Aller au contenu
Skillpedia
Sécurité6.5k · #14008

contracts-governance-attack

Ce qu’il fait

Cette skill couvre les façons de capturer le vote d'une DAO, comme l'utilisation de jetons empruntés pour un seul vote. Elle s'adresse aux auditeurs et aux équipes qui conçoivent la gouvernance on-chain.

Quand l’utiliser

  • ✓Quand vous examinez une DAO dont les votes utilisent les soldes actuels de jetons plutôt que des instantanés passés.
  • ✓Quand un contrat de gouvernance détient des jetons et les délègue à lui-même.
  • ✓Quand vous voulez vérifier les règles de quorum, de limites de propositions et de délai de verrouillage (timelock).

Lien du skill

https://github.com/BitterSecurity/Decepticon/blob/main/packages/decepticon/decepticon/skills/standard/contracts/governance-attack/SKILL.md

Copiez-le et collez-le dans votre IA (Claude, ChatGPT ou Cursor) en lui demandant de suivre les instructions.

Comment l’utiliser

Le plus simple : copiez le message et collez-le dans votre IA. Elle lit le skill et suit les instructions.

Message prêt à coller

Utilise ce skill pour m’aider : https://github.com/BitterSecurity/Decepticon/blob/main/packages/decepticon/decepticon/skills/standard/contracts/governance-attack/SKILL.md Lis le fichier SKILL.md de ce lien et suis ses instructions pour ma tâche.
Envie que votre IA trouve seule des skills comme celui-ci ?Installez le MCP gratuit de Skillpedia : une ligne, et elle cherche parmi 15 000+ skills avant chaque tâche.Installer en 1 minute →

Exemple de demande à votre IA

“Pouvez-vous vérifier si le vote de notre DAO pourrait être capturé avec un prêt de jetons de courte durée ?”

5 nouveaux skills par semaine. 1 minute de lecture.

Comment ça marche

L'agent vérifie si les votes utilisent des instantanés passés, revoit la délégation et les délais de verrouillage, puis signale les chemins de gouvernance à renforcer.

Contenu technique (SKILL.md original)

Texte original de l’auteur, en anglais, directement depuis 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
Questions fréquentes

Comment un vote par instantané aide-t-il ?

Le pouvoir de vote est mesuré à un bloc passé, donc un prêt pris dans la même transaction ne compte pas.

Que s'est-il passé dans le cas Beanstalk ?

La skill cite une perte d'environ 182 millions de dollars en avril 2022, due à un vote dans le même bloc.

Couvre-t-elle les contournements d'urgence ?

Oui. Elle cite le contournement d'urgence des délais de verrouillage par un multisig comme schéma à revoir.

Détails

Description originale de l’auteur

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.

repo: BitterSecurity/Decepticon

Popularité

Étoiles GitHub
6.5k
Position au classement
#14008
Licence
Apache-2.0
Mis à jour
01/11/2026

Ce skill vous est-il utile ?

0

Connectez-vous pour voter.

Commentaires

  • …

Autres skills de ce dépôt

Skills similaires