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

LSPS2: Release pruned pending requests from the total limit

Public commit record

What the developer wrote

Authored by auto-pr-bot

83/100 · Strong
LSPS2: Release pruned pending requests from the total limit

The LSPS2 service counts unanswered `get_info`/`buy` requests in a global
`total_pending_requests` counter and refuses new requests from any peer
once it reaches `MAX_TOTAL_PENDING_REQUESTS`. When a peer disconnected,
its pending requests were dropped from the per-peer map by
`prune_pending_requests` without lowering the counter, so every request
still unanswered at disconnect permanently consumed one of the 1,000
global slots until the process restarted. A peer with throw-away node
keys could thus pin an LSP at the limit and refuse `lsps2.get_info` and
`lsps2.buy` to all clients, and ordinary clients that lost their
connection before being answered drifted the counter upward, too.

Have `prune_pending_requests` return how many entries it removed (the
same shape LSPS1's already has) and subtract that from the counter in
`peer_disconnected`, using the same saturating `fetch_update` and
out-of-sync `debug_assert!` idiom as `remove_pending_request`.
`peer_disconnected` is the only caller of `prune_pending_requests`, and
together with `remove_pending_request` this covers every removal from
`pending_requests`, so the counter stays in sync with the per-peer maps
as `verify_pending_request_counter` asserts.

Reported by Anthropic's OSS Scanner as ANT-2026-S58419MV and
independently by Erick Cestari.

@tnull asked:

> @auto-pr-bot please fix this, including in the commit message that
> this was reported by Anthropic's OSS Scanner, as ANT-2026-S58419MV.
>
> Release requests pruned in peer_disconnected from
> total_pending_requests, keeping the counter in sync with what
> prune_pending_requests removes. Add a regression test that fails
> without the fix.

Requested-by: @tnull
Authored-By: matt/GLM-5.3-Flash-GGUF:Q4_K_XL <goose@users.noreply.local>
✓ 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 denial-of-service bug in the LSPS2 (Lightning Service Provider Specification 2) service code. The service tracks how many unanswered client requests it has globally and stops accepting new ones after 1,000. When a client disconnected before being answered, the per-client request list was cleaned up, but the global counter was not reduced. That meant every such request permanently consumed one of the 1,000 slots until the program restarted. An attacker could repeatedly connect, send a request, and disconnect to exhaust the slot limit, blocking legitimate clients from using the service. The fix makes the cleanup routine report how many requests it removed and subtracts that from the global counter when a peer disconnects. A regression test is included.

Recommended action

Review and merge the patch, then backport to maintained release branches that include the LSPS2 service code. Monitor for any other sites where pending_requests entries are removed without updating total_pending_requests. Run the new regression test in CI.

Security signals we found

01

Denial-of-service via resource exhaustion of a global request quota

02

Counter desynchronization between per-peer state and global atomic counter

03

Missing decrement on peer disconnect leading to permanent slot consumption

04

Fix includes regression test demonstrating exploitability

05

Reported by external security scanner and independent researcher

Risk score

Why this scored 76/100

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