All vulnerabilities
CRITICALWeb3exploited in the wild

WEB3-CREAM-FINANCE-2021

Web3 · Ethereum · Cream Finance

Summary

On October 27, 2021, lending protocol Cream Finance was drained of about $130 million in its third and largest exploit of the year. Using two coordinated addresses, the attacker took flash loans of roughly 500M DAI from MakerDAO and about $2B in ETH from Aave. They then manipulated the price-per-share oracle for Cream's yUSDVault (crYUSD) collateral: that price was computed as the vault's yUSD balance divided by yUSDVault totalSupply, so by redeeming roughly $500M of vault tokens they shrank totalSupply to about $8M while keeping vault value high, then donating/depositing ~$8M yUSD into the vault. This roughly doubled the perceived per-share value, so Cream valued the attacker's crYUSD collateral at about $3B instead of ~$1.5B, letting them borrow and drain the lending pools. The exploit wallet was funded via Tornado Cash about 30 minutes earlier. The attacker was never identified and the funds were not recovered.

How to avoid it in your code

  • Do not price collateral from a directly manipulable balance/totalSupply ratio; use manipulation-resistant oracles.
  • Sanity-bound per-share price changes per block and reject implausible swings.
  • Make pricePerShare resistant to single-transaction supply/balance manipulation (e.g. virtual offsets).
  • Apply borrow caps and conservative collateral factors on yield-bearing vault tokens.
  • Fuzz/invariant-test oracle pricing against flash-loan-driven mint/redeem sequences.

References

Related vulnerabilities

All Web3 →