1 00:00:00,000 --> 00:00:08,240 All right, so today I'll be talking about FPGAs, and first of all, how many people have seen one of my previous talks? 2 00:00:09,780 --> 00:00:13,380 Wow. That's amazing. Okay. 3 00:00:14,580 --> 00:00:17,900 Yeah, so I'm just going to go over some of the newer stuff that I've been working on, 4 00:00:19,720 --> 00:00:23,540 and some of the FileVault stuff that I've been working on, I actually worked on with Jake, 5 00:00:23,600 --> 00:00:29,080 and he has some new developments with that, so I thought I'd bring him up here so he can talk about that a little later. 6 00:00:30,000 --> 00:00:35,420 But anyway, I am the chairman for TORCON. TORCON, by the way, is happening in October. 7 00:00:35,500 --> 00:00:37,500 We have some flyers up here if you guys want to pick them up. 8 00:00:38,720 --> 00:00:44,380 And I also do security R&D for Pico Computing. That's the card that I run all my demos on here. 9 00:00:45,260 --> 00:00:50,880 And I'm also a researcher with the OpenCiphers project, which means that I'm the single person that contributes source to it. 10 00:00:54,160 --> 00:00:59,540 So, a quick overview here. We'll be doing, well, we can skip through the FPGA intro because, 11 00:01:00,000 --> 00:01:03,420 of so many people that have already seen my talk, and then we can just go on to some demos, 12 00:01:03,840 --> 00:01:06,940 and then talk about FileVault and some of the new stuff that's coming out. 13 00:01:09,400 --> 00:01:11,840 So, skipping over. Whoa. 14 00:01:13,860 --> 00:01:18,060 All right. Bluetooth pin cracking. Has anybody seen this demo before? 15 00:01:18,360 --> 00:01:22,320 Raise of hands. No? Oh, okay. Oh, yeah, yeah, yeah. 16 00:01:23,980 --> 00:01:29,300 So, have people seen the cow patty demo? Breaking cow patty? Yeah, okay. Sweet. 17 00:01:30,000 --> 00:01:36,060 So, it's pretty similar. You basically sniff out the authentication, and you can do that now with FTE dongles. 18 00:01:36,220 --> 00:01:41,820 You can use the open source sniffer that they just released at the Wi-Fi talk, I think, if you guys saw that. 19 00:01:43,040 --> 00:01:47,460 And so, yeah, if you can force the two devices to repair and capture the authentication, 20 00:01:47,820 --> 00:01:50,780 then the only thing that you really don't know is the pin. 21 00:01:50,960 --> 00:01:58,780 And so, the whole attack basically works by emulating, like, all the algorithms that they use. 22 00:01:59,000 --> 00:01:59,980 So, they use safety. 23 00:02:00,000 --> 00:02:04,900 And this whole attack was actually originally outlined by these guys. 24 00:02:05,540 --> 00:02:08,800 I'm not even going to try and pronounce their name, but they're down at the bottom there. 25 00:02:09,040 --> 00:02:11,800 And also, Terry Zoller, is he in the audience here? 26 00:02:12,400 --> 00:02:12,800 Yeah? 27 00:02:14,080 --> 00:02:15,260 He said he was going to be here. 28 00:02:15,440 --> 00:02:17,400 Anyway, he also did his own implementation. 29 00:02:17,920 --> 00:02:20,120 And so, there's a couple different implementations of this out there. 30 00:02:22,060 --> 00:02:24,720 So, basically, how it works is you have this whole authentication. 31 00:02:25,700 --> 00:02:27,320 A bunch of challenges are sent across. 32 00:02:27,520 --> 00:02:29,200 And there's essentially a key negotiation. 33 00:02:30,000 --> 00:02:33,100 And it's based on both sides having a mutual pin that matches. 34 00:02:35,860 --> 00:02:40,540 So, if you know the algorithm that they use, you just try a pin and, you know, run it through the capture 35 00:02:40,540 --> 00:02:42,880 and see if all the checksums match up and stuff. 36 00:02:43,260 --> 00:02:44,880 And it's actually a really small key space. 37 00:02:45,100 --> 00:02:50,560 If you think about the total key space, if people are just typing in pins, it's 10 to the 16. 38 00:02:50,820 --> 00:02:57,060 But most of the time, people just use a four-digit pin or an eight-digit pin or just, like, do all zeros or whatever. 39 00:02:57,280 --> 00:02:57,560 I mean. 40 00:02:58,660 --> 00:02:59,620 So, I did. 41 00:02:59,620 --> 00:03:01,380 I did an implementation that's all command-line based. 42 00:03:01,800 --> 00:03:05,840 And it implements, like, all this stuff. 43 00:03:06,060 --> 00:03:09,300 It runs in software and also on one of our cards. 44 00:03:09,760 --> 00:03:14,240 And it uses a 16-stage pipeline, if you guys know much about FPGA stuff. 45 00:03:16,740 --> 00:03:18,660 And this is essentially what it does. 46 00:03:18,760 --> 00:03:19,460 This is the algorithm. 47 00:03:20,080 --> 00:03:23,640 It runs E22 and does all this sort of crap. 48 00:03:24,680 --> 00:03:27,240 All these red things are basically the input. 49 00:03:27,780 --> 00:03:29,460 The stuff that you capture. 50 00:03:29,620 --> 00:03:30,040 They're off the network. 51 00:03:30,440 --> 00:03:32,780 And all we're brute forcing is the blue part there. 52 00:03:33,080 --> 00:03:35,860 And so, you just kind of run through with the data you capture. 53 00:03:36,040 --> 00:03:38,340 And then, eventually, you find a pin that makes everything happy. 54 00:03:41,360 --> 00:03:46,140 So, in my FPGA code, I have a pin generator that feeds into my SaferCore. 55 00:03:46,720 --> 00:03:48,460 And it feeds in 16 pins. 56 00:03:48,920 --> 00:03:52,920 And then, as it crunches through the pipeline on it, it ends up. 57 00:03:53,120 --> 00:03:56,040 Once the data starts coming out the other end, it gets looped back in. 58 00:03:57,200 --> 00:03:58,540 And then, basically. 59 00:03:59,900 --> 00:04:02,880 The implementation is kind of muxed for each time it gets looped back in. 60 00:04:03,240 --> 00:04:06,860 So, the first time, it's running E22, which is a variation of SaferPlus. 61 00:04:07,460 --> 00:04:09,300 And then, the second time, it gets looped back in. 62 00:04:09,380 --> 00:04:10,780 And it's kind of in E21 mode. 63 00:04:11,680 --> 00:04:13,140 And then, it gets looped back again. 64 00:04:13,400 --> 00:04:18,520 And it essentially just does all these operations here, but with a single SaferCore. 65 00:04:19,420 --> 00:04:21,860 So, it gets looped around and does all these calculations. 66 00:04:22,680 --> 00:04:29,000 And at the very end, you end up getting these results that you compare with, like, the checksums that are sent across in authentication. 67 00:04:30,140 --> 00:04:35,960 And, if it matches, then it reports back the pin, and if it doesn't, then it goes on to the next pin, and, you know, continues on. 68 00:04:36,920 --> 00:04:38,340 So, a pretty standard cracker. 69 00:04:39,960 --> 00:04:45,340 I'm just going to get on to the demo here, since I, uh, yeah, here's some performance numbers, but I can go over that later. 70 00:04:49,720 --> 00:04:51,540 I'll show you the boring demo first, here. 71 00:04:57,460 --> 00:04:58,800 This is running on my laptop. 72 00:04:59,040 --> 00:04:59,600 It's doing... 73 00:04:59,620 --> 00:05:02,220 maybe 10 or 20,000 pins per second, roughly. 74 00:05:04,000 --> 00:05:06,660 And, uh, this is running on the FPGA. 75 00:05:07,500 --> 00:05:10,600 So, it just cracked a six-digit pin on that first thing there. 76 00:05:10,680 --> 00:05:11,800 Right now, it's cracking a lot... 77 00:05:11,800 --> 00:05:13,460 That was a nine-digit pin, I think. 78 00:05:14,120 --> 00:05:21,760 And so, all these pins, it would take a few days to go through on my computer, but it just ran through all these in about six seconds or so. 79 00:05:25,220 --> 00:05:28,520 Now, uh, we have a much better interface here that... 80 00:05:28,520 --> 00:05:29,220 Thanks to... 81 00:05:29,220 --> 00:05:30,820 uh, Terry Zoller, we now have. 82 00:05:32,240 --> 00:05:34,480 So, I'm going to fire up this VB app, here. 83 00:05:38,180 --> 00:05:41,180 And, uh, with this, you can actually run it with the FTE software. 84 00:05:41,620 --> 00:05:46,580 So, if you capture the authentication, you just, uh, take the dump, and you can select it inside here. 85 00:05:46,700 --> 00:05:47,940 It's very easy to use. 86 00:05:49,380 --> 00:05:50,860 So, I'm going to capture this... 87 00:05:50,860 --> 00:05:51,480 this one. 88 00:05:51,680 --> 00:05:53,640 So, there's, there's all the values that we're using to crack it. 89 00:05:54,600 --> 00:05:56,680 And, I'm just going to crack it on my computer, right now. 90 00:05:56,820 --> 00:05:58,000 We've got some Hollywood effects going. 91 00:06:00,200 --> 00:06:04,760 So, right now, it's only doing about 200,000 per second, there, in the pins per second. 92 00:06:06,600 --> 00:06:08,140 So, I'm just going to stop it. 93 00:06:08,480 --> 00:06:10,280 Click this Use FPGA button, here. 94 00:06:10,600 --> 00:06:12,300 And, now, let's see how fast it runs. 95 00:06:14,420 --> 00:06:17,480 It only looks fast because I'm updating it a lot faster, but... 96 00:06:17,480 --> 00:06:18,100 Oh! 97 00:06:19,320 --> 00:06:23,180 So, there's, uh, like a eight digit pin, right there. 98 00:06:23,320 --> 00:06:24,980 And, there's a link key, so... 99 00:06:24,980 --> 00:06:29,200 So, now, if you had, uh, had some stuff, um, captured for the conversation, you could, uh, use this. 100 00:06:29,220 --> 00:06:33,720 You can feed this link key into your software, and then 101 00:06:33,720 --> 00:06:34,720 decrypt the whole conversation. 102 00:06:34,960 --> 00:06:36,760 Or you can just start injecting stuff into the 103 00:06:36,760 --> 00:06:37,160 conversation. 104 00:06:37,380 --> 00:06:38,900 You basically have the whole conversation 105 00:06:38,900 --> 00:06:39,920 owned at that point. 106 00:06:43,140 --> 00:06:45,140 So there's the sweet demo. 107 00:06:49,280 --> 00:06:53,800 So as far as performance numbers, there's really a 108 00:06:53,800 --> 00:06:55,680 couple orders of magnitude difference here. 109 00:06:57,340 --> 00:06:59,440 Using btcrack, there's some optimizations there. 110 00:06:59,540 --> 00:07:02,380 So you can get like 100,000, maybe 200,000 per second. 111 00:07:03,080 --> 00:07:05,880 And on this card on my laptop, I'm getting about 10 million 112 00:07:05,880 --> 00:07:06,400 per second. 113 00:07:06,920 --> 00:07:08,580 So it's quite a bit faster. 114 00:07:11,800 --> 00:07:14,860 Now the next topic is cracking WinZip AES encryption. 115 00:07:15,580 --> 00:07:18,740 So I wanted to attack WinZip for a while now. 116 00:07:18,980 --> 00:07:21,700 And I was looking at trying to reverse engineer WinZip. 117 00:07:21,820 --> 00:07:24,820 And I'm sure that lots of people have attacked WinZip 118 00:07:24,820 --> 00:07:25,600 because they're trying to write 119 00:07:25,600 --> 00:07:28,300 their cracks for it and try and make it so it doesn't do 120 00:07:28,300 --> 00:07:31,820 that stupid thing where it counts up a second for every 121 00:07:31,820 --> 00:07:33,040 day that you haven't registered and crap. 122 00:07:33,660 --> 00:07:35,120 So I started doing that. 123 00:07:35,280 --> 00:07:37,360 And then I checked out some of their web pages. 124 00:07:37,540 --> 00:07:40,300 And it turns out that they have a web page that describes 125 00:07:40,300 --> 00:07:42,420 their encryption algorithm for compatibility reasons. 126 00:07:43,960 --> 00:07:46,620 And basically, they linked to this site, and they pretty 127 00:07:46,620 --> 00:07:49,080 much ripped off this guy's entire code base for 128 00:07:49,080 --> 00:07:50,340 implementing all their encryption. 129 00:07:50,760 --> 00:07:53,580 So I just had to kind of figure out the zip format and 130 00:07:53,580 --> 00:07:54,720 use this guy's code. 131 00:07:54,720 --> 00:07:57,340 And it pretty much works. 132 00:07:57,460 --> 00:08:00,100 And actually, it's the same code that OSX ripped off too, 133 00:08:00,180 --> 00:08:00,280 right? 134 00:08:00,480 --> 00:08:01,060 Some of it, yeah. 135 00:08:01,200 --> 00:08:01,380 Yeah. 136 00:08:01,440 --> 00:08:04,360 So lots of people are using Dr. Gladman's file encryption 137 00:08:04,360 --> 00:08:04,780 code. 138 00:08:07,060 --> 00:08:11,200 But their encryption supports 128-bit, 192-bit, 256-bit. 139 00:08:11,400 --> 00:08:13,920 And it has this cool verification value, which I 140 00:08:13,920 --> 00:08:14,720 can get to in a minute. 141 00:08:17,000 --> 00:08:19,240 So essentially what you do is you try a password. 142 00:08:19,440 --> 00:08:22,660 You run it through this hashing algorithm called PBKDF2, 143 00:08:22,760 --> 00:08:24,700 which is the same one that you use for WPA2. 144 00:08:24,700 --> 00:08:30,480 And it actually ends up taking the end of it and uses 145 00:08:30,480 --> 00:08:31,900 that as a verification value. 146 00:08:32,180 --> 00:08:34,700 And so you can compare that with the value that's stored in 147 00:08:34,700 --> 00:08:37,640 the zip file and initially see if the password you're trying 148 00:08:37,640 --> 00:08:38,360 is valid or not. 149 00:08:39,300 --> 00:08:44,980 And then one out of two to the 16 times, you'll have to 150 00:08:44,980 --> 00:08:48,020 actually go and decrypt the whole file, check the checksum, 151 00:08:48,040 --> 00:08:49,440 and make sure that you got the right password. 152 00:08:49,700 --> 00:08:51,420 But this actually works really well. 153 00:08:51,540 --> 00:08:53,000 And I'll show you it working in a minute. 154 00:08:55,120 --> 00:08:58,260 So yeah, pretty much all the same code as the WPA. 155 00:08:58,400 --> 00:08:59,980 I just had to reverse engineer some of the formats. 156 00:09:02,120 --> 00:09:03,400 And I'll do a quick demo. 157 00:09:09,060 --> 00:09:12,380 And by the way, all this code is actually available on the 158 00:09:12,380 --> 00:09:14,740 OpenCiphers website right now if you want to grab it, if you 159 00:09:14,740 --> 00:09:16,620 need to crack any WinZip files. 160 00:09:18,840 --> 00:09:21,040 So this program just takes a zip file. 161 00:09:21,320 --> 00:09:24,200 And it takes a file inside the zip file, because you can 162 00:09:24,200 --> 00:09:27,160 actually have multiple encrypted zip files inside the 163 00:09:27,160 --> 00:09:27,480 zip file. 164 00:09:28,340 --> 00:09:29,600 I'll just look at one of these here. 165 00:09:31,340 --> 00:09:32,840 Here's a test file. 166 00:09:33,960 --> 00:09:35,600 So this is one file inside of it. 167 00:09:35,700 --> 00:09:38,020 And this one's actually encrypted with WinZip 168 00:09:38,020 --> 00:09:38,260 encryption. 169 00:09:38,500 --> 00:09:40,020 So Windows doesn't know how to deal with it. 170 00:09:42,560 --> 00:09:46,180 And I haven't registered WinZip yet, so I'll try and 171 00:09:46,180 --> 00:09:47,360 show you how to extract this here. 172 00:09:48,900 --> 00:09:50,880 Oh, wait, I've got to use something else. 173 00:09:52,380 --> 00:09:52,940 So yeah. 174 00:09:52,980 --> 00:09:53,800 Like if I try maybe 175 00:09:54,860 --> 00:09:58,640 7zip, let's see if that works, then it's asking for a 176 00:09:58,640 --> 00:09:59,160 password, right? 177 00:10:01,440 --> 00:10:05,640 So all you have to do is, I've got this script here. 178 00:10:07,500 --> 00:10:09,860 Like if you're just running this on your PC, you do 179 00:10:09,860 --> 00:10:13,500 WinZip crack, your zip file, the file inside of it that's 180 00:10:13,500 --> 00:10:15,660 encrypted, and then you give it a dictionary file. 181 00:10:16,300 --> 00:10:18,720 And inside your dictionary file, it's just a bunch of 182 00:10:18,720 --> 00:10:20,540 different passwords you want to try, right? 183 00:10:22,800 --> 00:10:24,180 So this is running on my computer. 184 00:10:24,200 --> 00:10:27,920 And it's going a little slow. 185 00:10:28,100 --> 00:10:29,460 So let me try it on the FPGA. 186 00:10:31,600 --> 00:10:33,920 So that's running on the FPGA, and it's a little faster. 187 00:10:34,120 --> 00:10:38,600 It's not crazy fast, but it'll get you where you want 188 00:10:38,600 --> 00:10:38,900 to go. 189 00:10:43,840 --> 00:10:45,240 So yeah, now on to FileVault. 190 00:10:45,380 --> 00:10:46,660 Did you want to explain this? 191 00:10:46,880 --> 00:10:47,420 Go for it. 192 00:10:47,520 --> 00:10:47,860 OK. 193 00:10:49,400 --> 00:10:52,800 So back when I was at the CCC, at the Congress list 194 00:10:52,800 --> 00:10:53,300 last year. 195 00:10:54,420 --> 00:10:57,300 Jake was giving a talk on FileVault, and so I kind of 196 00:10:57,300 --> 00:10:58,720 listened in on some of the stuff they were doing. 197 00:10:59,140 --> 00:11:01,880 And it turned out that FileVault also uses PBKDF2 198 00:11:01,880 --> 00:11:03,660 for their password hashing. 199 00:11:04,020 --> 00:11:06,600 So I coded up this program to crack FileVault images. 200 00:11:10,220 --> 00:11:13,200 And essentially, FileVault, your home directory is stored 201 00:11:13,200 --> 00:11:15,020 as a DMG file that's encrypted. 202 00:11:17,600 --> 00:11:23,400 And it basically uses AES, and then it uses triple DES for 203 00:11:23,400 --> 00:11:24,560 wrapping the keys and stuff. 204 00:11:24,880 --> 00:11:28,740 And there's a couple different formats for it, but it's 205 00:11:28,740 --> 00:11:30,040 basically the same hashing for both. 206 00:11:32,100 --> 00:11:35,120 And so yeah, I just modified my code and made it support 207 00:11:35,120 --> 00:11:35,820 FileVault. 208 00:11:37,560 --> 00:11:41,760 And yeah, it's actually exactly the same FPGA file 209 00:11:41,760 --> 00:11:42,940 that I'm using for the WinZip stuff. 210 00:11:44,060 --> 00:11:46,820 So didn't really have to do any modification with that. 211 00:11:48,220 --> 00:11:52,320 I had this, oh, Jake wrote this program for decrypting files. 212 00:11:52,320 --> 00:11:56,100 So if you have a DMG file that's encrypted, and you have 213 00:11:56,100 --> 00:11:58,340 the password for it, you can just run a command line tool 214 00:11:58,340 --> 00:12:01,880 and takes it in with the password, spits out a totally 215 00:12:01,880 --> 00:12:02,800 clean DMG file. 216 00:12:03,140 --> 00:12:05,300 And I think that some of the people hacking the iPhone 217 00:12:05,300 --> 00:12:08,480 actually use that for decrypting some of 218 00:12:08,480 --> 00:12:08,980 the iPhone stuff. 219 00:12:09,680 --> 00:12:12,580 And then I just kind of modified their code to do the 220 00:12:12,580 --> 00:12:15,180 cracking, so you can just try a bunch of passwords and see if 221 00:12:15,180 --> 00:12:15,680 they work or not. 222 00:12:18,080 --> 00:12:20,760 And there's a couple other attacks that Jake can elaborate 223 00:12:20,760 --> 00:12:21,660 on in a little bit. 224 00:12:21,780 --> 00:12:22,300 But I'll just go ahead and do that. 225 00:12:22,300 --> 00:12:24,000 And I'll just show you the cracking real quick here. 226 00:12:32,520 --> 00:12:36,180 We called this FileVault because we didn't want to have 227 00:12:36,180 --> 00:12:38,280 any sort of copyright issues with Apple, by the way. 228 00:12:40,900 --> 00:12:43,100 So yeah, this is running on my computer here. 229 00:12:43,940 --> 00:12:46,480 And it's pretty much like the same sort of speed improvement 230 00:12:46,480 --> 00:12:48,480 that you see with the WinZip stuff. 231 00:12:52,300 --> 00:12:53,340 Yeah, there's the password. 232 00:12:55,800 --> 00:12:59,140 OK, well, I'll let Jake talk about the FileVault stuff now. 233 00:12:59,420 --> 00:13:02,400 And then I'll come back on a little bit. 234 00:13:02,780 --> 00:13:07,260 So we did a sort of informal survey of about 100 to 150 235 00:13:07,860 --> 00:13:10,340 Macs running on PowerPC and x86. 236 00:13:10,700 --> 00:13:12,800 And actually, I see there are a bunch of Macs here. 237 00:13:13,980 --> 00:13:15,360 I'm very scared for you. 238 00:13:15,440 --> 00:13:16,760 But maybe you could help out. 239 00:13:17,960 --> 00:13:20,800 Who here has a terminal open on a Mac OS X machine? 240 00:13:20,940 --> 00:13:21,300 Anyone? 241 00:13:21,300 --> 00:13:21,380 Anyone? 242 00:13:21,660 --> 00:13:23,480 You, for example? 243 00:13:23,760 --> 00:13:24,180 You? 244 00:13:24,320 --> 00:13:24,480 Yeah? 245 00:13:25,580 --> 00:13:30,340 Can you type pmsetspace-g and tell me if it tells you the 246 00:13:30,340 --> 00:13:32,480 hibernate mode for your machine? 247 00:13:33,600 --> 00:13:37,200 See if it tells you it's 3 by any chance? 248 00:13:41,120 --> 00:13:42,080 Yeah, it does? 249 00:13:42,280 --> 00:13:42,840 Oh, you're fucked. 250 00:13:43,240 --> 00:13:43,820 All right. 251 00:13:49,360 --> 00:13:49,780 So. 252 00:13:49,780 --> 00:13:51,600 So that's good. 253 00:13:54,140 --> 00:13:56,240 So I'm pretty sure you didn't change that. 254 00:13:56,720 --> 00:14:00,240 And yeah, there's some dick-faced Apple security guy 255 00:14:00,240 --> 00:14:01,800 that told me that wasn't the case by default. 256 00:14:01,980 --> 00:14:03,260 But whatever. 257 00:14:04,100 --> 00:14:07,520 Anyway, it seems to be the case on every x86 Mac that I 258 00:14:07,520 --> 00:14:09,860 have found that is a laptop, that's the case. 259 00:14:10,040 --> 00:14:13,660 And if you go ahead and take a look at var vm in that 260 00:14:13,660 --> 00:14:15,600 directory, you tell me if there's a file called sleep 261 00:14:15,600 --> 00:14:15,840 image? 262 00:14:22,240 --> 00:14:22,880 Oh, cool. 263 00:14:23,040 --> 00:14:23,300 All right. 264 00:14:23,360 --> 00:14:23,720 Awesome. 265 00:14:24,220 --> 00:14:24,580 Neat. 266 00:14:26,300 --> 00:14:32,340 So if you, like, close your Mac for a second and then open it up, give it a second, wait 267 00:14:32,340 --> 00:14:36,580 for it to stop pulsing, like observe the light, it should be solid for a moment, and 268 00:14:36,580 --> 00:14:37,300 then it'll pulse. 269 00:14:38,080 --> 00:14:41,220 When it starts pulsing, open it again, type in your passphrase, and look at the time 270 00:14:41,220 --> 00:14:41,920 stamp on that file. 271 00:14:48,060 --> 00:14:48,540 All right. 272 00:15:12,500 --> 00:15:18,140 So basically, the key to all of this is in the mock kernel. 273 00:15:18,140 --> 00:15:23,380 I forgot to put the, oh, no, the version number I looked at was XNU792.13.8. 274 00:15:23,500 --> 00:15:24,900 I downloaded this a while ago. 275 00:15:25,060 --> 00:15:27,940 It's possible that they've changed some stuff, but, you know, maybe not. 276 00:15:28,260 --> 00:15:34,860 So the IOHybernate system sleep is inside of the kernel IOHybernate IOC++ file, and 277 00:15:34,860 --> 00:15:36,600 it's called from the IOPM root domain. 278 00:15:37,080 --> 00:15:41,960 And so in theory, the sleep images are encrypted with AES128 and cipherblock chaining mode. 279 00:15:42,640 --> 00:15:47,640 And it looks like a bunch of this stuff is borrowed from that fabulous Dr. Brian Gladman, 280 00:15:47,640 --> 00:15:49,180 the same stuff that he used for the Winzip. 281 00:15:50,080 --> 00:15:53,360 I discovered this sort of like independently from even talking with Hikari about this. 282 00:15:54,700 --> 00:15:57,300 So if you look inside, you see that it's a 128-bit key. 283 00:15:57,500 --> 00:16:00,600 Like you see this in the kernel source code, and you see like the wired crypt key, and 284 00:16:00,600 --> 00:16:04,460 you see the crypt key, and you see all this stuff, and you see how they generate it. 285 00:16:05,180 --> 00:16:10,480 From the previous examination with Ralph during the FileVault research we were doing at the 286 00:16:10,480 --> 00:16:15,960 Chaos Computer Club Congress last year, we determined that this random function is actually 287 00:16:15,960 --> 00:16:16,820 wrapped around Yaro. 288 00:16:17,640 --> 00:16:21,040 And they do some kind of like strange stuff for the random number generation that seems 289 00:16:21,040 --> 00:16:21,580 to be fine. 290 00:16:22,300 --> 00:16:24,360 Ralph is actually a real cryptographer. 291 00:16:24,700 --> 00:16:25,620 I'm just a photographer. 292 00:16:25,920 --> 00:16:27,220 I don't know much about this technology stuff. 293 00:16:27,900 --> 00:16:31,460 And in any case, it seems to be fine. 294 00:16:31,620 --> 00:16:34,140 They're just generating key, storing it, no big deal. 295 00:16:34,880 --> 00:16:38,880 So the thing is, though, is that it's not really okay, in that basically every single 296 00:16:38,880 --> 00:16:44,580 Mac laptop that I've seen that people didn't know better for, every single time they sleep 297 00:16:44,580 --> 00:16:47,620 their machine, they dump the contents, the full contents of memory, to the computer. 298 00:16:47,640 --> 00:16:50,780 And they don't even know what they're doing in the disk, like straight up. 299 00:16:51,780 --> 00:16:52,440 Pretty awesome. 300 00:16:52,880 --> 00:16:57,820 And I was going to demo ripping the key out of NVRAM on this machine, but I couldn't 301 00:16:57,820 --> 00:17:00,660 get the EFI shell to show up to this projector. 302 00:17:01,100 --> 00:17:07,060 But basically, if in fact you were able to find a way to turn on the encrypted Hibernate 303 00:17:07,060 --> 00:17:14,180 code that is in the mock kernel, you would be able to boot the machine and extract the 304 00:17:14,180 --> 00:17:14,960 key from NVRAM. 305 00:17:15,060 --> 00:17:17,540 And the reason is because the way that Apple ensures that 306 00:17:17,540 --> 00:17:22,340 the keys are removed from NVRAM is by doing it in the mock kernel, which is interesting 307 00:17:22,340 --> 00:17:25,740 because the mock kernel, you never get to that entry point. 308 00:17:25,840 --> 00:17:28,780 If you're never loading the mock kernel, the mock kernel can't free those entries. 309 00:17:29,220 --> 00:17:32,860 And the NVRAM is persistent across boots and stuff like that, right? 310 00:17:33,460 --> 00:17:34,540 That's kind of the point of it. 311 00:17:35,360 --> 00:17:39,980 So there's this really great piece of software called Refit, or R-E-F-I-T. 312 00:17:40,260 --> 00:17:43,420 And it has built-in NVRAM dumping tools. 313 00:17:43,580 --> 00:17:44,920 One of them is called DMP Store. 314 00:17:45,260 --> 00:17:46,500 Give it the dash B option. 315 00:17:46,680 --> 00:17:47,520 And you just get Hexnet.com. 316 00:17:47,540 --> 00:17:48,280 And you get all the dumps of the NVRAM. 317 00:17:48,420 --> 00:17:50,140 You get the global unique identifier. 318 00:17:50,460 --> 00:17:51,780 And you get the variable name. 319 00:17:52,200 --> 00:17:54,480 And I think that's pretty awesome. 320 00:17:54,780 --> 00:17:58,720 And if you look through the mock kernel, you can actually see boot path, boot device, 321 00:17:58,860 --> 00:18:01,780 boot image key, boot signature, memory signature, memsig, machine signature. 322 00:18:01,960 --> 00:18:03,600 There's a whole bunch of really interesting stuff in there. 323 00:18:04,780 --> 00:18:08,860 But it doesn't matter because I've actually not run across a single Mac that had this 324 00:18:08,860 --> 00:18:09,120 encrypted. 325 00:18:09,540 --> 00:18:11,640 So there's some really interesting things you can do here. 326 00:18:11,900 --> 00:18:16,440 For example, depending on which mode you have the machine set for the Hibernate mode stuff, 327 00:18:16,440 --> 00:18:19,900 you can actually inject data into the memory structures. 328 00:18:20,560 --> 00:18:23,740 So like, wait a minute. 329 00:18:23,960 --> 00:18:25,800 So you've got this crypto there, but you don't use it. 330 00:18:26,120 --> 00:18:26,520 Okay. 331 00:18:26,840 --> 00:18:31,520 So mode zero, if you enable that, that's the only safe mode that I've found. 332 00:18:31,600 --> 00:18:33,840 Because it doesn't write the VAR VM sleep image anymore. 333 00:18:34,920 --> 00:18:38,220 Several of the other modes, 1 through 4, 6, 7, 10, 11. 334 00:18:38,580 --> 00:18:40,120 And I didn't go above 11. 335 00:18:40,300 --> 00:18:44,200 I just figured that 11, since 10 and 11 were the same, it's possible that 12, 13, that's 336 00:18:44,200 --> 00:18:46,420 just like arbitrarily continues to do this. 337 00:18:46,440 --> 00:18:46,780 It's the same thing. 338 00:18:47,260 --> 00:18:51,880 But they suspend a RAM, they write a sleep image to disk, they don't have crypto at all. 339 00:18:52,400 --> 00:18:58,440 5, 8, and 9, write the sleep image to the disk, you'll see the light on the front be 340 00:18:58,440 --> 00:19:00,140 solid and then the machine will just turn off. 341 00:19:00,420 --> 00:19:05,000 And the next time you boot up, you'll have like a progress bar moving this way across 342 00:19:05,000 --> 00:19:05,480 the screen. 343 00:19:05,740 --> 00:19:08,960 And basically, it'll just show you and resume where you are. 344 00:19:09,100 --> 00:19:13,180 At that point, depending on which mode you're in, you want to experiment around with this. 345 00:19:13,280 --> 00:19:15,760 But basically, depending on what mode you're in, you'll type in the password three times. 346 00:19:15,760 --> 00:19:21,340 And if it fails during that time frame, it'll actually take the memory dump of you typing 347 00:19:21,340 --> 00:19:24,020 in that passphrase and it'll write that back out to disk. 348 00:19:24,140 --> 00:19:25,520 So the timestamp will update again. 349 00:19:26,000 --> 00:19:28,580 So I was thinking about some interesting things you could do there. 350 00:19:28,620 --> 00:19:31,780 It's like you could actually put arbitrary data into that field and it'll get written 351 00:19:31,780 --> 00:19:33,460 out to the var vm sleep image. 352 00:19:33,600 --> 00:19:38,500 So I don't know what you could put in there, like some ASCII text string that you would 353 00:19:38,500 --> 00:19:40,820 not want, like, yes, I killed my wife or something like that. 354 00:19:40,920 --> 00:19:44,940 But it would be written back out to that sleep image file, which I thought was really interesting. 355 00:19:44,940 --> 00:19:48,260 Because it's like, if you failed to authenticate as the user, why would you want to save the 356 00:19:48,260 --> 00:19:48,480 state? 357 00:19:49,400 --> 00:19:50,120 I don't know. 358 00:19:50,400 --> 00:19:53,640 But apparently, that was an idea that the Apple people thought was a good idea. 359 00:19:53,860 --> 00:19:56,040 Or maybe they just didn't think about it because they're overloaded. 360 00:19:56,300 --> 00:19:58,600 They probably need to hire more security people from the sound of it. 361 00:20:00,640 --> 00:20:02,860 This is, by the way, without encrypted swap. 362 00:20:03,200 --> 00:20:04,380 Those are all the modes I tested. 363 00:20:04,480 --> 00:20:08,320 Then I enabled encrypted swap, mode three, mode five, and mode seven for the hibernate 364 00:20:08,320 --> 00:20:08,480 mode. 365 00:20:09,140 --> 00:20:10,760 And none of them had crypto, again. 366 00:20:11,520 --> 00:20:13,240 And I mean, perhaps I'm doing something wrong. 367 00:20:13,360 --> 00:20:14,780 I'm willing to be corrected about this. 368 00:20:14,940 --> 00:20:17,680 But it doesn't matter, because even if they are doing crypto, we can extract the key. 369 00:20:18,340 --> 00:20:19,480 It's very simple to do it. 370 00:20:20,660 --> 00:20:24,680 But in any case, it negates the value of the encrypted swap, which was basically just being 371 00:20:24,680 --> 00:20:25,400 used as a band-aid. 372 00:20:25,500 --> 00:20:30,800 Some of you might remember people were typing in their file vault password, and they would 373 00:20:30,800 --> 00:20:35,880 grep through their swap file, and they would actually see their password in the swap file. 374 00:20:36,120 --> 00:20:39,640 Well, they turn on encrypted swap, that's how they fixed it, instead of zeroing memory. 375 00:20:40,340 --> 00:20:42,820 And I just bought a Mac Mini just to test this stuff. 376 00:20:42,940 --> 00:20:44,920 I set the password to pwn, pwn, pwn, pwn. 377 00:20:44,920 --> 00:20:48,220 And it's all over the swap file, like everywhere you can imagine it. 378 00:20:49,400 --> 00:20:52,580 So you could pull out the encrypted swap key if you were interested, and you can basically 379 00:20:52,580 --> 00:20:55,980 reconstruct the state of the machine at the moment at which it was put into a sleep mode. 380 00:20:56,380 --> 00:20:58,200 And this is for any laptop. 381 00:20:59,180 --> 00:21:02,500 So I was thinking about ways you could fix this, and EFI is really awesome. 382 00:21:02,700 --> 00:21:06,240 I'm glad that Apple went with EFI, because basically you can write any portable C app, 383 00:21:07,380 --> 00:21:11,420 and you could very easily take a variable, like you can patch the mock kernel, specifically 384 00:21:11,420 --> 00:21:12,640 the parts that do this key stuff. 385 00:21:13,000 --> 00:21:14,580 And you could set an NVRAM variable. 386 00:21:14,920 --> 00:21:20,560 Where it was basically some string that the user has as a passphrase, and you could take 387 00:21:20,560 --> 00:21:24,080 another set of random numbers, and you could put them in the variables, and you could XOR 388 00:21:24,080 --> 00:21:24,480 them together. 389 00:21:24,800 --> 00:21:27,700 And in theory, the worst thing that would happen is that, well, if you type in the 390 00:21:27,700 --> 00:21:32,180 incorrect password at boot, you would not be able to authenticate for the hibernated 391 00:21:32,180 --> 00:21:32,360 image. 392 00:21:32,480 --> 00:21:36,860 But the hibernated image, if it's actually correctly encrypted with AES-128 CBC, you 393 00:21:36,860 --> 00:21:39,840 should be able to just forget about it. 394 00:21:39,900 --> 00:21:41,900 It doesn't matter if they don't have the right password, they're not going to get it. 395 00:21:42,280 --> 00:21:44,900 But if they do type in the right password, then they've at least authenticated for the 396 00:21:44,920 --> 00:21:46,460 hibernated image, and they're going to be able to authenticate themselves, and they're 397 00:21:46,460 --> 00:21:46,780 in solid. 398 00:21:48,140 --> 00:21:48,680 All right. 399 00:21:48,740 --> 00:21:49,340 Back there, David. 400 00:21:51,400 --> 00:21:51,800 Ah. 401 00:21:52,520 --> 00:21:52,920 Okay. 402 00:21:53,020 --> 00:21:59,580 So, some future projects that you can see coming out of OpenCiphers is, I guess we now 403 00:21:59,580 --> 00:22:00,500 have some YCrawl support. 404 00:22:00,760 --> 00:22:01,860 I think I see Aaron back there. 405 00:22:01,980 --> 00:22:02,300 Yeah. 406 00:22:02,380 --> 00:22:02,800 Over there. 407 00:22:03,200 --> 00:22:06,280 He's giving a talk tomorrow on YCrawl. 408 00:22:06,540 --> 00:22:10,460 And I guess there's Pico support in that, so that's pretty awesome. 409 00:22:10,820 --> 00:22:14,320 And you can catch that in track one at 11.30, I think. 410 00:22:14,500 --> 00:22:14,900 All right. 411 00:22:14,920 --> 00:22:15,160 All right. 412 00:22:15,700 --> 00:22:22,240 And then we're also, well, I'm giving a talk at the CCC camp on cracking GSM crypto using 413 00:22:22,240 --> 00:22:22,900 FPGAs. 414 00:22:23,040 --> 00:22:27,700 And so if any of you are out of the country at CCC camp, you can check that out. 415 00:22:28,260 --> 00:22:31,920 It'll be at 3.30 p.m. next Friday in one of the tents, I guess. 416 00:22:34,260 --> 00:22:38,920 So conclusions, get an FPGA and start cracking, make use of hardware to break crypto. 417 00:22:40,260 --> 00:22:44,840 If you think that 64-bit is like, you know, doing pretty good, think again. 418 00:22:44,840 --> 00:22:46,920 And choose bad passwords. 419 00:22:47,380 --> 00:22:52,460 And if you want to throw rotten fruit at us, wait until the dunk tank tomorrow at 1 p.m. 420 00:22:52,460 --> 00:22:56,480 because we'll be there ready to get dunked if you guys want to support the EFF. 421 00:22:58,660 --> 00:23:04,380 And a little bit of thanks to Jake, Ralph Philip Wyman, Terry Zoeller, Eric Sesterhen, 422 00:23:04,520 --> 00:23:05,980 and all the viewers like you. 423 00:23:06,560 --> 00:23:07,300 Here's some info. 424 00:23:07,760 --> 00:23:10,900 I guess we're going to be taking questions in the question room unless there's time. 425 00:23:11,140 --> 00:23:11,800 Anybody know? 426 00:23:12,100 --> 00:23:12,880 You're off! 427 00:23:13,100 --> 00:23:13,660 We have some time. 428 00:23:13,740 --> 00:23:14,100 All right. 429 00:23:14,100 --> 00:23:14,180 All right.