fix: zcash seed fingerprint export issue
What changed, and why it matters
This commit fixes a bug in how the Keystone 3 hardware wallet stores a Zcash 'seed fingerprint.' The function that saves the fingerprint forgot to record which account it belongs to. That could cause the wallet to mix up or misidentify which Zcash account the fingerprint is for, potentially leading to wrong address derivation, export of incorrect account data, or user confusion when verifying accounts. It is a data-association bug, not a classic remote exploit.
Review all callers and consumers of g_zcashUFVKcache to confirm accountIndex is now consistently set and read; add regression tests for multi-account Zcash seed fingerprint export; verify that uninitialized or stale accountIndex values cannot propagate to exported data or UI prompts.
Security signals we found
Missing state-field update in account-scoped setter
Potential stale/uninitialized account index in shared cache structure
Risk of cross-account data confusion for Zcash UFVK/fingerprint export
No bounds or input validation changes; fix is a single field assignment
Evidence from the diff
In src/managers/account_manager.c, SetZcashSFP() copies a 32-byte seedFingerprint into g_zcashUFVKcache.seedFingerprint but previously did not set g_zcashUFVKcache.accountIndex. The patch adds that assignment. Without it, any consumer of the cache that relies on accountIndex to identify which Zcash UFVK/account the fingerprint belongs to would be reading stale or uninitialized account state. This could affect exported seed fingerprints, account selection, or any subsequent logic that pairs the fingerprint with a specific account index.
Changed components
src/managers/account_manager.cZcash account/UFVK managementSeed fingerprint export featureInspect captured patch +1 / −0
diff --git a/src/managers/account_manager.c b/src/managers/account_manager.c
index f1d22e0..70d22a2 100644
--- a/src/managers/account_manager.c
+++ b/src/managers/account_manager.c
@@ -605,6 +605,7 @@ static void SetZcashUFVK(uint8_t accountIndex, const char* ufvk)
static void SetZcashSFP(uint8_t accountIndex, const uint8_t* seedFingerprint)
{
ASSERT(accountIndex <= 2);
+ g_zcashUFVKcache.accountIndex = accountIndex;
memcpy_s(g_zcashUFVKcache.seedFingerprint, 32, seedFingerprint, 32);
printf("SetZcashSFP\r\n");
}
Why this scored 41/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.