Toutes les vulnérabilités
CRITICALWeb3

WEB3-SONNE-2024

Web3 · Optimism · Sonne Finance (Compound v2 fork)

Résumé

On May 14, 2024 Sonne Finance, a Compound v2 lending fork on Optimism, lost about $20 million when an attacker exploited a freshly created, low-liquidity VELO (Velodrome) market. Because market creation and the protective collateral-factor setup were split across timelocked permissionless transactions two days apart, the attacker acted inside the window before the market was safely seeded. The attacker minted the minimum amount of soVELO cTokens (1 wei) and then donated a large quantity of VELO directly to the soVELO contract, inflating totalCash while totalSupply stayed near zero. Since exchangeRate equals (totalCash + totalBorrows - totalReserves) / totalSupply, this empty-market rounding manipulation drove the cToken exchange rate up so the tiny share position was valued as enormous collateral. The attacker then borrowed roughly 265 WETH plus available USDC.e against the over-valued collateral, draining about $20M within about 25 minutes.

Comment l’éviter dans votre code

  • Never let a market go live with zero or near-zero total supply; require a protocol-owned initial mint and burn of cTokens before enabling collateral.
  • Compute exchangeRate from internally tracked cash rather than token.balanceOf so direct donations cannot inflate totalCash.
  • Round in the protocol's favour and reject mints that produce zero or dust cToken amounts in empty markets.
  • Make market creation and collateral-factor activation atomic, removing the timelock window an attacker can act within.
  • Cap per-block exchangeRate growth and validate collateral value against an external price reference.

Références

Vulnérabilités liées

Tout Web3 →