NEKO Hack
What happened
Neko Network, the experimental lending network of Maze Protocol on BNB Smart Chain, was attacked from August 11, 2021 (21:39 UTC). Attackers used a flaw in the closed-source MainPool lending contract to borrow against other users' collateral and receive the loans themselves. According to Maze's incident report, six attacker addresses (two using helper contracts) made more than 190 malicious borrows. Together they added 499,423 BUSD, 3,620,179 USDT, 2,792 USDC and 1 BTCB of debt to 16 victim accounts, about $4M in total. About $3.8M of that debt landed on a single whale's account and $296K on the rest. Only the Funding Pools lost money; the Reserve Pools and LP Pool do not lend and were not affected.
Maze froze the pools, which stayed closed for at least 24 hours because of a timelock. The attackers returned about $3.8M to the team's deployer address, and by August 16 the team had sent it to victims to repay their fraudulent debts. The whale ended with a 7% loss on their deposit, and other accounts were made whole. Maze noted that the contract had never been open-sourced or verified on BscScan, and that one attacking contract was deployed about five days before the Neko contract, so the attackers probably had access to the code. The protocol had been audited twice before launch.
How it happened
MainPool.borrowtook anonBehalfOfparameter naming whose collateral and credit the loan would use. The Neko frontend always passedmsg.sender, but the contract did not check this or require a borrow allowance from the named account.- The debt token was minted to the
onBehalfOfaccount, whiletransferUnderlyingTosent the borrowed asset tomsg.sender. - The attackers passed the addresses of users who had collateral in the Funding Pools and unused borrow credit as
onBehalfOf. Each call borrowed stablecoins in the victim's name and paid them to the attacker, from externally owned accounts and helper contracts0xE4eCb6c45Bc8fda0472f57a981bA9682fee191cBand0x52C52cee08090fE635872C2b67BaDBe041Fa58E2. - The attack was repeated across six addresses until the pools were frozen. About $3.8M was later returned and used to cancel the victims' fraudulent debts.
Protocol details
Evidence
- report Neko Hacking Incident Report (Maze Protocol blog, Aug 13, 2021, Wayback copy) blog.mazeprotocol.com
- code maze-protocol-official/documentation (GitHub repo file listing) github.com
- analysis DeFiLlama defillama.com
- analysis Explained: The Neko Network Hack (August 2021) halborn.com
- analysis Neko Hacking Incident Review (SmartState.tech, Aug 13, 2021, Wayback copy) smartstatetech.medium.com
- analysis Defi Hack: Neko Network hacked; attackers steal over 2 million in stablecoins coingape.com
Understand the attack patterns
Build your security review skills
Work through hands-on labs covering real exploit mechanics, review techniques, and defensive patterns.