Utopia Hack

Reported loss $120K
BNB Chain
Other

What happened

Utopia, a BEP20 reward token on BNB Smart Chain, was exploited on July 20, 2023 for roughly $119K-$120K of WBNB drained from its PancakeSwap liquidity pool.

The token's transfer logic included an _airdrop routine that, on every transfer, derived a series of "random" addresses from public on-chain values and set each one's balance to exactly 1 wei. Because the seed used only the last airdrop address, the block number and the transfer's from/to addresses, an attacker could steer one derived address onto the Utopia/WBNB pair and overwrite the pool's Utopia balance. After syncing the pair, a few wei of Utopia bought almost all of the WBNB reserve. The same _airdrop code was used by the FFIST token, exploited the same day.

**Block data**

  • Attacker: 0xe84ef3615b8df94c52e5b6ef21acbf0039b29113
  • Attack contract: 0x6191203510c2a6442faecdb6c7bb837a76f02d23
  • Vulnerable token: 0xb1da08c472567eb0ec19639b1822f578d39f3333
  • Exploit tx: 0xeb4eb487f58d39c05778fed30cd001b986d3c52279e44f46b2de2773e7ee1d5e

How it happened

  1. The attacker contract swapped a dust amount of WBNB (0.01 in the public reproduction) for Utopia to hold a small balance.
  2. It sent tiny Utopia transfers and called skim on the Utopia/WBNB pair, choosing parameters so that the pseudo-random address computed by _airdrop from lastAirdropAddress, block.number and the from/to addresses landed on the pair.
  3. _airdrop then assigned _balances[pair] = 1 wei instead of adding to it, wiping out the pool's real Utopia balance.
  4. Calling sync made the pair record that near-zero Utopia balance as its reserve.
  5. The attacker transferred 32 wei of Utopia to the pair and swapped it out for nearly the entire WBNB reserve.

Protocol details

Classification Token / Protocol Logic
Protocol Type Ponzi
Affected asset / contract Utopia
Implementation language Solidity
Protocol links Website @UtopiaBNB

Security review history

Build your security review skills

Work through hands-on labs covering real exploit mechanics, review techniques, and defensive patterns.