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

lightningd: fix race with mutual connect.

Public commit record

What the developer wrote

Authored by Rusty Russell

68/100 · Adequate
lightningd: fix race with mutual connect.

65dccea5bde4 "pytest: fix flake in test_reconnect_signed" accidentally
introduced a bug, where the connect command may not return.

If we call "connect" while a connection is still being processed
through the peer_connected hooks, we would call peer_channels_cleanup(),
which (if the peer has no channels) would free the peer.

Then when the peer_connected hook returned, it would lookup the peer,
see it was gone, and silently return. The connect_succeeded() function
was never called, and the connect command never woken.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
Changelog-None: bug introduced this release.
✓ Descriptive subject✓ Names a concrete action or component✓ Provides detailed explanatory context
The short version

What changed, and why it matters

This is a bug fix for a race condition in Core Lightning's peer connection handling. If a user or automated process called the 'connect' command while a peer connection was still being finalized through internal hooks, the connection command could hang forever and never return a response. The fix ensures the command waits properly during the 'connecting' state instead of cleaning up the peer prematurely. There is no direct evidence this was exploited as a security vulnerability; it appears to be a reliability bug.

Recommended action

Apply the patch. Monitor for any related hangs in connect command responses. No immediate incident response is indicated unless RPC unavailability is observed.

Security signals we found

01

Race condition in connection state machine

02

Use-after-free-like pattern: peer freed while hooks still reference it

03

Command hang / denial of service via unresponsive RPC call

04

Regression introduced by prior commit

Risk score

Why this scored 33/100

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