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

fix(core): fix nrf tlv offset calculatiion wrap

Public commit record

What the developer wrote

Authored by tychovrahe

57/100 · Thin
fix(core): fix nrf tlv offset calculatiion wrap

[no changelog]
✓ Descriptive subject✓ Names a concrete action or component✓ Uses a recognizable type or scope! No meaningful explanatory body
The short version

What changed, and why it matters

This commit fixes a bug in the Trezor hardware wallet's firmware update code for the nRF wireless chip. The code reads update image headers from an untrusted source and calculates where to look for a SHA-256 hash inside the image. Before the fix, the calculation used a signed offset type and did not check whether the claimed image size was larger than the actual buffer. A malicious or malformed update image could make the offset wrap around (become a small number due to integer overflow), bypassing later safety checks and potentially causing the device to read memory outside the intended buffer. The fix rejects images whose claimed size exceeds the buffer and uses an unsigned type for the offset calculation.

Recommended action

Treat this as a security-relevant hardening fix. Verify whether this code path is reachable from untrusted input (e.g., USB/Bluetooth firmware update commands or malicious update files) and backport the bounds check to other branches. Consider adding similar img_size > binary_size checks elsewhere in the nRF update code and reviewing other uses of off_t for untrusted offsets.

Security signals we found

01

Integer overflow/wrap in offset calculation on attacker-controlled header fields

02

Out-of-bounds read primitive in firmware image parsing

03

Missing size validation against buffer bounds

04

Signed offset type used for memory arithmetic

05

Patch adds explicit bounds check and switches to unsigned arithmetic

Risk score

Why this scored 61/100

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