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

clnrest: bound YAML deserialization to prevent alias-expansion OOM

Public commit record

What the developer wrote

Authored by daywalker90

85/100 · Strong
clnrest: bound YAML deserialization to prevent alias-expansion OOM

An unauthenticated POST to /v1/{method} with Content-Type: application/yaml
is parsed before the rune is verified. serde_yaml_ng 0.10.0 resolves YAML
anchors/aliases by re-deserializing the anchored node, bounded only by the
number of alias dereferences, not by what each dereference materializes.

Two distinct amplifications are possible: nested sequences of aliases
multiply into billions of nodes, and a single large anchored scalar aliased
many times is copied once per reference. A ~11 KB nested body expands to
~9 GB, and a ~0.5 MB body with a large anchored scalar expands to ~2 GB
while materializing only a few thousand nodes.

Deserialize YAML request bodies with our own budget
(plugins/rest-plugin/src/yaml.rs): a counting serde DeserializeSeed/Visitor
materializes at most MAX_YAML_NODES nodes and at most MAX_YAML_BYTES of
string data, aborting the parse once either bound is exceeded. This keeps
the footprint of any single request to a few MB regardless of the input,
while behavior on legitimate documents is unchanged.

Changelog-Fixed: clnrest: an unauthenticated YAML request using anchors/aliases could exhaust memory and crash the plugin; YAML deserialization is now bounded.
(cherry picked from commit b8c87a2b649620af371cdda578e195199a83f0ec)
✓ Specific, descriptive subject✓ Names a concrete action or component✓ Provides detailed explanatory context✓ Explains rationale or failure mode
The short version

What changed, and why it matters

This update fixes a memory exhaustion flaw in Core Lightning's REST plugin. An attacker could send a small, specially crafted YAML request to the clnrest endpoint that explodes internally into gigabytes of data, crashing the plugin. The patch adds hard limits on how large a YAML request can expand during parsing, so even malicious input stays small.

Recommended action

Apply the patch promptly. If running clnrest exposed to untrusted networks, consider restricting network access until patched. Monitor for prior anomalous memory spikes or clnrest plugin crashes that could indicate exploitation attempts.

Security signals we found

01

Unauthenticated memory-exhaustion vector in clnrest YAML parser

02

YAML anchor/alias expansion (Billion Laughs / large scalar amplification)

03

Parsing occurs before rune authentication

04

Patch adds node-count and byte-count budgets to deserialization

05

Changelog-Fixed labels this as a fixed security-relevant crash

Risk score

Why this scored 85/100

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