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

fix(clear_signing): parse arrays of static structs per the ABI spec.

Public commit record

What the developer wrote

Authored by PrisionMike

100/100 · Strong
fix(clear_signing): parse arrays of static structs per the ABI spec.

Unify head handling in ABIValue.parse(): a static value is encoded in
place (head_size bytes), a dynamic value's head is one word holding its
body offset, relative to the enclosing block. Subclasses now implement
only parse_body(). This replaces the four-branch isinstance dispatch in
Array and the two-mode Tuple.parse.

Previously the Array unconditionally dereferenced element heads,
assuming every struct element is a dynamic type, and from_proto
compensated by mislabeling array-nested tuples as is_dynamic=False
("don't dereference again"). That pair is correct for dynamic structs
(e.g. LiFi's, with bytes callData) but misparses arrays of fully static
structs, whose elements are canonically encoded in place at a stride of
the struct size, with no offsets at all.

is_dynamic is now the truthful, type-level ABI property everywhere:
the four LiFi array-nested tuples become is_dynamic=True, and
from_proto derives the flag for array-nested tuples from their fields
(the wire flag stays ignored in that position, as it always was).

The two hand-crafted vectors for the debug paths descriptor encoded the
old non-canonical layout (offset heads for a static struct array) and
are re-encoded canonically; the JSON fixture's signature is recomputed
accordingly. Note the signature assertions cannot catch encoding
regressions (blind-signing fallback signs the same bytes); the new
array-of-static-structs unit test and the token-request assertions in
test_definitions_request.py are the real guards.

[no changelog]

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
✓ Specific, descriptive subject✓ Names a concrete action or component✓ Uses a recognizable type or scope✓ Provides detailed explanatory context✓ Mentions testing or verification✓ Names security-relevant behavior explicitly
The short version

What changed, and why it matters

This commit fixes a bug in how Trezor firmware parses Ethereum transaction data for 'clear signing' of complex smart-contract calls. The parser previously misread arrays of simple structs (e.g., lists of token-swap details) because it assumed every struct element was stored via an offset pointer, which is only true for structs containing variable-length data. With the correct ABI behavior, static structs are now read directly in sequence. The bug could cause Trezor to display wrong values or fall back to blind signing, but it does not leak private keys or directly steal funds. The fix also hardens parsing against malformed empty structs and out-of-bounds reads.

Recommended action

Treat this as a security-hardening correctness fix for the Ethereum clear-signing parser. Reviewers should verify that the new canonical encoding matches the Solidity ABI spec for arrays of static structs, confirm the updated test vectors and signatures are valid, and ensure the empty-tuple rejection and bounds checks are present in shipped firmware. Consider whether prior firmware versions could be induced to blind-sign or mis-display crafted calldata and issue an advisory if user-visible risk is confirmed.

Security signals we found

01

Incorrect ABI decoding of arrays of static structs could lead to mis-displayed transaction fields during clear signing.

02

Mis-decoded fields may cause users to approve transactions different from what they see, or trigger blind-signing fallback.

03

Bounds-check improvements and rejection of zero-field tuples reduce denial-of-service / unbounded parse risks.

04

No evidence of private-key exposure, arbitrary code execution, or direct fund theft in the diff.

Risk score

Why this scored 62/100

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