Hack Analysis Beanstalk Governance Attack April 2022
Beanstalk's governance allowed a proposal to be voted on and executed in the same transaction via an emergency commit function, so an attacker used a flashloan to gain a supermajority of voting power and pass a malicious proposal that drained protocol funds. The attacker made off with a large amount of illicit profit, though the team later burned part of the stolen assets.
immunefi.com
Published on immunefi.com
Beanstalk, a permissionless fiat stablecoin protocol, was the victim of a whopping $181m hack on April 17, 2022, which leveraged the lack of execution delay to push through a malicious governance proposal.
The full write-up lives on its author's site
It belongs to its author, so we link to it rather than copy it. The other two tabs are our own rewrites, checked against it.
Not written yet. The AI write-up for this write-up has not been written yet. The Original tab links to the source.
How it worked
Impact
The attacker could drain protocol funds, though the text notes only around $77m of non-Bean assets were stolen and the rest was burned by the team.
What the attacker needed
About 70 ETH to submit a proposal; flashloan liquidity of over $1 billion; one day between proposal and execution
The fix
The text says Beanstalk removed the GovernanceFacet and replaced the on-chain governance mechanism with a community-run multisig wallet.
How it was found
- Swap ETH for BEAN and deposit it into Beanstalk to submit a malicious proposal.
- Wait one day for the proposal to become eligible for emergency execution.
- Flashloan large amounts of DAI, USDC and USDT from Aave.
- Deposit the stablecoins into Curve pools to obtain BEAN3CRV-f tokens.
- Deposit the BEAN3CRV-f tokens into Beanstalk to gain voting power and call emergencyCommit.
- Swap the drained BEAN3CRV-f back to stablecoins and repay the flashloan, keeping the profit.
Explained by bugbounty.wiki with AI from the original and checked against quotes from it; it can still be wrong. Read the original before relying on a detail.
Not written yet. The AI write-up for this write-up has not been written yet. The Original tab links to the source.
A flashloan is a loan that must be borrowed and repaid within one transaction, so no money is needed upfront. Beanstalk let people vote on and run a proposal in the same transaction, so someone could borrow a huge amount, use it to vote, run their own proposal, and repay the loan all at once. That let the attacker take funds that belonged to the protocol.
What is Business logic?
The application works as coded but not as intended: a negative price, a skipped payment step, a limit that can be crossed.