Discover more from Coinkite’s Substack
Proof of Keys Vol 3. Final
On Breaking SHA256 FUD, Attack Surfaces of Computers, Bitcoin Binary Watch Bot, Quantum Computing & Multisig Grifters Attacks
Dee: Sparrow has a great thing called Master Fingerprint ID, , we as well have something called Master Fingerprint ID that you can check on the COLDCARD itself. If you're dealing with a single sig wallet, and you don't know if you're in your passphrase wallet or your in your BIP85 wallet, or whatever you want, you can go to Advanced Tools and go to View Identity. And then it will give you a string of eight letters and numbers. And that's basically the first four bytes of your public key. Like a username, it’s a way to identify what wallet you're in with, without having to just try and sign a transaction and get that error. It's just a good thing for beginners to know about. And I find it very useful.
NVK: Cool, thanks, Dee. I think it'd be really cool to talk about some of the some of the FUD around solutions and some of the ways the products in the market do address them, hopefully, we can clear a few of those, because that's in my view, one of the things that keep people from using good solutions is just this fear of the nearly impossible attacks, or attacks that are complete lies (ie FUD). Why don't we start with: 'can Sha 256 be broken?' We hear every time the price of Bitcoin goes up. People come into this Bitcoin space and start saying that somebody could break bitcoin's cryptography. How big is the entropy space for ECDSA and Schnorr in the way that Bitcoin uses it? And how hard it is to break it.
Rijndael: It's really large orders of magnitude. Humans are really bad at comprehending orders of magnitude. The order of the number of atoms in the observable universe is about two orders of magnitude larger than the number of valid ECDSA keys that you can have in Bitcoin. What Justine was saying earlier about that your seed is a representation of your private key. What happens is, when you go to create a new wallet, your wallet generates new really big random numbers, and then feeds it into an algorithm that creates a master private key. And then that master private key is used to derive all of your addresses and the corresponding private keys for them. There's two ways that somebody could get your private key: one of them is that they just get really lucky. And they have what's called a collision where they randomly pick a key, that's the same as one of your keys. And as I mentioned, there's a really, really, really large number of keys out there. It's very unlikely that somebody is going to pick the same one. Or the other thing is the security of Bitcoin’s digital signatures rests on a thing called the discrete log problem. And the idea is that we don't know any way of un-doing particular mathematical operations over elliptic curves. And if we did that, it would mean a lot of things about cryptography and the whole internet would be broken. The cryptography that's protecting Bitcoin is like the same cryptography that protects the rest of the internet. If that broke, pretty much everything would break.
NVK: If the Bitcoin cryptography is broken airplanes start falling off the sky, electricity will stop being delivered, and the water will stop being delivered. Even your sewer likely stopped working in a big city. Essentially, everything in your life that maintains you alive, except from being out in the bush, depends on cryptography nowadays, and its geography.
Rijindael: Also, Bitcoin needs the Internet to work.
NVK: Well, there's radio.
Rijindael: Well, you can broadcast a transaction, but the miners are going to need the internet, right?
NVK: That's right. Everything in Bitcoin starts from entropy. That's why I wanted to start from there and address the original original FUD in terms of Bitcoin, custody. Now, let's dive into sanity and quality of entropy. If you have a bad or evil device or piece of software, it could create bad entropy to you either by bug or by a malicious intent. Just to oversimplify it, let's say you have a rainbow table, or a known bug and derivation. And, an evil piece of software or hardware wallet could theoretically start giving you either extremely weak entropy accidentally, or it could give you entropy that they themselves know some part of the entropy; which is kind of scary, right? Because they could give you entropy that they can then later derive it themselves, those keys, and then take your money remotely without you ever knowing what happened. I think it's important here to understand why people in this space are so adamant about you using software that is verifiable: so you can go look at the source code. You can build it yourself; not that everybody's going to do it. But people who have some notability, or people who understand it in this space are going to go look at the software because they understand it. They're either going to vouch for that piece of software, or they're going to say to that they're finding any issues with it. That means that when you're using your COLDCARD somebody else looked at that source code and knows that Coinkite is not sort of hiding some purposeful bad derivation there. Now another thing that goes in that sense is: why is it important to bring your own entropy? Because why trust the software itself at all? Why don't you just throw some dice, and input that entropy yourself into the COLDCARD? In my view, that's even a better solution. Or at least do it to prove it that the device does what it claims it does. And then you do a new one or some mix of it.
Good Guy Biker: That's why you use those chips on your devices, right? Because they're certified. They've been tested for entropy creation, right? I think there's the hardware is a big part of that too.
NVK: Yes, the thing though: I don't want to trust the trng, even though it is certified on a hardware device. Chances of that having a backdoor or being evil are low. If there is a backdoor, it probably is going to be state actor level try to do something. In my view, we don't like to trust it at all. What we do is we mix the entropy of different chips manufacturers that would of all have had to conspire together to do perform such an attack. And then on top of that, they would have to cheat our openly verifiable source code. If you add a dice roll on top of that, they can't really do anything about it. There are devices out there that don't have verifiable source code and they do depend on certification, so their security level does depend on that single point of failure. Let's call it that way. And we have seen this happening the world through time in terms of attacks on security systems, by state level attackers.
Good Guy Biker: The enclaves or chipsets that the Trezor use are easily exfiltrated using glitching exploits on some of the older models. The barrier of physically taking private keys from some of the older Trezor is a 15-minute YouTube video, a breadboard, and a few jumper cables. Whereas, with something like the COLDCARD, which uses multiple secure enclaves, it's incredibly difficult. You would need laminating or microwave equipment, and university-level laser equipment before you can accomplish these types of exfiltration. I think that's a big step: simple secure hardware.
NVK: That's one cool thing you get with multi-sig or a passphrase; is that you de-risk each key. Both Justine at Unchained Capital and Jamesons at Casa do source that entropy from different hardware wallets, which I assume you guys allow customers to pick, but you probably advise them to pick different hardware wallets. And on Casa's Keys app you will also have the app being one source of entropy as well.
Lazy Ninja: Also there there may be people listening right now that thinks this is tinfoil hat stuff that you don't need to pay attention to but there's a theory right now in the theft of Luke's coins, that somebody identified that his system has common vulnerability that's been reported publicly that the random number generator on that system is terribly broken.
NVK: This is where the rabbit hole of: 'please don't roll your own solutions' as a civilian is so important. Even as a programmer: don't roll your own solutions. Because your widow may not be able to recover from that or you are fallible, and your own solution has not had the scrutiny of the market to find those bugs that may be an even bigger problem.
Lazy Ninja: You're only one person, and it's just impossible to do the level of scrutiny needed on complicated systems to validate everything. Even sometimes looking at the failure, it's not obvious to you because these things are much more subtle. These errors than they appear when people sort of disclosed and it seems obvious, but when you don't know the errors there, it's really hard to see.
NVK: An air-gapped computer running an OS like Cubes or Tails is a great solution for doing Bitcoin operations, constructing transactions, and checking your wallet, but it is a terrible solution for handling private keys. General-purpose computers were not designed to hold secrets, they are extremely complex machines. Even if the OS is open-source, there are still 50 layers that are closed below that. Even Raspberry Pis are closed-source. Everything is closed. I think Lazy Ninja has some great commentary on the attack surface of general-purpose computers.
Lazy Ninja: I just want to make it clear that some of these advanced attacks are not purely theoretical. One of the things people sometimes do to protect themselves is to use an air-gapped computer with a hard drive that has never touched the internet. Obvious, the code had to get onto the hard drive at some point. The user does their stuff and then wipes the hard drive or something similar. However, a sophisticated attacker who has malware in the source code that people are downloading and putting on the air-gapped computer to set it up, can make it possible for the source code to cache private keys and other sensitive information to memory chips on the system that cannot be easily removed. For example, a private key could be cached to BIOS memory, and even if the hard drive is wiped, the key may still be stored in physical hardware on the computer that cannot be removed without destroying the computer. If the system is reinfected by the same virus, it can go look in those cache places and recover the information. These are advanced and tricky ways that attackers can steal sensitive information.
NVK: This is a trivial attack on something like a Raspberry Pi. It is possible because it has a bunch of proprietary, closed binary blobs running on the main micro and auxiliary systems. People trying to experiment with DIY solutions may use a curl to a bash script to build all the source code from the internet without knowing what packages are coming in to build that source code. They're not reviewing it themselves and not part of a package system where people actively seek to remove packages and have less attack surface. This is a huge amount of work that Bitcoin Core goes through, where it doesn't have dependencies. This means that when building the software, everything required comes in the same bundle and has already been reviewed. Most importantly, it is deterministically built so that when people claim the source does what it does, you can check byte by byte that your build is the same one. There is no room for anyone to change anything and do any shenanigans. We see mistakes where people try to do entropy without paying attention, using dice, dominoes or paper out of a hat and accidentally type in the same result. Every single bit of weak entropy space in Bitcoin is being watched and has already been derived. If you have a low entropy Bitcoin key, someone will take those funds from you. When talking about quality open source software, commercial software, and hardware in Bitcoin, a lot of work goes into making sure it's not exposing you to hacks or bad entropy. Craig, how do you manage packages and give advice to people using open source software wallets on a computer?
Craig Raw: The reality is that there are lots of dependencies and all of the noted difficult, but nevertheless, possible attacks are valid. If someone has the same access that you do when you run your bitcoin wallet, they have all the permissions to access the memory in which it is and pod drive. That's why we use hardware wallets, to have an air gap or a key sitting on a different device which is not running in the same memory space, or at least that an attacker doesn't have access to that. In terms of dependencies, the way to deal with it is to try and reduce them as much as possible and then review the ones that are there. This is the same approach that Bitcoin Core would take. However, the more common attack vector is malware sitting on your computer which has access to your bitcoin wallet and may have compromised your wallet.
Good Guy Biker: The number one reason that this is happening here in Canada is that the internet service providers' DNS lists are being hacked. As a result, a lot of local internet service providers are redirecting people to bad Electrum packages, images, or copies of websites. It's not just the GitHubs or repositories or bad tutorials that are sending people to these bad payloads, sometimes it's a case of AT&T being exploited.
NVK: You know, that brings me to binarywatch.org. It's a little project we put together recently. Essentially, it watches the binaries, which are the downloadable version of the software that is reproducibly built, ideally, or at least the binaries are signed. Most Bitcoin software, the binaries are assigned with the maintainers' keys. And people should always check the signature before they run software in general, but especially if it's Bitcoin software, to make sure that it is the actual software intended for them, not an evil version of that software. It’s @binarywatchbot on Twitter and it watches a lot of Bitcoin project binaries. And if they produce a bad signature, it will warn you. But you can always check it there. It's nice to have multiple people, multiple parties, double-checking the same thing, because they would have a good copy, a good known copy of that public key that was used to sign that specific software.
Lazy Ninja: And always make sure to check multiple maintainer keys because again, in the case of our friend, his PGP key was also compromised, which could have released bad versions.
Portland: I wanted to make a comment on random sources of entropy, specifically hardware random number generators. There are three things that must go right to implement them correctly. First, you must have a true random source of entropy on the silicon. This is the manufacturers' job. For example, STM, which is used in the Coldcard, has a hardware random number generator that I personally trust. However, it is also important to implement it correctly in software. This means using the correct code to activate it and obtaining random entropy from it. Lastly, there must be protection against a common vulnerability exploit, such as 2019 15847, where the compiler can optimize out the necessary instructions. This led to the Talos 2 situation, where a PowerPC processor had a great random number generator, but the library GCC used to compile to the architecture optimized out the total range of entropy possible. Even if the programmer wrote the code correctly, the compiler would optimize the entropy range.
NVK: It could even get funnier; for instance blockchain info back in the day was not randomizing key values, which is one of the nuances that go into building this. Essentially, there was a guy collecting Bitcoin from people who had a blockchain dot info wallet because they had a 404 error on random number.org. It was literally a 404 error because somebody was pulling random numbers from some random website that claimed to have random numbers to begin with. Programmers do all kinds of stupid things, but it's not always malicious. When there's a large install base, there are more eyes on it, more people trying to break it. It's economically interesting for people to try to break it, and those problems, bugs, they do come because people want bounties, people want fame. I highly recommend if you're interested in this topic, I had an episode of Bitcoin Review with Lazy Ninja, Craig and a few others on diving into wallets. I think we linked it on the nest. When conducting Bitcoin transactions, the more complicated your setup is, the greater the risk you are in. Smart people who are more familiar with the topic may be more vulnerable to these risks because they may use more advanced or customized methods to secure their transactions, which can also increase the chances of human error or oversights. For example, someone may use a custom ThinkPad laptop that has had all of its radios removed and is only used for Bitcoin transactions, but if they were to accidentally plug in a malware-infected USB device, their entire setup could be compromised. On the other hand, less knowledgeable people may use more standard and well-known security methods, such as using a hardware wallet and sticking to a single signature approach or seeking assistance with multisig through CASA, Unchained, Nunchuk or Keeper. This can be less risky because these methods have been widely tested and have fewer opportunities for human error. This is why we recommend using hardware devices specifically designed for Bitcoin transactions, and using "air-gapped" systems, where the device containing the secrets is not connected to the internet or other devices. This greatly reduces the chances of a security breach, and is relatively easy and inexpensive to implement. What other FUD that's reasonable but also so very unlikely to happen do you guys want to bring up?
Good Guy Biker: Quantum computer risk is a topic that many people are discussing. However, most people don't realize that companies like D-Wave, working on quantum computers, will not be the only ones to benefit from this technology. The entire industry will benefit and many people will work towards solutions for quantum hardening. This is not necessary right now, it's more of a "Boogeyman." In the worst-case scenario, if a Black Swan event were to occur, the node operators would likely roll back to a particular block before the event and implement quantum hardening.
NVK: One attack that is worth mentioning is multisig grifting. This is where a virus on a computer replaces the payout addresses on a multisig and the devices are not prepared to check. This allows the attacker to control the outputs and send the change to themselves. They may not be able to spend it, but the victim will not know where the change went. This can also be done with xpubs. If a victim has a large UTXO in their wallet and does not have good UTXO management, the change can be sent to an unknown address. This is where the attacker may try to grift the victim for money. This type of attack can happen with most wallets that are not as great in the market, as they are not prepared to deal with this type of attack.
Good Guy Biker: But you helped fix that with COLDCARD, didn't you NVK?
NVK: We enforce certain measures to prevent this type of attack. We don't give you a choice and we will give you a warning if there is something fishy, but we cannot know everything. There are ways of handling this type of attack, such as using a BIP that addresses this issue: BIP 129, Bitcoin Secure Multisig Setup (BSMS). This standard helps address some of that quorum knowledge by all the signers. However, all the signers are not the same, so it's important to have diversity in hardware signing devices and make sure that they have the best defenses in place. It's important to not use random hardware wallets that you heard are great on Twitter, but to do your research and make sure that you are using a reliable and secure hardware wallet. A lot of hardware wallets in the market are not commonly recommended and are mostly just Android phones from China in a different package, pretending to be very secure, but they are not.