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

Merge branch 'nickez/bb02-utf8-safe'

Public commit record

What the developer wrote

Authored by Niklas Dusenlund

45/100 · Thin
Merge branch 'nickez/bb02-utf8-safe'
✓ Descriptive subject✓ Names a concrete action or component! No meaningful explanatory body
The short version

What changed, and why it matters

This commit hardens the BitBox02 firmware so it stops trusting that incoming text strings are valid UTF-8 or plain ASCII. It replaces risky C string copies with length-checked, UTF-8-aware helpers, rejects non-ASCII characters at UI boundaries, and prevents malformed multi-byte characters from being cut in half when labels or device names are truncated. The changes reduce the chance that an attacker could crash the device or hide parts of a message by sending carefully crafted strings.

Recommended action

Treat this as a security-hardening patch and include it in the next firmware release. Review remaining `from_utf8_unchecked` call sites to confirm their safety invariants are actually upheld at runtime, and continue fuzzing the new `util_utf8_copy`/`util_utf8_strlcpy` helpers with null pointers, zero lengths, and invalid UTF-8 sequences.

Security signals we found

01

Replaced snprintf-based string copies with length-bounded UTF-8-aware copies

02

Added explicit length parameter to memory_set_device_name and reject embedded/invalid nulls

03

Added printable-ASCII enforcement at Rust UI boundary before C rendering

04

Added UTF-8-safe truncation that does not split multi-byte code points

05

Replaced panic-prone CStr::to_str().unwrap() with error-returning paths in U2F workflow

06

Added safety comments justifying remaining unsafe from_utf8_unchecked usage

07

Added unit tests covering invalid UTF-8, embedded nulls, and truncation behavior

Risk score

Why this scored 53/100

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