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

sign: disallow overlong der encodings and zero r or s values

Public commit record

What the developer wrote

Authored by Jon Griffiths

85/100 · Strong
sign: disallow overlong der encodings and zero r or s values

libsecp will happily parse and return such signatures without error,
however they can never be valid (in the overlong case, because libsecp
internally sets R to zero). Reject them up-front when parsing rather
than failing when attempting to use them later.
✓ 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 commit tightens signature validation in a cryptographic library. It now rejects malformed DER-encoded signatures that are longer than allowed, or where one of the signature numbers (R or S) is zero. Previously, the underlying secp256k1 library would accept these invalid forms silently, which could lead to later failures or unexpected behavior when the signatures are used in Bitcoin/Elements transactions.

Recommended action

Review callers of wally_ec_sig_from_der() to ensure they handle parse failures correctly, and verify that EC_SIGNATURE_DER_MAX_LEN is consistent with other DER length limits in the project. Consider adding test vectors for overlong DER and zero R/S signatures.

Security signals we found

01

Cryptographic input validation hardening

02

Rejection of overlong DER-encoded ECDSA signatures

03

Rejection of zero R or S signature components

04

Defense-in-depth against invalid signatures being accepted silently

Risk score

Why this scored 62/100

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