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

fix(core/rust): fix UB due to unaligned access in protobuf codec

Public commit record

What the developer wrote

Authored by matejcik

74/100 · Adequate
fix(core/rust): fix UB due to unaligned access in protobuf codec
✓ Specific, descriptive subject✓ Names a concrete action or component✓ Uses a recognizable type or scope✓ Explains rationale or failure mode! No meaningful explanatory body
The short version

What changed, and why it matters

This commit fixes undefined behavior in the Rust-based protobuf codec inside Trezor firmware. The code was reading multi-byte integers from data files that were not guaranteed to be properly aligned in memory, which can cause crashes or unpredictable behavior on some hardware. The patch ensures the data files are loaded with correct memory alignment and removes the use of 'packed' structs that forced unaligned access. It is a defensive hardening fix rather than a confirmed remote exploit.

Recommended action

Treat as a security-hardening fix and include in the next firmware release. Review whether any other Rust modules use include_bytes! followed by transmute/align_to for multi-byte types. Run tests on actual device hardware to confirm no remaining unaligned-access faults. No immediate user action is required.

Security signals we found

01

Undefined behavior due to unaligned pointer access in Rust protobuf codec

02

Use of include_bytes! without alignment guarantees for u16-backed structs

03

Removal of repr(C, packed) from FieldDef, NameDef, WireDef

04

Addition of alignment static assertions and include_aligned! macro

05

Generator script pb2py updated to align ENUM_ENTRY/MSG_ENTRY to 2 bytes

Risk score

Why this scored 61/100

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