AI-generated analysisPublished automatically and not human-verified. Validated context appears in community notes below.
← Watch feed
Moderate 62 Bitcoin

Check Electrum Merkle leaf risk by base size

Public commit record

What the developer wrote

Authored by Elias Rohrer

80/100 · Strong
Check Electrum Merkle leaf risk by base size

Electrum confirmation checks must reject transactions whose non-witness
serialization is 64 bytes, since txids and Merkle leaves are computed
from that serialization. Witness padding can otherwise move total_size
above 64 without removing the inner-node ambiguity.

Co-Authored-By: HAL 9000

This finding was discovered by Project Loupe
✓ Descriptive subject✓ Names a concrete action or component✓ Provides detailed explanatory context✓ Explains rationale or failure mode
The short version

What changed, and why it matters

This commit fixes a bug in how rust-lightning's Electrum transaction sync checks for a known Bitcoin Merkle-tree weakness. The old code rejected transactions whose total byte size was exactly 64, but an attacker could pad a transaction with extra witness data to push the total size above 64 while keeping the non-witness (base) size at 64. Because Bitcoin txids and Merkle leaves are computed from the non-witness data, the bypass could let a malicious 64-byte-base transaction be treated as a valid Merkle leaf, potentially allowing fake transaction confirmations. The fix checks the base (non-witness) size instead of total size and applies the check in more code paths.

Recommended action

Review and merge promptly; this is a correctness fix for a known Bitcoin Merkle-tree attack vector. Consider whether any other size-based checks in the codebase rely on total_size when base_size is security-relevant. No CVE or advisory is referenced in the commit materials.

Security signals we found

01

Fixes incorrect size check that could be bypassed with witness padding

02

Addresses known Bitcoin Merkle leaf-node weakness (bitslog 2018)

03

Changes total_size to base_size for txid-relevant serialization

04

Expands unsafe-leaf check to additional confirmation code path

05

Credits external security research group (Project Loupe)

Risk score

Why this scored 62/100

Our methodology →
Potential impact 18/30
Exploitability 12/25
Stealth signal 10/15
Affected reach 10/15
Confidence 8/10
Evidence quality 4/5
Human-validated context

Community notes

Notes can correct, qualify, or add evidence to the AI analysis. Every note shown here has been validated by a human moderator.

No validated notes yet.

The AI analysis stands alone for now. Submit a note if you can add evidence or important context.