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

SFT-7909: require a response long enough to fill the caller's buffer

Public commit record

What the developer wrote

Authored by Jack

90/100 · Strong
SFT-7909: require a response long enough to fill the caller's buffer

Sizing the copy from len rather than from the transport count fixed the
overlong case and introduced a small one in the other direction. For OP_Info
with len=4, a response of exactly four bytes passes the minimum-length check
and skips the frame and CRC checks, so deserialize() writes tmp[0..3] and the
fixed-length copy reads tmp[1..4] -- one byte the transport never wrote --
then reports success.

Shown with a host harness compiling the real se_read(), se_read_response(),
deserialize(), check_crc() and se_crc16_chain() with only the transport and
logging replaced. A full response, then a truncated one, returned
data=11 22 33 ef with rc=0, where the transport had supplied only 11 22 33 and
ef was left in that stack slot by the preceding call.

Reject actual < len + 3 immediately before the copy, through the existing
retry path so a transient truncation gets another attempt. The guard sits
after the opcode checks on purpose: it only bites OP_Info, because for every
other opcode check_crc() requires tmp[0] == actual and the length check
requires tmp[0] == len + 3, which together already imply it. Keeping it there
also leaves the SE error-code path, which returns early on a four-byte
response, untouched.

Harness results with the guard: a full Info response still succeeds, the
truncated one returns -1 with the destination untouched, an overlong 263-byte
response still copies exactly len bytes without overflowing, and a normal
command's error response still surfaces last_error = 0xEE.

Overlong responses stay accepted rather than requiring actual == len + 3. The
comment in se_read_response() says framing is sometimes imperfect and junk can
arrive at the end, so an exact-equality gate risks refusing responses that work
today, and the overflow is already closed by copying len.
✓ Specific, descriptive subject✓ Names a concrete action or component✓ Provides detailed explanatory context✓ Explains rationale or failure mode✓ Names security-relevant behavior explicitly
The short version

What changed, and why it matters

This commit fixes a firmware bug in how the Passport hardware wallet reads replies from its secure chip. When a certain type of reply (an 'info' response) was shorter than expected, the code could copy unread bytes from leftover stack memory into the caller's buffer and report success. That could leak small amounts of whatever data happened to be on the stack, or return incorrect info about the secure chip. The fix adds a length check so short replies are rejected and retried instead of being silently accepted.

Recommended action

Treat this as a security-relevant fix and include it in the next firmware release. Review other fixed-length copies near deserialization paths for similar length assumptions. No immediate CVE coordination is required unless the vendor determines the leaked stack data can include sensitive material.

Security signals we found

01

Use of uninitialized/stack-residual data in a successful return path

02

Missing lower-bound length check before fixed-length copy

03

Secure-element communication parsing bug

04

Potential information disclosure via returned buffer contents

Risk score

Why this scored 60/100

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