MooCakeCTX Hack
What happened
On November 6, 2022 (UTC), an attacker took about $140,000 from the MooCakeCTX vault on BNB Smart Chain, an auto-compounding vault that staked CAKE in a PancakeSwap pool earning CTK rewards. The vault did not settle pending rewards before accepting a new deposit. Using flash-loaned funds, the attacker made a large CAKE deposit, triggered a harvest that compounded the accrued rewards into the vault, and withdrew with a share of rewards earned before they joined.
QuillAudits reported $143,921; Fairyproof reported about $140,000.
How it happened
- The attacker bought CTK with a small amount of BNB and transferred it directly into the PancakeSwap SmartChef pool that pays the vault's CTK rewards.
- They flash-borrowed 400,000 BUSD from DODO, supplied it to Venus as collateral and borrowed 50,000 CAKE.
- They deposited all 50,000 CAKE into the vault with
depositAll(). The vault did not harvest or settle pending rewards first, so the new shares were priced as if no rewards had accrued. - They called
harvest()on the strategy, which claimed the CTK rewards, converted them and reinvested them, raising the value of every share, including the attacker's large new stake. - They called
withdrawAll()to take out more CAKE than they deposited, repaid Venus and the DODO flash loan, and kept the surplus.
Protocol details
Evidence
- report @beosinalert incident report twitter.com
- transaction bscscan.com transaction 0x03d3…ec8e bscscan.com
- transaction bscscan.com transaction 0x4492…c913 bscscan.com
- transaction bscscan.com transaction 0x5809…a119 bscscan.com
- transaction bscscan.com transaction 0x602c…ba45 bscscan.com
- transaction bscscan.com transaction 0x963d…ad6a bscscan.com
- address bscscan.com address 0x3570…acd5 bscscan.com
- address bscscan.com address 0x71ac…467c bscscan.com
- code DeFiHackLabs MooCAKECTX_exp.sol github.com
- analysis DeFiLlama defillama.com
- analysis Amidst FTX Saga, Hacker Swept More Than $25 Million in 2nd week of November (QuillAudits) quillaudits.substack.com
- analysis Weekly Blockchain Security Watch 147 (Fairyproof) fairyproof.substack.com
- analysis BscScan block 22832428 bscscan.com
Understand the attack patterns
Build your security review skills
Work through hands-on labs covering real exploit mechanics, review techniques, and defensive patterns.