bugfix: premature wipe while exporting secret material via NFC - only first export loop (0th) was actually sending data
What changed, and why it matters
This commit fixes a bug in the COLDCARD hardware wallet's NFC export feature. When exporting secret material (like a seed or private key) over NFC, the device was supposed to keep broadcasting the data in a loop until the user aborted or the recipient confirmed it was read. Due to a logic error, the device would wipe the temporary secret from its NFC chip after the very first loop, even though the user was still trying to export it. This meant subsequent NFC reads would fail or return nothing, making the export unreliable. The fix ensures the wipe only happens when the user actually aborts the operation.
Treat as a reliability/availability bug with potential security implications for secret backup workflows. Users exporting seeds or private keys over NFC should upgrade to a release containing this fix. Review whether failed exports due to this bug could have led users to retry or misinterpret device state, and consider adding tests covering multi-loop NFC export behavior.
Security signals we found
Data destruction / availability failure in secret export path
Logic error causing premature wipe of sensitive material
NFC secret-export loop behavior changed to match intended lifecycle
No explicit security framing by vendor; described as bugfix in changelog
Evidence from the diff
In shared/nfc.py, the share_loop() method handles exporting data via NFC. The original code unconditionally called self.wipe(is_secret) whenever write_mode was false. Because write_mode is false during secret export (the device writes the secret once and then waits for the recipient to read it), the wipe ran after the first iteration of the loop, clearing the NFC chip before the user had a chance to abort or retry. The patch adds an aborted condition so the wipe only occurs when the user aborts. Additionally, the unused numpad import was removed.
Changed components
shared/nfc.pyNFCHandler.share_loop()NFC secret export workflowInspect captured patch +4 / −2
diff --git a/releases/Next-ChangeLog.md b/releases/Next-ChangeLog.md
index 9077e13..1227c42 100644
--- a/releases/Next-ChangeLog.md
+++ b/releases/Next-ChangeLog.md
@@ -12,6 +12,7 @@ This lists the new changes that have not yet been published in a normal release.
- Bugfix: Disallow negative input/output amounts in PSBT.
- Bugfix: Fix filesystem initialization after Wife LFS or Destroy Seed.
- Bugfix: Fix MicroSD selftest
+- Bugfix: NFC loop exporting secrets pre-mature wipe
## Spending Policy Feature
diff --git a/shared/nfc.py b/shared/nfc.py
index cd6fe40..aff644a 100644
--- a/shared/nfc.py
+++ b/shared/nfc.py
@@ -402,7 +402,7 @@ class NFCHandler:
# Run the pretty animation, and detect both when we are written, and/or key to exit/abort.
# - similar when "read" and then removed from field
# - return T if aborted by user
- from glob import dis, numpad
+ from glob import dis
await self.wait_ready()
self.set_rf_disable(0)
@@ -471,7 +471,8 @@ class NFCHandler:
break
self.set_rf_disable(1)
- if not write_mode:
+ # do not wipe if we are not aborted
+ if not write_mode and aborted:
# function argument secret decides whether to do full wipe after writing to chip
await self.wipe(is_secret)
Why this scored 57/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.