Skip to content

bip39: scrub vector registers after mnemonic decoding#534

Open
odudex wants to merge 1 commit into
ElementsProject:masterfrom
odudex:bip39-scrub-pr
Open

bip39: scrub vector registers after mnemonic decoding#534
odudex wants to merge 1 commit into
ElementsProject:masterfrom
odudex:bip39-scrub-pr

Conversation

@odudex

@odudex odudex commented Jun 30, 2026

Copy link
Copy Markdown

During the work proposed on #533 I separated this out of scope, yet likely relevant commit from @pythcoiner, so it can be evaluated individually:

"test_clear finds plaintext secret material ~11KB deep on the stack after bip39_mnemonic_validate returns. The residue comes from XMM registers xsaved by the dynamic linker on subsequent PLT calls, not from a source-level local buffer. Adding a zeroed stack scratch in bip39_mnemonic_to_bytes forces glibc memset to issue SSE/AVX zero stores that clobber the vector registers before the function returns, so later xsave operations no longer spill secret bytes."

test_clear finds plaintext secret material ~11KB deep on the stack
after bip39_mnemonic_validate returns. The residue comes from XMM
registers xsaved by the dynamic linker on subsequent PLT calls, not
from a source-level local buffer. Adding a zeroed stack scratch in
bip39_mnemonic_to_bytes forces glibc memset to issue SSE/AVX zero
stores that clobber the vector registers before the function
returns, so later xsave operations no longer spill secret bytes.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants