OAK — OnChain Attack Knowledge

Worked example · 2021-07

THORChain — Bifrost credited deposits that were not real (ETH router) — THORChain / Ethereum — 2021-07-16 and 2021-07-22

Loss
two ETH-router exploits in July 2021. The first is given as about $4.9M by THORChain's weekly dev update 99 and by Halborn, and as about 4,200 ETH by THORChain's post-mortem, whose heading for it says "~$8m". The second is about $8M per CoinDesk, with the token amounts listed in the post-mortem. No source opened reports any of the stolen funds returned. The post-mortem says "The THORChain treasury will cover all losses to LPs. Nodes are not affected."
OAK Techniques observed
OAK-T10.002.001 (Off-chain Observer Source-Event Forgery — primary). THORChain's Bifrost node component, the off-chain observer that decides a deposit happened on Ethereum, accepted attacker-authored data as a deposit. In exploit 1 it read msg.value instead of the deposit event (dev update 99, post-mortem). In exploit 2 a fake router and fake Asgard vault produced a deposit event with a malicious memo that Bifrost treated as a normal deposit and refunded (post-mortem, Rekt). See techniques/T10.002.001-off-chain-observer-source-event-forgery.md. Also OAK-T9.005 (Reentrancy) for the separate 2021-07-09 whitehat find, an ERC-777 hook that triggered a secondary deposit (post-mortem of the router upgrade).
Attribution
unattributed. No source opened names the actors. THORChain's own tweet, reported by CoinDesk, described the second attacker as having deliberately limited their impact and as seemingly a whitehat; that is the protocol's characterisation, not a finding. The post-mortem says the exploit-2 attack wallet was spawned from Tornado Cash.
Key teaching point
A bridge observer must credit a deposit from the state it can verify, not from fields the depositor can write. Both exploits worked because Bifrost took a value or an event the attacker controlled (a msg.value set by a wrapper contract, a deposit event emitted by a fake router) as proof of funds received. The fix THORChain gave for exploit 1 was to read only the deposit event for a deposit action (post-mortem).

Summary

THORChain is a cross-chain liquidity network whose Bifrost component watches external chains and whose ETH router contract takes deposits on Ethereum. On 2021-07-09 a whitehat found an ERC-777 re-entrancy in the router and the team rescued the funds to the THORStarter deployer account (router upgrade post-mortem). On 2021-07-16 THORChain detected an exploit of Bifrost and paused trading (dev update 99). On 2021-07-22 a second attack through a fake router drained ERC-20 assets; Rekt says its observation began at 21:42 GMT that day and that THORChain first believed only about $800k had been lost to a whitehat. A later premature return to trading while the ETH balance was wrong left the network insolvent; the post-mortem puts the insolvency at roughly $16m.

An earlier version of this file described a cluster of three incidents ending with a "ChefDAO" exploit on 2021-08-12, a returned 10% bounty and a non-prosecution outcome. No page opened in the 2026-11 source pass supports those claims, and they are removed.

Timeline (UTC)

Stages: Flaw (Bifrost trusts attacker-written deposit data), Take (two exploits), Money (what the sources say about it), Response. The sources give dates by day only; exact times are undisclosed unless shown.

When What happened OAK
2021-07-09 A whitehat finds an ERC-777 hook in the router that triggers a secondary deposit; recursive deposits could raise the member's allowance to the full router balance. THORChain works with them to rescue the funds to the THORStarter deployer account (post-mortem) T9.005
Before 2021-07-16 Bifrost's override of the transaction value, meant only for the vaultTransferEvent router function, applies to any router call (dev update 99) T10.002.001
Before 2021-07-16 (time undisclosed) The attacker deploys a contract in front of the router. It sends msg.value 200 and calls the router with call value 0 and deposit amount 0; Bifrost reads 200. Repeated, this drains pools; the post-mortem says about 4,200 ETH (dev update 99, post-mortem) T10.002.001
2021-07-16 THORChain detects the exploit and pauses trading; release 0.60.1 stops all outbound ETH-chain transactions (dev update 99) response
2021-07-22 The attacker deploys a fake router and a fake Asgard vault, calls returnVaultAssets() with a small amount of ETH, and the fake vault produces a deposit event with a malicious memo. Bifrost treats it as a deposit and refunds the attacker. Six transactions listed below (post-mortem, Rekt) T10.002.001
2021-07-22 THORChain says ETH trading is halted until audit partners review it, and that ERC-20 pool LPs will be subsidised (CoinDesk) response
After 2021-07-22 (date undisclosed) A store migration meant to correct the ETH balance, then trading is enabled before the ETH price updates; arbitrage empties the remaining ETH and the network is insolvent. The post-mortem calls the upgrade "not adequately war-gamed" (post-mortem) response
2021-07-30 Post-mortem published with a five-part recovery plan: audits by Trail of Bits and Halborn, a bounty, a red team, monitoring (solvency checker, 25-minute node timeout, outbound throttling), insurance. Insolvency cover: one-third treasury, one-third an Iron Bank loan, one-third arbitrage (post-mortem) response
Onward from exploit 2 Where the stolen assets went: undisclosed in the sources opened. Rekt says the attacker "left most of the loot behind" —

Key addresses (all from the post-mortem, repeated by Rekt for exploit 2):

Exploit 2 transactions:

  1. 0x10352e6ec052771a92f05f93e037e066873f64bb502d4488726697987f054595
  2. 0x1c6ef4d5122f1287085097ac37df076d43f389bfc62a1bdfcd3163254b5fe94a
  3. 0x0b39a878f1bf3daa78be149222dd8e5fa3e37b54d0451872b3d7a2cbf7f070e2
  4. 0x01f38f17ba838b54350f8e2a2bd54fcdd9cf3c45fa1d2a735f5311507671be9e
  5. 0xa89d90f300fed8d1d987dec86d0d628f31ffd2d8aefdd857ad90151084531d4c
  6. 0x9db403ad39d3fe78de378af0b49f03d244326662f7fee230db87d12a624f564b

Assets taken in exploit 2, per the post-mortem: 966.62 ALCX, 20,866,664.53 XRUNE, 1,672,794.010 USDC, 56,104 SUSHI, 6.91 YFI and 990,137.46 USDT. Rekt also reports a separate follow-on drain of RUNE holders through the RUNE token's use of tx.origin in transferTo.

Root-cause evidence

Public references

Techniques demonstrated (2)

More incidents