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.

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:
Step 1— Flash Deposit: Attacker flash-borrows100,000 ETH+100,000 wstETHand callsCurvePool.add_liquidity([100k, 100k]), minting~200,000 LPtokens (depositing a small slice—say 5,000 LP—into VictimLendingMarket as collateral).Step 2— Triggerremove_liquidityCallback: Attacker callsCurvePool.remove_liquidity(195,000 LP):
CurvePoolfirst burns195,000 LP(totalSupply drops immediately from 210,000 down to 15,000 LP!)!CurvePoolnext sends97,500 native ETHto the Attacker viaattacker.call{value: 97,500e18}("")—BEFORE updatingCurvePool.balances[0]andbalances[1](or BEFORE transferring Token #1 wstETH!)!
Step 3— ReenterVictimLendingMarket.borrowInsidereceive!:
- Inside
Attacker.receive,CurvePool's invariantDstill reflects the old un-decremented105,000 wstETH(and/or un-decremented internal balances), whileLP.totalSupplyhas already shrunk by-93%! - Attacker calls
VictimLendingMarket.borrow(MAX)->VictimOraclecallsCurvePool.get_virtual_price = D / totalSupply->get_virtual_pricereads3.80 ETHper LP instead of1.02 ETH!
Step 4— Clean Exit:Attacker.receivereturns cleanly;CurvePoolfinishes updatingbalances, Attacker repays the flash loan, and walks away withVictimLendingMarket's entire USDC/WBTC treasury!
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_feesor PoolnonReentrantView):
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#
| LP Oracle Strategy | Vulnerable to Read-Only Reentrancy? | Vulnerable to Spot Flash-Swap Skew? | Gas Cost | Institutional Audit Verdict |
|---|---|---|---|---|
Raw pool.get_virtual_price * P_ETH (Legacy Pool) | YES (CRITICAL DRAIN!) | Partially (Amplification A bounds) | ~6,500g | BANNED in Lending Markets! |
Raw balancerPool.getRate (No Context Check) | YES (CRITICAL DRAIN!) | Partially | ~9,000g | BANNED without VaultReentrancyLib! |
VaultReentrancyLib +NG Guarded getRate | NO (Reverts on Active Lock) | Bounded by A & fees | ~13,500g | Safe when paired with Fair LP cap |
| Alpha Homora / Fair LP Pricing Formula | Check totalSupply Sync! (Still check lock!) | 100% Immune to Reserve Skew! | ~18,000g | Gold Standard (Lock Check + Fair Math) |
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:
- 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
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-skewRegulatory Directory Cross-Reference
Referenced Institutions & Regulatory Registries
Top Regulated Institutions in This Coverage Slice
Primary Tier-1 Supervisory Registries
Related Cross Chain Bridge Validator Exploits & Institutional Briefings
Explore Cross Chain Bridge Validator Exploits Hub (20) →Cross Chain Bridge Validator Exploits
Cross-Chain Bridge Verification, Oracle Manipulation & DeFi Exploit Root-Cause Guide (2026)Cross Chain Bridge Validator Exploits
Checks-Effects-Interactions (CEI), Cross-Contract Locks & Cancun EIP-1153 Transient GuardsCross Chain Bridge Validator Exploits
Flash-Loan Governance Attacks: Quorum Hijacking, ERC20Votes Checkpoints & Timelock DefensesCross Chain Bridge Validator Exploits
ERC-4626 Tokenized Vault Security: First-Depositor Share Inflation & Virtual-Offset MathCross Chain Bridge Validator Exploits
Merkle Tree Second-Preimage Attacks, abi.encodePacked Collisions & Bridge Proof ForgeryCross Chain Bridge Validator Exploits
ERC-7265 Smart-Contract Circuit Breakers: Rolling Outflow Rate Limiters & Delayed SettlementCross Chain Bridge Validator Exploits
L2 Sequencer Downtime Oracles: Chainlink Uptime Feeds, Grace Periods & L1 Force-InclusionCross Chain Bridge Validator Exploits
Foundry Stateful Invariant Fuzzing, Handler Ghost Variables & Halmos Symbolic Bytecode ProvingOnchain Wash Trading Market Abuse
Industrial Airdrop Sybil Detection: Louvain/Leiden Modularity, Gas Trees & Action Sequence CosineOnchain Wash Trading Market Abuse
Bonding-Curve Launches, Block-0 Sniper Bundles & Coordinated Rug-Pull On-Chain TelemetryOnchain Wash Trading Market Abuse
Benford's Law, Power-Law Tails & Trade-Size Forensics on Crypto ExchangesOnchain Wash Trading Market Abuse
Cross-Chain Laundering Forensics: Peel Chains, Bridge-Hop Tracing & Taint-Accounting Models
NFTVenue Ledger Data, Benchmarks & Contributor Records
CC BY 4.0 Open Data
Open Institutional Datasets (CSV / JSON) →
Download desk-compiled quantitative series & schemas.
2026 Reference Matrix
2026 Institutional Benchmarks & Thresholds →
Statutory capital, clearing, margin & rate conventions.
Editorial Records
Authors & Review Records →
View named contributors where those records are available.
Complete Index
Master Research & Dossier Archive →
Browse all published briefings by topic pillar & date.
