Hack Analysis Binance Bridge October 2022
The Binance Bridge was hacked because the IAVL Merkle proof verification did not use the right attribute of a node when calculating the root hash, allowing a malicious proof to be accepted. An attacker could then forge a cross-chain transfer and steal 2 million BNB, worth about $600 million at the time.
immunefi.com
Published on immunefi.com
On October 7th, 2022, the Binance Bridge was hacked due to a flaw in the IAVL Merkle proof verification system, which allowed a malicious hacker to steal 2m BNB, or about $600m USD equivalent at the time.
The full write-up lives on its author's site
It belongs to its author, so we link to it rather than copy it. The other two tabs are our own rewrites, checked against it.
Not written yet. The AI write-up for this write-up has not been written yet. The Original tab links to the source.
How it worked
Impact
The attacker could steal 2 million BNB, about $600 million at the time, and Binance paused the system and introduced a blacklist in response.
What the attacker needed
Deposit 100 BNB to become a relayer; craft a malicious payload and proof
How it was found
- Take a legitimate proof from an early cross-chain transaction.
- Decode and unmarshal the proof to access its internal structure.
- Hash the malicious payload to create a new leaf value.
- Build a key for the malicious leaf using a package sequence.
- Add the new leaf and an empty inner node to the proof.
- Set the right attribute of the proof to the hash of the malicious leaf, then marshal and verify the proof.
Explained by bugbounty.wiki with AI from the original and checked against quotes from it; it can still be wrong. Read the original before relying on a detail.
Not written yet. The AI write-up for this write-up has not been written yet. The Original tab links to the source.
A Merkle tree is a way to prove that some data is part of a large set without showing the whole set, by hashing data up to a single root hash. The bridge checked such proofs but made a mistake: it ignored one side of the information used to rebuild the root hash, so an attacker could supply a fake proof that still matched the real root hash. This let the attacker pretend a large transfer had happened and withdraw funds from the bridge.
What is Crypto?
Encryption, signatures, randomness or certificate checks that do not protect what they claim to.