xToken Hack
Incident Overview
Exploitation of Synthetix's xSNXa contract led to a loss of 2.4k ETH, 781k BNT, and 407k SNX.
The attacker initiated the exploit by borrowing a 61.8k ETH flash loan on dYdX. They then deposited 10k ETH to borrow 564k SNX on Aave and swapped 5.5k ETH for 700k SNX on SushiSwap. The attacker sold 1.2M SNX for 818 ETH on Uniswap v2, significantly reducing the SNX price. They then used only 0.12 ETH to mint 1.2B xSNXa, exploiting the protocol's reliance on Kyber for SNX purchases. The attacker then swapped 105M xSNX into 414 ETH and began to do reverse swaps in SushiSwap and Uniswap and repaid loans in Aave. They then sold the existing xSNXa to the Balancer SNX/ETH/xSNXa pool, repaid the flash loan to dYdX, and issued xBNTa four times for 0.03 ETH, which ultimately gave them 3.9B xBNTa. They then swapped half of xBNTa to 781k BNT.
Stolen funds:
- 2.4k ETH ($10.3M)
- 781k BNT ($6.2M)
- 407k SNX ($8M)
- 1.9B xBNTa
The attacker's address:
https://etherscan.io/address/0x07e02088…79dc3e
The transaction behind the attack:
https://etherscan.io/tx/0x7cc7d935…40da22
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 xToken, these are the critical security checks that could have prevented this incident (May 2021).
- Verify all logic paths related to Flashloan Price Oracle Attack / Flash Loan Attack are guarded by proper access controls and input validation - see the Flash Loans Attacks attack class for patterns
- Audit oracle price feeds for manipulation risks - ensure time-weighted average prices (TWAPs) or multi-source aggregators are used, not spot prices
- 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 TrialSecurity Audit History
- Audit Report 1 Report
Related Attack Classes
The technique used in this hack maps to these vulnerability classes in our security curriculum:
Sources & References
Learn to Prevent the Next xToken
The xToken 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.