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

lnwire: preserve unknown odd zero-length final hop TLVs

Public commit record

What the developer wrote

Authored by bitromortac

83/100 · Strong
lnwire: preserve unknown odd zero-length final hop TLVs

When decoding an onion message payload, the loop that forwards
unrecognized final hop TLVs to higher layers skipped any entry with a
zero-length value. DecodeWithParsedTypesP2P marks a recognized type with
a nil map entry but records the raw bytes for an unknown type, and an
unknown odd TLV with an empty value is valid. Keying the skip off a
length check therefore dropped such a TLV instead of passing it through.

Test the recognized-type skip against a nil entry so a valid unknown odd
zero-length TLV is preserved.
✓ Specific, descriptive subject✓ Names a concrete action or component✓ Provides detailed explanatory context✓ Mentions testing or verification
The short version

What changed, and why it matters

This commit fixes a small but real bug in how LND decodes onion-routed messages (used in Lightning Network offers and blinded paths). Unknown extra data fields with a valid but empty value were accidentally dropped because the code used a length check to decide what was 'known.' After the fix, it uses a nil check instead, so legitimate empty unknown fields are preserved. The bug could cause a node to silently ignore data another node expected it to forward or process, potentially breaking protocol features that rely on those fields.

Recommended action

Treat as a normal bug-fix patch. Reviewers should confirm the nil-vs-empty distinction is consistent across other TLV decode paths in lnwire, and consider whether any other components use len(tlvBytes) == 0 to detect recognized types. No immediate security response appears necessary, but operators should include this fix in their next maintenance update to avoid interoperability issues with future BOLT12 features.

Security signals we found

01

Loss of protocol data: valid unknown odd zero-length TLVs were dropped during decode

02

TLV parsing logic conflated 'recognized type' (nil map entry) with 'zero-length value' (empty byte slice)

03

Fix changes skip condition from length check to nil check

04

New regression test covers the zero-length unknown odd TLV case

05

No vendor security framing, CVE, or researcher attribution present in commit

Risk score

Why this scored 49/100

Our methodology →
Potential impact 12/30
Exploitability 8/25
Stealth signal 7/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.