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

Harden crypto_derive_symmetric_key

Public commit record

What the developer wrote

Authored by Salvatore Ingala

53/100 · Thin
Harden crypto_derive_symmetric_key

The function would cause a buffer overflow passed a buffer longer
than 32 bytes. This is not an issue today as it was only ever used
for a fixed short string (WALLET_SLIP0021_LABEL).

The workaround to copy into a local buffer is still needed, so we
defensively forbid longer strings.
✓ Descriptive subject✓ Provides detailed explanatory context✓ Names security-relevant behavior explicitly! Too few words to establish purpose
The short version

What changed, and why it matters

This commit fixes a defensive coding issue in the Ledger Bitcoin app. A function that derives a secret key from a text label could overflow an internal 32-byte buffer if given a label longer than 32 bytes. In practice, the app only ever passed one fixed short label, so the overflow was not reachable from normal use. The patch now rejects oversized labels and also handles the rare failure case when generating a wallet security code (HMAC).

Recommended action

Treat as a hardening fix with low immediate risk because the only known caller passes a fixed short label. Review all call sites of crypto_derive_symmetric_key to confirm no new callers can pass attacker-controlled long labels, and ensure downstream callers now check the new false return value. Consider adding unit tests for label_len > 32 and for HMAC failure paths.

Security signals we found

01

Stack buffer overflow potential in crypto_derive_symmetric_key

02

Missing input length validation on label_len before memcpy

03

Failure to check return value of compute_wallet_hmac in register_wallet

04

Defensive hardening rather than currently exploitable vulnerability

05

SLIP-0021 key derivation with alignment workaround

Risk score

Why this scored 45/100

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