1 00:00:00,000 --> 00:00:03,280 So let me take this out since we're allowed to do that. 2 00:00:03,500 --> 00:00:05,680 So we're talking about automated exploit detection. 3 00:00:06,300 --> 00:00:08,540 Fuck this manual looking at IDA shit page by page, 4 00:00:08,620 --> 00:00:09,220 line by line. 5 00:00:09,360 --> 00:00:10,240 It's fucking losers. 6 00:00:10,440 --> 00:00:13,000 Anyone who talks about that in their talk is leading you 7 00:00:13,000 --> 00:00:13,760 down the wrong path. 8 00:00:15,380 --> 00:00:15,880 What's that? 9 00:00:16,920 --> 00:00:17,360 . 10 00:00:18,380 --> 00:00:18,820 What? 11 00:00:19,280 --> 00:00:19,720 . 12 00:00:21,800 --> 00:00:24,640 My friend Luis here is talking about making debuggers and 13 00:00:24,640 --> 00:00:27,540 static analyzers talk to each other as opposed to doing 14 00:00:27,540 --> 00:00:28,200 things manually. 15 00:00:28,240 --> 00:00:29,440 It's about doing things more optimally. 16 00:00:29,440 --> 00:00:31,860 But he admitted in his talk it is still a Band-Aid. 17 00:00:31,980 --> 00:00:32,540 Is that correct? 18 00:00:33,460 --> 00:00:33,820 Yes. 19 00:00:34,880 --> 00:00:36,280 But it's a really good Band-Aid. 20 00:00:41,680 --> 00:00:43,460 It's like those Band-Aids, you know, that have 21 00:00:43,460 --> 00:00:44,700 cartoon on them. 22 00:00:46,420 --> 00:00:47,840 Very entertaining Band-Aid. 23 00:00:48,680 --> 00:00:50,240 Glow in the dark, scratch and sniff. 24 00:00:50,500 --> 00:00:52,740 G.I. Joe, Barbie, Teenage Mutant Ninja 25 00:00:52,740 --> 00:00:53,960 Turtles, et cetera, et cetera. 26 00:00:54,120 --> 00:00:55,460 Just like my underoos. 27 00:00:55,480 --> 00:00:55,840 Do you want to see? 28 00:00:56,940 --> 00:00:57,300 No? 29 00:00:57,460 --> 00:00:57,840 All right. 30 00:00:59,440 --> 00:01:01,820 So we're going to talk about automated exploit detection 31 00:01:01,820 --> 00:01:02,580 binaries. 32 00:01:02,720 --> 00:01:04,160 And I'm Matt, and that's Luis. 33 00:01:04,980 --> 00:01:07,840 And those are our URLs and our email addresses. 34 00:01:08,180 --> 00:01:10,060 And the project we're going to be talking about is bug report. 35 00:01:10,360 --> 00:01:11,700 And that's the SourceForge URL. 36 00:01:11,980 --> 00:01:15,080 If anybody is so inclined to go and start downloading the code 37 00:01:15,080 --> 00:01:17,980 right now so you can ask us extremely pertinent questions 38 00:01:18,400 --> 00:01:21,700 by the end of the talk, if you are so inclined. 39 00:01:24,820 --> 00:01:25,620 All right. 40 00:01:25,720 --> 00:01:26,580 So like I said, I'm Matt. 41 00:01:26,760 --> 00:01:29,420 And so, see, the last time I spoke at DEF CON was in two. 42 00:01:29,420 --> 00:01:30,080 2000. 43 00:01:30,460 --> 00:01:32,800 And we just taught classes on the DEF CON. 44 00:01:32,800 --> 00:01:33,220 It was yesterday. 45 00:01:33,540 --> 00:01:34,700 Oh, it was yesterday. 46 00:01:34,920 --> 00:01:35,700 My mistake. 47 00:01:37,480 --> 00:01:39,860 Yesterday is kind of a blur, but seven years ago? 48 00:01:40,100 --> 00:01:40,740 Fuck yeah. 49 00:01:41,900 --> 00:01:43,440 That's rote memory, basically. 50 00:01:43,600 --> 00:01:46,700 So before that, it was in 2000. 51 00:01:47,000 --> 00:01:50,360 We just taught a two-day class, two two-day classes of Blackout 52 00:01:50,360 --> 00:01:50,840 on this subject. 53 00:01:50,960 --> 00:01:53,060 We're going to give you a highly condensed version that 54 00:01:53,060 --> 00:01:58,000 is a lot more focused on the tool itself as opposed to a lot 55 00:01:58,000 --> 00:01:59,400 of the concept and things like that. 56 00:01:59,400 --> 00:02:01,520 So in the class, we basically taught people, 57 00:02:01,640 --> 00:02:04,560 how do you write an automated code analysis tool for binaries 58 00:02:04,560 --> 00:02:08,200 from scratch so as to commoditize the entire code 59 00:02:08,200 --> 00:02:10,300 analysis market, which is making too much money 60 00:02:10,300 --> 00:02:11,180 for too little functionality. 61 00:02:12,300 --> 00:02:14,220 And so, yeah. 62 00:02:14,560 --> 00:02:18,500 So, see, I taught a Rootkit class at Black Hat. 63 00:02:18,780 --> 00:02:20,520 And let's see, we did talks together at DEF CON. 64 00:02:21,400 --> 00:02:23,920 Really several security advisors over the years 65 00:02:23,920 --> 00:02:24,860 for exploitable bugs. 66 00:02:25,240 --> 00:02:29,260 One of the major ones that people may remember is, well, 67 00:02:29,260 --> 00:02:32,640 we found one packet that would crash basically any BSD box. 68 00:02:32,860 --> 00:02:34,980 It was an unaligned ICMP timestamp option thing. 69 00:02:35,340 --> 00:02:40,040 And NetBSD, OpenBSD, and FreeBSD on non-X86 architectures, 70 00:02:40,580 --> 00:02:41,800 crashing that with one packet. 71 00:02:43,600 --> 00:02:45,120 I can attribute a lot to open source. 72 00:02:45,380 --> 00:02:47,220 I fund a good deal of open source right now. 73 00:02:47,320 --> 00:02:49,900 One of the things I'm funding is a PlayStation 2 emulator 74 00:02:49,900 --> 00:02:52,220 called PCSX2, which you can Google. 75 00:02:53,920 --> 00:02:54,460 What's that? 76 00:02:56,720 --> 00:02:57,780 How about fuck you? 77 00:02:57,880 --> 00:02:58,580 Think, I'm talking. 78 00:02:58,760 --> 00:02:59,120 All right. 79 00:02:59,620 --> 00:03:04,380 So, anyways, PCSX2, I'm going to fund the Xbox development 80 00:03:04,380 --> 00:03:06,100 on that because I want to play Katamari on my Xbox. 81 00:03:07,020 --> 00:03:08,720 So, anyways, I fund a lot of open source development. 82 00:03:08,980 --> 00:03:11,800 And I work on a lot of product stuff, a lot of practical solutions, 83 00:03:11,980 --> 00:03:14,440 not academic jerking off like a lot of people talk about. 84 00:03:14,600 --> 00:03:15,580 And they never release anything. 85 00:03:15,960 --> 00:03:17,940 So, one of the things that we've done is we're going to release a tool 86 00:03:17,940 --> 00:03:20,780 with source code that actually works as opposed to, geez, 87 00:03:20,880 --> 00:03:22,720 I wonder if I could make, I don't know, 88 00:03:23,280 --> 00:03:26,440 something that would translate every binary into the same kind 89 00:03:26,440 --> 00:03:28,300 of bytecode, then we could analyze the bytecode and work 90 00:03:28,300 --> 00:03:29,060 on it for seven years. 91 00:03:29,060 --> 00:03:30,300 There's no results, for instance. 92 00:03:31,900 --> 00:03:32,640 And then, Luis. 93 00:03:34,680 --> 00:03:36,960 LUIS GARCIA- I do mostly hardware and software 94 00:03:36,960 --> 00:03:40,820 reversing for myself, mostly. 95 00:03:41,100 --> 00:03:43,500 And sometimes I do contracts for other people. 96 00:03:43,600 --> 00:03:44,340 But mostly it's for myself. 97 00:03:44,680 --> 00:03:45,560 I like reversing. 98 00:03:45,740 --> 00:03:49,640 I like to be able to see what's inside a binary, a protocol, 99 00:03:49,780 --> 00:03:51,040 an algorithm, or what have you. 100 00:03:51,320 --> 00:03:52,780 To me, it just is really interesting. 101 00:03:53,060 --> 00:03:54,460 That's really about it for me. 102 00:03:56,600 --> 00:03:57,000 Sweet. 103 00:03:57,240 --> 00:03:58,540 And Luis and I have been doing stuff together, 104 00:03:58,580 --> 00:03:59,040 like I said. 105 00:03:59,060 --> 00:04:03,460 That first advisory was in 99, something like that. 106 00:04:03,940 --> 00:04:05,840 And we released a couple of advisories over the years as 107 00:04:05,840 --> 00:04:05,960 well. 108 00:04:06,200 --> 00:04:08,220 So let's go to the next slide. 109 00:04:08,960 --> 00:04:09,760 So here's what we're talking about. 110 00:04:09,780 --> 00:04:11,200 We're talking about the definition of static analysis. 111 00:04:11,360 --> 00:04:13,040 We're going to talk about some of the underlying concepts. 112 00:04:13,200 --> 00:04:13,800 We're going to talk about challenges. 113 00:04:14,120 --> 00:04:17,060 Challenges are things that can be overcome easily if you just 114 00:04:17,060 --> 00:04:19,560 put your mind to it and not listen to discouraging 115 00:04:19,560 --> 00:04:20,000 assholes. 116 00:04:20,480 --> 00:04:22,880 And obstacles are things that are a little more difficult to 117 00:04:22,880 --> 00:04:23,640 overcome in reality. 118 00:04:24,720 --> 00:04:26,740 And we're going to talk about the solutions for these things 119 00:04:26,740 --> 00:04:27,820 in C-Sharp that we've implemented. 120 00:04:29,060 --> 00:04:31,900 Real-world exploit tests, where we look at real programs 121 00:04:31,900 --> 00:04:33,720 that we've compiled, and things like that. 122 00:04:33,840 --> 00:04:35,280 There are some limitations to the tool. 123 00:04:35,340 --> 00:04:36,600 We'll talk about those as we go along. 124 00:04:40,580 --> 00:04:41,300 Excuse me. 125 00:04:42,180 --> 00:04:42,620 Wow. 126 00:04:43,880 --> 00:04:44,660 So let's see. 127 00:04:44,740 --> 00:04:46,520 So BugReport's a project we're talking about. 128 00:04:46,680 --> 00:04:49,480 It started out as a set of tests for analysis tools. 129 00:04:49,680 --> 00:04:52,080 I worked on a commercial product that did code analysis. 130 00:04:52,460 --> 00:04:55,120 And that product was removed from the market for various 131 00:04:55,120 --> 00:04:56,280 reasons that I can't go into. 132 00:04:56,640 --> 00:04:57,300 But anyways. 133 00:04:57,300 --> 00:05:00,440 I was kind of disappointed with the kind of state of code 134 00:05:00,440 --> 00:05:01,100 analysis tools. 135 00:05:01,360 --> 00:05:03,460 And so I was trying to come up with a way how to move this 136 00:05:03,460 --> 00:05:03,780 forward. 137 00:05:03,840 --> 00:05:07,720 So I figured a really good kind of suite of programs that 138 00:05:07,720 --> 00:05:12,180 would give a kind of an objective evaluation of 139 00:05:12,180 --> 00:05:13,820 different tools, for instance. 140 00:05:14,040 --> 00:05:15,180 And there's a couple of things out there. 141 00:05:15,240 --> 00:05:16,420 But they're all vendor related. 142 00:05:16,720 --> 00:05:19,160 A lot of these things are funded by companies that start 143 00:05:19,160 --> 00:05:21,340 with F and then then Fortify and things like this. 144 00:05:21,400 --> 00:05:23,400 So you can't really trust it too much, in my personal 145 00:05:23,400 --> 00:05:23,680 opinion. 146 00:05:23,920 --> 00:05:26,620 I don't think they exercise code analysis tools very well. 147 00:05:27,780 --> 00:05:29,660 So I started out with that kind of concept. 148 00:05:29,800 --> 00:05:30,460 And I was like, you know what? 149 00:05:30,540 --> 00:05:33,980 I should do a Black Hat class or a DEF CON thing to put these 150 00:05:33,980 --> 00:05:35,620 ideas out there to commoditize them. 151 00:05:35,700 --> 00:05:37,580 I don't like people who keep their ideas all to themselves 152 00:05:37,580 --> 00:05:38,320 like they're secret. 153 00:05:38,600 --> 00:05:40,820 We need to commoditize these things and move on to the next 154 00:05:40,820 --> 00:05:43,460 level and move on to the next better ideas. 155 00:05:45,320 --> 00:05:47,640 So it's a proof of concept kind of thing. 156 00:05:47,840 --> 00:05:50,580 Proof of concept, in this particular context, actually 157 00:05:50,920 --> 00:05:52,680 works just in a very narrow context. 158 00:05:52,900 --> 00:05:53,920 And it's very easy to extend. 159 00:05:54,140 --> 00:05:55,400 And we're going to talk about how easy it's 160 00:05:55,400 --> 00:05:56,260 going to be to extend. 161 00:05:56,260 --> 00:05:59,380 And after this talk, anyone who's interested can come 162 00:05:59,380 --> 00:06:05,920 pair program with Luis and I and Brian, Eric maybe, Todd, 163 00:06:06,100 --> 00:06:07,720 Doug, or my husband, Jeff. 164 00:06:07,820 --> 00:06:09,220 By the way, it's my husband's birthday today. 165 00:06:10,680 --> 00:06:12,920 He just turned 16 years old. 166 00:06:15,660 --> 00:06:16,980 We got married in Norway. 167 00:06:17,260 --> 00:06:21,240 Anyways, we're releasing this in the GPL v3 draft 2 so 168 00:06:21,240 --> 00:06:23,660 people can't do things like embed it into an appliance and 169 00:06:23,660 --> 00:06:25,520 then circumvent the GPL that way. 170 00:06:27,880 --> 00:06:29,360 Or do anything else like that. 171 00:06:29,540 --> 00:06:31,720 We talked about using the Metasploit license, but I 172 00:06:31,720 --> 00:06:35,940 figured the GPL v3 would be a little more broadly known, 173 00:06:36,040 --> 00:06:36,300 perhaps. 174 00:06:36,560 --> 00:06:39,820 And we have a bunch of GPL v3 t-shirts here that the Free 175 00:06:39,820 --> 00:06:43,020 Software Foundation has sent me. 176 00:06:43,240 --> 00:06:45,800 And so we're going to give those out for really awesome 177 00:06:45,800 --> 00:06:48,940 kick-ass questions at the end of this talk. 178 00:06:49,220 --> 00:06:52,860 And once again, that's the URL there if you're so inclined to 179 00:06:52,860 --> 00:06:54,620 download the source code and ask pertinent questions. 180 00:06:54,960 --> 00:06:56,240 And we're going to talk a little bit more about that in a 181 00:06:56,240 --> 00:06:56,360 little bit. 182 00:06:56,600 --> 00:06:59,400 And so we're doing, so bug report was developed in a test 183 00:06:59,400 --> 00:07:01,680 driven way in a clean room re-implementation. 184 00:07:02,000 --> 00:07:04,480 Like I couldn't be involved with code because of my personal 185 00:07:04,480 --> 00:07:05,620 involvement in a commercial tool. 186 00:07:05,900 --> 00:07:08,100 So it was done in a test driven way where I would send Luis 187 00:07:08,100 --> 00:07:08,820 test programs. 188 00:07:09,200 --> 00:07:12,220 And he read some TDD and extreme programming and C 189 00:07:12,220 --> 00:07:12,780 sharp books. 190 00:07:13,000 --> 00:07:17,040 And so basically this tool so far sort of represents what 191 00:07:17,040 --> 00:07:20,060 the tests thus far have guided the code to do. 192 00:07:20,340 --> 00:07:22,180 Nothing more and nothing less. 193 00:07:22,380 --> 00:07:24,700 However, as you'll see, it basically just works. 194 00:07:24,780 --> 00:07:26,060 And it's very easy to extend. 195 00:07:26,060 --> 00:07:28,620 And to make work, which we're going to do this evening after 196 00:07:28,620 --> 00:07:30,740 this talk, whether any of you guys participate or not. 197 00:07:34,180 --> 00:07:36,540 So I know I'm going to get this question, why C sharp? 198 00:07:36,680 --> 00:07:38,620 Microsoft sucks, blah, blah, blah. 199 00:07:39,060 --> 00:07:39,500 All right. 200 00:07:40,580 --> 00:07:42,620 So it's very similar to Java and C++. 201 00:07:42,840 --> 00:07:44,160 I like object orientated language. 202 00:07:44,300 --> 00:07:45,100 I know some people don't. 203 00:07:45,140 --> 00:07:46,680 Some people prefer functional languages or procedural 204 00:07:46,680 --> 00:07:47,080 languages. 205 00:07:47,280 --> 00:07:49,080 Different smoke strokes make the world go around. 206 00:07:49,200 --> 00:07:50,120 It's my personal preference. 207 00:07:50,640 --> 00:07:55,340 And so in sort of funding this project, as it were, this is my 208 00:07:55,340 --> 00:07:57,780 personal preference that I chose to see it executed upon. 209 00:07:58,060 --> 00:08:00,620 It's an open ECMA standard, unlike Java, which is completely 210 00:08:00,620 --> 00:08:04,700 controlled by Sun under a bogus community process that took 211 00:08:04,700 --> 00:08:07,260 about, oh God, I don't know, five years to get generics into 212 00:08:07,260 --> 00:08:08,460 the language in a really shitty way. 213 00:08:08,740 --> 00:08:10,700 So I didn't really want to use Java. 214 00:08:10,860 --> 00:08:12,840 I didn't have any good personal experiences with it. 215 00:08:12,960 --> 00:08:16,020 And I wasn't ready to dive into scripting languages or 216 00:08:16,020 --> 00:08:19,440 interpreted scripting languages anyway because I didn't 217 00:08:19,440 --> 00:08:21,720 understand their underlying implementation well enough to 218 00:08:21,720 --> 00:08:23,800 know the language features and stuff like that. 219 00:08:23,800 --> 00:08:25,640 So I kind of stuck with what I knew. 220 00:08:26,540 --> 00:08:28,860 There's three different open source implementations of C 221 00:08:28,860 --> 00:08:29,160 sharp. 222 00:08:29,340 --> 00:08:29,820 There is mono. 223 00:08:30,000 --> 00:08:30,960 There is .GNU. 224 00:08:31,060 --> 00:08:32,960 And there is the Microsoft shared source one. 225 00:08:33,180 --> 00:08:33,840 Pick one. 226 00:08:34,100 --> 00:08:34,740 Any one. 227 00:08:35,020 --> 00:08:38,260 Whichever license you like or don't like or whatever, whatever. 228 00:08:38,680 --> 00:08:39,960 There's three open source implementations. 229 00:08:40,400 --> 00:08:42,620 How many open source implementations are there are Java? 230 00:08:42,880 --> 00:08:43,300 Zero. 231 00:08:44,100 --> 00:08:44,540 Zero. 232 00:08:45,720 --> 00:08:48,740 Anyways, other than some things that are just like starting 233 00:08:48,740 --> 00:08:50,440 right now and aren't very functional at all. 234 00:08:51,260 --> 00:08:53,140 So it has specific features that we like. 235 00:08:53,140 --> 00:08:55,980 High speed generics, nullable value type, strong typing, stuff 236 00:08:55,980 --> 00:08:56,440 like that. 237 00:08:56,660 --> 00:08:57,780 I like strongly typed language. 238 00:08:57,880 --> 00:08:59,220 Some people like loosely typed languages. 239 00:08:59,540 --> 00:09:00,640 It's a matter of preference. 240 00:09:00,900 --> 00:09:01,840 There's no real judgment there. 241 00:09:02,860 --> 00:09:05,700 And also there's high quality and simple open source tools for 242 00:09:05,700 --> 00:09:06,220 unit testing. 243 00:09:06,320 --> 00:09:08,240 The ID that we're going to show you is completely open 244 00:09:08,240 --> 00:09:08,500 source. 245 00:09:08,640 --> 00:09:09,080 Sharp developed. 246 00:09:09,440 --> 00:09:10,440 I really like it. 247 00:09:10,560 --> 00:09:12,680 It has its nooks and crannies of things that don't work but 248 00:09:13,160 --> 00:09:13,860 basically just works. 249 00:09:20,100 --> 00:09:21,360 So target of detection. 250 00:09:21,700 --> 00:09:22,880 What do we care about? 251 00:09:24,540 --> 00:09:27,040 Now a lot of people use a lot of colorful languages and a lot 252 00:09:27,040 --> 00:09:30,240 of diagrams and things like this to basically tell you, to make it 253 00:09:30,240 --> 00:09:33,400 seem very, very complicated what's going on, to make it seem like 254 00:09:33,400 --> 00:09:35,880 they are the wizards of assembly or the wizards of IDEN, blah, 255 00:09:35,980 --> 00:09:36,260 blah, blah. 256 00:09:37,120 --> 00:09:38,220 Here's what it comes down to. 257 00:09:38,460 --> 00:09:39,100 The essence. 258 00:09:39,420 --> 00:09:41,560 And it's going to seem like an oversimplification but we're going 259 00:09:41,560 --> 00:09:45,640 to go over code and assembly and the analysis and why it's not an 260 00:09:46,060 --> 00:09:46,420 oversimplification. 261 00:09:46,940 --> 00:09:49,240 That is, we are looking for out of bound memory rights. 262 00:09:49,440 --> 00:09:51,320 We don't care about memory leaks necessarily. 263 00:09:51,660 --> 00:09:53,120 We don't care about W. 264 00:09:53,140 --> 00:09:54,000 Double freeze necessarily. 265 00:09:54,260 --> 00:09:55,560 We don't care about that kind of stuff. 266 00:09:56,260 --> 00:09:59,420 Or potential nullable dereferences and all this other kind of stuff. 267 00:09:59,520 --> 00:10:03,100 We care about out of bound memory rights because every exploitable buffer overflow comes down 268 00:10:03,100 --> 00:10:05,220 to this in essence. 269 00:10:05,400 --> 00:10:09,200 You have to overwrite a buffer of some kind or get your code on the machine somehow. 270 00:10:09,620 --> 00:10:17,180 There are some very minor corner cases like protocols for instance that take a dereference 271 00:10:17,180 --> 00:10:20,280 and memory pointer that's specified in a packet by address. 272 00:10:20,720 --> 00:10:22,180 That's a little bit different. 273 00:10:22,180 --> 00:10:25,960 But it is effectively the same for our purposes. 274 00:10:26,200 --> 00:10:30,860 So let's look at a simple example of an out of bound memory right in C. 275 00:10:37,020 --> 00:10:40,580 Keep talking while I find it. 276 00:10:40,820 --> 00:10:41,420 All right. 277 00:10:42,080 --> 00:10:43,440 Oh, let's see here now. 278 00:10:43,620 --> 00:10:43,700 Yeah. 279 00:10:43,740 --> 00:10:44,760 So out of bound memory rights. 280 00:10:46,020 --> 00:10:50,720 So you know, there's loops, there's branches, people tell you all about dominator trees 281 00:10:50,720 --> 00:10:52,160 and lots of rules. 282 00:10:52,160 --> 00:10:56,340 Really important sounding stuff and very academic stuff and how would I ever learn 283 00:10:56,340 --> 00:10:59,180 about dominator trees and algorithms and crap like that. 284 00:10:59,280 --> 00:11:00,160 It really doesn't matter. 285 00:11:00,540 --> 00:11:01,520 This is what matters. 286 00:11:01,780 --> 00:11:02,800 Out of bound memory rights. 287 00:11:03,000 --> 00:11:06,460 We're going to go over loops, by the way, and make all those people look like they're 288 00:11:06,460 --> 00:11:11,260 full of hot air, which they are, because you'll see how simple it is to understand at the 289 00:11:11,260 --> 00:11:11,740 basic level. 290 00:11:11,980 --> 00:11:14,500 So this is an out of bound memory right at the simplest level. 291 00:11:14,660 --> 00:11:15,640 Where's one I can see? 292 00:11:16,140 --> 00:11:17,040 There's one I can see. 293 00:11:18,200 --> 00:11:19,480 So here's a simple thing. 294 00:11:19,660 --> 00:11:21,320 We're mallocing 16 bytes and we're writing. 295 00:11:22,160 --> 00:11:24,780 Out of bounds, out of the array with immediate data. 296 00:11:25,300 --> 00:11:26,860 So is this exploitable? 297 00:11:27,000 --> 00:11:27,680 No it is not. 298 00:11:27,800 --> 00:11:29,420 Here's our definition of exploitable. 299 00:11:29,740 --> 00:11:33,400 It's really funny when you talk to some of these vendors and you say, oh, well, do you 300 00:11:33,400 --> 00:11:34,320 detect exploitable bugs? 301 00:11:34,400 --> 00:11:37,560 They go, well, it depends on what you mean by exploitable and bug. 302 00:11:38,040 --> 00:11:40,380 And it's like, what the fuck are you talking about? 303 00:11:41,480 --> 00:11:46,260 I'm sorry, I didn't come to the conference with a thesaurus under my arm to try to, like, 304 00:11:46,740 --> 00:11:48,220 work out your market speak. 305 00:11:49,700 --> 00:11:51,840 In this case, what our definition... 306 00:11:51,840 --> 00:11:56,280 Or my definition, anyway, of an exploitable bug is an out of bound memory right that is 307 00:11:56,280 --> 00:12:00,180 with user supply data that is unconstrained, that has not been constrained properly. 308 00:12:00,520 --> 00:12:02,140 And we'll understand constraints a little bit later. 309 00:12:02,720 --> 00:12:05,220 So in this case, this is not exploitable, but still a bug, right? 310 00:12:05,300 --> 00:12:06,280 You're still corrupting memory. 311 00:12:06,400 --> 00:12:09,960 You're still going one outside the bounds of the buffer, which may or may not fuck things 312 00:12:09,960 --> 00:12:12,280 up to the point where your program will do something unexpected. 313 00:12:15,700 --> 00:12:18,000 Let's go back to the slide real quick. 314 00:12:20,500 --> 00:12:21,740 Can you make the font in... 315 00:12:22,200 --> 00:12:22,820 Texting there? 316 00:12:24,180 --> 00:12:24,580 Sure. 317 00:12:25,960 --> 00:12:26,900 We can do that. 318 00:12:27,960 --> 00:12:28,700 No worries. 319 00:12:32,820 --> 00:12:33,760 A LASIK doctor? 320 00:12:36,360 --> 00:12:36,960 I don't know. 321 00:12:36,980 --> 00:12:37,960 You hear what happened to Kathy Griffin? 322 00:12:38,160 --> 00:12:39,400 She had a really bad LASIK experience. 323 00:12:39,540 --> 00:12:41,140 You can look on her website, kathygriffin.net. 324 00:12:41,720 --> 00:12:43,740 See all the really gross pictures of her eye. 325 00:12:50,720 --> 00:12:51,440 Let's pick something. 326 00:12:51,620 --> 00:12:51,720 I don't know. 327 00:12:52,520 --> 00:12:53,580 There we go. 328 00:12:59,420 --> 00:13:00,420 All right. 329 00:13:00,680 --> 00:13:01,760 News of the day. 330 00:13:01,960 --> 00:13:02,760 Text pad sucks. 331 00:13:12,740 --> 00:13:15,220 Maybe you have to do a select all actually. 332 00:13:15,460 --> 00:13:16,000 Maybe they're right. 333 00:13:16,000 --> 00:13:17,300 Try selecting. 334 00:13:17,520 --> 00:13:19,060 This is the reference for the whole title. 335 00:13:19,120 --> 00:13:19,340 Okay. 336 00:13:22,320 --> 00:13:23,340 It's fine, move on. 337 00:13:23,760 --> 00:13:24,500 Yeah, just move on. 338 00:13:24,500 --> 00:13:26,420 Alright, two tears in a bucket, mother fuck it. 339 00:13:26,500 --> 00:13:26,960 Here we go. 340 00:13:29,500 --> 00:13:31,000 Alright, so if we go back to the, 341 00:13:32,760 --> 00:13:34,140 back to the Slyzides. 342 00:13:34,640 --> 00:13:35,800 That's small too, alright. 343 00:13:36,100 --> 00:13:36,360 Yeah, well. 344 00:13:37,940 --> 00:13:38,800 There's no winning. 345 00:13:39,380 --> 00:13:40,340 There really isn't. 346 00:13:41,060 --> 00:13:42,720 So, that's an out of bound memory, right? 347 00:13:42,800 --> 00:13:45,420 And so, if we look at the x86 for that memory, right? 348 00:13:45,420 --> 00:13:47,380 And this time, we'll try to do it in a bigger font, 349 00:13:47,540 --> 00:13:48,180 I promise you. 350 00:13:55,220 --> 00:13:56,280 It's gonna be in the same font. 351 00:13:56,580 --> 00:13:56,920 Is it? 352 00:13:57,060 --> 00:13:57,460 Yeah. 353 00:13:57,680 --> 00:13:58,000 It's not gonna work. 354 00:13:58,300 --> 00:13:59,040 It's not gonna work. 355 00:14:05,140 --> 00:14:06,100 There we go. 356 00:14:06,220 --> 00:14:07,060 There we go. 357 00:14:07,680 --> 00:14:08,780 Now it obeys. 358 00:14:17,860 --> 00:14:21,880 Alright, so, there's some preamble stuff 359 00:14:21,880 --> 00:14:22,880 where it's setting up the stack. 360 00:14:23,040 --> 00:14:25,520 That's line one, all about line, through line 118. 361 00:14:25,760 --> 00:14:26,680 One of the things we've done here, 362 00:14:26,720 --> 00:14:28,320 we've generated this using objdump, 363 00:14:28,400 --> 00:14:30,200 which comes with binutils, which is free with anything. 364 00:14:30,960 --> 00:14:33,380 Objdump is really cool because if you build it yourself, 365 00:14:33,560 --> 00:14:34,960 you can say enable all platforms, 366 00:14:35,180 --> 00:14:37,740 and it will disassemble just about anything you throw at it. 367 00:14:37,960 --> 00:14:39,920 Mind you, it is not a replacement for IDA, 368 00:14:40,320 --> 00:14:41,600 by any stretch of the imagination, 369 00:14:41,940 --> 00:14:43,660 especially not for malware type stuff, 370 00:14:43,660 --> 00:14:47,360 but you can get a lot of mileage out of objdump. 371 00:14:47,680 --> 00:14:49,580 So one of the things that we did is we told objdump 372 00:14:49,580 --> 00:14:52,480 to intermix the source code with the assembly here 373 00:14:52,480 --> 00:14:54,400 for the purposes of illustration, 374 00:14:54,720 --> 00:14:56,400 making it easier to talk about and comprehend. 375 00:14:57,880 --> 00:14:59,220 Let's see, so we get some preamble stuff, 376 00:14:59,400 --> 00:15:00,880 and you see the void P star malloc, 377 00:15:01,460 --> 00:15:04,680 and so you see a move D word pointer, ESP 0x10. 378 00:15:04,820 --> 00:15:06,580 That's putting 16 onto the top of the stack. 379 00:15:06,700 --> 00:15:07,440 It's not using a push. 380 00:15:08,460 --> 00:15:11,000 First time I've ever seen an assembly like that. 381 00:15:11,180 --> 00:15:13,640 This is GCC 4.0.3 that comes with it. 382 00:15:13,660 --> 00:15:15,780 It comes with Ubuntu, or Kubuntu in my personal case. 383 00:15:16,420 --> 00:15:18,600 But, so it's putting 16 on top of the stack. 384 00:15:18,800 --> 00:15:20,140 It's calling malloc, basically. 385 00:15:20,700 --> 00:15:22,560 So the first thing on the stack is an argument. 386 00:15:22,800 --> 00:15:24,780 So that's the malloc sub-16. 387 00:15:25,780 --> 00:15:27,480 And so on the x86 architecture, 388 00:15:27,780 --> 00:15:29,640 the return value comes in through EAX. 389 00:15:31,100 --> 00:15:33,760 So what you can see on line 123. 390 00:15:34,120 --> 00:15:34,740 Can you highlight 123? 391 00:15:38,360 --> 00:15:38,800 Cool. 392 00:15:39,700 --> 00:15:43,020 So you can see here what it's doing is it is moving 393 00:15:43,660 --> 00:15:47,360 zero into the dereference of EAX plus 16. 394 00:15:47,580 --> 00:15:50,440 So EAX contains the pointer returned by malloc. 395 00:15:50,540 --> 00:15:52,820 We're going 16 bytes into that buffer, 396 00:15:52,960 --> 00:15:53,840 which is one too many. 397 00:15:54,160 --> 00:15:57,160 And it's gonna put zero, one too many into there. 398 00:15:58,100 --> 00:16:00,880 One of my German colleagues on the FreeSCI 399 00:16:00,880 --> 00:16:03,260 open source project calls these OB1 bugs. 400 00:16:05,700 --> 00:16:07,360 So that's what the assembly looks like. 401 00:16:08,260 --> 00:16:10,060 Out of bounds memory access. 402 00:16:11,880 --> 00:16:12,400 All right, cool. 403 00:16:14,340 --> 00:16:16,160 So, out of bound write tests. 404 00:16:17,900 --> 00:16:20,840 So, one thing that we should do is we should look at 405 00:16:21,840 --> 00:16:24,060 an exploitable case and we're gonna show you how it fits 406 00:16:24,060 --> 00:16:26,040 into the automated testing framework that we have. 407 00:16:26,220 --> 00:16:27,720 Which is a simple Python script. 408 00:16:27,920 --> 00:16:29,900 Although, Mr. Doug here has actually, 409 00:16:30,020 --> 00:16:32,480 has a patch on his laptop that's gonna make 410 00:16:32,480 --> 00:16:33,500 the Python script unnecessary. 411 00:16:34,080 --> 00:16:34,640 Sorry, Luis. 412 00:16:34,800 --> 00:16:35,440 I know that's your baby. 413 00:16:38,740 --> 00:16:39,980 You son of a bitch. 414 00:16:42,380 --> 00:16:42,820 So. 415 00:16:43,660 --> 00:16:46,360 So let's look at one of the exploitable ones. 416 00:16:47,240 --> 00:16:50,040 Like with stack taint or what have you. 417 00:16:50,140 --> 00:16:51,840 And this should come up in the larger font. 418 00:16:52,380 --> 00:16:52,820 Font? 419 00:16:53,080 --> 00:16:53,480 Font? 420 00:16:53,880 --> 00:16:54,320 Font. 421 00:16:55,700 --> 00:16:58,560 It's been a long week and a half in the desert 422 00:16:59,200 --> 00:17:00,220 on a horse with no name. 423 00:17:04,400 --> 00:17:05,520 How about a heap taint? 424 00:17:06,320 --> 00:17:06,920 That's fine. 425 00:17:08,320 --> 00:17:09,780 We can just look at the dot dump actually. 426 00:17:13,660 --> 00:17:14,240 Double taint, check one. 427 00:17:15,280 --> 00:17:15,960 There you go. 428 00:17:16,580 --> 00:17:17,460 Yeah, the O2. 429 00:17:20,300 --> 00:17:20,780 Five. 430 00:17:23,200 --> 00:17:23,680 Swizzied. 431 00:17:24,260 --> 00:17:26,200 All right, so we've got some stacks set up. 432 00:17:26,440 --> 00:17:28,000 So this is an exploitable case. 433 00:17:30,360 --> 00:17:31,880 And all these involve main. 434 00:17:32,680 --> 00:17:34,780 Because one of the limitations that we have right now 435 00:17:34,780 --> 00:17:37,680 is that we only scan one function as the main function. 436 00:17:37,960 --> 00:17:41,040 We'll talk about how easy it's going to be to fix that. 437 00:17:41,040 --> 00:17:43,400 So let's see. 438 00:17:43,440 --> 00:17:45,620 So we get star star argv, which is tainted data. 439 00:17:45,700 --> 00:17:46,440 It's used to supply data. 440 00:17:46,560 --> 00:17:47,620 It comes in from the command line. 441 00:17:49,580 --> 00:17:52,340 And in the context of analyze this program, 442 00:17:52,460 --> 00:17:53,600 we don't know if it's set UID root. 443 00:17:53,800 --> 00:17:55,060 We don't know anything about this program. 444 00:17:55,360 --> 00:17:57,280 So we're just gonna say this is exploitable 445 00:17:57,280 --> 00:17:59,080 even though it might not actually matter. 446 00:17:59,300 --> 00:17:59,700 Maybe. 447 00:17:59,900 --> 00:18:00,560 Who knows? 448 00:18:00,720 --> 00:18:01,260 We don't. 449 00:18:01,320 --> 00:18:02,840 So let's pretend like it is. 450 00:18:06,300 --> 00:18:07,640 So char star star. 451 00:18:07,900 --> 00:18:09,320 So char g star star argv. 452 00:18:09,460 --> 00:18:09,940 All right. 453 00:18:09,940 --> 00:18:12,520 So star star argv lives at EVP plus 12. 454 00:18:12,600 --> 00:18:13,500 We put that into EAX. 455 00:18:15,040 --> 00:18:16,400 And so that gives us star argv. 456 00:18:16,500 --> 00:18:17,980 We dereference that one more time. 457 00:18:18,800 --> 00:18:20,580 And we get argv. 458 00:18:20,760 --> 00:18:22,720 And then we dereference that one more time. 459 00:18:22,880 --> 00:18:24,500 And we get the first byte. 460 00:18:25,140 --> 00:18:25,760 Is that right? 461 00:18:25,860 --> 00:18:27,540 Yeah, the first byte out of argv. 462 00:18:27,780 --> 00:18:30,820 And we put that into EBX. 463 00:18:31,060 --> 00:18:31,560 All right. 464 00:18:31,900 --> 00:18:33,240 So then we go do our malloc thing, 465 00:18:33,340 --> 00:18:34,100 which we just went through. 466 00:18:34,480 --> 00:18:37,580 And then we go down to line 129 there. 467 00:18:37,820 --> 00:18:39,680 And we see that we are putting the 468 00:18:39,680 --> 00:18:42,740 lower bits of EBX out of bounds into that array. 469 00:18:42,860 --> 00:18:43,420 That's exploitable. 470 00:18:44,120 --> 00:18:45,800 That's what every bug basically comes down to. 471 00:18:47,060 --> 00:18:48,220 Anybody that says differently, 472 00:18:48,400 --> 00:18:50,720 you can use a lot of colorful languages 473 00:18:50,720 --> 00:18:53,240 and a lot of really convoluted two-day classes, 474 00:18:53,300 --> 00:18:53,740 et cetera, et cetera, 475 00:18:53,740 --> 00:18:55,980 just to get down to this one thing. 476 00:18:56,480 --> 00:18:57,820 And this is what it looks like in the assembly. 477 00:18:57,980 --> 00:19:00,560 It's really easy to find in a very small program like this. 478 00:19:00,620 --> 00:19:02,360 But it actually comes in all shapes and sizes. 479 00:19:02,640 --> 00:19:03,680 So how do we deal with that? 480 00:19:03,820 --> 00:19:05,000 Well, one of the ways we deal with that is 481 00:19:05,000 --> 00:19:06,780 we compile the program a bunch of different ways 482 00:19:06,780 --> 00:19:07,840 with a bunch of different compilers. 483 00:19:07,840 --> 00:19:10,780 We do O-0, O-2, O-1, O-S, 484 00:19:10,800 --> 00:19:13,420 and then we do that for several different versions of GCC 485 00:19:13,420 --> 00:19:17,260 and Visual C++ and, God help you, Borland C++. 486 00:19:21,040 --> 00:19:23,000 And so that's basically it. 487 00:19:23,380 --> 00:19:25,760 So if we go to the command line, 488 00:19:26,340 --> 00:19:28,280 the bug report command line. 489 00:19:46,080 --> 00:19:47,900 Congratulations, here are a few tips 490 00:19:47,900 --> 00:19:49,040 to enhance your enjoyment 491 00:19:49,040 --> 00:19:50,920 of your new stainless steel drinkware. 492 00:19:54,500 --> 00:19:55,640 Do not overfill. 493 00:19:55,820 --> 00:19:57,740 Hot liquids can scald the user. 494 00:20:00,400 --> 00:20:03,560 When filled with hot liquids, keep out of reach of children. 495 00:20:06,540 --> 00:20:07,820 This is a stainless steel drink. 496 00:20:07,840 --> 00:20:08,480 It's a stainless steel product. 497 00:20:08,660 --> 00:20:10,120 It is not for microwave use. 498 00:20:12,880 --> 00:20:14,480 Fuck me, learn something new every day. 499 00:20:14,980 --> 00:20:16,000 It's pretty amazing. 500 00:20:16,560 --> 00:20:17,760 So here's what we're going to look at. 501 00:20:17,860 --> 00:20:18,900 So we're going to run the, by the way, 502 00:20:18,920 --> 00:20:22,160 this is a command line tool, because that's all we really 503 00:20:22,160 --> 00:20:23,320 need in this particular case. 504 00:20:24,680 --> 00:20:27,900 So you see, if you download the code and you are running 505 00:20:27,900 --> 00:20:29,800 sharp develop or you've used mono to build it, 506 00:20:29,840 --> 00:20:32,880 which is also relatively simple, that's it. 507 00:20:32,940 --> 00:20:33,360 You build it. 508 00:20:33,440 --> 00:20:34,760 It's bugreport.exe. 509 00:20:35,440 --> 00:20:37,740 It's about 2,000 lines of code, about 60% 510 00:20:37,840 --> 00:20:38,620 of that is unit tests. 511 00:20:39,280 --> 00:20:42,980 So I guess about 800, 800 lines of code or something. 512 00:20:45,180 --> 00:20:48,180 And so who's got their goddamn phone on? 513 00:20:48,680 --> 00:20:49,960 Give me a fucking break, will you? 514 00:20:50,960 --> 00:20:52,700 Jesus H. Christ in a chicken basket. 515 00:20:52,800 --> 00:20:53,760 You born in a barn or something? 516 00:20:57,340 --> 00:20:58,880 So let's see, so we're going to run that 517 00:20:58,880 --> 00:21:01,660 and we have this command line option called dash dash trace, 518 00:21:01,760 --> 00:21:04,000 which gives us debug output, basically, 519 00:21:04,000 --> 00:21:05,320 as it's going through and doing things. 520 00:21:05,500 --> 00:21:07,820 Right now what we did to simplify things a little bit, 521 00:21:07,820 --> 00:21:11,680 little bit, make it easier to understand, is that we don't actually parse L4P headers, 522 00:21:11,880 --> 00:21:15,720 right? You don't need to do that. What we've done is we let ObjDump do the hard work for 523 00:21:15,720 --> 00:21:19,840 us, so we don't have to have a full-on disassembler in order to analyze the binary code. 524 00:21:20,900 --> 00:21:25,340 That's not that we are not going to have that. We were looking at the quickest way that we 525 00:21:25,340 --> 00:21:29,700 could start getting code to catch certain vulnerabilities. So we wanted to concentrate 526 00:21:29,700 --> 00:21:33,920 on the analysis part, and then eventually move on. We're going to have to move on and 527 00:21:34,780 --> 00:21:37,440 decode or parse PE, ELF, and what have you. 528 00:21:38,940 --> 00:21:44,380 Yeah, so it was really kind of, for anyone who saw the XP talk, the extreme programming 529 00:21:44,380 --> 00:21:48,240 talk that we did yesterday, this is the simplest thing that could possibly work. And this is 530 00:21:48,240 --> 00:21:53,740 all about the analysis part, as opposed to boring PE and ELF bullshit. So that's why 531 00:21:53,740 --> 00:21:57,540 we use ObjDump to do this. We're not cheating. It's not difficult. It's a solved problem 532 00:21:57,540 --> 00:22:03,240 a hundred times over. Therefore, it's not worth talking about or focusing on. So, yeah, 533 00:22:03,320 --> 00:22:07,740 so that .dump file is basically an ObjDump output for that particular binary, and 534 00:22:07,740 --> 00:22:10,960 all these tests are, by the way, on the SourceForge project, so you can just run these or look 535 00:22:10,960 --> 00:22:20,020 at them or whatever. So if you want to hit enter. Wee! So it kind of looks like GDB output, 536 00:22:20,200 --> 00:22:23,600 and you're like, wait a minute, did you make a virtual machine or what? No, we didn't make 537 00:22:23,600 --> 00:22:27,880 a virtual machine. It kind of looks like it is, but that's kind of on purpose, basically, 538 00:22:28,060 --> 00:22:31,060 because that's the way that, you know, you're looking at binary code. You kind of want to 539 00:22:31,060 --> 00:22:36,220 think of it from how this run kind of perspective. Dash-dash trace is there just to help us 540 00:22:36,220 --> 00:22:36,860 debug things. 541 00:22:37,740 --> 00:22:41,680 We rarely have to use it, because our unit tests usually catch all of our bugs for us 542 00:22:42,180 --> 00:22:47,280 when we do unit test them, unlike our main, which Douglas has fixed. Thank you, Douglas. 543 00:22:49,800 --> 00:23:00,900 So the relevant output here, though, if we rerun it without dash-dash trace, that's 544 00:23:00,900 --> 00:23:04,960 the relevant output. So that's the bug in that particular problem. We detect that it's 545 00:23:04,960 --> 00:23:05,400 exploitable. 546 00:23:05,640 --> 00:23:07,540 So if we run it on our other program... 547 00:23:07,740 --> 00:23:11,760 So if we run it on our other one that doesn't have the stack taint at the end of it, it just 548 00:23:11,760 --> 00:23:12,260 says... 549 00:23:13,020 --> 00:23:13,720 Excuse me. 550 00:23:15,300 --> 00:23:19,940 It just says, uh-oh. It just says out of bounds there. So we're able to distinguish 551 00:23:19,940 --> 00:23:23,180 between exploitable and not exploitable, which is amazing, because a lot of these tools 552 00:23:23,180 --> 00:23:28,860 don't do that upfront for some reason. They're like, you've got a gazillion star copies, 553 00:23:29,020 --> 00:23:34,140 do something! And that's not very useful. It's only useful if it's actually exploitable, 554 00:23:34,300 --> 00:23:35,160 so that's what the main focus is. 555 00:23:35,160 --> 00:23:37,520 So this example here, it doesn't have taint... 556 00:23:37,520 --> 00:23:37,720 Yes. 557 00:23:37,720 --> 00:23:41,300 It's just an overwrite and it just shows OOB instead of exploitable. 558 00:23:41,560 --> 00:23:44,800 Yeah, it's just like the first one that we looked at where it was writing out of 559 00:23:44,800 --> 00:23:48,500 bounds but with zero which is of course not user-supplied data and whatever. 560 00:23:48,800 --> 00:23:51,160 It's not that user-supplied data is always bad, of course. 561 00:23:51,240 --> 00:23:55,760 Most programs take user-supplied data unless you're calculating the one millionth decimal 562 00:23:55,760 --> 00:23:58,160 place of pi or some bullshit like that. 563 00:23:58,320 --> 00:24:00,540 Otherwise you're taking user-supplied data. 564 00:24:00,920 --> 00:24:05,220 And so we're not saying don't take user-supplied data or it's horrible or bad or whatever. 565 00:24:05,220 --> 00:24:09,120 You just have to constrain it properly and not have out of bounds rights and we'll get 566 00:24:09,120 --> 00:24:10,400 into constraints in a little bit. 567 00:24:11,180 --> 00:24:14,020 So let's look at the next slide. 568 00:24:17,520 --> 00:24:19,340 Yeah, let's go through this first and we'll look at some code. 569 00:24:19,500 --> 00:24:21,500 We'll go back and look at the C-sharp code in a little bit. 570 00:24:22,500 --> 00:24:24,420 So dealing with branches. 571 00:24:26,100 --> 00:24:29,060 So the programs we looked at so far have been straight line programs basically. 572 00:24:29,300 --> 00:24:33,180 No ifs, no whiles, no whatever, no looping, no branches, et cetera, et cetera. 573 00:24:33,680 --> 00:24:34,820 That's not particularly real. 574 00:24:34,820 --> 00:24:38,900 So how do we deal with the branches? 575 00:24:40,680 --> 00:24:46,220 Well right now the way that we sort of, right now in the code the way that we track things 576 00:24:46,220 --> 00:24:51,100 is that everything has an underlying value, it's kind of immediate underlying value of 577 00:24:51,100 --> 00:24:55,440 everything because so far in our test program that's all we've seen, malloc 16, do this, 578 00:24:55,640 --> 00:24:56,180 do that. 579 00:24:56,320 --> 00:24:58,360 There's kind of a constant number in there. 580 00:24:58,760 --> 00:25:02,080 And so what happens if you have, you know... 581 00:25:03,240 --> 00:25:03,740 I don't know. 582 00:25:04,480 --> 00:25:07,980 What the fuck did I say about cell phones? 583 00:25:08,480 --> 00:25:09,600 Jesus H. Christ. 584 00:25:11,860 --> 00:25:12,480 All right. 585 00:25:13,440 --> 00:25:15,220 So what the fuck was I talking about? 586 00:25:16,700 --> 00:25:17,300 Tracking values. 587 00:25:17,680 --> 00:25:19,160 Tracking values, that's right. 588 00:25:21,960 --> 00:25:25,540 So coming into a program, let's say you get a buffer from receive, right? 589 00:25:25,620 --> 00:25:27,640 You get a buffer of 10, 1,024 bytes. 590 00:25:28,380 --> 00:25:30,140 What do you know about the bytes in that buffer? 591 00:25:30,240 --> 00:25:31,800 What do you know about the values in that buffer? 592 00:25:31,900 --> 00:25:33,300 How can you make decisions in the program? 593 00:25:33,300 --> 00:25:36,820 Based upon that buffer, can we look at a branch program real quick? 594 00:25:38,320 --> 00:25:40,100 And so the answer is you don't know. 595 00:25:40,520 --> 00:25:42,340 You don't know what's in there, right? 596 00:25:42,460 --> 00:25:42,940 So you don't... 597 00:25:42,940 --> 00:25:47,920 So without any hint or any anything you have to kind of like figure it out. 598 00:25:48,180 --> 00:25:51,860 And so you have to like take a guess or, you know, say, oh, well, I don't know what this 599 00:25:51,860 --> 00:25:57,060 is so I guess I'll treat it as if it's the biggest number possible or zero or the smallest 600 00:25:57,060 --> 00:26:01,540 number possible or null, which is what the current code does. 601 00:26:04,740 --> 00:26:05,880 So here's an example. 602 00:26:07,040 --> 00:26:10,500 So star star argv is exactly sort of a perfect example. 603 00:26:10,860 --> 00:26:12,040 What's at the end of that buffer? 604 00:26:12,780 --> 00:26:15,140 What's the zeroth byte of argv? 605 00:26:15,440 --> 00:26:16,680 We don't know. 606 00:26:17,480 --> 00:26:20,260 So coming into this program, do we take that if? 607 00:26:20,420 --> 00:26:22,120 Do we do what's in the if? 608 00:26:22,220 --> 00:26:23,460 Or do we not do what's in the if? 609 00:26:23,680 --> 00:26:24,600 How do we decide? 610 00:26:26,920 --> 00:26:31,520 Well, there's a bunch of ways you can go about this, but for the sake of brevity, what we're 611 00:26:31,540 --> 00:26:33,520 going to do is we'll just pull something out of our ass. 612 00:26:33,720 --> 00:26:36,940 If we're going to be arbitrary, let's be really arbitrary and just be honest with ourselves. 613 00:26:37,140 --> 00:26:39,640 We could flip a coin, take it or not, and then... 614 00:26:39,640 --> 00:26:42,060 But the thing is, yeah, take it or not, whatever. 615 00:26:42,240 --> 00:26:46,180 So let's pretend like if we don't have any constraint, if we don't know anything about 616 00:26:46,180 --> 00:26:49,480 this variable, we're going to constrain it as soon as possible in the program. 617 00:26:50,400 --> 00:26:55,020 So what we want to do to help us along that path is we want to take that branch because 618 00:26:55,020 --> 00:26:56,160 that's going to help us constrain it. 619 00:26:56,280 --> 00:27:00,680 So after that if statement is executed and we do count minus equals two. 620 00:27:00,680 --> 00:27:00,800 Two. 621 00:27:01,140 --> 00:27:03,160 On line nine? 622 00:27:03,700 --> 00:27:04,060 Nine. 623 00:27:04,220 --> 00:27:04,580 Nine. 624 00:27:05,660 --> 00:27:09,160 What do we know about the thing, about the byte at star, star, arg, v? 625 00:27:10,140 --> 00:27:14,380 We know that it is greater than or equal to period, right? 626 00:27:14,700 --> 00:27:17,420 So how do we express that? 627 00:27:18,200 --> 00:27:18,560 Right? 628 00:27:18,620 --> 00:27:19,280 So you can go back to the slide. 629 00:27:23,120 --> 00:27:25,600 So we express that with constraints like this. 630 00:27:25,720 --> 00:27:29,140 We say value is less than or equal to y and greater than or equal to x. 631 00:27:29,480 --> 00:27:30,660 And so as we go through... 632 00:27:30,680 --> 00:27:35,460 We go through branch statements, we get more and more refined kind of constraints, right? 633 00:27:35,540 --> 00:27:40,180 So when we go to evaluate the use of this variable, say in a dereference of a buffer 634 00:27:40,180 --> 00:27:46,860 or what have you, we basically have a range of values we can use or several ranges of 635 00:27:46,860 --> 00:27:47,500 values we can use. 636 00:27:47,580 --> 00:27:48,840 And how do we decide which ones we use? 637 00:27:49,220 --> 00:27:53,040 We'll talk about that in some other talk that is less time constrained. 638 00:27:53,520 --> 00:27:56,860 But for the sake of argument, we'll choose the largest number that we can. 639 00:27:57,000 --> 00:27:58,640 This largest number and the smallest number. 640 00:27:58,780 --> 00:28:00,440 Because accessing outside of the array... 641 00:28:00,680 --> 00:28:04,860 Over the bounds, this way, is as bad as underwriting the array like this. 642 00:28:06,360 --> 00:28:09,260 So this is kind of interesting. 643 00:28:09,700 --> 00:28:10,960 And so how... 644 00:28:10,960 --> 00:28:11,920 So we talked about... 645 00:28:11,920 --> 00:28:14,640 So we don't know anything about r star star r, v, for instance. 646 00:28:14,760 --> 00:28:17,040 We don't know anything about the buffer coming in from the network. 647 00:28:17,700 --> 00:28:24,020 So how do we sort of express that in this vernacular of constraints? 648 00:28:24,520 --> 00:28:26,560 Can you go to the next slide? 649 00:28:28,420 --> 00:28:29,160 And so... 650 00:28:29,160 --> 00:28:32,900 So we basically use the exact same vernacular, but we say it's negative infinity to positive 651 00:28:32,900 --> 00:28:33,260 infinity. 652 00:28:33,640 --> 00:28:34,520 We don't know. 653 00:28:34,740 --> 00:28:40,060 And if we were to codify this, we'd probably use like negative max int plus 10 and max 654 00:28:40,060 --> 00:28:40,860 int minus 10. 655 00:28:41,160 --> 00:28:45,100 Only because many people use max int for values in their programs or we'd have to choose 656 00:28:45,100 --> 00:28:47,500 some value that's kind of like a magic number. 657 00:28:47,700 --> 00:28:51,440 And yes, that has problems and is a little bit bogus, but bear with me. 658 00:28:53,140 --> 00:28:56,080 So one really interesting thing that's worth bringing up here. 659 00:28:57,620 --> 00:28:58,100 That's... 660 00:28:58,100 --> 00:29:03,840 Jeff brought up in Louise's talk is what if you wanted to know what input it took to 661 00:29:03,840 --> 00:29:05,400 get to a certain point in a program? 662 00:29:06,200 --> 00:29:07,700 Which is a wonderful question. 663 00:29:07,980 --> 00:29:12,820 Not a very difficult question to answer either if you've read any of the academic white 664 00:29:12,820 --> 00:29:13,420 papers whatsoever. 665 00:29:16,280 --> 00:29:17,560 So how would we do that? 666 00:29:18,940 --> 00:29:20,160 Louise, how would we do that? 667 00:29:21,020 --> 00:29:25,120 How would we figure out what input it would take to get a certain part in a program given 668 00:29:25,120 --> 00:29:25,440 constraints? 669 00:29:26,400 --> 00:29:27,820 You could figure out... 670 00:29:27,820 --> 00:29:31,760 You could try to figure out what type of constraints would get you down to certain levels, certain 671 00:29:31,760 --> 00:29:33,960 functions and whatnot and then go backwards from that. 672 00:29:34,420 --> 00:29:34,860 Yep. 673 00:29:35,020 --> 00:29:36,120 It's pretty much that simple. 674 00:29:36,400 --> 00:29:39,700 So once you're like sort of going through the program and you're interpreting the program 675 00:29:39,700 --> 00:29:42,980 and you follow these branches and you don't follow them and you merge different constraints 676 00:29:42,980 --> 00:29:48,960 together, by the time you get down to the vulnerable code, right, you know what constraint 677 00:29:48,960 --> 00:29:53,920 had to be on every single byte in that network buffer to get you down to the point where 678 00:29:54,520 --> 00:29:55,420 the exploit is. 679 00:29:55,960 --> 00:29:59,920 And so you not only know, you know, one individual packet that might get you there by setting 680 00:29:59,920 --> 00:30:04,700 breakpoints and a bunch of manual nonsense that's going to waste a lot of time, you know 681 00:30:04,700 --> 00:30:07,480 a range of packets you could use to get there. 682 00:30:07,620 --> 00:30:10,200 You know this byte could be between here and here. 683 00:30:10,360 --> 00:30:12,600 The next byte could be between here and here. 684 00:30:13,300 --> 00:30:17,720 And that's very useful and very practical in this particular context. 685 00:30:18,960 --> 00:30:20,440 Not a very hard problem at all. 686 00:30:20,600 --> 00:30:24,400 I'm not sure why anyone would think that was a hard problem given constraints and the basics 687 00:30:24,400 --> 00:30:25,400 of static analysis. 688 00:30:26,480 --> 00:30:27,580 So next slide. 689 00:30:31,000 --> 00:30:34,940 So so so so far we've been talking about actually can we go to loops? 690 00:30:35,440 --> 00:30:39,540 Loops is a interesting interesting little topic. 691 00:30:41,640 --> 00:30:42,340 Pardon me. 692 00:30:42,480 --> 00:30:43,060 Didn't mean to do that. 693 00:30:47,220 --> 00:30:50,040 So so let's open up IDA. 694 00:30:50,100 --> 00:30:52,480 This is show I don't hate IDA with all my soul. 695 00:30:56,640 --> 00:31:02,180 And so loops are pretty loops are a kind of branch basically they're a branch that goes 696 00:31:02,180 --> 00:31:06,460 backwards instead of forwards to oversimplify things a little bit. 697 00:31:07,640 --> 00:31:11,460 And so what we're going to look at is a vulnerability that actually my commercial product found 698 00:31:11,460 --> 00:31:16,040 the product is no longer the market that I no longer work on or sell in any particular 699 00:31:16,040 --> 00:31:16,460 way. 700 00:31:18,040 --> 00:31:23,560 And so so this was a novel security vulnerability that the product found. 701 00:31:23,560 --> 00:31:27,380 And so some people talk about loops in a very convoluted way and oh man these are trees 702 00:31:27,380 --> 00:31:29,580 and here's this graph and here's that graph et cetera et cetera. 703 00:31:29,780 --> 00:31:32,580 I'm going to give you a really simple algorithm you can code into an IDA plug-in in about 704 00:31:32,580 --> 00:31:36,660 15 minutes or so if you can get past IDA's API that is. 705 00:31:38,200 --> 00:31:43,660 And or you could just code it into bug report and not use IDA at all which would be really 706 00:31:43,660 --> 00:31:43,960 nice too. 707 00:31:45,160 --> 00:31:48,900 So yeah so this is a this is an exploit I found in Trillium it's a client side vulnerability. 708 00:31:49,380 --> 00:31:52,260 It is what I call an unbounded buffer iteration bug. 709 00:31:52,420 --> 00:31:53,440 This is these are my words. 710 00:31:53,440 --> 00:31:57,780 I'm making it up maybe someone uses similar words I don't know but for the sake of argument 711 00:31:57,780 --> 00:31:59,040 I'm making it up it's my words. 712 00:31:59,180 --> 00:32:02,580 So what I mean by unbounded I don't mean like a while one loop. 713 00:32:02,760 --> 00:32:08,980 What I mean is that there is no counter based upon the destination buffer size the buffer 714 00:32:08,980 --> 00:32:16,740 being written to there is no counter based upon that that will terminate this loop before 715 00:32:17,100 --> 00:32:18,620 that buffer is written out of bounds. 716 00:32:18,780 --> 00:32:20,620 That is a lot to swallow. 717 00:32:20,960 --> 00:32:23,200 So if we go back to the slide. 718 00:32:23,440 --> 00:32:23,580 Real quick. 719 00:32:26,900 --> 00:32:28,500 Here's what it comes down to folks. 720 00:32:29,420 --> 00:32:36,440 So we want to find a control flow block that forms a closed loop upon itself a loop right 721 00:32:36,440 --> 00:32:40,620 if you're into the visual thing which a lot of people are we like to be trapped in our 722 00:32:40,620 --> 00:32:41,980 GUIs and our GUI metaphors. 723 00:32:42,280 --> 00:32:49,120 And so where a pointer is written to and incremented written to and incremented. 724 00:32:49,340 --> 00:32:53,260 So we're writing to a thing in this buffer and we're moving the pointer next and we're 725 00:32:53,260 --> 00:32:54,600 writing something we're moving the pointer next. 726 00:32:55,320 --> 00:32:59,940 And so the exit from the loop if we can find one if it is not a while one for instance 727 00:33:00,740 --> 00:33:06,960 is a tainted byte comparison and said byte was written to the pointer in question the 728 00:33:06,960 --> 00:33:07,660 buffer in question. 729 00:33:08,340 --> 00:33:15,100 And so this is maybe a slightly narrow definition but for the trillion bug that we're looking 730 00:33:15,100 --> 00:33:20,560 at the MSRPC bug that the blast room exploited let me see the PTP key server bug and their 731 00:33:20,560 --> 00:33:23,120 LDAP protocol parsing that I found and never released. 732 00:33:23,260 --> 00:33:31,560 And what was the other one oh yeah the half life multiplayer server which was the actual 733 00:33:31,560 --> 00:33:34,800 bug that I based all of my detection upon that found these other novel bugs. 734 00:33:36,820 --> 00:33:41,040 So this is kind of constrained it could be a little broader to find more bugs et cetera 735 00:33:41,040 --> 00:33:45,640 et cetera but for the sake of brevity and time we will go back to the trillion code 736 00:33:45,640 --> 00:33:48,320 and assume that that is the algorithm that we are going to use. 737 00:33:49,320 --> 00:33:50,900 So what have we got here? 738 00:33:51,660 --> 00:33:52,700 So we have a receive. 739 00:33:53,400 --> 00:33:57,760 So we have a call to receive that's going to get tainted data it's going to fill buff 740 00:33:57,760 --> 00:34:02,560 which is EAX there it's going to there's no laser pointer laser pointer would be nice 741 00:34:02,560 --> 00:34:05,620 in the black hat class like the things are like right here so I could just like go like 742 00:34:05,620 --> 00:34:09,500 this and try to do that here and it doesn't work because I'm retarded. 743 00:34:11,020 --> 00:34:15,540 So EAX so after that call to receive EAX the buffer is going to be filled with tainted 744 00:34:15,540 --> 00:34:19,540 data in this particular case they filled with one byte of tainted data they read byte by 745 00:34:19,540 --> 00:34:22,060 byte which is kind of funny it's a little strange but whatever. 746 00:34:22,760 --> 00:34:28,120 EAX contains a tainted buffer and so it checks the return value of receive we don't 747 00:34:28,120 --> 00:34:32,600 really care about that and then it goes down into the block on the left. 748 00:34:33,720 --> 00:34:41,820 The block on the left which is gets a byte out of receive puts it into AL cop which is 749 00:34:41,820 --> 00:34:49,740 tainted so AL now contains tainted data AL then copies itself into the ESI plus EDI 750 00:34:49,740 --> 00:34:51,700 the dereference thereof right. 751 00:34:52,060 --> 00:34:57,500 So in this case EDI is the base pointer the base buffer basically ESI gets incremented 752 00:34:57,900 --> 00:35:04,860 all right EBX gets incremented then we compare AL to OAH which is a carriage return I do 753 00:35:04,860 --> 00:35:10,840 believe and if that's not true if we haven't hit the carriage return go back this is an 754 00:35:10,840 --> 00:35:14,180 unbounded buffer this is exploitable by the way it's a client side thing a lot of people 755 00:35:14,180 --> 00:35:18,660 focus on server side stuff I think client side stuff is more interesting personally 756 00:35:19,400 --> 00:35:21,500 it's just my personal preference of what I care about. 757 00:35:22,060 --> 00:35:29,840 It's all no judgment so that's it so we have all the pieces here we have tainted data we have it 758 00:35:29,840 --> 00:35:34,340 being written into a buffer a component of that buffer is incremented and we loop and loop and 759 00:35:34,340 --> 00:35:39,000 loop based upon the tainted data coming out from the network now this seems like ad hoc and 760 00:35:39,000 --> 00:35:43,180 contrived and et cetera et cetera I've probably found a dozen exploitable bugs in real 761 00:35:43,180 --> 00:35:47,940 commercial off the shelf software using this exact kind of algorithm right and so we can talk 762 00:35:47,940 --> 00:35:51,840 about dominant user trees and graphs and lots of really complicated pictures and bullshit 763 00:35:51,840 --> 00:35:56,660 like that but if it doesn't find any god damn bugs and you don't release a tool who gives a 764 00:35:56,660 --> 00:36:02,040 shit it doesn't matter if you can't practically apply the knowledge it does not matter I don't 765 00:36:02,040 --> 00:36:08,200 care what anybody says so that's an exploitable bug don't use Trillian they didn't fix all 766 00:36:08,200 --> 00:36:11,280 their bugs I tried reporting it to them they were really responsive at first and then they 767 00:36:11,280 --> 00:36:15,200 dropped off the face of the planet Trillian 3.1 which was the last release they did which I 768 00:36:15,200 --> 00:36:20,540 think was almost two years ago now they fixed some of the bugs wrong the other thing is that they 769 00:36:20,540 --> 00:36:21,820 copied and pasted this exact same thing on the other side of the network so I don't want to 770 00:36:21,820 --> 00:36:21,980 make it so obvious but I'm going to go back to some of the bugs because they're really 771 00:36:21,980 --> 00:36:25,680 interesting to go back to the same code which is HTTP response HTTP header response parsing 772 00:36:25,680 --> 00:36:33,700 response header parsing was copied and pasted almost every single DLL that they had and 773 00:36:33,700 --> 00:36:38,240 they didn't really fix them correctly so and and they didn't fix all they didn't even fix all 774 00:36:38,240 --> 00:36:44,520 of them either so I really wouldn't use Trillian it's just based upon this particular bug so 775 00:36:44,520 --> 00:36:49,600 that's unbounded loops and that's that that's all there is to it I mean that's really all 776 00:36:49,600 --> 00:36:51,800 there is to it it sounds overly simple you'll find so many other bugs that are not. So the 777 00:36:51,800 --> 00:36:57,220 bugs. It's crazy how many bugs you will find. And every protocol parser is gonna have loops 778 00:36:57,220 --> 00:37:01,320 like this. We gotta look through about this. In the case of the uh blaster worm bug in the 779 00:37:01,320 --> 00:37:05,400 case of yeah the blaster worm bug that the the bug in MSRPC that the blaster worm exploited 780 00:37:05,400 --> 00:37:09,840 it was doing basically the same thing except looking for a backslash in the UNC path. In the 781 00:37:09,840 --> 00:37:13,460 case of the PGP key server bug which may still exist I don't know I reported it to them and 782 00:37:13,460 --> 00:37:18,640 they threatened legal action uh it was an asterisk right? It's all the same kind of stuff 783 00:37:18,640 --> 00:37:26,720 um so you don't need God's own academic static analysis like algorithm that's you know the 784 00:37:26,720 --> 00:37:32,680 utopian solution for God to find bugs. You have to be pragmatic about it. So go back to the slides. 785 00:37:36,640 --> 00:37:42,800 So that was the trillion exploit example um and it basically comes down to this. The tool has 786 00:37:42,800 --> 00:37:48,080 not codified this yet but as you can see from talking about it basically um it wouldn't be 787 00:37:48,080 --> 00:37:48,480 that difficult. 788 00:37:48,640 --> 00:37:54,580 to write this code. Again it's a it'd be probably a 50 line IDA plugin or in the case of bug 789 00:37:54,580 --> 00:37:59,380 report it might be less less code. It'd be in C sharp and not have IDA's shitty plugin API. 790 00:37:59,620 --> 00:38:07,440 Shitty in my opinion anyways. So we gotta talk to bounded. So banner loops are not well 791 00:38:07,440 --> 00:38:11,960 they're bounded basically. They're not unbounded by my definition. This is my definition of 792 00:38:11,960 --> 00:38:18,620 bounded and unbounded. So can we look at the vuln server? C dot the C file. Vuln dash server 793 00:38:18,640 --> 00:38:22,840 is this thing that was used in a Purdue uh secure programming class. The reason I like it is 794 00:38:22,840 --> 00:38:28,240 because a bunch of people from several software vendors helped write this based upon uh real bugs 795 00:38:28,240 --> 00:38:31,820 that they had in their commercial off the shelf software. I'm not gonna say which vendors that 796 00:38:31,820 --> 00:38:38,400 it was. Other than it's cool that vendors are trying to help you know take real world bugs that 797 00:38:38,400 --> 00:38:43,960 they had and teach people, teach students about these bugs, what they look like, why you shouldn't 798 00:38:43,960 --> 00:38:45,220 do that and how to fix them. 799 00:38:49,180 --> 00:38:56,280 And so this is a a contrived program to some degree but uh it I didn't make it up and it's based 800 00:38:56,280 --> 00:39:04,140 upon real world bugs and if we're not looking at real world bugs who cares. You don't have the dot 801 00:39:04,140 --> 00:39:14,620 C? No? Uh what can we do? What can we do? Oh we can look at the um uh we can look at the 802 00:39:14,620 --> 00:39:17,820 assembly. Where you guys? You guys wanna see assembly? 803 00:39:19,220 --> 00:39:21,640 Woo! Yeah? Assembly in his house. 804 00:39:25,180 --> 00:39:32,280 Oh you don't have it at all? Oh that's balls. Let's see here now. Do we have any bounded anything? 805 00:39:32,620 --> 00:39:37,420 Is listener bounded? Listener is not bounded. That's a deep thing. That's uh branches. Yeah. 806 00:39:38,420 --> 00:39:39,420 Actually can I see something? 807 00:39:50,080 --> 00:39:51,500 What's that? 808 00:39:51,500 --> 00:39:51,720 That's right there. 809 00:39:59,080 --> 00:40:01,200 Oh well, we'll just talk about it in a slide. 810 00:40:05,260 --> 00:40:11,540 So uh, it's the exact same thing except in this case there is a counter. There's a counter counting down 811 00:40:11,540 --> 00:40:16,600 in the loop saying I'm gonna terminate when this counter reaches zero or when it's greater than some value 812 00:40:16,600 --> 00:40:17,820 or etcetera, etcetera. 813 00:40:19,100 --> 00:40:19,540 Um 814 00:40:20,340 --> 00:40:21,180 And so 815 00:40:21,500 --> 00:40:23,640 So, what is that counter based upon, basically? 816 00:40:23,800 --> 00:40:27,460 So what you need to look at is each step through the loop, 817 00:40:27,540 --> 00:40:29,800 there's a pointer that's written to and incremented, right? 818 00:40:30,120 --> 00:40:31,940 So one of the things to keep in mind here is that 819 00:40:31,940 --> 00:40:34,360 you don't have to go through the loop a thousand times 820 00:40:34,360 --> 00:40:37,640 and keep sort of executing it and get caught 821 00:40:37,640 --> 00:40:39,280 in like some kind of loop K-hole. 822 00:40:39,680 --> 00:40:42,000 What you have to do is you just have to analyze it once 823 00:40:42,620 --> 00:40:45,760 and then try to figure out, okay, the reason, 824 00:40:46,900 --> 00:40:49,320 the reason, so the metaphor is the reason 825 00:40:49,320 --> 00:40:52,080 or the circumstance under which we exit the loop 826 00:40:52,860 --> 00:40:55,740 is if the counter reaches zero, right? 827 00:40:55,820 --> 00:40:57,200 That's the reason that we leave. 828 00:40:57,280 --> 00:40:59,300 So if ECX is zero for the sake of argument, 829 00:40:59,780 --> 00:41:00,800 we're gonna leave that loop. 830 00:41:00,920 --> 00:41:03,620 If we see that ECX is decremented each time 831 00:41:03,620 --> 00:41:08,680 through the loop, right, and we know that ECX comes in 832 00:41:08,680 --> 00:41:12,060 with a value of 15, we can extrapolate, 833 00:41:12,080 --> 00:41:13,820 we can do simple multiplication and go, 834 00:41:13,920 --> 00:41:15,500 okay, it's decremented by one each time, 835 00:41:15,600 --> 00:41:17,080 it's gonna exit when it reaches zero, 836 00:41:17,160 --> 00:41:18,960 therefore it's gonna go through the loop 15 times. 837 00:41:19,320 --> 00:41:21,520 Therefore, if the pointer that we're writing to 838 00:41:21,520 --> 00:41:24,520 is less than or equal to 15, or is less than or equal 839 00:41:24,520 --> 00:41:27,520 to 15 bytes or whatever left in it, 840 00:41:28,000 --> 00:41:29,100 that's an exploitable bug. 841 00:41:29,460 --> 00:41:31,060 That's an out-of-bounds memory write. 842 00:41:31,140 --> 00:41:33,600 Again, really complicated loop, all this bullshit, 843 00:41:33,700 --> 00:41:35,720 et cetera, et cetera, out-of-bound memory write. 844 00:41:35,860 --> 00:41:36,780 I can't repeat this enough. 845 00:41:37,160 --> 00:41:38,420 Out-of-bound memory write. 846 00:41:39,180 --> 00:41:40,620 What the fuck's going on in there? 847 00:41:43,060 --> 00:41:45,380 All right, let's hope Winn doesn't die 848 00:41:45,380 --> 00:41:46,440 of a heart attack this year, everybody. 849 00:41:48,380 --> 00:41:49,680 Or cirrhosis of the liver. 850 00:41:49,780 --> 00:41:53,780 Anyways, so without that code, 851 00:41:54,580 --> 00:41:57,180 do you want to write something real quick and see? 852 00:41:57,620 --> 00:41:59,980 Let's move on, we'll move on. 853 00:42:02,880 --> 00:42:07,540 So let's go back to interfunction. 854 00:42:07,860 --> 00:42:10,300 So we've been talking about one function at a time. 855 00:42:10,560 --> 00:42:12,600 So, wow, functions don't really have, 856 00:42:12,920 --> 00:42:14,460 real programs don't really have one function. 857 00:42:14,680 --> 00:42:15,740 How do you deal with something that has, like, 858 00:42:15,740 --> 00:42:16,420 10,000 functions? 859 00:42:16,440 --> 00:42:18,480 Like Oracle's 30 megabyte binary. 860 00:42:19,000 --> 00:42:20,820 Their main service binary is, yes, 861 00:42:20,860 --> 00:42:22,100 30 megabytes. 862 00:42:22,240 --> 00:42:24,000 30 megabytes. 863 00:42:24,060 --> 00:42:26,440 And you're going to buy componentized things 864 00:42:26,440 --> 00:42:28,560 from a company that doesn't know how to componentize 865 00:42:28,560 --> 00:42:30,440 something that has 30 megabytes. 866 00:42:37,360 --> 00:42:39,840 I guess the GHB floated to the bottom. 867 00:42:41,960 --> 00:42:43,760 So, top-down stuff. 868 00:42:44,200 --> 00:42:45,340 You're talking about top-down stuff? 869 00:42:46,440 --> 00:42:46,760 Okay. 870 00:42:47,940 --> 00:42:50,320 So top-down is kind of a classical way to think 871 00:42:50,320 --> 00:42:51,360 about things to some degree. 872 00:42:52,220 --> 00:42:53,760 Basically, you start at the top of the program 873 00:42:53,760 --> 00:42:54,840 and you go down. 874 00:42:55,580 --> 00:42:56,660 That's basically what you do. 875 00:42:56,920 --> 00:42:58,960 So we'd start at main and go down. 876 00:42:59,180 --> 00:43:00,720 So can we look at an example with, 877 00:43:00,800 --> 00:43:02,760 we just skipped to the immediate parameter one. 878 00:43:21,960 --> 00:43:22,940 No, no, no. 879 00:43:22,940 --> 00:43:24,500 Interfunction immediate parameter. 880 00:43:40,300 --> 00:43:42,620 Is the author of text pad here? 881 00:43:44,420 --> 00:43:45,060 Very good. 882 00:43:45,600 --> 00:43:46,420 Very good. 883 00:43:46,440 --> 00:43:48,060 Very wise not to raise your hand, sir. 884 00:43:48,680 --> 00:43:49,200 Anyways. 885 00:43:50,500 --> 00:43:51,780 So interfunction stuff. 886 00:43:52,020 --> 00:43:54,120 So here's a really simple case of an interfunction 887 00:43:54,120 --> 00:43:55,320 kind of value tracking thing. 888 00:43:55,540 --> 00:43:57,740 And that is, we have two functions. 889 00:43:57,840 --> 00:43:58,660 We have a main function. 890 00:43:58,840 --> 00:44:00,480 And we have another function called bug. 891 00:44:00,820 --> 00:44:04,220 Bug passes zero in as the parameter to bug. 892 00:44:04,540 --> 00:44:05,060 Right? 893 00:44:05,100 --> 00:44:09,240 So bug then mallocs based upon that parameter, 894 00:44:09,400 --> 00:44:10,040 which is size. 895 00:44:10,180 --> 00:44:11,640 And then it writes a zero 896 00:44:12,720 --> 00:44:14,440 at array offset zero. 897 00:44:15,100 --> 00:44:15,620 Right? 898 00:44:16,440 --> 00:44:17,680 So bug zero, there is no storage. 899 00:44:17,800 --> 00:44:19,560 Writing anywhere in the array is completely bogus. 900 00:44:19,620 --> 00:44:20,440 So that's a bug. 901 00:44:20,660 --> 00:44:23,800 Or rather, it's a bug because we passed in zero. 902 00:44:24,180 --> 00:44:26,300 If we had passed in one, it would be okay. 903 00:44:26,800 --> 00:44:27,200 Right? 904 00:44:27,380 --> 00:44:29,440 So in order to not false positive, 905 00:44:29,560 --> 00:44:31,480 or to not have a false negative even, 906 00:44:31,580 --> 00:44:32,720 in this particular case, 907 00:44:32,800 --> 00:44:35,480 we would have to do interfunction value tracking. 908 00:44:36,200 --> 00:44:37,400 So how would we do that? 909 00:44:39,420 --> 00:44:40,240 How would we do that? 910 00:44:42,920 --> 00:44:44,220 We would trace the constraints 911 00:44:44,220 --> 00:44:45,720 down to the next function. 912 00:44:47,460 --> 00:44:48,560 That is correct. 913 00:44:48,840 --> 00:44:49,960 Basically all we have to do 914 00:44:49,960 --> 00:44:51,260 is follow the call instruction. 915 00:44:51,720 --> 00:44:53,860 We have to do our stack emulation 916 00:44:54,300 --> 00:44:55,520 to make the malloc work, 917 00:44:55,660 --> 00:44:57,480 or the malloc emulation work. 918 00:44:57,820 --> 00:44:59,560 So we just have to push things on the stack, 919 00:44:59,700 --> 00:45:00,440 do the call, 920 00:45:01,320 --> 00:45:02,640 pop things off the stack, 921 00:45:02,740 --> 00:45:03,320 like we're going to see, 922 00:45:03,500 --> 00:45:06,740 and use it just like we're interpreting the program, 923 00:45:06,920 --> 00:45:08,140 like we're emulating the program. 924 00:45:08,520 --> 00:45:10,720 So can we look at the assembly for this? 925 00:45:21,680 --> 00:45:23,320 It's just pissing in our face at this point. 926 00:45:23,400 --> 00:45:24,400 The font is big. 927 00:45:25,120 --> 00:45:26,860 We're used to it not working. 928 00:45:26,980 --> 00:45:27,820 It all of a sudden works. 929 00:45:28,100 --> 00:45:28,880 That's awesome. 930 00:45:29,980 --> 00:45:30,460 . 931 00:45:31,780 --> 00:45:32,580 Oh, is it? 932 00:45:34,980 --> 00:45:35,460 . 933 00:45:37,920 --> 00:45:38,400 . 934 00:45:39,800 --> 00:45:40,280 . 935 00:45:46,440 --> 00:45:47,520 I think that deserves a t-shirt. 936 00:45:47,580 --> 00:45:48,080 What size are you? 937 00:45:48,200 --> 00:45:48,560 Medium? 938 00:45:49,600 --> 00:45:49,960 . 939 00:45:52,900 --> 00:45:53,260 . 940 00:45:53,660 --> 00:45:54,020 . 941 00:45:54,020 --> 00:45:54,300 . 942 00:45:54,300 --> 00:45:54,340 . 943 00:45:54,340 --> 00:45:54,600 . 944 00:45:54,600 --> 00:45:54,660 . 945 00:45:55,360 --> 00:45:55,720 . 946 00:46:00,680 --> 00:46:01,040 . 947 00:46:01,040 --> 00:46:01,080 . 948 00:46:16,440 --> 00:46:16,660 . 949 00:46:23,480 --> 00:46:23,780 . 950 00:46:24,740 --> 00:46:25,040 . 951 00:46:29,300 --> 00:46:29,600 . 952 00:46:29,600 --> 00:46:30,060 . 953 00:46:30,060 --> 00:46:30,140 . 954 00:46:30,140 --> 00:46:30,160 . 955 00:46:30,160 --> 00:46:30,240 . 956 00:46:30,240 --> 00:46:30,260 . 957 00:46:30,640 --> 00:46:30,940 . 958 00:46:30,940 --> 00:46:30,960 . 959 00:46:30,960 --> 00:46:30,980 . 960 00:46:30,980 --> 00:46:31,000 . 961 00:46:41,960 --> 00:46:42,260 . 962 00:46:56,580 --> 00:46:56,660 . 963 00:46:57,320 --> 00:46:57,400 . 964 00:47:02,880 --> 00:47:02,960 . 965 00:47:04,100 --> 00:47:04,180 . 966 00:47:05,000 --> 00:47:05,080 . 967 00:47:05,080 --> 00:47:05,100 . 968 00:47:05,100 --> 00:47:05,140 . 969 00:47:05,140 --> 00:47:05,160 . 970 00:47:05,160 --> 00:47:05,280 . 971 00:47:05,280 --> 00:47:05,300 . 972 00:47:05,300 --> 00:47:05,320 . 973 00:47:05,320 --> 00:47:05,340 . 974 00:47:05,340 --> 00:47:05,360 . 975 00:47:46,140 --> 00:47:46,180 . 976 00:47:46,180 --> 00:47:46,200 . 977 00:47:46,200 --> 00:47:46,220 . 978 00:47:46,220 --> 00:47:46,240 . 979 00:47:46,240 --> 00:47:46,260 . 980 00:47:46,260 --> 00:47:46,280 . 981 00:47:46,280 --> 00:47:46,300 . 982 00:47:46,300 --> 00:47:46,320 . 983 00:47:46,320 --> 00:47:46,340 . 984 00:47:46,340 --> 00:47:46,360 . 985 00:47:46,360 --> 00:47:46,380 . 986 00:47:46,380 --> 00:47:46,400 . 987 00:47:46,400 --> 00:47:46,420 . 988 00:47:46,420 --> 00:47:46,800 . 989 00:47:56,500 --> 00:47:57,620 . 990 00:48:02,020 --> 00:48:03,140 . 991 00:48:05,920 --> 00:48:07,040 . 992 00:48:07,040 --> 00:48:07,340 . 993 00:48:07,340 --> 00:48:08,880 . 994 00:48:08,880 --> 00:48:08,900 . 995 00:48:08,900 --> 00:48:08,920 . 996 00:48:08,920 --> 00:48:09,480 . 997 00:48:09,480 --> 00:48:09,500 . 998 00:48:09,500 --> 00:48:09,520 . 999 00:48:13,600 --> 00:48:14,720 . 1000 00:48:14,720 --> 00:48:15,740 . 1001 00:48:45,360 --> 00:48:45,440 . . 1002 00:48:45,440 --> 00:48:45,460 . . 1003 00:48:45,460 --> 00:48:45,500 . . 1004 00:48:45,500 --> 00:48:45,540 . . 1005 00:48:46,120 --> 00:48:46,180 . . 1006 00:48:46,180 --> 00:48:46,220 . . 1007 00:48:46,220 --> 00:48:46,260 . . 1008 00:48:46,260 --> 00:48:46,300 . . 1009 00:48:46,300 --> 00:48:46,340 . . 1010 00:48:46,340 --> 00:48:46,380 . . 1011 00:48:47,020 --> 00:48:50,580 So we did malloc zero, we put something in, and it's out of bounds. Period. 1012 00:48:51,220 --> 00:48:53,920 Interfunction value tracking. So why is that so hard? 1013 00:48:55,260 --> 00:48:59,680 One of the difficulties with top-down stuff is let's say that this call stack, 1014 00:48:59,880 --> 00:49:01,280 so we have a thing that's one call stack deep. 1015 00:49:01,360 --> 00:49:05,500 Let's say the call stack was actually 800 function calls deep, right? 1016 00:49:05,560 --> 00:49:10,160 We had one function up here that called 800 functions down, down, down, down, down, down, down, right? 1017 00:49:10,620 --> 00:49:13,480 And so we called that top function from multiple places. 1018 00:49:13,480 --> 00:49:18,860 Every time that function was called, we'd have to go all the way down the call stack 1019 00:49:18,860 --> 00:49:20,480 and all the way back. 1020 00:49:20,860 --> 00:49:23,660 It's like a yo-yo in the Grand Canyon, right? 1021 00:49:23,860 --> 00:49:28,280 It's a lot of exertion for not a whole lot of results. 1022 00:49:29,900 --> 00:49:36,640 So if only there was some way, if only there was some way we could cache those results 1023 00:49:36,640 --> 00:49:40,580 because basically once we analyze them and we kind of come up with the constraints 1024 00:49:40,580 --> 00:49:43,460 to describe those, you know, if only there was a way 1025 00:49:43,480 --> 00:49:48,420 we could cache those per function, how would we do that? 1026 00:49:48,940 --> 00:49:50,460 How would we do that? You talk about it. 1027 00:49:55,780 --> 00:49:57,360 So we have all these functions. 1028 00:49:57,520 --> 00:50:01,940 It's all going to trickle down, and they get called multiple times. 1029 00:50:02,000 --> 00:50:02,840 They get called in a row. 1030 00:50:03,060 --> 00:50:06,680 So what we're trying to do is if this is going to happen over and over, 1031 00:50:06,760 --> 00:50:09,740 we basically have like a description of the function. 1032 00:50:10,880 --> 00:50:12,580 We can create what is... 1033 00:50:13,800 --> 00:50:18,200 kind of like a signature or a description of the function. 1034 00:50:18,540 --> 00:50:20,800 Similar to what we're doing right now with malloc, 1035 00:50:20,940 --> 00:50:22,840 we're not really calling malloc. 1036 00:50:22,940 --> 00:50:23,760 We're emulating malloc. 1037 00:50:23,900 --> 00:50:25,700 We know, okay, if this is a call to malloc, 1038 00:50:25,820 --> 00:50:28,180 it's going to take one argument, it's going to do this one thing, 1039 00:50:28,300 --> 00:50:30,440 and it's going to return a pointer to a buffer. 1040 00:50:30,760 --> 00:50:33,640 So as we start analyzing from top down, 1041 00:50:33,880 --> 00:50:36,960 we start looking at all the functions that we've already gone through, 1042 00:50:37,020 --> 00:50:38,860 and we can start passing things back up. 1043 00:50:39,000 --> 00:50:41,500 We can start passing up these descriptions back up. 1044 00:50:41,500 --> 00:50:44,640 So then we have descriptions of all these other functions, 1045 00:50:44,760 --> 00:50:46,200 and this is part of what takes... 1046 00:50:47,020 --> 00:50:48,580 makes analysis take a while, 1047 00:50:48,720 --> 00:50:51,860 is that you're going to have to construct all this data back up. 1048 00:50:54,960 --> 00:50:55,840 That's bottom up. 1049 00:50:57,700 --> 00:50:58,180 So... 1050 00:51:00,200 --> 00:51:01,620 So here's an example. 1051 00:51:01,840 --> 00:51:03,680 So he's going to bring up an example right now. 1052 00:51:04,860 --> 00:51:06,560 So this is hard. 1053 00:51:08,140 --> 00:51:10,020 And so we have... 1054 00:51:20,940 --> 00:51:22,360 So in this case, 1055 00:51:24,140 --> 00:51:25,780 we're actually passing... 1056 00:51:27,040 --> 00:51:28,480 We're going to call multiple functions. 1057 00:51:28,620 --> 00:51:30,340 First we're calling something called get taint. 1058 00:51:30,540 --> 00:51:31,960 That's going to set... 1059 00:51:32,500 --> 00:51:35,460 When we're in main right now, t doesn't have anything in it. 1060 00:51:35,500 --> 00:51:36,360 When we call get taint, 1061 00:51:36,460 --> 00:51:38,960 the data that's going to be contained in t is tainted. 1062 00:51:39,160 --> 00:51:40,760 It had to go to another function, 1063 00:51:40,760 --> 00:51:43,700 and that function modifies it and creates a taint. 1064 00:51:43,820 --> 00:51:46,760 That taint is then passed down to our vulnerable function bug. 1065 00:51:48,400 --> 00:51:49,880 And bug is going to... 1066 00:51:53,400 --> 00:51:54,580 Bug is writing... 1067 00:51:54,580 --> 00:51:55,520 It's going to malloc, 1068 00:51:55,560 --> 00:51:58,000 and it's going to write to the first position on that array. 1069 00:51:58,300 --> 00:51:59,680 And if you do a malloc 0, 1070 00:52:00,680 --> 00:52:03,520 some implementations are going to give you some type of buffer. 1071 00:52:03,600 --> 00:52:04,300 Other ones are not. 1072 00:52:04,400 --> 00:52:06,820 It depends on what version of glibc, blah, blah, blah, 1073 00:52:06,940 --> 00:52:08,460 all these different things. 1074 00:52:08,620 --> 00:52:09,040 But basically, 1075 00:52:09,040 --> 00:52:12,240 you should never be doing a malloc 0 in a program. 1076 00:52:12,480 --> 00:52:16,380 You should never see that as a standard thing that happens. 1077 00:52:16,680 --> 00:52:20,160 So we're writing our tainted data to the first position. 1078 00:52:20,420 --> 00:52:21,940 So when we're doing this top down, 1079 00:52:22,100 --> 00:52:26,500 we're going to have to know that this function sets tainted data. 1080 00:52:26,660 --> 00:52:27,900 That comes back up, 1081 00:52:27,960 --> 00:52:29,640 and then we have to drop back down a bug. 1082 00:52:35,960 --> 00:52:37,780 So basically with bottom up, 1083 00:52:37,780 --> 00:52:41,680 what you do is you analyze each function in isolation 1084 00:52:41,680 --> 00:52:43,780 without regard to the rest of the program. 1085 00:52:44,060 --> 00:52:45,420 And what do I mean by function? 1086 00:52:45,620 --> 00:52:48,640 There's something I really want to impress upon people here. 1087 00:52:48,860 --> 00:52:50,340 That is, there are no functions. 1088 00:52:50,540 --> 00:52:52,660 Functions are a construct inside of source code 1089 00:52:52,660 --> 00:52:56,680 that make it easy to sort of organize commands 1090 00:52:56,680 --> 00:52:58,420 and things of this nature. 1091 00:52:58,640 --> 00:53:01,580 In assembly, they do not exist. 1092 00:53:02,900 --> 00:53:03,960 Jedi mind trick. 1093 00:53:04,060 --> 00:53:05,440 There are no functions. 1094 00:53:05,600 --> 00:53:06,660 Everybody say it with me. 1095 00:53:06,660 --> 00:53:08,060 There are no functions. 1096 00:53:10,520 --> 00:53:11,220 Thank you. 1097 00:53:12,280 --> 00:53:14,400 This is funny, but it's really important. 1098 00:53:14,620 --> 00:53:15,160 And what it is, 1099 00:53:15,220 --> 00:53:16,640 people keep talking about functions, 1100 00:53:16,780 --> 00:53:18,640 and they keep using the metaphor of functions, 1101 00:53:18,760 --> 00:53:21,880 even though in like Windows XP and above, 1102 00:53:22,020 --> 00:53:23,400 with non-contiguous functions, 1103 00:53:23,760 --> 00:53:24,080 guess what? 1104 00:53:24,180 --> 00:53:25,360 They're not fucking functions anymore. 1105 00:53:25,580 --> 00:53:26,620 They're not contiguous anymore. 1106 00:53:26,920 --> 00:53:27,960 It was all an illusion. 1107 00:53:28,180 --> 00:53:29,540 It was all some magical dream. 1108 00:53:29,860 --> 00:53:31,660 The reason people keep thinking this way 1109 00:53:31,660 --> 00:53:33,380 is because the tools that we're using, 1110 00:53:33,440 --> 00:53:35,940 which are overextended 80 by 25 UIs, 1111 00:53:35,940 --> 00:53:38,440 basically with tabs and resizable windows, 1112 00:53:38,600 --> 00:53:40,660 they're still overextended 80 by 25 UIs, 1113 00:53:40,780 --> 00:53:42,980 still refer to things as functions. 1114 00:53:43,740 --> 00:53:44,920 Functions do not exist. 1115 00:53:45,200 --> 00:53:47,580 There are only basic blocks. 1116 00:53:47,900 --> 00:53:49,760 There are only control flow blocks. 1117 00:53:49,920 --> 00:53:52,140 Some control flow blocks happen to be 1118 00:53:52,860 --> 00:53:55,320 the target of a call instruction 1119 00:53:55,320 --> 00:53:56,760 or a jump instruction 1120 00:53:56,760 --> 00:53:57,980 or a whatever instruction. 1121 00:53:58,340 --> 00:54:00,500 But it is really, really important 1122 00:54:00,500 --> 00:54:04,020 to free your mind from this stupid bullshit 1123 00:54:04,020 --> 00:54:05,920 persisted by these UIs 1124 00:54:05,940 --> 00:54:08,540 and these UI paradigms from the 1980s, 1125 00:54:08,560 --> 00:54:10,420 the early 1980s, right? 1126 00:54:10,580 --> 00:54:12,320 These things that look like Turbo Debugger 1127 00:54:12,700 --> 00:54:13,740 that never grew up. 1128 00:54:13,860 --> 00:54:14,640 It's like Peter Pan. 1129 00:54:14,800 --> 00:54:16,080 It's like the UI that never grew up. 1130 00:54:16,200 --> 00:54:16,680 It's crazy. 1131 00:54:16,880 --> 00:54:18,060 It blows my mind. 1132 00:54:18,240 --> 00:54:20,760 People are trapped in these metaphors. 1133 00:54:22,820 --> 00:54:25,880 Anyways, so we have basic blocks, basically, 1134 00:54:25,920 --> 00:54:26,900 that are kind of grouped together 1135 00:54:26,900 --> 00:54:28,160 in a function-like thing. 1136 00:54:31,160 --> 00:54:34,460 And so we kind of discover these 1137 00:54:34,460 --> 00:54:35,480 as a pass-through. 1138 00:54:35,560 --> 00:54:37,480 It's kind of like a co-discovery pass, basically. 1139 00:54:37,640 --> 00:54:39,380 So we're discovering the basic blocks 1140 00:54:39,380 --> 00:54:40,940 that are the target of jumps and calls 1141 00:54:40,940 --> 00:54:41,720 and things like that, 1142 00:54:41,780 --> 00:54:43,420 that are sort of the entry point 1143 00:54:43,420 --> 00:54:45,660 into kind of a collection of basic blocks, 1144 00:54:45,800 --> 00:54:46,220 if you will. 1145 00:54:47,260 --> 00:54:48,620 Or you could call them functions. 1146 00:54:48,900 --> 00:54:49,980 I'm going to try not to. 1147 00:54:50,700 --> 00:54:51,100 Okay. 1148 00:54:52,300 --> 00:54:52,700 Yep. 1149 00:54:58,840 --> 00:55:01,340 So we do that discovery pass, let's say, 1150 00:55:01,400 --> 00:55:03,160 and we discover that there is get taint, 1151 00:55:03,160 --> 00:55:03,680 there is bug, 1152 00:55:03,800 --> 00:55:04,320 and there is main. 1153 00:55:04,540 --> 00:55:05,500 So in bottom-up, 1154 00:55:05,540 --> 00:55:07,140 you describe each of these in isolation 1155 00:55:07,140 --> 00:55:09,080 without any regard to how they're called 1156 00:55:09,080 --> 00:55:09,840 or anything like that 1157 00:55:09,840 --> 00:55:11,620 because we don't care in bottom-up. 1158 00:55:11,940 --> 00:55:13,420 So if we did one pass, 1159 00:55:13,680 --> 00:55:14,160 let's say, 1160 00:55:14,260 --> 00:55:15,040 through get taint, 1161 00:55:15,180 --> 00:55:15,700 all right, 1162 00:55:16,400 --> 00:55:17,940 what we would do with get taint 1163 00:55:17,940 --> 00:55:18,460 is we would say, 1164 00:55:18,560 --> 00:55:19,000 oh, well, 1165 00:55:19,200 --> 00:55:20,500 get taint ultimately 1166 00:55:21,260 --> 00:55:22,320 does a dereference 1167 00:55:22,320 --> 00:55:23,160 of a dereference 1168 00:55:23,160 --> 00:55:24,120 of the first parameter 1169 00:55:24,120 --> 00:55:25,640 and that's what it returns all the time. 1170 00:55:25,720 --> 00:55:27,080 There's no constraints or anything. 1171 00:55:27,220 --> 00:55:28,100 That's just what it does. 1172 00:55:28,700 --> 00:55:31,000 So there's an operator of dereference 1173 00:55:31,000 --> 00:55:32,140 and an operator of dereference 1174 00:55:32,140 --> 00:55:32,760 and we apply that 1175 00:55:32,760 --> 00:55:33,140 to the first parameter 1176 00:55:33,160 --> 00:55:33,420 of the first argument. 1177 00:55:33,580 --> 00:55:35,280 That's how we abstractly describe 1178 00:55:35,280 --> 00:55:36,580 this function. 1179 00:55:37,540 --> 00:55:37,980 Okay? 1180 00:55:38,220 --> 00:55:39,120 And so let's say 1181 00:55:39,120 --> 00:55:39,820 for the sake of argument, 1182 00:55:40,300 --> 00:55:41,620 main was the next one. 1183 00:55:41,740 --> 00:55:42,020 Well, 1184 00:55:43,720 --> 00:55:44,840 we happen to know 1185 00:55:45,620 --> 00:55:47,940 that at this point in main, 1186 00:55:48,500 --> 00:55:48,940 right, 1187 00:55:49,120 --> 00:55:50,100 let's pretend like 1188 00:55:50,100 --> 00:55:50,640 we don't know anything 1189 00:55:50,640 --> 00:55:51,320 about get taint, 1190 00:55:51,440 --> 00:55:51,600 right, 1191 00:55:51,620 --> 00:55:52,280 we're describing it 1192 00:55:52,280 --> 00:55:53,000 in isolation. 1193 00:55:53,460 --> 00:55:54,080 We don't, 1194 00:55:54,080 --> 00:55:54,760 we don't know anything 1195 00:55:54,760 --> 00:55:55,520 about get taint 1196 00:55:55,520 --> 00:55:57,520 so get taint gets executed 1197 00:55:57,520 --> 00:55:58,020 and we're like, 1198 00:55:58,040 --> 00:55:58,800 whatever. 1199 00:55:59,620 --> 00:56:00,640 We know that 1200 00:56:00,640 --> 00:56:01,840 that's a kind of 1201 00:56:01,840 --> 00:56:02,740 a call to something 1202 00:56:02,740 --> 00:56:03,140 but we don't know 1203 00:56:03,160 --> 00:56:04,420 anything about that yet. 1204 00:56:04,700 --> 00:56:06,260 So we'll just have unknowns 1205 00:56:06,660 --> 00:56:07,200 in our register. 1206 00:56:07,320 --> 00:56:07,780 We talked about 1207 00:56:07,780 --> 00:56:08,360 unknown values, 1208 00:56:08,520 --> 00:56:08,980 et cetera, et cetera. 1209 00:56:09,160 --> 00:56:09,260 We, 1210 00:56:09,300 --> 00:56:10,080 it's unconstrained. 1211 00:56:10,140 --> 00:56:10,440 We don't know 1212 00:56:10,440 --> 00:56:11,060 what the constraints are 1213 00:56:11,060 --> 00:56:11,580 when it returns. 1214 00:56:11,920 --> 00:56:12,240 Bug, 1215 00:56:12,440 --> 00:56:13,100 we go to run that, 1216 00:56:13,160 --> 00:56:13,360 we're like, 1217 00:56:13,440 --> 00:56:13,940 we don't know anything 1218 00:56:13,940 --> 00:56:14,360 else either 1219 00:56:14,360 --> 00:56:15,600 because we're not calling these things. 1220 00:56:15,660 --> 00:56:16,560 We're describing these functions 1221 00:56:16,560 --> 00:56:17,700 in isolation. 1222 00:56:18,060 --> 00:56:18,380 These, 1223 00:56:18,420 --> 00:56:18,920 these basic, 1224 00:56:18,960 --> 00:56:19,900 these groups of basic blocks 1225 00:56:19,900 --> 00:56:20,720 in isolation. 1226 00:56:21,220 --> 00:56:21,820 The next one 1227 00:56:21,820 --> 00:56:22,420 we're going to look at 1228 00:56:22,420 --> 00:56:23,680 is bug, right? 1229 00:56:23,760 --> 00:56:24,360 So we look at bug 1230 00:56:24,920 --> 00:56:25,960 and we analyze it 1231 00:56:25,960 --> 00:56:27,420 and we go, okay, there's a malloc sub zero. 1232 00:56:33,160 --> 00:56:34,720 And into the zeroth element 1233 00:56:34,720 --> 00:56:36,060 of that array, right? 1234 00:56:36,120 --> 00:56:36,980 So there is a buffer, 1235 00:56:37,540 --> 00:56:38,620 there's a buffer value 1236 00:56:38,620 --> 00:56:39,920 of size zero, 1237 00:56:40,080 --> 00:56:40,520 i.e., 1238 00:56:40,520 --> 00:56:41,920 you can't put anything in it. 1239 00:56:42,200 --> 00:56:43,920 And we are going to put 1240 00:56:43,920 --> 00:56:45,040 the first argument 1241 00:56:45,040 --> 00:56:47,720 into that zero length buffer. 1242 00:56:47,980 --> 00:56:49,380 So that's always a bug, 1243 00:56:49,560 --> 00:56:50,040 right? 1244 00:56:50,080 --> 00:56:50,660 So we can describe 1245 00:56:50,660 --> 00:56:51,860 this is always a bug 1246 00:56:51,860 --> 00:56:53,300 but if the first argument 1247 00:56:53,300 --> 00:56:53,840 is tainted 1248 00:56:53,840 --> 00:56:54,520 it's going to be 1249 00:56:54,520 --> 00:56:55,260 an exploitable bug, 1250 00:56:55,440 --> 00:56:55,840 right? 1251 00:56:55,900 --> 00:56:56,420 And we can know 1252 00:56:56,420 --> 00:56:57,320 that just looking at 1253 00:56:57,320 --> 00:56:58,120 the, 1254 00:56:58,120 --> 00:56:58,500 the, 1255 00:56:58,500 --> 00:56:59,740 the function 1256 00:56:59,740 --> 00:57:00,620 here in the source code. 1257 00:57:00,720 --> 00:57:01,100 Bug, 1258 00:57:01,280 --> 00:57:02,440 functions are a construct 1259 00:57:02,440 --> 00:57:03,140 of source code. 1260 00:57:03,160 --> 00:57:05,080 Not binary code. 1261 00:57:05,300 --> 00:57:05,680 Doesn't matter 1262 00:57:05,680 --> 00:57:06,480 what your UI says. 1263 00:57:06,760 --> 00:57:07,540 It's an illusion. 1264 00:57:07,820 --> 00:57:08,500 It's a construct. 1265 00:57:09,040 --> 00:57:09,480 So, 1266 00:57:10,360 --> 00:57:11,180 that's what we know, 1267 00:57:11,260 --> 00:57:11,400 right? 1268 00:57:11,500 --> 00:57:12,320 So in our first pass 1269 00:57:12,320 --> 00:57:13,120 that's our discovery. 1270 00:57:13,380 --> 00:57:14,020 So when we do 1271 00:57:14,020 --> 00:57:14,760 our second pass 1272 00:57:14,760 --> 00:57:15,500 we know everything 1273 00:57:15,500 --> 00:57:16,420 about every function here. 1274 00:57:16,700 --> 00:57:17,580 So we were able 1275 00:57:17,580 --> 00:57:17,880 to say, 1276 00:57:18,060 --> 00:57:18,340 okay, 1277 00:57:18,440 --> 00:57:18,860 in main, 1278 00:57:19,080 --> 00:57:19,840 let's start with main 1279 00:57:19,840 --> 00:57:20,400 for the sake of argument, 1280 00:57:20,580 --> 00:57:21,580 we know that get taint 1281 00:57:21,580 --> 00:57:22,400 returns the dereference 1282 00:57:22,400 --> 00:57:23,100 of the dereference 1283 00:57:23,100 --> 00:57:23,960 of the first argument. 1284 00:57:24,240 --> 00:57:24,680 Therefore, 1285 00:57:24,900 --> 00:57:26,980 we know that argv going in 1286 00:57:27,620 --> 00:57:28,500 the dereference 1287 00:57:28,500 --> 00:57:29,100 of the dereference 1288 00:57:29,100 --> 00:57:29,580 is tainted, 1289 00:57:29,700 --> 00:57:30,320 right? 1290 00:57:33,160 --> 00:57:33,500 So t is going 1291 00:57:33,500 --> 00:57:34,840 to have a tainted char 1292 00:57:34,840 --> 00:57:35,160 in it, 1293 00:57:35,260 --> 00:57:35,760 right? 1294 00:57:35,820 --> 00:57:36,740 We know that bug 1295 00:57:36,740 --> 00:57:37,920 is always going 1296 00:57:37,920 --> 00:57:38,180 to be, 1297 00:57:38,300 --> 00:57:39,320 have an out of bounds bug. 1298 00:57:39,840 --> 00:57:40,960 But if the first argument 1299 00:57:40,960 --> 00:57:41,400 is tainted, 1300 00:57:41,460 --> 00:57:42,080 it's exploitable. 1301 00:57:42,500 --> 00:57:42,880 At, 1302 00:57:42,960 --> 00:57:43,500 in this pass, 1303 00:57:43,700 --> 00:57:44,780 we know that t contains 1304 00:57:44,780 --> 00:57:45,160 exploited, 1305 00:57:45,300 --> 00:57:46,380 contains tainted data. 1306 00:57:46,700 --> 00:57:47,080 Therefore, 1307 00:57:47,340 --> 00:57:47,920 when we call bug, 1308 00:57:48,140 --> 00:57:49,020 it's going to be an exploitable 1309 00:57:49,020 --> 00:57:50,160 out of bounds error. 1310 00:57:50,560 --> 00:57:51,460 That's bottom up. 1311 00:57:51,780 --> 00:57:52,540 Here's the problem 1312 00:57:52,540 --> 00:57:53,100 with bottom up. 1313 00:57:53,200 --> 00:57:53,540 Can you go back 1314 00:57:53,540 --> 00:57:54,300 to the slides? 1315 00:57:59,540 --> 00:58:00,220 So the problem 1316 00:58:00,220 --> 00:58:00,720 with bottom up 1317 00:58:00,720 --> 00:58:01,220 is deeply 1318 00:58:01,220 --> 00:58:02,040 nested calls 1319 00:58:02,640 --> 00:58:03,020 basically. 1320 00:58:03,520 --> 00:58:04,440 So we're talking 1321 00:58:04,440 --> 00:58:05,360 about a call stack 1322 00:58:05,360 --> 00:58:06,460 that's 800 levels deep. 1323 00:58:06,620 --> 00:58:08,480 Okay, so in order 1324 00:58:08,480 --> 00:58:08,980 for that to bubble 1325 00:58:08,980 --> 00:58:09,440 all the way up 1326 00:58:09,440 --> 00:58:10,000 to the top, 1327 00:58:10,560 --> 00:58:10,960 basically, 1328 00:58:11,620 --> 00:58:12,300 so basically 1329 00:58:12,300 --> 00:58:13,200 each pass you do, 1330 00:58:13,300 --> 00:58:13,800 more information 1331 00:58:13,800 --> 00:58:14,480 bubbles up 1332 00:58:14,480 --> 00:58:15,120 to the next level 1333 00:58:15,120 --> 00:58:16,020 in the call stack, 1334 00:58:16,260 --> 00:58:16,620 right? 1335 00:58:17,080 --> 00:58:17,920 Next level up, 1336 00:58:17,940 --> 00:58:18,520 next level up. 1337 00:58:18,620 --> 00:58:20,220 So if you have a call stack 1338 00:58:20,220 --> 00:58:21,160 that's 800 levels deep, 1339 00:58:21,280 --> 00:58:22,100 you still have to iterate 1340 00:58:22,100 --> 00:58:23,160 over it 800 times 1341 00:58:23,160 --> 00:58:24,000 to get that to bubble 1342 00:58:24,000 --> 00:58:24,920 up to the top, 1343 00:58:25,040 --> 00:58:25,640 right? 1344 00:58:25,780 --> 00:58:26,780 So if you have a, 1345 00:58:26,800 --> 00:58:27,880 if all your call stacks 1346 00:58:27,880 --> 00:58:28,740 are 50 levels deep 1347 00:58:28,740 --> 00:58:29,080 or so, 1348 00:58:29,200 --> 00:58:29,900 but you have one 1349 00:58:29,900 --> 00:58:30,880 that's 800 levels deep, 1350 00:58:33,160 --> 00:58:33,480 The other one's 1351 00:58:33,480 --> 00:58:33,760 gonna be, 1352 00:58:33,820 --> 00:58:34,440 you're gonna iterate 1353 00:58:34,440 --> 00:58:35,780 50 times over the other ones 1354 00:58:35,780 --> 00:58:37,160 and basically be done. 1355 00:58:37,240 --> 00:58:37,760 You can't iterate 1356 00:58:37,760 --> 00:58:38,160 forever. 1357 00:58:39,340 --> 00:58:40,620 So one of the things 1358 00:58:40,620 --> 00:58:41,940 that I learned 1359 00:58:41,940 --> 00:58:43,560 in a practical implementation 1360 00:58:43,560 --> 00:58:44,360 that worked 1361 00:58:44,360 --> 00:58:45,200 and found real 1362 00:58:45,200 --> 00:58:45,900 exploitable bugs 1363 00:58:45,900 --> 00:58:47,080 is you have to do both. 1364 00:58:47,160 --> 00:58:47,360 There's kind of 1365 00:58:47,360 --> 00:58:48,340 academic bullshit 1366 00:58:48,340 --> 00:58:49,260 cock fights 1367 00:58:49,260 --> 00:58:50,600 about top down 1368 00:58:50,600 --> 00:58:51,540 versus bottom up 1369 00:58:51,540 --> 00:58:52,320 and this works 1370 00:58:52,320 --> 00:58:53,000 and that does it, 1371 00:58:53,060 --> 00:58:53,540 et cetera, et cetera. 1372 00:58:54,200 --> 00:58:55,080 I found you 1373 00:58:55,080 --> 00:58:55,620 used to use both 1374 00:58:55,620 --> 00:58:56,060 basically. 1375 00:58:56,320 --> 00:58:56,980 You get the best 1376 00:58:56,980 --> 00:58:57,560 of both worlds 1377 00:58:57,560 --> 00:58:57,920 effectively. 1378 00:58:58,100 --> 00:58:58,440 So you're able 1379 00:59:03,160 --> 00:59:03,180 to cock down 1380 00:59:03,180 --> 00:59:04,280 to basically meet 1381 00:59:04,280 --> 00:59:04,820 in the middle 1382 00:59:05,380 --> 00:59:06,780 and it sounds ad hoc 1383 00:59:06,780 --> 00:59:07,500 and I suppose 1384 00:59:07,500 --> 00:59:08,120 that it is. 1385 00:59:08,160 --> 00:59:09,400 It's not extremely 1386 00:59:09,400 --> 00:59:09,980 academic. 1387 00:59:09,980 --> 00:59:11,060 It's not provable, 1388 00:59:11,140 --> 00:59:11,860 et cetera, et cetera, 1389 00:59:11,920 --> 00:59:12,880 but it happens 1390 00:59:12,880 --> 00:59:13,400 to work. 1391 00:59:14,240 --> 00:59:14,960 Thank you. 1392 00:59:15,660 --> 00:59:16,140 Next. 1393 00:59:18,140 --> 00:59:19,220 So we talked 1394 00:59:19,220 --> 00:59:20,020 about this. 1395 00:59:20,040 --> 00:59:20,560 We talked 1396 00:59:20,560 --> 00:59:21,000 about that. 1397 00:59:21,180 --> 00:59:22,160 So basically 1398 00:59:22,680 --> 00:59:22,980 that's how 1399 00:59:22,980 --> 00:59:23,260 you detect 1400 00:59:23,260 --> 00:59:24,100 exploitable bugs, 1401 00:59:24,240 --> 00:59:24,660 right? 1402 00:59:24,800 --> 00:59:26,020 And so the C-sharp 1403 00:59:26,020 --> 00:59:26,860 code that is in 1404 00:59:26,860 --> 00:59:27,880 bug report 1405 00:59:28,520 --> 00:59:29,120 doesn't do 1406 00:59:29,120 --> 00:59:30,080 inter-function value tracking 1407 00:59:30,080 --> 00:59:30,780 but we've described 1408 00:59:30,780 --> 00:59:31,320 how easy 1409 00:59:33,160 --> 00:59:33,780 It's not that difficult. 1410 00:59:33,980 --> 00:59:34,780 The metaphors 1411 00:59:34,780 --> 00:59:35,260 are all there. 1412 00:59:35,480 --> 00:59:36,000 So what does 1413 00:59:36,000 --> 00:59:36,700 bug report do 1414 00:59:37,420 --> 00:59:37,740 exactly? 1415 00:59:38,180 --> 00:59:38,720 Can you show 1416 00:59:38,720 --> 00:59:39,220 the system test 1417 00:59:39,220 --> 00:59:40,280 list text 1418 00:59:40,280 --> 00:59:40,700 real quick? 1419 00:59:44,780 --> 00:59:45,420 So basically 1420 00:59:45,420 --> 00:59:46,080 since we've done 1421 00:59:46,080 --> 00:59:46,520 this in a test 1422 00:59:46,520 --> 00:59:47,020 driven fashion 1423 00:59:47,020 --> 00:59:47,580 we have a lot 1424 00:59:47,580 --> 00:59:48,060 of unit tests, 1425 00:59:48,160 --> 00:59:48,540 et cetera, et cetera, 1426 00:59:48,540 --> 00:59:48,980 but we always 1427 00:59:48,980 --> 00:59:49,460 start out with 1428 00:59:49,460 --> 00:59:50,240 a system test 1429 00:59:50,620 --> 00:59:51,320 of a program 1430 00:59:51,320 --> 00:59:51,840 we want to find 1431 00:59:51,840 --> 00:59:52,240 a bug in. 1432 00:59:52,460 --> 00:59:53,260 This is our list 1433 00:59:53,260 --> 00:59:53,920 of system tests. 1434 00:59:54,080 --> 00:59:55,060 We have a Python script, 1435 00:59:55,280 --> 00:59:56,420 well soon to be 1436 00:59:56,420 --> 00:59:57,400 extinct Python script 1437 00:59:57,400 --> 00:59:58,600 thanks to Mr. Douglas 1438 00:59:58,600 --> 00:59:59,100 here's 1439 00:59:59,760 --> 01:00:00,200 refactoring 1440 01:00:00,200 --> 01:00:01,400 that basically 1441 01:00:01,400 --> 01:00:02,160 goes through, 1442 01:00:02,320 --> 01:00:02,960 runs bug report 1443 01:00:02,960 --> 01:00:04,040 on all of these things 1444 01:00:04,040 --> 01:00:05,280 on all those tests 1445 01:00:05,280 --> 01:00:06,800 and checks to make sure 1446 01:00:06,800 --> 01:00:07,340 that the results 1447 01:00:07,340 --> 01:00:07,860 don't change. 1448 01:00:08,080 --> 01:00:08,920 Geez, that sounds 1449 01:00:08,920 --> 01:00:09,720 just like common sense. 1450 01:00:09,880 --> 01:00:10,360 Why wouldn't 1451 01:00:10,360 --> 01:00:11,120 everyone do that? 1452 01:00:11,200 --> 01:00:11,920 Beats the shit 1453 01:00:11,920 --> 01:00:12,280 out of me. 1454 01:00:12,560 --> 01:00:13,420 Some people just 1455 01:00:13,420 --> 01:00:14,920 like to not know 1456 01:00:14,920 --> 01:00:15,540 I guess. 1457 01:00:15,640 --> 01:00:16,460 It's like an adventure 1458 01:00:16,460 --> 01:00:17,880 to let your customers 1459 01:00:17,880 --> 01:00:18,520 find bugs. 1460 01:00:19,500 --> 01:00:19,940 Whatever. 1461 01:00:20,200 --> 01:00:20,580 I don't know. 1462 01:00:20,640 --> 01:00:21,100 Different strokes 1463 01:00:21,100 --> 01:00:21,500 make the world 1464 01:00:21,500 --> 01:00:21,900 go around. 1465 01:00:22,440 --> 01:00:23,120 I don't know. 1466 01:00:23,120 --> 01:00:25,180 So this is what 1467 01:00:25,180 --> 01:00:25,680 we talked about. 1468 01:00:26,240 --> 01:00:27,280 Basic value tracking, 1469 01:00:27,900 --> 01:00:28,680 out of bounds 1470 01:00:28,680 --> 01:00:29,120 memory detection. 1471 01:00:29,440 --> 01:00:30,120 It comes down 1472 01:00:30,120 --> 01:00:30,780 to out of bounds 1473 01:00:30,780 --> 01:00:31,220 memory detection. 1474 01:00:31,420 --> 01:00:32,340 In this case, 1475 01:00:32,380 --> 01:00:33,160 we've chosen 1476 01:00:33,160 --> 01:00:33,780 a very narrow 1477 01:00:33,780 --> 01:00:34,280 kind of thing. 1478 01:00:35,180 --> 01:00:35,920 We dealt with 1479 01:00:35,920 --> 01:00:36,240 branches, 1480 01:00:36,500 --> 01:00:37,460 we dealt with loops, 1481 01:00:37,700 --> 01:00:38,660 we were finding 1482 01:00:38,660 --> 01:00:39,540 real world exploitable 1483 01:00:39,540 --> 01:00:40,780 bugs and how 1484 01:00:40,780 --> 01:00:41,420 that would work 1485 01:00:41,420 --> 01:00:42,420 with real working 1486 01:00:42,420 --> 01:00:43,100 C sharp code 1487 01:00:43,720 --> 01:00:44,740 and that is at 1488 01:00:44,740 --> 01:00:45,900 that URL there. 1489 01:00:46,360 --> 01:00:47,240 One thing I'd like 1490 01:00:47,240 --> 01:00:47,540 to mention, 1491 01:00:47,620 --> 01:00:48,040 I think someone's 1492 01:00:48,040 --> 01:00:48,380 going to bring up 1493 01:00:48,380 --> 01:00:49,120 switch statements 1494 01:00:49,120 --> 01:00:50,480 and like jump tables 1495 01:00:53,120 --> 01:00:53,340 and constraints. 1496 01:00:53,380 --> 01:00:54,360 If you take the jump, 1497 01:00:54,400 --> 01:00:55,500 you know that ECX 1498 01:00:55,500 --> 01:00:56,720 is this and therefore 1499 01:00:56,720 --> 01:00:57,340 that's the constraint 1500 01:00:57,340 --> 01:00:57,960 on ECX 1501 01:00:57,960 --> 01:00:59,140 if you take the jump 1502 01:00:59,760 --> 01:01:00,460 for instance. 1503 01:01:01,060 --> 01:01:01,780 And so, 1504 01:01:01,800 --> 01:01:02,440 struct discovery, 1505 01:01:02,680 --> 01:01:03,380 all that kind of stuff, 1506 01:01:03,580 --> 01:01:04,240 it all comes down 1507 01:01:04,240 --> 01:01:05,300 to the same kind of stuff. 1508 01:01:05,480 --> 01:01:06,580 It's all values, 1509 01:01:06,920 --> 01:01:07,660 it's all abstract values 1510 01:01:07,660 --> 01:01:08,640 that point to things 1511 01:01:08,640 --> 01:01:09,420 that have a certain length 1512 01:01:09,420 --> 01:01:10,220 or a certain constraint 1513 01:01:10,220 --> 01:01:10,740 et cetera, et cetera. 1514 01:01:11,020 --> 01:01:11,920 With that said, 1515 01:01:12,680 --> 01:01:13,660 thank you very much. 1516 01:01:13,940 --> 01:01:14,540 Are there 1517 01:01:14,540 --> 01:01:14,900 any 1518 01:01:15,740 --> 01:01:16,140 quesestions? 1519 01:01:21,840 --> 01:01:22,640 I apologize. 1520 01:01:23,120 --> 01:01:23,780 I didn't see the whole thing. 1521 01:01:24,040 --> 01:01:24,420 That's all right. 1522 01:01:24,420 --> 01:01:24,800 How do you deal 1523 01:01:24,800 --> 01:01:27,040 with where you have 1524 01:01:27,040 --> 01:01:28,640 two different user inputs 1525 01:01:28,640 --> 01:01:29,340 of some form 1526 01:01:29,340 --> 01:01:30,440 or something that can't 1527 01:01:30,440 --> 01:01:30,780 be determined 1528 01:01:30,780 --> 01:01:32,200 by statically looking 1529 01:01:32,200 --> 01:01:32,720 at the binary? 1530 01:01:33,100 --> 01:01:34,140 One size is up 1531 01:01:34,140 --> 01:01:34,440 the buffer 1532 01:01:34,440 --> 01:01:35,060 and the other reads 1533 01:01:35,060 --> 01:01:35,980 into that count. 1534 01:01:36,440 --> 01:01:37,120 Do you understand 1535 01:01:37,120 --> 01:01:37,600 what I'm saying? 1536 01:01:37,760 --> 01:01:39,160 So you've got a value 1537 01:01:39,160 --> 01:01:40,200 that isn't in the program 1538 01:01:40,200 --> 01:01:41,280 itself without running. 1539 01:01:41,600 --> 01:01:42,080 Correct. 1540 01:01:42,620 --> 01:01:43,320 That comes from 1541 01:01:43,900 --> 01:01:44,860 two different sources. 1542 01:01:45,240 --> 01:01:45,280 Yep. 1543 01:01:45,380 --> 01:01:46,280 So the constraint 1544 01:01:46,280 --> 01:01:47,260 is still negative infinity 1545 01:01:47,260 --> 01:01:47,860 to positive infinity 1546 01:01:47,860 --> 01:01:48,880 until it gets constrained 1547 01:01:48,880 --> 01:01:49,580 by an assignment 1548 01:01:49,580 --> 01:01:50,960 or by a branch. 1549 01:01:51,980 --> 01:01:52,460 Basically, 1550 01:01:53,120 --> 01:01:53,640 it's unconstrained. 1551 01:01:53,720 --> 01:01:54,060 We don't know 1552 01:01:54,060 --> 01:01:54,920 negative infinity 1553 01:01:54,920 --> 01:01:55,700 to positive infinity 1554 01:01:55,700 --> 01:01:56,340 if we don't know 1555 01:01:56,340 --> 01:01:56,900 what it is. 1556 01:01:57,220 --> 01:01:58,060 If it comes from 1557 01:01:58,060 --> 01:01:58,760 some unknown source 1558 01:01:58,760 --> 01:01:59,360 where it's two different 1559 01:01:59,360 --> 01:02:00,020 places or whatever, 1560 01:02:00,480 --> 01:02:01,780 the source doesn't matter 1561 01:02:01,780 --> 01:02:02,420 basically. 1562 01:02:03,400 --> 01:02:04,560 How constrained is it 1563 01:02:04,560 --> 01:02:05,420 or unconstrained is it? 1564 01:02:06,100 --> 01:02:06,920 If that doesn't answer 1565 01:02:06,920 --> 01:02:07,280 your question, 1566 01:02:07,380 --> 01:02:08,340 come up to me later. 1567 01:02:08,800 --> 01:02:09,660 So there's this 1568 01:02:09,660 --> 01:02:10,540 points to thing 1569 01:02:10,540 --> 01:02:11,720 in the abstract value class. 1570 01:02:11,920 --> 01:02:12,240 Oh, awesome. 1571 01:02:12,340 --> 01:02:12,720 Someone looked 1572 01:02:12,720 --> 01:02:13,300 at the source code. 1573 01:02:13,500 --> 01:02:13,920 T-shirt. 1574 01:02:14,200 --> 01:02:15,560 And the taint, 1575 01:02:15,660 --> 01:02:16,160 the add taint 1576 01:02:16,160 --> 01:02:17,080 doesn't do anything with it 1577 01:02:17,080 --> 01:02:17,680 and there's this comment 1578 01:02:17,680 --> 01:02:18,340 like to do, 1579 01:02:18,420 --> 01:02:19,380 do something here later. 1580 01:02:23,120 --> 01:02:23,600 Did something 1581 01:02:23,600 --> 01:02:23,980 and what would 1582 01:02:23,980 --> 01:02:24,540 that something be? 1583 01:02:26,000 --> 01:02:27,360 So for things that, 1584 01:02:27,420 --> 01:02:28,660 so for pointers basically, 1585 01:02:29,080 --> 01:02:31,260 a pointer isn't really tainted, 1586 01:02:31,300 --> 01:02:31,500 right? 1587 01:02:31,620 --> 01:02:32,920 It doesn't contain any data. 1588 01:02:33,080 --> 01:02:33,400 It's just kind of 1589 01:02:33,400 --> 01:02:34,200 a pointer to data. 1590 01:02:34,400 --> 01:02:35,220 So how could a pointer 1591 01:02:35,820 --> 01:02:36,540 be tainted? 1592 01:02:36,740 --> 01:02:37,460 It can't be. 1593 01:02:37,700 --> 01:02:38,680 So kind of trying 1594 01:02:38,680 --> 01:02:39,280 to figure out like, 1595 01:02:39,360 --> 01:02:40,820 so I guess it could be tainted. 1596 01:02:40,980 --> 01:02:41,100 Hmm. 1597 01:02:41,340 --> 01:02:42,380 How would we deal with that? 1598 01:02:42,520 --> 01:02:43,620 And we don't have any tests, 1599 01:02:43,800 --> 01:02:44,520 any system tests 1600 01:02:44,520 --> 01:02:45,500 that kind of drive that. 1601 01:02:45,780 --> 01:02:47,400 So we put a to do 1602 01:02:47,400 --> 01:02:48,020 and said, 1603 01:02:48,080 --> 01:02:48,240 okay, 1604 01:02:48,360 --> 01:02:49,620 that doesn't strictly pertain 1605 01:02:49,620 --> 01:02:50,800 to our current customer test 1606 01:02:50,800 --> 01:02:51,760 but let's make a note 1607 01:02:51,760 --> 01:02:52,080 for later 1608 01:02:53,160 --> 01:02:54,120 So later do you try 1609 01:02:54,120 --> 01:02:54,940 to solve the constraints, 1610 01:02:55,040 --> 01:02:55,800 come up with some input 1611 01:02:55,800 --> 01:02:56,160 and say, 1612 01:02:56,280 --> 01:02:57,420 this points to things 1613 01:02:57,420 --> 01:02:58,500 that might be tainted. 1614 01:02:58,740 --> 01:02:59,020 Correct. 1615 01:02:59,100 --> 01:03:00,180 Let's actually get an input. 1616 01:03:00,180 --> 01:03:00,500 It could be, 1617 01:03:00,560 --> 01:03:01,080 it could not be. 1618 01:03:01,140 --> 01:03:02,440 The constraints will let you know basically. 1619 01:03:02,920 --> 01:03:04,180 And just one quick question. 1620 01:03:04,260 --> 01:03:05,700 Which constraint solver do you use? 1621 01:03:05,820 --> 01:03:06,620 Just roll your arm. 1622 01:03:06,620 --> 01:03:07,120 We haven't written it yet. 1623 01:03:07,320 --> 01:03:07,600 Okay. 1624 01:03:07,660 --> 01:03:08,640 We could use any which one of them. 1625 01:03:08,720 --> 01:03:09,680 There's a whole bunch of them out there. 1626 01:03:09,740 --> 01:03:10,400 It's an academic thing. 1627 01:03:10,460 --> 01:03:11,120 It's been solved a long, 1628 01:03:11,180 --> 01:03:11,480 long time. 1629 01:03:11,640 --> 01:03:12,740 I've been using CBC light. 1630 01:03:12,840 --> 01:03:13,460 It works pretty well. 1631 01:03:13,680 --> 01:03:13,920 Oh, cool. 1632 01:03:14,080 --> 01:03:14,600 It's good to know. 1633 01:03:14,980 --> 01:03:15,260 Thanks. 1634 01:03:18,720 --> 01:03:19,000 Hi. 1635 01:03:19,160 --> 01:03:19,500 I was wondering 1636 01:03:19,500 --> 01:03:21,000 if you had read 1637 01:03:21,000 --> 01:03:21,520 much of the papers 1638 01:03:23,120 --> 01:03:23,320 in England 1639 01:03:23,320 --> 01:03:24,380 and that group doing that. 1640 01:03:24,400 --> 01:03:24,580 Yes. 1641 01:03:24,580 --> 01:03:25,080 The people. 1642 01:03:25,640 --> 01:03:25,800 Yes. 1643 01:03:26,420 --> 01:03:27,200 I know them. 1644 01:03:27,300 --> 01:03:27,620 Yes. 1645 01:03:28,700 --> 01:03:29,680 What's your opinion 1646 01:03:29,680 --> 01:03:30,240 on the research? 1647 01:03:30,500 --> 01:03:31,140 I was curious. 1648 01:03:31,420 --> 01:03:31,780 I mean, 1649 01:03:31,800 --> 01:03:32,340 it's some good ideas. 1650 01:03:32,420 --> 01:03:32,680 Absolutely. 1651 01:03:32,860 --> 01:03:33,280 And they're really good 1652 01:03:33,280 --> 01:03:34,160 at finding old references 1653 01:03:34,160 --> 01:03:35,040 and memory leaks 1654 01:03:35,040 --> 01:03:35,780 and things like that. 1655 01:03:36,840 --> 01:03:38,040 As far as value tracking 1656 01:03:38,040 --> 01:03:38,900 and stuff like that, 1657 01:03:39,000 --> 01:03:39,720 I really don't know. 1658 01:03:39,800 --> 01:03:40,120 I haven't used 1659 01:03:40,120 --> 01:03:40,900 the program personally. 1660 01:03:41,280 --> 01:03:42,600 But I do know that PCLint 1661 01:03:42,600 --> 01:03:44,000 finds a lot of the same bugs 1662 01:03:44,000 --> 01:03:45,280 pretty accurately. 1663 01:03:45,500 --> 01:03:47,040 And PCLint does C++ 1664 01:03:47,780 --> 01:03:48,980 and a lot of other things 1665 01:03:48,980 --> 01:03:50,200 that they just refuse 1666 01:03:50,200 --> 01:03:51,360 to do effectively 1667 01:03:51,360 --> 01:03:53,100 and does it very well 1668 01:03:53,120 --> 01:03:54,060 for $239 1669 01:03:54,680 --> 01:03:56,280 for any size code base. 1670 01:03:56,480 --> 01:03:57,160 And I do believe 1671 01:03:57,160 --> 01:03:57,700 that their licensing 1672 01:03:57,700 --> 01:03:58,980 is still per line of code 1673 01:03:58,980 --> 01:04:00,100 which kind of blows my mind. 1674 01:04:00,240 --> 01:04:01,400 But different strokes 1675 01:04:01,400 --> 01:04:02,140 make their world go round 1676 01:04:02,140 --> 01:04:02,980 and that's their business plan. 1677 01:04:03,580 --> 01:04:04,720 So I haven't used it personally 1678 01:04:04,720 --> 01:04:06,200 but those are my impressions. 1679 01:04:06,440 --> 01:04:07,120 Does that answer your question? 1680 01:04:07,380 --> 01:04:07,480 Yeah. 1681 01:04:07,660 --> 01:04:07,980 Cool. 1682 01:04:08,980 --> 01:04:09,680 PCLint, by the way, 1683 01:04:09,740 --> 01:04:10,400 is the one that I like. 1684 01:04:10,560 --> 01:04:11,360 So everybody knows. 1685 01:04:11,500 --> 01:04:12,220 It's the one I use personally. 1686 01:04:12,300 --> 01:04:13,260 I bought my own personal copy. 1687 01:04:13,460 --> 01:04:14,200 I use it in a lot 1688 01:04:14,200 --> 01:04:15,100 of my open source development 1689 01:04:15,100 --> 01:04:15,860 to help me find bugs. 1690 01:04:18,220 --> 01:04:18,800 Yes, Ryan. 1691 01:04:19,000 --> 01:04:19,580 So I don't think 1692 01:04:19,580 --> 01:04:20,000 you can get rid 1693 01:04:20,000 --> 01:04:20,460 of the function 1694 01:04:20,460 --> 01:04:21,580 abstraction entirely. 1695 01:04:21,960 --> 01:04:22,680 Eventually you hit 1696 01:04:23,120 --> 01:04:23,600 lock or receive 1697 01:04:23,600 --> 01:04:24,600 or something like that. 1698 01:04:24,920 --> 01:04:25,900 And speaking of which, 1699 01:04:25,960 --> 01:04:27,480 if you're going to use object dump 1700 01:04:27,480 --> 01:04:28,800 until you get your own disassembler, 1701 01:04:28,880 --> 01:04:29,500 what are you guys doing 1702 01:04:29,500 --> 01:04:30,100 about the lack 1703 01:04:30,100 --> 01:04:31,760 of a flirt library 1704 01:04:31,760 --> 01:04:32,640 or equivalent? 1705 01:04:34,080 --> 01:04:35,180 Basically what we're doing 1706 01:04:35,180 --> 01:04:35,540 right now 1707 01:04:35,540 --> 01:04:36,380 is we're training ourselves 1708 01:04:36,380 --> 01:04:37,000 as you look 1709 01:04:37,000 --> 01:04:37,860 in the system test list 1710 01:04:37,860 --> 01:04:39,040 to O2 compiled 1711 01:04:39,040 --> 01:04:39,700 with dash G. 1712 01:04:39,920 --> 01:04:41,000 Or anything compiled 1713 01:04:41,000 --> 01:04:41,500 with dash G 1714 01:04:41,500 --> 01:04:42,880 with GCC 4.0.3. 1715 01:04:43,180 --> 01:04:43,960 So what we've done 1716 01:04:43,960 --> 01:04:44,700 in these initial things 1717 01:04:44,700 --> 01:04:45,620 is we've constrained ourselves 1718 01:04:45,620 --> 01:04:46,580 so we can provide 1719 01:04:46,580 --> 01:04:47,540 a lot of value 1720 01:04:47,540 --> 01:04:49,000 on open source code 1721 01:04:49,000 --> 01:04:50,200 compiled specifically 1722 01:04:50,200 --> 01:04:51,080 on my computer 1723 01:04:51,080 --> 01:04:52,180 because it's my computer. 1724 01:04:52,180 --> 01:04:52,920 So all self compiled 1725 01:04:52,920 --> 01:04:53,100 systems 1726 01:04:53,120 --> 01:04:53,820 so you can get the symbols 1727 01:04:53,820 --> 01:04:54,440 and everything, right? 1728 01:04:54,620 --> 01:04:54,840 Yes. 1729 01:04:55,000 --> 01:04:56,160 Do you need a disassembler 1730 01:04:56,160 --> 01:04:56,980 before you can go after 1731 01:04:56,980 --> 01:04:57,800 the raw binaries 1732 01:04:57,800 --> 01:04:58,700 closed source? 1733 01:05:00,040 --> 01:05:01,000 Well if you go look 1734 01:05:01,000 --> 01:05:01,780 at the code actually, 1735 01:05:01,880 --> 01:05:02,480 a lot of stuff 1736 01:05:02,480 --> 01:05:03,380 that we've had to do 1737 01:05:04,300 --> 01:05:05,240 basically to parse 1738 01:05:05,240 --> 01:05:06,580 op codes correctly, 1739 01:05:06,760 --> 01:05:07,500 just in the very simple 1740 01:05:07,500 --> 01:05:08,360 programs that we have, 1741 01:05:08,480 --> 01:05:09,940 we basically can do that now 1742 01:05:09,940 --> 01:05:10,820 because we know 1743 01:05:10,820 --> 01:05:11,460 if there's a mod RM, 1744 01:05:11,640 --> 01:05:12,380 we know if there's a sib, 1745 01:05:12,480 --> 01:05:13,000 we know the length, 1746 01:05:13,080 --> 01:05:13,580 et cetera, et cetera. 1747 01:05:14,120 --> 01:05:14,840 So it's just a matter 1748 01:05:14,840 --> 01:05:15,640 of kind of integrating 1749 01:05:15,640 --> 01:05:16,520 that and doing it. 1750 01:05:17,220 --> 01:05:18,120 It basically could be 1751 01:05:18,120 --> 01:05:19,540 sort of a refactoring step 1752 01:05:19,540 --> 01:05:21,260 more than a function feature add. 1753 01:05:23,420 --> 01:05:24,120 Good question. 1754 01:05:24,300 --> 01:05:25,680 Do you want a GPLV3 t-shirt? 1755 01:05:26,100 --> 01:05:27,020 Got them hacker sized? 1756 01:05:27,760 --> 01:05:28,680 We have an XL. 1757 01:05:30,860 --> 01:05:31,820 Football player, right? 1758 01:05:33,820 --> 01:05:34,780 A quick question 1759 01:05:34,780 --> 01:05:35,320 about constraint. 1760 01:05:35,580 --> 01:05:36,540 It seems like since you know 1761 01:05:36,540 --> 01:05:37,020 it's a computer, 1762 01:05:37,140 --> 01:05:38,920 you know bytes are 0 to 255, 1763 01:05:39,040 --> 01:05:40,440 registers are either 32 bit 1764 01:05:40,440 --> 01:05:41,200 or 64 bit. 1765 01:05:41,400 --> 01:05:41,460 Yeah. 1766 01:05:41,540 --> 01:05:42,240 Would you really want 1767 01:05:42,240 --> 01:05:43,380 to be doing maxint plus 10 1768 01:05:43,380 --> 01:05:44,860 or can you just do 0 to maxint 1769 01:05:44,860 --> 01:05:45,500 and be done with it? 1770 01:05:46,320 --> 01:05:47,040 You could, 1771 01:05:47,280 --> 01:05:48,140 like there's no reason 1772 01:05:48,140 --> 01:05:48,640 to do that. 1773 01:05:48,720 --> 01:05:49,320 You're 100% correct. 1774 01:05:50,080 --> 01:05:50,640 Just curious. 1775 01:05:50,820 --> 01:05:51,160 Yep. 1776 01:05:51,680 --> 01:05:52,500 But basically you want 1777 01:05:52,500 --> 01:05:53,040 to express it 1778 01:05:53,040 --> 01:05:53,100 in the same way 1779 01:05:53,100 --> 01:05:53,720 that you don't know, 1780 01:05:53,820 --> 01:05:54,020 basically. 1781 01:05:54,020 --> 01:05:54,420 There's a difference 1782 01:05:54,420 --> 01:05:55,840 between 0 to 255 1783 01:05:55,840 --> 01:05:57,340 and beats the shit out of me. 1784 01:05:57,880 --> 01:05:58,560 So that's it. 1785 01:05:58,640 --> 01:05:59,120 That's an important 1786 01:05:59,120 --> 01:05:59,980 distinction to have 1787 01:05:59,980 --> 01:06:01,280 that it has been constrained 1788 01:06:01,280 --> 01:06:02,920 or it hasn't been constrained. 1789 01:06:03,100 --> 01:06:03,960 That's the main thing. 1790 01:06:04,040 --> 01:06:04,400 It doesn't have 1791 01:06:04,400 --> 01:06:05,060 to be maxint. 1792 01:06:05,520 --> 01:06:06,240 Well it's, 1793 01:06:06,240 --> 01:06:07,140 I mean it's constrained 1794 01:06:07,140 --> 01:06:07,780 by the physical 1795 01:06:07,780 --> 01:06:09,360 of the computer guaranteed, right? 1796 01:06:09,720 --> 01:06:11,440 So you can start there 1797 01:06:11,440 --> 01:06:12,080 and just shrink it. 1798 01:06:12,080 --> 01:06:12,160 That's true. 1799 01:06:12,160 --> 01:06:12,340 That's true. 1800 01:06:12,600 --> 01:06:13,460 You still want to express 1801 01:06:13,460 --> 01:06:14,580 the intention of 1802 01:06:15,000 --> 01:06:15,920 we have no idea 1803 01:06:15,920 --> 01:06:16,580 what this is. 1804 01:06:16,920 --> 01:06:18,240 It could be 0 to 255, 1805 01:06:18,320 --> 01:06:18,920 certainly. 1806 01:06:19,200 --> 01:06:20,020 But for the case 1807 01:06:20,020 --> 01:06:21,020 of the static analysis 1808 01:06:21,020 --> 01:06:21,640 because otherwise 1809 01:06:23,100 --> 01:06:23,340 it's 0 to 255, 1810 01:06:23,340 --> 01:06:25,080 but if it's used 1811 01:06:25,080 --> 01:06:25,620 in a context 1812 01:06:25,620 --> 01:06:26,000 you don't have 1813 01:06:26,000 --> 01:06:26,660 a false positive 1814 01:06:26,660 --> 01:06:27,420 or a false negative 1815 01:06:27,420 --> 01:06:27,820 or whatever. 1816 01:06:27,960 --> 01:06:28,440 You want to be able 1817 01:06:28,440 --> 01:06:29,620 to go I don't know 1818 01:06:29,620 --> 01:06:30,200 about this. 1819 01:06:30,380 --> 01:06:31,160 So you can have 1820 01:06:31,160 --> 01:06:32,140 report items like 1821 01:06:32,140 --> 01:06:33,300 I absolutely know 1822 01:06:33,300 --> 01:06:33,820 this is a bug. 1823 01:06:34,300 --> 01:06:35,080 Absolutely know 1824 01:06:35,080 --> 01:06:35,620 because I know 1825 01:06:35,620 --> 01:06:36,480 everything about the constraint 1826 01:06:36,480 --> 01:06:37,960 and have another kind 1827 01:06:37,960 --> 01:06:38,560 of report item 1828 01:06:38,560 --> 01:06:39,980 that is like 1829 01:06:39,980 --> 01:06:41,260 this could be a bug. 1830 01:06:41,520 --> 01:06:42,440 I couldn't quite 1831 01:06:42,440 --> 01:06:43,160 figure it out 1832 01:06:43,160 --> 01:06:43,880 because I couldn't 1833 01:06:43,880 --> 01:06:44,220 quite narrow 1834 01:06:44,220 --> 01:06:44,940 the constraint enough. 1835 01:06:45,420 --> 01:06:46,740 So while you're right 1836 01:06:46,740 --> 01:06:47,780 the intention 1837 01:06:47,780 --> 01:06:48,580 of the negative infinity 1838 01:06:48,580 --> 01:06:49,240 to positive infinity 1839 01:06:53,100 --> 01:06:53,180 is important 1840 01:06:53,180 --> 01:06:54,400 especially when you 1841 01:06:54,400 --> 01:06:55,920 come to subtraction 1842 01:06:55,920 --> 01:06:56,280 and addition. 1843 01:06:56,520 --> 01:06:57,080 So if you have 1844 01:06:57,080 --> 01:06:57,840 an unknown value 1845 01:06:57,840 --> 01:06:58,720 and if you have 1846 01:06:58,720 --> 01:06:59,260 infinity 1847 01:06:59,260 --> 01:07:00,280 you subtract one 1848 01:07:00,280 --> 01:07:00,840 what is it? 1849 01:07:00,940 --> 01:07:01,340 Infinity. 1850 01:07:01,640 --> 01:07:02,700 We still don't know 1851 01:07:02,700 --> 01:07:03,300 what it is. 1852 01:07:03,500 --> 01:07:04,520 Whereas if we say 1853 01:07:04,520 --> 01:07:05,420 it's 0 to 255 1854 01:07:05,420 --> 01:07:06,000 let's say 1855 01:07:06,000 --> 01:07:06,820 as like a concrete 1856 01:07:06,820 --> 01:07:07,400 kind of range 1857 01:07:07,400 --> 01:07:08,280 if we then subtract 1858 01:07:08,280 --> 01:07:10,180 one that there's 1859 01:07:10,180 --> 01:07:10,660 a difference. 1860 01:07:10,800 --> 01:07:11,280 You have the user 1861 01:07:11,280 --> 01:07:11,940 inputted data 1862 01:07:11,940 --> 01:07:12,400 and you know 1863 01:07:12,400 --> 01:07:13,860 it's a series 1864 01:07:13,860 --> 01:07:14,180 of bytes 1865 01:07:14,180 --> 01:07:15,000 and then you either 1866 01:07:15,000 --> 01:07:15,920 do constants on it 1867 01:07:15,920 --> 01:07:16,340 or some sort 1868 01:07:16,340 --> 01:07:16,980 of system config 1869 01:07:16,980 --> 01:07:18,120 modification on it. 1870 01:07:18,420 --> 01:07:19,840 So it can't ever 1871 01:07:19,840 --> 01:07:20,360 be in a state 1872 01:07:20,360 --> 01:07:21,160 of infinity really. 1873 01:07:22,600 --> 01:07:23,000 Yeah. 1874 01:07:23,380 --> 01:07:24,100 You're right. 1875 01:07:24,420 --> 01:07:24,960 You're right. 1876 01:07:25,060 --> 01:07:26,100 I think we're 1877 01:07:26,100 --> 01:07:26,900 in violent agreement 1878 01:07:26,900 --> 01:07:27,760 as it is. 1879 01:07:27,920 --> 01:07:28,040 Yeah. 1880 01:07:28,140 --> 01:07:28,740 Actually I really 1881 01:07:28,740 --> 01:07:29,460 appreciate this talk. 1882 01:07:29,600 --> 01:07:30,920 It's been quite a week 1883 01:07:30,920 --> 01:07:32,120 to go to talks 1884 01:07:32,120 --> 01:07:32,700 at Black Hat 1885 01:07:32,700 --> 01:07:33,280 and hear that 1886 01:07:33,280 --> 01:07:34,200 oh we're just barely 1887 01:07:34,200 --> 01:07:34,880 starting this 1888 01:07:34,880 --> 01:07:36,060 to Halvers talk. 1889 01:07:36,220 --> 01:07:36,880 This is nearly impossible 1890 01:07:36,880 --> 01:07:37,800 to this talk 1891 01:07:37,800 --> 01:07:38,720 that it's not only 1892 01:07:38,720 --> 01:07:39,120 possible 1893 01:07:39,120 --> 01:07:39,900 but we're doing it. 1894 01:07:40,120 --> 01:07:40,520 Yeah. 1895 01:07:40,640 --> 01:07:40,980 I really 1896 01:07:40,980 --> 01:07:41,920 thank you very much. 1897 01:07:41,920 --> 01:07:42,400 I really, 1898 01:07:42,420 --> 01:07:43,140 really appreciate that. 1899 01:07:43,660 --> 01:07:44,540 Thank you very much. 1900 01:07:46,380 --> 01:07:47,000 If there's 1901 01:07:47,000 --> 01:07:47,580 no more questions 1902 01:07:48,080 --> 01:07:48,880 you can come up 1903 01:07:48,880 --> 01:07:49,200 afterward. 1904 01:07:49,720 --> 01:07:50,320 That's fine. 1905 01:07:50,720 --> 01:07:51,320 Thanks guys.