Bitcoin Forum
May 22, 2024, 03:16:31 PM *
News: Latest Bitcoin Core release: 27.0 [Torrent]
 
   Home   Help Search Login Register More  
Pages: [1] 2 »  All
  Print  
Author Topic: Are Brain Wallets really a good idea?  (Read 2757 times)
Kevlar (OP)
Sr. Member
****
Offline Offline

Activity: 602
Merit: 254


🔰FERRUM NETWORK🔰


View Profile
April 15, 2013, 08:48:15 PM
 #1

It seems to me Brain Wallets are a terrible idea because they are susceptible to brute force attacks.

Here's what I would do if I wanted to hack brain wallets: I'd grab a dictionary or password file, SHA-256 these, multiply by the secp256k1 ECPoint G, SHA-256 and RIPEMD-160 that, and compare it to all the outputs in the block chain. I'd build this as a map-reduce function, and I'd farm it out. The list of all outputs wouldn't amount to more than a couple hundred megabytes, and for added interest, the map function could generate random permutations of combinations of the words, and the reduce could compute the hash and compare it to the list of outputs. Anything which resulted in a hit would be would be of potential interest.

Of course this is all hypothetical... Anyone interested in the results of having actually done this? And the code I used to do it? I'll let ya have it for the price of getting out of the Newbie section...

-Kevlar



                            █████
                        █████████████
                     █████████████
                 ██████████████        █████
              █████████████        ████████████
          ██████████████        █████████████
       █████████████        █████████████       ██████
       ██████████        ████████████           ██████
       ███████       █████████████       ███    ██████
       ███████    █████████████       ██████    ██████
       ████████████████████       ██████████    ██████
       █████████████████       █████████████    ██████
       █████████████       █████████████        ██████
       ██████████       █████████████           ██████
       ███████      ██████████████       ███    ██████
       ██████    █████████████       ███████    ██████
       ██████    ██████████       ██████████    ██████
       ██████    ██████        █████████████    ██████
       ██████    ███       █████████████        ██████
       ██████           █████████████       ██████████
       ██████       █████████████        █████████████
                 █████████████       █████████████
              ████████████        █████████████
                  ████         ████████████
                           █████████████
                         ███████████
                            █████
Ferrum Network • Interoperability Network for Financial Applications
Kevlar (OP)
Sr. Member
****
Offline Offline

Activity: 602
Merit: 254


🔰FERRUM NETWORK🔰


View Profile
April 15, 2013, 08:51:48 PM
 #2

Well it seems my bluff has been called! Anyone actually interested? Just say yes, and I'll write up a big post tonight.


                            █████
                        █████████████
                     █████████████
                 ██████████████        █████
              █████████████        ████████████
          ██████████████        █████████████
       █████████████        █████████████       ██████
       ██████████        ████████████           ██████
       ███████       █████████████       ███    ██████
       ███████    █████████████       ██████    ██████
       ████████████████████       ██████████    ██████
       █████████████████       █████████████    ██████
       █████████████       █████████████        ██████
       ██████████       █████████████           ██████
       ███████      ██████████████       ███    ██████
       ██████    █████████████       ███████    ██████
       ██████    ██████████       ██████████    ██████
       ██████    ██████        █████████████    ██████
       ██████    ███       █████████████        ██████
       ██████           █████████████       ██████████
       ██████       █████████████        █████████████
                 █████████████       █████████████
              ████████████        █████████████
                  ████         ████████████
                           █████████████
                         ███████████
                            █████
Ferrum Network • Interoperability Network for Financial Applications
biosupdate
Newbie
*
Offline Offline

Activity: 6
Merit: 0


View Profile
April 15, 2013, 09:32:40 PM
 #3

Gavin Andresen recommends against using brain wallets here:

https://gist.github.com/gavinandresen/3840286


You also have to be very careful how you create and use a brain wallet. There have been many "brain wallet victims". One lost most of their balance by not specifying the change as a separate output in a hand crafted raw transaction and therefore turned it into a fee sent to the miners. One lost their balance by not realizing that the standard client sends the change to a new address, not the original. They then deleted the wallet.dat thinking that the change was safe back in their original brain wallet address. One lost all of their balance because the site they used to generate the brain wallet turned out to be keeping the private addresses.
uberduber
Newbie
*
Offline Offline

Activity: 13
Merit: 0


View Profile
April 15, 2013, 10:31:53 PM
 #4

seems weird
Anon136
Legendary
*
Offline Offline

Activity: 1722
Merit: 1217



View Profile
April 15, 2013, 10:36:32 PM
 #5

So long as you include a few made up words you should be protected against such an attack correct?

Rep Thread: https://bitcointalk.org/index.php?topic=381041
If one can not confer upon another a right which he does not himself first possess, by what means does the state derive the right to engage in behaviors from which the public is prohibited?
Kevlar (OP)
Sr. Member
****
Offline Offline

Activity: 602
Merit: 254


🔰FERRUM NETWORK🔰


View Profile
April 16, 2013, 04:53:43 AM
 #6

Ok, as promised.

So first of all: Why? Why pick on Brain Wallets?

I find large data problems and their solutions fascinating. I also love the design of the Bitcoin network, because it relies on the fact that randomly generated numbers are 'good enough' for a public addressing scheme. Brain Wallets are a kink in that otherwise unblemished idea, and while there's been people who have experimented with these techniques before, I wanted to take it to the next level and really see what could be done in terms of exposing weaknesses so I would have a better understanding of what would be required to actually hack random brain wallets. I can tell you that despite finding a few, I didn't take any of the coins. The amounts were small and they're probablly someone's mining earnings, and the amount you would get by taking them is about 1/100000th the cost of repeating the process here yourself. I've only provided the code, actually performing the experiment as described is left as an exercise to the reader.

So, without further adieu, here's the code: https://github.com/TSavo/BitKeyGrinder

What this code does is uses Hadoop to break down a large list of possible brain wallets into smaller chunks, and distributes those chunks for transformation into their equivalent brain wallet public key. There's another function for loading the block chain and scanning it for outputs that match from the resulting map/reduce job.

This is necessary because the function to compute the public key from the private one is prohibitively expensive... much more expensive than any of the hashing functions involved. On my Intel i5, I could get about 130 keys a second crunched, which meant I could do a 100 megabyte dictionary file in about a day and a half. Using Amazon's Elastic Map Reduce and the code linked above, I searched 15 gigabytes worth of public ally available dictionary files in about the same amount of time. Finding the keys in the blockchain took less than an hour on my i5 once everything had been downloaded again.

So, did I find anything?

Yeah, I did. It wasn't much though. Less than 1 BTC total. I left them there. And if you want to spend the money to go crunch 15 gigabytes of dictionary files to find that less than 1 BTC, good luck.

But let this be a cautionary tale: I churned 15 gigabytes of dictionary files in one day without exceeding my EC2 limit of 20 instances. If someone wanted to, they could start doing this full time, permuting 3 and four word combinations, and looking for brain wallets. Would it be economically viable? Nope. Would it potentially yield results? It would depend on how much CPU power you had... Food for thought.

Questions, comments, bit tips, and screams of agony are always welcome. I am a starving artist, and all tips will go to destroying my liver faster, and the occasional Bitcoin coding frenzy.

-Kevlar


                            █████
                        █████████████
                     █████████████
                 ██████████████        █████
              █████████████        ████████████
          ██████████████        █████████████
       █████████████        █████████████       ██████
       ██████████        ████████████           ██████
       ███████       █████████████       ███    ██████
       ███████    █████████████       ██████    ██████
       ████████████████████       ██████████    ██████
       █████████████████       █████████████    ██████
       █████████████       █████████████        ██████
       ██████████       █████████████           ██████
       ███████      ██████████████       ███    ██████
       ██████    █████████████       ███████    ██████
       ██████    ██████████       ██████████    ██████
       ██████    ██████        █████████████    ██████
       ██████    ███       █████████████        ██████
       ██████           █████████████       ██████████
       ██████       █████████████        █████████████
                 █████████████       █████████████
              ████████████        █████████████
                  ████         ████████████
                           █████████████
                         ███████████
                            █████
Ferrum Network • Interoperability Network for Financial Applications
metraX
Newbie
*
Offline Offline

Activity: 29
Merit: 0


View Profile
April 16, 2013, 05:34:05 AM
 #7

I'm not clear - how do you check if an address has a balance? seems like you would have to rescan the whole blockchain, or query blockchain.info each time
Kevlar (OP)
Sr. Member
****
Offline Offline

Activity: 602
Merit: 254


🔰FERRUM NETWORK🔰


View Profile
April 16, 2013, 06:57:20 AM
 #8

I'm not clear - how do you check if an address has a balance? seems like you would have to rescan the whole blockchain, or query blockchain.info each time

What the second program, BitKeyChecker, does is scan the Block Chain and build a set of all Transaction hashes, ever. It then checks the hashed password against that set to see if the set contains it. If it does, it's considered 'interesting'. I was getting upward of 400,000 checks per second on my i5, and I suspect the problem is IO bound, not the custom hashmap comparator I wrote.

Once you found something interesting, you'd have to go rerun the blockchain yourself to see what the balance was... an exercise left up to the reader.


                            █████
                        █████████████
                     █████████████
                 ██████████████        █████
              █████████████        ████████████
          ██████████████        █████████████
       █████████████        █████████████       ██████
       ██████████        ████████████           ██████
       ███████       █████████████       ███    ██████
       ███████    █████████████       ██████    ██████
       ████████████████████       ██████████    ██████
       █████████████████       █████████████    ██████
       █████████████       █████████████        ██████
       ██████████       █████████████           ██████
       ███████      ██████████████       ███    ██████
       ██████    █████████████       ███████    ██████
       ██████    ██████████       ██████████    ██████
       ██████    ██████        █████████████    ██████
       ██████    ███       █████████████        ██████
       ██████           █████████████       ██████████
       ██████       █████████████        █████████████
                 █████████████       █████████████
              ████████████        █████████████
                  ████         ████████████
                           █████████████
                         ███████████
                            █████
Ferrum Network • Interoperability Network for Financial Applications
Peleus
Member
**
Offline Offline

Activity: 112
Merit: 100


View Profile
April 16, 2013, 07:05:48 AM
 #9

Yeah already did this. But I just made a bitcoin address generator like vanitygen but used a password dictionaries as the seed rather than randomness. Created a long list of addresses. Using a block explorer you can extract every address with a balance in it. Compare the list.

Lesson - don't use brain wallets.
astor
Newbie
*
Offline Offline

Activity: 39
Merit: 0


View Profile
April 16, 2013, 08:22:18 AM
 #10

It is actually not that hard to make a secure password.

What you need to do is use muscular memory.  That is, you type the password 100 times on your keyboard, and use it relatively often, and you will magically remember it.

If you have played an instrument like the piano, you know how a song can be "remembered" by your fingers.

How do I know this?  Well I created my passwords like this for many years.

On Linux, the command to use is this:

$ tr -dc 'a-zA-Z0-9,.' </dev/urandom | head -c 100
PSZ0pF64Mj4LYp7yIHcJixvRKLf5UcoMcCKM3S9Rryj.nL4Xnugbu1UNoIVHR63oBFssMfqI6UlfKQV CDTCNyWZCvFtTiUPVU78y

(it might give different results on your machine ;-)

In this case, the password will consist of the characters a-z, A-Z, 0-9, and '.,'.  You might want to include other special characters like ;,.!@#$&*()_.., or you might want to remove some to make typing easier.  It's up to you.

Anyways, we can calculate the entropy in the above passwords.  I conveniently chose 64 symbols so the entropy is 6 bits/character.

Thus we need around 20 characters to make a truly secure password.  This is actually not that hard to do, it just requires some practice, like playing the piano.

First, choose a part of the string above that you "like".  This reduces the entropy of the password by some bits, but the loss is bounded, so this is not a problem.  Then divide the password into sections and start practicing on the keyboard.

For example the first 20 characters can be divided like this:
PSZ0p F64Mj4LY p7yIHcJ

Then you practice the individual sections until they "stick".  Practice every day, like you are going to play a piano concert.

Good luck.  Being able to remember hundreds of bits of randomness is a skill that has great benefits.

metraX
Newbie
*
Offline Offline

Activity: 29
Merit: 0


View Profile
April 16, 2013, 08:41:31 AM
 #11

Quote
What the second program, BitKeyChecker, does is scan the Block Chain and build a set of all Transaction hashes, ever. It then checks the hashed password against that set to see if the set contains it. If it does, it's considered 'interesting'. I was getting upward of 400,000 checks per second on my i5,

so how many seconds to check the set of all transactions?
(400k/sec, how many total are there?)
Tal1m0n
Newbie
*
Offline Offline

Activity: 13
Merit: 0


View Profile
April 16, 2013, 08:42:52 AM
 #12

I take a phrase out of a book of poetry then add a series of numbers + capitalization on every other digit. Makes it very easy to remember and gives me a very hard to crack password.

The majority of the people losing their wallets however are due to being infested with malware. A fresh install of Windows, second partition for all your programs, then Deep Freeze the whole thing and you getting hacked is very unlikely.
Kevlar (OP)
Sr. Member
****
Offline Offline

Activity: 602
Merit: 254


🔰FERRUM NETWORK🔰


View Profile
April 16, 2013, 04:57:32 PM
 #13

Quote
What the second program, BitKeyChecker, does is scan the Block Chain and build a set of all Transaction hashes, ever. It then checks the hashed password against that set to see if the set contains it. If it does, it's considered 'interesting'. I was getting upward of 400,000 checks per second on my i5,

so how many seconds to check the set of all transactions?
(400k/sec, how many total are there?)

To check the set of all transactions for a given hash? I was able to do so against 400,000 random hashes a second. So how long does it take to check ALL transactions to see if a hash is interesting? Less than 1/400,000 of a second, after having loaded them all into memory.



                            █████
                        █████████████
                     █████████████
                 ██████████████        █████
              █████████████        ████████████
          ██████████████        █████████████
       █████████████        █████████████       ██████
       ██████████        ████████████           ██████
       ███████       █████████████       ███    ██████
       ███████    █████████████       ██████    ██████
       ████████████████████       ██████████    ██████
       █████████████████       █████████████    ██████
       █████████████       █████████████        ██████
       ██████████       █████████████           ██████
       ███████      ██████████████       ███    ██████
       ██████    █████████████       ███████    ██████
       ██████    ██████████       ██████████    ██████
       ██████    ██████        █████████████    ██████
       ██████    ███       █████████████        ██████
       ██████           █████████████       ██████████
       ██████       █████████████        █████████████
                 █████████████       █████████████
              ████████████        █████████████
                  ████         ████████████
                           █████████████
                         ███████████
                            █████
Ferrum Network • Interoperability Network for Financial Applications
lostmyshit
Newbie
*
Offline Offline

Activity: 11
Merit: 0


View Profile
April 17, 2013, 04:42:46 AM
 #14

Quote

To check the set of all transactions for a given hash? I was able to do so against 400,000 random hashes a second. So how long does it take to check ALL transactions to see if a hash is interesting? Less than 1/400,000 of a second, after having loaded them all into memory.



are you saying, if I had a text file with 400,000 lines of text (guesses), you could turn them all into public addresses and know in 1 second if any of these 400k  are interesting?
Kevlar (OP)
Sr. Member
****
Offline Offline

Activity: 602
Merit: 254


🔰FERRUM NETWORK🔰


View Profile
April 17, 2013, 08:47:42 PM
 #15

Quote

To check the set of all transactions for a given hash? I was able to do so against 400,000 random hashes a second. So how long does it take to check ALL transactions to see if a hash is interesting? Less than 1/400,000 of a second, after having loaded them all into memory.



are you saying, if I had a text file with 400,000 lines of text (guesses), you could turn them all into public addresses and know in 1 second if any of these 400k  are interesting?

Well the whole point of the map/reduce thing was to first transform those 400,000 lines of text (guesses) into public addresses. This is what takes the time and computational power, and is by no means fast.

Once that work is done, and all the guesses have been transformed into public addresses, I can tell you in 1 second if any of those 400k guesses are interesting by scanning the block chain for all 400,000 of them in about 1 second.

That's what the code that I liked to does. BitKeyGrinder Map/Reduces the guesses into public keys, and BitKeyChecker checks them.

-Kevlar


                            █████
                        █████████████
                     █████████████
                 ██████████████        █████
              █████████████        ████████████
          ██████████████        █████████████
       █████████████        █████████████       ██████
       ██████████        ████████████           ██████
       ███████       █████████████       ███    ██████
       ███████    █████████████       ██████    ██████
       ████████████████████       ██████████    ██████
       █████████████████       █████████████    ██████
       █████████████       █████████████        ██████
       ██████████       █████████████           ██████
       ███████      ██████████████       ███    ██████
       ██████    █████████████       ███████    ██████
       ██████    ██████████       ██████████    ██████
       ██████    ██████        █████████████    ██████
       ██████    ███       █████████████        ██████
       ██████           █████████████       ██████████
       ██████       █████████████        █████████████
                 █████████████       █████████████
              ████████████        █████████████
                  ████         ████████████
                           █████████████
                         ███████████
                            █████
Ferrum Network • Interoperability Network for Financial Applications
astor
Newbie
*
Offline Offline

Activity: 39
Merit: 0


View Profile
April 18, 2013, 11:52:31 AM
 #16

Isn't converting passphrase -> address just public key crypto?  That's at around 10k/s isn't it?
molecular
Donator
Legendary
*
Offline Offline

Activity: 2772
Merit: 1019



View Profile
April 18, 2013, 12:05:46 PM
 #17

Yeah already did this. But I just made a bitcoin address generator like vanitygen but used a password dictionaries as the seed rather than randomness. Created a long list of addresses. Using a block explorer you can extract every address with a balance in it. Compare the list.

Lesson - don't use brain wallets.

no, that's not the lesson. "Use passphrase with high enough entropy for brainwallets" is the lesson.

PGP key molecular F9B70769 fingerprint 9CDD C0D3 20F8 279F 6BE0  3F39 FC49 2362 F9B7 0769
Dougie
Full Member
***
Offline Offline

Activity: 211
Merit: 100


You are not special.


View Profile
April 18, 2013, 12:10:11 PM
 #18

I like this! Interesting reading. Also amazing that you found some bitcoins using it since I was sceptical.

I don't think they're a good idea because I know how unreliable my brain is!

Lurking since 2011...
1J4DhU3q6RxxCTfAAcg5ExVK6FfxkmzkTH
CapnCrypto
Newbie
*
Offline Offline

Activity: 8
Merit: 0


View Profile
April 18, 2013, 01:30:00 PM
 #19

Wow, that's a very educational and interesting post, thanks for that Kevlar.

Sorry if these are newb questions but am I understanding right that once given a public key you can search through the block chain to find the holdings of the wallet associated with that key? Also, is it possible at all to find the public key associated with a certain BTC address? Just curious to understand the limitations of the BTC network.
psylence
Newbie
*
Offline Offline

Activity: 33
Merit: 0


View Profile
April 18, 2013, 01:38:31 PM
 #20

Not the best idea
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!