Threshold Transaction Malleability
The tBTC bridge's SPV proof verifier did not account for Bitcoin's transaction malleability, allowing a malicious miner to include a fake transaction by crafting a 64-byte coinbase transaction that collides with the fake transaction's hash. This could let an attacker forge a deposit proof and mint tBTC without actually locking Bitcoin.
immunefi.com
Published on immunefi.com
On August 20th, 2023, one of our top 50 whitehats, Kayaba, identified a vulnerability in Threshold Network’s tBTC. This vulnerability was concerned with the inherent malleability of Bitcoin transactions, which, in combination with the Threshold Network’s SPV proof verifier, allowed arbitrary transactions to be…
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
Root cause
The SPV proof verifier did not check that the coinbase transaction's Merkle proof had the same length as the transaction of interest's proof, allowing a 64-byte coinbase to be interpreted as an intermediate node and a fake transaction to be proven.
Impact
A malicious miner could forge a deposit proof and potentially mint tBTC without locking real Bitcoin, though the attack requires mining a block and finding a collision.
What the attacker needed
Ability to mine a Bitcoin block; craft a 64-byte coinbase transaction; find a collision for fake transaction
How it was found
- A malicious miner creates a valid 64-byte coinbase transaction.
- The miner prepares a fake transaction whose 32-byte ID matches the second half of the coinbase transaction.
- The miner includes the coinbase transaction in a block they mine.
- The miner submits an SPV proof to the tBTC bridge claiming the fake transaction is included.
- The bridge's verifier accepts the proof because it does not check the coinbase proof length.
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.
Bitcoin light clients verify transactions using a compact proof called SPV, which relies on a tree of hashes. The tBTC bridge used this proof to confirm Bitcoin deposits, but the proof could be tricked because a specially crafted 64-byte transaction (a coinbase) could be split into two 32-byte halves that look like a valid hash pair. An attacker who mines a block could therefore make the bridge believe a fake transaction was included, potentially minting tBTC without a real deposit.
What is Crypto?
Encryption, signatures, randomness or certificate checks that do not protect what they claim to.