We manage your security to weather the AI storm →

← Resource Hub

Compound Hack: Proposal 62 and the $147M Estimate

By Daniel GelfandPublished 4 min read

Part of our guide to smart contract vulnerabilities

Compound Hack: Proposal 62 and the $147M Estimate

Quick answer. In the 2021 Compound hack, Proposal 62 treated an accounting baseline as earned COMP for some users, letting them claim too much. A pre-vote test should verify that the upgrade credits no new rewards when none were earned.

Watch: Compound Hack: Proposal 62 and the $147M Estimate 1:26
Video transcript

Compound’s Proposal sixty-two was meant to give suppliers and borrowers separate reward rates. Instead, the upgrade let some accounts claim more COMP than they earned.

A missed case at the starting index made the upgrade count an accounting baseline as earned rewards. Compound Labs said the bug put the reward pool at risk, not supplied or borrowed funds.

The estimate of one hundred forty-seven million dollars combined an initial estimate of eighty million, about twenty-two million reportedly claimed after the refill, and forty-five million still at risk. That was not a final net loss.

Before voting, test a synthetic market with no rewards and verify that neither side credits or pays COMP. Use inherited balances to check that earned rewards survive the upgrade. Compare each account’s payouts and unpaid credits with an independent reward model.

Drill containment separately from repair. Account for refills while governance works on a fix, and check that withholding a payment does not break integrations that depend on claims.

In a Guardian audit, rules that must always hold become executable invariants. Your team keeps the suite to test fixes and future upgrades.

Read the full case study for the pre-vote checks, or bring your implementation, migration plan, and reward rules to Guardian to scope a lending protocol audit.

What Happened

Proposal 62 upgraded Compound v2's Comptroller on Ethereum. Each market previously used one COMP reward rate for both supplying and borrowing.[1, 2]

The upgrade let governance set those rates independently. It also fixed an earlier bug that prevented some markets from offering COMP rewards.

The new bug affected the COMP incentive pool. Compound Labs said supplied and borrowed funds were not at risk.[3]

Include supply and borrow interest indices, upgrade roles and timelocks in the lending protocol audit. Add reward accounting when a proposal changes it.

The Missing Equality Case

The market index tracks cumulative rewards per unit of position. An account's checkpoint records the index at its last accounting update.[4, 5]

The index gap is the reward per unit of position. The contract scales that amount by the size of the account's position.

The upgrade changed when market-wide reward indices were set, but some accounts still had no prior checkpoint.

For accounts with no prior checkpoint, the calculation skipped the baseline when the market index equaled its starting value. The code still saved the current checkpoint.[6]

The calculation measured from zero rather than from the starting index. That made an accounting baseline look like payable earnings.[2]

The patch restored the missing equality case on both sides. The bug was in payout accounting, not in the vote.

Timeline and Loss

Some accounts received excess COMP. Robert Leshner initially estimated that up to 280,000 COMP was at risk; Decrypt valued that amount at about $90 million on October 1.[2, 3]

After the refill, Leshner put total exposure at about 490,000 COMP. The refill itself did not pay users.[7, 8]

Rekt attributed the $147 million estimate to banteg: the initial $80 million figure, about $22 million reportedly claimed after the refill, and $45 million still at risk.

Leshner's October 9 snapshot put returns to the community Timelock at about 163,000 COMP. Compound's October 14 Digest repeated the tally.[9]

The snapshot also put about 130,000 COMP unclaimed in the Comptroller and roughly 200,000 misallocated COMP still outstanding.

Tokens never paid out are not recoveries. The $147 million estimate and the October snapshot do not establish a final net loss.

  • Sep 29, 2021, 20:24:08 UTC: Proposal 62 executes at Ethereum block 13,322,798, putting the new reward logic live.[10, 11]
  • Oct 3: The Reservoir transfers 202,472.5 COMP to the vulnerable Comptroller before a patch is live.
  • Oct 6: Proposal 63 is cancelled after voting because reverting reward claims would break third-party integrations.
  • Oct 9, 06:16:06 UTC, block 13,382,885: Proposal 64 stops new overcredits from this bug and withholds some transfers without reverting claims.[5]
  • Oct 19, 17:50:24 UTC, block 13,449,598: Proposal 65 corrects excess credits, records COMP still owed where applicable, and restores normal claims.[12]

How to Catch It

Proposal 62 had public code review, testnet testing and upgrade scenarios. That record does not establish the scope of an independent audit of the code that shipped.[1, 4, 13]

The Proposal 64 regression checked both COMP paid and COMP accrued in a test market with no rewards. Before voting on a fix, require the test to fail without it and pass with it.[6]

Use a synthetic market for a deterministic test. Assert that initializing a checkpoint at an unchanged starting index credits no rewards.

For a positive control, assign a test account a known share of a synthetic market. Check that it earns that share of the COMP emitted over a fixed interval.

Build a reference model from the documented reward schedule and account positions. Do not reuse the production index calculation.

Compare payouts plus unpaid credits to the rewards the model calculates for each account. A correct market total can hide misallocated credits.

Use inherited storage for the migration check. A clean deployment can pass while an upgrade mishandles stored balances.

Our guide on when to re-audit smart contracts helps you choose between a diff audit and a full review.

  • Check the starting boundary and adjacent index values on the supply and borrow sides independently.
  • Show that an upgrade leaves legitimately earned, unpaid rewards intact across account migration.
  • Record the fork block and simulate the exact governance payload on the team's own pre-release fork.
  • Match the planned implementation bytecode, initialization arguments and call order to the reviewed build before approval.

Containment Before Repair

Leshner said Compound had no immediate control to halt COMP distribution. A change required roughly seven days of governance.[3]

In a drill, record the earliest patch execution alongside the decisions operators can make while waiting.

Bound exposure using current balances and permitted inflows during that delay. Include reserves that can refill the reward pool.

Test emergency behavior through the contracts that depend on claims, not just through your own interface.

For calls that should still complete, check separately whether funds move. A normal return does not prove payment.

Reconcile the credits removed, tokens actually returned and amounts still owed separately.

Testing Lending Upgrade Invariants

Guardian's published audit method turns core safety rules into executable invariants. Teams keep the suite to test fixes and later upgrades.[14, 15, 16]

For a future reward upgrade, vary balances and rates across sequences of actions. A new rate should not reprice previously earned rewards.

Trace the meaning of each checkpoint in manual review. Then use the suite to check it across sequences the unit tests miss.

Review Your Next Lending Upgrade

If your next proposal changes how a market accrues or pays rewards, bring the implementation, migration plan and reward rules to scope a Guardian lending protocol audit.

Frequently Asked Questions

Could Proposal 64 withhold correctly earned COMP?

Compound Labs CTO Geoffrey Hayes explained that the filter could withhold payments from users who had interacted with an affected market, even if they never triggered the bug.[5]

Did returning COMP automatically clear the account record?

The October 14 Compound Digest said a separate governance proposal would be needed to reflect voluntary returns in account records.[2]

Sources

  1. Compound Community Forum: RFP 16: Dynamic COMP reward distribution
  2. The Compound Digest: Compound Treasury Updates, COMP Bug Fix, Dynamic Risk Parameters
  3. Decrypt: DeFi Community Blasts Compound CEO for ‘Doxxed’ Comment
  4. Compound Finance: Split COMP rewards distribution, pull request 144
  5. Compound Community Forum: Analysis of Proposal 64
  6. Compound Finance: Proposal 64: Fix COMP distribution bug, pull request 165
  7. Decrypt: $160M At Risk Due to Bug in DeFi Lending Protocol Compound
  8. Rekt: Compound - REKT
  9. EatTheBlocks: The $90 Million Equal Sign: Compound Finance COMP Bug
  10. Marked: Compound Governor Bravo proposal execution logs
  11. Marked: Compound governance execution block timestamps
  12. Compound Finance: Proposal 65: Correct bad COMP accruals, pull request 166
  13. Compound Community Forum: More Rigorous Process on Reviewing Large Code Changes
  14. Guardian: Guardian's Audit Track Record: Reviews and Same-Code Results
  15. Guardian: Foundry Invariant Testing: Handlers, Ghost Variables, Actors
  16. Guardian: Lending Protocol Audit Checklist: 40 Money Market Checks
  17. Tally: Compound Proposal 62: Split COMP rewards distribution and bug fixes
  18. Tally: Compound Proposal 64: Fix COMP accrual bug
  19. Tally: Compound Proposal 65: Correct over-accrued COMP
  20. Guardian: RAAC Core Contracts Audit Report
  21. Guardian: Sentiment V2 Audit Report
  22. Guardian: DAO Governance Security Checklist
  23. Guardian: Ownable vs AccessControl vs AccessManager in Solidity