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

Add missing bound check in call_get_preimage

Public commit record

What the developer wrote

Authored by Salvatore Ingala

60/100 · Adequate
Add missing bound check in call_get_preimage

Also add return value checks on all calls to buffer_write_bytes.
✓ Descriptive subject✓ Names a concrete action or component✓ Provides an explanatory body
The short version

What changed, and why it matters

This commit fixes a missing safety check in the Ledger Bitcoin app's code that copies a 'preimage' (a piece of data used in Bitcoin transactions) into an output buffer. Before the fix, if the preimage was larger than the buffer, the app could write past the end of the buffer, corrupting memory. The patch adds a size check and also checks the result of every buffer write so the app stops safely instead of overflowing. This is a memory-safety bug that could potentially be exploited from a host computer talking to the device.

Recommended action

Treat this as a security fix and include it in the next firmware/app release. Review related handlers for similar unchecked buffer_write_bytes() calls. If a previous release shipped without this fix, consider whether an advisory is warranted for memory-corruption risk in a hardware wallet trusted code path.

Security signals we found

01

Missing bounds check on output buffer length

02

Unchecked return value of buffer_write_bytes leading to potential buffer overflow

03

Memory corruption risk in device-side APDU handler

04

Fix pattern consistent with CVE-worthy memory-safety defect

Risk score

Why this scored 72/100

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