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

refactor(invoice): align signature checks with BOLT11 semantics

Public commit record

What the developer wrote

Authored by Erick Cestari

100/100 · Strong
refactor(invoice): align signature checks with BOLT11 semantics

Simplify `check_signature` logic to follow the BOLT11 rules discussed:

- If an `n` field is present, verify the signature against the included
pubkey using `secp256k1_ecdsa_verify`, which enforces normalized
low-S form.

- If no `n` field is present, rely on `secp256k1_ecdsa_recover` to
extract the pubkey. Recovery accepts both high-S and low-S signatures,
matching existing implementations (lnd, c-lightning).

This avoids redundant recovery+verify checks while preserving
interoperability.
✓ Specific, descriptive subject✓ Names a concrete action or component✓ Uses a recognizable type or scope✓ Provides detailed explanatory context✓ Mentions testing or verification✓ Names security-relevant behavior explicitly
The short version

What changed, and why it matters

This commit changes how Bitcoin Lightning invoices (BOLT11) are validated. Previously, the code always tried to recover the signer's public key from the signature and also verified it, which could reject some signatures that other Lightning implementations accept. Now, if the invoice explicitly includes a public key, it only verifies the signature against that key (and requires a strict low-S signature). If no public key is included, it recovers the public key from the signature, accepting both high-S and low-S signatures like lnd and c-lightning. This is described as an interoperability fix, not a security vulnerability, but it slightly weakens signature strictness in the no-pubkey case.

Recommended action

Review whether accepting high-S signatures in the recovery-only path is acceptable for your security model and BOLT11 compliance. Monitor for any related vulnerability reports or follow-up commits that add tests or further harden signature handling. No immediate patch action is indicated by the commit itself.

Security signals we found

01

Signature verification logic changed from verify+recover to branch on presence of n field

02

Recovery-only path now accepts high-S signatures, matching lnd/c-lightning behavior

03

Verification path with explicit pubkey enforces low-S normalization via to_standard()

04

Removal of InvalidRecoveryId error handling reduces strictness

05

No explicit security bug or CVE referenced in commit message

Risk score

Why this scored 35/100

Our methodology →
Potential impact 8/30
Exploitability 6/25
Stealth signal 5/15
Affected reach 7/15
Confidence 6/10
Evidence quality 3/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.