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

discovery: bound channel range reply buffering

Public commit record

What the developer wrote

Authored by Olaoluwa Osuntokun

68/100 · Adequate
discovery: bound channel range reply buffering

In this commit, we cap each QueryChannelRange response at 100,000 SCIDs
across all streamed replies. The existing reply-count limit did not track
the aggregate decoded working set, so memory use varied with the encoding
and composition of the reply stream.

We count raw SCIDs before timestamp filtering, charge replies using the
received encoding type, and release all accumulated range state on any
error. This bounds both memory and CPU work while still leaving headroom
above the current graph.
✓ Descriptive subject✓ Names a concrete action or component✓ Provides detailed explanatory context
The short version

What changed, and why it matters

This change fixes a way a malicious or buggy peer could make an LND node use an unpredictable amount of memory while syncing the Lightning channel graph. Before the fix, the node only limited the size of one compressed reply message, but an attacker could send many replies or craft replies so the total number of channel IDs ballooned. The patch caps the total number of channel IDs per sync at 100,000 and makes sure the temporary buffer is freed immediately if anything goes wrong, so a peer cannot trap memory by deliberately causing an error.

Recommended action

Treat this as a security hardening fix and include it in the 0.22.0 release. Operators running public or untrusted peers should upgrade. No immediate incident response is required unless unusual memory pressure has been observed during graph sync.

Security signals we found

01

Resource exhaustion / unbounded memory growth in gossip sync

02

Remote peer can influence memory allocation via ReplyChannelRange stream

03

Missing aggregate limit on decoded working set

04

State not released on validation errors, enabling memory pinning

05

Potential nil-pointer dereference on reply without active query

06

Release-notes explicitly describe the security/reliability relevance

Risk score

Why this scored 72/100

Our methodology →
Potential impact 22/30
Exploitability 16/25
Stealth signal 10/15
Affected reach 12/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.