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

Bound microSD message read at read time, not via separate stat

Public commit record

What the developer wrote

Authored by Jack

73/100 · Adequate
Bound microSD message read at read time, not via separate stat

A separate stat in its own CardSlot() left a TOCTOU window where a swapped file could still be read unbounded. Move the cap into a bounded read_fn inside the read.
✓ Specific, 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 security bug in the Passport hardware wallet's microSD message-signing flow. Previously, the firmware checked a file's size in one operation and then read it in another. Because the microSD card could be swapped between those two moments, a malicious file larger than the allowed limit could still be loaded. The fix reads only a bounded number of bytes in a single operation, closing that window.

Recommended action

Treat this as a security fix and include it in the next firmware release. Review other flows that stat-then-read files from microSD for similar TOCTOU issues. Consider whether ReadFileFlow should offer a built-in max_bytes option to make bounded reads the default.

Security signals we found

01

TOCTOU race condition between file-size stat and file read

02

Bypass of MSG_SIGNING_MAX_LENGTH length limit via microSD swap

03

Unbounded read of attacker-controlled file from removable media

04

Fix enforces bound at read time inside a single CardSlot() lifetime

Risk score

Why this scored 59/100

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