reload Trick Pins before deleting unlock pins
What changed, and why it matters
This change fixes a potential bug in how COLDCARD's 'trick PIN' feature removes special unlock PINs. Before deleting those PINs, the code now reloads the trick PIN data from storage. Without the reload, the function might operate on stale in-memory data and fail to delete some trick PINs that should have been removed. That could leave behind an unintended bypass PIN after a feature is turned off, which is a security-relevant state.
Treat as a low-to-moderate security hardening fix. Review whether stale self.tp state could be reached in normal or adversarial workflows and confirm the reload covers all persistence paths. Include this fix in release notes and consider whether any additional trick-PIN management functions need similar reload-before-mutate hardening.
Security signals we found
State synchronization fix between in-memory cache and persisted trick PIN storage
Deletion of security-sensitive bypass credentials (unlock pins)
Potential stale-data bug that could leave active bypass PINs in place
Patch is partial/single-line and defensive in nature
Evidence from the diff
In shared/trick_pins.py, delete_sp_unlock_pins() now calls self.reload() before iterating over self.tp to remove trick PINs flagged with TC_FW_DEFINED and TCA_SP_UNLOCK. The patch suggests the in-memory self.tp cache could be stale relative to persisted trick PIN state, causing the deletion loop to miss entries that exist on disk. Reloading ensures the deletion operates on current data. The change is small and defensive; no explicit vulnerability description or exploit is provided in the commit.
Changed components
shared/trick_pins.pyTrickPinMgmt.delete_sp_unlock_pins()COLDCARD trick PIN / unlock PIN subsystemInspect captured patch +1 / −0
diff --git a/shared/trick_pins.py b/shared/trick_pins.py
index 8466693..f305984 100644
--- a/shared/trick_pins.py
+++ b/shared/trick_pins.py
@@ -311,6 +311,7 @@ class TrickPinMgmt:
def delete_sp_unlock_pins(self):
# remove all bypass pins, they are done w/ feature
+ self.reload()
for k, (sn,flags,arg) in self.tp.items():
if (flags & TC_FW_DEFINED) and (arg == TCA_SP_UNLOCK):
self.clear_slots([sn])
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.