BabyDogeCoin Hack
What happened
On May 28, 2023, an attacker took about 437 BNB (roughly $135K-$137K) from the Baby Doge Coin token system on BNB Smart Chain. Normal BabyDoge buys and sells pay a 10% tax, but the project's FarmZAP contract was exempt, and anyone could call it. The attacker used a flash loan and FarmZAP to trade between the BabyDogeSwap and PancakeSwap pools without paying tax.
They also triggered the token's swapAndLiquify sell to push down the price on PancakeSwap. PeckShield reported that the profit was sent to the FixedFloat exchange, which had also funded the attacker's wallet. The developers then removed FarmZAP's tax exemption.
How it happened
- The attacker flash-borrowed 80,000 WBNB from Radiant's lending pool.
- Through FarmZAP, which paid no BabyDoge tax, they bought BabyDoge from the BabyDogeSwap router's pair.
- They sold that BabyDoge from FarmZAP into the PancakeSwap pair for about 13,208 BNB.
- They transferred 1 BabyDoge out of the farm. This triggered the token's
swapAndLiquify, which sold contract-held BabyDoge into the PancakeSwap pair and added liquidity, leaving BabyDoge cheaper on PancakeSwap than on the BabyDogeSwap pair. - They bought BabyDoge on PancakeSwap with about 13,202 BNB and sold it tax-free into the BabyDogeSwap pair through FarmZAP. After repaying the flash loan and its fee, they kept about 437 BNB.
Protocol details
Evidence
- report @PeckShieldAlert incident report twitter.com
- transaction bscscan.com transaction 0x098e…5375 bscscan.com
- transaction bscscan.com transaction 0x2ca8…0c6f bscscan.com
- transaction bscscan.com transaction 0x66e2…4925 bscscan.com
- address bscscan.com address 0x5187…e6e2 bscscan.com
- address bscscan.com address 0xcbc0…febb bscscan.com
- code MetaTrustLabs SmartContractAttackPoC index github.com
- analysis PeckShieldAlert post on the BabyDoge exploit (via FxTwitter API mirror of the X post) api.fxtwitter.com
- analysis pennysplayer thread on the BabyDoge exploit, quoted by BlockSec Phalcon (via FxTwitter conversation API) api.fxtwitter.com
- analysis DeFiHackLabs BabyDogeCoin_exp.sol PoC raw.githubusercontent.com
- analysis DeFiHackLabs 2023 incident list (20230529 BabyDogeCoin) raw.githubusercontent.com
Understand the attack patterns
Build your security review skills
Work through hands-on labs covering real exploit mechanics, review techniques, and defensive patterns.