chore(core): fail earlier if the device is not initialized
What changed, and why it matters
This commit moves a safety check earlier in the process of setting up a cryptographic seed on a Trezor device. The check ensures the device is properly initialized before it proceeds. By running the check earlier, it prevents a situation where a seed might already be cached or a passphrase accepted before the initialization check happens. This is a defensive hardening change, not a confirmed exploitable vulnerability, because the commit message does not describe a security issue and no exploit path is shown in the diff.
Treat as a low-risk hardening patch. Reviewers should confirm that raise_if_not_initialized() is the correct and sufficient guard for the THP path and that no other entry points bypass it. No urgent user action is indicated absent additional evidence of an exploitable vulnerability.
Security signals we found
Authorization/state check reordered to fail earlier
Defensive hardening around seed derivation and passphrase handling
No explicit security claim or changelog entry in commit
Evidence from the diff
In core/src/apps/common/seed.py, the call to raise_if_not_initialized() is moved above the cache-seed check and passphrase handling in the THP (Trezor Host Protocol) code path. Previously, the function accepted a passphrase, checked whether a seed was already cached, and only then verified initialization. The reordering ensures the device must be initialized before any passphrase work or cache inspection occurs. The change is minimal (+2/-2 lines) and appears to be preventive hardening rather than a fix for a demonstrated bug.
Changed components
core/src/apps/common/seed.pyTrezor Core firmware seed derivation flowTHP (Trezor Host Protocol) initialization pathInspect captured patch +2 / −2
diff --git a/core/src/apps/common/seed.py b/core/src/apps/common/seed.py
index cd77ace6..daaf9abd 100644
--- a/core/src/apps/common/seed.py
+++ b/core/src/apps/common/seed.py
@@ -86,11 +86,11 @@ if utils.USE_THP:
if msg.passphrase is not None and msg.on_device:
raise DataError("Passphrase provided when it shouldn't be!")
+ raise_if_not_initialized()
+
if ctx.cache.is_set(APP_COMMON_SEED):
raise Exception("Seed is already set!")
- raise_if_not_initialized()
-
passphrase = await get_passphrase(msg)
common_seed = mnemonic.get_seed(passphrase)
ctx.cache.set(APP_COMMON_SEED, common_seed)
Why this scored 35/100
Community notes
Notes can correct, qualify, or add evidence to the AI analysis. Every note shown here has been validated by a human moderator.
The AI analysis stands alone for now. Submit a note if you can add evidence or important context.