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

lightningd: don't allocate huge log entries on the stack

Public commit record

What the developer wrote

Authored by Vincenzo Palazzo

78/100 · Adequate
lightningd: don't allocate huge log entries on the stack

log_to_files() sized a stack VLA by the log string's length. Callers
can log attacker-controlled strings of arbitrary size - e.g. clnrest
logging unauthenticated request parameters on rune failure - so a
single ~10MB HTTP request overflowed the stack and crashed lightningd
(SIGSEGV).

Use a fixed 1kB stack buffer for normal entries and a heap allocation
for oversized ones.

Changelog-Fixed: lightningd: logging a very large message no longer crashes the node (stack overflow).

Reported-by: Vincenzo Palazzo (Bitcoin Security Council finding 2026-08-10)
(cherry picked from commit cc90f6b63da7a1ea9ea0b8276a96980dd2ed7496)
✓ Specific, descriptive subject✓ Names a concrete action or component✓ Provides detailed explanatory context✓ Names security-relevant behavior explicitly
The short version

What changed, and why it matters

This fix prevents a crash in Core Lightning's logging code. Previously, when the program wrote a log message, it reserved space on the stack based on the message's length. Because some logged text comes from outside sources (for example, unauthenticated web requests to the clnrest plugin), an attacker could send a very large request and cause the program to overflow its stack, crashing the node. The patch now uses a small fixed stack buffer for ordinary messages and switches to a heap allocation only when a message is unusually large.

Recommended action

Apply this patch promptly. It is a targeted, low-risk fix. If running a node exposed to clnrest or other interfaces that log external input, treat this as a denial-of-service issue that can be triggered remotely without authentication. Consider reviewing other VLA or stack-allocation patterns in logging and plugin code for similar issues.

Security signals we found

01

Stack-based variable-length allocation sized by attacker-influenced input

02

Remote unauthenticated input can reach the vulnerable logging path (clnrest request parameters)

03

Denial-of-service crash (SIGSEGV) demonstrated with a ~10 MB request

04

Changelog explicitly labels this as a crash fix for logging very large messages

05

Reported-by line credits an external security researcher/finding

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.