Skip to content
NFTVenue Ledger
Directory

Cross Chain Bridge Validator Exploits

Read-Only Reentrancy Exploits: Curve get_virtual_price & Balancer getRate View Skews

Even when an AMM pool protects its own state with nonReentrant locks, external lending protocols reading get_virtual_price or getRate mid-ETH-callback ingest wildly inflated LP prices.

By Dr. Devon Kurosawa, PhDReview not recorded · Updated
Read-Only Reentrancy Exploits: Curve get_virtual_price & Balancer getRate View Skews — NFTVenue Ledger 2026 quantitative & supervisory data card
NFTVenue Ledger (Cross-Chain Bridge Verification Models, Oracle Manipulation & Exploit RCAs): Curve/Balancer mid-callback LP rate skews, VaultReentrancyLib, and Fair LP math.Source: NFTVenue Ledger Institutional Research DeskLicense: CC-BY-4.0

Classic Solidity courses teach that view functions (compiled to EVM STATICCALL) are harmless because they cannot modify storage. Read-Only Reentrancy shattered that myth across more than $120M in DeFi exploits (Sentiment, Midas Capital, Jarvis, Sturdy Finance, Era Lend)! Notice the diabolical twist: the AMM pool itself (Curve ETH/stETH or Balancer Weighted/ComposableStable Pool) was NOT drained and its own nonReentrant lock worked as intended for mutating calls—instead, an external Lending Market (VictimVault) called the AMM's unguarded view function get_virtual_price or getRate right in the middle of the AMM's native-ETH withdrawal receive callback, while the AMM's internal accounting was temporarily half-updated!

Anchored in our cross-chain bridge, oracle & exploit RCA master guide, auditing LP collateral adapters across ecosystems in our marketplaces directory—such as Balancer-powered Beethoven X (built on the Balancer LBP & Vault standard Balancer standard), Acala Swap, and Astroport—requires Cross-Contract Reentrancy Lock Inspection!

Step-by-Step Execution Trace of a 3.8x LP virtual_price Inflation Attack!#

Watch how an attacker flash-borrows 100,000 ETH, inflates a Curve/Balancer ETH/wstETH LP token price by +280% with zero net price impact, and drains VictimLendingMarket:

  1. Step 1 — Flash Deposit: Attacker flash-borrows 100,000 ETH + 100,000 wstETH and calls CurvePool.add_liquidity([100k, 100k]), minting ~200,000 LP tokens (depositing a small slice—say 5,000 LP—into VictimLendingMarket as collateral).
  2. Step 2 — Trigger remove_liquidity Callback: Attacker calls CurvePool.remove_liquidity(195,000 LP):
  • CurvePool first burns 195,000 LP (totalSupply drops immediately from 210,000 down to 15,000 LP!)!
  • CurvePool next sends 97,500 native ETH to the Attacker via attacker.call{value: 97,500e18}("")—BEFORE updating CurvePool.balances[0] and balances[1] (or BEFORE transferring Token #1 wstETH!)!
  1. Step 3 — Reenter VictimLendingMarket.borrow Inside receive!:
  • Inside Attacker.receive, CurvePool's invariant D still reflects the old un-decremented 105,000 wstETH (and/or un-decremented internal balances), while LP.totalSupply has already shrunk by -93%!
  • Attacker calls VictimLendingMarket.borrow(MAX) -> VictimOracle calls CurvePool.get_virtual_price = D / totalSupply -> get_virtual_price reads 3.80 ETH per LP instead of 1.02 ETH!
  1. Step 4 — Clean Exit: Attacker.receive returns cleanly; CurvePool finishes updating balances, Attacker repays the flash loan, and walks away with VictimLendingMarket's entire USDC/WBTC treasury!
Read-only reentrancy exploit call graph from AMM remove_liquidity ETH callback into Lending Oracle getRate
Read-only reentrancy exploit call graph from AMM remove_liquidity ETH callback into Lending Oracle getRateVerified Exhibit

How to Harden Oracle Adapters Against Read-Only Reentrancy!#

If you are building a lending market or structured vault accepting LP tokens (Curve, Balancer, Beethoven X, Velodrome), you cannot modify the already-deployed AMM pool bytecode—so your Oracle Adapter itself must detect whether the AMM's reentrancy lock is currently entered!

  • Balancer V2 / Beethoven X Vault Lock Check (ensureNotInVaultContext):

Balancer V2's Vault stores its global reentrancy semaphore on manageUserBalance. Calling VaultReentrancyLib.ensureNotInVaultContext(IVault(balancerVault)) (which executes a zero-op staticcall/view check reading the Vault reentrancy flag via manageUserBalance or EIP-1153 lock) reverts immediately if the call stack is currently inside ANY Balancer join/exit/swap callback!

  • Curve Pool Lock Check (withdraw_admin_fees / claim_admin_fees or Pool nonReentrant View):

Curve StableSwap-NG and Tricrypto-NG now apply @nonreentrant directly onto get_virtual_price! For legacy Curve pools whose get_virtual_price lacks @nonreentrant, the oracle adapter either invokes a lightweight state-noop gated by the pool's @nonreentrant lock (prior to STATICCALL boundary) or computes Fair LP Valuation mathematically from Chainlink/Pyth prices without trusting pool reserves at all!

LP Token Valuation Methods: Vulnerable vs Fair-Reserve Math#

Quantitative Distribution · Gas Cost
Gas Cost
01Raw pool.getvirtualprice P…~6,500g02Raw balancerPool.getRate (N…~9,000g03VaultReentrancyLib +NG Guar…~13,500g04Alpha Homora / Fair LP Pric…~18,000g
LP Oracle StrategyVulnerable to Read-Only Reentrancy?Vulnerable to Spot Flash-Swap Skew?Gas CostInstitutional Audit Verdict
Raw pool.get_virtual_price * P_ETH (Legacy Pool)YES (CRITICAL DRAIN!)Partially (Amplification A bounds)~6,500gBANNED in Lending Markets!
Raw balancerPool.getRate (No Context Check)YES (CRITICAL DRAIN!)Partially~9,000gBANNED without VaultReentrancyLib!
VaultReentrancyLib +NG Guarded getRateNO (Reverts on Active Lock)Bounded by A & fees~13,500gSafe when paired with Fair LP cap
Alpha Homora / Fair LP Pricing Formula Check totalSupply Sync! (Still check lock!)100% Immune to Reserve Skew!~18,000gGold Standard (Lock Check + Fair Math)
Vulnerability of LP collateral valuation formulas to reserve flash swaps and mid-withdrawal callback skews
Vulnerability of LP collateral valuation formulas to reserve flash swaps and mid-withdrawal callback skewsVerified Exhibit

Fair LP Valuation Formula (Constant-Product & Weighted Pools) + Lock Invariant#

Look closely at Bar #2 in our diagram above—a subtlety that caught even senior DeFi teams off guard: *Alpha Homora's Fair LP Formula (`2 sqrt(r0 * r1 * P0 * P1) / totalSupply) stops spot flash swaps, YET STILL FAILS under read-only reentrancy if you skip the AMM lock check**, because during the mid-withdrawal callback k = r0 * r1 has NOT shrunk yet while totalSupply` HAS shrunk! You MUST combine both:

Formula or model from the articleNot independently verified
1) Step 1 — Mandatory Counterparty AMM Reentrancy-Semaphore Assertion:
  • require(!CounterpartyPool.isReentrancyLocked, "ReadOnlyReentrancyDetected!");
  • // Balancer V2: VaultReentrancyLib.ensureNotInVaultContext(vault)
  • 2) Step 2 — Manipulation-Resistant Fair LP Token Price (Weighted Pool w1 + w2 = 1, Oracle Prices P1, P2):
  • Given verified post-lock invariant K = (r1 ^ w1) * (r2 ^ w2) and LP totalSupply S:
  • PLPfair = ( K / S ) * ( (P1 / w1) ^ w1 ) * ( (P2 / w2) ^ w2 )
  • Special Case (50/50 Constant Product x * y = k, w1 = w2 = 0.5):
  • PLPfair = ( 2 * sqrt(r1 * r2) * sqrt(P1 * P2) ) / S
  • Worked Audit Check:
  • Flash attacker swaps $50M into 50/50 ETH/USDC pool -> spot ratio skews 10x, YET invariant k = r1 * r2 only grows slightly by fees!
  • AND because Step 1 verified !isReentrancyLocked, k and S are 100% synchronized -> PLPfair shifts 0.00%!

Enforcing Universal Checks-Effects-Interactions & Transient Locks Next#

How should AMM and lending-protocol authors write their own contracts so neither mutating nor view functions ever expose an inconsistent intermediate state? Examine compiler-safe patterns next in CEI & ReentrancyGuardTransient engineering and cross-contract flash-swap drains inside our Cross-Chain Bridge & Oracle Security hub.

Frequently asked questions

How can a read-only view function be exploited by reentrancy if STATICCALL forbids state changes?

The attacker does NOT mutate the AMM during the reentrant call; instead, while the AMM is paused mid-withdrawal (having burned LP tokens before deducting reserves), the attacker calls a separate Lending Market whose oracle reads the temporarily inflated view price.

What caused the July 2023 $70M Curve Vyper compiler reentrancy exploit?

Vyper versions 0.2.15, 0.2.16, and 0.3.0 contained a compiler bug generating separate @nonreentrant storage slots per function instead of sharing one lock key—allowing add_liquidity to be called inside remove_liquidity native-ETH callbacks.

How does Balancer VaultReentrancyLib.ensureNotInVaultContext work inside a view oracle?

In Balancer V2 hardened libraries, an oracle adapter executes a low-gas call probing the Vault reentrancy semaphore; if the Vault is currently mid-join/exit/swap, the probe reverts the entire transaction.

Why is Alpha Homora Fair LP math alone insufficient against read-only reentrancy?

Fair LP math replaces manipulable reserve ratios r1/r2 with invariant sqrt(r1*r2)/totalSupply; however, during a mid-withdrawal callback, totalSupply has already decreased while r1*r2 has not, so sqrt(r1*r2)/totalSupply still inflates wildly!

Publication record

Published
November 13, 2026
Updated
November 14, 2026
Author
Dr. Devon Kurosawa, PhD
Review
Review not recorded
Automated fact check
Passed in the stored pipeline record
Source URLs
3 recorded

AI assistance recorded: anthropic/claude-opus-4.6. This field does not establish human review or source verification.

Academic & Institutional Attribution

Cite This Research & Embed Live Data Card

Open Attribution License (CC BY 4.0)

Standard academic & institutional research paper citation format.

Dr. Devon Kurosawa, PhD. (2026, November 14). Read-Only Reentrancy Exploits: Curve get_virtual_price & Balancer getRate View Skews. NFTVenue Ledger. https://nftvenueledger.com/protocols/read-only-reentrancy-balancer-curve-lp-virtual-price-skew

Regulatory Directory Cross-Reference

Referenced Institutions & Regulatory Registries

Primary Tier-1 Supervisory Registries

Explore Cross Chain Bridge Validator Exploits Hub (20) →

NFTVenue Ledger Data, Benchmarks & Contributor Records

Read-Only Reentrancy: Curve & Balancer LP Oracle Exploits | NFTVenue Ledger