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

Rename and clear var containing k or -k

Public commit record

What the developer wrote

Authored by John Moffett

68/100 · Adequate
Rename and clear var containing k or -k

buf currently holds k or -k and isn't cleared, so clear it and rename to
nonce32 to clarify its sensitivity and match how it is named in the
corresponding ECDSA sign_inner.
✓ Descriptive subject✓ Names a concrete action or component✓ Provides detailed explanatory context
The short version

What changed, and why it matters

This commit fixes a small but real security hygiene issue in the Schnorr signature code. A 32-byte buffer that holds the secret signing nonce (the random-like value 'k') was not being wiped from memory after use. The patch renames the buffer to make its sensitive role obvious and adds an explicit clear operation so the nonce does not linger in stack memory after the function returns. If an attacker could read leftover process memory, the un-cleared nonce could help forge signatures for that message/key. The fix is straightforward and aligns the Schnorr code with the existing ECDSA behavior.

Recommended action

Treat as a low-to-moderate defensive-security fix. Review whether any released versions shipped with the uncleared buffer and consider a backport or advisory if the library guarantees memory scrubbing of sensitive intermediates. No immediate emergency response is warranted because exploitation requires an attacker to read process memory, but the patch should be included in the next maintenance release.

Security signals we found

01

Sensitive cryptographic material (Schnorr nonce k/-k) left uncleared in stack memory

02

Addition of explicit memory clearing via secp256k1_memclear

03

Variable renamed to nonce32 to signal sensitive contents

04

Alignment with existing ECDSA sign_inner cleanup pattern

05

Potential information disclosure / nonce reuse risk if memory is exposed

Risk score

Why this scored 44/100

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