OAK — OnChain Attack Knowledge

Worked example · 2021-09

Compound Comptroller distribution bug — Ethereum — 2021-09-30

Loss
~$80–90M in COMP tokens accidentally over-distributed to protocol users (some early estimates extended to ~$147M / ~490,000 COMP if the bug had been exploited to its theoretical maximum). Approximately ~$38–48M in COMP was voluntarily returned over the following weeks; the remainder was retained by recipients.
OAK Techniques observed
OAK-T9.004 (Access-Control / Authorisation Logic Error) — broadly construed: a logic error in the Comptroller contract introduced through a legitimate governance proposal. Boundary case — see Discussion. Adjacent: OAK-T9.003 (Governance Attack) as the converse case (legitimate governance produced a bad change rather than malicious governance acquisition producing an attacker-designed change).
Attribution
unattributed — accidental, no attacker. The "loss" is the result of a one-character bug in a governance-passed upgrade, not adversarial behaviour. Recipients of the over-distributed COMP were ordinary protocol users whose claim transactions executed exactly as the deployed contract specified.
Key teaching point
This is the most unusual case in OAK v0.1 because there is no attacker. Every prior worked example in this directory has at least one adversarial actor whose actions can be mapped to OAK Techniques. The Compound 2021-09 incident has none. The "loss" is entirely a defender failure — a development-process and governance-design failure jointly produced by Compound Labs and the proposal author — manifesting as accidental distribution to a long tail of ordinary users.

Summary

Compound Finance is an Ethereum-based on-chain money market with on-chain governance mediated by its COMP token. On 2021-09-30, the protocol's Proposal 062 — a routine community-written upgrade intended to split COMP distribution rates between supply-side and borrow-side participants per market — passed governance and executed. The upgraded Comptroller contract contained a single-character logic error (a > operator where >= was required, per public analysis by Mudit Gupta) that caused certain users to be credited with vastly more COMP than they were entitled to when they claimed rewards. Within hours of execution, founder Robert Leshner publicly acknowledged the bug, asked recipients to return the over-distributed COMP voluntarily, and noted that no admin controls existed to halt the distribution — every fix required Compound's standard 7-day governance cycle. During that 7-day window an additional ~$68.8M was moved into the buggy Comptroller via the drip() function, expanding the pool of mis-claimable COMP. Proposal 063 (interim) and Proposal 064 (Fix COMP Accrual Bug) were subsequently passed, with Proposal 064 receiving 1,037,107 votes for and 0 against from 27 large delegates. The case is unusual in OAK because there is no attacker, and recipients had no contractual or smart-contract-level obligation to return the funds.

Timeline (UTC)

When Event OAK ref
2021-09-30 Proposal 062 ("Distribute COMP to Borrowers and Suppliers") executes after passing standard 7-day governance T9.004 introduction (governance-mediated)
2021-09-30 (hours after execution) Anomalous COMP claims observed; 240,000 COMP ($70M at the time) over-distributed T9.004 manifestation
2021-09-30 Leshner publicly acknowledges the bug; asks recipients to return funds; notes no admin pause exists (defender response)
2021-10-02 Leshner posts the now-controversial "keep 10% as a white-hat… otherwise being reported as income to the IRS, and most of you are doxxed" tweet (off-OAK; governance-comms)
2021-10-03 Founder publicly states up to ~$162M / ~490,000 COMP could be at risk if the bug were exploited to its full theoretical extent (via additional drip() flows) T9.004 blast-radius escalation
during 7-day fix window ~$68.8M additional COMP drip()'d into the buggy Comptroller, enlarging the mis-claimable pool (structural feature, not adversarial)
2021-10-07 Proposal 064 ("Fix COMP Accrual Bug") passes unanimously among voting delegates and executes T9.004 mitigation
weeks following 117,000 COMP ($38.7M as of Oct 3 reporting; later totals ~$48M) returned voluntarily; remainder retained (recovery; see Discussion)

What defenders observed

  • The bug was a single-character operator error in the Comptroller contract (> vs. >=, per public analysis by blockchain security researcher Mudit Gupta) introduced by Proposal 062. The proposal had been visible on-chain through Compound's standard 7-day governance review window, was reviewed by the community, voted on, time-locked, and executed — and the bug still shipped. This is the central defender lesson: Compound's governance process worked exactly as designed and produced a buggy contract anyway. T9.004 surfaces are not eliminated by governance review alone.
  • No admin pause / kill switch existed. Once Proposal 062 executed, the only path to halt over-distribution was another 7-day governance proposal. During that window the Comptroller continued to over-pay claimants and the drip() function continued to refill it from the Reservoir contract. The asymmetry between deploy speed (instant on proposal execution) and fix speed (7 days minimum) is itself a structural T9.004 surface.
  • The asymmetric incentive structure for recipients is the unusual feature of this case. Recipients of the over-distributed COMP had executed legitimate claimComp() transactions against a deployed contract that returned the over-distributed amount as specified by its (buggy) code. They had no smart-contract-level, contractual, or — under most interpretations — common-law obligation to return the funds. Compound's only available levers were public moral suasion (Leshner's "please return") and the implied threat of US tax-law treatment (the "doxxed / reported to IRS" tweet, later walked back as "bone-headed"). Both are off-chain levers. Neither is an OAK technique — they sit outside the on-chain attack-knowledge frame entirely.
  • Voluntary-return rate was substantial but partial. Public reporting indicates roughly ~$38–48M returned (out of ~$80–90M actually distributed), i.e., on the order of half. The remaining fraction was retained, with no public legal action known to have recovered it through 2024–2025. This sets a defender prior: in accidental-distribution cases, recovery via moral suasion is non-zero but should not be assumed to exceed ~50%.

What this example tells contributors writing future Technique pages

  • Governance-introduced contract bugs are a structural class. This case sits at a real boundary in OAK's v0.1 taxonomy. It is not T9.003 (Governance Attack): the proposal passed legitimately and the proposer was not acting adversarially. It is not T9.004 in its narrow adversarial reading (no malicious access-control bypass; no attacker exploited the bug to extract value beyond what the contract paid out automatically). For v0.1 we classify it under T9.004 broadly construed as an access-control / authorisation logic error, with the explicit note that this is the non-adversarial inverse of the typical T9 case. Contributors writing future T9.004 page revisions should consider whether v0.x needs a distinct sub-technique — provisionally T9.004.x: Governance-Introduced Logic Error — to separate adversarial logic-error exploitation from accidental governance-shipped bugs. The mitigations are similar (formal verification, multi-reviewer audit, slower upgrade cadence for distribution-affecting changes, kill-switch / pause authority for accrual contracts) but the threat model is different: there is no attacker to deter, only a development-process failure to harden against.
  • "Code is law" cuts both ways. The Beanstalk T9.003 case showed that "code is law" framing favours attackers (the contract did what it said; the design assumed consent that flash-loaned voting power did not represent). Compound's 2021-09 case shows the same framing favours recipients of accidental distributions: the contract did what it said, and on-chain there is no clawback path. Contributors should not assume "code is law" sympathies cluster on one side of the defender/attacker line.
  • Off-chain levers (legal threat, social pressure, IRS reporting) are not OAK techniques but they are real components of incident response and should be acknowledged as such in any narrative section without being mapped to the OAK taxonomy. OAK is on-chain attack knowledge by scope; the recovery surface is broader than the attack surface and the framework should be honest about that asymmetry.
  • The 7-day-governance-fix window is itself a defender-relevant property. For protocols where reward accrual or distribution is parameterised through governance-upgradeable contracts, contributors writing related Technique pages should explicitly note that the time between bug discovery and fix execution is a function of the governance schedule, not of engineering response speed. Pause / kill-switch authority for distribution contracts (held by a multisig or guardian, not requiring full governance) is a standard mitigation for this class.

Public references

Discussion

This is the most unusual case in OAK v0.1 because there is no attacker. Every prior worked example in this directory has at least one adversarial actor whose actions can be mapped to OAK Techniques. The Compound 2021-09 incident has none. The "loss" is entirely a defender failure — a development-process and governance-design failure jointly produced by Compound Labs and the proposal author — manifesting as accidental distribution to a long tail of ordinary users.

The case raises three tensions that OAK as a framework should be explicit about:

  1. Legal vs. ethical vs. practical recoverability. Legally, US tax authorities likely treat retained over-distribution as ordinary income (per Section 61 of the IRS code, as cited in contemporaneous reporting), but that is not the same as a clawback right; Compound has no smart-contract-level or contractual basis on which to compel return. Ethically, recipients received funds the protocol did not intend to send and the founder publicly asked for back; a substantial fraction returned voluntarily. Practically, ~50% retention appears to be the rough equilibrium for accidental-distribution cases of this size. OAK should not collapse these three dimensions into a single "loss recovered" number.

  2. The framework's adversarial framing has a blind spot. OAK is OnChain Attack Knowledge. Accidental distribution bugs introduced by legitimate governance produce defender-relevant outcomes (loss of treasury value, governance-process trust damage, regulatory exposure for recipients) that do not fit the attack-knowledge frame. v0.x should consider whether to scope these in (as a parallel "defender-failure" class) or scope them out explicitly (with cross-references to software-engineering and governance-design literature). The current draft includes this case under T9.004 broadly construed; that is a v0.1 expedient, not a settled position.

  3. The case is the converse of T9.003. Beanstalk (2022-04, this directory's T9.003 canonical example) shows malicious governance acquisition producing an attacker-designed contract change. Compound 2021-09 shows legitimate governance producing a bad contract change. The two cases delimit the design space of "governance produced an outcome the protocol's long-term holders did not want" — one adversarial, one accidental — and any future work on T9 sub-techniques should treat them as a paired set.

Compound's specific mitigation chain (Proposals 063 → 064, founder public comms, voluntary-return campaign) is the standard playbook for this class as of v0.1 and should be treated as such by future contributors. The unresolved question — what would have prevented Proposal 062 from shipping with the bug — points to formal verification, multi-party audit of distribution-logic changes, and pause authority for accrual contracts as the leading candidate mitigations. None of those are attacker-deterrent measures; all are development-process measures. That asymmetry is the defining feature of this case in the OAK corpus.

Techniques demonstrated (2)