fix(core/fido2): unlock before handling `_CBOR_RESET`
What changed, and why it matters
This commit fixes a bug in the Trezor device's FIDO2 (WebAuthn/passwordless login) feature. Before the fix, if a user tried to perform a factory reset of FIDO2 credentials while the device storage was locked (for example, after auto-lock or reboot), the reset could not actually delete the stored credentials because the code skipped the unlock step. The fix ensures the device prompts for the PIN to unlock storage before processing the reset, so credentials can be properly wiped.
Treat as a low-to-moderate reliability/security fix. Review whether the locked-state behavior could leave residual credentials after a reset attempt and whether any other destructive FIDO2 operations similarly bypass the unlock check. No immediate emergency response is indicated, but the fix should be included in the next firmware release.
Security signals we found
Functional bug in security-sensitive operation (FIDO2 authenticator reset)
Storage lock state not verified before credential deletion attempt
Missing PIN/unlock gate on destructive operation
Patch adds explicit unlock flow before reset confirmation
Evidence from the diff
In core/src/apps/webauthn/fido2.py, the _cbor_reset handler previously directly transitioned to Fido2ConfirmReset without ensuring the configuration/storage was unlocked. The patch introduces _cbor_reset_process and wraps it in Fido2Unlock when config.is_unlocked() is false. This causes the device to request PIN entry and then proceed to the reset confirmation, ensuring credential deletion can occur against unlocked storage.
Changed components
Trezor Core firmwareFIDO2/WebAuthn implementationcore/src/apps/webauthn/fido2.pyInspect captured patch +10 / −1
### core/src/apps/webauthn/fido2.py
@@ -1991,10 +1991,19 @@ def _cbor_reset(req: Cmd, dialog_mgr: DialogManager) -> Cmd | None:
# Return success, because the authenticator is already in factory default state.
return cbor_error(req.cid, _ERR_NONE)
- if not dialog_mgr.set_state(Fido2ConfirmReset(req.cid, dialog_mgr.iface)):
+ if config.is_unlocked():
+ state = _cbor_reset_process(req, dialog_mgr)
+ else:
+ state = Fido2Unlock(_cbor_reset_process, req, dialog_mgr)
+
+ if not dialog_mgr.set_state(state):
return cmd_error(req.cid, _ERR_CHANNEL_BUSY)
return None
+def _cbor_reset_process(req: Cmd, dialog_mgr: DialogManager) -> State:
+ return Fido2ConfirmReset(req.cid, dialog_mgr.iface)
+
+
def cmd_keepalive(cid: int, status: int) -> Cmd:
return Cmd(cid, _CMD_KEEPALIVE, bytes([status]))Why this scored 42/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.