Agave Hack
Incident Overview
The attacker's address:
https://blockscout.com/xdai/mainnet/address/0xD041Ad9a…79E358/transactions
The attacks were made possible due to the xDAI token's architecture, which includes the function callAfterTransfer(), which creates a reentrancy vulnerability.
Using flash loans as collateral, the attacker(s) layered multiple borrow functions within one another, increasing the amount borrowed before the protocol could update the debt balance. Repeating this approach resulted in borrowing assets that were significantly more valuable than the collateral provided.
Stolen funds were bridged to Ethereum and deposited into Tornado Cash mixer:
https://etherscan.io/txs?a=0xd041ad9a…79e358
Incident Report
Protocol Information
What the Attacker Needed to Succeed
Understanding the prerequisites for this type of attack helps auditors identify protocols that are most at risk and helps developers build better defenses.
What Auditors Should Check
If you're auditing a protocol with similar architecture to Agave, these are the critical security checks that could have prevented this incident (March 2022).
- Verify all logic paths related to Flashloan Reentrancy Attack / Other are guarded by proper access controls and input validation - see the Flash Loans Attacks attack class for patterns
- Check that all state-changing functions follow the Checks-Effects-Interactions (CEI) pattern to prevent reentrancy and logic ordering bugs
- Review privileged functions (owner, admin, governance) for potential abuse vectors - centralization risks should be documented and bounded with timelocks or multi-sigs
Master these auditing techniques with hands-on labs and real exploit scenarios in the Smart Contract Hacking course.
Free TrialRelated Attack Classes
The technique used in this hack maps to these vulnerability classes in our security curriculum:
Proof-of-Concept Exploits
On-Chain Evidence & References
Sources & References
- 01
- 02
Learn to Prevent the Next Agave
The Agave hack is one of many attacks that skilled auditors are trained to detect before deployment. Master real exploit patterns and defense techniques with hands-on Web3 security training.