OFFCODE
Sign inCreate account

Case study Curve Pool exploit 2023: o reentrancy attack que abalou DeFi

Análise técnica do exploit em pools Curve Finance em julho de 2023 — $70M+ loss, white hat recovery, Vyper compiler bug, e implicações para DeFi audit standards.

02/05/2026 · 6 min de leitura · CaseStudy · Curve · Exploit · DeFi

O exploit

Em 30 julho 2023, multiple pools em Curve Finance (DEX especializada em stablecoins e correlated assets) foram exploradas em ataque coordenado. Affected pools: pETH/ETH, msETH/ETH, alETH/ETH, CRV/ETH. Total damage: ~$70 million em initial exploit phase.

Vulnerability: reentrancy bug em specific Vyper compiler versions (0.2.15, 0.2.16, 0.3.0). When user added/removed liquidity em affected pools, reentrancy was possible em fallback function execution. Attacker could repeatedly remove liquidity in single transaction.

A root cause: Vyper compiler

Vyper é programming language for Ethereum smart contracts (alternative to Solidity). Designed for security/clarity emphasis.

Bug em compiler: reentrancy locks em specific Vyper versions were not properly emitted. Vyper code declaring '@nonreentrant' didn't reliably prevent reentrancy at bytecode level.

Affected versions: only 0.2.15, 0.2.16, 0.3.0. Newer e older versions correctly implemented locks.

Curve had used affected Vyper versions for certain pool deployments. Other pools using newer/older Vyper versions or Solidity were not affected.

The exploit chain

Step 1: attacker added liquidity to affected pool (e.g., pETH/ETH).

Step 2: triggered remove_liquidity function. Vyper compiler bug allowed reentrancy in token transfer callback.

Step 3: during reentrancy, attacker called pool functions reading stale state — pool incorrectly calculated remaining balances.

Step 4: attacker received more tokens than legitimate withdrawal would allow.

Step 5: repeated across multiple pools using same approach until pools were drained.

Response coordination

Multiple security researchers immediately recognized exploit signature on-chain. Coordinated response via Discord/Telegram groups (Pwning Era, security alliance).

Curve team paused affected pools where possible (some can't be paused due to immutability — design choice).

MEV bots responded: multiple bots front-ran some attack transactions, capturing stolen funds before attacker could withdraw fully.

White hat recovery: several front-running bots returned captured funds. Approximately $24M was recovered via MEV operators returning stolen funds to Curve.

CRV token dump risk

Curve founder Michael Egorov held large amounts of CRV token used as collateral on various DeFi lending protocols (Aave, Frax). Total collateral loans ~$100M against CRV.

Exploit caused CRV price to drop (initially -30% on the day). Risk: cascading liquidations of Egorov's loans could trigger fire-sale of CRV at depressed prices, further crashing token e potentially crashing related stablecoins (crvUSD, etc).

Cascade prevention: TechBros (multiple major DeFi figures) coordinated OTC purchase of CRV from Egorov at agreed prices. Reduced his loan exposure, prevented forced liquidations. Cascade averted.

Final tally

Total lost: ~$70M initial exploit.

Recovered via white hats: ~$50M ultimately returned to affected pool LPs.

Net loss: ~$20-25M (significant but bounded compared to many other DeFi exploits).

Affected pools relaunched after Vyper compiler fix. CRV price recovered over weeks.

Industry implications

Lição 1: even battle-tested code can have undiscovered bugs. Curve was one of most respected, audited protocols. Vyper compiler had been used em production for years. Bugs surface unexpectedly.

Lição 2: language/compiler diversification has costs. Vyper was chosen for security benefits but specific compiler versions had bugs not found in Solidity. Trade-off em tooling depth.

Lição 3: MEV community can be net-positive. Many front-running bots are extractive, but in this case they protected funds. White hat recovery patterns developed post-Curve.

Lição 4: founder concentration of governance tokens used as collateral is systemic risk. Egorov's CRV position threatened broader market until coordinated rescue. Post-incident, multiple DeFi tokens experienced governance reviews of similar concentration risks.

Lições enduring para o user

Diversificação entre pools: don't concentrate liquidity em single pool, even em established protocols.

Time horizon awareness: DeFi protocols accumulate risk over time. Older code é often more battle-tested, but new features can introduce new bugs.

Insurance options: protocols like Nexus Mutual, InsurAce offer cover policies for DeFi protocol exploits. Premiums vary, but for significant LP positions, can be worthwhile.

Liquidity provision is NOT 'staking' or 'savings.' LPs bear impermanent loss + smart contract risk + protocol governance risk + composability risk.

Para o usuário OFFCODE: spot trading na exchange centralizada não expõe a smart contract risk. DeFi engagement via self-custody wallet expõe à plena DeFi risk surface. Choose accordingly based on risk tolerance.

Aviso YMYL: DeFi has accumulated $5+ billion in lifetime exploits. While ecosystem is more secure each year, residual risk is permanent. Diversification across protocols, sizing limits, e periodic withdrawal of yields back to safer holdings é prudent strategy.

← Todos os artigos