Worked example · 2024-05
Sonne Finance empty-market rounding-error exploit — Optimism — 2024-05-14
Summary
Sonne Finance was a Compound v2 fork operating on Optimism (with a smaller deployment on Base), originally launched in 2022 and continuing operations through 2024 across multiple lending markets. On 2024-05-14, an attacker exploited an empty-market rounding-error in Sonne's recently-deployed VELO market to drain approximately $20M from Sonne's pools across the affected markets.
The proximate cause — per Cantina, BlockSec, Halborn, and SlowMist post-incident write-ups, all converging on the same root-cause description — is the same vulnerability class that drained Hundred Finance in April 2023, Midas Capital in June 2023, and Onyx Protocol in September 2024. In a Compound v2 cToken market with zero or near-zero supply, the share-price computation involves divisions that, under specific donation / share-mint sequences, can be manipulated by a relatively small attacker deposit followed by a direct-token donation. The donation inflates the apparent reserves without minting new shares; subsequent share-mint and redeem computations round in the attacker's favour by amounts that, when scaled by flash-loaned working capital, yield extraction in the millions.
The Sonne-specific feature is that the VELO market had been launched recently and the protocol's deployment script for new markets had not been retrofitted to enforce a non-trivial initial mint at deployment. The protocol team had been aware of the cohort vulnerability — published disclosures from Hundred Finance and Midas Capital in 2023 had circulated widely in the audit-and-defender community — and had patched older markets, but the bootstrap-on-deployment discipline had not been carried into the new-market launch process at the depth needed to prevent the May 2024 incident.
After the exploit, Sonne paused the affected markets, engaged with white-hat searchers (some of whom had front-run a portion of the extractable amount and returned funds to the protocol), announced a partial wind-down of the protocol, and ultimately discontinued operations across both Optimism and Base. The protocol's active-development life ended materially as a consequence of the May 2024 incident.
For OAK's purposes the case is a clean T9.005 (arithmetic / rounding-error sub-class) extraction with a T9.002 (flash-loan) working-capital precondition. The novel OAK contribution of the worked example is closing the cohort framing on the Compound v2 fork rounding-error sub-class alongside Onyx 2024 — the Sonne case is the bigger of the two 2024 cohort cases, the protocol's response (wind-down) is materially different from Onyx's response (continue-with-pause), and the case provides a second within-cohort 2024 worked example for the cohort-monitoring-of-newly-added-markets structural lesson.
Timeline (UTC)
| When | Event | OAK ref |
|---|---|---|
| Pre-2023-04 | Compound v2 fork architecture deployed across multiple protocols; empty-market rounding-error vulnerability latent in the cToken initialisation path | T9.005 surface (latent, cohort-wide) |
| 2023-04-15 | Hundred Finance exploited via empty-market rounding-error on Optimism, ~$7.4M extracted; root cause disclosed publicly | T9.005 cohort case 1 |
| 2023-06-16 | Midas Capital exploited via the same class on BNB Chain, ~$600K extracted | T9.005 cohort case 2 |
| 2023-04 — 2023-Q3 | Compound upstream and most actively-maintained forks deploy the canonical "first-depositor" / market-bootstrap patch | (cohort mitigation deployed, partially) |
| 2023-Q3 — 2024-05 | Sonne Finance patches existing markets but does not retrofit the bootstrap-on-deployment discipline into the new-market launch process | (Sonne cohort gap, latent) |
| Pre-2024-05 | Sonne deploys VELO market without sufficient bootstrap mint; market is in exploitable empty-market state | (Sonne specific surface, latent) |
| 2024-05-14 (attack tx window) | Attacker funds wallet via Tornado Cash; opens flash loan; deposits dust into the VELO market; donates VELO directly to the cToken contract; mints / redeems share-priced positions taking advantage of the rounding-favourable computation; repays flash loan; extracts ~$20M cumulative across affected markets | T9.005 + T9.002 extraction |
| 2024-05-14 (within hour) | On-chain monitoring (Cantina, BlockSec PhalconHQ, white-hat searchers) flags anomalous flow; some white-hat searchers front-run / capture a portion of remaining extractable amount and return to protocol | (defender response, partial recovery via white-hat) |
| 2024-05-14 (within ~2 hours) | Sonne operations team confirms the exploit; pauses affected markets across Optimism deployment | (operator response) |
| 2024-05-14 — 2024-05-15 | Continued attempts at extraction against unaffected markets are blocked by pause; full pause-coverage achieved by end of window | (operator response) |
| 2024-05-14 onward | Cantina, BlockSec, Halborn, SlowMist publish post-incident write-ups converging on the same empty-market rounding-error root cause | (transparency / cohort signal) |
| 2024-05 onward | Sonne announces partial wind-down; over subsequent weeks, full discontinuation of active development on both Optimism and Base deployments | (protocol-end-of-life response) |
| 2024-09-26 | Onyx Protocol exploited via the same class on Ethereum, ~$3.8M; the second 2024 cohort case | T9.005 cohort case 4 (Sonne is case 3) |
| Days following Sonne | Attacker laundering routes proceeds through Tornado Cash on Ethereum after bridging from Optimism | T7.001 (off this example's framing) |
| Continuing | No public recovery beyond the white-hat-captured portion; no civil-forfeiture action | (recovery state) |
What defenders observed
- The bug class was identical to Hundred Finance, Midas Capital, and Onyx — same patch existed, the cohort-monitoring discipline did not catch the gap. Hundred Finance was a Compound v2 fork on Optimism (April 2023). Midas Capital was a Compound v2 fork on BNB Chain (June 2023). Onyx Protocol was a Compound v2 fork on Ethereum (September 2024). Sonne Finance was a Compound v2 fork on Optimism (May 2024). All four are in the same architectural cohort; all four were exploited via the same empty-market rounding-error sub-class; all four had access to the same canonical patch from April 2023 onward. The defender lesson is structural: the cohort-monitoring discipline for newly-added markets in actively-maintained Compound v2 forks was incomplete at coverage sufficient to prevent the 2024 cases. Sonne and Onyx together are the canonical 2024 evidence.
- Newly-added markets are the highest-priority surveillance targets within a Compound v2 fork. Hundred Finance's exploited markets were existing markets in unusual liquidity states; Sonne's exploited market (VELO) was a recently-added market that had not gone through the bootstrap-on-deployment retrofit. The defender practice the Sonne case suggests is treating new-market launches in Compound v2 forks as cohort-level monitoring events: every new market deployment in any production fork should be checked against the canonical bootstrap-mint criterion before becoming live for user deposits, and should be monitored for the empty-market-state-equivalent for an initial period after deployment.
- The protocol's response was materially different from Onyx's response and is independently informative. Onyx (September 2024) continued operations after the exploit with protocol-pause and incremental remediation. Sonne (May 2024) wound down the protocol after the exploit. The shape of the operator response is partly a function of the exploit's relative size against the protocol's TVL — Sonne's ~$20M was a much larger fraction of Sonne's TVL than Onyx's ~$3.8M was of Onyx's TVL — and partly a function of the operator's own assessment of the recover-and-continue versus wind-down trade-off. Worked examples that capture this dimension explicitly are useful to defender practice as evidence that not every exploit results in continuing operations; protocol-end-of-life is a real outcome class in the 2024 incident corpus.
- White-hat searcher front-running captured a partial portion of remaining extractable amount. A subset of white-hat searchers monitoring the Optimism mempool / on-chain state during the exploit window front-ran some of the attacker's continuing extraction and returned the captured funds to the protocol. The captured amount (~$6.5M of pre-pause-additional-extractable-amount) reduced the loss the protocol absorbed but did not unwind the principal extraction. The white-hat-front-running primitive is a partial-mitigation that has shown up in several 2023–2024 cases (Euler Finance contributors, some bridge incidents, this case); it is operationally meaningful but is not a substitute for primary mitigation of the underlying vulnerability.
- Detection latency was operator-acceptable; recovery latency was effectively infinite for the attacker-controlled portion. Sonne paused within roughly two hours of the on-chain attack window. The attacker's exfiltration via bridging from Optimism to Ethereum and routing through Tornado Cash followed the standard 2024-EVM-mainnet pattern; the protocol-pause primitive on Optimism protects future drains but does not unwind completed extraction once funds reach the bridge / mixer surface — the same shape as Onyx 2024 and most 2024 EVM exploit cases.
What this example tells contributors writing future Technique pages
- T9.005 covers the precision-loss / rounding-error sub-class and Sonne is the canonical 2024 cohort-anchor case. The cohort spans Hundred Finance (April 2023), Midas Capital (June 2023), Sonne Finance (May 2024), and Onyx Protocol (September 2024). Sonne is the largest single case in the cohort and is the cleanest 2024 cohort-anchor for the known-vulnerability-not-fixed-across-forks structural lesson. The T9.005 technique page should treat Sonne as the canonical 2024 cohort-anchor example, with Onyx as the secondary 2024 case showing within-protocol prior-incident framing and Sonne showing cohort-level framing.
- Cohort-monitoring of newly-added markets in actively-maintained Compound v2 forks is a discoverable defender practice and a Mitigations-layer cross-cutting reference. The set of Compound v2 forks in production at any time is enumerable. The set of newly-added markets per fork per month is enumerable on-chain. The presence-or-absence of the canonical bootstrap-mint patch on each new market is checkable at deployment time. The defender practice the Sonne and Onyx cases jointly suggest is cohort-level monitoring of new-market launches across the full cohort, with a deployment-time check for the bootstrap-mint criterion. Contributors writing the Mitigations layer should treat this as a first-class cross-cutting Mitigation entry referenced from T9.005 and from the worked-example layer.
- Within-class repeat-failure across forks is a recurring OAK pattern that generalises beyond Compound v2. The cross-fork repeat-failure shape at Compound v2 generalises to other protocol-fork ecosystems: Curve forks (the read-only-reentrancy class affecting multiple Curve-fork lending and stablecoin deployments in 2023), Liquity forks (the CDP-and-Zap helper-contract class — see Prisma 2024 at
/examples/2024-03-prisma-finance.md), Uniswap-V2 forks (various sub-class rounding bugs across the cohort), and others. The Sonne / Onyx 2024 pair is the cleanest 2024 evidence that the cohort-monitoring discipline is generally incomplete; future cross-fork worked examples should reference the Sonne / Onyx pair as the canonical 2024 cohort-pattern anchor. - Protocol-end-of-life is a real outcome class in the 2024 incident corpus and worked examples should report it. Sonne wound down after the May 2024 incident. The OAK corpus's value to defender practice is partly in capturing the realistic distribution of post-exploit protocol outcomes: continue-with-pause (Onyx, Li.Fi, WOOFi, Hedgey), partial-recovery-and-continue (Prisma), wind-down (Sonne), full-recovery-via-negotiation (Euler Finance 2023). Worked examples should preserve this dimension explicitly in the front-matter and discussion.
- Pseudonymous attribution is the realistic attribution status for this class. Funding through Tornado Cash, bridging from Optimism, laundering through Tornado Cash on Ethereum. No industry forensics provider has produced a named-individual claim. Contributors should not over-claim attribution simply because the on-chain forensics are detailed.
Public references
[sonnepostmortem2024]— Sonne Finance protocol-side post-incident statement covering the May 2024 VELO-market exploit and the subsequent wind-down decision.[cantinasonne2024]— Cantina (formerly Spearbit) post-incident technical write-up emphasising the empty-market rounding-error root cause and the cohort framing alongside Hundred Finance and Midas Capital.[blocksecsonne2024]— BlockSec PhalconHQ forensic analysis of the Sonne Finance exploit including transaction-trace breakdown of the flash-loan / donation-rounding extraction sequence.[halbornsonne2024]— Halborn post-incident technical analysis of the Sonne exploit cross-referencing the Compound v2 fork cohort.[slowmistsonne2024]— SlowMist incident analysis covering funding-source tracking, bridging from Optimism, and Tornado Cash laundering on Ethereum.[rektsonne2024]— Rekt News public-facing summary framing the case as the third 2024 Compound v2 fork rounding-error case (alongside Hundred Finance / Midas Capital cohort).[peckshieldsonne2024]— PeckShield headline figures and on-chain analytics for the Sonne 2024 drain (~$20M extracted, partial white-hat front-running).
Citations
[sonnepostmortem2024]— Operator post-incident statement; primary source for affected-market identification, white-hat-captured-portion accounting, and wind-down decision.[cantinasonne2024]— Forensic technical analysis; primary source for cohort framing alongside Hundred Finance and Midas Capital.[blocksecsonne2024]— Transaction-trace forensic breakdown; primary source for the flash-loan / donation-rounding extraction sequence.[halbornsonne2024]— Cross-cohort technical analysis; secondary source for the Compound v2 fork cohort structural framing.[slowmistsonne2024]— Funding-source tracking and laundering pattern; primary source for pseudonymous attribution status.[rektsonne2024]— Public-facing summary; secondary source for cohort-anchor 2024 framing.[peckshieldsonne2024]— Headline figures and on-chain analytics; primary source for cited $20M and white-hat-recovered-portion figures.
Discussion
Sonne Finance 2024 is OAK's canonical case for the known-vulnerability-not-fixed-across-forks cross-cutting failure mode in the Compound v2 fork rounding-error cohort, paired with Onyx 2024 at /examples/2024-09-onyx.md as the second 2024 cohort case. The two together establish the cohort-anchor evidence for the structural lesson: cohort-monitoring of newly-added markets in actively-maintained Compound v2 forks was incomplete at depth-of-deployment-coverage during 2024, and the canonical patch (initial-mint-on-deployment / market-bootstrap requirement) was not uniformly enforced at new-market launch time across the cohort.
The cohort framing is the analytically central feature. Hundred Finance (April 2023), Midas Capital (June 2023), Sonne Finance (May 2024), and Onyx Protocol (September 2024) are four cases of the same vulnerability sub-class across four protocols in the same architectural cohort. The cumulative cohort loss is approximately $32M across the four cases. The canonical patch existed from April 2023 onward; the cohort-level coverage of the patch across all forks-in-production-with-non-trivial-TVL was incomplete throughout the 14 months between the Hundred Finance disclosure and the Sonne incident, and remained incomplete through the Onyx incident in September 2024. The defender lesson is not protocol-specific — it is cohort-level: any architectural cohort sharing a known vulnerability needs cohort-level patch-status verification, applied at deployment time for new components, not only at retrofit time for existing components.
The within-protocol-vs-within-cohort distinction matters. Onyx 2024 carries strong within-protocol repeat-failure framing (Onyx had a prior 2023 incident in the same class). Sonne 2024 carries primarily cross-fork-cohort framing (Sonne had no prior incident; the cohort had three prior incidents). The two together cover both shapes of the known-vulnerability-not-fixed pattern within the same vulnerability sub-class — within-protocol repeat-failure (Onyx, Wintermute) and across-fork-cohort repeat-failure (Sonne) — and both shapes need explicit Mitigations-layer treatment.
The protocol-end-of-life outcome is independently informative. Sonne wound down after the May 2024 incident; the operational reality of running a Compound v2 fork with a major loss event was incompatible with continuing operations at the protocol's pre-exploit TVL. Worked examples should treat protocol-end-of-life as a real outcome class in the 2024 corpus and report it explicitly; the corpus's defender-practice value is partly in capturing the realistic distribution of post-exploit operational outcomes, of which wind-down is one.
For OAK's broader credibility, including Sonne 2024 in v0.1 closes a structural gap: it provides the second 2024 Compound v2 fork rounding-error worked example (alongside Onyx) needed to make the cohort-anchor framing credible, it documents protocol-end-of-life as an outcome class, and it captures the partial-recovery-via-white-hat-front-running primitive that has shown up in several 2023–2024 cases as a real but partial defender mechanism.