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

fix(core/bootloader): reject changed headers on block-0 retry

Public commit record

What the developer wrote

Authored by tychovrahe

97/100 · Strong
fix(core/bootloader): reject changed headers on block-0 retry

`on_headers` runs once, on the first IMAGE_INIT_CHUNK_SIZE prefetch: it
validates the vendor and image headers and their signatures, decides whether
the storage has to be wiped, and caches the header for the per-block hash
checks. Those checks cover only the code, starting at `headers_offset` -- the
header bytes are trusted because they were already validated.

Since the block-0 retry was fixed to re-fetch the whole block from its start,
that block carries the header bytes again, but `headers_parsed` is already set,
so nothing revalidates them. A host could fail block 0 deliberately and answer
the retry with a different image: its headers go to flash unchecked, and with a
shorter vendor header its code shifts into the part of the block that the
cached hash does not cover. The wipe decision is kept from the first image, so
a vendor change no longer erases the seed.

Record a digest of the prefetch exactly as `on_headers` accepted it, and
require block 0 to still match it before `on_chunk` sees it or it is written.
Different headers are not a transfer error a retry could fix, so this aborts
the upload instead of spending a retry.

The bug was never released.

[no changelog]

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
✓ Specific, descriptive subject✓ Names a concrete action or component✓ Uses a recognizable type or scope✓ Provides detailed explanatory context✓ Explains rationale or failure mode
The short version

What changed, and why it matters

This commit fixes a bug in the Trezor bootloader's firmware update process. When installing new firmware, the device first checks and approves the image's header (which includes things like the vendor identity and whether the storage should be wiped). Because of how retries work, a malicious or buggy host computer could have sent one approved header first, then on a retry of the very first data block sent a different image with a different header. The second header would be written to the device without being re-checked, potentially changing which vendor signed the firmware and skipping the security wipe of the user's secrets. The fix records a cryptographic fingerprint of the originally approved header and aborts the update if the retried block's header does not match exactly.

Recommended action

Ensure this fix is included in any bootloader release; verify that the headers_digest comparison cannot be bypassed and that validated_len is always set by every on_headers implementation. No user action is needed because the commit states the bug was never released.

Security signals we found

01

Bypass of header revalidation on block-0 retry

02

Potential storage-wipe decision bypass

03

Potential code placement shift via shorter vendor header

04

Fix records and enforces digest of validated header prefix

05

Abort instead of retry when headers change

Risk score

Why this scored 68/100

Our methodology →
Potential impact 22/30
Exploitability 12/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.