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

lightningd: fix segfault when parse_filter fails

Public commit record

What the developer wrote

Authored by dovgopoly

68/100 · Adequate
lightningd: fix segfault when parse_filter fails

We need to initialize ->json_cmd *before* complaining about malformed
filters.

```
lightningd: FATAL SIGNAL 11 (version v25.12-21-g3851187-modded)
0x1042d2023 ???
send_backtrace+0x4f:0
0x1042d20cb ???
crashdump+0x43:0
0x19fe3b743 ???
???:0
0x104180173 command_log
lightningd/jsonrpc.c:1406
0x10420d8f7 command_fail_badparam
common/json_command.c:25
0x104181a07 parse_request
lightningd/jsonrpc.c:1075
0x104181a07 read_json
lightningd/jsonrpc.c:1216
0x10424c65b next_plan
ccan/ccan/io/io.c:60
0x10424c65b do_plan
ccan/ccan/io/io.c:422
0x10424c587 io_ready
ccan/ccan/io/io.c:439
0x10424dd9b io_loop
ccan/ccan/io/poll.c:470
0x10417ede7 io_loop_with_timers
lightningd/io_loop_with_timers.c:22
0x104183a33 main
lightningd/lightningd.c:1492
```

Co-authored-by: Rusty Russell <rusty@rustcorp.com.au>
Changelog-Fixed: JSON-RPC: malformed filters no longer crash lightningd.
✓ Descriptive subject✓ Names a concrete action or component✓ Provides detailed explanatory context
The short version

What changed, and why it matters

This commit fixes a bug where a malformed JSON-RPC filter could crash the Core Lightning daemon (lightningd) with a segmentation fault. The crash happened because the code tried to report the malformed filter before it had looked up the command it was processing. The fix moves the command lookup earlier, so the error can be reported safely without dereferencing a null pointer.

Recommended action

Apply the patch. It is a small, targeted fix with a clear crash reproduction. Nodes accepting JSON-RPC connections (especially from untrusted or buggy clients) should upgrade to avoid denial-of-service crashes. No additional mitigation is required beyond patching.

Security signals we found

01

NULL pointer dereference leading to daemon crash (DoS)

02

Use-after-initialization ordering bug in JSON-RPC request parsing

03

Crash triggered by malformed user-supplied RPC filter parameter

04

Changelog explicitly labels this as a JSON-RPC crash fix

Risk score

Why this scored 72/100

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