1 00:00:00,000 --> 00:00:02,520 All right. Good afternoon, everybody. I'm Jared DeMott. 2 00:00:03,060 --> 00:00:07,940 I'm going to be talking to you about fuzzing, and I am just happy, ecstatic, and amazed that this house is packed. 3 00:00:08,200 --> 00:00:14,760 Dan Kaminsky is talking in the other room, and I wasn't sure I was going to get too many people in here today, so that's awesome. 4 00:00:15,360 --> 00:00:19,800 How many saw Atlas or Johnny Long? Raise your hand yesterday. Did you guys see that? 5 00:00:20,080 --> 00:00:23,920 Who loved the video of Bruce Potter? Did you guys like that? 6 00:00:24,520 --> 00:00:28,640 Oh, man. To me, that was hilarious. That was just off the hook. 7 00:00:28,640 --> 00:00:31,480 So let's jump into this. I've got a lot of stuff, so I'm going to move pretty fast. 8 00:00:33,900 --> 00:00:36,500 The range of people I think in here goes everywhere. 9 00:00:36,660 --> 00:00:41,800 I've talked to people who don't know what the word fuzzing means, and I've talked to people that have been doing this for five-plus years. 10 00:00:42,020 --> 00:00:49,240 So I'm going to do a background, current state, talk about context-free grammar fuzzers, talk about generic fuzzers, 11 00:00:49,280 --> 00:00:53,140 talk just real briefly about how web and file fuzzing kind of fits into this a little bit, 12 00:00:53,240 --> 00:00:58,420 talk about some formal metrics and kind of advancing the state and where some of my research is going with this. 13 00:01:01,020 --> 00:01:08,380 So for those of you who do not know what the word fuzzing means, it's basically an automated testing technique to find bugs in software. 14 00:01:09,000 --> 00:01:16,500 That's it. That's the short version, and there's a lot of debate longer about what else exactly it means, 15 00:01:16,680 --> 00:01:21,580 and maybe fuzzing is only random, and maybe it's structured, and we'll talk a little bit about that. 16 00:01:21,740 --> 00:01:24,640 So Peter Ohart from the former Microsoft says, 17 00:01:24,820 --> 00:01:28,500 A highly automated testing technique that covers numerous boundary cases, 18 00:01:28,640 --> 00:01:32,540 using invalid data from files, network protocols, API calls, and other targets, 19 00:01:33,060 --> 00:01:36,900 as application input to better ensure the absence of explodable vulnerabilities. 20 00:01:37,420 --> 00:01:41,200 And then the word fuzzing comes from 1990 with Barton Miller. 21 00:01:41,360 --> 00:01:44,140 A lot of people apparently say, I can't even attest to this personally, 22 00:01:44,280 --> 00:01:50,240 but for modem application tendency to fail due to random input caused by line noise on fuzzy telephone lines. 23 00:01:50,320 --> 00:01:52,500 So he did some research in 1990. 24 00:01:52,860 --> 00:01:58,460 So to get everybody on the same page, what I like to do, too, is just give a really quick example of, 25 00:01:58,900 --> 00:02:02,460 fuzzing, just up front, show what it is, and then we'll talk more in detail about it. 26 00:02:02,540 --> 00:02:07,140 So say we have this fake little protocol, and it's user, Jared, that's a client, 27 00:02:07,280 --> 00:02:11,120 and the server says, okay, good user, give me your pass, password, my lane pass, 28 00:02:11,540 --> 00:02:15,820 and the server says, all right, cool, and then client, here's a command. 29 00:02:16,040 --> 00:02:17,940 So that's the fake protocol. 30 00:02:18,760 --> 00:02:20,620 Now, how would you fuzz that, okay? 31 00:02:21,760 --> 00:02:25,200 Well, first we'll talk about just the data, and then we'll talk about monitoring the server. 32 00:02:25,340 --> 00:02:28,500 But basically, you could, like, see in loop three, I send you, 33 00:02:28,640 --> 00:02:31,620 user, Jared, and he says, okay, and then I give some random data. 34 00:02:32,340 --> 00:02:37,180 So that is not truly random fuzzing, right, because we have some protocol knowledge. 35 00:02:37,400 --> 00:02:42,900 We send the first leg, we get the second leg, and then we send some crazy stuff in the third leg, right? 36 00:02:43,340 --> 00:02:46,800 So that could be maybe just seeing how it handles arbitrary binary data. 37 00:02:46,940 --> 00:02:49,720 That's test one, say, or maybe these tests are randomized. 38 00:02:50,600 --> 00:02:53,260 A lot of different ways to write fuzzers, and we'll talk about that, too. 39 00:02:53,960 --> 00:02:56,580 In the first loop, you see I send 50,000 FFs. 40 00:02:56,640 --> 00:02:58,380 Maybe you're looking for long strings, or again, 41 00:02:58,640 --> 00:02:59,760 how it handles non-ASCII data. 42 00:03:01,160 --> 00:03:07,820 Second loop, we see 12% ends in the middle of the Jared for the user name, percent ends. 43 00:03:07,960 --> 00:03:08,880 We all know what that is, right? 44 00:03:09,060 --> 00:03:09,980 What am I looking for? 45 00:03:10,440 --> 00:03:11,040 Who knows? 46 00:03:12,100 --> 00:03:13,180 Format string bugs, right. 47 00:03:13,260 --> 00:03:15,260 And if you don't know what that is, there's lots of good data out there. 48 00:03:15,400 --> 00:03:17,280 So those are what are called attack heuristics. 49 00:03:17,760 --> 00:03:22,840 Sending a long string, sending a format string, sending a null byte at the end instead of a carriage return, 50 00:03:23,260 --> 00:03:24,480 changing the delimiters, right? 51 00:03:24,560 --> 00:03:28,320 These are like in a text protocol, the normal sequence of events, 52 00:03:28,320 --> 00:03:34,360 is like string, delimiter, string, line ending, maybe changing delimiters, or line endings, or chaining command. 53 00:03:34,480 --> 00:03:38,480 There's a lot of different attack heuristics that should and could be built into a good fuzzer. 54 00:03:38,620 --> 00:03:42,780 So, just again, so we're all on the same page with the word fuzzing, 55 00:03:42,840 --> 00:03:45,100 since I use it like a million times in this presentation. 56 00:03:46,820 --> 00:03:51,720 Other words, there's sort of like two industries that are now, I hope, colliding, 57 00:03:51,760 --> 00:03:55,780 because I think software will be at its best when the QA world, software testing. 58 00:03:55,880 --> 00:03:56,780 Who does software testing? 59 00:03:56,920 --> 00:03:57,420 Quality assurance. 60 00:03:57,420 --> 00:03:58,160 Raise your hand. 61 00:03:58,540 --> 00:03:59,460 Anybody out there? 62 00:04:00,040 --> 00:04:00,960 No, that's good. 63 00:04:01,080 --> 00:04:01,460 I like that. 64 00:04:01,680 --> 00:04:04,940 And then there's security researchers doing fuzzing to find bugs in software. 65 00:04:05,120 --> 00:04:05,580 Who's doing that? 66 00:04:05,680 --> 00:04:06,100 Raise your hand. 67 00:04:06,200 --> 00:04:06,440 Let's see. 68 00:04:06,660 --> 00:04:08,040 Yeah, there's more of those guys. 69 00:04:08,200 --> 00:04:08,440 All right. 70 00:04:08,540 --> 00:04:08,840 Me too. 71 00:04:09,200 --> 00:04:14,240 So anyway, if the QA guys learn a little bit more about what the security guys are doing, 72 00:04:14,440 --> 00:04:15,380 things are going to get better. 73 00:04:15,740 --> 00:04:19,660 And if the security guys know a little bit about regression testing and some of the QA things, 74 00:04:19,900 --> 00:04:21,700 then their testing could get better too. 75 00:04:21,900 --> 00:04:27,400 So the word that the QA guys tend to use is robustness testing or negative testing. 76 00:04:27,420 --> 00:04:29,460 Or all kinds of other words. 77 00:04:29,680 --> 00:04:30,880 Stochastic means random. 78 00:04:32,420 --> 00:04:33,440 Monkey, I've heard. 79 00:04:33,600 --> 00:04:34,220 Boundary, stress. 80 00:04:34,500 --> 00:04:37,020 Some of these are a little bit different, but they can be used in the same context. 81 00:04:37,300 --> 00:04:38,780 I'm just going to use the word fuzzing today. 82 00:04:40,140 --> 00:04:42,520 So how does fuzzing fit into software testing? 83 00:04:42,800 --> 00:04:46,300 If I'm Microsoft and I want to fuzz to make my software better, which if you went to the 84 00:04:46,300 --> 00:04:48,300 Vista talk at Black Hat, it was pretty good actually. 85 00:04:48,620 --> 00:04:49,660 They talk about that. 86 00:04:49,740 --> 00:04:50,220 They do that. 87 00:04:50,420 --> 00:04:50,620 Okay. 88 00:04:51,640 --> 00:04:54,000 Well, software testing, as we know, is difficult. 89 00:04:54,320 --> 00:04:54,780 It's tedious. 90 00:04:54,960 --> 00:04:55,500 It's expensive. 91 00:04:55,780 --> 00:04:56,760 It's like half the budget. 92 00:04:56,860 --> 00:04:57,400 But it's something that you can do. 93 00:04:57,400 --> 00:04:57,940 It's all we have. 94 00:04:58,260 --> 00:05:01,920 It's really the only way and the primary way that you have to gain confidence in your 95 00:05:01,920 --> 00:05:03,260 software, that your software is any good. 96 00:05:03,680 --> 00:05:04,400 Pre-release. 97 00:05:04,940 --> 00:05:08,520 Post-release, you have this whole group of third-party security reachers that will be 98 00:05:08,520 --> 00:05:11,580 glad to find bugs and resell them and do this whole thing that we do as an industry 99 00:05:11,580 --> 00:05:11,820 now. 100 00:05:13,000 --> 00:05:17,260 So testing, again, we probably know if we've seen this before, there's Black Box, Dynamic, 101 00:05:18,120 --> 00:05:21,940 which is like you have a real binary running on a real server, and you're sending real 102 00:05:21,940 --> 00:05:23,620 stuff to it and really interacting with it. 103 00:05:23,800 --> 00:05:27,380 And there's White Box, which is more like code audits and scanning through sources. 104 00:05:27,400 --> 00:05:29,780 You're scanning source code, and both are good. 105 00:05:29,920 --> 00:05:30,680 You should do both. 106 00:05:30,940 --> 00:05:32,500 There's some pros and cons to each. 107 00:05:32,600 --> 00:05:36,280 The pro of Black Box is that if you send real data to a real server running on a real box, 108 00:05:36,360 --> 00:05:38,640 you'll find a real bug, and you can really exercise it remotely. 109 00:05:39,280 --> 00:05:44,280 If you're scanning source code and your lint or your whatever tells you, hey, here's a 110 00:05:44,280 --> 00:05:45,400 stir copy, that's kind of naughty. 111 00:05:45,480 --> 00:05:46,920 And then you're like, all right, well, let me go look into this. 112 00:05:47,100 --> 00:05:49,500 And then you find out, yeah, that is a problem. 113 00:05:49,780 --> 00:05:53,680 When the config file gets loaded by the admin who has to be admin to load the config file, 114 00:05:53,820 --> 00:05:54,700 then that could be a problem. 115 00:05:54,860 --> 00:05:56,960 But you can't really exercise that bug remotely. 116 00:05:57,140 --> 00:05:57,380 So there's a problem. 117 00:05:57,400 --> 00:05:59,080 There's a slight difference in terms of usability. 118 00:05:59,380 --> 00:06:01,940 But all bugs should be fixed from a QA standpoint, right? 119 00:06:02,020 --> 00:06:02,660 Bugs are bugs. 120 00:06:03,020 --> 00:06:09,480 But it's just in terms of attack surface, which we'll just explain pretty briefly in a minute. 121 00:06:09,600 --> 00:06:13,040 So how does fuzzing fit into that quality assurance lifecycle? 122 00:06:13,680 --> 00:06:15,200 Or how does fuzzing fit in? 123 00:06:15,260 --> 00:06:17,940 We know how fuzzing fits in from a research standpoint, right? 124 00:06:18,000 --> 00:06:18,680 We want to find bugs. 125 00:06:18,760 --> 00:06:19,140 We fuzz. 126 00:06:19,140 --> 00:06:19,660 We find a bug. 127 00:06:19,860 --> 00:06:21,280 We do whatever we want to do with it, right? 128 00:06:21,520 --> 00:06:24,760 But from a QA standpoint, you have formal methods and software engineering. 129 00:06:25,560 --> 00:06:27,260 You know, you should have this formal process. 130 00:06:27,400 --> 00:06:28,260 This process of developing software. 131 00:06:28,420 --> 00:06:30,000 And part of that is your quality assurance group. 132 00:06:30,180 --> 00:06:31,800 And part of that is your testing group. 133 00:06:31,980 --> 00:06:33,720 And part of your testing group is fuzzing. 134 00:06:33,800 --> 00:06:35,160 It's just one small piece of it, okay? 135 00:06:35,520 --> 00:06:37,660 And fuzzing actually is kind of gray boxy. 136 00:06:37,660 --> 00:06:38,200 I mentioned that. 137 00:06:38,360 --> 00:06:40,320 And there's a lot of other testing that should take place. 138 00:06:40,440 --> 00:06:42,460 Unit, integration, blah, blah, blah, blah, blah, blah. 139 00:06:43,220 --> 00:06:48,420 So is fuzzing better than reverse engineering? 140 00:06:49,220 --> 00:06:51,940 Is fuzzing better than source code auditing? 141 00:06:52,800 --> 00:06:54,760 Is fuzzing better than gambling? 142 00:06:55,060 --> 00:06:55,800 I don't know. 143 00:06:55,800 --> 00:06:57,020 I think so. 144 00:06:57,260 --> 00:06:59,260 But I'm a little biased there. 145 00:06:59,480 --> 00:07:00,680 So the answer is no. 146 00:07:00,860 --> 00:07:01,260 It's not. 147 00:07:01,580 --> 00:07:02,020 Okay? 148 00:07:02,160 --> 00:07:03,020 It's really not. 149 00:07:03,160 --> 00:07:04,460 It just supplements all those things. 150 00:07:04,580 --> 00:07:05,680 You should still reverse engineer. 151 00:07:05,840 --> 00:07:07,040 You still need source code audits. 152 00:07:07,260 --> 00:07:08,560 You still need testing. 153 00:07:08,720 --> 00:07:11,900 You still need pen tests for a lot of reasons. 154 00:07:12,140 --> 00:07:17,640 And one of those reasons is probably fairly obvious in that fuzzing is not a catch-all solution. 155 00:07:17,880 --> 00:07:20,640 It doesn't work against every kind of app. 156 00:07:20,740 --> 00:07:25,780 If you have this special Java web thingy and you want to see, can I go from logic to fuzzing? 157 00:07:25,780 --> 00:07:28,840 Can I log in PHP to logged in PHP? 158 00:07:29,520 --> 00:07:31,860 Fuzzing doesn't really do a lot for you there, right? 159 00:07:31,960 --> 00:07:33,560 That's more of a pen test kind of thing. 160 00:07:33,860 --> 00:07:37,180 Sending random data to that might help you. 161 00:07:37,260 --> 00:07:39,600 And actually, we'll talk a little bit about how that could be interesting. 162 00:07:39,860 --> 00:07:47,000 But traditionally, especially if you're looking for memory corruption bugs, which are still the majority of all the bugs out there. 163 00:07:47,080 --> 00:07:50,660 Buffer overflows, heap overflows, stack overflows, pointer overflows. 164 00:07:50,860 --> 00:07:53,920 You know, all these kinds of corruption, memory corruption type errors. 165 00:07:54,140 --> 00:07:55,760 In C or C++ apps. 166 00:07:55,760 --> 00:07:56,760 That's where the goodies are. 167 00:07:56,940 --> 00:08:04,200 And if you have a server that was written in C that runs on a box that doesn't have any heap and stack protection and all this kind of stuff. 168 00:08:04,640 --> 00:08:07,360 Fuzz it because I guarantee you'll find an ODE in it. 169 00:08:08,120 --> 00:08:09,540 Well, not guarantee it. 170 00:08:09,600 --> 00:08:12,280 But there's a good chance there's probably some bug in there somewhere. 171 00:08:12,600 --> 00:08:15,980 Okay, so there's a lot of people that have been doing fuzzing for a lot of years actually. 172 00:08:16,120 --> 00:08:21,780 And when Miller first did this thing 16 years ago in 1990, I don't know if anybody really cared about his research. 173 00:08:21,900 --> 00:08:23,320 He didn't get much academic respect. 174 00:08:23,700 --> 00:08:25,080 Because all he really did. 175 00:08:25,080 --> 00:08:31,660 Was basically take a random stream generator and pump those bytes to like LS and other Unix utilities. 176 00:08:32,280 --> 00:08:35,500 And it was sort of like everyone in the academic community was like, wow, that's kind of lame. 177 00:08:35,900 --> 00:08:37,220 But it was amazing. 178 00:08:37,460 --> 00:08:41,080 He like crashed like half the apps on all the Unix boxes at the time. 179 00:08:41,420 --> 00:08:43,680 So things have gotten better since then. 180 00:08:43,740 --> 00:08:45,420 You can't just send truly random stuff anymore. 181 00:08:45,520 --> 00:08:46,740 It won't help you a whole lot these days. 182 00:08:46,760 --> 00:08:47,020 It could. 183 00:08:47,660 --> 00:08:51,340 But it's been, fuzzing has been effective for a long time. 184 00:08:51,400 --> 00:08:53,380 And we just saw the month of browser bugs, right? 185 00:08:53,440 --> 00:08:53,960 We all know that. 186 00:08:53,960 --> 00:08:55,820 So fuzzing is doing its thing still. 187 00:08:55,900 --> 00:08:56,700 It's alive and kicking. 188 00:08:57,500 --> 00:08:58,780 I'm making a living doing it. 189 00:08:58,840 --> 00:08:59,880 So, yeah. 190 00:09:01,400 --> 00:09:01,800 Okay. 191 00:09:01,920 --> 00:09:04,080 So who does this fuzzing thing? 192 00:09:04,320 --> 00:09:06,400 Software companies ought to be doing this. 193 00:09:06,500 --> 00:09:07,460 And I think they are now. 194 00:09:07,540 --> 00:09:09,160 Probably starting about a year ago. 195 00:09:09,340 --> 00:09:12,700 They really jumped on this bandwagon and said, hey, we're getting killed. 196 00:09:12,980 --> 00:09:14,980 The bad guys are, they're fuzzing. 197 00:09:15,040 --> 00:09:15,760 And they're finding bugs. 198 00:09:16,000 --> 00:09:18,120 And we got like a multi-billion dollar budget. 199 00:09:18,220 --> 00:09:18,980 And we're not finding them. 200 00:09:19,040 --> 00:09:19,380 What's up? 201 00:09:19,460 --> 00:09:20,200 So they're fuzzing. 202 00:09:21,520 --> 00:09:23,020 Vulnerability analysts are fuzzing. 203 00:09:24,000 --> 00:09:27,400 So fuzzing companies are creating fuzzers to sell. 204 00:09:27,660 --> 00:09:27,920 Okay? 205 00:09:28,000 --> 00:09:30,980 I don't know exactly how many fuzzer companies are out there. 206 00:09:31,840 --> 00:09:32,780 There are some. 207 00:09:32,840 --> 00:09:36,540 I'll talk a little bit about Codynamicon in Finland just briefly. 208 00:09:36,860 --> 00:09:39,500 They do some good academic work at Ulu. 209 00:09:39,640 --> 00:09:40,700 So there's academic work. 210 00:09:40,880 --> 00:09:42,200 I'm doing that too. 211 00:09:42,360 --> 00:09:43,140 And there's hackers. 212 00:09:43,880 --> 00:09:44,620 Lord knows. 213 00:09:46,580 --> 00:09:51,100 So fuzzers are built, bottom line, end of intro, because they work. 214 00:09:51,260 --> 00:09:51,640 Okay? 215 00:09:53,080 --> 00:09:54,880 But the question is, how do they work? 216 00:09:56,460 --> 00:10:01,940 And, okay, so at the bottom of this slide, you see there's this thing called attack surface. 217 00:10:02,220 --> 00:10:03,200 So a program is big. 218 00:10:03,320 --> 00:10:04,640 Most programs are pretty big, right? 219 00:10:04,700 --> 00:10:09,480 And I talked about that mythical program that read a config file and there was an error in it and stuff like that. 220 00:10:09,720 --> 00:10:12,760 That could be considered part of maybe like the local attack surface. 221 00:10:12,920 --> 00:10:14,740 Maybe not, depending on how that exactly worked. 222 00:10:14,960 --> 00:10:18,300 There's definitely an attack surface from an external point of view, right? 223 00:10:18,360 --> 00:10:20,360 And that's the one that's most interesting for remote vulnerabilities. 224 00:10:20,360 --> 00:10:26,320 There's this bit of code and there's the parsers that are in that code that read the traffic that comes remotely. 225 00:10:26,500 --> 00:10:28,060 That's the attack surface I'm talking about. 226 00:10:28,160 --> 00:10:28,960 There could be an attack surface. 227 00:10:30,140 --> 00:10:36,120 Jesse Burns gave a talk at Black Hat talking about the interprocess communication attack surface. 228 00:10:36,320 --> 00:10:40,220 There's an attack surface there between programs within a box and there's local attacks. 229 00:10:40,460 --> 00:10:42,500 So figure out what your attack surface is. 230 00:10:43,260 --> 00:10:47,660 And then the second most important part, and I think it's kind of overlooked, 231 00:10:47,740 --> 00:10:49,800 because we all know we've got this source data 232 00:10:50,360 --> 00:10:52,640 that we have to become fuzzy that we somehow deliver to an application. 233 00:10:53,080 --> 00:10:54,000 We know that, right? 234 00:10:54,060 --> 00:10:54,640 We got that down. 235 00:10:55,820 --> 00:11:02,460 But the other part is how do we monitor the application to make sure that we notice when something bad happens? 236 00:11:02,600 --> 00:11:04,260 And that's actually a really tough problem. 237 00:11:04,460 --> 00:11:08,800 It's not just, you know, run something and hope it dumps core. 238 00:11:09,060 --> 00:11:09,960 That's what it used to be. 239 00:11:10,060 --> 00:11:11,000 That's not what it is anymore. 240 00:11:11,280 --> 00:11:14,240 You can still do that, actually, and that still works in certain cases. 241 00:11:14,320 --> 00:11:15,000 But it's getting tougher. 242 00:11:15,540 --> 00:11:17,500 One way is to attach a debugger, okay? 243 00:11:17,660 --> 00:11:19,280 You start the process in a debugger. 244 00:11:20,360 --> 00:11:22,840 It's tricky, too, because some processes are really hard to start in a debugger. 245 00:11:22,860 --> 00:11:25,300 At the end of this, I'm going to give a demo on a tool that I wrote. 246 00:11:25,640 --> 00:11:27,840 And I'm going to, it's on DoveCod. 247 00:11:28,020 --> 00:11:30,320 DoveCod's the application I'm going to run GPF against. 248 00:11:30,580 --> 00:11:31,300 GPF's the fuzzer. 249 00:11:31,360 --> 00:11:32,360 I wrote General Purpose Fuzzer. 250 00:11:33,260 --> 00:11:37,080 So, and show a bug in that, multiple bugs in that, actually. 251 00:11:37,300 --> 00:11:43,980 And it's really hard to start DoveCod in GDB because, like, the parent process starts 252 00:11:43,980 --> 00:11:48,500 and it starts like an auth process, which starts like three children process for each protocol. 253 00:11:49,060 --> 00:11:50,120 And if any of them die, 254 00:11:50,360 --> 00:11:52,620 that parent will just kick them off and restart them, the whole thing. 255 00:11:52,840 --> 00:11:57,280 So, it's a little tricky to just, quote, unquote, start DoveCod in GDB. 256 00:11:58,520 --> 00:12:00,140 So, you can monitor logs. 257 00:12:00,900 --> 00:12:04,360 You can, you know, application logs, system logs. 258 00:12:04,640 --> 00:12:05,760 I'm just going to be doing it two ways. 259 00:12:05,880 --> 00:12:11,080 I'll actually show that it dumps core because I do ulimit-c unlimited to get to dump core. 260 00:12:11,700 --> 00:12:16,600 And also, by tailing the var log, we'll see a message in the mail log itself. 261 00:12:16,840 --> 00:12:18,120 But there's a lot of different ways. 262 00:12:18,120 --> 00:12:21,020 And one final note about the debugger that was really interesting. 263 00:12:21,180 --> 00:12:23,580 You guys maybe noticed that there was a sendmail bug this year. 264 00:12:24,040 --> 00:12:26,920 Well, that was actually a timing issue, a race condition. 265 00:12:27,340 --> 00:12:31,720 And if you attach a debugger to it, okay, to monitor and try and find this bug, 266 00:12:31,900 --> 00:12:34,620 you really can't find it because it screws up the race condition, right? 267 00:12:34,680 --> 00:12:37,940 The debugger changes the timing of race conditions in some cases. 268 00:12:38,060 --> 00:12:44,060 So, you can't even unilaterally say that we'll just start it in the debugger and fuzz and find bugs, right? 269 00:12:44,220 --> 00:12:46,860 So, okay, enough said on that. 270 00:12:48,360 --> 00:12:51,440 Okay, so, again, one more sort of intro slide. 271 00:12:51,620 --> 00:12:52,820 So, why do they work again? 272 00:12:53,140 --> 00:12:54,500 Well, a few reasons. 273 00:12:54,640 --> 00:12:58,880 There's this general goal of QA guys to do functional testing in the past. 274 00:12:59,020 --> 00:13:00,160 I think this has definitely changed now. 275 00:13:00,340 --> 00:13:03,500 But in the past, QA was like, does our program work like it's supposed to? 276 00:13:04,040 --> 00:13:06,980 And the hackers were like, I don't know how this program works. 277 00:13:07,080 --> 00:13:08,620 I don't care how this program works. 278 00:13:08,680 --> 00:13:10,300 I want to find a buffer overflow, right? 279 00:13:10,660 --> 00:13:13,620 So, there was a definite difference in approach and goal. 280 00:13:13,740 --> 00:13:16,000 And that made, you know, two different approaches, two different results. 281 00:13:16,100 --> 00:13:17,300 Not terribly surprising, right? 282 00:13:18,300 --> 00:13:23,180 And part of that is sort of what I call gap coverage, which is like, even if that wasn't true, 283 00:13:24,160 --> 00:13:27,360 internally, we bought this really expensive fuzzer on Microsoft. 284 00:13:27,480 --> 00:13:29,160 We paid a million dollars for a fuzzer. 285 00:13:29,220 --> 00:13:30,040 And it rocks. 286 00:13:30,320 --> 00:13:33,400 You know, it found like 99 of 100 bugs. 287 00:13:33,680 --> 00:13:38,340 And here I am, maybe I'm this like lame-o hacker and I wrote this fuzzer and it sucks. 288 00:13:39,220 --> 00:13:41,640 But it doesn't really matter because it found one bug. 289 00:13:41,840 --> 00:13:43,460 And that bug was exploitable, okay? 290 00:13:43,560 --> 00:13:44,280 So, you see what I'm saying? 291 00:13:44,340 --> 00:13:46,300 There's a notion of a gap, that the tools are different. 292 00:13:46,400 --> 00:13:48,100 And because of that, you can still find bugs. 293 00:13:48,120 --> 00:13:50,300 Even if your fuzzer isn't uber cool. 294 00:13:51,060 --> 00:13:53,460 So, and the other deal is code coverage. 295 00:13:54,020 --> 00:13:59,460 I just like to talk about this because it's interesting from kind of an academic, excuse me, standpoint. 296 00:13:59,980 --> 00:14:05,080 Which is basically like in the past, QA guys were given sort of like incentives or bonuses. 297 00:14:05,220 --> 00:14:10,300 Sort of like, our goal is to get 80% code coverage with your test tool suite against our product. 298 00:14:10,880 --> 00:14:15,260 If your tool achieves that, and the faster you achieve that, you can get a bonus or something like that. 299 00:14:15,380 --> 00:14:16,260 I don't know exactly how it works. 300 00:14:16,300 --> 00:14:17,400 I've actually never worked in QA. 301 00:14:17,400 --> 00:14:19,280 I'm sorry if I'm insulting the QA world. 302 00:14:19,500 --> 00:14:21,620 But, and so they would do that. 303 00:14:21,700 --> 00:14:24,020 They would write a tool that was based on just getting code coverage. 304 00:14:24,140 --> 00:14:25,720 They wanted to cover as much code as possible. 305 00:14:26,420 --> 00:14:29,700 But the problem, again, go back to format strings or anything else. 306 00:14:30,040 --> 00:14:33,580 Well, they went through that, the sprint F or whatever. 307 00:14:33,860 --> 00:14:35,760 But they didn't give it a percent N, right? 308 00:14:35,840 --> 00:14:36,500 So, it didn't crash. 309 00:14:36,800 --> 00:14:38,880 Because they didn't give it the right data when they got code coverage. 310 00:14:38,980 --> 00:14:42,920 So, code coverage tells us something very, very, very useful. 311 00:14:43,260 --> 00:14:45,000 But it only tells us half the battle. 312 00:14:45,080 --> 00:14:45,740 Which is this. 313 00:14:45,740 --> 00:14:50,060 If you cover something, you know that you've covered. 314 00:14:50,140 --> 00:14:53,840 But if you haven't covered it, then you haven't tested it and you certainly haven't found bugs. 315 00:14:53,980 --> 00:14:56,480 So, if you haven't covered it, it tells you that, right? 316 00:14:56,620 --> 00:14:57,700 It tells you that you haven't even tried. 317 00:14:58,040 --> 00:14:59,480 So, you need to get code coverage. 318 00:14:59,560 --> 00:15:00,900 Code coverage is a good metric. 319 00:15:01,060 --> 00:15:03,520 And it's an important metric to test against anything. 320 00:15:03,780 --> 00:15:04,920 Fuzzers, testing suites, whatever. 321 00:15:05,180 --> 00:15:06,800 But it doesn't tell the complete story. 322 00:15:06,960 --> 00:15:11,080 So, these guys marketing my fuzzer gets 80% code coverage and yours only gets 50. 323 00:15:11,800 --> 00:15:14,960 You know, it doesn't really, okay, well, let's think about that. 324 00:15:14,960 --> 00:15:16,360 It doesn't necessarily tell the whole story. 325 00:15:16,480 --> 00:15:17,280 It does tell us something, though. 326 00:15:17,420 --> 00:15:17,820 Okay, so. 327 00:15:19,640 --> 00:15:21,520 General fuzzing types of tools. 328 00:15:22,680 --> 00:15:26,760 There's generation fuzzers, which is what the majority of fuzzers I think out there are. 329 00:15:26,840 --> 00:15:27,400 Which is this. 330 00:15:28,300 --> 00:15:30,780 I make an FTP product, say. 331 00:15:31,020 --> 00:15:32,060 I want to test it. 332 00:15:32,300 --> 00:15:34,340 I buy an FTP fuzzer. 333 00:15:34,480 --> 00:15:35,580 It fuzzes FTP. 334 00:15:35,940 --> 00:15:37,060 It finds three bugs. 335 00:15:37,280 --> 00:15:37,820 I fix them. 336 00:15:37,940 --> 00:15:38,540 I run it again. 337 00:15:38,680 --> 00:15:39,200 They're not there. 338 00:15:39,220 --> 00:15:39,920 Regression testing. 339 00:15:40,060 --> 00:15:40,560 The whole thing. 340 00:15:40,640 --> 00:15:41,120 That works. 341 00:15:41,260 --> 00:15:41,480 Okay? 342 00:15:41,480 --> 00:15:47,480 The other type is mutation or capture replay, which is sort of like I use ethereal. 343 00:15:47,860 --> 00:15:50,480 I capture any session, whatever. 344 00:15:51,080 --> 00:15:51,960 And I'll talk about this. 345 00:15:52,000 --> 00:15:52,760 This is my tool that I wrote. 346 00:15:52,840 --> 00:15:53,860 GPF is kind of like this. 347 00:15:54,060 --> 00:15:56,620 You can capture FTP, whatever. 348 00:15:57,340 --> 00:15:59,100 And then you can replay that, right? 349 00:15:59,220 --> 00:16:01,800 And you can replay it with faults injected in certain spots. 350 00:16:01,960 --> 00:16:05,520 And if it's a cryptographic protocol, you can't just replay it directly, right? 351 00:16:05,580 --> 00:16:09,520 You need some user function that lets it know, hey, when you do this, you do a hash. 352 00:16:09,660 --> 00:16:10,360 And it's kind of complex. 353 00:16:10,360 --> 00:16:14,280 Actually, Ike's not a real good one to use for mutation, which is why I actually wrote 354 00:16:14,280 --> 00:16:15,380 an Ike fuzzer, too, separately. 355 00:16:15,500 --> 00:16:18,400 Because Ike is a tough nut to crack with a general purpose. 356 00:16:18,520 --> 00:16:19,220 But it can be done. 357 00:16:19,960 --> 00:16:22,900 And general purposes are great against a lot of other protocols, too. 358 00:16:23,020 --> 00:16:24,100 And hopefully we'll see that. 359 00:16:24,160 --> 00:16:25,460 There's fuzzing frameworks. 360 00:16:26,120 --> 00:16:26,640 You know? 361 00:16:26,720 --> 00:16:29,520 And there's old-school, straight-up random generators. 362 00:16:30,740 --> 00:16:32,460 And, yeah, there's a lot of different kinds. 363 00:16:32,580 --> 00:16:37,800 So of the categories, how do they create this semi-valid, or some people call it semi-invalid. 364 00:16:37,840 --> 00:16:38,740 It's the same word. 365 00:16:38,780 --> 00:16:40,340 It basically means, like, most of the stuff. 366 00:16:40,360 --> 00:16:41,280 And the protocol is right. 367 00:16:42,440 --> 00:16:42,800 Okay? 368 00:16:42,860 --> 00:16:43,320 And that's key. 369 00:16:43,860 --> 00:16:46,380 That the rate of faults be relatively low. 370 00:16:46,540 --> 00:16:51,620 Because if all your stuff is totally random, you'll never make it past, like, leg one of 371 00:16:51,620 --> 00:16:52,180 the protocol, right? 372 00:16:52,220 --> 00:16:53,040 I showed that little example. 373 00:16:53,180 --> 00:16:53,800 Client said this. 374 00:16:53,920 --> 00:16:54,560 Server said this. 375 00:16:54,620 --> 00:16:55,240 Client said this. 376 00:16:55,260 --> 00:16:55,760 Server said this. 377 00:16:55,820 --> 00:16:59,600 Well, if all you ever send is totally random junk in leg one, the server is just going 378 00:16:59,600 --> 00:17:00,300 to boot you, right? 379 00:17:00,380 --> 00:17:01,040 You're going to get reset. 380 00:17:01,200 --> 00:17:02,720 And you'll never make it into the further legs. 381 00:17:02,980 --> 00:17:08,860 So if you want to fuzz, like, the 20th leg of some arbitrary protocol, 19 of those 20 382 00:17:08,860 --> 00:17:10,280 steps need to be exactly right. 383 00:17:10,360 --> 00:17:10,820 Okay? 384 00:17:10,980 --> 00:17:15,580 So you can see that the rate of faults need to be fairly low in general when you're fuzzing. 385 00:17:16,720 --> 00:17:20,660 So to create these faults, you could just randomly do it. 386 00:17:20,780 --> 00:17:20,880 You know? 387 00:17:20,920 --> 00:17:26,060 You could say, pick a random leg, pick a random position on that leg, pick some random data 388 00:17:26,420 --> 00:17:29,060 of a random size with some random bytes and stick it in. 389 00:17:29,180 --> 00:17:30,300 And that actually works fairly well. 390 00:17:30,400 --> 00:17:30,880 It's kind of cool. 391 00:17:31,880 --> 00:17:33,160 You know, maybe you don't want to do that. 392 00:17:33,200 --> 00:17:36,720 Maybe you want to be very cyclic, very deterministic in exactly how this thing runs. 393 00:17:37,260 --> 00:17:39,960 I want to fuzz every byte of every variable. 394 00:17:40,360 --> 00:17:41,880 Variables are basically like what we saw. 395 00:17:42,000 --> 00:17:45,340 Like, it was user, space, password, you know, line ending. 396 00:17:45,440 --> 00:17:46,960 All those pieces are considered a variable. 397 00:17:47,180 --> 00:17:48,880 String, delimiter, string, line ending. 398 00:17:49,960 --> 00:17:54,540 You could say, for every string, pick a spot in the middle and insert one to 10,000 bytes 399 00:17:54,540 --> 00:17:55,920 by one using every byte. 400 00:17:56,060 --> 00:17:56,240 Okay? 401 00:17:56,300 --> 00:17:57,120 That's deterministic. 402 00:17:57,140 --> 00:17:57,880 It could run forever. 403 00:17:58,300 --> 00:17:58,900 All right? 404 00:17:58,960 --> 00:18:03,100 And that gets into this whole, like, infinite run time deal if you talk about true randomness. 405 00:18:04,120 --> 00:18:06,660 So, and library is a good one. 406 00:18:06,780 --> 00:18:07,780 Test cases is a good one. 407 00:18:07,800 --> 00:18:09,180 Library is kind of like, I have this list. 408 00:18:09,280 --> 00:18:10,340 I have 10,000 naughty strings. 409 00:18:10,360 --> 00:18:10,920 I have 10,000 strings that I like. 410 00:18:10,980 --> 00:18:11,420 One's big. 411 00:18:11,540 --> 00:18:12,340 One has format stuff. 412 00:18:12,540 --> 00:18:13,220 One has whatever. 413 00:18:13,380 --> 00:18:13,900 One has hacks. 414 00:18:14,240 --> 00:18:14,740 You know? 415 00:18:14,760 --> 00:18:17,700 And I just replace each variable on the line with a string from my library. 416 00:18:17,820 --> 00:18:18,120 That's good. 417 00:18:18,220 --> 00:18:18,980 That works really well. 418 00:18:19,580 --> 00:18:21,840 Test cases are, a lot of the ones for sale do this. 419 00:18:21,900 --> 00:18:25,040 They're like, sort of like, my tool has 10,000 cases against FTP. 420 00:18:25,680 --> 00:18:27,520 How many test cases does your tool have? 421 00:18:27,900 --> 00:18:31,760 You know, so you can, you can have, like, a number of already preset test cases. 422 00:18:31,880 --> 00:18:32,400 You run it. 423 00:18:32,400 --> 00:18:32,960 You run it again. 424 00:18:33,120 --> 00:18:33,880 That same kind of deal. 425 00:18:33,960 --> 00:18:36,060 There's a lot of different ways to do this. 426 00:18:36,240 --> 00:18:37,520 And a lot of them are really good. 427 00:18:37,760 --> 00:18:38,120 So. 428 00:18:40,020 --> 00:18:41,520 Funny stories about fuzzing. 429 00:18:42,040 --> 00:18:46,520 I was, I was talking to Dan Kaminski at lunch, day two, black hat. 430 00:18:46,680 --> 00:18:49,220 And I told him, hey, I do fuzzing, too. 431 00:18:49,300 --> 00:18:50,020 I'm giving a talk on that. 432 00:18:50,040 --> 00:18:51,060 And he does fuzzing, too. 433 00:18:51,240 --> 00:18:53,160 And he's like, dumb or smart? 434 00:18:53,720 --> 00:18:54,920 And I'm like, hmm, well. 435 00:18:55,120 --> 00:18:56,000 I knew what he meant. 436 00:18:56,140 --> 00:18:56,320 Okay? 437 00:18:56,380 --> 00:19:00,060 Because I've been in this, I've been fuzzing long enough to know what he was asking. 438 00:19:00,300 --> 00:19:01,580 But it's kind of a strange question. 439 00:19:01,840 --> 00:19:04,660 A lot of people ask, ask, ask that. 440 00:19:04,820 --> 00:19:05,860 Is it intelligent fuzzing? 441 00:19:06,040 --> 00:19:06,960 Is it dumb fuzzing? 442 00:19:07,000 --> 00:19:07,920 And dumb doesn't necessarily. 443 00:19:08,120 --> 00:19:11,540 Doesn't necessarily have any negative connotation like your fuzzer is dumb and mine is intelligent. 444 00:19:12,120 --> 00:19:14,580 It doesn't have the connotation that one is worse than the other. 445 00:19:14,640 --> 00:19:19,240 What it really means is dumb means more randomness and smart means less randomness. 446 00:19:19,380 --> 00:19:21,700 And either extreme, sort of like in politics, right? 447 00:19:21,760 --> 00:19:25,260 If you're way on the left or way on the right, you know, you can get lost. 448 00:19:25,580 --> 00:19:28,560 But if you're sort of that line of holiness right down the middle that we're looking for. 449 00:19:28,680 --> 00:19:29,980 And fuzzing is kind of the same way. 450 00:19:30,640 --> 00:19:35,980 If your fuzzer knows too much about the protocol, that means it follows the RFC exactly and does everything exactly right. 451 00:19:36,060 --> 00:19:37,480 I never expect more than 200 bytes here. 452 00:19:37,480 --> 00:19:38,720 So I never send more than 200 bytes. 453 00:19:38,840 --> 00:19:40,200 Well, then you're not really fuzzing, right? 454 00:19:40,260 --> 00:19:40,960 You just have a client. 455 00:19:41,620 --> 00:19:46,560 And if it's totally dumb, totally random, we already talked about run times infinite and you're not going to get anywhere fast. 456 00:19:46,780 --> 00:19:48,020 So you want something in the middle. 457 00:19:48,660 --> 00:19:49,720 Faults relatively low. 458 00:19:49,820 --> 00:19:50,560 We've talked about that. 459 00:19:52,460 --> 00:19:57,860 So the question here is which fuzzer of all those that we just talked about is better? 460 00:19:58,240 --> 00:19:58,640 Commercial? 461 00:19:59,580 --> 00:20:00,380 Open source? 462 00:20:02,500 --> 00:20:02,900 Generation? 463 00:20:04,560 --> 00:20:04,960 Generic? 464 00:20:05,940 --> 00:20:08,020 There's actually really no research done on this. 465 00:20:08,080 --> 00:20:12,080 And it would actually be a really good research problem if somebody else was looking to pick up a Ph.D. in fuzzing. 466 00:20:12,320 --> 00:20:14,020 This would be a great problem. 467 00:20:14,280 --> 00:20:16,500 I mean, code coverage, for instance, could be a metric. 468 00:20:16,640 --> 00:20:19,400 You could say, well, one fuzzer gets better code coverage than the other. 469 00:20:19,480 --> 00:20:22,720 But like we talked about, that doesn't give you a complete picture. 470 00:20:23,760 --> 00:20:24,120 Okay? 471 00:20:24,220 --> 00:20:26,200 And you could say, well, number of bugs it finds. 472 00:20:27,540 --> 00:20:29,020 That's actually a fairly good metric. 473 00:20:29,100 --> 00:20:33,500 But it's fairly hard to determine against software that hasn't been tested yet because you really don't know if there's bugs or not. 474 00:20:33,620 --> 00:20:33,720 Right? 475 00:20:33,720 --> 00:20:35,780 So you could take software. 476 00:20:35,980 --> 00:20:40,160 You could maybe write software that only one person knew of the bugs that are in it. 477 00:20:40,480 --> 00:20:44,160 And the people that are fuzzing don't know where these bugs will be. 478 00:20:44,260 --> 00:20:45,680 And you could maybe have kind of a shootout. 479 00:20:45,740 --> 00:20:46,840 That would actually be pretty sweet. 480 00:20:47,400 --> 00:20:48,100 Nobody's done that. 481 00:20:49,760 --> 00:20:50,160 Okay. 482 00:20:50,280 --> 00:20:52,400 So that's all the intro stuff. 483 00:20:52,760 --> 00:20:55,180 And we're going to go into context-free grammars. 484 00:20:55,220 --> 00:20:56,720 I'm not a context-free grammar expert. 485 00:20:57,560 --> 00:20:58,340 I admit that. 486 00:20:59,060 --> 00:21:01,400 I've never written a fuzzer that uses context-free grammars. 487 00:21:01,400 --> 00:21:05,220 But the people at ULU University Secure Programming Group came up with Protos. 488 00:21:05,280 --> 00:21:07,780 I know you guys have probably heard about that if you've been fuzzing for a while. 489 00:21:08,380 --> 00:21:10,580 And they did some really good research on that. 490 00:21:10,660 --> 00:21:19,160 And I'm just kind of going to blow through this pretty quickly and not really talk about how, you know, the BNF language and all that stuff works. 491 00:21:20,200 --> 00:21:21,660 But basically here's an example. 492 00:21:21,880 --> 00:21:26,920 You can properly and completely define a protocol using context-free grammars. 493 00:21:26,960 --> 00:21:28,520 Like transfer is a read or a write. 494 00:21:29,060 --> 00:21:31,160 A read is a read request and a reads. 495 00:21:31,660 --> 00:21:34,680 A read request is a null or a one, a file name. 496 00:21:34,800 --> 00:21:35,980 A file name is a character. 497 00:21:36,100 --> 00:21:37,880 A character is a one through seven F. 498 00:21:38,000 --> 00:21:38,040 Right? 499 00:21:38,140 --> 00:21:38,740 You can, you can. 500 00:21:38,920 --> 00:21:45,760 And if you want to write a fuzzer that does context-free grammar fuzzing, you could say basically do this right thing or do this bad thing. 501 00:21:45,960 --> 00:21:47,540 So here's the, here's the description. 502 00:21:47,740 --> 00:21:48,100 It's normal. 503 00:21:48,200 --> 00:21:50,460 But 30% of the time do this thing that's not normal. 504 00:21:50,560 --> 00:21:50,740 Okay. 505 00:21:50,800 --> 00:21:55,280 And you can just iteratively define a protocol with those kind of faults injected in that way. 506 00:21:55,320 --> 00:21:57,640 And that's actually a really, a really good way to do it. 507 00:22:01,400 --> 00:22:04,460 So Protos talks a little bit about their, their interface roundup. 508 00:22:04,480 --> 00:22:05,560 There's a lot of data on this slide. 509 00:22:05,660 --> 00:22:07,520 My slides are on AppliedSec.com. 510 00:22:07,560 --> 00:22:10,500 My tools, my slides, my paper, everything's there. 511 00:22:11,560 --> 00:22:12,400 Go grab it. 512 00:22:12,440 --> 00:22:16,700 In fact, you want to grab my tool off AppliedSec.com, not off the DEF CON CD because it's slightly updated. 513 00:22:18,000 --> 00:22:26,240 So one of the things that I liked about the third point of this limitation of vulnerability testing is what I talked about earlier that not everything can be monitored. 514 00:22:26,560 --> 00:22:31,340 It's really, I think, somewhat impossible to monitor the server in every scenario. 515 00:22:31,400 --> 00:22:33,160 If you attach a debugger, you could miss a race condition. 516 00:22:33,440 --> 00:22:35,760 If you don't attach a debugger, you're probably going to miss some other bugs. 517 00:22:35,980 --> 00:22:39,460 If you're just looking at logs, maybe it doesn't generate logs all the time in certain scenarios. 518 00:22:40,180 --> 00:22:46,040 If you're looking at CPU utilization, memory utilization, you can catch some kind of runaway integer. 519 00:22:46,300 --> 00:22:48,140 You know, there's a lot of different ways you can monitor the process. 520 00:22:48,320 --> 00:22:52,660 And ideally, you do it all, particularly if you're serious about finding bugs in some given app. 521 00:22:54,660 --> 00:22:59,920 And I like this just because you talk about, like, biology kind of mixing into the computer science world. 522 00:22:59,920 --> 00:23:05,660 They talk about their tool having basically a pesticide paradox against given software. 523 00:23:05,760 --> 00:23:10,560 That is, if they have a SMTP fuzzer, they run it against a SMTP server. 524 00:23:10,780 --> 00:23:11,740 It finds 10 bugs. 525 00:23:11,940 --> 00:23:13,020 You fix the 10 bugs. 526 00:23:13,120 --> 00:23:13,660 You run it again. 527 00:23:13,740 --> 00:23:14,120 They're gone. 528 00:23:14,200 --> 00:23:14,880 That software's immune. 529 00:23:15,420 --> 00:23:15,860 Okay? 530 00:23:15,880 --> 00:23:17,000 And all tools are like that. 531 00:23:18,000 --> 00:23:25,840 And one of the cool things about, like, my tool in interjecting randomness is it has a seed for that random value, right? 532 00:23:25,920 --> 00:23:28,540 So in my tool, you seed it, and there's definitely randomness throughout. 533 00:23:28,540 --> 00:23:33,180 And if you want to replay that exact session again for regression testing, use the same seed. 534 00:23:33,400 --> 00:23:38,520 But if you want it to be randomly differently, seed it differently, and you can potentially maybe get some different results. 535 00:23:38,940 --> 00:23:44,640 So, you know, there's varying mileage varies, sort of, so to speak, on that kind of stuff. 536 00:23:44,800 --> 00:23:51,500 So into a little more of my specialty and where kind of some of my research has gone is in generic fuzzing, 537 00:23:51,600 --> 00:23:53,720 which is general-purpose fuzzing. 538 00:23:53,960 --> 00:23:58,060 There's another guy that wrote a tool, Martin Bugnaud, called Otto DeFe that I'll talk about. 539 00:23:58,540 --> 00:24:01,440 That he has not released yet, but apparently intends to do so. 540 00:24:03,080 --> 00:24:05,760 So automatic protocol detection, that's what I talked about before. 541 00:24:05,960 --> 00:24:07,280 Capture session with ethereal. 542 00:24:07,940 --> 00:24:09,200 Convert it to a neutral format. 543 00:24:09,420 --> 00:24:13,700 That's a good thing to do, because libpcap files are not all that easy to manually modify. 544 00:24:14,800 --> 00:24:16,920 Convert it to some text-looking format. 545 00:24:17,020 --> 00:24:18,920 Even if it's binary data, you can do this, all right? 546 00:24:18,980 --> 00:24:20,260 And you'll see that if you play with my tool. 547 00:24:20,760 --> 00:24:25,720 And, like, say you captured a stream of an FTP session, but, you know, you screwed up your login name or something like that. 548 00:24:25,720 --> 00:24:28,800 You can just change it in the file real quickly to the right password or the right username. 549 00:24:29,020 --> 00:24:34,880 You can get, obviously, different tests, different pass through the code, different coverage, 550 00:24:35,120 --> 00:24:39,440 depending on exactly how well your fuzzer understands the protocol. 551 00:24:39,580 --> 00:24:45,120 How much protocol knowledge and how many various iterations through different state spaces that it transfers. 552 00:24:45,240 --> 00:24:47,660 So that's a nice thing to have, the ability to do that. 553 00:24:47,760 --> 00:24:48,640 And I use that all the time. 554 00:24:48,740 --> 00:24:53,660 In fact, sometimes, if the protocol is simple, like in the case of the example I'll show you with IMAP, 555 00:24:53,800 --> 00:24:55,700 fuzzing dovecats. 556 00:24:55,720 --> 00:24:56,880 I didn't even capture a session. 557 00:24:57,040 --> 00:25:03,880 I just created a quick protocol description in a text file the way that the GPF expects to see it. 558 00:25:04,000 --> 00:25:05,600 And you can just fuzz directly from there with it. 559 00:25:05,680 --> 00:25:06,920 You just sort of give it the protocol knowledge. 560 00:25:07,220 --> 00:25:09,680 And it's very simple because the bugs I found are pre-login. 561 00:25:09,720 --> 00:25:14,840 So I just gave it basically the 12 valid IMAP commands or something like that and told it to go to town, right? 562 00:25:14,960 --> 00:25:18,300 So there's ways that that can just be really. 563 00:25:18,420 --> 00:25:22,480 And good generic fuzzers should be able to, based on any given capture, 564 00:25:22,980 --> 00:25:25,640 should be able to fuzz either in the server direction or the client. 565 00:25:25,720 --> 00:25:26,800 Both are important. 566 00:25:26,980 --> 00:25:28,860 It should be able to fuzz either way pretty easily. 567 00:25:30,320 --> 00:25:32,480 So attack heuristics, we've talked about that. 568 00:25:32,580 --> 00:25:34,320 Long strings, weird strings, format strings. 569 00:25:35,240 --> 00:25:36,840 Intelligent randomness we've talked about. 570 00:25:37,620 --> 00:25:41,620 The only thing about intelligent randomness is, again, going back to another, 571 00:25:41,820 --> 00:25:43,840 this would be another great research project, 572 00:25:43,980 --> 00:25:49,920 is basically that there has not been any research kind of trying to find where that holy line I talked about is. 573 00:25:50,000 --> 00:25:53,420 Nobody really knows where that is, how to weight exactly how often there should be faults 574 00:25:53,420 --> 00:25:54,580 or where there should be faults 575 00:25:54,580 --> 00:25:57,140 or how the faults are created, how much randomness. 576 00:25:57,440 --> 00:26:00,260 There's no definite research there. 577 00:26:00,340 --> 00:26:02,000 As of now, that's basically an art. 578 00:26:02,180 --> 00:26:06,260 There's no scientific data at all that I've seen that indicates what method may be preferred. 579 00:26:06,780 --> 00:26:10,380 So I weight it basically best I think it should be. 580 00:26:11,460 --> 00:26:14,800 Remote debugging is a sweet thing that Autodefay does. 581 00:26:15,100 --> 00:26:19,480 And that's basically like you've got your fuzzer fuzzing, say, a server or client, 582 00:26:19,660 --> 00:26:21,240 whichever direction you want to think of it in. 583 00:26:21,540 --> 00:26:23,900 And you have this process that is a debugger 584 00:26:23,900 --> 00:26:27,080 that attaches to the process, but it's also communicating with the fuzzer, right? 585 00:26:27,180 --> 00:26:28,760 So you're getting this backend knowledge. 586 00:26:29,180 --> 00:26:30,280 Hey, something just happened. 587 00:26:30,420 --> 00:26:30,960 It's signal 11. 588 00:26:31,100 --> 00:26:32,320 Let's log it and let's keep fuzzing. 589 00:26:32,440 --> 00:26:35,200 Like there's this cool stuff you can do with remote debugging. 590 00:26:35,260 --> 00:26:36,120 Really, really good stuff. 591 00:26:37,720 --> 00:26:39,320 Dynamic weighting is another thing I'll talk about. 592 00:26:39,660 --> 00:26:43,920 And distributed fuzzing is kind of an idea I had that I've never actually seen played out anywhere. 593 00:26:44,040 --> 00:26:46,220 And you can do this a little bit with GPF. 594 00:26:46,280 --> 00:26:52,180 It has a super GPF mode that will basically start, you know, as many instances of GPF as you want. 595 00:26:52,180 --> 00:26:56,520 And it actually, it kind of like file fuzzes your capture file. 596 00:26:56,780 --> 00:27:02,140 And it sort of fuzzes the switches that GPF expects on the command line. 597 00:27:02,260 --> 00:27:06,560 So it starts a lot of strange instances against different captures that fuzz normally. 598 00:27:06,800 --> 00:27:07,980 So it's really kind of wild. 599 00:27:08,140 --> 00:27:12,200 The problem with that is it's really hard to identify when an error has occurred. 600 00:27:12,320 --> 00:27:16,080 If you have a thousand versions of a fuzzer sending a thousand packets a second 601 00:27:16,080 --> 00:27:21,240 and you're not doing some sort of remote debugging or some sort of logging of when exactly a fault occurs, 602 00:27:22,180 --> 00:27:27,440 or even if you are, if you have some second generation bugs or a heat bug. 603 00:27:27,980 --> 00:27:29,380 I talk about second generation. 604 00:27:29,560 --> 00:27:31,920 I'm talking about uninitialized stack or heat bugs. 605 00:27:32,100 --> 00:27:32,320 I don't know. 606 00:27:32,420 --> 00:27:35,380 Does anybody know what an uninitialized stack bug is? 607 00:27:35,520 --> 00:27:36,660 Raise your hand if you know what that is. 608 00:27:37,140 --> 00:27:38,040 So there's a few. 609 00:27:38,080 --> 00:27:40,680 There's a few hands out there that know what that kind of flaw is. 610 00:27:40,740 --> 00:27:45,680 It's kind of a cutting edge flaw which basically goes along the lines of 611 00:27:46,140 --> 00:27:50,780 somebody in their code just says like, you know, int i at the top of a routine or something. 612 00:27:50,780 --> 00:27:52,380 They don't say int i equals zero. 613 00:27:52,520 --> 00:27:55,560 So they don't actually manually initialize it. 614 00:27:55,700 --> 00:27:59,740 Well, suppose there's some routine in code and I've actually found one of these in the wild. 615 00:27:59,940 --> 00:28:04,580 Suppose there's some routine in code that goes through and there's a path where there's no bug 616 00:28:04,580 --> 00:28:10,080 but it just so happens you overwrite maybe by four bytes and you overwrite the initialization of some variable 617 00:28:10,760 --> 00:28:11,860 that gets later used. 618 00:28:11,980 --> 00:28:16,660 Then you start again from the top of this program and you're going through down this other path through the code 619 00:28:16,660 --> 00:28:19,900 and whoa, something crazy happens because that variable was initialized 620 00:28:19,900 --> 00:28:20,940 and the code didn't know that. 621 00:28:21,020 --> 00:28:22,320 It doesn't expect it to be initialized. 622 00:28:22,400 --> 00:28:23,940 It wasn't written for it to be initialized. 623 00:28:24,620 --> 00:28:29,560 So there's, you know, there's some really cool things that can be found with fuzzers 624 00:28:29,560 --> 00:28:36,440 but trying to track down exactly what data caused the fault and where it happened and how and why, 625 00:28:36,960 --> 00:28:37,700 it's tricky. 626 00:28:37,860 --> 00:28:41,120 It really is, especially if you've got some of this wild stuff happening, you know, 627 00:28:41,140 --> 00:28:45,360 and there's some weird bugs and it can definitely be kind of tricky. 628 00:28:48,480 --> 00:28:49,140 All right. 629 00:28:49,900 --> 00:28:50,020 We're running out of time. 630 00:28:50,340 --> 00:28:53,020 So briefly, web and file fuzzing. 631 00:28:53,940 --> 00:28:55,920 Basically, we'll talk just real quick. 632 00:28:56,060 --> 00:29:02,060 How is web fuzzing different than, say, fuzzing a standard C-type daemon? 633 00:29:02,140 --> 00:29:04,200 Well, basically, it's just this. 634 00:29:04,420 --> 00:29:09,400 If you're fuzzing an HTTP server like you want to find an ODA in Apache or IIS, well, good. 635 00:29:09,540 --> 00:29:11,880 I'm glad that you're looking at that and good luck to you. 636 00:29:12,900 --> 00:29:14,700 It's getting harder to find those, okay? 637 00:29:15,060 --> 00:29:18,660 That code set's getting better and I think we should still continue to look at it 638 00:29:18,660 --> 00:29:23,100 and there probably certainly will be bugs found in it but they're hard to find, very hard, okay? 639 00:29:23,200 --> 00:29:25,480 I think we can all agree to that now. 640 00:29:25,760 --> 00:29:32,480 But there's all kinds of these crappy PHP web apps for like myblogger.com or thing 641 00:29:32,480 --> 00:29:34,480 and they suck, all right? 642 00:29:34,600 --> 00:29:36,580 They are not written well at all. 643 00:29:36,980 --> 00:29:38,940 But the question is how do I find these? 644 00:29:39,320 --> 00:29:41,780 Has anybody heard of a file inclusion bug? 645 00:29:42,120 --> 00:29:42,940 You're looking for it? 646 00:29:43,000 --> 00:29:43,360 There's a few. 647 00:29:43,420 --> 00:29:45,040 File inclusion, you guys know what that is. 648 00:29:45,180 --> 00:29:48,360 So it's kind of a pen testing sort of thing trying to find bugs 649 00:29:48,360 --> 00:29:56,500 and web apps and a fuzzer that's just basically sending semi-valid data watching Apache, 650 00:29:56,960 --> 00:29:58,480 waiting to see Apache die. 651 00:29:59,160 --> 00:30:00,820 You're going to be waiting a while, okay? 652 00:30:01,660 --> 00:30:07,000 So because the web app is having all kinds of problems but you never see it by watching Apache. 653 00:30:07,220 --> 00:30:12,980 You need to watch the HTTP return codes coming back from those web apps to see what's going on. 654 00:30:13,500 --> 00:30:17,480 And I actually have not written a tool that does this but I used SpyDynamics 655 00:30:17,480 --> 00:30:21,780 called SpyFuzzer just a little bit and it's kind of slick. 656 00:30:22,080 --> 00:30:25,240 It's not, I'm not going to say it's the greatest thing in the world 657 00:30:25,240 --> 00:30:28,260 because you basically got to define all your tests manually and there's really no good, 658 00:30:28,420 --> 00:30:32,620 not a real good like kind of but it will if you know of a certain test you want to do, 659 00:30:32,720 --> 00:30:35,500 like you want to say I'd like to like check this checkout cart. 660 00:30:35,660 --> 00:30:41,400 Like what if I buy, you know, one through 10,000 items of this type without logging in or something. 661 00:30:41,460 --> 00:30:44,380 You know, you've got this idea how to sort of pen test this web app. 662 00:30:44,540 --> 00:30:46,880 You can automate that with SpyFuzzer and that's kind of cool. 663 00:30:46,880 --> 00:30:47,720 So it's a little different. 664 00:30:48,940 --> 00:30:51,980 File fuzzing is actually very similar to normal fuzzing 665 00:30:51,980 --> 00:30:55,440 but there's just slightly different tools and I mean there's a lot of different ways to do this too. 666 00:30:56,000 --> 00:30:58,000 Very similar to the fuzzing we're talking about. 667 00:30:58,120 --> 00:31:00,000 It's sort of like you have a Word document. 668 00:31:01,200 --> 00:31:03,500 Okay, one way is you could just manually mutate that. 669 00:31:03,640 --> 00:31:06,920 You could, I don't know, just change every tenth byte 670 00:31:06,920 --> 00:31:11,200 and then give that file to Word and watch Word and see if Word dies. 671 00:31:11,420 --> 00:31:12,680 If it does, you found a bug, right? 672 00:31:12,960 --> 00:31:15,260 So there's a lot of different ways you could try to automate that 673 00:31:15,260 --> 00:31:16,860 and some guys gave some good tips. 674 00:31:16,880 --> 00:31:18,520 You can go to Firefox, Sutt & Green and Black Hat. 675 00:31:18,620 --> 00:31:19,540 You can go to iDefense. 676 00:31:19,560 --> 00:31:20,400 You can grab their tools. 677 00:31:20,480 --> 00:31:21,160 They're up on the website. 678 00:31:21,560 --> 00:31:23,920 So if you want to learn more about that. 679 00:31:24,260 --> 00:31:27,160 There should be and I don't think, I can't remember. 680 00:31:27,300 --> 00:31:28,240 I'm trying to remember off the top of my head. 681 00:31:28,440 --> 00:31:29,880 It's been a while since I looked at their tools. 682 00:31:30,060 --> 00:31:34,880 But there should be some ways to do some more intelligent fuzzing too besides just, you know, randomly. 683 00:31:34,960 --> 00:31:36,240 Obviously, there should be some protocol knowledge. 684 00:31:36,340 --> 00:31:37,380 I think they do some of that too. 685 00:31:38,680 --> 00:31:40,740 So okay, fuzzing metrics. 686 00:31:41,660 --> 00:31:44,920 Basically, the big deal is Martin Vagno wrote a paper on fuzzing. 687 00:31:45,000 --> 00:31:46,080 It was a pretty good one. 688 00:31:46,880 --> 00:31:50,840 The paper and the paper by Peter Olhart are probably the best two papers besides mine, of course. 689 00:31:50,940 --> 00:31:51,580 Look at AppliedSec. 690 00:31:51,680 --> 00:31:52,280 You'll see my paper. 691 00:31:52,660 --> 00:31:53,320 There is that. 692 00:31:53,580 --> 00:31:55,360 But they wrote some really good stuff. 693 00:31:55,520 --> 00:32:00,040 And his is basically not rocket science but it is, it's just, it makes sense, right? 694 00:32:00,100 --> 00:32:04,160 He's like, I want a metric to know how long will it take for my fuzzer to finish. 695 00:32:05,260 --> 00:32:09,840 Well, if you use true randomness, basically the answer is your fuzzer is never finished, right? 696 00:32:09,940 --> 00:32:13,520 And that's one of the things I'm studying in my research too is sort of like when's a good cutoff time? 697 00:32:13,920 --> 00:32:16,220 You know, how can we say that we think we've covered enough? 698 00:32:16,880 --> 00:32:17,200 Or whatever. 699 00:32:17,380 --> 00:32:19,380 But his tool is actually very deterministic. 700 00:32:19,500 --> 00:32:25,880 And what he does is he says all the variables, that is the user, space, pass, you know, all these things, 701 00:32:26,100 --> 00:32:27,140 those are called variables. 702 00:32:27,980 --> 00:32:33,340 And I have a list of a really long like 10,000, you know, member list of bad strings. 703 00:32:33,640 --> 00:32:37,020 And I'm going to take those strings and just put them in place of the variables, right? 704 00:32:37,100 --> 00:32:43,860 So I have library times variables times a half second or whatever it takes to run each test equals run time. 705 00:32:44,180 --> 00:32:46,680 That doesn't sound like, you know, rocket science. 706 00:32:46,880 --> 00:32:48,580 That's computer science kind of stuff. 707 00:32:48,940 --> 00:32:51,720 But actually it's, believe it or not, it's fairly revolutionary in this field. 708 00:32:51,800 --> 00:32:54,060 There hasn't been much formal study at all in fuzzing. 709 00:32:54,120 --> 00:32:56,340 It's basically just been like I send crap, I found a buffer overflow. 710 00:32:56,760 --> 00:32:57,400 I'm the man. 711 00:32:57,480 --> 00:33:00,380 I posted it, put bug track, you know, all that kind of good stuff. 712 00:33:02,060 --> 00:33:08,640 So now he does another really slick thing that's kind of cool. 713 00:33:08,760 --> 00:33:14,240 He basically, so not only does he have a run time, but he orders that too, which is kind of cool. 714 00:33:14,320 --> 00:33:16,860 It's basically like if the variable is good, 715 00:33:16,860 --> 00:33:20,800 if the variable is used in one of these naughty functions, got a big list of naughty functions, right? 716 00:33:22,140 --> 00:33:23,680 Then we fuzz those first. 717 00:33:24,200 --> 00:33:27,460 Again, not rocket science, but pretty revolutionary, you know, in terms of fuzzing 718 00:33:27,460 --> 00:33:32,400 and the way he, the remote debugger relays that to the fuzzing tool itself. 719 00:33:32,660 --> 00:33:33,820 So pretty good stuff. 720 00:33:34,660 --> 00:33:38,000 You know, there are some issues obviously, of course, with the fact that, you know, 721 00:33:38,080 --> 00:33:40,700 maybe more randomness could be good for second generation bugs. 722 00:33:40,840 --> 00:33:46,560 Maybe Windows Vista says this whole list of naughty functions shall never be used 723 00:33:46,860 --> 00:33:47,520 in Windows Vista. 724 00:33:47,780 --> 00:33:49,600 That's what they said at the talk at Black Hat. 725 00:33:49,760 --> 00:33:55,600 They have ways of completely eliminating these from the Windows Vista source code altogether. 726 00:33:56,200 --> 00:33:59,420 So in that case, it doesn't really help us all that much weighting, weight rise, right? 727 00:34:00,480 --> 00:34:03,340 And of course, attaching a debugger, which is a must for this kind of stuff, 728 00:34:03,420 --> 00:34:07,620 could potentially make you miss, you know, sort of like attaching a debugger is great for 95%. 729 00:34:07,620 --> 00:34:10,200 There's that 5% of race conditions or something you could miss. 730 00:34:13,420 --> 00:34:15,520 So basically, some future research. 731 00:34:15,520 --> 00:34:20,020 My thoughts are kind of like, I like to combine those kind of things that are out there, 732 00:34:20,060 --> 00:34:23,560 like Vecno's approach with my tool and my approach. 733 00:34:23,940 --> 00:34:26,900 And even kind of, basically the approach is something like this. 734 00:34:26,980 --> 00:34:31,040 Let's do some deterministic, structured stuff up front. 735 00:34:31,200 --> 00:34:33,340 And if you don't find any bugs with careful inspection, 736 00:34:33,700 --> 00:34:35,700 then you can sort of open up the throttle, right? 737 00:34:35,780 --> 00:34:41,540 You can introduce more, you know, randomness per byte or more junk, basically. 738 00:34:41,560 --> 00:34:44,340 You can kind of throttle back and let it run longer if you have time 739 00:34:44,340 --> 00:34:47,960 to try and find more of those second generation kind of things. 740 00:34:48,160 --> 00:34:53,660 And then, really surprisingly to me, I went to Sparks, Edmonton, Cunningham. 741 00:34:53,900 --> 00:34:56,480 Their talk on Sidewinder at Black Hat, great talk. 742 00:34:56,600 --> 00:34:59,960 They talked about using genetic algorithms in fuzzing. 743 00:35:00,080 --> 00:35:02,340 And I actually take a genetics algorithm class this fall. 744 00:35:02,540 --> 00:35:05,180 I was planning to do research on genetics algorithm. 745 00:35:05,520 --> 00:35:07,260 But I was happy when I saw their talk. 746 00:35:07,300 --> 00:35:11,020 Now I'm upset because they laid a great groundwork to kind of get started 747 00:35:11,020 --> 00:35:14,320 in how some of this might be used as of yet their tool wasn't working. 748 00:35:14,340 --> 00:35:17,680 They weren't super useful against multi-leg protocols and stuff like that. 749 00:35:17,920 --> 00:35:22,120 But they had some great groundwork laid on how, basically, 750 00:35:22,240 --> 00:35:25,020 what they use for the genetic algorithm stuff. 751 00:35:25,120 --> 00:35:26,820 So hopefully I can kind of build on that this year. 752 00:35:26,880 --> 00:35:27,460 That's my plan. 753 00:35:29,240 --> 00:35:31,800 So basically what I'm going to do right now is give a quick demo 754 00:35:31,800 --> 00:35:34,480 and then we'll take whatever questions you guys have, okay? 755 00:35:49,040 --> 00:35:49,860 All right. 756 00:35:51,000 --> 00:35:53,580 This is the only time wireless mics are really kind of handy. 757 00:35:54,020 --> 00:35:58,580 So basically if I just – let me make sure I click in my VM here. 758 00:35:59,560 --> 00:36:00,940 Cat all three. 759 00:36:02,040 --> 00:36:05,440 What I'm going to show you again is just I'm going to run my tool against Dovecot 760 00:36:05,440 --> 00:36:07,260 and show you some bugs that I found. 761 00:36:07,640 --> 00:36:10,920 I was not able to take these bugs and turn them into O-Days. 762 00:36:10,980 --> 00:36:13,060 But it's like a take-home assignment for you all. 763 00:36:13,060 --> 00:36:17,780 If you're smarter than me, see if you can take these bugs and turn them into O-Days. 764 00:36:17,840 --> 00:36:18,700 Good luck with that. 765 00:36:18,860 --> 00:36:19,640 So they're pre-logging. 766 00:36:20,500 --> 00:36:23,520 And you can see GPF and then I got pre-logging fault one. 767 00:36:23,720 --> 00:36:26,880 It's basically just going to run a capture file that I have. 768 00:36:27,060 --> 00:36:35,420 And if I cat pre-logging fault one – wow. 769 00:36:35,840 --> 00:36:38,080 Okay. Dot. There we go. 770 00:36:38,880 --> 00:36:42,620 So you can see what a capture file looks like for me in my neutral format. 771 00:36:43,060 --> 00:36:44,220 It's not in libpcap. 772 00:36:44,360 --> 00:36:46,940 It's basically like source means it came from the server. 773 00:36:47,740 --> 00:36:50,000 And you can reverse that easily when you run the tool. 774 00:36:50,160 --> 00:36:55,580 The size is 5 and the data is basically 05 and then probably like a slash r slash n 775 00:36:55,580 --> 00:36:58,080 and an all or whatever the data actually is there. 776 00:36:58,300 --> 00:37:02,680 So that's just what the capture file format looks like. 777 00:37:02,700 --> 00:37:03,840 It's real simple. It's real straightforward. 778 00:37:04,060 --> 00:37:06,320 It's simple to modify if you wanted to change that a little bit, 779 00:37:06,400 --> 00:37:07,880 change the byte, change the size, okay? 780 00:37:07,960 --> 00:37:08,700 No problems there. 781 00:37:10,600 --> 00:37:16,220 So what I'm going to do is I'm going to get ready to run a couple versions of GPF. 782 00:37:16,340 --> 00:37:19,160 And the switches that I showed you, you'll have to check out the readme. 783 00:37:19,240 --> 00:37:21,200 It's fairly good documentation, I think, for a readme. 784 00:37:22,420 --> 00:37:24,460 There's a lot of different little switches that GPF expects, 785 00:37:24,640 --> 00:37:26,000 but they're not that hard to use. 786 00:37:26,200 --> 00:37:28,660 And I'm actually going to be using it in just straight replay mode. 787 00:37:28,760 --> 00:37:30,440 It's not going to be fuzzing because these bugs, 788 00:37:30,600 --> 00:37:33,220 I don't even actually have to fuzz them to find them. 789 00:37:33,280 --> 00:37:37,520 It's just when you send a certain sequence of bad things, DubCut will crash. 790 00:37:37,660 --> 00:37:38,300 But I found that. 791 00:37:38,300 --> 00:37:39,700 Based on fuzzing, okay? 792 00:37:39,800 --> 00:37:43,840 So let me start, do a U limit so I can get a core dump, 793 00:37:43,980 --> 00:37:46,700 dash C, unlimited, okay? 794 00:37:47,060 --> 00:37:48,300 And then start DubCut. 795 00:37:48,740 --> 00:37:49,820 The server should be running. 796 00:37:49,920 --> 00:37:54,400 So if I go over to, this is a tail, tail dash F of var log, mail log. 797 00:37:54,720 --> 00:37:56,660 We see the entry DubCut starting up. 798 00:37:56,880 --> 00:38:03,740 So the question is, what happens if I do a PS dash EF grep DubCut. 799 00:38:04,580 --> 00:38:08,080 What happens if I do a, this is the thing you need to do before you fuzz, by the way. 800 00:38:08,300 --> 00:38:09,940 Before you fuzz until you've done something like this, 801 00:38:10,000 --> 00:38:12,760 you need to figure out what will a fault look like to me. 802 00:38:12,940 --> 00:38:14,900 Will I be able to see it in logs or not? 803 00:38:15,340 --> 00:38:17,440 Will I be able to get, what am I doing? 804 00:38:17,600 --> 00:38:20,280 I need to, I'm talking while I'm trying to do this. 805 00:38:20,340 --> 00:38:21,580 So I'm just going to put in a PID. 806 00:38:24,140 --> 00:38:29,080 So if I kill dash 11 DubCut auth, who thinks they know what will happen? 807 00:38:29,180 --> 00:38:29,580 Does anybody know? 808 00:38:30,520 --> 00:38:31,200 Take a guess. 809 00:38:31,320 --> 00:38:33,920 Who thinks they know what's going to happen if I just do this? 810 00:38:34,940 --> 00:38:37,020 It'll dump core because I set a U limit, right? 811 00:38:37,020 --> 00:38:41,020 And it doesn't, depending on kernels and, you know, EUIDs 812 00:38:41,540 --> 00:38:43,800 and there's a lot of different problems that can create, 813 00:38:44,120 --> 00:38:46,500 that process may not dump core. 814 00:38:47,160 --> 00:38:49,220 But when I do that, it does dump core. 815 00:38:49,460 --> 00:38:50,320 See, there's a core there. 816 00:38:50,460 --> 00:38:54,180 Let me remove it so it's not confused with a different one, core.297. 817 00:38:55,080 --> 00:38:59,840 And if I do the PS again, we see that DubCut auth is back 818 00:38:59,840 --> 00:39:01,340 and it has a different PID, okay? 819 00:39:01,820 --> 00:39:06,160 So we know that the DubCut watch daemon will restart it. 820 00:39:06,160 --> 00:39:08,580 And we see in the log, see what we see in the log? 821 00:39:08,720 --> 00:39:10,700 We saw this child was killed with signal 11, okay? 822 00:39:10,760 --> 00:39:11,340 So pretty straightforward. 823 00:39:11,440 --> 00:39:12,380 We know what to expect. 824 00:39:12,620 --> 00:39:14,220 We do that before we fuzz, right? 825 00:39:15,000 --> 00:39:17,820 Okay, and now we actually will send it. 826 00:39:17,900 --> 00:39:18,920 So I run the script. 827 00:39:19,040 --> 00:39:19,760 Here's GPF. 828 00:39:19,800 --> 00:39:20,240 It's running. 829 00:39:20,280 --> 00:39:21,980 You see client server, client server. 830 00:39:22,120 --> 00:39:22,600 It's sending data. 831 00:39:22,700 --> 00:39:26,260 Sometimes it prints in hex and sometimes it prints in ASCII. 832 00:39:26,360 --> 00:39:27,420 I don't know if you noticed that. 833 00:39:27,480 --> 00:39:29,320 Let me page up. 834 00:39:29,380 --> 00:39:30,280 Just based on what it sees. 835 00:39:30,400 --> 00:39:33,440 If the first few bytes look like they're binary, it'll print it in binary. 836 00:39:33,700 --> 00:39:36,140 If the first few bytes are, you know, ASCII, 837 00:39:36,140 --> 00:39:37,560 it'll print it in ASCII kind of deal. 838 00:39:37,660 --> 00:39:40,160 So pretty straightforward but pretty cool stuff. 839 00:39:40,460 --> 00:39:42,700 And then you see, like, couldn't read socket negative 2, right? 840 00:39:42,780 --> 00:39:44,580 So that means that there maybe was an issue. 841 00:39:44,960 --> 00:39:47,840 And if we go back and look at our log, it's like, oops, what was that? 842 00:39:48,360 --> 00:39:51,480 We got auth died and the login process died. 843 00:39:51,600 --> 00:39:52,740 So both pre-login. 844 00:39:52,780 --> 00:39:54,060 I didn't even use a user in the past. 845 00:39:54,280 --> 00:39:57,500 We got two problems right off the bat in DubCut there. 846 00:39:57,620 --> 00:40:00,900 So that's my demo and that's my tool and that's my talk. 847 00:40:00,960 --> 00:40:01,260 Thanks. 848 00:40:09,160 --> 00:40:12,000 I raced through that because I wasn't sure if I was going to make it through that. 849 00:40:12,140 --> 00:40:13,120 So do we have any questions? 850 00:40:13,280 --> 00:40:14,480 Anybody have a question? 851 00:40:15,560 --> 00:40:16,460 I think there's a microphone. 852 00:40:17,140 --> 00:40:17,600 Go ahead. 853 00:40:17,740 --> 00:40:19,200 You want to step up to the mic or ask it from there? 854 00:40:19,260 --> 00:40:19,680 Whatever you like. 855 00:40:22,040 --> 00:40:23,700 Yes, you have to go to the microphone, he said. 856 00:40:27,040 --> 00:40:31,640 How are you doing your tokenization to differentiate between strings so that you know where to fuzz? 857 00:40:32,020 --> 00:40:32,860 Well, that's a good question. 858 00:40:33,920 --> 00:40:35,100 GPF has a few different modes. 859 00:40:35,100 --> 00:40:36,600 You don't have to tokenize, right? 860 00:40:36,780 --> 00:40:39,160 GPF has lots of different modes. 861 00:40:39,260 --> 00:40:43,440 And if you see that in the read me, you'll see, like, you can just tell it to do some cyclic stuff, 862 00:40:43,660 --> 00:40:50,280 like just insert large strings or just insert format strings and do it only in this leg and do it only in this position. 863 00:40:50,420 --> 00:40:51,360 You can do a lot of different stuff. 864 00:40:51,440 --> 00:40:55,460 Or you can run it in a dash P mode, which I call pattern matching, which is tokenization. 865 00:40:56,680 --> 00:40:58,200 And it will basically do what you say. 866 00:40:58,320 --> 00:41:01,540 It will say, okay, this looks like there's a string here. 867 00:41:02,360 --> 00:41:02,680 Okay? 868 00:41:02,740 --> 00:41:04,460 And you have to actually tell it on the command line. 869 00:41:04,480 --> 00:41:04,960 What a dilemma. 870 00:41:05,100 --> 00:41:07,020 So it says I'm expecting strings to be this. 871 00:41:07,120 --> 00:41:09,820 I expect a delimiter to be a space of one byte long. 872 00:41:10,180 --> 00:41:13,180 And I expect a line ending to be a slash R slash N. 873 00:41:13,300 --> 00:41:16,700 So once it knows that it expects that that's the pattern, it will just find that. 874 00:41:16,860 --> 00:41:20,940 And based on that, it will do different things for delimiters and line endings than it would for data. 875 00:41:21,160 --> 00:41:22,260 So does that answer your question? 876 00:41:22,900 --> 00:41:23,280 Okay, great. 877 00:41:25,420 --> 00:41:29,700 Have you reported the problems you found to the DoveCop people? 878 00:41:30,960 --> 00:41:32,320 I reported a couple. 879 00:41:33,560 --> 00:41:34,440 Did you get any response? 880 00:41:35,000 --> 00:41:35,400 What's that? 881 00:41:35,660 --> 00:41:36,420 Did you get a response? 882 00:41:36,820 --> 00:41:37,520 Yeah, actually. 883 00:41:38,180 --> 00:41:38,800 Yes, I did. 884 00:41:39,160 --> 00:41:40,800 So they're going to put out a fix? 885 00:41:40,880 --> 00:41:43,860 These particular bugs, I don't know if they're fixed in the newest version or not. 886 00:41:43,960 --> 00:41:44,420 I really don't. 887 00:41:44,480 --> 00:41:46,540 I leave that as an assignment for you all to have fun with. 888 00:41:46,740 --> 00:41:46,940 Okay. 889 00:41:47,100 --> 00:41:49,680 And did you play with the DoveCop POP3 daemon at all? 890 00:41:50,000 --> 00:41:50,580 Did I what? 891 00:41:50,740 --> 00:41:52,420 The DoveCop POP3 daemon. 892 00:41:52,520 --> 00:41:53,360 Did you try fuzzing it? 893 00:41:53,520 --> 00:41:54,080 Yeah, I did. 894 00:41:54,120 --> 00:41:55,160 I fuzzed that a little bit, too. 895 00:41:55,220 --> 00:41:56,400 And I didn't find any problems there. 896 00:41:56,500 --> 00:41:58,640 But again, you know, there's a lot of different modes. 897 00:41:58,820 --> 00:41:59,960 I've added some stuff since then. 898 00:42:00,040 --> 00:42:01,100 So I say fuzz away. 899 00:42:01,400 --> 00:42:01,960 Okay, thanks. 900 00:42:02,200 --> 00:42:02,920 Yeah, no problem. 901 00:42:03,740 --> 00:42:04,860 DoveCop has actually had it. 902 00:42:04,920 --> 00:42:06,840 I found a number of problems. 903 00:42:07,540 --> 00:42:10,400 One of the problems was actually POP3 that I reported that was fixed. 904 00:42:10,520 --> 00:42:11,640 But that one's fixed now, so. 905 00:42:12,320 --> 00:42:16,680 Just with genetic algorithms, I mean, the key is the fitness function, obviously. 906 00:42:16,940 --> 00:42:17,400 Yeah. 907 00:42:17,480 --> 00:42:25,160 And it seems like you either crash it or you don't crash it or you get garbage out when you shouldn't get garbage. 908 00:42:25,340 --> 00:42:28,460 So how do you define a useful fitness function? 909 00:42:28,620 --> 00:42:32,740 Because it doesn't seem like the search space is that fine-grained. 910 00:42:32,820 --> 00:42:32,900 Yeah. 911 00:42:33,300 --> 00:42:34,880 Yeah, that's a great question. 912 00:42:34,940 --> 00:42:35,660 That is the problem. 913 00:42:35,780 --> 00:42:39,920 And if you, I don't know if you were at Black Hat or not, but they talked a little bit about that. 914 00:42:39,960 --> 00:42:41,120 I missed the talk. 915 00:42:41,260 --> 00:42:42,360 I wasn't at Black Hat. 916 00:42:42,440 --> 00:42:44,660 Otherwise, it's potentially already answered. 917 00:42:44,800 --> 00:42:49,180 But I just thought since you're talking about using it, I thought you might have a reasonable answer to that. 918 00:42:49,380 --> 00:42:49,860 Yeah, yeah. 919 00:42:49,920 --> 00:42:51,800 Well, there's a lot of different fitness functions, right? 920 00:42:51,880 --> 00:42:55,700 One they mentioned was basically like a point in the program. 921 00:42:56,240 --> 00:42:59,800 If we ever get to this point, then that's fit. 922 00:42:59,940 --> 00:43:02,900 So the code pass or the data that allows us to do that. 923 00:43:02,900 --> 00:43:07,280 That allows us to get closer, excuse me, to this code path are more fit than others. 924 00:43:07,380 --> 00:43:11,060 And they do that by setting breakpoints on everything along the way to that and checking the data. 925 00:43:11,140 --> 00:43:12,740 So the data could be fit based on that. 926 00:43:13,020 --> 00:43:17,000 And there's probably a lot of other ways you could generate fitness. 927 00:43:17,160 --> 00:43:19,800 And that's really one of the things that I'm going to be studying here exactly, right? 928 00:43:19,880 --> 00:43:24,340 Because even once you do that, it's sort of like, well, we found data that was fit and it made it to this point. 929 00:43:25,120 --> 00:43:29,340 Well, that's great, but it didn't necessarily crash it and it didn't necessarily find us a bug, right? 930 00:43:29,900 --> 00:43:32,620 So we got to find a way to work that in, right? 931 00:43:32,620 --> 00:43:34,980 To finding data that's fit in the sense that it's problematic. 932 00:43:35,420 --> 00:43:37,060 So how do you pick those points? 933 00:43:37,260 --> 00:43:42,620 I mean, like, in kernel hacking, there's obviously a bunch of places where, quote, unquote, we should never get here. 934 00:43:42,800 --> 00:43:46,360 I mean, is that type of location that you think about? 935 00:43:46,660 --> 00:43:51,740 Or, I mean, and obviously that's harder if it's a closed source application. 936 00:43:52,760 --> 00:43:53,800 Yeah, that's a really good point. 937 00:43:53,900 --> 00:43:58,160 Well, one of the things you can do is you can pick, potentially going back to that list of naughty strings. 938 00:43:58,400 --> 00:44:01,200 If you, you know, throw it in IDA Pro and you find it. 939 00:44:01,200 --> 00:44:02,720 Oh, there's three strcopys here. 940 00:44:03,100 --> 00:44:05,600 If we ever make it, can we make it to this strcopy? 941 00:44:05,660 --> 00:44:06,320 That's a good question. 942 00:44:06,400 --> 00:44:08,100 And that actually is a really useful thing to know. 943 00:44:08,520 --> 00:44:12,060 From a remote, does this attack service ever lead us to this somehow, right? 944 00:44:12,260 --> 00:44:14,160 So that's kind of a useful thing in that sense. 945 00:44:15,180 --> 00:44:17,300 Okay, so that is potentially automatable. 946 00:44:17,820 --> 00:44:25,520 If there's a set of functions that are potentially vulnerable, then you can effectively automatically pick those out. 947 00:44:25,560 --> 00:44:28,340 Then use those to predefine a set of fitness functions. 948 00:44:28,420 --> 00:44:29,520 Is that kind of what you have in mind? 949 00:44:29,720 --> 00:44:30,160 Yeah, yeah. 950 00:44:30,160 --> 00:44:32,300 There's probably a lot of different ways, so good question. 951 00:44:32,400 --> 00:44:32,640 Thanks. 952 00:44:33,900 --> 00:44:34,340 Hi. 953 00:44:34,880 --> 00:44:38,200 How do you get around code that inherently rate limits you? 954 00:44:38,780 --> 00:44:40,180 I'm sorry, can you say it one more time? 955 00:44:40,400 --> 00:44:43,340 Yeah, how do you get around code that inherently rate limits you? 956 00:44:44,080 --> 00:44:45,740 Code that rate limits me? 957 00:44:46,000 --> 00:44:53,720 Yeah, that tries to put in delays to stop you throwing so much data in a particular time sequence or time frame. 958 00:44:53,960 --> 00:44:58,000 So a lot of authentication protocols will actually put in delay and back you off. 959 00:44:58,480 --> 00:44:58,920 Yes. 960 00:44:58,920 --> 00:45:01,120 So is that particularly easy to get around? 961 00:45:01,340 --> 00:45:02,960 What are the issues there? 962 00:45:03,060 --> 00:45:04,000 That's a great question. 963 00:45:04,100 --> 00:45:05,380 Actually, a really, really good question. 964 00:45:05,560 --> 00:45:10,520 Timing is a huge issue when you're fuzzing because if you fuzz too fast, this fuzzer just may blacklist your IP, right? 965 00:45:10,580 --> 00:45:13,880 Or the server may just say, oop, this guy's doing something weird. 966 00:45:13,900 --> 00:45:14,400 I don't like him. 967 00:45:14,720 --> 00:45:16,780 That's a great question, and that's a problem you run up against. 968 00:45:16,900 --> 00:45:19,220 One of the parameters that you feed GPF is timing. 969 00:45:19,620 --> 00:45:24,780 I default sort of have it at 1,000 milliseconds per leg, but you can back that way off if you need to. 970 00:45:25,740 --> 00:45:28,100 Or you can do, there's user functions I talked about. 971 00:45:28,100 --> 00:45:34,200 There's user functions in GPF, like if your protocol has an encrypted hash, it expects you to do this, do a hash, and send it back. 972 00:45:34,600 --> 00:45:41,780 You can have a user function do that, and you could also have a user function just maybe every 10 times you have the program sleep for a minute or something. 973 00:45:41,920 --> 00:45:44,400 Whatever you need to do to keep the timing sane, you can do that. 974 00:45:44,980 --> 00:45:45,700 Yeah, thanks. 975 00:45:45,960 --> 00:45:46,400 Good question. 976 00:45:46,580 --> 00:45:47,140 Any more questions? 977 00:45:49,100 --> 00:45:49,700 All right. 978 00:45:49,700 --> 00:45:51,040 Well, peace, blessings, and good luck.