DarkPool Hack
What happened
The Dark Pool (DPC) token on BNB Smart Chain was exploited on September 9, 2022 for about $103,755 (Beosin EagleEye's figure), drained from its PancakeSwap liquidity pool.
DPC's contract paid rewards to users who staked DPC LP tokens. Beosin traced the flaw to one line in getClaimQuota, ClaimQuota = ClaimQuota.add(oldClaimQuota[addr]), which carried the previously recorded reward into each new reward calculation. As a result, the claimable reward kept accumulating when the attacker called claimStakeLp again and again. The attacker withdrew the inflated DPC and sold it for USDT. Beosin reported that the funds stayed in the attacker's address after the attack.
**Block data**
- Attacker:
0xf211fa86cbc60d693d687075b03dff3c225b25c9 - Attack contract:
0x2109bbecb0a563e204985524dd3db2f6254ab419 - Draining tx:
0x92cab23d536d2e13ecb7c473350121165de0ae6c6c81be94ba502ac7db72e86f - Liquidity pool:
0x79cd24ed4524373af6e047556018b1440cf04be3
How it happened
- The attacker called DPC's
tokenAirdropso its contract qualified for rewards. - It swapped USDT for DPC, added DPC/USDT liquidity on PancakeSwap and staked the LP tokens with
stakeLp. - It called
claimStakeLprepeatedly. BecausegetClaimQuotaadded the stored reward (oldClaimQuota) into each new calculation, the recorded reward kept growing with each call. - It withdrew the inflated reward as DPC through
claimDpcAirdrop. - It sold the DPC for USDT in the pool, taking about $103,755.
Protocol details
Evidence
- report Report en.0xzx.com
- report @BeosinAlert incident report twitter.com
- transaction BSC transaction 0x92cab23d...e86f and block 21,179,285 bscscan.com
- address bscscan.com address 0x2109…b419 bscscan.com
- address bscscan.com address 0x79cd…4be3 bscscan.com
- address bscscan.com address 0xf211…25C9 bscscan.com
- code DeFiHackLabs 2022 incident list (20220909 DPC - Incorrect Reward calculation) github.com
- analysis Beosin:BNBChain上DPC代币合约遭受黑客攻击事件分析 (Tencent Cloud mirror) cloud.tencent.cn
- analysis DeFiHackLabs DPC_exp.sol (2022-09 PoC) raw.githubusercontent.com
Build your security review skills
Work through hands-on labs covering real exploit mechanics, review techniques, and defensive patterns.