TempleDAO Hack
What happened
On October 11, 2022, an attacker drained about 321,154 xFraxTempleLP (xLP) tokens from the StaxLPStaking contract of STAX, a product of the TempleDAO ecosystem on Ethereum. Reported losses were about $2.3 million. The contract's stake-migration function had no access control. It let any caller name any contract as the "old" staking contract and be credited with an arbitrary stake. The attacker removed the LP into TEMPLE and FRAX and swapped the proceeds to about 1,830 ETH, which was moved to another address. Cointelegraph put the loss at about 4% of TempleDAO's $57 million TVL. The team shut down the dApp and said the exploiter could do no further harm. The exploiter's address was linked to a Binance account, and TempleDAO said it was working with Binance on the investigation. Stax offered a white-hat bounty and said it would increase its existing Hats Finance bounty if the funds were returned.
Attacker address: 0x9c9Fb3100A2a521985F0c47DE3B4598dafD25B01
Exploit transaction: 0x8c3f442fc6d640a6ff3ea0b12be64f1d4609ea94edd2966f42c01cd9bdcf04b5
Liquidity removal transaction: 0x4b119a4f4ba1ad483e9851973719f310527b43f3fcc827b6d52db9f4c1ddb6a2
How it happened
migrateStake(address oldStaking, uint256 amount)was meant to be called only by a migrator. It had noonlyMigratormodifier and did not validateoldStaking.- The function called
oldStaking.migrateWithdraw(msg.sender, amount)and then creditedamountto the caller with_applyStake. It never checked that any tokens had arrived. - The attacker deployed a contract whose
migrateWithdraw()did nothing. They calledmigrateStake()with that contract asoldStakingand anamountequal to the staking contract's full xLP balance. - With the fake stake recorded, the attacker called
withdrawAll(false)and received about 321,154 real xLP tokens. - The LP was removed into
TEMPLEandFRAX, and the proceeds were swapped to about 1,830 ETH.
Protocol details
Post-Incident Timeline
-
2022-10-17
On 16 October 2022, the stolen amount of 1831 $ETH was moved into TornadoCash from the EOA address Address 0x2b63…b5a0
Evidence
Proof of concept
1 availableSources
- report Twitter/X Alert twitter.com
- report @FrankResearcher incident report twitter.com
- transaction etherscan.io transaction 0x8c3f…04b5 etherscan.io
- transaction etherscan.io transaction 0x4b11…b6a2 etherscan.io
- address etherscan.io address 0x9c9F…5B01 etherscan.io
- analysis TempleDAO exploit results in $2M loss cointelegraph.com
- analysis DeFiLlama defillama.com
- analysis TempleDAO Exploit Remastered faraz.faith
- analysis Fuzzing on-chain contracts with Echidna blog.trailofbits.com
Understand the attack patterns
Build your security review skills
Work through hands-on labs covering real exploit mechanics, review techniques, and defensive patterns.