Curve DEX Hack
What happened
On July 30, 2023, exploiters drained several Curve Ethereum liquidity pools after a Vyper compiler flaw disabled the pools' intended cross-function reentrancy protection.
Vyper versions 0.2.15, 0.2.16, and 0.3.0 incorrectly allocated a distinct storage lock to each use of a named nonreentrant decorator. Functions intended to share one lock therefore allowed cross-function reentrancy. In affected Curve pools, native-ETH calls could transfer execution before storage updates, enabling stale-balance LP accounting.
How it happened
Affected pools compiled with vulnerable Vyper releases made native-ETH calls before completing sensitive accounting. The compiler assigned separate storage locks to functions that shared the same nonreentrant key, so an attacker could re-enter between removing and adding liquidity while pool balances were stale. That let the attacker mint an inflated LP claim and withdraw pool assets after repaying flash-loan capital.
Protocol details
Evidence
Proof of concept
1 availableSources
- report @spreekaway incident report twitter.com
- report Vyper technical postmortem hackmd.io
- report Curve pool reentrancy exploit postmortem llamarisk.com
- code Vyper compiler security advisory github.com
- analysis Website reference hackmd.io
- analysis DeFiLlama defillama.com
- analysis Curve DAO LP recompensation proposal gov.curve.finance
Understand the attack patterns
Build your security review skills
Work through hands-on labs covering real exploit mechanics, review techniques, and defensive patterns.