contracts-governance-attack
What it does
This skill covers ways DAO voting can be captured, such as using borrowed tokens for a single vote. It is for auditors and teams designing on-chain governance.
When to use it
- βWhen you review a DAO whose votes use current token balances instead of past snapshots.
- βWhen a governance contract holds tokens and delegates them to itself.
- βWhen you want to check quorum, proposal limits and timelock rules.
Skill link
https://github.com/BitterSecurity/Decepticon/blob/main/packages/decepticon/decepticon/skills/standard/contracts/governance-attack/SKILL.mdCopy it and paste it into your AI (Claude, ChatGPT or Cursor), asking it to follow the instructions.
How to use
The easiest way: copy the message and paste it into your AI. It reads the skill and follows the instructions.
Ready-to-paste message
For Claude Code, Codex or Cursor: run it in your project folder and the skill gets installed.
Download the SKILL.md and drop it into your agentβs skills folder.
Example of what to ask your AI
βCan you check whether our DAO's voting could be captured with a short-term token loan?β
5 new skills a week. 1 minute to read.
How it works
The agent checks whether votes use past snapshots, reviews delegation and timelocks, and reports the governance paths that need hardening.
Technical content (original SKILL.md)
Original text by the author, straight from GitHub.
DAO Governance Attack
Attack classes
1. Flash-loan-backed vote
DAOs that grant voting power = current token balance (not snapshot of past balance) are vulnerable:
// Attack: borrow governance token, vote, return loan, all in one tx
function attack() external {
// 1. Flash-borrow gov tokens
IFlashLoan(aave).flashLoan(address(this), govToken, 1_000_000e18, "");
}
function executeOperation(...) external {
// 2. Vote on the malicious proposal
governor.castVote(proposalId, 1); // 1 = for
// 3. Repay loan + premium (automatic by flash-loan callback)
}
This is what happened to Beanstalk (April 2022, $182M loss) β attacker flash-borrowed Beanstalk gov tokens, voted to drain the treasury, repaid the loan. Same block.
Defense check: Does getVotes(address, blockNumber) reference a past snapshot? If yes (Compound's GovernorBravo pattern, OZ Governor with ERC20Votes + getPastVotes), flash-loan vote doesn't work.
2. Delegation hijack
ERC20Votes lets users delegate. If a contract holds gov tokens and delegates to itself, controlling that contract = controlling the votes.
// If the target DAO has a contract holding tokens that delegates to itself,
// and that contract is upgradeable/has an admin function:
upgradeableContract.upgradeAndCall(newImpl, abi.encodeWithSelector(redelegate.selector, attacker));
// Now attacker controls those votes.
3. Quorum dilution attack
If quorum = % of total supply (not % of currently-active voters), an attacker can mint or stake extra tokens to push quorum out of reach:
// Some DAOs base quorum on totalSupply()
// Attacker mints a bunch of tokens to themselves (via legit minting if they're holder)
// Quorum requirement now too high for real voters to meet β all proposals fail
4. Proposal spam DoS
GovernorBravo has a proposalThreshold. If low, attacker spams proposals to:
- Burn proposers' gas
- Confuse the UI
- Push real proposals out of the active window
5. Time-lock bypass via emergency multisig
Most DAOs have a "Security Council" or "Emergency Multisig" that can execute without time-lock for emergencies. If signers can be socially engineered, phished, or are compromised: instant treasury drain.
Check: timelock.executor() β if it's a multisig and you can compromise N-of-M signers, the time-lock is illusory.
6. Snapshot vs. on-chain desync
Off-chain Snapshot.org votes use signed messages. If the DAO trusts Snapshot results and executes via a relayer:
- Forge votes by sniping pending signed messages
- Bribe voters off-chain (cheaper than on-chain)
- Replay signed messages on a fork
7. Proposal-script slippage
GovernorBravo proposals execute calldata. If the proposal description and the actual calldata don't match, voters approve one thing while approving another:
// Description: "Allocate 1000 USDC to grants"
// Actual calldata: transfer(attacker, 1_000_000e6)
// Voters who don't decode calldata get rugged.
Recon
# Identify the governance contract
cast call --rpc-url $RPC $TIMELOCK "getMinDelay()(uint256)"
cast call --rpc-url $RPC $GOVERNOR "votingPeriod()(uint256)"
cast call --rpc-url $RPC $GOVERNOR "proposalThreshold()(uint256)"
cast call --rpc-url $RPC $GOVERNOR "quorum(uint256)(uint256)" $BLOCK
# Compound/Aave/Uniswap-style: Get GovernorBravo state
forge inspect GovernorBravoDelegate storage-layout
# List active proposals
cast logs --rpc-url $RPC --address $GOVERNOR \
--from-block latest:-1000 \
"ProposalCreated(uint256,address,address[],uint256[],string[],bytes[],uint256,uint256,string)"
Defender's checklist (the audit you're trying to defeat)
| Defense | Bypass |
|---|---|
getVotes uses past-block snapshot |
Can't flash-loan-vote β find delegation-hijack instead |
| Two-step time-lock (queue + execute) | Can't bypass without compromised emergency multisig |
proposalThreshold > 0 |
Can't spam β but might still be cheap |
| Off-chain vote (Snapshot) β on-chain by N-of-M multisig | Replace at the multisig layer |
Tooling
# Tally, Boardroom β DAO dashboards (find target governance contracts)
# Forge / Foundry β simulate the attack on a fork
forge test --fork-url $RPC --match-test test_governance_drain
# Tenderly β live transaction simulation against fork
References
- "Beanstalk Governance Attack" post-mortems (Beanstalk Farms, April 2022)
- Compound GovernorBravo audit reports (OpenZeppelin)
- "Slip
FAQ
How does a snapshot vote help?
Voting power is measured at a past block, so a loan taken in the same transaction does not count.
What happened in the Beanstalk case?
The skill cites an April 2022 loss of about 182 million dollars from a same-block vote.
Does it cover emergency bypasses?
Yes. It names an emergency multisig bypass of timelocks as a pattern to review.
Details
Original description by the author
DAO governance attack β flash-loan-backed vote manipulation, delegation hijack, quorum dilution, proposal-spam DoS, time-lock bypass via emergency multisig, snapshot vs. on-chain vote desync, Compound/Aave/Uniswap-style GovernorBravo abuse.
Popularity
- GitHub stars
- 6.5k
- Ranking position
- #14008
- License
- Apache-2.0
- Updated
- 11/1/2026
Comments
- β¦
More skills from this repository
detector-overview
6.5kHelps your agent read code that a scanner flagged and decide which flagged spots are real security bugs and which are false alarms.
exploiter-overview
6.5kHelps your agent join several confirmed security weaknesses into one test chain and check how far that chain could reach.
llm-redteam-overview
6.5kHelps your agent find the right AI red-team guide for a test, covering 15 tactic groups from prompt injection to model abuse.
aatmf-t01-prompt-injection
6.5kExplains prompt injection, where hidden instructions try to override an AI system, so security testers can check for it.
Similar skills
reverse-engineer-anything
422kHelps your agent look inside shipped apps and packages to explain features, compare versions, or guide a rebuild, using the REA tool.
1password
394kHelps your agent set up the 1Password CLI, sign in, and read or inject secrets without printing their values into chat.
healthcheck
394kHelps your agent audit the computer or server that runs OpenClaw for security risks, such as SSH, firewall, updates, and backups, then suggest safe fixes.