1 00:00:00,000 --> 00:00:17,660 Hello, my name is Charlie Miller. I'm going to be talking today about different kinds of fuzzing and trying to basically take a stab at figuring out exactly how much better different kinds are from others and some other fundamental questions about fuzzing. 2 00:00:17,660 --> 00:00:37,140 So, basically, people have been fuzzing for a number of years and using that to find bugs, and there's a lot of sort of experience in the field, but no one's really sort of looked at exactly, you know, tried to quantify how effective it is or not, and that's what I was wanting to try to do. 3 00:00:38,680 --> 00:00:47,480 So, basically, I'll take a little time to first talk about what fuzzing is real briefly, and then I'll talk about basically one big case. 4 00:00:47,660 --> 00:00:57,540 And it involves portable network graphics, which are just images, and in particular, libpng, which is a library that parses PNGs. 5 00:00:57,880 --> 00:01:11,860 And then I'll talk about basically what the whole talk is about, which was the two kinds of fuzzing that I'm talking about, mutation and generation-based fuzzing, and I'm going to show exactly what happened when I looked to see how effective they were. 6 00:01:14,240 --> 00:01:17,640 So, one of the founding fathers of fuzzing, and I'm going to show exactly what happened when I looked to see how effective they were. 7 00:01:17,660 --> 00:01:32,720 So, one of the founding fathers of fuzzing has this quote in his paper, intelligent fuzzing usually gives more results, and, you know, that totally makes sense, and everyone knows it's pretty much true, but the question is, you know, what's more, right? 8 00:01:33,000 --> 00:01:44,380 Because doing intelligent fuzzing is just an order of magnitude harder to do than dumb fuzzing, and so the question becomes, is it worth your time to do the intelligent fuzzing or not? 9 00:01:44,540 --> 00:01:45,960 And that's what I kind of wanted to find out. 10 00:01:46,160 --> 00:01:46,220 Okay. 11 00:01:47,040 --> 00:01:47,560 Okay. 12 00:01:47,660 --> 00:02:00,100 So, one thing I wanted to find out was if you're going to use mutation-based fuzzing, that starts from a particular file and you make changes to it or a particular test case, and I wanted to know how important is your choice of the initial test case? 13 00:02:00,200 --> 00:02:03,300 So, does it matter, or you can just pick something at random, or do you have to think about it? 14 00:02:03,660 --> 00:02:06,920 And if you do have to think about it, how important is it? 15 00:02:09,480 --> 00:02:09,800 Okay. 16 00:02:09,880 --> 00:02:10,960 So, what's fuzzing? 17 00:02:11,040 --> 00:02:16,060 You've probably seen, I've seen at least a couple talks that talk about fuzzing already, so this might be a rehash, but it's quick. 18 00:02:17,200 --> 00:02:22,920 So, fuzzing, basically, you start by generating test cases, and test cases, they're just inputs to the target program. 19 00:02:23,240 --> 00:02:36,180 They might be files, so, like, if you were fuzzing Microsoft Office, you would generate Word documents or Excel spreadsheets, and those would be your test cases, so they would be mutated versions of that. 20 00:02:36,800 --> 00:02:43,600 It could be network traffic, so if you're fuzzing, like, a web server or something, the network traffic, that would count as your test cases. 21 00:02:43,800 --> 00:02:46,040 Command line arguments, so maybe very long strings. 22 00:02:46,060 --> 00:02:48,180 String and command lines, environment variables, whatever. 23 00:02:48,360 --> 00:02:52,580 So, whatever the input is that's going into the program, that's what's called the test case. 24 00:02:53,620 --> 00:03:01,820 These test cases should be similar to real valid data, but they have to obviously have problems, too, so they contain anomalies, as well. 25 00:03:02,120 --> 00:03:11,340 And the reason they have to be at least somewhat close is if you just send complete random garbage to the program, it's just immediately going to kick it out and know something's wrong, and so you're not going to get very deep into the program. 26 00:03:11,460 --> 00:03:14,680 So, you want to get deep enough into it, but still have some problems. 27 00:03:16,520 --> 00:03:18,760 So, fuzzing is basically two things. 28 00:03:18,860 --> 00:03:22,280 You generate the test cases, and then you monitor the program to see if anything went wrong. 29 00:03:22,680 --> 00:03:28,620 And so, things that might go wrong in the program is maybe it starts eating up 100% of the CPU, so that shows something's gone wrong. 30 00:03:28,760 --> 00:03:29,520 Maybe the thing crashes. 31 00:03:30,720 --> 00:03:34,160 Maybe it starts to open files that it's not supposed to. 32 00:03:34,280 --> 00:03:37,940 So, anyway, you need something to monitor the program and see what's going on. 33 00:03:39,840 --> 00:03:45,900 So, the point of sending in these anomalous test cases is that you're doing things. 34 00:03:45,900 --> 00:03:46,040 You're doing things that are not supposed to be happening. 35 00:03:46,060 --> 00:03:50,340 So, if you set it at the normal client or the normal behavior of the program, it doesn't usually happen. 36 00:03:50,560 --> 00:03:57,080 So, hopefully, you'll find some assumptions the program made, and you'll violate those, and good things will happen. 37 00:04:00,000 --> 00:04:02,620 So, basically, there's a lot of... 38 00:04:02,620 --> 00:04:06,680 I mean, the big question is, I said fuzzing is two things, getting test cases and then monitoring the program. 39 00:04:06,880 --> 00:04:10,560 So, on the side about getting test cases, how do you get them, right? 40 00:04:10,640 --> 00:04:13,480 You need hundreds of thousands of these things, so how do you make them? 41 00:04:13,840 --> 00:04:15,700 And there's basically three ways. 42 00:04:16,060 --> 00:04:17,640 There's three ways right now to do it, and I'm only going to talk about two. 43 00:04:18,220 --> 00:04:22,300 Jared, who was in here before this talk, talked about the third one. 44 00:04:23,760 --> 00:04:29,780 So, the dumb fuzzing, or it's called protocol unaware fuzzing. 45 00:04:29,900 --> 00:04:31,480 So, you don't know anything about the protocol. 46 00:04:31,820 --> 00:04:39,420 You just take a valid input, so a valid test case, maybe, like I said, a spreadsheet or some network traffic or whatever. 47 00:04:39,540 --> 00:04:41,780 So, something valid, and then you just start making little changes to it. 48 00:04:42,980 --> 00:04:46,040 So, maybe you start... 49 00:04:46,060 --> 00:04:51,480 So, there's a program called FileFuzz, and what it does, among other things, is it'll take a file, 50 00:04:51,540 --> 00:04:55,440 and it'll just start changing every byte one at a time, and then it'll send it through the program. 51 00:04:55,640 --> 00:04:58,380 So, that's one example of dumb fuzzing. 52 00:04:59,180 --> 00:05:00,680 There's other heuristics you can use. 53 00:05:00,740 --> 00:05:06,560 So, instead of just flipping a byte randomly, you can find something that looks like a string and add a bunch of A's or something. 54 00:05:06,680 --> 00:05:07,460 So, add long strings. 55 00:05:07,600 --> 00:05:13,400 You can start looking for things that look like integers and putting lots of different integer values in for it. 56 00:05:14,560 --> 00:05:15,780 Percent ends, look for formatting. 57 00:05:16,060 --> 00:05:16,300 Bugs, whatever. 58 00:05:17,520 --> 00:05:20,820 The point about dumb fuzzing is it's super easy to set up and do. 59 00:05:21,060 --> 00:05:27,340 So, if you give me a program and you give me a valid input, I can basically write a fuzzer and get it going in about 10 minutes. 60 00:05:27,640 --> 00:05:29,940 So, I don't need to know anything about how the program works. 61 00:05:30,440 --> 00:05:35,360 I don't need to know anything about the file format or the network format or anything. 62 00:05:35,540 --> 00:05:39,000 So, I can just turn the thing on, just start flipping bits, and I'm off to the races. 63 00:05:40,220 --> 00:05:41,780 So, you can get into it really fast. 64 00:05:43,960 --> 00:05:46,040 And, obviously, it might depend. 65 00:05:46,060 --> 00:05:47,940 It might depend on the initial test case. 66 00:05:48,120 --> 00:05:52,840 So, you can imagine, again, back to my example of fuzzing Microsoft, say, PowerPoint. 67 00:05:53,300 --> 00:06:01,440 So, it doesn't matter if I take a 1-kilobyte PowerPoint slide or a 1-megabyte PowerPoint slide. 68 00:06:01,560 --> 00:06:04,120 If I start from those two and I start flipping bits, is that going to make a difference? 69 00:06:04,320 --> 00:06:05,060 Well, probably. 70 00:06:05,480 --> 00:06:07,220 And I'll quantify that later. 71 00:06:09,160 --> 00:06:10,300 So, that was dumb fuzzing. 72 00:06:10,360 --> 00:06:13,620 You just take something you already have and just start making changes to it. 73 00:06:13,960 --> 00:06:15,820 The alternative is intelligent fuzzing. 74 00:06:16,060 --> 00:06:17,360 Or protocol-aware fuzzing. 75 00:06:18,980 --> 00:06:21,740 Or, I think I call it generational-based, too. 76 00:06:22,140 --> 00:06:25,900 So, the point of this is you don't start from something that you already have. 77 00:06:26,020 --> 00:06:27,240 You basically build it up from scratch. 78 00:06:27,660 --> 00:06:31,180 So, you take some description of what the program is to expect. 79 00:06:31,340 --> 00:06:33,480 So, maybe it's an RFC. 80 00:06:33,680 --> 00:06:35,880 Or maybe it's just documentation that comes with the program. 81 00:06:36,080 --> 00:06:40,320 Or it could be you could reverse engineer the binary or look at the source code or whatever. 82 00:06:40,600 --> 00:06:42,700 Somehow, you get a description of what the program expects. 83 00:06:44,000 --> 00:06:45,980 Then, you start building up the test case. 84 00:06:45,980 --> 00:06:50,120 So, the test case is from this description, adding in the anomalies as you go. 85 00:06:50,880 --> 00:06:55,360 So, the more or less famous intelligent fuzzer is Spike. 86 00:06:55,700 --> 00:07:06,560 And for that, you write a description of what the protocol is, and Spike goes in and it changes one at a time, each of the fields, and it adds anomalies. 87 00:07:07,840 --> 00:07:09,180 So, again, you can do the same thing. 88 00:07:09,260 --> 00:07:12,340 You add in numbers, like to the end, plus or minus one. 89 00:07:13,000 --> 00:07:15,600 You can add in negative numbers, percent ends, whatever you want. 90 00:07:15,600 --> 00:07:16,020 Long strings. 91 00:07:17,460 --> 00:07:24,040 The point of this is, and I mentioned this earlier, that it's very much harder to do this than the dumb fuzzing is. 92 00:07:24,400 --> 00:07:30,700 It takes a long time to sit down and read an entire RFC and then write a program that basically emulates every single part of the RFC. 93 00:07:30,940 --> 00:07:33,400 And then you have to do the whole thing if you want to explore the whole program. 94 00:07:33,580 --> 00:07:40,640 So, you can imagine that this is going to take days, weeks, months even for very complicated protocols. 95 00:07:42,780 --> 00:07:45,020 So, it should make sense that if... 96 00:07:45,020 --> 00:07:52,500 If for sure you're guaranteed you're hitting every single thing that's in the specification, you'd think that you have a better chance of finding bugs like this. 97 00:07:52,800 --> 00:07:59,440 And what I wanted to find out in this whole talk is exactly how much better is it. 98 00:07:59,500 --> 00:08:05,760 Because if I'm going to spend a month doing this, when I could have just turned on my dumb fuzzer in five minutes, it better be a heck of a lot better. 99 00:08:09,220 --> 00:08:14,740 Okay, so, I should just mention, so the third type of fuzzing that is sort of around... 100 00:08:15,020 --> 00:08:18,080 Besides dumb, smart, is evolutionary. 101 00:08:18,520 --> 00:08:20,140 And like I said, Jared already talked about that. 102 00:08:20,340 --> 00:08:22,300 And that's a whole different way to generate inputs. 103 00:08:22,420 --> 00:08:24,480 You use evolutionary algorithms. 104 00:08:26,280 --> 00:08:29,800 Anyway, so I wanted to answer these questions that I had. 105 00:08:30,180 --> 00:08:33,700 And to do it, I needed to actually fuzz something. 106 00:08:34,980 --> 00:08:39,300 Okay, so what I decided to fuzz was PNG. 107 00:08:39,480 --> 00:08:41,100 It's an image format. 108 00:08:41,720 --> 00:08:43,080 It's used in... 109 00:08:45,020 --> 00:08:45,700 Did I skip something? 110 00:08:46,700 --> 00:08:47,020 Nope. 111 00:08:47,120 --> 00:08:48,220 So anyway, it's an image format. 112 00:08:48,380 --> 00:08:49,360 It's used all over the place. 113 00:08:50,880 --> 00:08:53,440 Just to describe to you what a PNG looks like. 114 00:08:54,640 --> 00:08:55,960 It starts out with eight bytes. 115 00:08:56,680 --> 00:08:57,580 It's always the same. 116 00:08:58,080 --> 00:08:59,580 And then it has these things called chunks. 117 00:09:00,180 --> 00:09:04,360 And each chunk consists of four bytes to tell you how long the chunk is. 118 00:09:04,920 --> 00:09:06,500 Four bytes to tell you the type of chunk. 119 00:09:07,100 --> 00:09:07,880 Then some data. 120 00:09:08,000 --> 00:09:09,400 And you don't even have to have data if you don't want to. 121 00:09:09,720 --> 00:09:11,520 And then a four byte CRC checksum. 122 00:09:11,620 --> 00:09:13,500 So, just to make sure that it hasn't been corrupted. 123 00:09:13,840 --> 00:09:14,940 And you just get all these chunks. 124 00:09:15,020 --> 00:09:15,580 One after another. 125 00:09:15,860 --> 00:09:18,280 And that's all a PNG looks like if you tear it open. 126 00:09:19,520 --> 00:09:20,280 And there's... 127 00:09:20,280 --> 00:09:23,000 The original PNG RFC specifies 18 chunk types. 128 00:09:23,420 --> 00:09:24,940 Three of which have to show up in every file. 129 00:09:26,340 --> 00:09:29,840 There's other extensions to the RFC that talk about other types. 130 00:09:30,220 --> 00:09:31,980 And you can make up your own type or whatever. 131 00:09:32,140 --> 00:09:35,500 I end up looking at 21 because that's what libpng knows about. 132 00:09:37,960 --> 00:09:39,180 And I don't know if you can see it. 133 00:09:39,280 --> 00:09:44,540 But this is a little program I have that can analyze files and break them apart. 134 00:09:44,540 --> 00:09:45,720 By their specification. 135 00:09:46,120 --> 00:09:47,800 And you can just see maybe on the bottom there. 136 00:09:48,360 --> 00:09:51,020 The different chunk types that show up in this particular PNG. 137 00:09:51,800 --> 00:09:53,240 And what it would look like. 138 00:09:53,700 --> 00:09:54,840 So, that's just what it looks like. 139 00:09:55,160 --> 00:09:57,060 And the only hex I think you'll see in this slide. 140 00:09:57,200 --> 00:09:57,960 Or in this presentation. 141 00:09:59,820 --> 00:10:02,260 So, the first thing I want to do is think about. 142 00:10:02,720 --> 00:10:04,140 If you're going to do dumb fuzzing. 143 00:10:04,240 --> 00:10:06,640 So, you have to start with a PNG. 144 00:10:06,820 --> 00:10:09,780 And you have to start flipping bits or adding strings or doing something. 145 00:10:11,180 --> 00:10:12,600 What kind of PNGs are out there? 146 00:10:12,680 --> 00:10:13,580 So, you've got to start with something. 147 00:10:13,580 --> 00:10:15,380 So, you're probably going to go to the internet. 148 00:10:15,540 --> 00:10:17,300 And find some file and start with that. 149 00:10:17,440 --> 00:10:18,660 So, what kind of files are out there? 150 00:10:18,740 --> 00:10:19,560 What are you going to stumble upon? 151 00:10:20,740 --> 00:10:22,580 So, I downloaded every PNG I could find. 152 00:10:22,700 --> 00:10:24,380 Which turned out to be about 1,600 of them. 153 00:10:24,680 --> 00:10:25,380 They're all unique. 154 00:10:26,300 --> 00:10:28,000 I wrote a program which processed each one. 155 00:10:28,160 --> 00:10:32,120 And printed out and stored the types of chunks that were in that file. 156 00:10:32,320 --> 00:10:33,120 And the number of chunks. 157 00:10:34,140 --> 00:10:36,940 And you can see here that it kind of surprised me. 158 00:10:37,060 --> 00:10:39,660 That most of these files didn't have very many different chunk types. 159 00:10:41,380 --> 00:10:43,380 So, on average they had about five. 160 00:10:43,380 --> 00:10:45,340 Five different chunk types of the possible 21. 161 00:10:46,560 --> 00:10:47,880 There wasn't much standard deviation. 162 00:10:48,200 --> 00:10:49,960 I found one file that had nine chunk types. 163 00:10:50,180 --> 00:10:53,520 And I found a bunch of them that only had the three that are required. 164 00:10:56,100 --> 00:10:59,460 So, you have to think that if you're going to. 165 00:11:00,280 --> 00:11:01,200 Assuming that every. 166 00:11:02,020 --> 00:11:06,120 There's different code in the target program to process the different chunk types. 167 00:11:06,480 --> 00:11:10,760 If you start with a PNG that doesn't have a particular chunk type. 168 00:11:10,840 --> 00:11:12,940 You're never going to fuzz the code that processes that. 169 00:11:13,060 --> 00:11:13,220 So. 170 00:11:13,380 --> 00:11:18,400 It's really important that you understand that. 171 00:11:18,680 --> 00:11:20,860 And if you grab a file off the internet. 172 00:11:20,980 --> 00:11:22,300 And you only have five chunk types. 173 00:11:22,420 --> 00:11:25,360 And you start fuzzing dumbly with that file. 174 00:11:25,760 --> 00:11:30,360 You're going to end up only fuzzing like five of the possible 21 functions. 175 00:11:30,540 --> 00:11:31,500 If that's how they do it. 176 00:11:32,580 --> 00:11:35,600 So, this is a distribution of the different chunk types. 177 00:11:36,220 --> 00:11:40,480 And what percentage of the files contain one of those types. 178 00:11:40,860 --> 00:11:42,500 So, you can see the three that are mandatory. 179 00:11:42,620 --> 00:11:43,000 Obviously. 180 00:11:43,000 --> 00:11:43,700 They all had those. 181 00:11:44,360 --> 00:11:45,120 But otherwise, you know. 182 00:11:45,160 --> 00:11:47,460 There's a bunch that you can look at over towards the right. 183 00:11:47,560 --> 00:11:48,940 That didn't show up at all. 184 00:11:49,840 --> 00:11:52,600 And there's a lot of other ones that only show up in 5% or less of the files. 185 00:11:52,700 --> 00:11:56,440 So, that's what average PNGs look like. 186 00:11:56,520 --> 00:11:58,140 They don't have a lot of different types. 187 00:11:59,980 --> 00:12:01,420 And this is just restating that. 188 00:12:01,560 --> 00:12:04,480 So, basically if you pick a random file on the internet. 189 00:12:04,560 --> 00:12:05,700 It's probably going to have around five chunks. 190 00:12:07,300 --> 00:12:09,760 Nine of the 21 types occur in less than 5% of files. 191 00:12:11,140 --> 00:12:12,380 Four of them never showed up at all. 192 00:12:13,600 --> 00:12:16,680 And again, the important thing about that is. 193 00:12:16,780 --> 00:12:21,360 If you start to use this as the basis for your mutation based fuzzer. 194 00:12:21,520 --> 00:12:25,500 You're never going to fuzz any of the code for the chunks that aren't present in your file. 195 00:12:26,100 --> 00:12:28,620 And of course, I know this because I looked at it. 196 00:12:28,740 --> 00:12:30,120 But if you didn't know anything about PNGs. 197 00:12:30,140 --> 00:12:30,980 You wouldn't know that. 198 00:12:31,060 --> 00:12:32,420 And you would think you would have done a great job. 199 00:12:32,520 --> 00:12:34,460 Because you started with a couple PNGs and fuzzed them. 200 00:12:34,780 --> 00:12:37,540 But really, you wouldn't have fuzzed a lot of the code. 201 00:12:39,380 --> 00:12:40,420 So, in order to. 202 00:12:42,080 --> 00:12:42,880 So, I said. 203 00:12:43,000 --> 00:12:43,020 I said earlier. 204 00:12:43,280 --> 00:12:44,100 While assuming that. 205 00:12:44,120 --> 00:12:46,860 That maybe they just process all the different chunk types the same way. 206 00:12:46,920 --> 00:12:47,540 So, it doesn't really matter. 207 00:12:47,880 --> 00:12:49,840 And so, to answer some of my questions. 208 00:12:49,980 --> 00:12:51,520 I took one particular library. 209 00:12:51,760 --> 00:12:53,900 And I'm going to analyze the heck out of it. 210 00:12:54,020 --> 00:12:55,420 So, I looked at libpng. 211 00:12:56,700 --> 00:12:59,320 Which is an open source package. 212 00:12:59,460 --> 00:13:02,640 Used in a lot of the browsers. 213 00:13:04,340 --> 00:13:09,500 And I wanted to make sure that each of the chunk types had separate code. 214 00:13:10,060 --> 00:13:11,040 To handle it. 215 00:13:12,040 --> 00:13:12,980 So, the first thing I did. 216 00:13:12,980 --> 00:13:13,580 The way I did that. 217 00:13:14,300 --> 00:13:15,120 And, you know, obviously. 218 00:13:15,200 --> 00:13:16,960 With libpng, I could just look at the source code. 219 00:13:17,100 --> 00:13:18,360 But originally, I had sort of. 220 00:13:18,840 --> 00:13:22,760 I was planning on using like three or four different PNG processors. 221 00:13:22,940 --> 00:13:24,380 So, that's why I chose this way. 222 00:13:24,440 --> 00:13:25,040 Because it's generic. 223 00:13:25,320 --> 00:13:25,820 But anyway. 224 00:13:25,900 --> 00:13:26,240 Trust me. 225 00:13:26,340 --> 00:13:27,700 It really does have different code for each one. 226 00:13:28,380 --> 00:13:28,860 But anyway. 227 00:13:28,960 --> 00:13:31,460 I took PNGs. 228 00:13:32,180 --> 00:13:34,380 That contained just the three mandatory chunks. 229 00:13:34,740 --> 00:13:35,740 And then one more each. 230 00:13:39,280 --> 00:13:40,140 So, let's see. 231 00:13:40,660 --> 00:13:41,200 And then. 232 00:13:41,400 --> 00:13:42,180 So, that way. 233 00:13:42,180 --> 00:13:43,780 I basically had four chunk types. 234 00:13:44,260 --> 00:13:45,700 And the three mandatory and one extra. 235 00:13:45,800 --> 00:13:46,640 And I fuzzed each one. 236 00:13:48,940 --> 00:13:53,720 And this graph is just supposed to show you that there is different. 237 00:13:54,660 --> 00:13:59,640 So, there's different amounts of code were used to process each of the different chunk types. 238 00:14:01,180 --> 00:14:04,300 And the sort of odd measure that I used was. 239 00:14:05,600 --> 00:14:08,600 The number of lines of code required to process each. 240 00:14:08,660 --> 00:14:11,760 As a percentage of the number of lines required to process. 241 00:14:11,840 --> 00:14:12,160 And then we'll. 242 00:14:12,180 --> 00:14:13,340 It's a mouthful. 243 00:14:13,520 --> 00:14:15,040 And if you want to know why I chose that. 244 00:14:15,940 --> 00:14:16,920 Please see me afterwards. 245 00:14:17,120 --> 00:14:17,840 But I'm running out of time. 246 00:14:18,880 --> 00:14:19,320 All right. 247 00:14:19,360 --> 00:14:22,080 So, some chunk types require more code than others for processing. 248 00:14:22,800 --> 00:14:23,800 Four chunk types. 249 00:14:24,260 --> 00:14:25,720 The four that never showed up. 250 00:14:25,720 --> 00:14:28,680 Actually require 76% more code than just an average file. 251 00:14:28,840 --> 00:14:34,640 So, that's 76% more code than just a minimal PNG that you'll never fuzz with dumb fuzzing. 252 00:14:36,680 --> 00:14:37,080 Okay. 253 00:14:38,080 --> 00:14:38,880 So, again. 254 00:14:38,980 --> 00:14:39,960 Now I'm going to compare. 255 00:14:40,380 --> 00:14:41,800 So, I guess the point of that was. 256 00:14:41,800 --> 00:14:44,320 It's important which one you start with. 257 00:14:44,800 --> 00:14:48,880 And now I want to see how much better is generational based than mutation based. 258 00:14:49,000 --> 00:14:49,760 So, smart versus dumb. 259 00:14:50,140 --> 00:14:51,240 So, I ran three experiments. 260 00:14:52,140 --> 00:14:55,620 One was I wanted to measure the dumb fuzzing. 261 00:14:55,700 --> 00:14:57,300 So, I started with three different files. 262 00:14:57,600 --> 00:14:58,820 One that had five chunks. 263 00:14:59,720 --> 00:15:02,440 Which is sort of what you would typically find if you just randomly pick one. 264 00:15:02,620 --> 00:15:03,460 One that had seven. 265 00:15:03,520 --> 00:15:04,600 Which you'd have to be pretty lucky. 266 00:15:04,820 --> 00:15:06,060 And then the one that had the nine. 267 00:15:06,520 --> 00:15:09,580 So, that one you'd have to play the lottery to win. 268 00:15:09,840 --> 00:15:10,680 And for each of these. 269 00:15:10,740 --> 00:15:11,480 I used something. 270 00:15:11,480 --> 00:15:16,220 Something basically like file fuzz to generate 100,000 test cases. 271 00:15:18,120 --> 00:15:18,520 Okay. 272 00:15:18,600 --> 00:15:22,680 Experiment two was to make sure that the program is not just going to spit these things out right away. 273 00:15:22,740 --> 00:15:23,660 Because they had CRCs. 274 00:15:24,000 --> 00:15:26,560 I took the 300,000 files from the first experiment. 275 00:15:26,680 --> 00:15:27,860 And fixed up all the CRCs. 276 00:15:28,120 --> 00:15:29,340 And re-ran the experiment. 277 00:15:29,500 --> 00:15:33,140 Just to make sure that it wasn't something about the CRC that was in the data. 278 00:15:34,580 --> 00:15:36,240 And finally, for the third experiment. 279 00:15:36,540 --> 00:15:38,780 I used spike file and the PNG specification. 280 00:15:39,820 --> 00:15:41,180 And I generated files. 281 00:15:41,480 --> 00:15:43,580 That contained every single chunk type. 282 00:15:44,360 --> 00:15:46,660 And fuzzed every single field in the chunk type. 283 00:15:46,740 --> 00:15:48,940 So, the CRCs, links, chunk names, the data, everything. 284 00:15:49,420 --> 00:15:49,980 And doing that. 285 00:15:50,040 --> 00:15:51,800 I ended up with 29,000 files. 286 00:15:52,000 --> 00:15:54,040 Which is quite a bit less than the other ones. 287 00:15:55,400 --> 00:15:57,980 So, here's basically the whole talk in one slide. 288 00:15:59,100 --> 00:16:00,160 If you look in the left. 289 00:16:00,280 --> 00:16:08,100 So, the first three bars are using dumb fuzzing on the file that had five, seven, and nine chunk types. 290 00:16:08,640 --> 00:16:09,480 And so, you can see. 291 00:16:09,580 --> 00:16:10,860 If you can read the numbers. 292 00:16:10,940 --> 00:16:11,260 I can. 293 00:16:12,840 --> 00:16:14,540 So, the one was 60% more. 294 00:16:14,700 --> 00:16:16,600 And the green one is 140% more. 295 00:16:16,740 --> 00:16:18,500 So, you basically get twice as much. 296 00:16:18,800 --> 00:16:19,820 And this is code coverage. 297 00:16:20,340 --> 00:16:23,820 Twice as much code coverage by fuzzing the. 298 00:16:24,720 --> 00:16:29,360 Starting with the nine chunked PNG versus the five chunked PNG. 299 00:16:29,500 --> 00:16:33,900 So, you can get twice as much code coverage just by choosing the right file to start with. 300 00:16:34,320 --> 00:16:37,500 And you get the same sort of phenomenon on the ones where I fixed the CRCs. 301 00:16:37,940 --> 00:16:39,080 Didn't seem to make much difference. 302 00:16:39,320 --> 00:16:40,980 And then you look at the one all the way on the right. 303 00:16:40,980 --> 00:16:43,300 And that's the one I got from using generational-based fuzzing. 304 00:16:44,060 --> 00:16:45,940 And that one, the number says 289. 305 00:16:46,680 --> 00:16:48,120 So, you do get quite a bit more. 306 00:16:50,020 --> 00:16:50,980 So, I should. 307 00:16:51,140 --> 00:16:51,780 The one caveat. 308 00:16:51,960 --> 00:16:53,400 I didn't mention code coverage until just now. 309 00:16:53,540 --> 00:16:54,600 That's how I was measuring this. 310 00:16:55,640 --> 00:16:58,780 The caveat is if you get code coverage, that doesn't necessarily mean you're going to find bugs. 311 00:16:59,100 --> 00:17:02,600 But definitely, if you don't cover a certain line, you're definitely not going to find a bug there. 312 00:17:03,180 --> 00:17:03,480 Anyway. 313 00:17:03,580 --> 00:17:04,800 So, to wrap things up. 314 00:17:07,260 --> 00:17:09,440 Mutation-based fuzzing is very dependent on the inputs. 315 00:17:09,900 --> 00:17:10,960 And choosing the right. 316 00:17:10,980 --> 00:17:14,240 Input in this case, you can get up to twice as good of code coverage. 317 00:17:15,760 --> 00:17:19,800 Generation-based fuzzing is much better than mutation-based in this case. 318 00:17:20,200 --> 00:17:21,640 It's two to five times better. 319 00:17:21,720 --> 00:17:24,240 Depending on which file you started with. 320 00:17:25,300 --> 00:17:27,220 And this is only one file type. 321 00:17:27,440 --> 00:17:29,100 So, it might not generalize. 322 00:17:29,420 --> 00:17:30,520 But it kind of might. 323 00:17:30,640 --> 00:17:38,280 So, the only other data I've ever seen that talks kind of about this is in the book Fuzzing that just came out. 324 00:17:38,940 --> 00:17:39,620 Very good book. 325 00:17:39,620 --> 00:17:43,780 They examined 10,000 SWF files. 326 00:17:44,000 --> 00:17:46,680 And this is the distribution that they found for the version numbers. 327 00:17:47,700 --> 00:17:52,480 And sure enough, if you just wanted to do blind dumb fuzzing of Flash. 328 00:17:53,260 --> 00:17:54,900 And you just pick some files off the internet. 329 00:17:55,400 --> 00:17:59,340 You're not going to be fuzzing anything that's Flash 7 or 8 specific. 330 00:17:59,580 --> 00:18:02,320 Because only 3% of the files are going to do that. 331 00:18:02,420 --> 00:18:03,920 So, again, this is an important case. 332 00:18:04,020 --> 00:18:08,500 If you want to fuzz Flash and you want to use the dumb fuzzing technique. 333 00:18:08,500 --> 00:18:11,200 You need to make sure you get a file that has Flash 8. 334 00:18:11,320 --> 00:18:13,760 And you can do much better that way. 335 00:18:14,200 --> 00:18:15,980 So, that's it. 336 00:18:16,120 --> 00:18:17,060 I guess I'm out of time. 337 00:18:17,140 --> 00:18:20,860 So, if you have questions, please follow me to the question and answer room. 338 00:18:21,560 --> 00:18:21,920 Thanks. 339 00:18:22,580 --> 00:18:22,940 Thank you. 340 00:18:23,300 --> 00:18:24,420 Thank you.