OAK — OnChain Attack Knowledge

Worked example · 2021-20

Governance Timelock Design Anti-Pattern Cohort — 2021–2025 — Amplification Factor Across Multiple Technique Classes

Loss
The timelock-free governance design anti-pattern (T16.006) is an amplification surface rather than an extraction mechanism — it does not directly cause loss but converts any governance-compromise event (T16.001 flash-loan voting, T16.003 delegation-cluster takeover, T16.005 malicious proposal snowballing, T11.x multisig compromise) from a time-delayed extraction with a mandatory user-observation window into an instantaneous extraction with no user exit window. The loss attributable to the absence of a timelock is the incremental extraction that could have been prevented had users been given the standard 24–72 hour exit window between governance approval and execution. Across the named cases in this cohort, the amplification factor is substantial: Beanstalk (~$182M, no timelock), Compound Proposal 289 (~$24M prevented by timelock review), Tornado Cash (~$1M, no effective timelock for the self-modifying-contract payload). The gap between prevented and realised extraction across these cases is the most direct measurement of the timelock's defensive value.
OAK Techniques observed
OAK-T16.006 (Timelock-Free Protocol Upgrade Execution — the governance design anti-pattern in which the protocol's upgrade authority can execute a protocol upgrade without a mandatory timelock delay between governance approval and on-chain execution. Four sub-shapes: proxy-admin instant upgrade, governance-executor direct execution, multisig-direct upgrade authority, and governance-overrideable timelock.) OAK-T16.001 (Flash-Loan Governance Vote Manipulation — the flash-loan-as-voting-power-primitive, structurally amplified by the absence of a timelock: a mandatory timelock would force the attacker to hold borrowed governance tokens across blocks, making the flash-loan primitive infeasible.) OAK-T9.003 (Governance Attack — the parent-class Technique covering governance capture generally; T16.006 is the governance-design decision that determines the blast radius of any T9.003-class governance compromise.)
Attribution
unattributed — T16.006 is a governance-design decision rather than an individual-actor exploit. The protocols named in this cohort made independent governance-design choices about timelock presence, duration, and overrideability. No single actor is responsible for the anti-pattern; the pattern recurs across independent protocol teams because the defensive value of a timelock is not always salient at protocol-launch time, when governance throughput is prioritised over governance security.
Key teaching point
The timelock is the single most load-bearing defense-in-depth primitive at the governance layer — and its absence (T16.006) is the single highest-leverage amplification surface across the entire governance-attack Technique family (T16.001, T16.003, T16.005, T11.x). A protocol without a mandatory timelock between governance approval and execution is structurally undefended against any governance-compromise event, regardless of its quorum threshold, multisig hardening, proposal-review process, or governance-token distribution. The timelock does not prevent governance capture — but it converts governance capture from an instantaneous extraction into a time-delayed extraction with a mandatory user-observation window, which is a categorically different risk profile. The three numbers that measure the timelock's defensive value: Beanstalk (~$182M, no timelock, fully extracted) vs. Compound 289 (~$24M, timelock present, fully prevented) vs. Tornado Cash (~$1M, timelock present but proposal-payload review not performed, extracted and partially returned).

Summary

The governance timelock design anti-pattern is the most structurally significant governance-security finding in the OAK corpus because it amplifies every other governance-attack Technique. A protocol that is vulnerable to T16.001 (flash-loan vote manipulation), T16.003 (delegation-cluster vote takeover), T16.005 (malicious proposal snowballing), or T11.x (multisig compromise) faces a categorically different risk depending on whether a mandatory timelock exists between governance approval and on-chain execution.

The Timelock as Load-Bearing Defense-in-Depth

The timelock serves two distinct defensive functions:

  1. User-exit window. Between governance approval and execution, users — particularly large LPs and institutional participants — can observe the queued upgrade, evaluate its correctness, and exit their positions before execution. This converts a governance-compromise event from a 100%-extraction event (attacker drains everything, all users lose) into a partial-extraction event (attacker drains the residual TVL after users who monitored the timelock window have exited).

  2. Governance-review window. Between governance approval and execution, governance participants, security researchers, and the broader community can review the queued proposal's calldata, verify that the execution payload matches the proposal text, and deploy counter-proposals or emergency interventions. The Compound 289 case (July 2024) is the canonical validation: the malicious proposal passed the on-chain vote, but the timelock window provided sufficient time for the community to recognise the self-dealing pattern, deploy an emergency counter-proposal, and cancel the treasury action before execution.

For T16.001 specifically, the timelock serves a third, more fundamental function: it makes the flash-loan primitive structurally infeasible. A flash loan must be repaid within the same transaction. If a mandatory timelock exists between proposal approval and execution, the attacker cannot execute the malicious proposal in the same transaction as the flash loan — they must hold the borrowed governance tokens across the timelock duration (typically 24–72 hours), which is economically infeasible at the scale required for governance capture. The timelock converts T16.001 from a same-block atomic attack to a multi-day capital-intensive operation — eliminating the attack class entirely for protocols with adequate timelock duration.

T16.006 Sub-Shapes

Proxy-admin instant upgrade. The proxy admin (EOA, multisig, or DAO executor) can call upgradeTo on the proxy in the same transaction as governance approval — no intermediate timelock contract enforces a delay. The ProposalExecuted event and the Upgraded event fire in the same block. This is the most common sub-shape in pre-2022 DeFi protocols and remains present in fork-substrate DAOs that inherit governance contracts from pre-2022 reference implementations.

Governance-executor direct execution. The governance executor contract can call arbitrary external functions without routing through a timelock — governance proposal approval and execution occur atomically. The executor is itself the timelock bypass.

Multisig-direct upgrade authority. The governance multisig is itself the proxy admin, and threshold approval authorizes an immediate upgrade without a separate timelock contract interposed between the multisig and the proxy. The multisig's execTransaction path directly targets the proxy's upgradeTo function. This sub-shape is common in Gnosis Safe-administered protocols where the Safe's threshold approval is treated as sufficient governance review.

Governance-overrideable timelock. The timelock contract's minimum delay is configurable by governance and can be reduced to zero (or a trivially short window) by the same governance that the timelock is meant to constrain. The timelock is present but not load-bearing — the governance that would be constrained by the timelock can override it. This is the most subtle sub-shape because the protocol can truthfully claim "we have a timelock" while the timelock provides no effective defense against a governance-compromise event.

The Compound 289 vs. Beanstalk Calibration

The most important comparison in the T16.006 corpus:

  • Beanstalk (April 2022): No timelock. Flash-loan governance attack. ~$182M extracted in a single transaction. Users had zero exit window. The extraction was atomic and complete.

  • Compound 289 (July 2024): Timelock present. Delegation-cluster governance attack. ~$24M prevented during the timelock review window. Users had time to observe the passed proposal, recognise the self-dealing pattern, and deploy a counter-proposal. The extraction was fully prevented.

The difference between these two outcomes is not the sophistication of the attackers (both were sophisticated), the size of the protocols (both are major DeFi protocols), or the governance-attack Technique class (T16.001 vs. T16.003). The difference is a single governance-design decision: whether a mandatory, non-governance-overrideable timelock exists between governance approval and execution.

Tornado Cash: The Timelock Is Necessary But Not Sufficient

The Tornado Cash governance attack (May 2023, T16.005) complicates the narrative. Tornado Cash had a governance process with community review — but the attacker's Proposal 20 included a hidden setup()-style function in the deployed proposal contract that granted the proposer 1.2M voting power on execution. The proposal passed on legitimate vote weight (community members voted based on the benign front-end-displayed text), the timelock window passed without the hidden payload being detected, and the proposal executed — granting the attacker voting power sufficient to self-pass Proposal 21 and drain the treasury.

The Tornado Cash case demonstrates that a timelock is necessary but not sufficient. The timelock provides the review window, but the review must actually be performed — and the review must include proposal-payload static analysis (OAK-M02), not just voting-outcome review. A DAO that has a timelock but does not perform proposal-payload review during the timelock window is defended against T16.001 and T16.003 (which require rapid or atomic execution) but remains undefended against T16.005 (which embeds the malicious payload in a proposal that passes on legitimate vote weight and survives the timelock window through payload concealment).

The Fork-Substrate Tail Risk

The T16.006 surface is concentrated at fork-substrate DAOs — protocols that inherit governance contracts from pre-2022 reference implementations (Compound Governor Bravo forks, OpenZeppelin Governor forks, MakerDAO governance forks) without the post-2022 timelock and snapshot mitigations applied to the upstream reference. These protocols inherit the governance-design vulnerability of the pre-2022 reference without the benefit of the post-2022 mitigation response. The fork-substrate tail is the standing T16.006 surface at v0.1 — the major DeFi DAOs have largely adopted timelock-gated execution, but the long tail of smaller protocols inheriting pre-mitigation governance contracts remains structurally exposed.

Timeline (UTC)

When Event OAK ref
2020–2021 Proxy-upgrade pattern proliferation; DeFi governance contracts broadly deploy without mandatory timelocks; fork-substrate DAO tail begins accumulating T16.006 (structural accumulation)
2022-04-17 Beanstalk: flash-loan governance attack with no timelock; ~$182M extracted atomically T16.001 + T16.006 (canonical: no-timelock + flash-loan)
2022–2023 Post-Beanstalk governance-design migration: major DeFi DAOs adopt snapshot-based voting power and timelock-gated execution T16.006 + T16.001 (mitigation response)
2023-05-20 Tornado Cash: malicious proposal with hidden setup() function passes timelock window without payload review; ~$1M extracted T16.005 + T16.006 (timelock present, payload review absent)
2024-07-28 Compound Proposal 289: delegation-cluster vote takeover; ~$24M prevented during timelock review window T16.003 + T16.006 (timelock present, review performed — prevented)
2021–2025 Fork-substrate DAO tail remains structurally exposed to T16.006-amplified governance attacks; smaller-protocol incidents continue unreported T16.006 (ongoing at tail)

Public references

  • Beanstalk Farms BIP-18 post-mortem (April 2022) — canonical no-timelock governance-attack forensic reference
  • Compound DAO Proposal 289 governance record (July 2024) — canonical timelock-review-window validation
  • Tornado Cash governance Proposal 20/21 post-mortem (May 2023) — canonical timelock-without-payload-review failure mode
  • [zhou2023sok] — academic taxonomy documenting timelock-absence as a recurring governance-design vulnerability
  • See techniques/T16.006-timelock-free-protocol-upgrade-execution.md and techniques/T16.001-flash-loan-governance-vote-manipulation.md for Technique definitions
  • Cross-reference: techniques/T16.003-delegation-cluster-vote-takeover.md (Compound 289 — timelock prevented), techniques/T16.005-malicious-proposal-snowballing.md (Tornado Cash — timelock without payload review), techniques/T9.003-governance-attack.md (parent governance-attack class)

Discussion

The governance timelock design anti-pattern is the canonical illustration of a defense-in-depth primitive whose absence amplifies every other Technique in its family. T16.006 is not an attack Technique in the conventional sense — it is a governance-design decision that determines the blast radius of every governance-compromise event. The case comparison across Beanstalk (no timelock, $182M extracted), Tornado Cash (timelock present, payload review absent, $1M extracted), and Compound 289 (timelock present, review performed, $24M prevented) is the most direct calibration of the timelock's defensive value in the OAK corpus — and the strongest argument for treating mandatory, non-governance-overrideable timelocks as a hard governance-design requirement rather than an optional security feature.

Techniques demonstrated (3)