Toutes les vulnérabilités
CRITICALWeb3exploited in the wild

WEB3-BEANSTALK-2022

Web3 · Ethereum · Beanstalk Farms

Résumé

On April 17, 2022, the Beanstalk stablecoin protocol was drained of about $182 million in a governance attack amplified by a flash loan, netting the attacker roughly $80 million after repaying the loan. The attacker borrowed about $1 billion across Aave and other venues (350M DAI, 500M USDC, 150M USDT plus BEAN and LUSD), deposited it into Curve to mint roughly 795M BEAN3CRV-f and 59M BEANLUSD-f LP tokens, and supplied them to Beanstalk's Silo to instantly hold a supermajority (over 78%, above the two-thirds threshold) of STALK governance power. Beanstalk's emergencyCommit path let a proposal pass once 24 hours had elapsed and a two-thirds vote existed; the attacker had pre-submitted a malicious BIP (BIP-18) whose init contract transferred the protocol's funds, then executed emergencyCommit in a single transaction. The core flaw was that voting power could be acquired flash-loan-instantly with no time-lock against single-block voting. Funds were laundered through Tornado Cash and never recovered; the attacker remains anonymous.

Comment l’éviter dans votre code

  • Use flash-loan-aware governance: snapshot voting power at a prior block, not at execution time.
  • Enforce timelocks between proposal submission, voting, and any fund-moving execution.
  • Require deposited governance stake to mature before it confers voting weight.
  • Restrict emergency-execution paths and forbid them from calling arbitrary fund-transfer init contracts.
  • Add invariant tests that single-transaction governance cannot move protocol funds.

Références

Vulnérabilités liées

Tout Web3 →