identity: clean temporary hash buffer
What changed, and why it matters
This commit fixes a small but real security hygiene issue in Blockstream Jade, a hardware wallet. A temporary buffer that holds a sensitive cryptographic hash (HMAC-SHA512 output used to derive child private keys) was not marked as sensitive memory. That means the buffer could be left uncleared in RAM after use, potentially leaking key material if an attacker could read device memory. The patch marks the buffer with SENSITIVE_PUSH so it is properly wiped with SENSITIVE_POP. It is a cleanup/fix, not a full exploit chain by itself.
Treat as a low-to-moderate defensive fix. Include in the next firmware release. No urgent advisory is required unless the project can demonstrate practical memory disclosure, but users should update when available. Review other stack buffers in identity.c and related modules for similar missing SENSITIVE_PUSH usage.
Security signals we found
Sensitive memory not marked for clearing (missing SENSITIVE_PUSH/POP)
Buffer holds HMAC-SHA512 output used in BIP32 hardened child key derivation
Patch adds explicit sensitive-memory lifecycle management
Fix is defensive/hygiene rather than an active vulnerability with demonstrated exploit
Evidence from the diff
In main/identity.c, get_bip32_hardened_child() computes an HMAC-SHA512 into a stack buffer uint8_t sha[HMAC_SHA512_LEN]. Before the patch, sha was not registered with the SENSITIVE_PUSH/SENSITIVE_POP mechanism used for other local variables (tmp, tweak, key). The patch adds SENSITIVE_PUSH(sha, sizeof(sha)) before the HMAC call and SENSITIVE_POP(sha) after the existing pops. This ensures the buffer is cleared from memory after use, reducing the window for memory disclosure of intermediate key derivation material.
Changed components
main/identity.cget_bip32_hardened_child()BIP32 hardened child key derivationInspect captured patch +2 / −0
### main/identity.c
@@ -107,6 +107,7 @@ static void get_bip32_hardened_child(
// I = HMAC-SHA512(Key = cpar, Data)
uint8_t sha[HMAC_SHA512_LEN];
+ SENSITIVE_PUSH(sha, sizeof(sha));
JADE_WALLY_VERIFY(wally_hmac_sha512(parent->chain_code, sizeof(parent->chain_code), child_out->priv_key,
sizeof(child_out->priv_key) + sizeof(child_out->child_num), sha, sizeof(sha)));
@@ -137,6 +138,7 @@ static void get_bip32_hardened_child(
SENSITIVE_POP(&tmp);
SENSITIVE_POP(&tweak);
SENSITIVE_POP(&key);
+ SENSITIVE_POP(sha);
child_out->version = BIP32_VER_MAIN_PRIVATE;
}Why this scored 47/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.