]> git.bitcoin.ninja Git - rust-lightning/commit
Protect against Core's Merkle leaf node weakness
authorElias Rohrer <dev@tnull.de>
Thu, 1 Aug 2024 16:30:41 +0000 (11:30 -0500)
committerElias Rohrer <dev@tnull.de>
Thu, 8 Aug 2024 12:35:33 +0000 (14:35 +0200)
commit44a479e2ae7f9bf4a13a2b88829c730e5797559a
treee38cb884dc2737aae9fefa8233ac82c92df49305
parent50d21b7c08bb600127223d86d391943dbafdacf9
Protect against Core's Merkle leaf node weakness

Bitcoin Core's Merkle tree implementation has no way to discern between
internal and leaf node entries. As a consequence it is susceptible to an
attacker injecting additional transactions by crafting 64-byte
transactions matching an inner Merkle node's hash (see
https://web.archive.org/web/20240329003521/https://bitslog.com/2018/06/09/leaf-node-weakness-in-bitcoin-merkle-tree-design/).

To protect against this (highly unlikely attack vector), we check that
the transaction isn't 64 bytes in length, and skip it otherwise.
lightning-transaction-sync/src/electrum.rs
lightning-transaction-sync/src/esplora.rs