Curve DEX Hack

Reported loss $61.7M
Ethereum
Cross-function reentrancy from Vyper compiler bug

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.

Technical root cause

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

Classification Reentrancy
Protocol Type DEX
Implementation language Vyper
Protocol links Website @CurveFinance

Understand the attack patterns

Build your security review skills

Work through hands-on labs covering real exploit mechanics, review techniques, and defensive patterns.