Critical · 9.3 Node.js & npm GHSA-8vv3-6qpc-gpw6 CVE-2026-107846
bitcoinjs-lib Merkle Root Validation Flaw Allows Transaction List Forgery
A vulnerability in bitcoinjs-lib allows an attacker to duplicate transactions in a Merkle tree without detection, letting a forged transaction list pass block-root validation. Fixes are available.
By PatchBriefing · ·
Produced automatically from official sources with the help of AI. How we work →
AI summary
A vulnerability has been identified in bitcoinjs-lib, a JavaScript Bitcoin library used in Node.js and browser applications. The issue, tracked as CVE-2026-107846, affects how the library verifies Merkle roots when validating block transaction lists. The vendor has released fixed versions addressing the flaw.
What happened
A flaw was found in bitcoinjs-lib's Merkle root computation and validation logic. The library's fastMerkleRoot function pads odd levels of a Merkle tree by hashing the final node together with itself, but does not flag or reject cases where this duplication occurs. As a result, the block-root validation paths in the library — including the Block.checkMerkleRoot() and Block.calculateMerkleRoot() functions, and later checkTxRoots() and __checkMerkleRoot — can accept a recomputed Merkle root without detecting that duplicate transaction hashes were used to produce it.
Technical cause
The root cause is an improper validation of an integrity check value (CWE-354). When a Merkle tree level contains an odd number of nodes, the Bitcoin Merkle tree construction duplicates the last node to produce an even pairing for hashing. bitcoinjs-lib replicates this padding behavior during root computation but omits a check confirming that any duplication of adjacent hashes is legitimate rather than attacker-introduced. This allows a peer to append duplicate transactions to a block's transaction list while keeping the Merkle root, block header, proof of work, and block identifier (hash) identical to the original, honest block.
Why it matters
Applications that rely on bitcoinjs-lib to validate block transaction lists against a Merkle root — such as block explorers, exchange transaction indexers, or SPV (simplified payment verification) clients — can be misled by a forged transaction list that passes validation unnoticed. Consequences include processing the same transaction twice, or rejecting a legitimate, honest block because its hash was associated with a forged list by another party. Both outcomes affect data integrity in systems that depend on accurate block content.
Affected versions
bitcoinjs-lib versions from 2.3.0 up to (not including) 5.2.1 are affected. Versions from 6.0.0 up to (not including) 6.1.8 are affected. Versions from 7.0.0-rc.0 up to (not including) 7.0.2 are affected.
Fixes and mitigation
The vendor has released fixed versions: 5.2.1, 6.1.8, and 7.0.2. These versions address the missing detection of duplicate Merkle node hashes during block-root validation.
Recommended action
Projects using bitcoinjs-lib should update to version 5.2.1, 6.1.8, or 7.0.2, depending on which major release line is in use. Applications that perform their own block or transaction validation based on bitcoinjs-lib's Merkle root functions should confirm that the updated library versions are in place before trusting block-root verification results.
PatchBriefing score
9.3 / 10 · Critical
Official CVSS: 9.3
CVSS:4.0/AV:N/AC:L/AT:N/PR:N/UI:N/VC:L/VI:H/VA:L/SC:N/SI:H/SA:H
EPSS 0.0026 (11 percentile)
Why this score
The PatchBriefing score equals the official CVSS score; when this article covers several vulnerabilities, the highest one. Signals such as known exploitation and EPSS are listed separately and do not change the score.
Affected versions
- bitcoinjs-lib ≥ 7.0.0-rc.0 < 7.0.2
- vulnerable
- bitcoinjs-lib >= 7.0.0-rc.0, < 7.0.2
- vulnerable
- ≥ 5.2.1
- patched
- ≥ 6.1.8
- patched
- ≥ 7.0.2
- patched
Reported fixes
The vendor has released fixed versions: 5.2.1, 6.1.8, and 7.0.2. These versions address the missing detection of duplicate Merkle node hashes during block-root validation.
How this was built
4 source records were collected, matched and used to prepare the report above.
-
NVD (NIST) database
-
CVE.org database
-
GitHub Advisory Database database
-
OSV.dev database
Revision history
- Published
- Generated
- Published
- Early Warning