Hi! I asked ChatGPT to check how ElectrumSVP v0.2.0-beta.1 generates and stores seed phrases, and it found something that looks concerning.
When creating a new standard account, the wallet appears to save a plaintext copy of the BIP39 seed phrase in its database, even with a wallet password set. Changing the password also seems to leave that copy untouched.
Here’s the code path it found, based on commit:
4a09e01
- In electrumsv/gui/qt/account_wizard.py, around line 429, the account creation code does this:
keystore.bip39_words = seed_phrase
This keeps an extra copy of the original seed phrase in bip39_words.
- In electrumsv/keystore.py, around line 485, the password-update code encrypts fields such as seed and xprv, but doesn’t handle bip39_words.
- In electrumsv/keystore.py, around line 449, the serialization code includes bip39_words in the data saved to the wallet database. That means this copy gets saved without encryption.
The review tested this at the database level using test data with no funds. It was able to read the full seed phrase without the wallet password and use it to recreate the same account extended private key. After changing the password and saving again, the plaintext seed phrase was still there.
So if someone gets access to an affected wallet file or a backup, they could recover the seed phrase despite the wallet having a password. In the tested setup, that was enough to recover the account’s private key.
The seed-generation checks themselves passed: the code uses os.urandom(16) for 128 bits of entropy, the English wordlist matched BIP39, and all 16 mnemonic-generation tests and 24 seed-derivation tests passed.
The review also inspected the relevant code inside the standard Windows EXE and found that it matched the tagged source. The reproduction used the wallet/database code directly, so it wasn’t a full test through the packaged app’s interface. The portable Windows, macOS, and Linux packages weren’t separately checked.
Could you take a look and confirm this? It seems the fix would need to cover both newly created accounts and existing wallet files that already contain a plaintext bip39_words field.
It would also be helpful to let affected users know what to do about their wallets and backups, since changing the password alone doesn’t fix this, and any seed phrase that has already been exposed would still be compromised.
Thanks!
Hi! I asked ChatGPT to check how ElectrumSVP v0.2.0-beta.1 generates and stores seed phrases, and it found something that looks concerning.
When creating a new standard account, the wallet appears to save a plaintext copy of the BIP39 seed phrase in its database, even with a wallet password set. Changing the password also seems to leave that copy untouched.
Here’s the code path it found, based on commit:
4a09e01
keystore.bip39_words = seed_phrase
This keeps an extra copy of the original seed phrase in bip39_words.
The review tested this at the database level using test data with no funds. It was able to read the full seed phrase without the wallet password and use it to recreate the same account extended private key. After changing the password and saving again, the plaintext seed phrase was still there.
So if someone gets access to an affected wallet file or a backup, they could recover the seed phrase despite the wallet having a password. In the tested setup, that was enough to recover the account’s private key.
The seed-generation checks themselves passed: the code uses os.urandom(16) for 128 bits of entropy, the English wordlist matched BIP39, and all 16 mnemonic-generation tests and 24 seed-derivation tests passed.
The review also inspected the relevant code inside the standard Windows EXE and found that it matched the tagged source. The reproduction used the wallet/database code directly, so it wasn’t a full test through the packaged app’s interface. The portable Windows, macOS, and Linux packages weren’t separately checked.
Could you take a look and confirm this? It seems the fix would need to cover both newly created accounts and existing wallet files that already contain a plaintext bip39_words field.
It would also be helpful to let affected users know what to do about their wallets and backups, since changing the password alone doesn’t fix this, and any seed phrase that has already been exposed would still be compromised.
Thanks!