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

fix(nordic): bound the length of SPI frames from the host MCU

Public commit record

What the developer wrote

Authored by tychovrahe

85/100 · Strong
fix(nordic): bound the length of SPI frames from the host MCU

process_rx_msg() copied `len` bytes into trz_packet_t.data[254] without
checking it. `msg_len` is a uint8_t, so the destination could be overflowed
by one byte - landing in the packet's own `len` field - and the source read
could run two bytes past the 254-byte SPI receive buffer, whose data field
starts at offset 2 and is 251 bytes long.

Bound both ends: reject frames whose msg_len exceeds MAX_SPI_DATA_SIZE while
the frame is being validated, and keep a check against PACKET_DATA_SIZE in
process_rx_msg(), which owns the destination.

[no changelog]
✓ Specific, descriptive subject✓ Names a concrete action or component✓ Uses a recognizable type or scope✓ Provides detailed explanatory context
The short version

What changed, and why it matters

This commit fixes a small but real memory overflow bug in the code that handles Bluetooth-related SPI messages between the host microcontroller and the Nordic chip in a Trezor device. A malicious or malformed message could ask the firmware to copy slightly more data than the destination buffer can hold, potentially corrupting an adjacent length field and reading past the end of the receive buffer. The patch now rejects oversized frames at two different points in the code.

Recommended action

Treat this as a security fix and include it in release notes or a changelog entry. Review whether the same pattern exists in other transport paths. Consider fuzzing the SPI/ BLE message parsers. No independent CVE is required unless the vendor determines exploitability warrants one.

Security signals we found

01

Buffer overflow / out-of-bounds write in packet handling

02

Out-of-bounds read from SPI receive buffer

03

Missing length validation on attacker-influenced message field

04

Defense-in-depth: bounds check added at both validation and consumption layers

Risk score

Why this scored 49/100

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