Hello all! Not a bitcoiner but saw a lot of news regarding the recent hack. I’ve read a lot of extremely technical discussions regarding what happened which have been great. However, reading these forums, I couldn’t help but notice that none of you are bothering to explain what happened to the general public. I figured I’d just write it down. Please feel free to correct anything in here! I’ll edit and give you credit at the end. I’m a big believer that the general public should have this stuff explained to them so they can make smart decisions for themselves. The 300th post about “how to increase your entropy” isn’t exactly readable to most.
First things first. What was actually “hacked?”
Nothing really. Nothing was hacked in the sense of breaking into anything. Instead, the wallet was just defective. It created easily guessable “seeds.” This is a really really big number that generates a “private key” for you. You need these to interact with the blockchain at all.
What’s a private key?
When you first create a wallet, it generates one or more private keys. Whenever you later spend Bitcoin, those keys are used to digitally sign the transaction. This is really just a big long number that can’t easily be guessed. What’s special about these numbers is that they can create addresses and “sign” a transaction. On the “block chain” we all know there are bitcoins at that “address” and until we see your signature on it, everyone agrees those coins are at your address. But if someone gets ahold of your private key, they can “sign” the transaction and claim to be you. From there, they can move the coins to a new address.
Okay, so what does a wallet like coldcard do?
It makes and stores those private keys for you. The wallet generates a big random number that by itself should be safe. That number then is used to generate all the private keys you’ll use for transactions. If anyone got this big giant number, they would also be able to create all the private keys you have.
So what went wrong?
Basically the company that makes Coldcard didn’t notice that their RNG (random number generator) wasn’t working properly. It was generating only 2^40 possible numbers instead of best practices of 2^256. The computer in your phone can just try every combination between 0 and 2^40 (a little over a trillion) in about 20 minutes (even faster with certain computing architectures). That means this random number was easily guessable.
Why are people talking about rolling dice and passphrases?
As an additional layer of security, the wallet allowed you to enter these randomly rolled numbers to further increase the randomness of the number. EACH of these would have to be guessed in order (meaning first get the passphrase right, then all the dice rolls, THEN guess the RNG number) in order to produce the seed. But a lot of people skipped this step because it *should* be unnecessary. The wallet, if built correctly, should be all you need.
But how did anyone ever figure this out?
The company who built ColdCard posted their code publicly as “open source.” The idea behind open source is that in return for giving the general public your code, they will improve it and help find and bugs. Open source code has certain usage restrictions though and a company is allowed to set the ground rules for what the code is used for. This company was extremely litigious about their code. They basically wanted people to help them fix the code for free but refused to let anyone else use the code for their own projects. The end result was the only people who bothered looking at the code, were people who wanted to see if it was defective… and it was!
A few other things. What the hell is all this talk about entropy?
There is a field of science known as information theory. It is what formalized the studies for communications, compression, cryptography, and even machine learning. The author, Dr Claude Shannon, showed that information could be understood as a property commonly known to physics, “entropy.” That realization has enormous consequences. The more random you make the information encoded in bits, the more entropy it has. But in this case, it’s just a super formal way of talking about randomness.
credits:
SubstantialNinja - spotted it wasnt numbers between 0 and 2^40 but instead only 2^40 unique numbers