1 00:00:00,000 --> 00:00:01,700 This is our first talk today. 2 00:00:03,020 --> 00:00:08,240 Talk is basically the one Bitcoin heist with Joseph Gabay. 3 00:00:08,620 --> 00:00:10,340 And here he is. 4 00:00:10,360 --> 00:00:12,340 And give him a big round of applause. 5 00:00:12,340 --> 00:00:14,780 This is the first talk of DAKON. 6 00:00:15,000 --> 00:00:15,940 All right. 7 00:00:16,580 --> 00:00:17,320 All right. 8 00:00:17,320 --> 00:00:18,260 There you go, buddy. 9 00:00:18,260 --> 00:00:19,620 Thank you very much. 10 00:00:20,320 --> 00:00:21,520 Hello everyone. 11 00:00:21,520 --> 00:00:22,520 Good morning. 12 00:00:22,600 --> 00:00:24,340 Thank you all for coming. 13 00:00:25,540 --> 00:00:29,120 My name is Joseph Gabay and I stole a Bitcoin from the Internet. 14 00:00:29,300 --> 00:00:33,920 And I'm going to tell you how I did it and how you can do it too, but not really. 15 00:00:34,520 --> 00:00:37,300 So before I get into this talk, I want to give a basic disclaimer. 16 00:00:37,300 --> 00:00:38,540 This is a personal project. 17 00:00:38,540 --> 00:00:42,280 It's not affiliated with my employer, with my friends, with anyone. 18 00:00:42,740 --> 00:00:45,740 Just don't call my employer asking about this. 19 00:00:45,740 --> 00:00:47,100 I've had that happen before. 20 00:00:47,100 --> 00:00:48,580 It's an awkward conversation. 21 00:00:49,260 --> 00:00:51,880 I'll have my email address at the end if you've got questions. 22 00:00:51,880 --> 00:00:52,360 Reach out to me. 23 00:00:52,360 --> 00:00:53,400 I'm happy to talk. 24 00:00:54,480 --> 00:00:56,540 So what this talk is about. 25 00:00:56,860 --> 00:01:03,340 In short, about ten years ago, some anonymous person on the Internet issued a puzzle challenge to the Internet. 26 00:01:03,580 --> 00:01:05,320 There is a one Bitcoin prize. 27 00:01:05,320 --> 00:01:06,440 There are 20 clues. 28 00:01:06,440 --> 00:01:11,960 If you solve all 20 clues, you get the phrase that unlocks the brain wall that contains the Bitcoin. 29 00:01:12,160 --> 00:01:15,960 Now this went on claim for a very long time, over 11 years. 30 00:01:15,960 --> 00:01:23,460 And as I'm sure all of you know what the Bitcoin prize has done in those past 11 years, it was definitely interesting that it had never been claimed. 31 00:01:23,900 --> 00:01:37,780 So last year, as the prize continued to spike, I eventually got over my disdain for OpenCL and decided to learn how to botch the other hashcat plugins in order to crack brain wallets and finish the rest of this puzzle. 32 00:01:37,880 --> 00:01:50,600 So this talk is going to talk about the puzzle itself, who wrote it and how it worked, how brain wallets work under the hood, which is the technology that the puzzle relied on, and also the basics of hashcat modules and plugins and how to put them together. 33 00:01:51,260 --> 00:01:55,020 So, a little bit about me and how I got here. 34 00:01:55,020 --> 00:01:56,820 I used to be a robotics engineer. 35 00:01:57,120 --> 00:01:59,920 And then I did something very funny with shopping cart wheels. 36 00:01:59,920 --> 00:02:02,080 You can check it out at the Physical Security Village later. 37 00:02:02,080 --> 00:02:05,820 I've got a little demo booth, but you can control them with your phone by freaking them. 38 00:02:05,940 --> 00:02:10,920 I spoke about that at DEF CON 29 and 31, if you're curious at all. 39 00:02:10,920 --> 00:02:15,980 And I'm a skydiver, an internet treasure hunter, retired now. 40 00:02:15,980 --> 00:02:17,780 I figure I should quit while I'm ahead. 41 00:02:18,100 --> 00:02:21,160 And I'm here on stage now. 42 00:02:21,720 --> 00:02:23,940 So, the one bitcoin book. 43 00:02:24,400 --> 00:02:29,040 This was a puzzle challenge posted to Twitter and Reddit in April 2014. 44 00:02:29,360 --> 00:02:34,240 The deal was the first ten people to sign up for it on the website got a free copy of the book. 45 00:02:34,240 --> 00:02:39,400 Everyone else had to pay 0.01 bitcoins, which at the time was only four or five dollars. 46 00:02:39,400 --> 00:02:41,840 But now is much, much more. 47 00:02:42,300 --> 00:02:45,860 The copyright at the bottom of it was to a Spencer Lucas. 48 00:02:45,860 --> 00:02:48,820 I've done some basic OSINT on this. 49 00:02:48,820 --> 00:02:52,260 I haven't been able to find any social media presence, any name. 50 00:02:52,260 --> 00:02:54,580 The website was WhoIsProtected. 51 00:02:55,560 --> 00:02:57,620 So, I really have no idea. 52 00:02:57,620 --> 00:03:01,300 I've tried reaching out to all of the social media accounts and haven't gotten any responses. 53 00:03:01,300 --> 00:03:05,900 Spencer Lucas, if you're out there watching this talk, reach out, please. 54 00:03:07,620 --> 00:03:09,520 But there were 20 clues. 55 00:03:09,680 --> 00:03:12,180 I'll give some examples of them in just a second. 56 00:03:12,200 --> 00:03:15,860 But each clue gave you a single letter, uppercase or lowercase. 57 00:03:15,860 --> 00:03:18,020 There were no special characters, no numbers. 58 00:03:18,020 --> 00:03:22,540 So, that is a 52 character set for each possible clue. 59 00:03:22,780 --> 00:03:30,900 You took all of these, you combined them, and you added an extra little bonus string that you got as part of the email when you actually paid for it or signed up for free. 60 00:03:30,900 --> 00:03:33,040 Put that into the Brain Wallet utility. 61 00:03:33,280 --> 00:03:37,860 And if you got it right, you get the private key for the address containing one Bitcoin. 62 00:03:38,820 --> 00:03:40,660 Reactions to this were a little mixed. 63 00:03:40,660 --> 00:03:43,540 A lot of people on Reddit thought this guy was full of crap. 64 00:03:43,920 --> 00:03:45,100 Rightfully so. 65 00:03:45,740 --> 00:03:47,300 People thought it was suspicious. 66 00:03:47,560 --> 00:03:52,820 And , you know, he was, to his defense, engaging with people on Reddit and trying to defend it. 67 00:03:52,820 --> 00:03:56,580 He, at one point, had joked if this went well, he might release a 10 Bitcoin book. 68 00:03:56,580 --> 00:03:58,160 I'm still waiting for that. 69 00:03:58,160 --> 00:04:02,720 I hope he chooses a different technology to base it off of for reasons that will become evident. 70 00:04:03,300 --> 00:04:04,220 But, yeah. 71 00:04:04,220 --> 00:04:10,700 It was one of those things where I don't think a lot of people really wanted to engage with it because they didn't think it was legitimate. 72 00:04:10,700 --> 00:04:13,700 They thought someone was trying to steal four or five bucks at a time from folks. 73 00:04:13,700 --> 00:04:15,080 Which, fair. 74 00:04:15,240 --> 00:04:17,360 But, so it goes. 75 00:04:17,480 --> 00:04:19,260 Let's go through a couple of the clues. 76 00:04:19,800 --> 00:04:21,820 I had some help solving these. 77 00:04:21,820 --> 00:04:24,840 One of them is from my friend Ashley who helped me with quite a few of these. 78 00:04:24,840 --> 00:04:26,260 She's in the audience here right now. 79 00:04:26,260 --> 00:04:35,260 If we could just give a big round of applause because she was hugely instrumental in helping me get here and also just keeping my fixation on this alive. 80 00:04:35,860 --> 00:04:40,120 So, this is clue 12, one of the examples that Spencer posted on Twitter publicly. 81 00:04:40,440 --> 00:04:43,920 It consists of four shapes with letters in them. 82 00:04:44,100 --> 00:04:50,120 And it's not said, but you can intuit that you need to figure out the pattern and figure out what letter is in the next shape. 83 00:04:50,420 --> 00:04:53,520 So, again, I have no idea how Ashley figured this one out. 84 00:04:53,520 --> 00:04:57,340 But you have to take the position index of each shape. 85 00:04:57,340 --> 00:04:58,840 So, one, two, three, or four. 86 00:04:58,840 --> 00:05:02,660 Count the number of letters in the word for the number of that index. 87 00:05:02,660 --> 00:05:04,260 So, one has three letters. 88 00:05:04,260 --> 00:05:08,160 That number gives you the number of sides in the polygon. 89 00:05:08,160 --> 00:05:11,220 So, one is three, gives you a triangle. 90 00:05:11,820 --> 00:05:14,980 Three is five, gives you a pentagon, etc. 91 00:05:15,960 --> 00:05:25,620 And then you take the nth letter from the word of the shape and put that in the letter, and that's the pattern. 92 00:05:25,620 --> 00:05:32,720 So, if we continue this on, we get five, which has four sides, which gives us a square, and the fifth letter of square is R. 93 00:05:32,720 --> 00:05:33,860 So, that's R. 94 00:05:34,240 --> 00:05:39,600 These were fairly complicated, and some of them were a bit involved. 95 00:05:39,600 --> 00:05:41,220 Some of them were less so. 96 00:05:41,220 --> 00:05:43,940 Oh, no, there's one even more impressive one after this. 97 00:05:43,940 --> 00:05:45,420 This is one that I solved. 98 00:05:45,420 --> 00:05:46,720 This was a lot easier. 99 00:05:46,780 --> 00:05:48,520 They were not all as esoteric. 100 00:05:48,520 --> 00:05:52,660 This was a 4x4 grid with some numbers in it and a missing space. 101 00:05:53,140 --> 00:06:00,020 If you look at the diagonal, you see KMPH spelled out backwards, and then some numbers. 102 00:06:00,120 --> 00:06:06,720 Physicists amongst you, or weirdos, might recognize that the speed of light in kilometers per hour is, in fact, that number. 103 00:06:06,720 --> 00:06:10,000 And we know that the speed of light is represented with a lowercase c. 104 00:06:10,000 --> 00:06:11,920 So, that's clue four. 105 00:06:11,920 --> 00:06:16,780 And here's another one that I actually solved, and I would have never gotten this in a million years. 106 00:06:16,780 --> 00:06:22,440 It's a sequence of 12 numbers arranged in five rows, and the last number is unknown. 107 00:06:22,440 --> 00:06:30,100 There is a key at the bottom for decoding the final number into the answer, and you can see it's A through Z lower, A through Z upper. 108 00:06:30,440 --> 00:06:40,840 And, yeah, I'm just going to give you the answer for this one, because the nth number is the sum of the nth prime number, Fibonacci number, and perfect square. 109 00:06:42,300 --> 00:06:49,180 I, again, actually have no idea how you got this, but it's a good one. 110 00:06:49,180 --> 00:06:53,400 And you add everything up, you get 325, which corresponds to uppercase B. 111 00:06:53,700 --> 00:06:56,620 So, those are some examples of the kinds of clues. 112 00:06:56,620 --> 00:06:59,280 You know, a lot of them were pattern-based, some of them were basic. 113 00:06:59,280 --> 00:07:04,580 One of them, which I absolutely drove myself nuts on, had three-by-three grids with letters in them. 114 00:07:04,580 --> 00:07:07,820 I was trying to solve Sudoku or word searches. 115 00:07:07,820 --> 00:07:14,420 No, they were all just airport codes for airports in countries that started with S, and the answer was uppercase S. 116 00:07:14,580 --> 00:07:17,440 And I overworked that one really hard. 117 00:07:17,440 --> 00:07:21,300 I had a Python program doing Sudoku solving with all the airport codes for countries. 118 00:07:21,300 --> 00:07:22,720 It was... it was... 119 00:07:23,140 --> 00:07:24,260 But, anyways. 120 00:07:24,300 --> 00:07:26,280 So, all of this goes into a brain wallet. 121 00:07:26,280 --> 00:07:27,820 What is a brain wallet? 122 00:07:27,820 --> 00:07:34,580 And I'm going to say right now, don't use brain wallets to store anything valuable right now, both because of what I've done and what another hacker's done years ago. 123 00:07:34,580 --> 00:07:36,560 I'm going to talk about their cool work in a sec. 124 00:07:36,560 --> 00:07:40,980 But brain wallets are basically a method to store Bitcoin in your brain. 125 00:07:41,100 --> 00:07:43,660 You create a secret passphrase. 126 00:07:43,740 --> 00:07:54,240 This can be anything from, you know, password 123, which you'll be stolen from immediately, to the entire B-movie script. 127 00:07:54,240 --> 00:08:00,020 Which, again, you'll be stolen from immediately because people have all of the things people would think of just cycling through. 128 00:08:00,020 --> 00:08:07,320 People have been like, oh, I've used the first three paragraphs from The Great Gatsby and my money was stolen in, like, five seconds. 129 00:08:07,580 --> 00:08:10,040 Don't use brain wallets for anything important. 130 00:08:10,200 --> 00:08:13,340 We'll talk about the internals and how they work a little later on. 131 00:08:13,340 --> 00:08:24,060 But the original website, Brain Wallet, was taken down after another hacker had pointed out some fairly significant security weaknesses in how it worked. 132 00:08:24,060 --> 00:08:26,280 And that resulted in people getting their money stolen. 133 00:08:26,280 --> 00:08:41,640 But there is a reproduction of it for people who need to reclaim their funds, and it has a big warning at the top at brainwalletx.github.io in case anyone wants to play around with this at home and needs to actually go from the brain wallet phrase to the private key. 134 00:08:42,680 --> 00:08:50,800 So, before we get into how the brain wallet works, I'm going to give a very, very brief overview of two key cryptographic concepts. 135 00:08:50,800 --> 00:08:55,040 That's going to be hashes and elliptic curve cryptography. 136 00:08:55,040 --> 00:09:00,740 So, hashes are a special little function that basically act as one-way trap doors. 137 00:09:00,740 --> 00:09:02,980 You can take an input of any size. 138 00:09:02,980 --> 00:09:09,020 It can be a single letter, or it can be the entire script of the Bee Movie, or it can be the Bee Movie as an MP4 file. 139 00:09:09,020 --> 00:09:13,280 But you can take anything in, and it outputs it to an output of a fixed size. 140 00:09:13,280 --> 00:09:17,540 So, any input, a size of 128 bytes, for example. 141 00:09:18,300 --> 00:09:22,060 And the important part about hashes is they are repeatable. 142 00:09:22,060 --> 00:09:26,200 So, if you hash the same thing twice, you will always get the same result. 143 00:09:26,740 --> 00:09:32,880 You can change just a single character in a long text, and it's going to completely change what the hash is. 144 00:09:32,880 --> 00:09:34,820 And this means there's no way to go backwards. 145 00:09:34,820 --> 00:09:39,220 I can't give you a hash, and you tell me what the original thing was. 146 00:09:39,220 --> 00:09:40,200 At least easily. 147 00:09:40,200 --> 00:09:43,460 You have to basically brute force it, which is what this talk is about. 148 00:09:44,040 --> 00:09:50,800 They're used in a lot of contexts, and this is an entire field of cryptography unto themselves, so I'm not going to go into too much detail. 149 00:09:50,800 --> 00:09:54,100 But they're very important for storing passwords safely. 150 00:09:54,100 --> 00:09:56,860 So, if you have a database breach, people don't know all the passwords. 151 00:09:56,860 --> 00:10:01,520 You can use them to verify data integrity, because if one little thing changes, the whole hash changes. 152 00:10:01,700 --> 00:10:04,760 And, in some cryptographic contexts, they just waste time. 153 00:10:04,760 --> 00:10:15,220 They're computationally expensive, and if you want to make an attacker waste a bunch of time so they can't brute force as fast, you say, all right, do a thousand versions of this hash over and over. 154 00:10:15,220 --> 00:10:18,620 And it knows what the answer should be, so you have to do the work. 155 00:10:18,620 --> 00:10:22,240 The second important concept is elliptic curve cryptography. 156 00:10:22,240 --> 00:10:31,700 This one is even more esoteric, so I'm going to skip over some of the technical details, but the important parts are you have two keys with this. 157 00:10:31,700 --> 00:10:34,700 You have a private key and a public key. 158 00:10:34,980 --> 00:10:42,500 The private key is used to sign messages, encrypt them, and the public key is used to verify or decrypt them. 159 00:10:42,500 --> 00:10:46,760 There's a lot of nuance here, but that's the important part for what we're doing here. 160 00:10:46,760 --> 00:10:55,800 If you have the private key, you can always figure out the public key, but it is impossible to figure out what the private key is from the public key. 161 00:10:55,800 --> 00:11:04,080 That's what a lot of modern cryptography is based on, and until quantum computing becomes in vogue, that's going to be the norm. 162 00:11:04,520 --> 00:11:07,560 They're used all over for creating secure connections. 163 00:11:07,640 --> 00:11:15,060 Cryptocurrencies use them heavily, as we're about to learn, and they're critical for authentication and identity verification. 164 00:11:15,660 --> 00:11:17,120 It's a lot of deep math. 165 00:11:17,120 --> 00:11:21,520 They're very cool, but well, well beyond the scope of what I can competently explain. 166 00:11:22,140 --> 00:11:23,820 So we have these. 167 00:11:24,000 --> 00:11:25,380 How do these make a brain wallet? 168 00:11:25,380 --> 00:11:29,240 How do you take a phrase in your head and get Bitcoin out of it? 169 00:11:29,340 --> 00:11:33,600 So we take a secret passphrase and we somehow transform it into a Bitcoin address. 170 00:11:33,600 --> 00:11:35,320 There's some mystery steps in between. 171 00:11:35,980 --> 00:11:39,660 We take the secret passphrase. 172 00:11:39,720 --> 00:11:42,840 We'll use hello DEF CON 33 for our example here. 173 00:11:42,840 --> 00:11:47,060 And first we run it through a hash algorithm called SHA-256. 174 00:11:47,720 --> 00:11:53,500 So this is going to take hello DEF CON and turn it into that string starting with BDA that you see there. 175 00:11:53,980 --> 00:11:57,560 Now this is going to be what we use as our private key. 176 00:11:57,560 --> 00:12:00,400 The brain wallet application calls this the secret exponent. 177 00:12:00,400 --> 00:12:04,020 That's not wrong, but that's not the nomenclature usually used with cryptocurrencies. 178 00:12:05,140 --> 00:12:15,260 So we're going to take this, and the nice part about the hash algorithm is no matter what input you have, it'll always give you the same size output. 179 00:12:15,260 --> 00:12:23,980 So Bitcoin private keys are expected to be a specific size, so you can use the hash algorithm to force whatever input to be a valid private key. 180 00:12:23,980 --> 00:12:26,260 So that's the beauty of hash algorithms there. 181 00:12:26,640 --> 00:12:40,400 So using that elliptic curve cryptography, we basically plot stuff on some neat parabolas, we can get the public key associated with this private key, and that's that little string starting with 04A. 182 00:12:40,400 --> 00:12:45,840 And I'm going to tell everyone now there's no Bitcoin on this address, if anyone's already got the site up. 183 00:12:46,820 --> 00:12:50,380 So you take this and you do another hash algorithm. 184 00:12:50,380 --> 00:12:59,700 This is called hash 160, and this is kind of specific to Bitcoin, but it's a combination of another round of SHA-256 and then RIP EMD 160. 185 00:12:59,700 --> 00:13:07,900 And the important part is you get 160 character output from RIP EMD 160, and that's what you're going to need to make your address. 186 00:13:08,360 --> 00:13:19,180 And basically getting the address from that is pretty easy, you just shift around a couple bits, add some encoding, add a checksum, and encode it all in base 56, and you have your Bitcoin address. 187 00:13:19,180 --> 00:13:21,820 In this case it's 15ZC whatever. 188 00:13:22,200 --> 00:13:33,560 So, and you can do this with any phrase, if I change the H in Hello Def Con to a lower case H, all of those strings below it would change radically, and I would get a completely different Bitcoin address, and a completely different private key. 189 00:13:34,440 --> 00:13:37,780 So, how do we solve the puzzle the intended way? 190 00:13:38,540 --> 00:13:52,700 The intended way is we solve all 20 clues, we add the secret string, which is another 20 clues that we got in the email to the end of it, we throw this into the Brain Wallet website, we get the private key, we take that private key, put it into our wallet, 191 00:13:52,700 --> 00:13:53,820 and extract the money. 192 00:13:54,340 --> 00:13:57,140 And somehow profit, and pay a bunch of taxes. 193 00:13:58,000 --> 00:14:00,820 Well, as you can guess, I didn't do it that way. 194 00:14:00,820 --> 00:14:20,000 In retrospect, I know this with the clarity of hindsight, I had, me and Ashley had solved 16 of the 20 clues, we didn't know how many, how close we were originally, but we were fairly close, and we still weren't going to cross that finish line, and there's still two that I have no idea how to get the answer to, 195 00:14:20,000 --> 00:14:21,420 despite knowing the answer. 196 00:14:21,420 --> 00:14:34,460 So we're going to do it the hacker way, and this involves some spreadsheets and a bunch of math, but we had a high confidence in at least 70% of the clues, decent guess for 20%, and then the last two, absolutely no idea. 197 00:14:34,660 --> 00:14:44,140 And I thought, what if we just brute force the last 30%, you know, it's only like a couple letters, how hard can it be? 198 00:14:44,600 --> 00:14:46,720 Let's find out, let's do some math. 199 00:14:47,480 --> 00:14:50,280 So, I tricked you all, it's math lesson time. 200 00:14:51,200 --> 00:14:52,880 Let's talk about combinatorics. 201 00:14:52,880 --> 00:14:57,340 So, combinatorics, very basically, it's a branch of math dealing with counting things. 202 00:14:57,340 --> 00:14:59,740 How many ways can you arrange a set of objects? 203 00:14:59,740 --> 00:15:02,480 If the order does matter, if the order doesn't matter. 204 00:15:04,180 --> 00:15:08,860 And it's a very fun field of math because it can give us some ridiculously large numbers. 205 00:15:09,840 --> 00:15:17,000 So, for instance, we have 20 positions, each one having 52 possibilities to solve. 206 00:15:17,000 --> 00:15:19,080 That's 52 to the 20th power. 207 00:15:19,080 --> 00:15:21,880 And I have just lost my presentation, there we go. 208 00:15:21,880 --> 00:15:26,020 So, it's 52 to the 20th power, and that's a really, really big number. 209 00:15:27,300 --> 00:15:31,820 Every clue we have a confident answer to divides this number by 52. 210 00:15:31,820 --> 00:15:37,380 And you can see I have a little chart to the side there that kind of shows how quickly that grows. 211 00:15:37,680 --> 00:15:48,500 You know, we go from only missing 2 to, you know, 2700 possibilities, to missing 17 to already 140,000, and it just grows quite literally, exponentially. 212 00:15:48,680 --> 00:15:54,740 There's way too many to test manually with any sort of brute force, so we need to make a computer do this. 213 00:15:55,140 --> 00:16:04,000 Thankfully, another brilliant hacker by the name of Ryan Castellucci, I don't know how to pronounce their last name, but they're a fellow non-binary hacker. 214 00:16:04,180 --> 00:16:08,620 They're currently suing the UK government for non-binary recognition. 215 00:16:08,620 --> 00:16:10,660 I'll have a little plug for them later. 216 00:16:10,660 --> 00:16:20,120 But they spoke at DEF CON 23, where they introduced Brain Flare, which was a utility for cracking brain wallets in CPU time. 217 00:16:20,220 --> 00:16:26,120 And they are the main reason you should not use brain wallets, or at least up until now, they were the main reason. 218 00:16:26,120 --> 00:16:27,620 Now there's two good reasons. 219 00:16:28,160 --> 00:16:33,820 You can do whatever you want with your money, I'm not your mom or accountant, but, like, it's not a good idea. 220 00:16:33,980 --> 00:16:35,340 It's going to get stolen. 221 00:16:35,500 --> 00:16:43,660 This only runs in CPU, it is not GPU accelerated, but, you know, given the numbers that I just looked at, depending on the speed I get, that's quite possible. 222 00:16:44,100 --> 00:16:46,200 So, I do a little bit of testing. 223 00:16:46,580 --> 00:16:51,960 My home PC maxes out at 1.4 mega hashes a second. 224 00:16:51,960 --> 00:16:55,840 That's 1.4 million hashes per second it can do, possibility-wise. 225 00:16:55,840 --> 00:16:58,640 And I've got my computer specs there in case anyone's curious. 226 00:16:59,380 --> 00:17:02,320 So now we get to do math with big numbers, which is fun. 227 00:17:02,760 --> 00:17:06,340 1.4 mega hashes is 1.4 times 10 to the 6th. 228 00:17:06,340 --> 00:17:16,140 We divide that by our number that's 10 to the 20th, and we get a number on the order of 4.73 times 10 to the 20th years. 229 00:17:16,260 --> 00:17:20,220 That is 10 orders of magnitude larger than the age of the universe. 230 00:17:20,280 --> 00:17:24,700 I am not going to crack the entire puzzle from scratch on my home computer. 231 00:17:25,260 --> 00:17:28,920 Thankfully, we already solved a bunch, and that cuts it down significantly. 232 00:17:29,060 --> 00:17:38,260 If we have 15 solved, which is one more than we were confident on, that gets us down to a much more reasonable number, and we can solve it in about 270 seconds. 233 00:17:38,740 --> 00:17:40,320 Which... let's do it! 234 00:17:40,920 --> 00:17:49,560 And this is just another example of how long it would take to solve each number of unknowns. 235 00:17:50,780 --> 00:17:53,280 So, let's crack the puzzle. 236 00:17:53,580 --> 00:17:57,760 I wrote a lightweight generator script in C. 237 00:17:57,920 --> 00:18:01,020 It pipes its output directly into Brainflare. 238 00:18:01,020 --> 00:18:05,020 It is basically just a whole bunch of arrays with characters. 239 00:18:05,280 --> 00:18:17,380 It pipes all of the different things in, and Brainflare converts them into a brain wallet, and tells me if it matches the Bitcoin address that I told it in advance. 240 00:18:17,380 --> 00:18:21,000 So, let's rip through, you know, just a cool 20 billion hashes. 241 00:18:21,000 --> 00:18:21,900 No big deal. 242 00:18:24,600 --> 00:18:27,660 That was... let me get my alignment better. 243 00:18:27,780 --> 00:18:28,680 There we go. 244 00:18:29,980 --> 00:18:34,120 So, four hours later, it was easy. 245 00:18:34,180 --> 00:18:35,800 Nah, I didn't get anything. 246 00:18:36,580 --> 00:18:37,800 Didn't work. 247 00:18:37,860 --> 00:18:42,160 I expanded this to a run with seven unknown clues. 248 00:18:42,280 --> 00:18:44,500 That took over eight days to run. 249 00:18:44,500 --> 00:18:50,600 It was just very weird having my computer on for eight days straight, not using it because it was fully maxed out. 250 00:18:50,800 --> 00:18:52,640 And, didn't get it. 251 00:18:53,560 --> 00:18:55,820 At this point, it was very discouraging. 252 00:18:55,820 --> 00:18:59,800 One of the big problems with this challenge is, there's no feedback in the process. 253 00:18:59,800 --> 00:19:04,280 You're putting in... it's like CTS where you're just putting in a flag and being told yes or no. 254 00:19:04,280 --> 00:19:06,820 You don't know which clues are right. 255 00:19:06,820 --> 00:19:09,640 You don't know which clues are wrong. 256 00:19:09,980 --> 00:19:13,520 You don't even know if the puzzle's solvable. 257 00:19:13,700 --> 00:19:25,500 It had been... I'd taken various swings at this over the past ten years, but it had been a significant amount of time, and Bitcoin had increased, and presumably the puzzle creator knew the answers and likes money. 258 00:19:25,500 --> 00:19:29,180 So, one would assume that he would have solved it himself. 259 00:19:29,180 --> 00:19:32,320 So, the suspicion of, is this even possible? 260 00:19:32,320 --> 00:19:35,400 Did the creator make a typo and the money is just lost forever? 261 00:19:35,800 --> 00:19:37,360 That started to cross my mind. 262 00:19:37,360 --> 00:19:39,180 So, I need to try a different approach. 263 00:19:39,740 --> 00:19:42,060 And that involves rolling unknowns. 264 00:19:42,260 --> 00:19:44,520 We're doing more combinatorics, I know. 265 00:19:45,800 --> 00:19:51,740 Basically, we have a number that we know, and we know at least one of those is wrong. 266 00:19:51,740 --> 00:20:00,440 So, we need to rotate through all the possible combinations of ones that we think are right and set them to be the wild card and rotate through all the possibilities. 267 00:20:00,460 --> 00:20:03,380 And that's going to increase our solution space significantly. 268 00:20:03,380 --> 00:20:07,740 And this lovely equation can tell us by exactly how much. 269 00:20:07,960 --> 00:20:10,400 And this table can save you from doing the math. 270 00:20:10,560 --> 00:20:19,580 As we can see, I have the number of rotating wild cards and the number of fixed wild cards, that is ones that we know we don't know and are always brute forcing. 271 00:20:19,580 --> 00:20:27,640 And as we change the number of those, we see that it increases the crack time by a different factor. 272 00:20:27,640 --> 00:20:35,480 For instance, if we have five fixed wild cards and two rotating wild cards, that increases the time to crack by a factor of 105. 273 00:20:35,760 --> 00:20:44,720 Which is significant to cross any sort of space, given the fact that there are 20 ones that we don't know that we don't know. 274 00:20:44,720 --> 00:20:48,180 One of the ones that I was confident in had to be wrong. 275 00:20:48,180 --> 00:20:49,360 Nope. 276 00:20:50,780 --> 00:20:53,960 So, we got to go fast. 277 00:20:54,840 --> 00:20:58,320 GPUs are the best for doing any sort of cryptographic operation. 278 00:20:59,020 --> 00:21:01,380 Because they can do stuff in parallel. 279 00:21:01,380 --> 00:21:09,820 So, CPUs basically, they take one hash at a time and do all the math for that one hash, check it, and see if it works. 280 00:21:10,020 --> 00:21:21,240 GPUs, because they're used to having to render grids of pixels that are doing the exact same math for the shader over and over, they basically have a bunch of mini-CPUs all in parallel. 281 00:21:21,240 --> 00:21:25,340 The catch is, they can only do the same operation at a time. 282 00:21:25,340 --> 00:21:32,420 So you have multiple hash candidates all loaded in and they're going through each step one at a time in lockstep. 283 00:21:32,420 --> 00:21:38,480 And then at the very end, you can just look through the very end and say, alright, do any of these match what we're looking for? 284 00:21:38,640 --> 00:21:45,500 It's a massive, massive time increase and it's the reason cryptocurrency miners have bought up all the graphics cards. 285 00:21:45,500 --> 00:21:48,120 Because it's the same crypto math. 286 00:21:48,480 --> 00:21:53,240 The other problem for me is, coding for GPUs is hard. 287 00:21:54,380 --> 00:21:55,040 Really hard. 288 00:21:55,040 --> 00:21:59,800 It is kind of an obscure area that's very specialized. 289 00:21:59,800 --> 00:22:03,140 There is not a lot of good tutorials for it. 290 00:22:03,200 --> 00:22:05,500 Or not a lot of resources. 291 00:22:05,620 --> 00:22:11,860 You know, in the days even before ChatGPT, there was basically nothing. 292 00:22:11,860 --> 00:22:16,520 And I did, just out of curiosity, throw up ChatGPT and say, make me a hashcat module to do this. 293 00:22:16,520 --> 00:22:18,720 And it can't do OpenCL either. 294 00:22:20,380 --> 00:22:22,440 But has someone done it for me? 295 00:22:22,440 --> 00:22:23,460 I'm lazy. 296 00:22:23,460 --> 00:22:24,320 We'll see. 297 00:22:24,720 --> 00:22:32,620 So I was looking at a couple GPU-based projects that do similar things around trying to find a specific Bitcoin address. 298 00:22:32,620 --> 00:22:35,380 And there are three major candidates here. 299 00:22:35,500 --> 00:22:38,840 VanityGen and its subprogram OCLVanityGen. 300 00:22:38,840 --> 00:22:43,400 OCL being OpenCL, which is the GPU programming language. 301 00:22:43,400 --> 00:22:45,400 It's used to generate vanity addresses. 302 00:22:45,400 --> 00:22:48,160 Let's say you want a Bitcoin address that starts with your name. 303 00:22:48,540 --> 00:22:54,760 You can have your GPU generate Bitcoin addresses just at random until it eventually hits one. 304 00:22:54,760 --> 00:22:57,500 And you'll go through billions and you'll hit one. 305 00:22:57,560 --> 00:23:00,360 But if you can do billions a second, it's pretty all right. 306 00:23:00,500 --> 00:23:01,980 This uses GPU. 307 00:23:02,100 --> 00:23:03,400 And that's promising. 308 00:23:03,720 --> 00:23:10,460 Because you can say, I want to find this pattern of address and it does some sort of cryptography. 309 00:23:10,460 --> 00:23:11,620 And it does it very fast. 310 00:23:11,620 --> 00:23:15,940 It's in the giga hashes range on my GPU. 311 00:23:16,240 --> 00:23:20,120 There's also Bitcrack, which is made to solve a different Bitcoin puzzle. 312 00:23:20,120 --> 00:23:23,600 It's not really a puzzle as much as a brute force experimentation. 313 00:23:24,340 --> 00:23:32,500 Basically, someone said, I put Bitcoin at this address with a private key that starts with this many zeros. 314 00:23:32,520 --> 00:23:38,320 And higher and higher prizes for progressively fewer and fewer known zeros. 315 00:23:38,320 --> 00:23:46,780 So there's a bunch of people who are using GPUs to basically go through all of that space and try to find what the private key is and get the money. 316 00:23:46,780 --> 00:23:48,360 And that's a whole separate thing. 317 00:23:48,360 --> 00:23:48,900 But it's neat. 318 00:23:48,900 --> 00:23:52,240 But it's someone doing something similar and maybe I can use that. 319 00:23:52,940 --> 00:23:56,960 And then there's Hashcat, which, spoiler, is what I ended up using. 320 00:23:56,960 --> 00:24:01,480 But that's a general use CPU password and hash cracking utility. 321 00:24:01,480 --> 00:24:03,840 It's not specifically for cryptocurrency. 322 00:24:03,860 --> 00:24:06,380 It has a couple of cryptocurrency modules, which we'll use. 323 00:24:06,380 --> 00:24:08,200 But it doesn't support brain wallets. 324 00:24:09,260 --> 00:24:12,320 So we'll take a look at Vanity Gen real quick. 325 00:24:13,320 --> 00:24:14,960 It's very, very fast. 326 00:24:14,960 --> 00:24:16,660 You can see I lied a bit. 327 00:24:16,660 --> 00:24:19,400 It's actually several hundred mega hashes a second. 328 00:24:19,400 --> 00:24:24,820 But that's still pretty good just running on a random cloud instance GPU. 329 00:24:24,820 --> 00:24:28,080 I think that was a 3060, no, 3080 I see right there. 330 00:24:28,700 --> 00:24:32,360 This turned out to be a bit of a lie when it comes to what I need to do. 331 00:24:32,420 --> 00:24:35,160 They do a neat little trick called batch inversion. 332 00:24:36,160 --> 00:24:40,020 It's clever, but it unfortunately makes it impossible to do what I need to do. 333 00:24:40,020 --> 00:24:58,560 Without getting too far into the math of it, if you don't actually care about your specific inputs, you can put a bunch of related points all together and do the really expensive math operation once and then figure out the result for all of those points based off that one thing. 334 00:24:58,780 --> 00:25:09,120 And it's really handy, but that's basically saying, private key and all the private keys within N range of it and do the batch inversion and then figure out the results. 335 00:25:09,500 --> 00:25:14,100 I'm trying to do arbitrary private keys, so that's not exactly going to work. 336 00:25:16,700 --> 00:25:19,560 So, what about Bitcrack? 337 00:25:20,100 --> 00:25:25,300 This one looks for a pattern matching a specific private key. 338 00:25:25,920 --> 00:25:28,540 It also shows a very promising hash rate. 339 00:25:28,740 --> 00:25:31,940 It lets you specify a range of key spaces to search. 340 00:25:31,940 --> 00:25:39,480 This is because people want to be able to coordinate, all right, I'm searching this range of private keys and you can search this one so we're not just doing the same space. 341 00:25:40,480 --> 00:25:43,560 Problem is, it's also using batch inversion. 342 00:25:43,560 --> 00:25:51,340 You can see right there in the little highlighted comment where it multiplies together all of the points together before doing the math. 343 00:25:51,340 --> 00:25:59,660 Because, once again, while you can specify the range, you don't actually care about the inputs, only that they're not the same inputs someone else has tried. 344 00:26:00,340 --> 00:26:02,380 And so, Hashcat. 345 00:26:02,380 --> 00:26:05,800 And that is, in fact, a hacker known as Hashcat up there. 346 00:26:06,940 --> 00:26:10,360 Hashcat is an open source password cracking utility. 347 00:26:10,360 --> 00:26:18,340 If you have a hash that you want to find the original or a original input for, you can use it to brute force it. 348 00:26:18,400 --> 00:26:21,320 It's a pretty versatile and neat tool. 349 00:26:21,500 --> 00:26:25,080 It's GPU accelerated and has a lot of optimizations. 350 00:26:25,080 --> 00:26:36,580 People have done hand optimization for some of these algorithms that make them significantly faster, which is very impressive to do, you know, assembly level coding for cryptography in a GPU. 351 00:26:36,760 --> 00:26:41,840 It has its own generator for generating masks and wildcard attacks. 352 00:26:41,840 --> 00:26:44,480 It really has a lot of nice utilities. 353 00:26:44,480 --> 00:26:48,500 You can feed in passwords via the pipe normally, like I did with my generator. 354 00:26:48,500 --> 00:26:52,840 And it handles all the difficult GPU scheduling and tasking stuff for myself. 355 00:26:52,840 --> 00:26:56,200 It also provides a framework for custom plugins. 356 00:26:56,200 --> 00:26:58,840 But it doesn't support brain wallets. 357 00:26:58,840 --> 00:27:04,600 And in order to make custom plugins, you need to be competent in OpenCL, which I wasn't and still aren't. 358 00:27:05,860 --> 00:27:07,740 So I had to admit defeat. 359 00:27:07,940 --> 00:27:10,160 I brute forced all the ones I could. 360 00:27:10,440 --> 00:27:14,320 I have a high confidence in all of the other answers that I think I've solved. 361 00:27:15,200 --> 00:27:20,500 It's infeasible to proceed assuming some of those are wrong because I have no idea which ones are wrong. 362 00:27:20,760 --> 00:27:23,920 And I don't know OpenCL and I'm not going to learn. 363 00:27:23,920 --> 00:27:25,600 I don't even know if it's solvable. 364 00:27:25,600 --> 00:27:30,420 This could just very well be dead money that's just going to sit on the Internet forever. 365 00:27:30,420 --> 00:27:37,940 And the public address where the Bitcoin was was published, so you could see it was still there and it hadn't moved. 366 00:27:37,980 --> 00:27:39,920 But again, the author probably knew the answers. 367 00:27:39,920 --> 00:27:42,700 Why didn't they take it back when it hit $100,000? 368 00:27:43,680 --> 00:27:46,800 So I'm not going to get weird about this or anything. 369 00:27:47,200 --> 00:27:49,300 I'm just going to move on with my life. 370 00:27:49,300 --> 00:27:51,040 Totally healthy relationship. 371 00:27:51,040 --> 00:27:52,720 This isn't my white whale or anything. 372 00:27:54,080 --> 00:27:58,500 But I think I learned that the real Bitcoin was the friends I made along the way. 373 00:27:58,680 --> 00:28:03,680 And it wouldn't be a presentation I give if I didn't shoehorn a Terry Pratchett quote into it. 374 00:28:03,680 --> 00:28:05,300 So it was a good map. 375 00:28:05,300 --> 00:28:06,300 And in studying it, Mr. 376 00:28:06,300 --> 00:28:11,200 Wilkinson and his chums would learn a lot about decryption, geography, and devious cartography. 377 00:28:11,440 --> 00:28:19,640 They wouldn't find in it the whereabouts of Ankh-Morpork $150,000 in mixed currency, though, because the map was a complete and complex fiction. 378 00:28:19,640 --> 00:28:27,500 However, Moist entertained a wonderful warm feeling inside to think that they would, for some time, possess the greatest of all treasures, which is hope. 379 00:28:27,500 --> 00:28:33,640 And anyone who couldn't simply remember where they'd stashed a great big fortune deserved to lose it, in Moist's opinion. 380 00:28:34,900 --> 00:28:38,580 And I think that applies here. 381 00:28:40,360 --> 00:28:46,180 And I got thinking about motivation and incentive and growth. 382 00:28:46,180 --> 00:28:53,120 And I kept looking at this chart and thinking, is today the day I learn OpenCL? 383 00:28:53,980 --> 00:28:55,440 And it was. 384 00:28:57,760 --> 00:29:00,780 So I started digging into Hashcat pretty deeply. 385 00:29:00,780 --> 00:29:05,600 Thankfully, they have some really great documentation for developing custom plug-ins. 386 00:29:06,400 --> 00:29:10,120 You do still need to understand OpenCL and some of the principles there. 387 00:29:10,120 --> 00:29:21,080 You can get away with not needing to understand it intimately, but I definitely had some stumbling blocks around memory management that I might not have had should I have been a little more versed in it. 388 00:29:21,280 --> 00:29:25,100 So, Hashcat does not support brain wallets. 389 00:29:25,120 --> 00:29:31,780 But it supports every single one of the cryptographic operations that I just talked about that we need to make a brain wallet. 390 00:29:31,800 --> 00:29:35,160 And all of those are optimized for running in the GPU. 391 00:29:35,340 --> 00:29:43,340 It's got SecP256K1, which is the specific ECC curve that's used to get the public key from a Bitcoin private key. 392 00:29:43,340 --> 00:29:49,480 It's got SHA256, which is used to take the brain wallet phrase and get the private key. 393 00:29:49,480 --> 00:29:54,900 And RIPEMD160, which is used to actually generate the Bitcoin address. 394 00:29:54,900 --> 00:29:58,520 So what if we just kind of took all these modules and made them kiss? 395 00:30:00,360 --> 00:30:02,460 We'll talk about Hashcat. 396 00:30:02,460 --> 00:30:04,140 It's a good use case for them. 397 00:30:04,600 --> 00:30:05,860 Come on. 398 00:30:06,600 --> 00:30:07,600 There we go. 399 00:30:08,380 --> 00:30:10,180 First, you find the hash you want to crack. 400 00:30:10,180 --> 00:30:12,100 In this case, the Bitcoin wallet. 401 00:30:12,880 --> 00:30:15,780 You figure out which module to use, or in this case, to make. 402 00:30:16,260 --> 00:30:17,480 You pick your attack mode. 403 00:30:17,480 --> 00:30:19,080 I'll talk about that in just a sec. 404 00:30:19,080 --> 00:30:23,240 And your dictionary and generator, which is basically the source of things you want to try. 405 00:30:23,240 --> 00:30:27,760 If you're doing a password, it's probably going to be a word list of common passwords from database breach. 406 00:30:28,080 --> 00:30:33,100 If it's something more complex like this, you can specify random mask rules. 407 00:30:33,100 --> 00:30:38,400 And you feed it GPUs and compulsively check it every five minutes for about half an hour. 408 00:30:38,400 --> 00:30:40,920 And then forget about it for 15 days. 409 00:30:40,920 --> 00:30:44,380 And then remember that you're spending money on cloud GPUs and check it. 410 00:30:45,460 --> 00:30:52,180 And this is just a quick example of a Hashcat run on a rather simple hash algorithm called MD5. 411 00:30:52,180 --> 00:30:54,840 It's less used for security and more file verification. 412 00:30:55,060 --> 00:30:59,020 But I hashed the word password with MD5 and I got that string. 413 00:30:59,020 --> 00:31:06,040 I ran Hashcat in mode 0, which is MD5's mode, with an A3. 414 00:31:06,040 --> 00:31:09,520 That means it's a wild card attack, which means I'm not passing in things to try. 415 00:31:09,520 --> 00:31:12,700 I'm saying, all right, it's going to be eight random letters. 416 00:31:12,700 --> 00:31:13,980 Just try all of them. 417 00:31:13,980 --> 00:31:14,980 And let it run. 418 00:31:14,980 --> 00:31:19,200 Two seconds later, you can see at the top, it tells me you have that hash. 419 00:31:19,200 --> 00:31:21,900 And the original phrase was password. 420 00:31:22,600 --> 00:31:25,560 And MD5 is very simple, very basic. 421 00:31:25,560 --> 00:31:29,800 Something more complex, like SHA-256, a bit more complicated. 422 00:31:29,800 --> 00:31:35,480 For that same eight-character password, we're looking at a 13-day crack time on the same computer. 423 00:31:36,700 --> 00:31:40,660 So, just because it can go fast doesn't mean it always will. 424 00:31:42,700 --> 00:31:44,580 So, Hashcat plugins. 425 00:31:44,580 --> 00:31:45,800 What is a plugin? 426 00:31:46,160 --> 00:31:53,120 A Hashcat plugin is the thing that actually represents how to crack a specific kind of hash. 427 00:31:53,120 --> 00:31:58,520 It is everything you need to do SHA-256 or MD5 or brain wallets. 428 00:31:58,520 --> 00:32:00,000 It consists of two main parts. 429 00:32:00,000 --> 00:32:01,740 It's a module and a kernel. 430 00:32:01,740 --> 00:32:08,660 The module is the overall structure and the information about the hash or algorithm. 431 00:32:08,660 --> 00:32:21,920 It handles the input and output processing of, you know, your input strings or what the mask generator outputs to the outputs of, you know, Hashcat's internal structure to making it look like the hash you're actually trying to crack. 432 00:32:22,680 --> 00:32:26,900 The module element is written in C and it runs in the CPU. 433 00:32:26,940 --> 00:32:39,560 It's compiled at the same time you build Hashcat and it is generally fairly easy to work with and it's a glorified config file with a little bit of scripting in it. 434 00:32:39,560 --> 00:32:41,580 The kernel is where the heavy lifting happens. 435 00:32:41,580 --> 00:32:45,800 It handles the actual cryptographic operations and the code that runs in the GPU. 436 00:32:45,840 --> 00:32:48,760 It's written in a language called OpenCL. 437 00:32:48,760 --> 00:32:55,000 It uses a .cl extension and it's basically C++ but worse. 438 00:32:55,320 --> 00:32:59,340 And all of this represents how to crack a specific algorithm. 439 00:32:59,760 --> 00:33:03,480 A module consists of a couple important bits of information. 440 00:33:03,480 --> 00:33:07,940 They're located in the modules folder if you go to Hashcat source code. 441 00:33:07,960 --> 00:33:18,440 They're pre-compiled and they give you information about the digest size which is, you know, when you're comparing through and seeing if it matches, how big should that structure be? 442 00:33:18,440 --> 00:33:27,020 It gives you information on how to test the benchmark information and the default pattern for when you're running that benchmark. 443 00:33:27,120 --> 00:33:31,820 And later on it also has the information on how to encode and decode your formats. 444 00:33:31,820 --> 00:33:33,900 We'll go into that detail in just a sec. 445 00:33:33,900 --> 00:33:38,620 So, the module hash decode, that's one of the important functions in your module. 446 00:33:38,620 --> 00:33:41,740 That handles every single line in your hash target file. 447 00:33:41,740 --> 00:33:50,220 So you feed in a list of target hashes, it processes through and decodes them from whatever, you know, a password hash that you have from a computer. 448 00:33:50,220 --> 00:33:55,140 It decodes it into Hashcat's internal structure where it can more easily work with it. 449 00:33:56,120 --> 00:34:01,920 It also populates the hash digests that are later compared to against in the comparison function. 450 00:34:02,000 --> 00:34:04,800 The hash encode function kind of does the opposite. 451 00:34:04,800 --> 00:34:10,760 It goes from the internal Hashcat format to the specific hash format that's going to be recognizable. 452 00:34:10,760 --> 00:34:12,800 In this case, a Bitcoin address. 453 00:34:12,800 --> 00:34:20,020 The digest size tells us how much memory we need to allocate for each hash that we're going to crack. 454 00:34:20,020 --> 00:34:30,520 And the self test pass and self test hash are basically the dummy password and hash combination you put in so it knows that it's working right before it runs. 455 00:34:30,800 --> 00:34:33,780 And same for the benchmark mask and character set. 456 00:34:34,220 --> 00:34:37,540 This is an example of the module file that I wrote for this. 457 00:34:37,580 --> 00:34:41,780 You can see I specify a few things about it. 458 00:34:41,780 --> 00:34:47,560 I specify a default password of Hashcat and the Bitcoin address that the Brain Wallet gives if you do Hashcat. 459 00:34:47,700 --> 00:34:49,780 The character sets to try. 460 00:34:49,820 --> 00:34:53,840 You'll notice I removed all the special characters since Brain Wallets are never going to do it. 461 00:34:53,840 --> 00:34:57,060 I could have removed the numbers too, but that was my mistake. 462 00:34:58,340 --> 00:34:59,760 And that just kind of sets it. 463 00:34:59,760 --> 00:35:02,900 The other important part is you see the current underscore type. 464 00:35:02,900 --> 00:35:07,800 That's where you specify the number for the module or tell it what number it is. 465 00:35:07,800 --> 00:35:12,420 So when you do dash M0, in this case it's dash M1337. 466 00:35:13,640 --> 00:35:17,180 And then this brings us to the kernel where the heavy lifting happens. 467 00:35:17,380 --> 00:35:23,260 The kernel is compiled at run time per graphics card because each graphics card is going to need something different. 468 00:35:23,260 --> 00:35:26,820 OpenCL actually compiles it live for you there. 469 00:35:27,400 --> 00:35:32,720 They are located in the slash OpenCL folder and they have a slightly different name format. 470 00:35:32,820 --> 00:35:36,760 Some of them are designated as pure or optimized. 471 00:35:36,760 --> 00:35:43,160 The optimized ones had someone go in and manually tweak around some of the code to take shortcuts where possible. 472 00:35:43,160 --> 00:35:45,840 They're quicker, but sometimes a lot less human readable. 473 00:35:45,840 --> 00:35:50,560 And sometimes they may have caveats where they're not appropriate for all cracking methods. 474 00:35:51,980 --> 00:35:56,460 Sometimes they'll also have a, you see it like underscore A3 or A0. 475 00:35:56,840 --> 00:36:00,180 Depending on if you're using a password list or a generator thing. 476 00:36:00,180 --> 00:36:05,780 Some algorithms will have performance boosts if you do it slightly differently depending on that. 477 00:36:05,780 --> 00:36:09,440 So it also lets you specify different branches to take for that. 478 00:36:09,680 --> 00:36:14,540 Inside the kernel file, there are three key functions, init, loop, and comp. 479 00:36:15,100 --> 00:36:20,940 Init does the initial setup, initialization, and any non-time intensive calculations. 480 00:36:21,320 --> 00:36:24,980 Loop does all of the time intensive calculations until they're done. 481 00:36:24,980 --> 00:36:29,620 And comp does the comparison to see, hey, is this the password we were trying to get? 482 00:36:30,840 --> 00:36:37,500 The initialization function, and it's usually named something like this, it sets up all of the buffers. 483 00:36:37,520 --> 00:36:46,080 It does any one time calculations or initializations, setting up your point curves, and it's run once per candidate that you put in. 484 00:36:46,540 --> 00:36:49,860 And it's generally used to set up stuff for the loop. 485 00:36:49,860 --> 00:37:01,460 In some cases, like ours, we didn't have a time intensive portion that is looped, so all of the actual calculation and hashing is done in the init, and the loop just passes it on to the comparison function. 486 00:37:02,660 --> 00:37:11,180 The loop function, if you're doing something that has a lot of internal steps, like do 500 rounds of MD5, that's going to happen in the loop function. 487 00:37:11,180 --> 00:37:17,260 This lets HashCat better organize it and not think that a process is hanging or non-responsive. 488 00:37:17,260 --> 00:37:25,280 It lets it also better organize it into batches and be able to suspend one and insert another for execution. 489 00:37:26,240 --> 00:37:30,220 We didn't use it in this one because it didn't need it. 490 00:37:30,220 --> 00:37:40,900 The brain, while algorithm, does not have any repeated or iterated steps, but if something you're trying to do does have iterated steps, the code for that would live in the loop function. 491 00:37:41,100 --> 00:37:43,540 And lastly, we've got the comparison function. 492 00:37:43,820 --> 00:38:01,540 This takes the result of your init or your loop, which shoves the... and you can specify which possession, but usually the last or first four bytes of your result into a comparison register, and then it compares it with the last four or first four of your target hash. 493 00:38:01,540 --> 00:38:06,240 And then if it's right, it does a full comparison to prevent it, but that just saves a little bit of time. 494 00:38:06,540 --> 00:38:08,680 And this is the function that actually does it. 495 00:38:08,680 --> 00:38:17,140 If you have a large list of hashes, it does a little bit of optimization there, but in this case, it was only just one, so there was nothing special there. 496 00:38:18,280 --> 00:38:20,380 It's time to gather all the ingredients we need. 497 00:38:20,500 --> 00:38:25,340 I took the SHA-256 from the included module there. 498 00:38:27,160 --> 00:38:34,200 I borrowed a lot of the initialization and the update and final functions, which are what you need to run the algorithm. 499 00:38:34,200 --> 00:38:36,640 I did the same for RIP-EMD-160. 500 00:38:37,000 --> 00:38:43,140 And I also yoinked the SEC-P256 from their code, where they do that. 501 00:38:43,140 --> 00:38:51,660 They mostly use it in a module for Bitcoin wallet import format private key, in module 28502. 502 00:38:51,660 --> 00:38:59,320 It's not exactly what I need, but part of that step does involve doing the curve cryptography to go from a private key to a public key. 503 00:38:59,320 --> 00:39:01,000 So I'm just going to borrow that. 504 00:39:01,900 --> 00:39:06,160 I did a little bit of massaging to make the module. 505 00:39:06,160 --> 00:39:11,260 I took the module for SHA-256 because that's the first step in that. 506 00:39:11,260 --> 00:39:13,360 I might as well use that as the entrance. 507 00:39:13,680 --> 00:39:22,920 So I heavily modified module 1400, which is the hashcap module for SHA-256 with no salts. 508 00:39:22,920 --> 00:39:35,540 And the only major thing I really had to change here was the digest size because SHA-256 is expecting a smaller output than the public key is. 509 00:39:35,540 --> 00:39:42,940 So one big problem I had was I was trying to shove too much data into too small of a bit of memory and I kept getting seg faults. 510 00:39:42,940 --> 00:39:45,780 And debugging OpenCL is fun. 511 00:39:46,080 --> 00:39:49,700 So I basically smushed all of those together. 512 00:39:49,700 --> 00:39:51,400 I took the input parameters. 513 00:39:51,400 --> 00:39:54,400 I took the decode function from the target. 514 00:39:54,640 --> 00:39:56,560 That's going to be 28.5. 515 00:39:56,560 --> 00:40:03,020 And I took the encode function from 28.502 as well. 516 00:40:03,660 --> 00:40:05,620 I was doing testing and debugging. 517 00:40:05,620 --> 00:40:10,080 Brought me back to CS101 because I made best friends with the printf statement again. 518 00:40:11,880 --> 00:40:27,540 Yeah, it's really difficult to do traditional debugging in graphics cards because you have a whole lot of threads all running simultaneously in lockstep and you can't interrupt or introspect a single one without affecting another one. 519 00:40:27,780 --> 00:40:29,540 So there are a couple workarounds. 520 00:40:29,540 --> 00:40:37,760 One, Hashcat does have a specific set of flags you can put in to force it very unhappily to only attempt to use a single thread. 521 00:40:37,760 --> 00:40:45,700 I still kept getting some multi-threaded output with it but it really reduced it from an unreadable console to only a handful of repeated outputs. 522 00:40:45,700 --> 00:40:53,440 And you're basically using good old printf and you're printing out debug statements and trying to trace stuff out that way. 523 00:40:53,460 --> 00:40:57,600 If you're trying to do this at home and stuff's not working, check your digest size. 524 00:40:57,600 --> 00:41:02,680 There's a great write-up on that in the documentation on how to choose that. 525 00:41:02,900 --> 00:41:09,900 And if things are working and not segfaulting but your results aren't wrong, make sure your endianness is right. 526 00:41:10,160 --> 00:41:15,780 Some modules like doing things in big endian, some like doing them in little endian. 527 00:41:15,900 --> 00:41:21,020 There's definitely some parts of my code that are just shifting bits around to the other side. 528 00:41:21,020 --> 00:41:23,300 And that actually made it work. 529 00:41:23,660 --> 00:41:25,380 So, this works. 530 00:41:25,380 --> 00:41:29,120 And I got it working on GPUs. 531 00:41:29,320 --> 00:41:31,700 But it was a bit slow. 532 00:41:31,700 --> 00:41:37,140 I was getting about 7600 kilohashes a second. 533 00:41:37,140 --> 00:41:45,180 Which is, as you'll recall, less than an order of magnitude bigger than what I was getting on my CPU. 534 00:41:45,180 --> 00:41:50,500 I was getting maybe 1400 kilohashes a second on my CPU. 535 00:41:50,500 --> 00:41:54,720 So this is faster, but certainly not radically faster. 536 00:41:58,720 --> 00:42:07,940 Why is that when the individual one used got 142 gigahashes a second for 28.502? 537 00:42:07,940 --> 00:42:11,360 And the answer is, not batch inversion. 538 00:42:11,820 --> 00:42:19,800 It actually uses a much easier trick, which is, it assumes Hashcat is passing in completely random strings. 539 00:42:19,800 --> 00:42:24,440 Not all of those are going to be valid as wallet import format strings. 540 00:42:24,440 --> 00:42:30,520 So it's doing a lot of basic filtering looking for the first byte being valid or not and then dropping them. 541 00:42:30,520 --> 00:42:35,760 So the vast, vast majority of the candidates that you see in this benchmark were just dropped and ignored. 542 00:42:37,680 --> 00:42:43,900 So I eventually removed that code and ran it again and I got similar hash rates, so I moved on. 543 00:42:44,280 --> 00:42:47,320 This led me to create my generator generator. 544 00:42:47,460 --> 00:42:52,140 I mentioned that combinatorics and how Hashcat can accept masks. 545 00:42:52,140 --> 00:42:53,980 It can accept a list of masks. 546 00:42:53,980 --> 00:43:04,520 So I made a quick little Python script to generate a different mask list for all 105 possibilities of different combinations of unknown unknowns. 547 00:43:04,520 --> 00:43:10,240 And I fed it into Hashcat and I have everything I need. 548 00:43:10,460 --> 00:43:12,240 Except compute power. 549 00:43:12,240 --> 00:43:13,980 So I went to the cloud. 550 00:43:14,000 --> 00:43:15,660 There's a website called Vast AI. 551 00:43:15,660 --> 00:43:19,420 You can rent GPUs on the cloud by the minute. 552 00:43:19,420 --> 00:43:20,820 It's relatively cheap. 553 00:43:20,820 --> 00:43:25,120 I can rent a 3080 for 16 cents an hour. 554 00:43:25,680 --> 00:43:38,280 So I just spun up a whole bunch of cards in the cloud and overall in this I maybe spent 50 bucks in cloud compute and it's way cheaper than a cracking rig and it also didn't heat up my house. 555 00:43:38,620 --> 00:43:42,140 So a couple hours later, success. 556 00:43:42,500 --> 00:43:44,180 It's actually funny. 557 00:43:44,400 --> 00:43:52,320 It only took three minutes to crack from when I started it in the cloud and then I checked much later and absolutely freaked out. 558 00:43:52,320 --> 00:43:58,120 But it cracked the brain wall and I had the private key. 559 00:43:58,120 --> 00:44:12,800 So very, very carefully I disconnected from the internet and I put it into my Bitcoin wallet and I swept the wallet and on December 13th, 2024, I claimed the one Bitcoin prize. 560 00:44:13,980 --> 00:44:15,060 Thank you. 561 00:44:17,580 --> 00:44:19,020 Thank you, thank you. 562 00:44:19,520 --> 00:44:21,740 Now some of you might be wondering, what about the money? 563 00:44:21,740 --> 00:44:22,960 It's mostly been spent. 564 00:44:22,960 --> 00:44:23,940 Not saying on what. 565 00:44:23,940 --> 00:44:24,840 Life's expensive. 566 00:44:24,840 --> 00:44:26,180 I paid my taxes. 567 00:44:26,920 --> 00:44:28,700 The joker doesn't mess with the IRS. 568 00:44:28,700 --> 00:44:36,540 I will say, getting an accountant to call me back and not think I wasn't some sort of delusional or actively in a pig butchering scam was very, very difficult. 569 00:44:36,980 --> 00:44:40,360 I finally got one to call me back and tell me how to put this on my taxes. 570 00:44:40,960 --> 00:44:43,020 The rest isn't on my purse in my home. 571 00:44:43,020 --> 00:44:44,940 Don't try to hack me. 572 00:44:45,680 --> 00:44:47,260 It's not in a brain wallet either. 573 00:44:47,260 --> 00:44:51,380 I only did one outrageous thing and I took a zero gravity flight with it. 574 00:44:52,940 --> 00:44:57,520 It was an absolutely amazing experience. 575 00:44:58,260 --> 00:44:59,800 I have no regrets. 576 00:44:59,800 --> 00:45:04,720 That was the one thing I splurged on that I couldn't otherwise justify. 577 00:45:04,720 --> 00:45:12,680 But that was just because I'd been dreaming of doing that forever and that was what I was going to spend this prize money on in the first place years and years ago. 578 00:45:13,440 --> 00:45:15,020 I will say one thing. 579 00:45:15,060 --> 00:45:17,380 The reason it took me so long is clue 20. 580 00:45:17,380 --> 00:45:18,840 It had an ambiguous answer. 581 00:45:19,880 --> 00:45:22,380 This was the unknown unknown that blocked me. 582 00:45:22,520 --> 00:45:26,060 What is this last clue and what letter is missing to spell it all out? 583 00:45:26,060 --> 00:45:28,520 It's clue 20 and there's no why. 584 00:45:28,520 --> 00:45:29,520 Right? 585 00:45:29,900 --> 00:45:33,000 But it's also a haiku and there's no K. 586 00:45:33,000 --> 00:45:35,960 K was the correct answer and I'd assumed Y. 587 00:45:36,040 --> 00:45:45,320 And this had plagued me for about 10 years and ironically had caused a significant increase in the prize money because it took me so long to get to this point. 588 00:45:45,320 --> 00:45:47,740 So I can't be too, too mad. 589 00:45:47,740 --> 00:45:49,560 But come on. 590 00:45:50,560 --> 00:45:52,520 There are two unsolved clues. 591 00:45:52,760 --> 00:45:54,200 I have the answers. 592 00:45:54,200 --> 00:45:55,660 I don't know the solution. 593 00:45:55,660 --> 00:45:59,500 I'm offering a small trophy to anyone who can tell me the answer. 594 00:45:59,600 --> 00:46:02,240 I have shopping cart wheels that are locked. 595 00:46:02,240 --> 00:46:03,320 You can remote control. 596 00:46:03,320 --> 00:46:07,680 I will send a custom one to anyone who can tell me the answer. 597 00:46:08,800 --> 00:46:09,620 Please. 598 00:46:09,620 --> 00:46:12,700 This is bothering my soul so much. 599 00:46:13,360 --> 00:46:15,200 I've got my email here. 600 00:46:15,320 --> 00:46:20,600 Puzzleanswers at bgaydocrime.com Just, please help me. 601 00:46:20,600 --> 00:46:23,860 I'll post on my website if I get the answers. 602 00:46:23,860 --> 00:46:31,060 If you want to try this at home I have the custom module on my GitHub repo as well as some very basic instructions. 603 00:46:31,120 --> 00:46:31,760 Cavidempter. 604 00:46:31,760 --> 00:46:33,100 You get what you pay for. 605 00:46:33,320 --> 00:46:37,360 There is a version that does compressed Bitcoin wallet formats. 606 00:46:37,360 --> 00:46:39,000 That's 1338. 607 00:46:39,260 --> 00:46:43,160 It's basically the same thing, just slightly tweaks how the address comes out. 608 00:46:44,280 --> 00:46:47,380 I'd like to give a huge thanks to a bunch of people. 609 00:46:47,380 --> 00:46:50,920 The team at Hashcat for making the software. 610 00:46:50,920 --> 00:46:56,600 Ryan for doing the awesome things they're doing and Brainflare and kind of keeping me on this path. 611 00:46:56,600 --> 00:46:59,720 Spencer Lucas for this whole, whole challenge. 612 00:46:59,720 --> 00:47:02,140 My parents, my mom, and dad. 613 00:47:02,140 --> 00:47:05,440 My friends and everyone who supported me along the way for this. 614 00:47:05,440 --> 00:47:06,680 My partner Daisy. 615 00:47:06,680 --> 00:47:12,540 My accountant Jill who actually returned my call for this absolutely insane voicemail. 616 00:47:13,480 --> 00:47:18,100 Chuck Kopenspire for helping me get this PowerPoint looking nice. 617 00:47:18,100 --> 00:47:22,640 He's a creative and technical consultant for queer and neurodivergent professionals. 618 00:47:22,820 --> 00:47:23,780 He's great. 619 00:47:23,780 --> 00:47:26,840 If any of you need PowerPoint design, check out his website. 620 00:47:26,840 --> 00:47:36,460 My friend Ashley, of course, for keeping this fixation alive and being the one person I can talk to about this puzzle to an unlimited degree without getting tired. 621 00:47:36,460 --> 00:47:40,200 And the folks at Zero Gravity for giving me a really, really great time. 622 00:47:41,180 --> 00:47:44,780 This is a donation link to Ryan's GoFundMe . 623 00:47:44,820 --> 00:47:50,900 They are actively in a legal battle against the government of the UK for recognition of non-binary rights. 624 00:47:51,300 --> 00:47:54,440 I'm also a non -binary hacker, so this is important to me. 625 00:47:55,400 --> 00:48:01,360 I plan on, after this talk, donating a bit of the prize to their GoFundMe. 626 00:48:01,360 --> 00:48:05,120 And if anyone out there thinks this is a worthy cause, I would encourage it. 627 00:48:05,120 --> 00:48:06,920 It's a totally safe QR code. 628 00:48:06,920 --> 00:48:09,820 If not, you can just search for the GoFundMe on Google. 629 00:48:10,280 --> 00:48:11,760 I wouldn't trust me. 630 00:48:12,960 --> 00:48:13,920 That's all, folks. 631 00:48:13,920 --> 00:48:15,360 Thank you so much for coming. 632 00:48:15,520 --> 00:48:17,260 I'll be answering questions. 633 00:48:17,260 --> 00:48:20,200 I know the answers to and making up answers to the ones I don't. 634 00:48:20,380 --> 00:48:21,380 Thank you all.