All vulnerabilities
CRITICALWeb3exploited in the wildcurated

WEB3-BNB-CHAIN-2022

Web3 · BNB Chain · BSC Token Hub

Summary

On October 6, 2022, an attacker forged a Merkle proof against the BSC Token Hub, the cross-chain bridge of BNB Chain, and minted 2 million BNB worth roughly $570 million out of thin air. The bridge verified inbound messages from the BNB Beacon Chain using Cosmos IAVL Merkle range proofs, and the verifier had two compounding defects: it computed the tree root from the left path only (ignoring any right child), and it never rejected proof path nodes that carried both a left and a right child. So the attacker took a real, years-old proof (a 0.05 BNB transfer whose root was already trusted), kept its left path intact so the root hash stayed identical, then injected a crafted leaf authorizing a mint into a node's right field with an empty inner node for padding. After depositing 100 BNB to register as a relayer, the forged package passed the iavlMerkleProofValidate precompile at address 0x65 and the handlePackage() handler minted 1 million BNB to the attacker, executed twice. No existing user funds were touched: every stolen token was freshly minted. BNB Chain then halted its validators, freezing the bulk of the loot on-chain, so only about $100 to $137 million ever escaped to other networks.

How to fix it

  • Verify IAVL and Merkle range proofs correctly: reject any path node that carries an unexpected right (or left) child, and reject proofs where both children are set.
  • Ensure the computed root depends on every supplied proof node, not just the left path.
  • Patch and pin the proof library (cosmos-sdk, tendermint, iavl) to fixed versions; do not carry a vendored copy that silently drifts.
  • Replace open, bond-only relayer registration with an allowlist or threshold attestation so a single forged submission is not enough.
  • Add per-epoch mint caps and circuit breakers so an abnormal mint trips a breaker before it can be repeated.

How to avoid it in your code

  • Fuzz and formally verify cross-chain proof verifiers against forged and edge-case tree structures; the canonical invariant is that the root must be a function of all proof nodes.
  • Gate privileged cross-chain handlers (handlePackage, token issuance) behind stricter authorization and value-anomaly limits.
  • Never treat a freshly minted balance as equivalent to a verified deposit; isolate issuance behind independent checks.
  • Keep a rehearsed validator-halt playbook as a genuine last-resort control, accepting the centralization tradeoff it implies.

Advisory details

How it happened

The attacker registered as a legitimate bridge relayer by depositing 100 BNB to the RelayerHub, then submitted a forged cross-chain package. The first mint of 1 million BNB landed around 18:26 UTC; a second attempt hit 15 failures (rejected for an out-of-order package sequence) before succeeding around 20:43 UTC, for 2 million BNB total. Rather than dump the tokens and crash the price (which would have self-defeated the theft), the attacker parked roughly 900,000 BNB as collateral on the Venus lending protocol and borrowed about $150 million in stablecoins against it, then bridged value out to Ethereum, Polygon, Fantom, Avalanche, Optimism and Arbitrum. The defect was a classic forgeable proof: the IAVL range-proof code should have verified that no path node had an unexpected child, but it did not, so a real proof could be padded with a malicious right leaf without changing the root that the bridge trusted.

The response and what it means

BNB Chain stopped the bleeding the only way a young chain could: it contacted validators one by one and halted block production roughly three hours in. By its own account the network ran 26 active validators out of 44 total at the time (the often-repeated "21 validators" figure is unverified). The halt stranded about $430 million of the minted BNB on-chain; Tether and Circle later blacklisted reachable stablecoins (around $33.5 million combined), and Elliptic estimated more than $350 million was ultimately made inaccessible, leaving only tens of millions in censorship-resistant form. The community then voted through emergency governance on whether to freeze the funds, whether to use BNB Auto-Burn to cover the loss, and on bug and recovery bounties, and the Moran hard fork (October 12, 2022) shipped the corrected IAVL check and whitelisted relayers, closing the open registration path. No individual or group was ever named. The headline that "$570 million was stolen" is misleading: about $570 million was minted, but the realized loss to the chain was far smaller, and the episode showed both how a single proof-verification bug can mint a half-billion dollars and how a fast halt can claw most of it back. It belongs to the same brutal 2022 bridge wave as Wormhole, Ronin, Nomad and Poly Network, which together pushed cross-chain bridge theft past $2 billion for the year.

References

Related vulnerabilities

All Web3 →