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

fix(crypto): Fix side-channel vulnerability in BIP-39 mnemonic processing

Public commit record

What the developer wrote

Authored by Martin Pastyřík

100/100 · Strong
fix(crypto): Fix side-channel vulnerability in BIP-39 mnemonic processing

Fix function `mnemonic_to_bits` to be constant time. Replace binary search over the wordlist with a linear search to ensure the same number of comparisons.
Introduce function `constant_time_memeq` that comapres two parts of memory in costant time.
Remove integrity check in legacy to reduce the number of computations over seed.

(cherry picked from commit 4e6f0dee81b4d9e553d247faa3194b8053b74dcb)
✓ Specific, descriptive subject✓ Names a concrete action or component✓ Uses a recognizable type or scope✓ Provides detailed explanatory context✓ Explains rationale or failure mode✓ Names security-relevant behavior explicitly
The short version

What changed, and why it matters

This commit fixes a timing side-channel flaw in how Trezor hardware wallets convert a user's recovery phrase (BIP-39 mnemonic words) into secret seed bits. The old code used a fast but variable-time binary search over the word list, which could let a local attacker with precise timing measurements learn information about the recovery words. The patch replaces it with a constant-time linear comparison and also removes an extra integrity check in older (legacy) Trezor firmware to reduce how often the secret seed is processed.

Recommended action

Treat this as a security fix and ensure it is included in firmware releases for affected Trezor devices. Users should update firmware when available. Developers should verify that callers of `mnemonic_find_word()` supply at least `BIP39_MAX_WORD_LEN + 1` byte buffers, as the function now reads up to 9 bytes. Review whether the removed legacy `mnemonic_check()` call had any non-security purpose that needs replacement.

Security signals we found

01

Side-channel fix: replaces binary search with constant-time linear scan

02

New constant-time memory comparison helper `constant_time_memeq`

03

Mask-based selection of matched word index to avoid secret-dependent branches

04

Removal of legacy `mnemonic_check()` integrity check to reduce seed exposure

05

Changelog entry explicitly labels the change as a security fix

Risk score

Why this scored 76/100

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