Smart contract bugs / Who can call it?
Governance takeover
An attacker gets enough votes, often with borrowed tokens, and passes a proposal that sends the treasury to them. With no timelock, nobody can stop it.
14 real exploits · $257.5M lost
How the attack works
- Voting power is the token balance at the time of the vote, not at an earlier block.
- The attacker takes a flash loan of the governance token, or buys it cheaply in a low-liquidity market.
- The attacker creates and votes on a proposal that transfers the treasury or upgrades a contract.
- With no timelock and no quorum guard, the proposal executes before anyone reacts.
Vulnerable and fixed code
function vote(uint256 id) external {
votes[id] += token.balanceOf(msg.sender); // flash-loaned balance counts
}
function execute(uint256 id) external {
require(votes[id] > quorum);
proposals[id].target.call(proposals[id].data); // runs at once
}// OpenZeppelin Governor + ERC20Votes + TimelockController
function _getVotes(address a, uint256 timepoint, bytes memory)
internal view override returns (uint256)
{
return token.getPastVotes(a, timepoint); // snapshot before the proposal
}
// votingDelay > 0, votingPeriod of days, and a timelock of 2+ days on execution.Review checklist
- Count votes from a snapshot taken before the proposal (ERC20Votes
getPastVotes). - Use a voting delay, a voting period of several days and a timelock on execution.
- Give a guardian or security council the power to cancel a malicious proposal.
- Watch new proposals with a bot. A proposal that moves the treasury must alert the team.
How to test for it
- In a test, flash-mint governance tokens and vote in the same block. The vote must count zero.
Real exploits (14)
-
Beanstalk: Beanstalk lost about $181M when an attacker used flash-loaned funds to gain a governance supermajority and instantly executed a malicious emergency proposal (BIP-18) that sent all protocol assets to them.
Root cause and fix
Vulnerable code:
Diamond · emergencyCommit()Voting power was measured from tokens deposited in the same transaction, and an emergency proposal could be executed right away with no delay. The attacker first submitted a malicious BIP-18 and waited out the roughly one-day delay on normal governance actions. They then flash-borrowed DAI, USDC, USDT, BEAN and LUSD, added liquidity to Curve pools to get BEAN LP tokens, and deposited them into the Diamond to get voting power. They called vote(bip=18) and emergencyCommit(bip=18), which ran the attacker's init contract and moved all protocol assets to them. They then removed the liquidity, repaid the flash loans and swapped the profit to WETH.
What would have stopped it: Do not allow a proposal to be executed in the same block or transaction in which the voting power was acquired. Use snapshot-based voting power taken from earlier blocks, and add a mandatory timelock to emergency commits. Also require a vote threshold that cannot be reached with flash-loaned capital.
-
Compound Finance: Whale Humpy pushed Compound Proposal 289 through a low-turnout vote to move 499,000 COMP (about $24M) into a vault controlled by the Golden Boys multisig; the proposal was cancelled before funds were lost.
Root cause and fix
Compound's token-weighted voting let one large holder pass a proposal with only 57 addresses voting (682,191 for, 633,636 against). The proposal sent 499,000 COMP from the treasury to the goldCOMP vault. The Golden Boys multisig alone could withdraw (divest) from it, so the DAO could not recall the funds. Voter apathy and the lack of a safeguard such as a veto or an active timelock admin made this possible. Proposals 289 and 290 were cancelled after a compromise, so no funds were lost.
What would have stopped it: Use governance protections such as higher quorums, longer timelocks, and a guardian or community multisig able to cancel contentious proposals. Make DAO treasury investments recallable by the DAO. Vote-escrow or lock-based voting can also make a hostile majority harder to build.
-
BonkDAO: BonkDAO lost about $19.3M of BONK treasury when an attacker spent $4.4M buying enough tokens to pass a malicious proposal under a weak governance config.
Root cause and fix
Vulnerable code:
Realms (SPL Governance) BonkDAO configurationThe DAO's Realms governance config had a 1% community vote threshold, a 100 million BONK proposal creation threshold, and a zero-second instruction hold-up time, with direct treasury transfers allowed. An attacker submitted proposal BIP #76 ("Sowellian BonkDAO") on June 30, disguised as reform but containing a treasury transfer. On July 4-5 a separate wallet bought BONK on exchanges and borrowed more via marginfi to reach just over 1%, then voted yes on July 6 (turnout 2.9%). The transfer executed the moment the vote closed, with no review window or veto time.
What would have stopped it: Set a meaningful hold-up (timelock) period so the community can review and veto passed proposals before they execute. Raise quorum and proposal thresholds, and cap or add extra approval for treasury transfers. Monitor proposals so their actual instructions get reviewed.
-
Curio: Curio lost about $16M on Ethereum when an attacker used a small amount of CGT to gain voting power in its MakerDAO-style governance and minted huge amounts of CGT.
Root cause and fix
Vulnerable code:
IDSChief / IDSPause · cookCurio's governance contracts, forked from MakerDAO (IDSChief and IDSPause), had a flaw in how voting power was granted and checked. The attacker's contract (via its "cook" function) acquired a small number of CGT, locked them, and voted to gain control. This let the attacker run a delegatecall into a malicious contract through the pause mechanism, which minted a huge amount of CGT (about 996 billion remained held). The attacker then swapped and bridged tokens to cash out. The article does not give the exact code-level flaw.
What would have stopped it: Make sure voting power cannot be gained or inflated cheaply, and that a proposal needs real quorum and a timelock before it can run a delegatecall through the pause contract. Get an independent audit and test the forked governance code for privilege escalation.
-
Term Labs (Term Finance Meta Vaults): Term Labs lost about $8.5M from its Meta Vaults when an attacker bought a near-total share of thin voting supply and passed a proposal that disabled the timelock and drained the vaults.
Root cause and fix
Vulnerable code:
Aragon TokenVoting governance wrapper / Zodiac Delay module on Term Strategy Vaults · executeProposal()Voting power required wrapping vault shares into a governance token, and almost nobody did. With about 0.5 ETH the attacker held 90.7% of the ETH Meta Vault voting supply and all active voting power in the USDC vaults. Proposing needed zero voting power. The attacker filed a proposal disguised as a routine veto item, with 17 actions. The first actions set the Zodiac Delay cooldown and expiration to zero and enabled an attacker executor. The rest recalled funds from strategies, added an attacker-controlled strategy with a max uint256 debt limit, and moved the funds into it. Governance was allowed to reconfigure the delay module meant to restrain it.
What would have stopped it: Set a meaningful quorum measured against total vault shares, not just wrapped voting tokens. Require a minimum proposer voting power. Make the timelock and delay module immutable to governance proposals, and require a separate guardian or veto role for strategy additions and debt-limit changes.
-
X100 Senate: X100 Senate treasury lost about 4.75M USDT when an attacker used flash-loaned funds to take 2 of 3 senate seats and pass a treasury swap in one transaction, because the governance has no snapshot and no timelock.
Root cause and fix
Vulnerable code:
X100 Senate / Freezer / DexTreasury (0x79f35a33fe2813414851c4ae8daeacd14d822a46) · applyForSenate(), propose(), vote(), execute(), v3Swap()Senate seats are ranked by live frozen stake with no snapshot, and applyForSenate() is permissionless. propose(), vote() and execute() have no voting delay, so all three can run in one transaction, and 2 of 3 seats is enough to pass a proposal. The attacker flash-borrowed 1.94M USDT from Aave, bought 38,200 X, froze it across two helper contracts and took two seats. They then passed a v3Swap that sold 400,000 treasury X into an attacker-created thin PancakeV3 pool at a manipulated price (~0.0001 USDT per X). The treasury got ~35 USDT. The attacker burned their liquidity position to get the X back, sold it on the deep Uniswap pool and repaid the loan. The only remaining checks, dexSellCap and the _afterExecute balance check, did not stop a sale within the cap.
What would have stopped it: Use snapshot-based voting power (checkpointed at a block before the proposal) and enforce a voting delay and a timelock between propose, vote and execute. Make the treasury swap check the price against a trusted oracle or the deep pool, and only allow pools from a whitelist, not pools anyone can create.
-
Atlantis Loans: Abandoned BSC lender Atlantis Loans lost about $2.5M after an attacker passed a malicious governance proposal that took control of its token contracts.
Root cause and fix
The developers abandoned the protocol but left it live, and the only way to change or shut it down was through governance. Nobody watched governance, so the attacker pushed and voted through proposal 52 on 7 June. It gave them control of the token contracts. They upgraded those contracts to malicious versions and used them to move tokens from any address that still had active approvals to Atlantis contracts. An earlier attempt on 12 April had failed. The article does not say how the attacker got enough votes.
What would have stopped it: Before abandoning a protocol, shut it down properly: pause markets, let users withdraw, and renounce or lock upgrade rights. Add a timelock and sufficient quorum to governance, and monitor proposals even on defunct projects. Users should revoke old token approvals.
-
Tornado Cash Governance: Tornado Cash governance was taken over via a malicious metamorphic proposal contract (CREATE/CREATE2 plus selfDestruct) that granted the attacker 1.2M votes, and the attacker made about $750k by selling TORN.
Root cause and fix
Vulnerable code:
Proposal contract 0xC503893b3e3c0C6b909222b45f2a3a259a52752D (deployed via deployer contract 0x7dc8)Governance approved a proposal contract whose code could be changed after the vote. The attacker deployed it through a CREATE2 deployer contract that used CREATE (nonce 1), and the proposal had a hidden selfDestruct function. After approval, the attacker self-destructed the proposal and the deployer, which reset the nonce, and redeployed different malicious code at the same address. The new code gave 10,000 TORN to each of the attacker's addresses, which produced 1.2M votes against 700k legitimate votes and full control of governance. The attacker then sold TORN for 430 ETH.
What would have stopped it: Do not let governance execute proposal contracts that can contain selfDestruct or delegatecall. Check that the code hash of the proposal at execution time matches the hash that was reviewed and voted on, and reject proposals that were deployed by a CREATE2 factory. Review proposal code carefully and diff it against previous proposals.
-
Build Finance: Build Finance lost about $470k when an attacker passed a malicious proposal in its DAO governance, which approved the attacker to drain the governance contract's BUILD tokens.
Root cause and fix
Vulnerable code:
BuildGovernance · propose() / vote() / execute()The BUILD governance contract let an attacker with a small token balance create a proposal and pass it with a single vote, with no real quorum or protection against a hostile takeover. The attacker proposed a call that made the BUILD token approve the attacker's address for the maximum amount from the governance contract. After the voting period, the attacker called execute(), which ran the approval. They then used transferFrom to drain all BUILD held by the governance contract. The PoC shows a vote from one address passing the proposal.
What would have stopped it: Require a meaningful quorum and a minimum participation threshold, enforce a timelock and a proposal-power snapshot, and don't let a proposer's or a single voter's small stake pass a proposal that can approve treasury tokens. Restrict which targets and function calls a proposal may execute.
-
Yam Finance: Yam Finance lost about $121K (48 WETH + 763 UMA) when an attacker bought ~3.3% of YAM and passed a proposal in a dormant DAO, taking over the Timelock and draining legacy UMA farming contracts.
Root cause and fix
Vulnerable code:
YamGovernorAlpha · propose()The YAM DAO was dormant, so about 504K YAM (~3.3% of supply), self-delegated, cleared both the proposal threshold (1%) and the quorum (4%) with no opposing votes. The attacker proposed setPendingAdmin(attacker) on the Timelock, voted, queued, waited out the delay and executed it, which gave them admin control. Through the Timelock they cut the delay, made themselves gov of the UMAFarmingMar and UMAFarmingFeb contracts, called _settleExpired(), and then used the gov-only masterFallback() to transfer WETH and UMA out.
What would have stopped it: Retire or migrate the legacy contracts, and move the Timelock admin and farming gov to a renounced or safer owner when a DAO goes inactive. Set quorum and thresholds against active voter turnout, add a guardian or veto that can cancel suspicious proposals, and monitor proposals so the community can react during the timelock delay. Avoid a generic arbitrary-call escape hatch like masterFallback on contracts that hold funds.
4 more examples in the full guide.