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

common: bound JSON nesting depth when parsing

Public commit record

What the developer wrote

Authored by Níckolas Goline

85/100 · Strong
common: bound JSON nesting depth when parsing

json_next() and the JSMN result validator each recurse once per level of
nesting, so a sufficiently deeply nested (but otherwise valid) JSON document
could exhaust the C stack. Bound the nesting depth in json_parse_input(),
before either recursive walk runs, and reject anything deeper. The depth
check is itself iterative, so it cannot overflow.

Changelog-Fixed: JSON-RPC: reject excessively-nested JSON rather than risk a stack overflow.
(cherry picked from commit b940aa32b7b385b4139bbc9251b1cca044c496cc)
✓ Descriptive subject✓ Names a concrete action or component✓ Provides detailed explanatory context✓ Explains rationale or failure mode✓ Names security-relevant behavior explicitly
The short version

What changed, and why it matters

This commit fixes a stack-overflow risk in Core Lightning's JSON parser. Before the fix, an attacker could send a valid JSON-RPC message containing thousands of nested brackets or braces. The parser's own helper functions used recursion for each nesting level, so such input could crash the process by exhausting the C call stack. The patch adds an iterative depth check (maximum 256 levels) before any recursive walk, rejecting over-nested input safely.

Recommended action

Apply the patch and run the included unit test. Consider monitoring JSON-RPC endpoints for rejected over-nested payloads. No further immediate action is required; the fix is self-contained and does not change valid payload behavior for realistic nesting depths.

Security signals we found

01

Stack-overflow via deeply nested JSON

02

Recursive JSON traversal without depth bound

03

Denial-of-service vector in JSON-RPC input parsing

04

Iterative pre-validation to bound recursion

05

Changelog-Fixed explicitly labels JSON-RPC security fix

Risk score

Why this scored 80/100

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