LPC Token Hack

Reported loss $45K
BNB Chain
Other

What happened

LPC, a BEP20 token traded on PancakeSwap, was exploited on 25 July 2022. A flaw in the token's _transfer logic let an address send tokens to itself and end up with more than it started with. The attacker flash-borrowed almost the entire LPC reserve of the PancakeSwap LPC/USDT pool, self-transferred it repeatedly to inflate the balance, repaid the loan and sold the surplus. PANews, citing Chengdu Lianan (Beosin) monitoring, put the attacker's profit at about 178 BNB (roughly $45,715); the figure shown here is $45,304. The dump crushed the LPC price.

Attacker: 0xd9936EA91a461aA4B727a7e3661bcD6cD257481c

Exploit transaction: 0x0e970ed84424d8ea51f6460ce6105ab68441d4450a80bc8d749fdf01e504ed8c

A second attacker transaction is also listed: 0xbd7ecaf0ce2ea7755d16deb0658fe0570d7e6e45fe3ce5b34f49d1e5f50ddb8b.

How it happened

  1. The attacker borrowed LPC from the PancakeSwap LPC/USDT pair through a flash swap (PANews reports 1,353,900 LPC; the public PoC borrows the whole reserve minus one unit).
  2. Inside the callback, the attacker called transfer with its own address as both sender and recipient. _transfer worked from a cached recipientBalance that was not refreshed after the sender side was debited, so the write-back credited the full amount on top of the old balance.
  3. Each self-transfer therefore increased the balance instead of leaving it unchanged; the PoC repeats it ten times.
  4. The attacker repaid the flash swap with part of the inflated LPC, sending about 10% extra to cover the fee on the transfer back, so that 90% of what it sent matched the borrowed amount (per the PoC).
  5. The remaining LPC was sold for stablecoins (BUSD per PANews) and then swapped to BNB, about 178 BNB in total according to PANews.

Protocol details

Classification Token / Token & Share Accounting
Protocol Type Exploit/Other
Affected asset / contract LPC
Implementation language Solidity

Build your security review skills

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