All right, so today I'll be talking about FPGAs, and first of all, how many people have seen one of my previous talks? Wow. That's amazing. Okay. Yeah, so I'm just going to go over some of the newer stuff that I've been working on, and some of the FileVault stuff that I've been working on, I actually worked on with Jake, 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. But anyway, I am the chairman for TORCON. TORCON, by the way, is happening in October. We have some flyers up here if you guys want to pick them up. And I also do security R&D for Pico Computing. That's the card that I run all my demos on here. And I'm also a researcher with the OpenCiphers project, which means that I'm the single person that contributes source to it. So, a quick overview here. We'll be doing, well, we can skip through the FPGA intro because, of so many people that have already seen my talk, and then we can just go on to some demos, and then talk about FileVault and some of the new stuff that's coming out. So, skipping over. Whoa. All right. Bluetooth pin cracking. Has anybody seen this demo before? Raise of hands. No? Oh, okay. Oh, yeah, yeah, yeah. So, have people seen the cow patty demo? Breaking cow patty? Yeah, okay. Sweet. So, it's pretty similar. You basically sniff out the authentication, and you can do that now with FTE dongles. You can use the open source sniffer that they just released at the Wi-Fi talk, I think, if you guys saw that. And so, yeah, if you can force the two devices to repair and capture the authentication, then the only thing that you really don't know is the pin. And so, the whole attack basically works by emulating, like, all the algorithms that they use. So, they use safety. And this whole attack was actually originally outlined by these guys. I'm not even going to try and pronounce their name, but they're down at the bottom there. And also, Terry Zoller, is he in the audience here? Yeah? He said he was going to be here. Anyway, he also did his own implementation. And so, there's a couple different implementations of this out there. So, basically, how it works is you have this whole authentication. A bunch of challenges are sent across. And there's essentially a key negotiation. And it's based on both sides having a mutual pin that matches. So, if you know the algorithm that they use, you just try a pin and, you know, run it through the capture and see if all the checksums match up and stuff. And it's actually a really small key space. If you think about the total key space, if people are just typing in pins, it's 10 to the 16. 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. I mean. So, I did. I did an implementation that's all command-line based. And it implements, like, all this stuff. It runs in software and also on one of our cards. And it uses a 16-stage pipeline, if you guys know much about FPGA stuff. And this is essentially what it does. This is the algorithm. It runs E22 and does all this sort of crap. All these red things are basically the input. The stuff that you capture. They're off the network. And all we're brute forcing is the blue part there. And so, you just kind of run through with the data you capture. And then, eventually, you find a pin that makes everything happy. So, in my FPGA code, I have a pin generator that feeds into my SaferCore. And it feeds in 16 pins. And then, as it crunches through the pipeline on it, it ends up. Once the data starts coming out the other end, it gets looped back in. And then, basically. The implementation is kind of muxed for each time it gets looped back in. So, the first time, it's running E22, which is a variation of SaferPlus. And then, the second time, it gets looped back in. And it's kind of in E21 mode. And then, it gets looped back again. And it essentially just does all these operations here, but with a single SaferCore. So, it gets looped around and does all these calculations. And at the very end, you end up getting these results that you compare with, like, the checksums that are sent across in authentication. 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. So, a pretty standard cracker. 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. I'll show you the boring demo first, here. This is running on my laptop. It's doing... maybe 10 or 20,000 pins per second, roughly. And, uh, this is running on the FPGA. So, it just cracked a six-digit pin on that first thing there. Right now, it's cracking a lot... That was a nine-digit pin, I think. 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. Now, uh, we have a much better interface here that... Thanks to... uh, Terry Zoller, we now have. So, I'm going to fire up this VB app, here. And, uh, with this, you can actually run it with the FTE software. So, if you capture the authentication, you just, uh, take the dump, and you can select it inside here. It's very easy to use. So, I'm going to capture this... this one. So, there's, there's all the values that we're using to crack it. And, I'm just going to crack it on my computer, right now. We've got some Hollywood effects going. So, right now, it's only doing about 200,000 per second, there, in the pins per second. So, I'm just going to stop it. Click this Use FPGA button, here. And, now, let's see how fast it runs. It only looks fast because I'm updating it a lot faster, but... Oh! So, there's, uh, like a eight digit pin, right there. And, there's a link key, so... So, now, if you had, uh, had some stuff, um, captured for the conversation, you could, uh, use this. You can feed this link key into your software, and then decrypt the whole conversation. Or you can just start injecting stuff into the conversation. You basically have the whole conversation owned at that point. So there's the sweet demo. So as far as performance numbers, there's really a couple orders of magnitude difference here. Using btcrack, there's some optimizations there. So you can get like 100,000, maybe 200,000 per second. And on this card on my laptop, I'm getting about 10 million per second. So it's quite a bit faster. Now the next topic is cracking WinZip AES encryption. So I wanted to attack WinZip for a while now. And I was looking at trying to reverse engineer WinZip. And I'm sure that lots of people have attacked WinZip because they're trying to write their cracks for it and try and make it so it doesn't do that stupid thing where it counts up a second for every day that you haven't registered and crap. So I started doing that. And then I checked out some of their web pages. And it turns out that they have a web page that describes their encryption algorithm for compatibility reasons. And basically, they linked to this site, and they pretty much ripped off this guy's entire code base for implementing all their encryption. So I just had to kind of figure out the zip format and use this guy's code. And it pretty much works. And actually, it's the same code that OSX ripped off too, right? Some of it, yeah. Yeah. So lots of people are using Dr. Gladman's file encryption code. But their encryption supports 128-bit, 192-bit, 256-bit. And it has this cool verification value, which I can get to in a minute. So essentially what you do is you try a password. You run it through this hashing algorithm called PBKDF2, which is the same one that you use for WPA2. And it actually ends up taking the end of it and uses that as a verification value. And so you can compare that with the value that's stored in the zip file and initially see if the password you're trying is valid or not. And then one out of two to the 16 times, you'll have to actually go and decrypt the whole file, check the checksum, and make sure that you got the right password. But this actually works really well. And I'll show you it working in a minute. So yeah, pretty much all the same code as the WPA. I just had to reverse engineer some of the formats. And I'll do a quick demo. And by the way, all this code is actually available on the OpenCiphers website right now if you want to grab it, if you need to crack any WinZip files. So this program just takes a zip file. And it takes a file inside the zip file, because you can actually have multiple encrypted zip files inside the zip file. I'll just look at one of these here. Here's a test file. So this is one file inside of it. And this one's actually encrypted with WinZip encryption. So Windows doesn't know how to deal with it. And I haven't registered WinZip yet, so I'll try and show you how to extract this here. Oh, wait, I've got to use something else. So yeah. Like if I try maybe 7zip, let's see if that works, then it's asking for a password, right? So all you have to do is, I've got this script here. Like if you're just running this on your PC, you do WinZip crack, your zip file, the file inside of it that's encrypted, and then you give it a dictionary file. And inside your dictionary file, it's just a bunch of different passwords you want to try, right? So this is running on my computer. And it's going a little slow. So let me try it on the FPGA. So that's running on the FPGA, and it's a little faster. It's not crazy fast, but it'll get you where you want to go. So yeah, now on to FileVault. Did you want to explain this? Go for it. OK. So back when I was at the CCC, at the Congress list last year. Jake was giving a talk on FileVault, and so I kind of listened in on some of the stuff they were doing. And it turned out that FileVault also uses PBKDF2 for their password hashing. So I coded up this program to crack FileVault images. And essentially, FileVault, your home directory is stored as a DMG file that's encrypted. And it basically uses AES, and then it uses triple DES for wrapping the keys and stuff. And there's a couple different formats for it, but it's basically the same hashing for both. And so yeah, I just modified my code and made it support FileVault. And yeah, it's actually exactly the same FPGA file that I'm using for the WinZip stuff. So didn't really have to do any modification with that. I had this, oh, Jake wrote this program for decrypting files. So if you have a DMG file that's encrypted, and you have the password for it, you can just run a command line tool and takes it in with the password, spits out a totally clean DMG file. And I think that some of the people hacking the iPhone actually use that for decrypting some of the iPhone stuff. And then I just kind of modified their code to do the cracking, so you can just try a bunch of passwords and see if they work or not. And there's a couple other attacks that Jake can elaborate on in a little bit. But I'll just go ahead and do that. And I'll just show you the cracking real quick here. We called this FileVault because we didn't want to have any sort of copyright issues with Apple, by the way. So yeah, this is running on my computer here. And it's pretty much like the same sort of speed improvement that you see with the WinZip stuff. Yeah, there's the password. OK, well, I'll let Jake talk about the FileVault stuff now. And then I'll come back on a little bit. So we did a sort of informal survey of about 100 to 150 Macs running on PowerPC and x86. And actually, I see there are a bunch of Macs here. I'm very scared for you. But maybe you could help out. Who here has a terminal open on a Mac OS X machine? Anyone? Anyone? You, for example? You? Yeah? Can you type pmsetspace-g and tell me if it tells you the hibernate mode for your machine? See if it tells you it's 3 by any chance? Yeah, it does? Oh, you're fucked. All right. So. So that's good. So I'm pretty sure you didn't change that. And yeah, there's some dick-faced Apple security guy that told me that wasn't the case by default. But whatever. Anyway, it seems to be the case on every x86 Mac that I have found that is a laptop, that's the case. And if you go ahead and take a look at var vm in that directory, you tell me if there's a file called sleep image? Oh, cool. All right. Awesome. Neat. So if you, like, close your Mac for a second and then open it up, give it a second, wait for it to stop pulsing, like observe the light, it should be solid for a moment, and then it'll pulse. When it starts pulsing, open it again, type in your passphrase, and look at the time stamp on that file. All right. So basically, the key to all of this is in the mock kernel. I forgot to put the, oh, no, the version number I looked at was XNU792.13.8. I downloaded this a while ago. It's possible that they've changed some stuff, but, you know, maybe not. So the IOHybernate system sleep is inside of the kernel IOHybernate IOC++ file, and it's called from the IOPM root domain. And so in theory, the sleep images are encrypted with AES128 and cipherblock chaining mode. And it looks like a bunch of this stuff is borrowed from that fabulous Dr. Brian Gladman, the same stuff that he used for the Winzip. I discovered this sort of like independently from even talking with Hikari about this. So if you look inside, you see that it's a 128-bit key. Like you see this in the kernel source code, and you see like the wired crypt key, and you see the crypt key, and you see all this stuff, and you see how they generate it. From the previous examination with Ralph during the FileVault research we were doing at the Chaos Computer Club Congress last year, we determined that this random function is actually wrapped around Yaro. And they do some kind of like strange stuff for the random number generation that seems to be fine. Ralph is actually a real cryptographer. I'm just a photographer. I don't know much about this technology stuff. And in any case, it seems to be fine. They're just generating key, storing it, no big deal. So the thing is, though, is that it's not really okay, in that basically every single Mac laptop that I've seen that people didn't know better for, every single time they sleep their machine, they dump the contents, the full contents of memory, to the computer. And they don't even know what they're doing in the disk, like straight up. Pretty awesome. And I was going to demo ripping the key out of NVRAM on this machine, but I couldn't get the EFI shell to show up to this projector. But basically, if in fact you were able to find a way to turn on the encrypted Hibernate code that is in the mock kernel, you would be able to boot the machine and extract the key from NVRAM. And the reason is because the way that Apple ensures that the keys are removed from NVRAM is by doing it in the mock kernel, which is interesting because the mock kernel, you never get to that entry point. If you're never loading the mock kernel, the mock kernel can't free those entries. And the NVRAM is persistent across boots and stuff like that, right? That's kind of the point of it. So there's this really great piece of software called Refit, or R-E-F-I-T. And it has built-in NVRAM dumping tools. One of them is called DMP Store. Give it the dash B option. And you just get Hexnet.com. And you get all the dumps of the NVRAM. You get the global unique identifier. And you get the variable name. And I think that's pretty awesome. And if you look through the mock kernel, you can actually see boot path, boot device, boot image key, boot signature, memory signature, memsig, machine signature. There's a whole bunch of really interesting stuff in there. But it doesn't matter because I've actually not run across a single Mac that had this encrypted. So there's some really interesting things you can do here. For example, depending on which mode you have the machine set for the Hibernate mode stuff, you can actually inject data into the memory structures. So like, wait a minute. So you've got this crypto there, but you don't use it. Okay. So mode zero, if you enable that, that's the only safe mode that I've found. Because it doesn't write the VAR VM sleep image anymore. Several of the other modes, 1 through 4, 6, 7, 10, 11. And I didn't go above 11. I just figured that 11, since 10 and 11 were the same, it's possible that 12, 13, that's just like arbitrarily continues to do this. It's the same thing. But they suspend a RAM, they write a sleep image to disk, they don't have crypto at all. 5, 8, and 9, write the sleep image to the disk, you'll see the light on the front be solid and then the machine will just turn off. And the next time you boot up, you'll have like a progress bar moving this way across the screen. And basically, it'll just show you and resume where you are. At that point, depending on which mode you're in, you want to experiment around with this. But basically, depending on what mode you're in, you'll type in the password three times. And if it fails during that time frame, it'll actually take the memory dump of you typing in that passphrase and it'll write that back out to disk. So the timestamp will update again. So I was thinking about some interesting things you could do there. It's like you could actually put arbitrary data into that field and it'll get written out to the var vm sleep image. So I don't know what you could put in there, like some ASCII text string that you would not want, like, yes, I killed my wife or something like that. But it would be written back out to that sleep image file, which I thought was really interesting. Because it's like, if you failed to authenticate as the user, why would you want to save the state? I don't know. But apparently, that was an idea that the Apple people thought was a good idea. Or maybe they just didn't think about it because they're overloaded. They probably need to hire more security people from the sound of it. This is, by the way, without encrypted swap. Those are all the modes I tested. Then I enabled encrypted swap, mode three, mode five, and mode seven for the hibernate mode. And none of them had crypto, again. And I mean, perhaps I'm doing something wrong. I'm willing to be corrected about this. But it doesn't matter, because even if they are doing crypto, we can extract the key. It's very simple to do it. But in any case, it negates the value of the encrypted swap, which was basically just being used as a band-aid. Some of you might remember people were typing in their file vault password, and they would grep through their swap file, and they would actually see their password in the swap file. Well, they turn on encrypted swap, that's how they fixed it, instead of zeroing memory. And I just bought a Mac Mini just to test this stuff. I set the password to pwn, pwn, pwn, pwn. And it's all over the swap file, like everywhere you can imagine it. So you could pull out the encrypted swap key if you were interested, and you can basically reconstruct the state of the machine at the moment at which it was put into a sleep mode. And this is for any laptop. So I was thinking about ways you could fix this, and EFI is really awesome. I'm glad that Apple went with EFI, because basically you can write any portable C app, and you could very easily take a variable, like you can patch the mock kernel, specifically the parts that do this key stuff. And you could set an NVRAM variable. Where it was basically some string that the user has as a passphrase, and you could take another set of random numbers, and you could put them in the variables, and you could XOR them together. And in theory, the worst thing that would happen is that, well, if you type in the incorrect password at boot, you would not be able to authenticate for the hibernated image. But the hibernated image, if it's actually correctly encrypted with AES-128 CBC, you should be able to just forget about it. It doesn't matter if they don't have the right password, they're not going to get it. But if they do type in the right password, then they've at least authenticated for the hibernated image, and they're going to be able to authenticate themselves, and they're in solid. All right. Back there, David. Ah. Okay. So, some future projects that you can see coming out of OpenCiphers is, I guess we now have some YCrawl support. I think I see Aaron back there. Yeah. Over there. He's giving a talk tomorrow on YCrawl. And I guess there's Pico support in that, so that's pretty awesome. And you can catch that in track one at 11.30, I think. All right. All right. And then we're also, well, I'm giving a talk at the CCC camp on cracking GSM crypto using FPGAs. And so if any of you are out of the country at CCC camp, you can check that out. It'll be at 3.30 p.m. next Friday in one of the tents, I guess. So conclusions, get an FPGA and start cracking, make use of hardware to break crypto. If you think that 64-bit is like, you know, doing pretty good, think again. And choose bad passwords. And if you want to throw rotten fruit at us, wait until the dunk tank tomorrow at 1 p.m. because we'll be there ready to get dunked if you guys want to support the EFF. And a little bit of thanks to Jake, Ralph Philip Wyman, Terry Zoeller, Eric Sesterhen, and all the viewers like you. Here's some info. I guess we're going to be taking questions in the question room unless there's time. Anybody know? You're off! We have some time. All right. All right.