Don't restore cached backup password (bkpw) from backup file
What changed, and why it matters
This update fixes a security flaw in how the COLDCARD wallet restores its settings from a backup file. Previously, a tampered backup could secretly set the password used for future backups, letting an attacker who later gets physical access predict or control backup encryption. The fix ignores that 'cached backup password' field during restore, so backups cannot smuggle in a chosen password.
Apply this patch and verify backup restore behavior rejects bkpw. Users should re-create backups after updating and avoid restoring from untrusted backup files. Consider auditing other settings keys for similar import/export asymmetries.
Security signals we found
Tampered-backup password fixation
Backup restore integrity hardening
Cached secret import prevention
Write/read symmetry enforcement
Evidence from the diff
In shared/backups.py, restore_from_dict_ll() now skips any key named ‘bkpw’ (cached backup password). The backup writer already strips bkpw when creating backups, so a bkpw value present during restore indicates a crafted/tampered backup. Without this check, an attacker could fixate setting.bkpw and influence the passphrase used to encrypt all subsequent backups, undermining backup confidentiality/integrity. The patch is a targeted hardening change and mirrors the existing write-side strip of bkpw.
Changed components
shared/backups.pyrestore_from_dict_ll()settings.bkpw handlingInspect captured patch +7 / −0
diff --git a/shared/backups.py b/shared/backups.py
index 169533b..07fb2f5 100644
--- a/shared/backups.py
+++ b/shared/backups.py
@@ -201,6 +201,13 @@ def restore_from_dict_ll(vals, raw):
k = key[8:]
+ if k == 'bkpw':
+ # never import a cached backup password from a backup file.
+ # write-side (render_backup_contents) strips bkpw, so a present
+ # value means a tampered/crafted file trying to fixate the
+ # password used for all FUTURE backups - drop it.
+ continue
+
if k == 'sd2fa':
# do NOT restore sd2fa as SD card can be lost or damaged
# new version of firmware 5.1.3+ will not back sd2fa
Why this scored 72/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.