Technical definition
Transaction malleability arises from the fact that the transaction ID (TXID) in many blockchain systems is derived from the transaction's raw data, including its signature. An attacker can modify non-critical parts of the transaction (e.g., the signature's encoding) without invalidating the transaction, resulting in a different TXID. Since the TXID is used to track transaction confirmation status, this can lead to race conditions where exchanges or services mistakenly believe a transaction failed, prompting users to resubmit payments. The issue is particularly relevant in systems using unconfirmed transactions for state transitions, such as the Lightning Network.
An analogy
Imagine sending a signed contract through a courier, but before delivery, someone alters the envelope’s label (e.g., changes the handwriting slightly) without changing the contract’s content. The recipient sees a different label and assumes the contract wasn’t delivered, even though it was. The contract itself remains valid, but the tracking system is confused.
Why it matters
Transaction malleability can disrupt payment processing systems, leading to double-spending risks, failed transactions, or unnecessary resubmissions. It undermines the reliability of transaction tracking, which is critical for services relying on unconfirmed transactions.
Where it came from
The issue was first publicly discussed in 2014, notably exploited in the Mt. Gox exchange collapse, where attackers manipulated unconfirmed Bitcoin transactions to trick the exchange into refunding users. It has since been addressed in Bitcoin Core with SegWit (2017), which separates transaction signatures from the TXID calculation.
Example in practice
A user sends 1 BTC to an exchange. An attacker intercepts the unconfirmed transaction and modifies its signature encoding, changing the TXID. The exchange, seeing the new TXID, believes the transaction failed and requests the user to resend the payment. The user sends another 1 BTC, resulting in a double spend of 2 BTC (the original and the resubmitted transaction).
Common misconceptions
- Misconception: Transaction malleability allows attackers to steal funds. → Correction: It does not allow theft; it only manipulates transaction IDs, potentially causing confusion in tracking.
- Misconception: All blockchains are vulnerable to transaction malleability. → Correction: Some blockchains (e.g., those using SegWit or alternative signature schemes) mitigate this issue by changing how TXIDs are calculated.
Risks & limitations
- Exchanges or services may incorrectly mark transactions as failed, leading to lost funds or unnecessary resubmissions.
- Can be exploited in combination with other attacks (e.g., 0-conf attacks) to disrupt payment processing.
- May cause temporary confusion in transaction tracking, though modern systems have largely mitigated this risk.
- In systems relying on unconfirmed transactions (e.g., Lightning Network), malleability can lead to channel state inconsistencies.