Worked example · 2022-03
Agave / Hundred Finance reentrancy exploit — Gnosis Chain — 2022-03-15
Summary
On 2022-03-15 attackers exploited Agave (an Aave fork) and Hundred Finance (a Compound fork) on Gnosis Chain [rektagave]. Rekt attributes the vulnerability to the design of the xDAI token, which contains a _callAfterTransfer() function; the attacker used flash loans as initial collateral and nested borrow calls inside one another, borrowing more than the protocol could record in its debt balance [rektagave]. Immunefi traces both attacks to post-transfer hooks (onTokenTransfer()) in non-standard ERC-677 tokens on the bridge, which enabled reentrancy; for Hundred, the attacker deposited about $2M in USDC as collateral and borrowed well over $6M, and tokens were sent before the user's debt was updated [immunefihundred].
Rekt reports that after a few hours the attacker sent the 2,116 ETH from Agave and 2,363 ETH from Hundred to Tornado Cash [rektagave].
Timeline (UTC+1 per Rekt)
| When | Event |
|---|---|
| 2022-03-15 11:25:40 | Agave exploit transaction [rektagave] |
| 2022-03-15 11:28:40 | Hundred Finance exploit transaction [rektagave] |
| 2022-03-15 (hours later) | Proceeds sent to Tornado Cash [rektagave] |
Public references
[rektagave]— Rekt, "Agave DAO, Hundred Finance - REKT" (2022-03-15): https://rekt.news/agave-hundred-rekt[immunefihundred]— Immunefi, "Hack Analysis: the Hundred Finance Heist, March 2022": https://immunefi.com/blog/bug-fix-reviews/hack-analysis-the-hundred-finance-heist-march-2022/[theblockagave]— The Block, "DeFi protocols Agave and Hundred Finance exploited on Gnosis Chain for $11 million" (2022-03-15): https://www.theblock.co/post/137932/defi-protocols-agave-and-hundred-finance-exploited-on-gnosis-chain-for-11-million- Cross-reference: T9.005 at
techniques/T9.005-reentrancy.md.