What is Nostr?
Matt Corallo [ARCHIVE] /
npub1e46…xmcu
2023-06-07 02:02:36
in reply to nevent1q…kxnr

Matt Corallo [ARCHIVE] on Nostr: 📅 Original date posted:2011-07-04 🗒️ Summary of this message: Discussion on ...

📅 Original date posted:2011-07-04
🗒️ Summary of this message: Discussion on potential vulnerabilities in Bitcoin wallet.dat file, including the possibility of attackers inserting unencrypted keypool keys. Suggestions for future-proofing the file.
📝 Original message:For some reason my mail client let me respond off-list here, didnt mean
to...

On Mon, 2011-07-04 at 14:23 -0400, Gavin Andresen wrote:
> RE: "You have some unencrypted keys, should I encrypt them for you?"
>
> That re-opens an "attacker packs the keypool with keypairs that they
> know about" (if I can read/write wallet.dat, then I can delete
> encrypted keypool keys and insert a bunch of unencrypted keypool keys
> that I know how to spend, and rely on the user to click "OK" because
> users are trained to just click "OK").
Not strictly true, if the keys are loaded, but not added to
mapAddressBook or setKeyPool, they wont be used for any new
transactions, or shown to the user, but the user is still able to
receive Bitcoins to those keys.
> RE: breaking backup scripts: if they use the backupwallet RPC
> command, then they will Just Work.
Not really, most backupwallet-based scripts will backup wallet.dat,
encrypt wallet.dat, upload wallet.dat. Now it backups up wallet.dat and
the encrypt part fails because there is no wallet.dat, only
wallet_e.dat. If we rename to wallet.dat on output, now the user's
restore might not work...
>
> 0.4 and later could, on wallet encryption, create a wallet_e.dat
> (encrypted wallet). Then truncate wallet.dat and set its
> file-permissions to 000, so if old versions of bitcoin OR any dumb
> wallet backup scripts try to read it they fail.
True, but that is only a solution for Linux and Mac and then you are
back to unreadable error on Windows load and other unforeseeable errors
for odd scripts.

I suppose I just really dont like the idea of renaming wallet.dat,
everything knows the filename and is used to it.
>
> RE: future-proofing: wallet.dat contains nFileVersion (version of
> bitcoin that last wrote the wallet). Adding a nMinVersion that
> specifies "you must be at least THIS version to read this file" seems
> like a good idea so if you have version 0.4 or later future wallet
> upgrades give you a reasonable message if you try to downgrade after
> an incompatible change.
Yep, just something simple that says, no reading this to old versions is
needed, IMO the older version should freak out if it sees keys that it
doesn't know about (as it could also indicate wallet corruption in some
rare cases), but nMinVersion works just as well, in any case this should
only very rarely be a problem...how often will we change the wallet
format?
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 836 bytes
Desc: This is a digitally signed message part
URL: <http://lists.linuxfoundation.org/pipermail/bitcoin-dev/attachments/20110704/65711d4e/attachment.sig>;
Author Public Key
npub1e46n428mcyfwznl7nlsf6d3s7rhlwm9x3cmkuqzt3emmdpadmkaqqjxmcu