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

lnpeer: decode_short_ids: check length of short ids

Public commit record

What the developer wrote

Authored by f321x

81/100 · Strong
lnpeer: decode_short_ids: check length of short ids

- if `encoded_short_ids` does not decode into a whole number of `short_channel_id`:
- MAY send a `warning`.
- MAY close the connection.
https://github.com/lightning/bolts/blob/0cf21511a781c295b9374aeaef37cf9c4d193502/07-routing-gossip.md?plain=1#L674

# Conflicts:
# electrum/lnpeer.py
✓ Specific, descriptive subject✓ Names a concrete action or component✓ Provides detailed explanatory context✓ Links an issue, advisory, or supporting reference
The short version

What changed, and why it matters

This commit adds a length check to a function that decodes Lightning network channel identifiers from peer messages. Previously, if a peer sent a malformed list whose byte count was not a multiple of 8, the function would silently produce partial or misaligned identifiers. The change now rejects such inputs and may warn or disconnect the peer, following the Lightning protocol spec.

Recommended action

Treat as a hardening fix. Review whether the raised exception is caught cleanly by callers to avoid uncaught crashes, and ensure the warning/close behavior is implemented consistently with BOLT 7.

Security signals we found

01

Input validation added for peer-supplied length-sensitive data

02

Malformed gossip query could yield truncated or misaligned short_channel_id parsing

03

Spec-compliant handling (BOLT 7) for invalid encoded short ids

04

Potential for peer-triggered exception / connection close

Risk score

Why this scored 50/100

Our methodology →
Potential impact 12/30
Exploitability 10/25
Stealth signal 8/15
Affected reach 10/15
Confidence 7/10
Evidence quality 3/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.