OAK — OnChain Attack Knowledge

Worked example · 2022-07

Yam Finance — an attacker staked bought YAM liquidity to gain voting power, put an unverified-code proposal to a quorum vote and withdrew the stake; the guardians cancelled it before execution — Yam DAO / Ethereum — 2022-07-09

Loss
None. The proposal was cancelled before it could execute. At risk: a treasury of about $3.1M, per DeepDAO data cited by The Block and Decrypt. Sources do not say what the proposal's code would have moved.
OAK Techniques observed
OAK-T16.002 (Hostile-Vote Treasury Drain — primary, attempted). The attacker acquired voting power by market purchase (YAM bought, paired with ETH in a Sushiswap pool, LP tokens staked in the Yam Incentivizer, which grants votes to LPs), then proposed and voted a proposal with unverified code that The Block says was built to move the reserves to an attacker-controlled wallet. The vote reached quorum; the proposal never executed. See techniques/T16.002-hostile-vote-treasury-drain.md. OAK-T7.001 (Mixer-Routed Hop — funding in and proceeds out: the post-mortem says the first wallet was funded with 200 ETH from Tornado Cash and that the proceeds were later sent to Tornado Cash). See techniques/T7.001-mixer-routed-hop.md. No flash loan was used: the voting power was bought and held for hours.
Attribution
unattributed (addresses only; main wallet 0x4429abbf523bef0f1e934b04cff8584955c72548).
Key teaching point
Make a proposer keep the proposal threshold for the whole vote, and keep a cancel power for the guardians until execution. Here the attacker withdrew the staked LP tokens right after voting, which dropped the proposer below the 50k BoU YAM threshold and let the guardians cancel; a proposer who stayed staked could not have been cancelled that way. Also: surface proposals made through contracts (they did not show as ordinary transactions on Etherscan) and refuse to treat unverified proposal code as reviewable.

Summary

On 2022-07-09 an attacker, funded from Tornado Cash two days earlier, used a set of wallets and an unverified contract to create a Yam governance proposal and vote it past quorum with 224,739 BoU YAM (about 561,847 YAM) staked through the Sushiswap-LP incentivizer (post-mortem). Ethereum security community members alerted the YAM Guardians; because the proposal held unverified, unknown code it was judged potentially malicious, and because the proposer had pulled its stake the guardians could cancel it at 12:41 UTC. The Yam team said "Earlier today, there was a governance attack on the DAO that has been thwarted" (Decrypt). This is separate from the 2020 rebase bug.

Timeline (UTC)

Stages: Preparation (funding, buying voting power) → Execution (proposal and vote) → Exit (stake withdrawn) → Response (alert, cancel). Times are from the post-mortem unless stated.

When What happened OAK
2022-07-07 17:54 to 18:42 Wallet A funded with 200 ETH from Tornado Cash in 2 transactions; 135 ETH sent on to wallet B. T7.001
2022-07-07 19:01 to 21:28 Wallet B sells 57 ETH for YAM, adds ETH and YAM to the Sushiswap pool and stakes the LP tokens in the Yam Incentivizer. T16.002
2022-07-09 07:41 to 08:50 Wallet A funds wallets C and D; wallet C buys YAM and adds liquidity; wallet D deploys the unverified attacker contract (08:36); B and C send LP tokens to it. T16.002
2022-07-09 09:06 Attacker contract stakes the LP tokens in the Incentivizer. T16.002
2022-07-09 09:08 to 09:09 Wallet D, through the contract, creates the proposal and votes with 224,739 BoU YAM; quorum is 200,000 BoU YAM. Decrypt notes a spam-like description beginning "Contributors comps for May, backpay for VDM". T16.002
2022-07-09 09:15 to 09:28 Contract withdraws the LP tokens to wallet B, which unwinds them and sells the YAM for about 50.7 ETH. —
2022-07-09 (morning, US Eastern per post-mortem) Ethereum security community members alert the YAM Guardians; proposal judged potentially malicious. response
2022-07-09 12:41 Guardians cancel the proposal. The guardian multisig was not needed to move treasury funds. response
After 2022-07-09 12:41 Attacker sells its remaining YAM and sends the ETH to Tornado Cash from wallet B. Amounts: undisclosed. T7.001
2022-07-09 to 2022-07-10 Yam announces the thwarted attack on X (July 9 per Decrypt); The Block reports on July 10 that it resembled an attempt in December 2021. response

Key addresses (from the post-mortem; the post-mortem's Etherscan link for wallet C points at wallet B, so C is linked by its own address):

Fund flow: no funds were taken from the DAO. The attacker's own ETH flow (Tornado Cash in, about 50.7 ETH from the first sale, Tornado Cash out) is described above without amounts for the exit; an on-chain trace was not done.

Root-cause evidence

Public references

Techniques demonstrated (2)

More incidents