BlackGold Hack

Reported loss $18K
BNB Chain
Other

What happened

On December 12, 2022, an attacker exploited BlackGold (BGLD) on BNB Chain while holders were being migrated from an old BGLD token to a new one. DeFiHackLabs puts the total loss at about $18K for the whole transaction.

The old BGLD charged an extra fee on transfers. BlockSec identified this as the root cause: by sending old BGLD to a PancakeSwap pair and taking the excess back with skim(), the attacker could shrink the pair's BGLD reserve to almost nothing and then swap a tiny amount of BGLD for the other side of the pool. According to the DeFiHackLabs reproduction, the attacker used the trick twice in one transaction, first on the WBNB/BGLD pair and then on the old BGLD/DEBT pair. Between and after those drains, it converted leftover old BGLD to new BGLD through the migration contract and sold the new token for DEBT, finally swapping DEBT to USDT.

The existing record attributes the attack to a price difference between the two token versions during migration. BlockSec's analysis names the transfer fee instead; the reproduction shows the migration was used to cash out, but not how much of the profit came from it.

  • Attacker (existing record): 0xf4fd2ebe7196c8e99e88bcc4aef69dda0e493b8f
  • Exploit transaction: 0xea108fe94bfc9a71bb3e4dee4a1b0fd47572e6ad6aba8b2155ac44861be628ae
  • Old BGLD: 0xC2319E87280c64e2557a51Cb324713Dd8d1410a3
  • New BGLD: 0x169f715CaE1F94C203366a6890053E817C767B7C
  • Migration proxy: 0xE445654F3797c5Ee36406dBe88FBAA0DfbdDB2Bb

How it happened

  1. The attacker took a 125 WBNB flash loan from a DODO pool and swapped it into old BGLD through the WBNB/BGLD pair, buying most of the pair's BGLD.
  2. It sent the pair about ten times the pair's remaining BGLD balance, called skim() to take the excess back and then sync(). Because of the extra transfer fee, the pair's recorded BGLD reserve dropped to almost nothing.
  3. It sold a tiny amount of old BGLD into the pair for a large amount of WBNB and repaid the 125 WBNB flash loan.
  4. It called migrate() on the migration proxy to turn its leftover old BGLD into new BGLD, and sold most of that new BGLD for DEBT.
  5. It flash-swapped 950 DEBT from the new BGLD/DEBT pair, used the DEBT to buy old BGLD from the old BGLD/DEBT pair, and repeated the transfer, skim() and sync() trick there. Selling a tiny amount of old BGLD back returned a large amount of DEBT, and the attacker repaid the 950 DEBT plus the pair fee.
  6. It called migrate() again, sold the new BGLD for DEBT, and swapped its DEBT to USDT, keeping the USDT and remaining WBNB.

Protocol details

Classification Token / Oracle Manipulation
Protocol Type Exploit/Other
Affected asset / contract BGLD
Implementation language Solidity
Protocol links Website

Build your security review skills

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