Bitcoin Forum
April 26, 2024, 09:54:23 AM *
News: Latest Bitcoin Core release: 27.0 [Torrent]
 
   Home   Help Search Login Register More  
Pages: [1] 2 »  All
  Print  
Author Topic: A Proposal for Brainwallets (v2)  (Read 3219 times)
fireduck (OP)
Sr. Member
****
Offline Offline

Activity: 392
Merit: 251



View Profile
March 02, 2014, 04:11:19 AM
 #1

http://1209k.com/brainv2/

About

People love the idea of a memorizable key for bitcoin wallets. There is an appeal to having something in your head worth something and having it written no where and not stealable without a $5 wrench.

Problem

What people currently refer to as a "brainwallet" is simply a passphrase run through a single SHA-256 and then the result is the private key for a bitcoin address. The problem here is that an attacker can download the blockchain and then run very fast attacks basically hashing any text they can find to see if it hashes to a key which has some bitcoins. And when they find one, they drain that address. They can do this very fast since a single SHA-256 is quite cheap. This leads to sadness.

Solution

An awesome answer is key stretching. The short version is that a function is used to make it more time complex to test a key. As a simple example, lets say rather than SHA-256 once, it is SHA-256 a million times. That means it is a million times more expensive for an attacker to test each possible password. Then you make it even better by adding in something unique to the user. This makes the attacker have to do much more work as each different salt uses a different input on its million SHA-256 operations.

Bitrated user: fireduck.
Every time a block is mined, a certain amount of BTC (called the subsidy) is created out of thin air and given to the miner. The subsidy halves every four years and will reach 0 in about 130 years.
Advertised sites are not endorsed by the Bitcoin Forum. They may be unsafe, untrustworthy, or illegal in your jurisdiction.
1714125263
Hero Member
*
Offline Offline

Posts: 1714125263

View Profile Personal Message (Offline)

Ignore
1714125263
Reply with quote  #2

1714125263
Report to moderator
1714125263
Hero Member
*
Offline Offline

Posts: 1714125263

View Profile Personal Message (Offline)

Ignore
1714125263
Reply with quote  #2

1714125263
Report to moderator
1714125263
Hero Member
*
Offline Offline

Posts: 1714125263

View Profile Personal Message (Offline)

Ignore
1714125263
Reply with quote  #2

1714125263
Report to moderator
jcrubino
Member
**
Offline Offline

Activity: 83
Merit: 10


View Profile
March 02, 2014, 05:16:35 AM
 #2

warpwallet https://keybase.io/warp/

Uses scrypt to hash the passphrase first.

odolvlobo
Legendary
*
Offline Offline

Activity: 4298
Merit: 3209



View Profile
March 02, 2014, 06:03:44 AM
Last edit: July 01, 2014, 03:21:56 PM by odolvlobo
 #3

A better solution is to add something unusual to the pass phrase. Even if pass phrases are hashed a million times, a 1 TH/s ASIC could still generate a million candidates per second. Not only does making the pass phrase longer make it take longer to generate the correct hash, but it makes it more costly to check the hashes.

Imagine creating a pass phrase by selecting four random words from a 1,000 word dictionary. A hacker with a 1 TH/s ASIC can generate a table of all possible hashes in one second and the size of the table will be 32 TB (actually much less with compression).

If the pass phrase is hashed a million times, then it will take a million seconds to generate the table and that is a benefit. However, if two more words are added to the pass phrase, then not only would it take a million seconds, but it would also make the table a million times bigger.

Using scrypt instead, as jcrubino suggests, is a good idea too because scrypt is designed to be resistant to password cracking. Whoever decided to use SHA-256 for hashing a brain wallet password knew very little about security.

Join an anti-signature campaign: Click ignore on the members of signature campaigns.
PGP Fingerprint: 6B6BC26599EC24EF7E29A405EAF050539D0B2925 Signing address: 13GAVJo8YaAuenj6keiEykwxWUZ7jMoSLt
piotr_n
Legendary
*
Offline Offline

Activity: 2053
Merit: 1354


aka tonikt


View Profile WWW
March 02, 2014, 08:51:38 AM
 #4

The problem here is that an attacker can download the blockchain and then run very fast attacks basically hashing any text they can find to see if it hashes to a key which has some bitcoins.
The obvious solution to this problem (which applies to any password, not only one that protects bitcoins) it to pick a text that they cannot find. Smiley

Check out gocoin - my original project of full bitcoin node & cold wallet written in Go.
PGP fingerprint: AB9E A551 E262 A87A 13BB  9059 1BE7 B545 CDF3 FD0E
Luke-Jr
Legendary
*
expert
Offline Offline

Activity: 2576
Merit: 1186



View Profile
March 02, 2014, 09:18:39 AM
 #5

Key stretching does nothing to improve entropy, which is the real problem with so-called brainwallets.
It is simply impossible to have a human-chosen passphrase as a secure key, no matter how you do it.
A high-entropy passphrase will almost certainly be very difficult to memorise for a human.

fireduck (OP)
Sr. Member
****
Offline Offline

Activity: 392
Merit: 251



View Profile
March 02, 2014, 03:58:41 PM
 #6

Key stretching does nothing to improve entropy, which is the real problem with so-called brainwallets.
It is simply impossible to have a human-chosen passphrase as a secure key, no matter how you do it.
A high-entropy passphrase will almost certainly be very difficult to memorise for a human.

While that is true, attackers do not have unlimited resources and there are some situations where people really like brain wallets.  I wouldn't say it is appropriate for many use cases, but I'd say it is for some.

Bitrated user: fireduck.
spartacusrex
Hero Member
*****
Offline Offline

Activity: 718
Merit: 545



View Profile
March 02, 2014, 06:54:00 PM
 #7

Is there some way of checking the entropy of a Human-Chosen phrase ?

Is there a denomination for 'Entropy' ?

Can one thing be said to be more entropic than another.. and if so, how do you calculate it ?

 

Life is Code.
itod
Legendary
*
Offline Offline

Activity: 1974
Merit: 1075


^ Will code for Bitcoins


View Profile
March 02, 2014, 07:26:30 PM
 #8

Can one thing be said to be more entropic than another.. and if so, how do you calculate it ?

http://ritcyberselfdefense.wordpress.com/2011/09/24/how-to-calculate-password-entropy/
gmaxwell
Moderator
Legendary
*
expert
Offline Offline

Activity: 4158
Merit: 8382



View Profile WWW
March 03, 2014, 12:24:25 AM
 #9

Virtually all of those calculators are completely wrong.  You cannot simply calculate entropy of a human sourced password without a statistical model at least as powerful as a typical human mind. Advice like assuming uniform probability over the character set is provably bad (by virtue of people with ~60 character 'brainwallet' keys which have been compromised) and you should feel bad for suggesting it.

This is about the N-th time this bad idea has been brought up here. Please use the search.

I should direct you specific to my last rant on the subject: https://bitcointalk.org/index.php?topic=311000.msg3345309#msg3345309

It's very hard to advance the art here, even with awesome strengthening because there is no salt (and cannot be really effectively— if there were place to store the salt, forget the brain nonsense and just use the salt as a strong random key) and because the data is constantly available to attackers. This means that even if a cracking farm goes slowly— maybe only 1000 attempts per second— once you have a million users using it you're getting an effective rate of a billion attempts per second.  Then you run into the really strong resistance people have had in having effective strengthening: Strengthening enough to be more than the smallest speedbump is just not usable implemented in Javascript and this is constantly used as an excuse to do weak things...

and then you multiply it by the surprisingly unreliability qualities of human memory. It's just a bad idea all around, and it's irresponsible engineering to suggest anyone use this sort of scheme.
itod
Legendary
*
Offline Offline

Activity: 1974
Merit: 1075


^ Will code for Bitcoins


View Profile
March 03, 2014, 12:56:07 AM
 #10

Virtually all of those calculators are completely wrong.  You cannot simply calculate entropy of a human sourced password without a statistical model at least as powerful as a typical human mind. Advice like assuming uniform probability over the character set is provably bad (by virtue of people with ~60 character 'brainwallet' keys which have been compromised) and you should feel bad for suggesting it.

This is about the N-th time this bad idea has been brought up here. Please use the search.

I should direct you specific to my last rant on the subject: https://bitcointalk.org/index.php?topic=311000.msg3345309#msg3345309

It's very hard to advance the art here, even with awesome strengthening because there is no salt (and cannot be really effectively— if there were place to store the salt, forget the brain nonsense and just use the salt as a strong random key) and because the data is constantly available to attackers. This means that even if a cracking farm goes slowly— maybe only 1000 attempts per second— once you have a million users using it you're getting an effective rate of a billion attempts per second.  Then you run into the really strong resistance people have had in having effective strengthening: Strengthening enough to be more than the smallest speedbump is just not usable implemented in Javascript and this is constantly used as an excuse to do weak things...

and then you multiply it by the surprisingly unreliability qualities of human memory. It's just a bad idea all around, and it's irresponsible engineering to suggest anyone use this sort of scheme.

You've got me wrong, I'm all against brainwallets. Just tried to help the beginner who asked "Is there a denomination for 'Entropy'?" to get some basic ideas without directing him to Wikipedia article which is overwhelming for the most people.
Abdussamad
Legendary
*
Offline Offline

Activity: 3598
Merit: 1560



View Profile
March 03, 2014, 01:01:37 AM
 #11

Key stretching does nothing to improve entropy, which is the real problem with so-called brainwallets.
It is simply impossible to have a human-chosen passphrase as a secure key, no matter how you do it.
A high-entropy passphrase will almost certainly be very difficult to memorise for a human.

Are you sure about that last sentence? Electrum seeds are quite easy to memorize and they have 128 bits of entropy.
HostFat
Staff
Legendary
*
Offline Offline

Activity: 4214
Merit: 1203


I support freedom of choice


View Profile WWW
June 30, 2014, 11:09:54 PM
 #12

Someone has took them Smiley
19aREH3jaDba1xt14zhaUvzyAhzphdAwJN

http://1209k.com/brainv2/

NON DO ASSISTENZA PRIVATA - http://hostfatmind.com
Syke
Legendary
*
Offline Offline

Activity: 3878
Merit: 1193


View Profile
July 01, 2014, 03:28:17 AM
 #13

Key stretching does nothing to improve entropy, which is the real problem with so-called brainwallets.
It is simply impossible to have a human-chosen passphrase as a secure key, no matter how you do it.
A high-entropy passphrase will almost certainly be very difficult to memorise for a human.

As fireduck mentioned in his detailed blog, http://correcthorsebatterystaple.net/ is one example of a method to generate a highly secure, easily memorized, brain wallet. It's not "impossible". It just needs to be done carefully.

Here is my brain wallet, generated from correcthorsebatterystaple.net. Hack it and win 1 BTC!

https://blockchain.info/address/1LyoCGuuBQzqKintFHsgNEm5ZDR91prUku

Buy & Hold
jonald_fyookball
Legendary
*
Offline Offline

Activity: 1302
Merit: 1004


Core dev leaves me neg feedback #abuse #political


View Profile
July 01, 2014, 04:35:00 AM
 #14

Key stretching does nothing to improve entropy, which is the real problem with so-called brainwallets.
It is simply impossible to have a human-chosen passphrase as a secure key, no matter how you do it.
A high-entropy passphrase will almost certainly be very difficult to memorise for a human.

Are you sure about that last sentence? Electrum seeds are quite easy to memorize and they have 128 bits of entropy.


I agree about the electrum seed, and it also has key stretching.

I don't even think you can say it's impossible to create your
secure phrase.  maybe not provably secure...but you can
easily create weirdness and entropy using mental techniques,
and add additional entropy with nonsense words, misspellings, and throw in a few
numbers in there....it will be fine if you know what you are
doing (don't try this at home) and dont do something stupid
like use movie phrases.

pitfalls, yes. impossible, no.

Granted, I would rather use electrum because it's more easily memorized.


gmaxwell
Moderator
Legendary
*
expert
Offline Offline

Activity: 4158
Merit: 8382



View Profile WWW
July 01, 2014, 05:20:54 AM
 #15

I don't even think you can say it's impossible to create your
secure phrase.  maybe not provably secure...but you can
easily create weirdness and entropy using mental techniques,
and add additional entropy with nonsense words, misspellings, and throw in a few
A lot of people have screwed themselves badly this way— you are not a unique and special snowflake, the ways and manipluation people will come up with when they are trying to be "random" is fairly predictable, and that the same properties which make keys easy to remember make them more predictable. Studies of have shown people picking _more_ predictable passwords when explicitly instructed to be unpredictable. Modern password cracking is a statistical study of psychology, powered by "big data" analysis on information culled from huge leaked plaintext password databases and sources like twitter and the forums.

Using a fancy technique may really only be adding a few extra bits of entropy, and worse it's very hard for you to reason about how much entropy you have and an attacker with more powerful statistical tools than your intuition may find your key with only moderate effort.  For this reason it is far better to use a random technique (e.g. dice or a computer CSPRNG) and just add a couple bits directly, then there is no ambiguity.

(Though this is all without regarding the very real risk of forgetting— almost no one is prepared to deal with cryptographic secrets which _cannot_ be recovered if lost, and most people drastically overestimate the strength of their memory)

Whenever a website turns up having a security breach and we find it was using unsalted passwords everyone cries out claiming that the operators are incompetent fools (perhaps even criminally so) and yet thats exactly what a human generated "brainwallet" is— an unsalted hashed password, but worse: they're publicly visible to everyone so someone doesn't even have to compromise a system before they start cracking.
theymos
Administrator
Legendary
*
Offline Offline

Activity: 5180
Merit: 12899


View Profile
July 01, 2014, 06:05:44 AM
 #16

IMO, wallets that use memorized seeds should do something like this instead:
- Ask the user for some impossible-to-forget information such as their full name to use as salt.
- Generate random words to use as a passphrase. The number of words can be user-configurable, but 5 or 6 should be OK on fast computers.
- Depending on the number of words, apply enough key stretching to make attacks infeasible.

Then you only have to memorize ~6 words instead of a full ~12-word seed mnemonic, which is a lot easier. And there's still no risk of users choosing bad passphrases, since the wallet does it for them.

(The rough passphrase utility I made a while ago works a bit like this, though it doesn't generate passphrases.)

1NXYoJ5xU91Jp83XfVMHwwTUyZFK64BoAD
Syke
Legendary
*
Offline Offline

Activity: 3878
Merit: 1193


View Profile
July 01, 2014, 06:09:23 AM
 #17

(Though this is all without regarding the very real risk of forgetting— almost no one is prepared to deal with cryptographic secrets which _cannot_ be recovered if lost, and most people drastically overestimate the strength of their memory)

Which is it? Are the secrets hackable, or are they unrecoverable? You can't have it both ways.

Buy & Hold
gmaxwell
Moderator
Legendary
*
expert
Offline Offline

Activity: 4158
Merit: 8382



View Profile WWW
July 01, 2014, 06:19:08 AM
 #18

Which is it? Are the secrets hackable, or are they unrecoverable? You can't have it both ways.
You absolutely can. First: whats hackable to _you_ is not whats hackable to some guy with powerful statistical analysis and a fpga cracking farm who, with one unit of effort, simultaneously attacks all users. Secondly, what I was more expressing was an OR case,  that frequently you secrets are either crackable OR they are likely to be lost.  Both of those possible outcomes result in you losing your funds.

IMO, wallets that use memorized seeds should do something like this instead:
- Ask the user for some impossible-to-forget information such as their full name to use as salt.
- Generate random words to use as a passphrase. The number of words can be user-configurable, but 5 or 6 should be OK on fast computers.
- Depending on the number of words, apply enough key stretching to make attacks infeasible.
A challenge there is that it may be quite hard to get users to understand that your collection of personal information there isn't to send it off to some server or put it someplace public... in querying around I got the impression that lots of people would put random things in those fields, defeating the protection.  It would probably be better than what people are actually doing.

There is another weird consequence is that you lose denyablity when using such a scheme. E.g. if someone does obtain your secrets then your address is effectively a cryptographic commitment to that personal info, it's harder to say "those transactions weren't mine". Thats a little bit into the realm of movie plot threats, but at least some of the people working on encrypted wallets have insisted on "denyability" as a feature, and people have used it as selling point for "brainwallets" (and also as an argument against writing down the key, which is probably the most prudent think you should do— considering the forgetting risk).

jonald_fyookball
Legendary
*
Offline Offline

Activity: 1302
Merit: 1004


Core dev leaves me neg feedback #abuse #political


View Profile
July 01, 2014, 01:36:46 PM
Last edit: July 01, 2014, 02:04:43 PM by jonald_fyookball
 #19

I don't even think you can say it's impossible to create your
secure phrase.  maybe not provably secure...but you can
easily create weirdness and entropy using mental techniques,
and add additional entropy with nonsense words, misspellings, and throw in a few
A lot of people have screwed themselves badly this way— you are not a unique and special snowflake, the ways and manipluation people will come up with when they are trying to be "random" is fairly predictable, and that the same properties which make keys easy to remember make them more predictable. Studies of have shown people picking _more_ predictable passwords when explicitly instructed to be unpredictable. Modern password cracking is a statistical study of psychology, powered by "big data" analysis on information culled from huge leaked plaintext password databases and sources like twitter and the forums.

Using a fancy technique may really only be adding a few extra bits of entropy, and worse it's very hard for you to reason about how much entropy you have and an attacker with more powerful statistical tools than your intuition may find your key with only moderate effort.  For this reason it is far better to use a random technique (e.g. dice or a computer CSPRNG) and just add a couple bits directly, then there is no ambiguity.

(Though this is all without regarding the very real risk of forgetting— almost no one is prepared to deal with cryptographic secrets which _cannot_ be recovered if lost, and most people drastically overestimate the strength of their memory)

Whenever a website turns up having a security breach and we find it was using unsalted passwords everyone cries out claiming that the operators are incompetent fools (perhaps even criminally so) and yet thats exactly what a human generated "brainwallet" is— an unsalted hashed password, but worse: they're publicly visible to everyone so someone doesn't even have to compromise a system before they start cracking.


I do agree, its better to use computer generated randomness.

But, I'm still not convinced it can't be done.

If I wanted to use elements from my day yesterday -- say the name (which I can't even spell
correctly) of the lady at the Chinese take out place... or, a word from an episode title
that I watched with my wife... or the raw name of an AVI file that I burned, etc, or
the current time, ...maybe those methods are predictable but there is still entropy.

I can also devise a "predictable" but still effective ordering method.
(the method can be predictable, but doesn't mean the results can be
predicted)
 
if go with 100 as a lower bound of words people commonly choose, and
if I choose 25 random things, now you're talking 100^25, that's 160 bits of entropy.

Also, where do you draw the line between human-chosen and random?
If I write down random words to form a candidate word list, is it still
random, or does it have to be completely off the top of my head
without the help of rudimentary tools such as pen and paper?

Generally, it is probably best not encourage this kind of thing,
as the risks outweigh the rewards.  I just wanted to make the point
that it is not impossible if one is careful and understands the dynamics
and the numbers.

My answer to forgetting passwords is steganography.   Hide the backup on your own machine
in an image, mp3, or series of carriers if you really want to be paranoid.

When it comes to difficulty of memorizing something, I think people
are forgetting that the human brain remembers what it considers
to be important.  If I place a high importance of remembering my
bitcoin password, (and if I rehearse it), then I'm sure i could
retain a very long password for a very long time.  

I think the average person can easily remember a 12 word passphrase
if they have a substantial amount of money in it.

DeathAndTaxes
Donator
Legendary
*
Offline Offline

Activity: 1218
Merit: 1079


Gerald Davis


View Profile
July 01, 2014, 02:28:50 PM
Last edit: July 01, 2014, 02:49:23 PM by DeathAndTaxes
 #20

The problem jonald is determining the level of entropy.  Also humans are very good at convincing themselves they are random when they aren't.  A common homework experiment of entropy is to ask 100 people to pick a random number between 1 and 10.  Usually 30%+ will pick "7" and significantly less than the expected 10% will pick either 1 or 10.   Picking 1 in the range 1 to 10 doesn't seem random to most people so at a subconcious level, most will reject it from even being a candidate.

It isn't impossible for a human to generate a passphrase with sufficient entropy however the three major problems remain:
a) Most will fail at the process, and when they fail they will have funds stolen so any method which encourages that is unethical.

b) It is very difficult to quantitatively state how much entropy your human chosen passphrase actually has.  So you pick a passphrase and your funds aren't stolen yet.  Is it because the passphrase is secure and it will never be stolen or is it just because a hacker hasn't gotten to it yet and they will steal it in the future.

c) The sheer number of inputs necessary to have a high confidence that there is sufficient entropy is high enough that a significant number of users will lose access to their funds.   Another way to look at it is if you need to memorize 25 words you chose to have the same security as 6 random words is there any benefit to advocating the former?

Quote
I think the average person can easily remember a 12 word passphrase
if they have a substantial amount of money in it.

Then use diceware and random words (or some similar system). Using diceware and truly random selections (i.e. roll some dice), 10 simple words gets you >128 bits of entropy.  This is very similar to the concept that electrum uses for the seed words.  The seed is random    

You probably can be very secure using less random words combined with key stretching.  Key stretching is very effective when used with truly random values with lower (but still useful) levels of entropy.   For example 5 diceware words is only 64 bits of entropy*. If your key is the hash of the diceware words [ key=H(set of diceware words) and your attacker can make 1 trillion hashes per second well the 50% solution time is ~100 years.   Still that may be close too close to comfort and that work requirement can be increased by key stretching.  For something like a cold storage wallet you don't need sub millisecond access; so use a KDF timed to take a little over a second to complete.  Even in unoptimized javascript that should mean tens of thousands of iterations.  Lets say 10,000.  Now the attacker can't attempt 1 trillion passwords per second.  With the same hardware they can still complete 1 trillion hashes per second but each password attempt takes 10,000 hashes so their throughput has dropped to a mere 100 million passwords per second and correspondingly the 50% solution time has been increased to one million years.

It is important to understand that key stretching can't "fix" passwords with very poor entropy.  For example if your password is on a list of 1 million known compromised passwords then the attacker would find it in a fraction of a second (assuming it isn't precomputed).  Using key stretching is still ineffective as using this hypothetical machine above even with key hardening the attacker can attack 100 million hardened passwords per second.  So the solution time is increased by 10,000x however it is increased from microseconds to a fraction of a second.

Quote
Also, where do you draw the line between human-chosen and random?
If I write down random words to form a candidate word list, is it still
random, or does it have to be completely off the top of my head
without the help of rudimentary tools such as pen and paper?

If you wrote down a large list and then randomly selected from it then it would be random.  Of course by randomly selecting I don't mean the equivalent of "pick a number from 1 to 10" as we already know the results will not be random.  You could number the words on the list and then roll dice to pick the words.  Of course you would want a large library of words.  Larger library means less words selected for the same entropy.  You would also want to avoid words which may be confused for other words or are hard to remember.  You would also want to make sure your numbers system has a uniform distribution (each word has an equal chance of being picked). You would also need to safely store multiple copies of this system and it would be a good idea for it to be widely adopted.  This means it would be both peer reviewed and there is an increased chance you can find the word list in the future. Of course if you spent countless hours doing all that ... well you just reinvented diceware.  It has been around since 1996 and is rather robust.  Maybe someday I need to make a brainwallet site using diceware so people can stop losing coins.

http://world.std.com/~reinhold/diceware.html

* D&T warning.  You can only use a reduced entropy password if you are sure the level of key stretching.  For open source software you can inspect the code and preferably any system would make this clear and visible to the end user.  Opaque websites (i.e. your login for BCT) are a different story.  You have no idea how much key stretching (if any) the site is doing.  Thus you should always assume that no key stretching is being performed.  Although the topic is about brain wallets I don't want someone using 5 (or less) diceware words for their exchange account and when they get hacked saying D&T said it was secure.  Honestly since websites are so bad at security I would recommend using diceware as a master password for a tool like lastpass and generating a random 20 digit password for each website.
Pages: [1] 2 »  All
  Print  
 
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.19 | SMF © 2006-2009, Simple Machines Valid XHTML 1.0! Valid CSS!