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

lightningd: check expiry bounds in createinvoice too

Public commit record

What the developer wrote

Authored by Amperstrand

78/100 · Adequate
lightningd: check expiry bounds in createinvoice too

A crafted bolt11 can carry expiry >= 2^32 past the invoice RPC's
gate: the expiry field is a varint and decode does not require a
valid signature, so createinvoice fed b11->expiry straight into
invoice creation -- hitting the same bolt11_encode() 60-bit abort
and expiry-timer overflow as the invoice path. Same bound, same
message, placed before the re-encode. Pointed out in the PR thread.

Changelog-Fixed: lightningd: refuse bolt11 `expiry` above 2^32 seconds in `createinvoice` too, instead of crashing or busy-looping.
Signed-off-by: Amperstrand <amperstrand@localhost>
(cherry picked from commit 5f433f04e84cda27a4298500860af18e6b9b8e87)
✓ 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 commit fixes a bug in Core Lightning's createinvoice RPC. A malicious or malformed BOLT11 invoice could include an expiry time of 2^32 seconds or more. Because createinvoice decoded the invoice without checking signature validity, it would accept that oversized expiry and either crash the daemon (inside bolt11_encode) or cause the expiry timer to misbehave. The fix adds the same upper bound check that already existed for the invoice RPC, refusing such invoices with a clear error message instead of crashing or busy-looping.

Recommended action

Apply the patch and run the included regression test. Review other RPCs that decode BOLT11 without signature verification to ensure similar bounds are enforced consistently. Consider hardening bolt11_encode and the timer code against out-of-range expiry values as defense in depth.

Security signals we found

01

Denial-of-service vector: malformed input can crash daemon or cause busy-loop

02

Input validation gap: signature-not-required decode path bypasses existing expiry bound

03

Integer/overflow-related failure: expiry timer overflow at large values

04

Assertion abort in bolt11_encode() for expiry > 60 bits

05

Fix mirrors existing bound from invoice RPC into createinvoice RPC

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.