1 00:00:11,320 --> 00:00:17,120 Welcome to the combined finalitizo speech. I have the pleasure of speaking with 2 00:00:17,120 --> 00:00:30,920 Harvard Flag here. Hands. And what we are trying to do is actually to bootstrap most 3 00:00:30,920 --> 00:00:38,180 of you script kiddies into real hackers. So the idea here is we're quickly talking 4 00:00:38,180 --> 00:00:46,740 about the mindset, then a lengthy session on finding vulnerabilities, and quick part 5 00:00:46,740 --> 00:00:47,000 on 6 00:00:47,000 --> 00:00:51,300 writing exploits. And if we got time, because the speech got cut short, as you just heard, 7 00:00:52,000 --> 00:00:55,120 we're talking about exploiting non-standard stuff. 8 00:00:56,760 --> 00:01:02,860 So the first and foremost thing. Who in the room knows who John von Neumann is? Raise 9 00:01:02,860 --> 00:01:15,820 your hand. See? That should be everyone in this room. The thing is, every computer today 10 00:01:15,820 --> 00:01:16,720 is built after 11 00:01:16,720 --> 00:01:23,220 something that's called the von Neumann machine. And this basically makes no difference between 12 00:01:23,220 --> 00:01:31,060 data and code. It doesn't matter if a byte is data or if a byte is code. Data can become 13 00:01:31,060 --> 00:01:37,000 code and code can become data. The only difference is that the data your instruction pointer 14 00:01:37,000 --> 00:01:43,500 points to is the code that's executed. That's it. And all exploitation actually depends 15 00:01:43,500 --> 00:01:44,380 on this fact. 16 00:01:46,740 --> 00:01:50,140 Second thing. Please start opening your eyes. 17 00:01:50,500 --> 00:01:56,280 If you have something that crashes, don't just ignore it. Don't just click away, 18 00:01:56,380 --> 00:02:02,360 Dr. Watson. Don't just delete the core file that was just produced by a web server. Please 19 00:02:02,360 --> 00:02:07,820 don't. Take the time and look at what happened. If you surf to a web page with your favorite 20 00:02:07,820 --> 00:02:12,560 web browser and your web browser disappears, and you surf to this web page again and your 21 00:02:12,560 --> 00:02:16,700 web browser disappears again, this is something you want to look at. You want to look at. 22 00:02:16,700 --> 00:02:20,980 You want to know what this web page does, what this web page actually sends your web 23 00:02:20,980 --> 00:02:26,400 browser to make it crash. Take a debugger, look at it, try to find out what happened. 24 00:02:26,940 --> 00:02:31,700 Don't ignore everything. Most people just walk around and stumble across vulnerabilities 25 00:02:32,380 --> 00:02:40,820 every day and just don't realize. So start looking. And here's a warning. Don't make 26 00:02:40,820 --> 00:02:45,900 any mistakes about it. This is real work. If you want to do something, you have to learn 27 00:02:45,900 --> 00:02:46,320 the stuff. 28 00:02:46,700 --> 00:02:54,520 You have to take a lot of time to find vulnerabilities. If you write exploits and they're supposed 29 00:02:54,520 --> 00:02:59,300 to work on something else than your local computer, it takes time. You have to find 30 00:02:59,300 --> 00:03:06,580 out how to make them reliable. So you have to really put some work in there. This doesn't 31 00:03:06,580 --> 00:03:07,260 come for free. 32 00:03:07,420 --> 00:03:13,200 And unfortunately, just in case you don't want to waste your time, brain is required. 33 00:03:13,580 --> 00:03:16,680 So if you don't have one, just don't waste it. 34 00:03:16,680 --> 00:03:17,840 Just don't waste your time with the rest of the slides. 35 00:03:21,120 --> 00:03:28,040 So finding vulnerabilities. Here's the deal. What we want to have is ODE and possibly our 36 00:03:28,040 --> 00:03:34,620 own ODE. So what we're looking for is something that handles network input, anything. As long 37 00:03:34,620 --> 00:03:39,880 as it handles any type of network input, we're fine. We look for something that runs 38 00:03:39,880 --> 00:03:45,860 on a remote system. Reason being, if we exploit our local system, it's kind of boring because, 39 00:03:45,860 --> 00:03:48,320 well, we know the administrator password already. 40 00:03:49,740 --> 00:03:54,440 And please, if you look for vulnerabilities, look for something that is complex enough. 41 00:03:55,320 --> 00:04:03,980 Except for Cisco, it doesn't really make sense to try to attack a UDP echo service. In case 42 00:04:03,980 --> 00:04:04,900 of Cisco, it's different. 43 00:04:07,560 --> 00:04:15,160 So what testing methods do we have? We can do manual testing, pure groundwork, make your 44 00:04:15,160 --> 00:04:15,640 hands dirty. 45 00:04:15,860 --> 00:04:23,860 We can fuzz stuff. We can do static analysis. We can diff stuff. Or we can do runtime analysis. 46 00:04:25,080 --> 00:04:31,020 So manual testing basically means you use the thing the way it is intended to be used. 47 00:04:31,220 --> 00:04:35,420 You use the client that's supposed to be used. So if you're testing a web server, what would 48 00:04:35,420 --> 00:04:35,980 be the client? 49 00:04:37,880 --> 00:04:39,280 Yeah, the web browser. 50 00:04:39,700 --> 00:04:43,960 So sometimes you have things that are a bit more complex. 51 00:04:43,960 --> 00:04:50,740 And you should actually then use the client that gives you the most functionality. 52 00:04:51,560 --> 00:04:56,000 What you're doing is you just use all the functionality and look at things. You look 53 00:04:56,000 --> 00:05:03,380 at the reaction of the target to valid input. What is it supposed to do? Most people start 54 00:05:03,380 --> 00:05:07,960 installing web server and try to, like, find bugs without knowing actually how the web 55 00:05:07,960 --> 00:05:08,420 server works. 56 00:05:09,480 --> 00:05:13,680 You have to observe the difference between valid and invalid input. 57 00:05:14,620 --> 00:05:21,780 Because if you're having just the idea of how it reacts to invalid input, you cannot 58 00:05:21,780 --> 00:05:22,580 compare. 59 00:05:22,840 --> 00:05:24,340 You don't know what's going on. 60 00:05:24,460 --> 00:05:25,920 And you need to find out what's going on. 61 00:05:26,060 --> 00:05:32,680 The most important thing is here, observe the correlation between your actions and network. 62 00:05:33,000 --> 00:05:35,520 The network communication that's going on. 63 00:05:35,640 --> 00:05:38,020 Both timing and what's been sent. 64 00:05:38,260 --> 00:05:40,860 So please start using the sniffers. 65 00:05:41,260 --> 00:05:43,880 Start looking at what's happening at the cable. 66 00:05:43,960 --> 00:05:45,320 Why are you using something? 67 00:05:46,260 --> 00:05:50,980 So you look at information that's transmitted before and after the authentication. 68 00:05:51,320 --> 00:05:54,380 Well after authentication is sometimes kind of boring. 69 00:05:54,560 --> 00:06:01,980 But still, if you have a normal user account somewhere and you want to become a, like, 70 00:06:02,020 --> 00:06:07,200 more privileged user there, it could be interesting what data is transmitted after the authentication. 71 00:06:07,720 --> 00:06:11,700 But of course, if you have something that is pre-authentication, it's even better. 72 00:06:12,680 --> 00:06:16,720 One very important thing is the configuration of your target. 73 00:06:16,900 --> 00:06:20,420 If possible, try to set up the service you're trying to hack yourself. 74 00:06:21,060 --> 00:06:22,420 Don't have someone come in. 75 00:06:22,540 --> 00:06:27,100 Like, don't call your local system administrator and say, come to me here and install this 76 00:06:27,100 --> 00:06:31,520 Oracle database on my computer so I can start looking for Litchfield type of vulnerabilities. 77 00:06:32,140 --> 00:06:32,660 No. 78 00:06:33,060 --> 00:06:34,020 Install it yourself. 79 00:06:34,280 --> 00:06:37,260 Because only that way you understand what they're thinking. 80 00:06:37,460 --> 00:06:41,620 You understand how this thing is built and how you're supposed to configure it. 81 00:06:41,700 --> 00:06:47,380 Maybe you actually find something really simple that everyone overlooks and you see 82 00:06:47,380 --> 00:06:51,880 because it is a configuration mistake and not something that you would find with a debugger 83 00:06:51,880 --> 00:06:52,900 or with static analysis. 84 00:06:53,580 --> 00:06:55,420 And look at the logging capabilities. 85 00:06:56,420 --> 00:07:00,440 Instead of reverse-engineering the whole thing, if you can set it to full debug mode 86 00:07:00,780 --> 00:07:07,580 and it will tell you, I'm TCP.C line 417 and just received a packet, and then it tells 87 00:07:07,580 --> 00:07:10,120 you TCP.C line 1007. 88 00:07:10,140 --> 00:07:11,680 I just parsed the packet. 89 00:07:11,680 --> 00:07:13,620 You know exactly what's going on. 90 00:07:13,700 --> 00:07:15,900 So there is absolutely no point in wasting time. 91 00:07:16,400 --> 00:07:17,980 Just check what it can do. 92 00:07:19,200 --> 00:07:20,180 Things to look for. 93 00:07:20,520 --> 00:07:22,200 Input validation on client-side. 94 00:07:22,300 --> 00:07:23,100 Really bad thing. 95 00:07:23,220 --> 00:07:24,120 Really widely used. 96 00:07:25,280 --> 00:07:27,020 Simple example with a web application. 97 00:07:27,400 --> 00:07:32,840 If you have a web application and you go there and you enter a bunch of As and it tells you 98 00:07:32,840 --> 00:07:37,140 you're not supposed to enter a bunch of As but never talk to the server, it is client-side 99 00:07:37,140 --> 00:07:37,380 authentication. 100 00:07:37,880 --> 00:07:41,060 This is why it is important to look at the cable at the same time. 101 00:07:41,060 --> 00:07:41,840 You do something. 102 00:07:42,380 --> 00:07:48,160 If it is client-side authentication, then you have, of course, the possibility of changing 103 00:07:48,160 --> 00:07:52,280 the client to something different, like a Perl script, and send a bunch of As over 104 00:07:52,280 --> 00:07:53,300 and see what happens. 105 00:07:53,460 --> 00:07:58,900 Because they may assume that since they are checking it on the client-side, it is already 106 00:07:58,900 --> 00:08:02,480 checked and already fine and nobody could possibly enter a bunch of As. 107 00:08:04,340 --> 00:08:09,140 Also, look of input that is modified before send. 108 00:08:09,580 --> 00:08:10,840 Again, web browsers. 109 00:08:10,840 --> 00:08:17,100 For example, modify special characters by doing HTTP encoding before they are sent over. 110 00:08:17,320 --> 00:08:20,820 Now, maybe you want to send over the special character. 111 00:08:21,920 --> 00:08:27,920 You have to, again, look at the cable, what's actually happening when you click on something. 112 00:08:29,260 --> 00:08:32,340 Then you have to look at pre-authentication data. 113 00:08:32,460 --> 00:08:38,960 Stuff that's sent to this target service before a username and password combination is validated. 114 00:08:39,380 --> 00:08:39,820 So. 115 00:08:40,840 --> 00:08:41,840 This could be your host name. 116 00:08:41,940 --> 00:08:42,860 This could be username. 117 00:08:43,220 --> 00:08:46,360 This could be certificate content, which is really interesting. 118 00:08:47,520 --> 00:08:56,120 I recommend if you are having a web browser and you often use some servers that use HTTPS, 119 00:08:56,320 --> 00:09:00,080 I recommend building a certificate with a really long distinguished name. 120 00:09:00,480 --> 00:09:04,860 But don't be surprised if you install that as a client-side certificate and you suffer 121 00:09:04,860 --> 00:09:08,520 on the internet and leave just burning, crashed web servers. 122 00:09:09,300 --> 00:09:09,900 So. 123 00:09:10,220 --> 00:09:10,820 So. 124 00:09:10,840 --> 00:09:14,280 Data and time strings also can be really interesting. 125 00:09:14,400 --> 00:09:22,200 If your day suddenly has a 10-digit number amount of hours, some servers react funny. 126 00:09:23,100 --> 00:09:24,180 And version information. 127 00:09:24,480 --> 00:09:29,960 Often clients send their own version to the server so the server can determine what type 128 00:09:29,960 --> 00:09:30,900 of client it is. 129 00:09:31,820 --> 00:09:33,180 Here's a good example with SAP. 130 00:09:33,480 --> 00:09:35,280 They do that for every packet. 131 00:09:35,480 --> 00:09:40,100 So you can, like, per packet decide what version of the browser you want to use. 132 00:09:40,100 --> 00:09:45,460 Which is really interesting because the parsers are not built to parse a packet from version 133 00:09:45,460 --> 00:09:48,360 4 and the next packet from version 1 in the same session. 134 00:09:50,100 --> 00:09:51,500 More things to look for. 135 00:09:51,660 --> 00:09:53,940 Again, the network protocol is really interesting. 136 00:09:55,160 --> 00:10:01,880 You have to determine what type of size field you have or if you even have size fields. 137 00:10:02,080 --> 00:10:08,500 If this protocol is just static sizes, the assumption could be made by the programmer 138 00:10:09,060 --> 00:10:09,340 that. 139 00:10:10,460 --> 00:10:16,540 It's only this type of information and this size of information coming in per packet. 140 00:10:16,700 --> 00:10:19,740 So if you send more, you might actually overflow a buffer. 141 00:10:20,280 --> 00:10:24,120 More interesting, far more interesting, are dynamic fields. 142 00:10:24,540 --> 00:10:25,720 Here's a good example. 143 00:10:25,860 --> 00:10:33,540 If you see something that has, like, a four byte number, most of them zero, and the last 144 00:10:33,540 --> 00:10:34,060 is eight. 145 00:10:34,180 --> 00:10:36,880 And then you see eight characters following it. 146 00:10:37,160 --> 00:10:39,880 This first part is probably the length field. 147 00:10:40,100 --> 00:10:42,080 So we have one length information here. 148 00:10:42,580 --> 00:10:44,320 Then you can start playing around. 149 00:10:44,420 --> 00:10:50,020 What happens if you change this length information, let's say, to something with the most significant 150 00:10:50,020 --> 00:10:50,860 bit being one. 151 00:10:51,160 --> 00:10:55,020 And suddenly, on the server side, it becomes a negative value. 152 00:10:56,300 --> 00:10:58,380 Interesting enough, often you see this. 153 00:10:58,500 --> 00:11:00,280 You have a terminating zero here. 154 00:11:00,480 --> 00:11:06,700 So this is then really interesting because there are two information points on length. 155 00:11:06,880 --> 00:11:10,080 So the code on the server side could use either. 156 00:11:10,080 --> 00:11:16,140 The length field or the terminating zero, which is often done, actually it's often implemented 157 00:11:16,140 --> 00:11:20,940 as the length field is used in the beginning of the pausing and then everyone else just 158 00:11:20,940 --> 00:11:22,540 assumes it's a zero terminated string. 159 00:11:22,680 --> 00:11:25,100 This can go wrong and this is what you want. 160 00:11:26,280 --> 00:11:32,820 Also timing, concurrent connections, lots of them, if they're having a table where they 161 00:11:32,820 --> 00:11:39,400 hold all the information and you put a lot of connections in there, this table might 162 00:11:39,400 --> 00:11:39,560 overflow. 163 00:11:40,040 --> 00:11:41,900 Or fast sequential connections. 164 00:11:42,440 --> 00:11:48,140 If you connect fast and disconnect and connect fast, you might get things out of sync. 165 00:11:49,640 --> 00:11:51,160 Advantages of manual testing. 166 00:11:51,460 --> 00:11:53,440 There is no need for additional tools. 167 00:11:53,540 --> 00:11:55,360 You don't need any lead hacking tools. 168 00:11:55,660 --> 00:12:01,080 All you need is your client and the browser and, well, your brain. 169 00:12:02,460 --> 00:12:04,360 You become familiar with the target. 170 00:12:04,460 --> 00:12:05,260 This is very important. 171 00:12:06,360 --> 00:12:09,380 Don't start hacking something that you don't know how it works. 172 00:12:09,400 --> 00:12:15,500 You have to understand what principles they set and what they were looking for to do and 173 00:12:15,500 --> 00:12:21,740 what they ignored and what they didn't do during the development cycle. 174 00:12:21,960 --> 00:12:24,340 You have to understand who you play against with. 175 00:12:24,460 --> 00:12:25,280 Those are humans. 176 00:12:25,460 --> 00:12:29,040 Those are humans who wrote this code and those are probably stupid humans. 177 00:12:29,300 --> 00:12:31,520 You just have to find out how stupid. 178 00:12:34,160 --> 00:12:35,200 Another advantage. 179 00:12:35,340 --> 00:12:39,000 It uncovers, as you have seen, client-side security really, really well. 180 00:12:39,400 --> 00:12:40,540 And this is really fast. 181 00:12:40,780 --> 00:12:45,060 If you find a client-side security, you can be pretty much sure that you can exploit the 182 00:12:45,060 --> 00:12:45,520 server somehow. 183 00:12:47,140 --> 00:12:47,660 Disadvantages. 184 00:12:47,860 --> 00:12:53,200 Of course, it has a potentially high learning effort, but what hasn't? 185 00:12:54,040 --> 00:12:57,640 It often just provides clues, like the protocol we just saw. 186 00:12:57,980 --> 00:13:01,860 You can't just change the protocol in the sniffer and re-inject the packet. 187 00:13:02,740 --> 00:13:07,700 You actually then have to go and write additional code to try it out. 188 00:13:08,020 --> 00:13:09,380 And there is a high dependency. 189 00:13:09,400 --> 00:13:11,180 There is a high dependence on the tester, which is you. 190 00:13:11,400 --> 00:13:15,800 There is a high dependence on how much you're actually thinking about it. 191 00:13:17,140 --> 00:13:23,360 What you usually find with that is the classic cross-site scripting crap, code and SQL injections 192 00:13:23,360 --> 00:13:29,240 in web applications, protocol-based overflows, as we just saw, and application logic failures. 193 00:13:29,580 --> 00:13:35,440 Application logic failures are not found by any other testing methods so far and can be 194 00:13:35,440 --> 00:13:38,720 really, really useful, especially if they're web applications. 195 00:13:38,820 --> 00:13:39,380 So, I'm going to give you a few examples. 196 00:13:39,400 --> 00:13:44,980 There are a few examples that have a logic that, for example, depends on transporting 197 00:13:44,980 --> 00:13:47,380 the price information over the browser. 198 00:13:47,560 --> 00:13:53,360 So if you understand this and you see this, you can change the price and get your favorite 199 00:13:53,360 --> 00:13:54,120 toys for free. 200 00:13:54,860 --> 00:14:01,060 So it is best suited for web applications, Java crap, proprietary clients, and, of course, 201 00:14:01,140 --> 00:14:04,320 Internet Explorer, as lately often seen on BuckTrick. 202 00:14:06,720 --> 00:14:09,380 Another way to test any target. 203 00:14:09,400 --> 00:14:10,480 Fuzzing. 204 00:14:10,520 --> 00:14:16,200 Fuzzing is basically the idea of creating a rough client that exceeds the posses of 205 00:14:16,200 --> 00:14:17,140 the normal client. 206 00:14:17,360 --> 00:14:24,080 So for example, again, if you're talking HTTP, you're creating a client that is able to support 207 00:14:24,440 --> 00:14:26,480 a 4,000 character long URI. 208 00:14:27,200 --> 00:14:31,080 And this is then used to send it over to the server. 209 00:14:31,920 --> 00:14:36,740 It is best suited for documented protocols because you have to re-implement the whole 210 00:14:36,740 --> 00:14:37,020 thing. 211 00:14:37,320 --> 00:14:39,380 So HTTP.com. 212 00:14:42,160 --> 00:14:47,820 Again, web applications can be really interesting and protocols with many field combinations. 213 00:14:48,320 --> 00:14:49,280 Let me show you why. 214 00:14:49,720 --> 00:14:52,020 There are two different ways of doing fuzzing. 215 00:14:52,160 --> 00:14:56,900 There is what I call see my manual fuzzing, where you actually go ahead and you write 216 00:14:56,900 --> 00:15:02,160 a short script or program that does the first two, three steps that the usual client will 217 00:15:02,160 --> 00:15:06,780 do and sends over data, which is potentially malformed. 218 00:15:07,780 --> 00:15:09,300 You're manually changing. 219 00:15:09,400 --> 00:15:17,160 Single information one at a time in this client and just send more in this field or 220 00:15:17,160 --> 00:15:21,540 more in that field or change the length while you're here or play with this while you're 221 00:15:21,540 --> 00:15:21,740 there. 222 00:15:22,400 --> 00:15:24,840 It is your imagination what you can do. 223 00:15:25,640 --> 00:15:26,700 You run the code. 224 00:15:26,820 --> 00:15:28,180 You evaluate what happens. 225 00:15:28,420 --> 00:15:29,560 You look at the response. 226 00:15:30,100 --> 00:15:34,660 You look at the timing because it could be interesting if you send 10 As and it takes 227 00:15:34,660 --> 00:15:37,880 a second and you send 100 As and it takes two seconds. 228 00:15:38,600 --> 00:15:42,400 Obviously, it is handling those As somehow. 229 00:15:42,820 --> 00:15:48,760 Maybe you want to use that later in the exploitation process to make sure that the process is busy 230 00:15:48,760 --> 00:15:49,240 for a while. 231 00:15:50,140 --> 00:15:52,920 The other approach is automated fuzzing. 232 00:15:53,080 --> 00:16:00,500 In automated fuzzing, you actually write a script or program mostly actually almost 233 00:16:00,500 --> 00:16:03,780 all the time using a fuzzier framework. 234 00:16:05,200 --> 00:16:07,860 Basically, what you do is you write a program. 235 00:16:07,860 --> 00:16:10,780 You write a program to generate random crap in large amounts. 236 00:16:11,700 --> 00:16:17,520 You're coming up with all types of random crap you want to send there and then put that 237 00:16:17,520 --> 00:16:22,760 in the program and let the program deal with increasing the amount of crap or combining 238 00:16:22,760 --> 00:16:25,540 the amount of crap and doing other stuff. 239 00:16:25,920 --> 00:16:30,340 All you want to do is let it run for a while and see if your target crashes. 240 00:16:32,900 --> 00:16:36,940 What you try to find out with the SEMA manual fuzzing, as I just said. 241 00:16:37,860 --> 00:16:39,720 You're looking for unexpected responses. 242 00:16:40,000 --> 00:16:46,520 If the web server for a file that's obviously not there responds for or for a file not found, 243 00:16:46,640 --> 00:16:48,120 this is an expected response. 244 00:16:48,420 --> 00:16:53,620 If it responds something like, you got blue hair, then you should investigate that further. 245 00:16:54,980 --> 00:16:56,740 You look for modified data. 246 00:16:58,160 --> 00:17:04,620 One example here is if you send data to a web server, let's say you send a bunch of 247 00:17:04,620 --> 00:17:06,000 As, just a few. 248 00:17:06,260 --> 00:17:07,780 You get an answer back. 249 00:17:07,860 --> 00:17:13,400 File not found, but it converted those As either to Unicode or to HTTP encoding and 250 00:17:13,820 --> 00:17:17,940 has therefore sent you something like percent for one, percent for one. 251 00:17:18,540 --> 00:17:21,320 This is interesting and you should really look into it. 252 00:17:21,440 --> 00:17:21,840 Why? 253 00:17:21,960 --> 00:17:27,540 Because he needed three bytes for this encoding and you sent one byte. 254 00:17:27,700 --> 00:17:29,500 So maybe there is a miscalculation. 255 00:17:29,580 --> 00:17:33,740 Maybe it didn't calculate correctly how much bytes it needed for the encoding. 256 00:17:34,860 --> 00:17:36,720 You look for change timing behavior. 257 00:17:36,720 --> 00:17:39,540 Does it take longer or is it really quick? 258 00:17:39,880 --> 00:17:43,560 If it disconnects really, really quick, it probably just crashed. 259 00:17:44,240 --> 00:17:48,660 And of course, you look for target crashes best on the system itself. 260 00:17:48,920 --> 00:17:54,700 So if you have the target, you should attach a debugger to it while you're doing the fuzzing 261 00:17:54,700 --> 00:17:58,700 and see if the debugger at some point in time pops up and says, wait a minute, this just 262 00:17:58,700 --> 00:18:00,440 wrote over way too much data. 263 00:18:02,340 --> 00:18:06,700 The procedure here, as I said, is you go ahead and try to get your data. 264 00:18:06,720 --> 00:18:08,140 Your script work in the first place. 265 00:18:08,260 --> 00:18:10,180 Please, I've seen that so often. 266 00:18:10,340 --> 00:18:16,220 People writing scripts for attacking something and like iterate through all possible ways 267 00:18:16,220 --> 00:18:17,380 to send crap there. 268 00:18:17,620 --> 00:18:21,120 And if you ask them, okay, can you modify the script so that it works? 269 00:18:21,340 --> 00:18:23,380 They're like, yeah, try this. 270 00:18:23,540 --> 00:18:24,560 And it doesn't work. 271 00:18:24,720 --> 00:18:27,040 So make sure it works in the first place. 272 00:18:27,120 --> 00:18:32,560 Make sure in the beginning it is valid input that you sent and then start throwing crap 273 00:18:32,560 --> 00:18:32,880 at it. 274 00:18:34,860 --> 00:18:36,040 Change the fields. 275 00:18:36,040 --> 00:18:37,200 One at a time. 276 00:18:37,240 --> 00:18:39,140 Don't change like everything at the same time. 277 00:18:39,260 --> 00:18:42,880 And then try to figure out which of the changes actually made the target crash. 278 00:18:43,920 --> 00:18:44,840 Send it over. 279 00:18:44,960 --> 00:18:46,180 Inspect what came back. 280 00:18:46,580 --> 00:18:50,340 Change the fields again based on what came back. 281 00:18:50,740 --> 00:18:52,460 You always learn something. 282 00:18:52,580 --> 00:18:55,440 Even if it just says no, you learned something. 283 00:18:55,520 --> 00:19:01,720 You learned that it handled it and that it didn't want to parse it further or actually 284 00:19:01,720 --> 00:19:04,020 parse it and said, no, this is not good. 285 00:19:04,980 --> 00:19:05,540 Yeah. 286 00:19:05,540 --> 00:19:08,440 And then repeat until you found a bug. 287 00:19:09,440 --> 00:19:13,940 Here's an example where a timing issue was found. 288 00:19:14,860 --> 00:19:20,840 There is a largely known company that writes security and secure software. 289 00:19:22,140 --> 00:19:26,180 And this has a timing issue with fanciness. 290 00:19:26,580 --> 00:19:33,440 Timing issue here is if you connect too often to PC anywhere, it will not really handle 291 00:19:33,440 --> 00:19:35,420 the loading and unloading of the DLL. 292 00:19:35,420 --> 00:19:40,340 That it needs to paint this fancy little icon in the right corner of your windows. 293 00:19:40,560 --> 00:19:46,400 And so instead of like changing the icon color from green to red to let the user know that 294 00:19:46,400 --> 00:19:52,780 someone connected, it changes its state from running to crashed and pops up a message box. 295 00:19:55,500 --> 00:19:58,140 The automatic parsing procedure is a bit different. 296 00:19:58,480 --> 00:20:03,380 Here you have to start thinking in the beginning and then just wait. 297 00:20:03,980 --> 00:20:05,400 You have to define what you want. 298 00:20:05,400 --> 00:20:06,880 What vulnerabilities you want to look for. 299 00:20:06,920 --> 00:20:07,780 What type of vulnerabilities. 300 00:20:08,120 --> 00:20:11,380 Do you just look for overflows or do you look for format strings as well? 301 00:20:11,520 --> 00:20:13,460 Do you look for integer related crap? 302 00:20:13,940 --> 00:20:18,680 You have to define that and then write the script or program depending on your father 303 00:20:18,680 --> 00:20:19,000 framework. 304 00:20:19,560 --> 00:20:25,800 And then basically you just start and let it run and let it generate all kinds of interesting 305 00:20:25,800 --> 00:20:28,840 messages and see if the target crashes. 306 00:20:29,220 --> 00:20:34,440 Again, you should attach a debugger to it, especially on windows because there is this 307 00:20:34,440 --> 00:20:34,940 thing. 308 00:20:35,400 --> 00:20:36,080 We'll come into this later. 309 00:20:36,220 --> 00:20:38,180 That's called structured exception handler. 310 00:20:38,600 --> 00:20:43,420 And so the programs are actually allowed to handle the situation where they fucked up 311 00:20:43,420 --> 00:20:43,780 themselves. 312 00:20:44,600 --> 00:20:49,500 So if they fucked up, they can say, it's almost like a lawyer. 313 00:20:49,700 --> 00:20:54,440 They can say, I registered this lawyer here and if I fucked up, please call this lawyer 314 00:20:54,440 --> 00:20:55,460 and he's dealing with that. 315 00:20:57,000 --> 00:21:02,460 This is the same procedure and if you don't attach a debugger, you don't see this because 316 00:21:02,460 --> 00:21:04,020 the lawyer is just dealing with it. 317 00:21:04,060 --> 00:21:05,240 And you know, behavior. 318 00:21:05,400 --> 00:21:06,640 You're behaving as if nothing happened. 319 00:21:07,000 --> 00:21:10,080 And you have issues with process forking as well. 320 00:21:11,220 --> 00:21:14,220 There are several fuzzing frameworks. 321 00:21:14,600 --> 00:21:17,100 The most well-known is Spike by Dave Fattel. 322 00:21:17,760 --> 00:21:20,340 It is currently 2.9. 323 00:21:20,440 --> 00:21:24,640 It's block-based fuzzer written in C. So your fuzzing programs have to be in C as 324 00:21:24,640 --> 00:21:28,200 well, which of course is kind of like error prone. 325 00:21:28,940 --> 00:21:33,760 It has some functions for sending data and some functions for doing iterations on strings 326 00:21:33,760 --> 00:21:35,260 and creating bigger blocks. 327 00:21:35,260 --> 00:21:37,580 And more amounts of blocks and stuff like that. 328 00:21:38,160 --> 00:21:40,160 Unfortunately, there's almost no documentation. 329 00:21:40,560 --> 00:21:43,960 So you better read the demo programs that come with it. 330 00:21:44,140 --> 00:21:47,780 And since it is written in C, you often have things like this. 331 00:21:48,140 --> 00:21:49,220 Don't make a mistake. 332 00:21:49,400 --> 00:21:53,700 This core dump here is actually the fuzzing program and not the target that got fuzzed. 333 00:21:55,640 --> 00:21:57,440 Also don't trust it too much. 334 00:21:57,580 --> 00:22:03,320 Here we have a case where it just fails to calculate the content length field for HTTP 335 00:22:03,320 --> 00:22:03,900 correctly. 336 00:22:04,080 --> 00:22:05,240 And so the web server doesn't know what to do with it. 337 00:22:05,260 --> 00:22:08,460 It doesn't even parse the request because, yeah, it figured out it's wrong. 338 00:22:09,960 --> 00:22:16,320 There is another framework that's not released yet but will probably be if you're lucky over 339 00:22:16,320 --> 00:22:17,520 the time of DEF CON. 340 00:22:17,740 --> 00:22:19,500 It's written by Michael Addington. 341 00:22:19,620 --> 00:22:27,520 It is a Python object-oriented class structure and consists of several elements including 342 00:22:28,360 --> 00:22:34,220 generators for static elements, transformers for all kinds of encoding and decoding and 343 00:22:34,220 --> 00:22:34,680 crypto. 344 00:22:35,260 --> 00:22:35,720 It's also a very useful tool. 345 00:22:35,720 --> 00:22:38,820 It's kind of handy if you're parsing something that's in an encrypted communication. 346 00:22:40,000 --> 00:22:46,940 It has protocols so it can actually handle state over multiple protocol messages, publishers 347 00:22:46,940 --> 00:22:52,140 for sending the stuff actually or putting it in files or whatever is required, and groups 348 00:22:52,140 --> 00:22:55,480 and scripts so you can even put more abstraction on it. 349 00:22:55,780 --> 00:23:01,200 And the good part here, besides being actually real good code, is it's actually documented 350 00:23:01,200 --> 00:23:01,660 as well. 351 00:23:03,480 --> 00:23:05,240 This is a full-text file. 352 00:23:05,240 --> 00:23:11,680 It's a full-blown HTTP get request fuzzer in Python using Peach, so you see you don't 353 00:23:11,680 --> 00:23:13,340 have to code lots of stuff. 354 00:23:13,540 --> 00:23:17,200 You just have to specify what you want to do and then send it over. 355 00:23:20,060 --> 00:23:27,520 Advantages of CMA manual parsing are, as I said, the try and then inspect procedure 356 00:23:27,520 --> 00:23:28,300 that you follow. 357 00:23:28,720 --> 00:23:33,860 The fact that you're actually looking at the responses and learn every time you send 358 00:23:33,860 --> 00:23:34,840 something to the server. 359 00:23:34,840 --> 00:23:38,040 It helps you to really fast find all kinds of vulnerabilities. 360 00:23:38,960 --> 00:23:43,760 And of course, the good thing is if your script sends a bunch of A's in this or that field 361 00:23:44,320 --> 00:23:48,980 and you get the target crashed, you can use this script and slap your shellcode and return 362 00:23:48,980 --> 00:23:52,840 address in there instead of the A's and see what you got in exploit. 363 00:23:54,900 --> 00:24:01,060 Automated fuzzing is really good if you have a good done fuzzing script or program. 364 00:24:01,320 --> 00:24:04,360 You can just throw it against all kinds of different servers. 365 00:24:04,360 --> 00:24:05,740 Then see what happens. 366 00:24:06,120 --> 00:24:13,340 So you quickly find stuff and due to the fact that it is a program, you can basically have 367 00:24:13,340 --> 00:24:14,940 all kinds of combinations done. 368 00:24:15,120 --> 00:24:20,720 So if there are many possible combinations in a protocol you're attacking, then you should 369 00:24:20,720 --> 00:24:21,540 use this. 370 00:24:22,620 --> 00:24:26,040 Disadvantages, of course, you need to understand the protocol in the first place. 371 00:24:26,080 --> 00:24:30,400 Otherwise you can fuzz it, but it's kind of like boring because the server will never 372 00:24:30,400 --> 00:24:30,860 pause it. 373 00:24:31,640 --> 00:24:33,860 The tester has to rely on the fuzzer. 374 00:24:33,940 --> 00:24:34,320 The testers have to rely on the fuzzer. 375 00:24:34,360 --> 00:24:38,920 So as you see with the spike example, make sure that the stuff actually makes sense. 376 00:24:41,860 --> 00:24:45,700 And you need a debugger on the target system, as I said. 377 00:24:48,140 --> 00:24:53,320 So I'm passing on to Harvey here because static analysis is actually where he grew up with, 378 00:24:53,420 --> 00:24:55,020 so he's more fit in it. 379 00:24:55,740 --> 00:24:56,560 Good afternoon. 380 00:24:56,960 --> 00:24:58,260 Well, yeah. 381 00:24:58,340 --> 00:25:02,980 We went over looking at stuff manually, like at the application behavior and we went over 382 00:25:03,520 --> 00:25:04,020 fuzzing. 383 00:25:05,040 --> 00:25:06,340 Both is not really my world. 384 00:25:06,440 --> 00:25:09,060 I usually like take a disassembler and read the code. 385 00:25:10,660 --> 00:25:14,120 So yeah, what I'll be talking about is... 386 00:25:15,140 --> 00:25:16,560 Well, I'll just skip this slide. 387 00:25:18,360 --> 00:25:21,820 Anyhow, the stuff you'll need for actually reading a binary is you need the binaries 388 00:25:21,820 --> 00:25:24,900 at the target, which is sometimes a hassle because people tend to charge money for these 389 00:25:24,900 --> 00:25:25,360 sort of things. 390 00:25:26,000 --> 00:25:29,760 Same thing, you need a decent disassembler and there's only one decent disassembler out 391 00:25:29,760 --> 00:25:31,620 there, so get yourself a copy of IDA. 392 00:25:32,340 --> 00:25:34,260 There's a free evaluation version of data. 393 00:25:34,260 --> 00:25:34,340 It's a free evaluation version of data. 394 00:25:34,360 --> 00:25:37,300 You can get it on Web Data Rescue's website and if that's not enough for you, you might 395 00:25:37,300 --> 00:25:39,360 have to show it a few bucks, but it's worth it, definitely. 396 00:25:41,620 --> 00:25:45,660 Well, yeah, you need to know what self-language the target is written in and so on. 397 00:25:45,820 --> 00:25:50,440 The two more important things which you need to know is fluent assembly and fluent C because, 398 00:25:50,440 --> 00:25:54,460 well, you're reading assembly code and that assembly code has been generated by a C compiler 399 00:25:54,460 --> 00:25:55,500 from valid C code. 400 00:25:55,740 --> 00:26:00,240 You're looking for bugs at the C level in the assembly language, so understanding how 401 00:26:00,240 --> 00:26:03,380 those two things interrelate is a basic prerequisite. 402 00:26:05,860 --> 00:26:08,040 So how do you go about finding bugs? 403 00:26:08,200 --> 00:26:12,000 First of all, we find reachable references to functions with vulnerability potentials, 404 00:26:12,000 --> 00:26:13,340 string copy, sprinter, and so on. 405 00:26:15,760 --> 00:26:16,640 All right. 406 00:26:17,440 --> 00:26:18,100 Never mind. 407 00:26:18,620 --> 00:26:19,240 All right. 408 00:26:19,240 --> 00:26:21,680 So you look for places where there might be bugs. 409 00:26:21,820 --> 00:26:26,340 We can start with stupid things like string copy and sprinter and so on, and the fact 410 00:26:26,340 --> 00:26:30,280 that you're still finding these sorts of bugs really shows you what the current level of 411 00:26:30,280 --> 00:26:33,100 quality in commercial closed source software is at. 412 00:26:35,420 --> 00:26:39,140 Then once you've found a function, like you basically draw up criteria for every function, 413 00:26:39,280 --> 00:26:40,180 string copy, sprinter. 414 00:26:40,480 --> 00:26:44,400 You might actually find functions in the binary which are not like standard C functions but 415 00:26:44,400 --> 00:26:46,900 which have certain criteria where they can like blow up on you. 416 00:26:47,420 --> 00:26:52,440 So you try to draw up criteria for every function where it's like what preconditions do they 417 00:26:52,440 --> 00:26:53,520 have to satisfy the arguments. 418 00:26:53,940 --> 00:26:59,360 And then you go through binary and first look at all the calls, look at whether the preconditions 419 00:26:59,360 --> 00:26:59,800 are satisfied. 420 00:27:00,300 --> 00:27:04,340 And if the preconditions are not satisfied, like meaning there might be a bug, then you 421 00:27:06,380 --> 00:27:10,520 basically check whether the user input, like whether the attacker can influence the arguments 422 00:27:10,520 --> 00:27:13,060 coming in there which will violate the preconditions. 423 00:27:15,000 --> 00:27:18,460 And yeah, then you basically just try to find out whether that stuff is reachable. 424 00:27:18,860 --> 00:27:23,080 Obviously, like since you're looking at the entire program at once, you'll very easily 425 00:27:23,080 --> 00:27:26,820 read a lot of code where application is starting up and reading a lot of config files. 426 00:27:27,160 --> 00:27:30,760 Now, being able to find an overflow in a config file is not all that useful because you might 427 00:27:30,760 --> 00:27:33,100 have to be administrative to read the config file in the first place. 428 00:27:33,100 --> 00:27:37,980 So you kind of want to limit the code constructs you're looking at to those parts which are 429 00:27:37,980 --> 00:27:39,860 actually usable from the main user input parser. 430 00:27:40,520 --> 00:27:44,740 So after you've found a function which violates the preconditions and you are sure you can 431 00:27:44,740 --> 00:27:49,840 influence those things, you should pause, like read upwards in the code to see whether 432 00:27:49,840 --> 00:27:54,120 the application is checking the input somewhere because it's usually quite annoying to spend 433 00:27:54,120 --> 00:27:58,020 a lot of time working your way down through the tree, like through the core graph, getting 434 00:27:58,020 --> 00:28:02,840 to a certain point and then finding out that the application was checking, well, certain values 435 00:28:03,100 --> 00:28:04,780 right at the beginning or whatever and you just missed it. 436 00:28:06,240 --> 00:28:06,800 All right. 437 00:28:08,280 --> 00:28:13,460 It is, I mentioned before that it is really important to make sure that the function you're 438 00:28:13,460 --> 00:28:18,580 trying to reach is reachable from the main user input parser because if not, well, you're, 439 00:28:19,100 --> 00:28:22,320 hey, I have an overflow in the parsing of the password file. 440 00:28:22,700 --> 00:28:25,120 It's very good, but if you can write to it, you don't need the overflow. 441 00:28:26,340 --> 00:28:32,480 So you kind of want to find codes which read user data first, which might be received, received from, 442 00:28:33,120 --> 00:28:39,620 WSA received, WSA received from, you might want to know about RPC when you're looking 443 00:28:39,620 --> 00:28:41,060 at RPC components and so on. 444 00:28:43,280 --> 00:28:48,600 Then you just follow the program flow until you start seeing code that actually does some 445 00:28:48,600 --> 00:28:50,260 parsing on these things, like comparing strings. 446 00:28:50,680 --> 00:28:56,720 If you have a mail server, look for the SMTP strings, elo, hello, whatever, and then use 447 00:28:56,720 --> 00:29:01,600 the location of that main user input parser in the core graph in order to identify whether 448 00:29:01,600 --> 00:29:03,080 the function, like the locations you found are correct. 449 00:29:03,100 --> 00:29:07,940 It's not actually reachable, meaning you're trying to find out whether there's any path 450 00:29:07,940 --> 00:29:11,480 in the program that can lead from the main user input handler to the function where you're 451 00:29:11,480 --> 00:29:14,460 trying to find the bug or where you have found the bug and you're trying to get to it. 452 00:29:15,340 --> 00:29:15,940 All right. 453 00:29:16,220 --> 00:29:20,840 So the more important things to remember when you're doing this, in order to find bugs, 454 00:29:21,080 --> 00:29:24,200 you have to know the language, like the C language better than the programmer. 455 00:29:24,340 --> 00:29:28,540 Your job is being a smart ass and a nitpicker and a language learner about C. 456 00:29:29,560 --> 00:29:31,940 So the ANSI C standard should be your Bible. 457 00:29:31,940 --> 00:29:33,260 It's the best 10 bucks you've ever spent. 458 00:29:34,420 --> 00:29:35,300 You should read it. 459 00:29:35,380 --> 00:29:36,200 You should read it. 460 00:29:36,300 --> 00:29:38,200 And, yeah, you should read it. 461 00:29:40,380 --> 00:29:44,900 And it is really important to know that, like, having small gaps in your knowledge 462 00:29:45,420 --> 00:29:52,160 will make you miss, like, have large gaps in your audit coverage, meaning if you don't 463 00:29:52,160 --> 00:29:54,240 know a whole lot of assembly, you'll miss a lot of things. 464 00:29:54,600 --> 00:29:57,040 If you don't know a whole lot of C, you'll miss a lot of things. 465 00:29:57,220 --> 00:30:00,480 So make sure you've got your basics straight, like you know assembly well and you know C 466 00:30:00,480 --> 00:30:00,740 well. 467 00:30:00,740 --> 00:30:06,440 And make a point on being very, very, very rigorous on understanding what the language 468 00:30:06,440 --> 00:30:07,460 semantics are and so on. 469 00:30:08,580 --> 00:30:13,660 What is quite useful in order to learn more about the bug process or about bugs in general 470 00:30:13,660 --> 00:30:15,800 is read lots of open source diffs. 471 00:30:15,940 --> 00:30:19,540 The nice part about open source is they tell you, oh, we found a bug here. 472 00:30:19,580 --> 00:30:20,280 We're fixing it. 473 00:30:20,540 --> 00:30:23,080 Now, you should read those diffs. 474 00:30:23,080 --> 00:30:24,240 It's kind of like crossword puzzles. 475 00:30:24,380 --> 00:30:27,540 You print them out in the morning, sit down, what the heck were they changing? 476 00:30:27,820 --> 00:30:29,000 Why are they changing it? 477 00:30:29,000 --> 00:30:30,100 What's the implication? 478 00:30:30,720 --> 00:30:33,640 And where might this have happened? 479 00:30:33,740 --> 00:30:36,380 Like, are there any other places where this might have happened? 480 00:30:36,620 --> 00:30:39,320 Because oftentimes a diff somewhere will give you order elsewhere. 481 00:30:39,620 --> 00:30:44,800 And usually, like, critical kernel bugs will be fixed in the development kernel first before 482 00:30:44,800 --> 00:30:45,420 they're back-proded. 483 00:30:45,620 --> 00:30:47,760 So that gives you, like, a few weeks advantage. 484 00:30:49,440 --> 00:30:49,920 Yeah. 485 00:30:51,580 --> 00:30:56,740 So another thing which you really should always be aware of are different compilers work 486 00:30:56,740 --> 00:30:57,160 differently. 487 00:30:57,160 --> 00:31:01,560 And there's an astonishing number of compilers that are just plain broken. 488 00:31:01,980 --> 00:31:03,660 Like, they have buggy libraries. 489 00:31:03,800 --> 00:31:05,180 They don't implement the C standing correctly. 490 00:31:05,680 --> 00:31:07,160 Ball and C is a fantastic example. 491 00:31:07,360 --> 00:31:10,920 If you malloc minus one, like, four gigabytes, it returns success and corrupts the heap at 492 00:31:10,920 --> 00:31:11,520 the same time. 493 00:31:11,740 --> 00:31:16,120 Because what happens is they take the size, like, the size of the request, and they add 494 00:31:16,120 --> 00:31:19,780 the size of the control structure which they have to use for managing the block. 495 00:31:20,000 --> 00:31:23,420 So if minus one, you add eight for the control structure, you get seven. 496 00:31:23,880 --> 00:31:25,020 You allocate seven bytes. 497 00:31:25,060 --> 00:31:27,140 And then you write an eight-byte control structure into the seven bytes. 498 00:31:27,140 --> 00:31:30,840 So just calling malloc minus one will fuck up the heap. 499 00:31:31,160 --> 00:31:35,520 And there's a lot of things like this where compilers just don't implement the standard 500 00:31:35,520 --> 00:31:37,000 correctly and are broken in themselves. 501 00:31:37,540 --> 00:31:40,520 And then there's a lot of code that will work on one compiler and be vulnerable on 502 00:31:40,520 --> 00:31:40,840 the other one. 503 00:31:42,240 --> 00:31:44,100 So those are definitely places to look. 504 00:31:44,760 --> 00:31:48,320 The interesting thing about the standard is in many places the standard itself is ambiguous 505 00:31:49,300 --> 00:31:53,360 where it doesn't really phrase explicitly what should happen on an F read with a size 506 00:31:53,360 --> 00:31:55,460 zero and so on, or F gets with a size zero. 507 00:31:55,780 --> 00:31:57,120 And then you just read through the standard. 508 00:31:57,140 --> 00:31:59,040 And you're like, okay, this is an ambiguous statement. 509 00:31:59,640 --> 00:32:01,660 Let's see how different compilers react to it. 510 00:32:01,900 --> 00:32:04,100 And then you just see your compiler's question left, right, and center. 511 00:32:04,820 --> 00:32:06,260 It's a bit of a lawyer's mindset. 512 00:32:06,440 --> 00:32:08,860 You have to become, like, a C language lawyer. 513 00:32:09,100 --> 00:32:12,700 You know, you read the standard and you see where there's ambiguities, where there's 514 00:32:12,700 --> 00:32:14,240 something not totally clear. 515 00:32:15,440 --> 00:32:15,960 All right. 516 00:32:16,300 --> 00:32:21,680 So you should get to the point where you can, like, solve trigger questions like these. 517 00:32:22,480 --> 00:32:26,540 If you look at the following code there, you're going to assign int a with a value of ten. 518 00:32:26,540 --> 00:32:29,160 And assign int c with a value of minus one. 519 00:32:29,560 --> 00:32:32,000 You're going to assign int b equals ten. 520 00:32:32,720 --> 00:32:38,100 And then you have the condition if a plus b is larger than c, which means ten plus ten 521 00:32:38,100 --> 00:32:39,300 is larger than minus one. 522 00:32:40,640 --> 00:32:43,160 And interestingly enough, that condition evaluates to false. 523 00:32:43,920 --> 00:32:51,460 Now, this is relatively easily explained in terms of, well, a and c are signed, but b 524 00:32:51,460 --> 00:32:52,000 is unsigned. 525 00:32:52,100 --> 00:32:55,380 So if there's an unsigned component of the composing, the composing will be unsigned. 526 00:32:55,380 --> 00:32:58,420 c will not be interpreted as minus one, but as four billion. 527 00:32:58,760 --> 00:33:00,460 Obviously, four billion is larger than twenty. 528 00:33:00,640 --> 00:33:01,300 Fair enough. 529 00:33:01,740 --> 00:33:05,820 Now, the interesting part comes at the bottom where you have essentially the same composing 530 00:33:05,820 --> 00:33:06,800 but with different types. 531 00:33:07,160 --> 00:33:12,200 Instead of having an int and an unsigned int, we have ints and an unsigned short. 532 00:33:12,520 --> 00:33:16,620 And all of a sudden, the exact same composing evaluates to true. 533 00:33:17,960 --> 00:33:24,400 Meaning, well, ten plus ten is all of a sudden larger than the... 534 00:33:25,060 --> 00:33:26,780 four billion in c. 535 00:33:27,140 --> 00:33:28,420 And where's that coming from? 536 00:33:30,560 --> 00:33:36,040 So, quoting from the ISOC standard, page 57, it's called integer propagation. 537 00:33:36,420 --> 00:33:40,220 If an integer can represent all values of the original type, the value is converted 538 00:33:40,220 --> 00:33:40,800 to an int. 539 00:33:41,040 --> 00:33:42,900 Otherwise, it is converted to an unsigned int. 540 00:33:43,140 --> 00:33:44,540 These are called integer promotions. 541 00:33:44,940 --> 00:33:49,920 So the trick basically is we have an addition in a condition down here. 542 00:33:50,760 --> 00:33:54,380 So the thing is a, b, and c have ints. 543 00:33:54,380 --> 00:33:54,900 They're not explicit types. 544 00:33:56,160 --> 00:33:58,020 They're either ints or unsigned ints. 545 00:33:58,020 --> 00:34:02,500 But the question truly is, if you see this addition, what type does the result of a plus b have? 546 00:34:03,060 --> 00:34:05,100 Because if any side in the composing... 547 00:34:05,100 --> 00:34:08,100 If anything in the condition is unsigned, the composing will be unsigned. 548 00:34:08,340 --> 00:34:10,260 If both sides are signed, it will be signed. 549 00:34:11,020 --> 00:34:12,680 So we have a plus b. 550 00:34:12,720 --> 00:34:14,740 We are adding an unsigned value and a signed value. 551 00:34:15,520 --> 00:34:17,460 And we don't really know what the type is. 552 00:34:17,540 --> 00:34:19,300 So the standard answer is this. 553 00:34:19,940 --> 00:34:24,100 If an int can represent all values of the original types, the value is converted to an int. 554 00:34:24,380 --> 00:34:26,040 Otherwise, it is converted to an unsigned int. 555 00:34:26,100 --> 00:34:27,180 These are called integer promotions. 556 00:34:28,180 --> 00:34:31,000 Unsigned int b in the lower example... 557 00:34:31,880 --> 00:34:32,420 Oh, wait. 558 00:34:32,600 --> 00:34:35,640 Unsigned int b here can represent the values from 0 to 4 billion. 559 00:34:36,100 --> 00:34:39,580 4 billion does not fit into a standard int, which can only hold 2 billion. 560 00:34:40,060 --> 00:34:43,540 Thus, a plus b, we have the type unsigned int, 561 00:34:44,100 --> 00:34:46,780 which means this side of the composing is unsigned. 562 00:34:46,800 --> 00:34:47,320 Oops, sorry. 563 00:34:50,860 --> 00:34:52,900 Which means this side of the composing is unsigned, 564 00:34:52,900 --> 00:34:54,060 and this side is signed. 565 00:34:54,360 --> 00:34:56,840 One of the two sides is unsigned, the composing is unsigned. 566 00:34:57,220 --> 00:34:58,100 Down here... 567 00:34:59,580 --> 00:35:00,140 Damn it. 568 00:35:02,780 --> 00:35:03,260 It's out. 569 00:35:03,860 --> 00:35:08,240 Down here, we have a plus b, but b is an unsigned short. 570 00:35:08,440 --> 00:35:10,860 The maximum value an unsigned short can have is 65k. 571 00:35:11,140 --> 00:35:15,100 And 65k fits comfortably into the 2 billion that an integer can hold. 572 00:35:15,460 --> 00:35:19,780 So the language rules dictate that b, a plus b, is going to be signed. 573 00:35:20,200 --> 00:35:21,860 Both sides of the composing are signed. 574 00:35:21,860 --> 00:35:22,940 Composing ends up signed. 575 00:35:23,160 --> 00:35:24,940 20 is larger than minus 1. 576 00:35:25,760 --> 00:35:26,760 And, uh, yeah. 577 00:35:26,900 --> 00:35:30,980 So, love your law, and love your CNI-Gresh standard. 578 00:35:32,400 --> 00:35:33,960 Anyhow, going back to static analysis. 579 00:35:34,300 --> 00:35:37,320 Um, the big advantages of this stuff is 580 00:35:37,800 --> 00:35:40,420 you'll find vulnerabilities in code that's not normally executed. 581 00:35:40,840 --> 00:35:45,660 If you're just fuzzing, you're basically covering the normal-trodden code paths, 582 00:35:45,920 --> 00:35:49,060 and all the testing will actually, like the testing on the vendor side, 583 00:35:49,320 --> 00:35:51,440 will travel the normal-trodden code paths. 584 00:35:51,880 --> 00:35:54,560 You're interested in those paths that are hardly ever reached. 585 00:35:54,680 --> 00:35:56,040 Because that's where bugs hide. 586 00:35:56,260 --> 00:35:58,840 It's kind of like, bugs tend to hide under stones, not in plain sight. 587 00:35:59,300 --> 00:36:01,100 It's the same with computer bugs. 588 00:36:01,240 --> 00:36:02,920 They hide in places where nobody's looking. 589 00:36:04,100 --> 00:36:08,300 So, um, yeah, there's a lot of things you can find very quickly, very easily. 590 00:36:08,740 --> 00:36:11,200 Uh, format string bugs are very easy to scan for. 591 00:36:11,680 --> 00:36:16,300 And you'll find really, really funny and really complex vulnerabilities, um, just by reading the code. 592 00:36:16,760 --> 00:36:18,820 The disadvantage is you need to have a lot of time. 593 00:36:19,380 --> 00:36:22,760 Um, you need to spend a few years of your life for it, like, on it. 594 00:36:23,600 --> 00:36:27,180 And, um, yeah, you need to have a kind of a thing for pain as well, 595 00:36:27,240 --> 00:36:28,960 because reading assembly will make your head hurt. 596 00:36:29,280 --> 00:36:30,120 And you gotta like that. 597 00:36:31,220 --> 00:36:33,760 So, um, there are a lot of disadvantages. 598 00:36:34,480 --> 00:36:36,400 It's kind of a lot of time just reconstructing shit. 599 00:36:37,320 --> 00:36:40,720 And, um, C++ code is notoriously annoying to read, 600 00:36:40,740 --> 00:36:42,220 because you have all those virtual method codes, 601 00:36:42,420 --> 00:36:45,600 which basically tell you that, like, you can't really tell in the static disassembly 602 00:36:45,600 --> 00:36:48,260 where a certain code is going unless you spend a lot of time checking it down. 603 00:36:49,040 --> 00:36:54,100 Um, and there are certain things that are really, really almost impossible to read decently. 604 00:36:54,180 --> 00:36:56,400 Visual Basic, um, if you compile it in a certain manner, 605 00:36:56,520 --> 00:36:58,220 it will not be compiled to native code at all, 606 00:36:58,260 --> 00:37:00,420 but to an intermediate level in a presentation, 607 00:37:00,600 --> 00:37:01,400 which will then be emulated, 608 00:37:01,660 --> 00:37:03,220 and you really don't want to read that. 609 00:37:04,760 --> 00:37:05,160 Alright. 610 00:37:05,420 --> 00:37:08,880 So, I mentioned before that diffing is a really important concept, 611 00:37:09,040 --> 00:37:10,800 and diffing for source code is relatively easy. 612 00:37:11,420 --> 00:37:14,500 Now, um, binary diffing is something that's a lot of fun as well, 613 00:37:15,040 --> 00:37:18,240 basically because, um, vendors have gotten into this habit 614 00:37:18,240 --> 00:37:19,880 of not telling us exactly where the bug is anymore, 615 00:37:20,240 --> 00:37:21,060 and that's quite annoying. 616 00:37:22,020 --> 00:37:26,020 So, um, the goal is to take an updated piece of software, 617 00:37:26,100 --> 00:37:27,120 like a Microsoft security update, 618 00:37:27,480 --> 00:37:29,260 and quickly identify where the bug is, 619 00:37:29,380 --> 00:37:31,760 because most people take a few days in order to install them, 620 00:37:31,880 --> 00:37:34,420 so if you can have an export the day after a patch was released, 621 00:37:34,940 --> 00:37:36,980 you have a few days before they install the patch, which is good. 622 00:37:38,400 --> 00:37:41,740 And, um, seriously, diffing takes a lot less time than auditing, 623 00:37:41,800 --> 00:37:44,040 because somebody else has done the job of auditing and finding the bug, 624 00:37:44,100 --> 00:37:45,420 you just have to look where they've changed things. 625 00:37:45,420 --> 00:37:49,140 So it's a bit of a more economic way of breaking into systems. 626 00:37:49,600 --> 00:37:51,680 If you just have the time of sitting in front of the system 627 00:37:51,680 --> 00:37:54,880 and to wait for a few weeks until a new patch comes out, 628 00:37:54,960 --> 00:37:56,220 a different patch you break into the system, 629 00:37:56,980 --> 00:37:59,500 you've just saved yourself a lot of work, 630 00:37:59,600 --> 00:38:00,720 and that's always good. 631 00:38:01,820 --> 00:38:04,580 Um, anyhow, the other thing is that you actually sometimes get 632 00:38:04,580 --> 00:38:07,260 all day out of those patches because vendors tend to fuck up those patches 633 00:38:07,260 --> 00:38:10,780 in ways that you wouldn't expect, like patch things incorrectly, 634 00:38:11,860 --> 00:38:14,660 um, disregard signings and the added range checks. 635 00:38:14,660 --> 00:38:18,060 Um, that's happened to some people sometime. 636 00:38:18,480 --> 00:38:21,400 And then there's other things, basically, because if you have a large company 637 00:38:21,400 --> 00:38:23,860 like Microsoft, and a bug is in a library, 638 00:38:24,460 --> 00:38:26,420 and somebody fuzzes an application, 639 00:38:26,620 --> 00:38:29,300 and the application crashes due to a bug in the library, 640 00:38:29,740 --> 00:38:32,680 they will report to the product group for the product that crashed. 641 00:38:33,040 --> 00:38:37,220 Now, the product group will try, like, implement a patch in the product 642 00:38:37,220 --> 00:38:39,960 to work around fixing, like, the bug in the library 643 00:38:39,960 --> 00:38:41,180 instead of actually fixing the library. 644 00:38:41,620 --> 00:38:43,840 Now, this is quite amusing for us, 645 00:38:43,840 --> 00:38:46,900 because we see the workaround, we see what's broken in the library, 646 00:38:47,120 --> 00:38:50,520 and then we grab our hard disk for, well, whatever other application 647 00:38:50,520 --> 00:38:52,440 might be using the library, and we get free order. 648 00:38:53,160 --> 00:38:55,060 Um, it happens to Microsoft, for example, 649 00:38:55,060 --> 00:38:57,580 when they did the ISAR Server Edge 323 patch, 650 00:38:57,680 --> 00:38:58,940 they gave everybody net-mitting remotes. 651 00:38:59,360 --> 00:38:59,920 That's nice. 652 00:39:02,280 --> 00:39:05,320 All right, so, um, first of all, you need to find out 653 00:39:05,320 --> 00:39:07,700 what file's actually been modified in the patch. 654 00:39:07,840 --> 00:39:11,220 You can do it either by, um, well, it kind of depends on what the patch is, 655 00:39:11,300 --> 00:39:13,740 but with Microsoft, we would usually just create a large directory, 656 00:39:13,740 --> 00:39:14,480 with a random name. 657 00:39:14,900 --> 00:39:17,760 You just abort, basically, the, the patching process, 658 00:39:17,820 --> 00:39:18,820 they would leave the directory there. 659 00:39:19,160 --> 00:39:21,260 You just create the process once they ask you for something, 660 00:39:21,420 --> 00:39:23,820 and then, uh, you have a directory with all the files they're updating. 661 00:39:24,320 --> 00:39:27,340 Um, if the application, or if it's something more complex, 662 00:39:27,380 --> 00:39:28,580 where they're actually modifying executables, 663 00:39:28,620 --> 00:39:29,980 you might want to use something like Firemon. 664 00:39:30,780 --> 00:39:33,780 And, um, yeah, then you have to disassemble the patch. 665 00:39:35,380 --> 00:39:38,400 Um, doing this by hand is a really time-consuming process, 666 00:39:38,560 --> 00:39:41,000 meaning you have to disassemble all the functions, 667 00:39:41,140 --> 00:39:43,260 see which ones are identical, and compare them. 668 00:39:44,220 --> 00:39:47,000 Um, that is really, really, really time-consuming. 669 00:39:47,480 --> 00:39:49,380 Uh, there's ways to do this automatically. 670 00:39:49,740 --> 00:39:54,180 Um, you, well, you need a bit of graph theory for it. 671 00:39:54,740 --> 00:39:56,900 And, um, I'm not going to explain too much of it. 672 00:39:56,980 --> 00:39:58,420 There's a paper at that address there, 673 00:39:59,060 --> 00:40:02,100 which, uh, basically explains how the algorithms underneath it work. 674 00:40:03,040 --> 00:40:04,600 And, um, that's quite nice. 675 00:40:04,720 --> 00:40:06,940 It's, like, after the Microsoft release of the S-channel, 676 00:40:07,440 --> 00:40:10,120 um, like, uh, overflow and PCT parsing patch, 677 00:40:10,380 --> 00:40:12,560 it takes about an hour, like, when you receive the patch, 678 00:40:12,620 --> 00:40:13,480 to figure out what the bug is. 679 00:40:13,740 --> 00:40:16,560 And, um, it takes about another six hours to override EIP, 680 00:40:16,760 --> 00:40:18,740 about 12 hours to have a fully working exploit. 681 00:40:19,680 --> 00:40:21,880 And, um, that is quite nice, 682 00:40:22,000 --> 00:40:24,100 especially considering the fact that there seems to be a law in Germany 683 00:40:24,100 --> 00:40:25,580 that prohibits financial institutions 684 00:40:25,580 --> 00:40:28,380 to install any patch without testing it for seven days first. 685 00:40:31,220 --> 00:40:31,660 Right. 686 00:40:35,400 --> 00:40:38,900 So, um, coming from the static analysis, 687 00:40:39,080 --> 00:40:41,800 you can actually do the same thing with runtime analysis as well. 688 00:40:42,120 --> 00:40:43,540 So the idea is here, 689 00:40:43,540 --> 00:40:46,540 instead of, like, using IDA as a disassembler 690 00:40:46,540 --> 00:40:48,560 and, um, looking at the static stuff, 691 00:40:48,800 --> 00:40:51,940 um, you're actually basically look the process, 692 00:40:52,160 --> 00:40:54,540 um, on its fingers while it's doing it, 693 00:40:54,660 --> 00:40:55,780 um, in runtime. 694 00:40:56,220 --> 00:40:59,440 You do pretty much the same thing as in static analysis, 695 00:40:59,840 --> 00:41:01,780 um, but the thing is, 696 00:41:01,880 --> 00:41:04,080 it's more a observation type of thing 697 00:41:04,080 --> 00:41:06,760 instead of completely reverse engineering stuff. 698 00:41:08,600 --> 00:41:11,040 So, um, it's again a manual process, 699 00:41:11,100 --> 00:41:13,180 and what you need is a functional version 700 00:41:13,180 --> 00:41:14,840 of what you're trying to break. 701 00:41:15,040 --> 00:41:17,180 So if it doesn't work on your computer, 702 00:41:17,420 --> 00:41:19,300 don't do runtime because, yeah, 703 00:41:19,400 --> 00:41:21,600 you have nothing to monitor or attach to. 704 00:41:21,960 --> 00:41:23,900 Um, of course you need a debugger. 705 00:41:24,120 --> 00:41:27,100 Um, you need, again, fluent disassembly, 706 00:41:27,120 --> 00:41:29,680 and you need, again, at least a clue 707 00:41:29,680 --> 00:41:32,940 of what the library functions on your platform do, 708 00:41:33,060 --> 00:41:34,340 so give yourself a reference. 709 00:41:36,100 --> 00:41:37,760 Um, for the debugger thing, 710 00:41:38,000 --> 00:41:41,800 um, you can do a lot of funny stuff with runtime debugging, 711 00:41:41,800 --> 00:41:44,020 and I figured that on Windows, 712 00:41:44,140 --> 00:41:46,080 there is actually no open source debugger, 713 00:41:46,140 --> 00:41:49,600 um, and I wanted to waste a bit of time of my life 714 00:41:49,600 --> 00:41:51,580 and change that, and so here it is. 715 00:41:51,980 --> 00:41:53,680 Um, this is Dumbbug. 716 00:41:53,880 --> 00:41:56,640 It is, um, a C++ architecture, 717 00:41:57,500 --> 00:42:00,060 so you have actually a, um, debugger 718 00:42:00,060 --> 00:42:02,840 including pausing from, um, PE files, 719 00:42:02,900 --> 00:42:04,980 which is the annoying DLL on EXO files, 720 00:42:05,780 --> 00:42:06,800 disassembly, threat handling, 721 00:42:06,920 --> 00:42:08,880 and all the crap that you don't want to care about, 722 00:42:09,020 --> 00:42:11,780 and you can basically instantly create debuggers 723 00:42:11,800 --> 00:42:12,760 in a few lines of code. 724 00:42:12,960 --> 00:42:14,140 This is how it looks like. 725 00:42:14,220 --> 00:42:15,960 This is a full-blown Windows debugger in C. 726 00:42:16,860 --> 00:42:19,280 Um, you basically need to tell your compiler 727 00:42:19,280 --> 00:42:20,780 that there is a debugger. 728 00:42:20,800 --> 00:42:23,160 You need to create a debugger variable, 729 00:42:23,640 --> 00:42:26,700 and, um, you basically load the program and let it run. 730 00:42:27,120 --> 00:42:29,600 Um, this will already deal with everything 731 00:42:29,600 --> 00:42:32,180 that can possibly happen to a piece of software on Windows, 732 00:42:32,640 --> 00:42:36,300 and from here on, you can either register callback, 733 00:42:36,440 --> 00:42:39,560 um, functions or overload, um, the class. 734 00:42:39,800 --> 00:42:41,160 The class actually provides 735 00:42:41,800 --> 00:42:44,220 a bunch of functions for all interesting things, 736 00:42:44,360 --> 00:42:47,220 like exceptions happening or setting breakpoints and stuff, 737 00:42:47,340 --> 00:42:50,840 and you can overload those and build your own debuggers, 738 00:42:50,880 --> 00:42:52,100 um, however you like it. 739 00:42:53,900 --> 00:42:56,740 So in runtime analysis, you can do one of two things. 740 00:42:56,940 --> 00:42:59,440 The first thing is data follow, um, procedure. 741 00:42:59,700 --> 00:43:01,880 So basically, when stuff is received, 742 00:43:02,080 --> 00:43:03,800 um, you break at the receive call, 743 00:43:03,880 --> 00:43:05,060 you look where the stuff ends up, 744 00:43:05,140 --> 00:43:06,880 and you set a memory breakpoint, 745 00:43:07,040 --> 00:43:10,640 and then you let it run for however long you want it. 746 00:43:10,640 --> 00:43:13,140 Um, because it will stop 747 00:43:13,140 --> 00:43:14,980 as soon as someone looks at the data, 748 00:43:15,080 --> 00:43:17,820 um, this someone is probably the protocol parser, 749 00:43:17,880 --> 00:43:20,380 and therefore this is the point where you're interested in. 750 00:43:20,540 --> 00:43:22,340 Um, again, unfortunately, 751 00:43:22,460 --> 00:43:24,500 um, you have to spend a bit more time 752 00:43:24,500 --> 00:43:26,900 than once you identify this place 753 00:43:26,900 --> 00:43:28,780 and do reverse engineering 754 00:43:28,780 --> 00:43:30,860 and find actually out what it's doing. 755 00:43:32,080 --> 00:43:35,680 The other thing, um, is basically the same thing, 756 00:43:35,800 --> 00:43:38,000 um, that you do in static analysis. 757 00:43:38,280 --> 00:43:40,040 You follow code, um, 758 00:43:40,640 --> 00:43:41,460 while it's executed. 759 00:43:41,760 --> 00:43:45,120 The good thing here is you can actually step over stuff, 760 00:43:45,340 --> 00:43:47,580 um, if it looks like it's not interesting, 761 00:43:47,800 --> 00:43:49,740 and if it was interesting, well, do it again. 762 00:43:50,940 --> 00:43:53,500 Um, you, again, check arguments, 763 00:43:53,540 --> 00:43:57,740 and, um, that are passed to functions 764 00:43:57,740 --> 00:43:58,640 when they're called, 765 00:43:58,740 --> 00:44:01,860 and you check arguments if they're user data or not. 766 00:44:02,140 --> 00:44:04,740 But actually, you want to do this 767 00:44:04,740 --> 00:44:07,560 for stuff like sprintf or string copy, 768 00:44:07,760 --> 00:44:09,680 and the problem is if the programmer 769 00:44:09,680 --> 00:44:11,200 was a real brilliant one, 770 00:44:11,360 --> 00:44:14,640 then he has about, like, 1,000, 2,000 cards 771 00:44:14,640 --> 00:44:15,900 of sprintf in his program. 772 00:44:16,180 --> 00:44:18,120 You don't want to stop every time 773 00:44:18,440 --> 00:44:21,640 he calls sprintf to print his maiden name or whatever. 774 00:44:21,940 --> 00:44:25,300 Um, so you want to actually just see 775 00:44:25,300 --> 00:44:28,300 a few cases where it actually handles user data, 776 00:44:28,420 --> 00:44:30,280 so it's one in 100 cards or something, 777 00:44:30,460 --> 00:44:33,580 which is kind of boring, so, um, it's impractical. 778 00:44:35,300 --> 00:44:38,920 Advantages here is that in contrast to static analysis, 779 00:44:38,920 --> 00:44:41,660 the disassembly you see when the stuff runs is correct, 780 00:44:41,800 --> 00:44:42,840 because if it's not correct, 781 00:44:43,020 --> 00:44:45,320 it would be passed to the CPU as incorrect 782 00:44:45,320 --> 00:44:46,720 and therefore just crash. 783 00:44:47,000 --> 00:44:50,500 So, um, you have a, basically a guarantee 784 00:44:50,500 --> 00:44:51,740 that what you're looking at 785 00:44:51,740 --> 00:44:53,680 is actually what the CPU is executing. 786 00:44:54,180 --> 00:44:55,920 Um, you have a known state, 787 00:44:56,180 --> 00:44:59,620 so you actually know everything that the computer knows, 788 00:44:59,800 --> 00:45:02,440 and you see, again, advanced vulnerabilities 789 00:45:02,440 --> 00:45:05,460 that are really interesting, funny combinations 790 00:45:05,460 --> 00:45:07,920 of, like, things that people could fuck up. 791 00:45:07,920 --> 00:45:11,060 And so it's slightly faster than static analysis, 792 00:45:11,280 --> 00:45:13,040 because you can skip over stuff 793 00:45:13,040 --> 00:45:14,320 and you don't have to find out 794 00:45:14,320 --> 00:45:16,860 where indirect calls lead to and stuff. 795 00:45:17,360 --> 00:45:22,240 Um, again, it is time, skill, and experience required, 796 00:45:22,560 --> 00:45:25,620 so you can't just, like, go home and do it. 797 00:45:25,860 --> 00:45:28,400 And you often have timeout issues, 798 00:45:28,560 --> 00:45:31,280 so if you're, like, inspecting a protocol's parser, 799 00:45:31,380 --> 00:45:35,560 um, it could easily be that at some point in time 800 00:45:35,560 --> 00:45:37,840 it remembered the time that the packet came in, 801 00:45:37,920 --> 00:45:39,940 and then does a different code path, 802 00:45:40,140 --> 00:45:44,980 um, because just it spent about ten seconds on this thing 803 00:45:44,980 --> 00:45:46,360 because you were stepping through it 804 00:45:46,360 --> 00:45:47,680 instead of just running through it. 805 00:45:48,380 --> 00:45:50,060 So you have to watch out, um, 806 00:45:50,140 --> 00:45:51,740 if the code path you are seeing 807 00:45:51,740 --> 00:45:53,540 is actually the one that's usually executed. 808 00:45:55,180 --> 00:45:57,740 Um, usual findings for static and runtime, 809 00:45:58,080 --> 00:45:59,820 um, all kinds of overflows 810 00:45:59,820 --> 00:46:03,700 in pretty much every possible location in the code. 811 00:46:03,940 --> 00:46:06,500 Format string vulnerabilities are totally easy found. 812 00:46:06,500 --> 00:46:09,820 And integer vulnerabilities are usually not found 813 00:46:09,820 --> 00:46:13,300 in, um, testing methods like fuzzing or manual testing. 814 00:46:13,740 --> 00:46:16,400 So it's good for all kinds of stuff, 815 00:46:16,520 --> 00:46:17,960 especially protocol parsers. 816 00:46:18,160 --> 00:46:22,760 Um, logging is something that many, many servers break on, 817 00:46:22,880 --> 00:46:24,980 so every time they want to lock something, 818 00:46:25,180 --> 00:46:27,520 um, they have to copy it in a text buffer, 819 00:46:27,740 --> 00:46:29,380 and this is where they often fuck up. 820 00:46:29,820 --> 00:46:33,220 Um, and you find code using unsafe functions 821 00:46:33,220 --> 00:46:35,760 like sprintf or string copy and whatnot. 822 00:46:36,960 --> 00:46:40,880 Now, um, I mentioned that you want to see 823 00:46:40,880 --> 00:46:43,320 only the sprintf calls and stuff 824 00:46:43,320 --> 00:46:45,520 that, um, are relevant to you 825 00:46:45,520 --> 00:46:48,260 and they're, um, with user data. 826 00:46:48,500 --> 00:46:50,760 So I actually wanted to prove the point 827 00:46:50,760 --> 00:46:53,420 and, um, write a demo for the debugger core. 828 00:46:53,780 --> 00:46:57,400 And so there is a L trace implementation for Windows now. 829 00:46:57,620 --> 00:47:02,840 Um, it basically locks calls to functions before and after. 830 00:47:02,980 --> 00:47:06,080 So you see, um, what arguments are passed to the functions 831 00:47:06,080 --> 00:47:08,640 and, um, what comes out of it, what happens there. 832 00:47:08,940 --> 00:47:11,760 Um, supports several different call conventions 833 00:47:11,760 --> 00:47:14,220 because if you're trying to hack something 834 00:47:14,220 --> 00:47:16,840 that's written in Delphi and compiled in Delphi, 835 00:47:16,960 --> 00:47:17,400 yeah. 836 00:47:22,140 --> 00:47:24,200 Um, not natively yet 837 00:47:24,200 --> 00:47:27,220 because I didn't want to use any Microsoft, um, code. 838 00:47:27,420 --> 00:47:30,400 Like, um, for PDBs, it would require you, um, 839 00:47:30,480 --> 00:47:33,660 to use debug help DLL, which comes with a DDK, 840 00:47:33,820 --> 00:47:36,000 which means that I'm supposed to spend 841 00:47:36,080 --> 00:47:37,920 money on, um, crappy Microsoft code 842 00:47:37,920 --> 00:47:39,180 so I can redistribute it. 843 00:47:39,240 --> 00:47:40,580 And I didn't feel like this. 844 00:47:40,780 --> 00:47:43,780 So it does support debug, um, information, 845 00:47:44,080 --> 00:47:46,100 code view, FPO and stuff like that. 846 00:47:46,180 --> 00:47:47,680 Um, not yet PDB. 847 00:47:48,080 --> 00:47:48,880 But it's coming. 848 00:47:50,080 --> 00:47:51,980 Another good thing is, um, it's, 849 00:47:52,040 --> 00:47:53,840 as far as I know, the only debugger on Windows 850 00:47:53,840 --> 00:47:55,180 that is able to follow fork. 851 00:47:55,400 --> 00:47:58,640 So if your process is actually spawning a child, 852 00:47:58,760 --> 00:48:01,160 um, this one will just create another debugger 853 00:48:01,160 --> 00:48:02,740 and follow this child at the same time. 854 00:48:02,900 --> 00:48:05,260 So when you're fuzzing something, um, 855 00:48:05,260 --> 00:48:07,360 you don't miss it because it is in a fork child. 856 00:48:07,880 --> 00:48:11,000 It does a bit of stack analysis when the call is made 857 00:48:11,000 --> 00:48:13,420 and it does, of course, format string analysis. 858 00:48:14,340 --> 00:48:16,980 Um, it works by having trace definitions. 859 00:48:17,540 --> 00:48:20,900 So you basically take your, um, arbitrary MSDN, 860 00:48:20,960 --> 00:48:25,760 um, information and copy and paste the C prototype, 861 00:48:26,080 --> 00:48:28,580 um, into the trace definition file. 862 00:48:28,900 --> 00:48:31,260 Um, here you see you have a function name. 863 00:48:31,360 --> 00:48:33,760 Then you have the different arguments to the function. 864 00:48:33,760 --> 00:48:37,520 You can actually specify if this argument is something 865 00:48:37,520 --> 00:48:39,380 that is coming into the function. 866 00:48:39,480 --> 00:48:42,420 It is a input value, like the socket in receive. 867 00:48:42,740 --> 00:48:46,420 Or if it's a output thing, like in a S printf, 868 00:48:46,460 --> 00:48:48,580 you want to see the output buffer. 869 00:48:48,840 --> 00:48:50,340 You want to see what came out of it. 870 00:48:50,600 --> 00:48:53,840 Reason for this is, you can actually do matching on strings. 871 00:48:54,080 --> 00:48:58,380 So you can actually say, um, hex or equals in S printf. 872 00:48:58,520 --> 00:49:02,120 And then it will only lock calls that actually produce 873 00:49:02,120 --> 00:49:04,940 a output that contained the word hexer. 874 00:49:05,460 --> 00:49:07,860 Which is pretty handy because you can just attach it 875 00:49:07,860 --> 00:49:10,080 to a process and let it run for a while 876 00:49:10,080 --> 00:49:12,780 and then send all kinds of crap to it. 877 00:49:12,900 --> 00:49:15,600 And this crap should contain the word hexer. 878 00:49:15,740 --> 00:49:19,040 And you only see calls to S printf that actually deal 879 00:49:19,040 --> 00:49:20,280 with stuff you send it to. 880 00:49:21,840 --> 00:49:23,320 Um, this is the output. 881 00:49:23,520 --> 00:49:24,600 Here's the good thing about it. 882 00:49:24,640 --> 00:49:26,360 You don't need to read disassembly for it. 883 00:49:26,640 --> 00:49:29,520 Um, because it translates the calls to C again 884 00:49:30,120 --> 00:49:31,920 or to something that looks familiar. 885 00:49:32,120 --> 00:49:35,480 Um, you see you have different types. 886 00:49:35,640 --> 00:49:38,520 You also have the type fntshar, which basically says 887 00:49:38,520 --> 00:49:41,380 this is a format string and should better contain 888 00:49:41,380 --> 00:49:44,360 format specifiers, otherwise it's probably broken. 889 00:49:44,820 --> 00:49:47,960 Um, and you see the return values here. 890 00:49:48,100 --> 00:49:50,640 Um, the addresses of the buffers, stuff like that. 891 00:49:51,940 --> 00:49:53,080 Here's another example. 892 00:49:53,260 --> 00:49:56,760 This is actually from a server that, um, I found a vulnerability 893 00:49:56,760 --> 00:49:59,720 and wrote an exploit for, um, using the tracer. 894 00:49:59,900 --> 00:50:02,100 Um, which is a good point. 895 00:50:02,120 --> 00:50:02,560 Congratulations. 896 00:50:02,660 --> 00:50:06,220 It turns out it is a, um, server for an online game, 897 00:50:06,360 --> 00:50:09,020 and, um, someone, like, really screwed me up in the online game 898 00:50:09,020 --> 00:50:10,100 and I wanted to pay back. 899 00:50:10,400 --> 00:50:16,080 So, um, this is a custom function in the code here. 900 00:50:16,320 --> 00:50:20,300 Um, you have a parameter that nobody cares about. 901 00:50:20,460 --> 00:50:23,840 Then there is a format string and a message structure, 902 00:50:24,160 --> 00:50:26,760 um, where the logging message is written to. 903 00:50:26,960 --> 00:50:31,800 Um, what happens here is you see this node that's generated 904 00:50:31,800 --> 00:50:35,060 by the tracer saying that there is no format specifier 905 00:50:35,060 --> 00:50:37,040 in the fmt-shar type thing. 906 00:50:37,260 --> 00:50:42,060 And it turns out that this blah thingy here, um, actually is a message 907 00:50:42,060 --> 00:50:43,760 that is, um, coming from the user. 908 00:50:43,940 --> 00:50:47,380 So here you have your run-of-the-mill format string bug. 909 00:50:48,680 --> 00:50:52,200 Advantages from call tracing, um, it's extremely fast. 910 00:50:53,240 --> 00:50:57,320 You just have to, like, attach the tracer, um, on a process, 911 00:50:57,520 --> 00:51:01,420 click around, use the process for a while, um, terminate the thing, 912 00:51:01,420 --> 00:51:05,880 look at the output, um, and basically you can use your text editor 913 00:51:05,880 --> 00:51:09,640 and, um, search for the word vulnerability in the tracer output. 914 00:51:09,840 --> 00:51:12,000 You might actually find something right away. 915 00:51:12,220 --> 00:51:16,620 Um, you can recognize user supply data, so you don't have to find out 916 00:51:16,620 --> 00:51:20,960 if this data actually reached any point or if this is user data or not, 917 00:51:21,080 --> 00:51:22,940 because you know what you sent to it. 918 00:51:23,020 --> 00:51:25,980 If you are tracing a web server and there is an sprintf 919 00:51:25,980 --> 00:51:30,320 that contains the word Mozilla, it's probably something you sent over. 920 00:51:31,420 --> 00:51:35,520 And, as you have seen, it does automatic format string vulnerability detection, 921 00:51:35,840 --> 00:51:37,740 which is lame, but we can do that. 922 00:51:38,680 --> 00:51:44,700 Um, disadvantages, again, it's incomplete, so, um, the cool stuff is found by static analysis. 923 00:51:44,840 --> 00:51:50,220 You see here only the most trodden code paths, and it covers only function calls, 924 00:51:50,380 --> 00:51:54,460 so if someone actually does, um, a pointer arithmetic copy or something, 925 00:51:54,700 --> 00:51:56,680 um, you don't see that. 926 00:51:58,780 --> 00:52:00,400 So, um, of course, 927 00:52:01,420 --> 00:52:05,860 they're free and, um, yeah, it is recommended to combine those techniques, 928 00:52:06,060 --> 00:52:09,100 so don't, like, aim for one and make only this. 929 00:52:09,500 --> 00:52:15,840 So one combination that I'm right now fancying is, um, fuzzing using Peach 930 00:52:15,840 --> 00:52:21,920 and some pretty good script to it, and then attach the ltrace, um, to the target, 931 00:52:22,040 --> 00:52:27,100 so in case it forks or in case it throws an exception, this is covered. 932 00:52:27,420 --> 00:52:31,400 Um, also see my manual fuzzing in static analysis. 933 00:52:32,060 --> 00:52:34,100 Um, can help a lot. 934 00:52:34,280 --> 00:52:38,620 So if you're doing see my manual fuzzing and you have something that looks suspicious, 935 00:52:39,020 --> 00:52:44,180 then you go load the binary up, um, and read the code that's actually doing, 936 00:52:44,300 --> 00:52:46,840 handling the stuff that you're wondering about. 937 00:52:48,480 --> 00:52:52,320 So, um, a few slides on writing exploits. 938 00:52:52,400 --> 00:52:55,680 First of all, please don't write exploits in C. 939 00:52:56,080 --> 00:52:56,980 I do so. 940 00:52:57,780 --> 00:52:58,940 You do so, yeah. 941 00:52:59,760 --> 00:53:00,800 Please don't. 942 00:53:04,280 --> 00:53:07,780 It's really, it's error-prone to the end. 943 00:53:07,900 --> 00:53:10,320 I mean, we're exploiting C programs all the time. 944 00:53:10,440 --> 00:53:12,840 Why do we write exploitable exploits? 945 00:53:13,440 --> 00:53:14,760 It is not portable. 946 00:53:15,300 --> 00:53:16,400 Um, I see, hm? 947 00:53:18,220 --> 00:53:21,280 Uh, just to make a case for writing exploits in C is, 948 00:53:21,480 --> 00:53:25,840 if you're attacking a system and you want to use an exploit from that system on, 949 00:53:27,200 --> 00:53:30,500 um, you might, well, of course you can always forward traffic and crap, 950 00:53:30,500 --> 00:53:33,580 but you might just not want to have to install Python on the other system or... 951 00:53:36,400 --> 00:53:38,100 So we see there are different opinions. 952 00:53:40,540 --> 00:53:41,420 But don't. 953 00:53:43,800 --> 00:53:45,260 The thing is, it's not portable. 954 00:53:45,500 --> 00:53:51,560 How often do I see, um, people writing exploits in C that are not even portable 955 00:53:51,560 --> 00:53:53,400 between a Linux and a BSD system? 956 00:53:53,820 --> 00:53:57,680 So if I need, like, five hours to get the exploit working in the first place, 957 00:53:57,720 --> 00:53:58,620 it doesn't get me anywhere. 958 00:53:58,620 --> 00:53:59,780 And it's ugly. 959 00:54:00,160 --> 00:54:02,640 So go ahead, use Perl, use Python. 960 00:54:02,760 --> 00:54:04,380 If you're really sick, use Java. 961 00:54:04,560 --> 00:54:05,960 Use something that's portable. 962 00:54:08,280 --> 00:54:09,500 Exploit creation process. 963 00:54:09,920 --> 00:54:12,560 You start by, basically, finding a vulnerability. 964 00:54:12,900 --> 00:54:13,600 This we covered. 965 00:54:13,880 --> 00:54:16,100 Then you find out how to trigger this vulnerability. 966 00:54:16,700 --> 00:54:18,620 Then you try to get code execution. 967 00:54:19,160 --> 00:54:22,880 Um, yeah, you're actually aiming at getting your code to execute. 968 00:54:23,440 --> 00:54:26,580 Then you try to get, somehow, shellcode over there. 969 00:54:26,700 --> 00:54:28,480 And then you execute the shellcode. 970 00:54:28,620 --> 00:54:31,380 Which, basically, um, gives you the root shell. 971 00:54:32,820 --> 00:54:33,800 To trigger it. 972 00:54:34,020 --> 00:54:37,520 Make sure that, um, when you know how to trigger the vulnerability, 973 00:54:38,060 --> 00:54:40,100 this works on more than one computer. 974 00:54:40,820 --> 00:54:42,160 This would be really good. 975 00:54:42,240 --> 00:54:44,140 Because if it's only working on your computer, 976 00:54:44,220 --> 00:54:45,700 you can only exploit your computer. 977 00:54:46,520 --> 00:54:48,860 So try it, please, on more than one computer. 978 00:54:49,040 --> 00:54:50,220 VMware comes to mind. 979 00:54:50,280 --> 00:54:55,060 You can actually have more than one virtual computer on your computer and try it. 980 00:54:55,660 --> 00:54:58,140 And observe the environment requirements. 981 00:54:58,680 --> 00:55:00,140 Um, here's an example. 982 00:55:00,800 --> 00:55:03,840 Which is not too easy, uh, to solve, actually. 983 00:55:03,960 --> 00:55:04,740 It looks easy. 984 00:55:04,860 --> 00:55:08,380 Because, um, you do a get request and a lot of A's. 985 00:55:08,640 --> 00:55:10,360 Um, and send it to the web server. 986 00:55:10,520 --> 00:55:11,140 And it crashes. 987 00:55:11,600 --> 00:55:12,420 This is fine. 988 00:55:12,520 --> 00:55:13,300 This is what we want. 989 00:55:13,480 --> 00:55:16,500 The problem is that if you look at the vulnerability, 990 00:55:17,060 --> 00:55:23,460 it is actually, um, putting the original path, the real path, and the request together. 991 00:55:24,160 --> 00:55:26,920 Um, and hereby overflowing a buffer. 992 00:55:27,180 --> 00:55:28,220 Now, the thing is. 993 00:55:28,220 --> 00:55:29,920 You don't know the real path. 994 00:55:30,220 --> 00:55:33,200 So either you find a way to disclose the path, 995 00:55:33,400 --> 00:55:36,300 or you find an intelligent way to exploit it. 996 00:55:36,420 --> 00:55:38,220 But this is an environment requirement. 997 00:55:38,640 --> 00:55:42,980 You don't necessarily know what the path is the server is installed on. 998 00:55:44,440 --> 00:55:45,400 Code execution. 999 00:55:46,080 --> 00:55:50,600 Um, when you, you want to basically influence the instruction pointer, 1000 00:55:50,800 --> 00:55:54,320 um, to point at data that you influenced or sent. 1001 00:55:54,560 --> 00:55:57,160 Um, first of all, 1002 00:55:57,160 --> 00:56:01,140 when you try to point, um, the instruction pointer into your buffer, 1003 00:56:02,000 --> 00:56:04,680 use something that will stop executing. 1004 00:56:04,960 --> 00:56:06,360 Don't use capital A's. 1005 00:56:06,380 --> 00:56:09,900 Capital A's are a increment, um, opcode on Intel. 1006 00:56:10,140 --> 00:56:11,740 It will just walk over it. 1007 00:56:11,840 --> 00:56:13,380 So use something else. 1008 00:56:13,520 --> 00:56:14,660 Um, use FF. 1009 00:56:14,680 --> 00:56:15,800 Use the debug break. 1010 00:56:16,020 --> 00:56:18,000 Um, CC is good. 1011 00:56:18,200 --> 00:56:19,980 C0 is an illegal instruction. 1012 00:56:20,680 --> 00:56:23,720 And don't limit yourself to the overflowed buffer. 1013 00:56:23,900 --> 00:56:27,140 Don't try to stuff your shellcode into the buffer that you overflowed. 1014 00:56:27,160 --> 00:56:28,680 Those are two vectors. 1015 00:56:28,960 --> 00:56:30,340 The one is to trigger the vulnerability, 1016 00:56:30,760 --> 00:56:32,860 and the other one is to transport your shellcode. 1017 00:56:33,160 --> 00:56:36,460 Don't limit yourself by putting both vectors in one. 1018 00:56:37,340 --> 00:56:40,320 Um, try to get out of the function as soon as possible. 1019 00:56:40,500 --> 00:56:42,780 So if you can influence the logic somehow, 1020 00:56:43,060 --> 00:56:45,820 um, try, as soon as the overflow happened, 1021 00:56:45,940 --> 00:56:48,900 try to reach the return as fast as possible. 1022 00:56:49,060 --> 00:56:51,280 Because there could be reading of local variables, 1023 00:56:51,480 --> 00:56:55,180 or writing to local variables or function arguments, 1024 00:56:55,520 --> 00:56:56,840 which later, 1025 00:56:57,160 --> 00:56:57,960 um, screw your shellcode. 1026 00:56:58,440 --> 00:57:00,600 I got a fancy graphic for that. 1027 00:57:00,940 --> 00:57:03,620 Um, and this is what you usually have. 1028 00:57:03,680 --> 00:57:04,340 You have a buffer. 1029 00:57:04,560 --> 00:57:07,460 Um, this is because the buffer is broken. 1030 00:57:07,660 --> 00:57:08,980 Um, you have a variable, 1031 00:57:09,540 --> 00:57:11,140 base pointer, return address. 1032 00:57:11,500 --> 00:57:14,760 So when it enters, um, the function, 1033 00:57:14,900 --> 00:57:17,560 it will actually write a return address in the base pointer here. 1034 00:57:18,100 --> 00:57:20,020 Um, then you have the buffer overflow. 1035 00:57:21,480 --> 00:57:23,900 And if this happens, you're screwed. 1036 00:57:24,240 --> 00:57:25,960 If it tries to use this variable, 1037 00:57:27,160 --> 00:57:29,020 after you overflow the buffer, this is bad. 1038 00:57:29,260 --> 00:57:30,580 So try to prevent this. 1039 00:57:30,680 --> 00:57:32,080 If you can influence the code path, 1040 00:57:32,360 --> 00:57:35,180 try to prevent reading of the variable to actually 1041 00:57:35,960 --> 00:57:37,460 then reach this position, 1042 00:57:37,720 --> 00:57:39,460 where it reads the data you overflow. 1043 00:57:41,580 --> 00:57:43,760 So what return address should we use? 1044 00:57:44,060 --> 00:57:46,440 Um, there are different ways of doing it. 1045 00:57:47,000 --> 00:57:50,280 There is this classic way, um, following L of 1, 1046 00:57:50,420 --> 00:57:52,520 doing direct return to the buffer. 1047 00:57:52,660 --> 00:57:56,320 This is bad in operating systems that are used today, 1048 00:57:56,320 --> 00:57:58,800 because there tend to be multi-threading, 1049 00:57:58,960 --> 00:58:02,820 and they tend to have different addresses for stacks all the time. 1050 00:58:03,060 --> 00:58:05,440 So don't do this, because it's not reliable, 1051 00:58:05,680 --> 00:58:09,200 and you will not get anything that works on systems 1052 00:58:09,200 --> 00:58:12,320 that didn't belong to you, um, in short. 1053 00:58:12,760 --> 00:58:17,360 So, um, the best way, or the most common way right now, 1054 00:58:17,400 --> 00:58:20,140 is return to a known code location. 1055 00:58:20,360 --> 00:58:22,880 Find some location, some code location, 1056 00:58:22,880 --> 00:58:24,820 that actually has an instruction, like, 1057 00:58:24,820 --> 00:58:26,980 jump to a register, call a register, 1058 00:58:27,400 --> 00:58:29,980 pop something and return if you have a pointer 1059 00:58:29,980 --> 00:58:31,100 to your buffer on a stack, 1060 00:58:31,300 --> 00:58:34,680 or add ESP something, return is the same case 1061 00:58:34,680 --> 00:58:37,020 if you have a pointer, um, to your buffer, 1062 00:58:37,140 --> 00:58:38,500 higher up the stack, use that. 1063 00:58:38,960 --> 00:58:41,220 Or, use the structured exception handler. 1064 00:58:41,560 --> 00:58:43,920 For those of you who haven't seen SEH, 1065 00:58:44,140 --> 00:58:46,240 um, the structured exception handler is, 1066 00:58:46,340 --> 00:58:47,400 as I mentioned earlier, 1067 00:58:47,680 --> 00:58:50,680 the way for the program to handle its fuck-ups himself. 1068 00:58:51,520 --> 00:58:53,160 So, the good thing is, 1069 00:58:53,340 --> 00:58:54,800 the SEH is usually used 1070 00:58:54,820 --> 00:58:57,080 to actually store it on the stack, 1071 00:58:57,620 --> 00:58:58,720 the address is. 1072 00:58:59,320 --> 00:59:02,620 So, um, instead of just overflowing 1073 00:59:02,620 --> 00:59:05,240 up to the return address, and then return somewhere, 1074 00:59:05,640 --> 00:59:08,340 overflow further, till you hit the first SEH. 1075 00:59:08,820 --> 00:59:11,340 What happens here, is basically, 1076 00:59:11,520 --> 00:59:13,520 you overflow up to here, 1077 00:59:13,780 --> 00:59:16,120 then NTDL comes along, 1078 00:59:16,360 --> 00:59:18,420 and says, um, exception happened, 1079 00:59:18,740 --> 00:59:21,320 um, tries to call the handler, 1080 00:59:21,520 --> 00:59:23,940 and you know what happens, it executes your code. 1081 00:59:25,460 --> 00:59:27,820 Um, this is a very reliable way 1082 00:59:27,820 --> 00:59:28,880 of getting code execution. 1083 00:59:31,340 --> 00:59:34,520 Um, useful jump and call register sequences 1084 00:59:34,520 --> 00:59:37,100 are sometimes really hard to find, 1085 00:59:37,240 --> 00:59:39,420 because if you, for example, do a union code, 1086 00:59:39,600 --> 00:59:41,820 you only influence two out of four bytes, 1087 00:59:42,000 --> 00:59:44,420 and the other two are mostly zero, 1088 00:59:44,520 --> 00:59:46,680 or something else, depending on the translation table. 1089 00:59:46,940 --> 00:59:48,120 This is really bad. 1090 00:59:48,520 --> 00:59:50,500 And there's a solution for it, 1091 00:59:50,540 --> 00:59:52,240 which is pure simple brute force, 1092 00:59:52,440 --> 00:59:54,800 um, yeah, I'm not intelligent enough 1093 00:59:54,820 --> 00:59:55,760 to do anything else, 1094 00:59:55,800 --> 00:59:57,280 so brute force is my tool of choice. 1095 00:59:57,620 --> 01:00:00,660 Um, which is searching the entire 1096 01:00:00,660 --> 01:00:02,260 memory address space 1097 01:00:02,620 --> 01:00:04,280 for something that is addressable, 1098 01:00:04,420 --> 01:00:05,860 and then search from there, 1099 01:00:06,020 --> 01:00:07,720 if it would actually fuck up, 1100 01:00:07,760 --> 01:00:09,600 um, the exploitation process or not. 1101 01:00:10,680 --> 01:00:13,800 This gives you all possible return addresses 1102 01:00:13,800 --> 01:00:15,460 that you could potentially reach. 1103 01:00:16,560 --> 01:00:19,440 And since I was playing around with return address stuff, 1104 01:00:19,620 --> 01:00:22,640 um, I actually wanted to put an end 1105 01:00:22,640 --> 01:00:24,580 at those return address guessing, 1106 01:00:24,820 --> 01:00:26,760 and by hand finding stuff anyway, 1107 01:00:27,000 --> 01:00:30,140 and, um, also did the same thing 1108 01:00:30,140 --> 01:00:31,760 for plain ASCII return addresses. 1109 01:00:32,080 --> 01:00:34,580 Um, the good thing here is, 1110 01:00:34,700 --> 01:00:37,480 you can actually save all the return addresses 1111 01:00:37,480 --> 01:00:39,840 that you found for one version of the software, 1112 01:00:40,240 --> 01:00:42,000 then go to a different installation 1113 01:00:42,000 --> 01:00:43,120 and do the same there, 1114 01:00:43,360 --> 01:00:44,820 and then do a diff- 1115 01:00:44,820 --> 01:00:46,400 What the good thing here is, 1116 01:00:46,560 --> 01:00:48,900 it gives you a reliable return address 1117 01:00:48,900 --> 01:00:49,820 that works on both. 1118 01:00:50,000 --> 01:00:51,560 If you do that five times, 1119 01:00:51,800 --> 01:00:53,640 you have something that's probably working 1120 01:00:53,640 --> 01:00:54,560 all over the world, 1121 01:00:54,680 --> 01:00:56,820 um, which is what you're owning with it. 1122 01:01:00,460 --> 01:01:02,820 Um, the whole thing is put together 1123 01:01:02,820 --> 01:01:05,140 in a plug-in for OliDBG. 1124 01:01:05,720 --> 01:01:07,400 OliDBG is a Windows debugger, 1125 01:01:07,460 --> 01:01:10,560 um, with a fancy graphical user interface and stuff. 1126 01:01:10,760 --> 01:01:13,000 It actually supports quite a lot of stuff 1127 01:01:13,000 --> 01:01:14,380 and should be used. 1128 01:01:14,480 --> 01:01:17,080 If you don't have your favorite Windows debugger 1129 01:01:17,080 --> 01:01:19,040 selected yet, um, use Oli. 1130 01:01:19,340 --> 01:01:21,280 Um, this is a plug-in for Oli, 1131 01:01:21,460 --> 01:01:23,620 um, and you can basically attach it 1132 01:01:23,640 --> 01:01:25,120 to your target process 1133 01:01:25,640 --> 01:01:28,180 and have it, um, find return addresses for you. 1134 01:01:29,120 --> 01:01:30,580 This is how that looks like. 1135 01:01:30,800 --> 01:01:33,660 Um, here it is a Unicode return address. 1136 01:01:34,780 --> 01:01:36,740 This here is a position 1137 01:01:36,740 --> 01:01:38,460 that one could address, um, 1138 01:01:38,560 --> 01:01:39,720 with this byte sequence 1139 01:01:40,460 --> 01:01:43,080 and the unretranslation of Unicode. 1140 01:01:44,100 --> 01:01:47,500 But this obviously is not a call or jump to a register, 1141 01:01:47,720 --> 01:01:48,980 but down here we have one. 1142 01:01:49,180 --> 01:01:51,920 And the plug-in, since it searches 1143 01:01:51,920 --> 01:01:53,280 from every addressable position, 1144 01:01:53,640 --> 01:01:57,260 um, could find out that in between here 1145 01:01:57,260 --> 01:01:58,720 there is no memory access 1146 01:01:58,720 --> 01:02:00,520 and we don't care if it fucks up, 1147 01:02:00,560 --> 01:02:02,580 um, the registers because the registers 1148 01:02:02,580 --> 01:02:04,100 contain crap anyway. 1149 01:02:04,360 --> 01:02:05,620 We just overflow the buffer. 1150 01:02:05,940 --> 01:02:08,420 Um, so this is just playing around 1151 01:02:08,420 --> 01:02:10,280 and we really don't care what it does. 1152 01:02:10,460 --> 01:02:12,640 And then it's calling edx 1153 01:02:12,640 --> 01:02:14,180 and we get code execution. 1154 01:02:16,780 --> 01:02:19,040 So now we have code execution. 1155 01:02:19,240 --> 01:02:20,660 Now we need to get the shellcode there. 1156 01:02:20,940 --> 01:02:22,820 Shellcode is a general term, um, 1157 01:02:24,200 --> 01:02:26,440 describing data that became code. 1158 01:02:26,660 --> 01:02:28,480 Who paid attention on the first slide? 1159 01:02:28,720 --> 01:02:31,280 This is exactly why von Neumann is good. 1160 01:02:31,600 --> 01:02:33,600 This is why we are happy that everyone 1161 01:02:33,600 --> 01:02:35,540 builds computers following von Neumann. 1162 01:02:36,100 --> 01:02:38,120 Um, here the data becomes code 1163 01:02:38,710 --> 01:02:41,240 and now we need to create this data, 1164 01:02:41,380 --> 01:02:43,500 um, which is useful. 1165 01:02:43,720 --> 01:02:46,380 So if you're not so good in assembly, 1166 01:02:46,540 --> 01:02:50,220 um, you could actually write your shellcode, 1167 01:02:50,400 --> 01:02:52,740 a small program that opens the listening 1168 01:02:52,820 --> 01:02:55,160 or the shell in C or something else, 1169 01:02:55,240 --> 01:02:57,860 compile it, take the assembly out 1170 01:02:57,860 --> 01:03:00,100 by disassembling it and, um, 1171 01:03:00,280 --> 01:03:02,240 make it then position independent 1172 01:03:02,240 --> 01:03:03,860 or remove forbidden characters 1173 01:03:03,860 --> 01:03:05,700 like zero bytes, um, 1174 01:03:05,880 --> 01:03:08,040 but I actually recommend writing it 1175 01:03:08,040 --> 01:03:09,340 in assembly right away. 1176 01:03:09,500 --> 01:03:11,960 So get network-wide assembler 1177 01:03:11,960 --> 01:03:14,160 and, yeah, write it in assembly. 1178 01:03:14,420 --> 01:03:15,800 It's good training anyway. 1179 01:03:16,420 --> 01:03:19,140 Um, when you write your shellcode, 1180 01:03:19,220 --> 01:03:20,420 try to make it flexible. 1181 01:03:20,700 --> 01:03:22,800 Try to not rely on anything on, 1182 01:03:22,820 --> 01:03:23,800 on the target, um, 1183 01:03:24,040 --> 01:03:26,040 as, as little as you can. 1184 01:03:26,200 --> 01:03:28,780 Just system calls is the best way to do it. 1185 01:03:28,960 --> 01:03:31,120 Um, and use for addressing, 1186 01:03:31,440 --> 01:03:34,480 make sure that you have position independent addressing. 1187 01:03:34,680 --> 01:03:37,720 So don't rely on addresses 1188 01:03:37,720 --> 01:03:40,020 because you don't know if your shellcode 1189 01:03:40,020 --> 01:03:42,340 is going to end up at the same code address 1190 01:03:42,340 --> 01:03:43,020 all the time. 1191 01:03:43,380 --> 01:03:45,120 Here's an example, um, 1192 01:03:45,360 --> 01:03:49,460 for getting the address of the string binsh here. 1193 01:03:49,860 --> 01:03:52,800 Um, the way you would do it 1194 01:03:52,820 --> 01:03:56,140 is you jump from the beginning to the end. 1195 01:03:56,280 --> 01:03:58,460 From there, you call the beginning 1196 01:03:58,460 --> 01:04:01,460 and then pop EBP or whatever 1197 01:04:01,460 --> 01:04:04,760 because the call will store the return address 1198 01:04:04,760 --> 01:04:06,980 which is right here where the string begins 1199 01:04:06,980 --> 01:04:07,740 on the stack. 1200 01:04:07,920 --> 01:04:09,220 And when you pop it down, 1201 01:04:09,400 --> 01:04:11,100 you have the address of EBP. 1202 01:04:11,960 --> 01:04:14,760 The reason to do the call at the bottom 1203 01:04:14,760 --> 01:04:16,480 and not at the top is this, 1204 01:04:16,620 --> 01:04:21,940 um, you have here a negative call 1205 01:04:21,940 --> 01:04:24,600 because the offset from the call is upwards, 1206 01:04:24,800 --> 01:04:25,400 not downwards. 1207 01:04:25,680 --> 01:04:27,400 So it's negative, so it's all F. 1208 01:04:27,620 --> 01:04:29,580 If you had it the other way around, 1209 01:04:29,720 --> 01:04:30,940 it would be a zero bytes, 1210 01:04:31,120 --> 01:04:33,280 all the zero bytes because it would, yeah, 1211 01:04:33,810 --> 01:04:35,820 just, if there is, 1212 01:04:35,860 --> 01:04:38,220 if the difference is less than, like, 1213 01:04:38,810 --> 01:04:40,660 what, four gigabytes or something, 1214 01:04:40,900 --> 01:04:43,380 um, then you have zeros in the address. 1215 01:04:48,620 --> 01:04:51,460 ...known way to transport the shellcode. 1216 01:04:51,940 --> 01:04:55,740 Um, you can have another buffer in the same request 1217 01:04:55,740 --> 01:04:59,160 and basically point to this buffer later on 1218 01:04:59,160 --> 01:05:00,700 or you send data before. 1219 01:05:00,920 --> 01:05:02,440 Maybe you have to send a username 1220 01:05:02,440 --> 01:05:03,680 before sending the overflow. 1221 01:05:04,060 --> 01:05:05,880 Why not put your shellcode in the username? 1222 01:05:06,120 --> 01:05:06,940 This is a good idea. 1223 01:05:08,140 --> 01:05:09,840 Shellcode also often gets transformed. 1224 01:05:10,220 --> 01:05:12,540 So you have zero bytes, um, 1225 01:05:12,680 --> 01:05:15,980 that get introduced or that you don't have to have 1226 01:05:15,980 --> 01:05:18,460 in your shellcode for the string operations to work. 1227 01:05:18,660 --> 01:05:20,700 Um, you have other forbidden characters. 1228 01:05:20,700 --> 01:05:22,360 For example, um, 1229 01:05:22,540 --> 01:05:24,800 if the overflow has something to do with a path, 1230 01:05:25,020 --> 01:05:27,800 probably dot and slash are not allowed. 1231 01:05:28,100 --> 01:05:30,040 And so you have to take care 1232 01:05:30,040 --> 01:05:31,260 that those are not in there. 1233 01:05:31,600 --> 01:05:32,600 And you have encoding. 1234 01:05:32,960 --> 01:05:35,080 Again, Unicode can be a real bitch here 1235 01:05:35,080 --> 01:05:36,800 because it changes, like, 1236 01:05:36,880 --> 01:05:38,880 50% of your code at least, 1237 01:05:40,040 --> 01:05:41,200 which looks like this. 1238 01:05:41,740 --> 01:05:44,660 Um, you have a piece of really nice code 1239 01:05:44,660 --> 01:05:45,760 in the beginning 1240 01:05:45,760 --> 01:05:47,540 and then it went through Unicode composition 1241 01:05:47,540 --> 01:05:49,320 and got, like, all screwed up. 1242 01:05:49,320 --> 01:05:53,000 And you have to tackle this somehow. 1243 01:05:53,880 --> 01:05:55,900 The way to tackle this is, um, 1244 01:05:56,140 --> 01:05:58,160 first published by Chris Anway 1245 01:05:58,160 --> 01:05:59,740 from, um, Next Generation. 1246 01:06:00,300 --> 01:06:04,360 Um, they called it a Venetian shellcode 1247 01:06:04,360 --> 01:06:07,400 because it tries to close the blinds 1248 01:06:07,400 --> 01:06:09,420 that were generated with the zero bytes in between. 1249 01:06:09,720 --> 01:06:12,640 Um, and this is why it is called 1250 01:06:12,640 --> 01:06:14,800 a Venetian shellcode generator. 1251 01:06:15,280 --> 01:06:17,240 Um, the reason why it is a generator 1252 01:06:17,240 --> 01:06:19,000 is you don't want to do that by hand. 1253 01:06:19,320 --> 01:06:20,520 This is tiresome. 1254 01:06:20,700 --> 01:06:22,820 And, um, you can actually go and Google 1255 01:06:22,820 --> 01:06:24,120 for the paper by Chris 1256 01:06:24,120 --> 01:06:26,220 and then you know why you don't want to do that by hand. 1257 01:06:26,600 --> 01:06:29,880 Um, so there are actually, um, 1258 01:06:29,960 --> 01:06:31,980 shellcode generators for this. 1259 01:06:32,160 --> 01:06:33,720 Um, DeFi 12, again, 1260 01:06:33,820 --> 01:06:36,420 made one in Python that's public. 1261 01:06:36,480 --> 01:06:38,160 And, yeah, you can download it. 1262 01:06:38,260 --> 01:06:40,600 And, um, we actually have a curl implementation 1263 01:06:40,600 --> 01:06:45,000 that creates a bit better, um, Unicode Venetian shellcode. 1264 01:06:45,100 --> 01:06:46,600 And this is also public. 1265 01:06:48,240 --> 01:06:49,820 So this is what it does. 1266 01:06:50,100 --> 01:06:53,080 Um, you have your stuff sent over 1267 01:06:53,080 --> 01:06:54,940 and you have all the zero bytes in here 1268 01:06:54,940 --> 01:06:56,300 which you don't want to have. 1269 01:06:56,520 --> 01:06:59,480 So this code over here goes ahead 1270 01:06:59,480 --> 01:07:01,940 and fixes itself, basically. 1271 01:07:02,860 --> 01:07:05,040 They're just going byte by byte 1272 01:07:05,040 --> 01:07:07,580 and fix them back to what they're supposed to be. 1273 01:07:08,880 --> 01:07:11,200 And then start executing from here. 1274 01:07:15,800 --> 01:07:17,300 So, finalizing this, um, 1275 01:07:17,440 --> 01:07:20,020 what we can do now is trigger the vulnerability, 1276 01:07:20,560 --> 01:07:23,580 um, point the instruction pointer to some data 1277 01:07:23,580 --> 01:07:25,240 that, um, we can influence. 1278 01:07:25,820 --> 01:07:28,280 And which, at this point in time, becomes code. 1279 01:07:28,700 --> 01:07:33,720 We can get our code or data, um, somehow there 1280 01:07:33,720 --> 01:07:35,760 so we can actually execute it. 1281 01:07:36,000 --> 01:07:37,640 And now we have to try it out. 1282 01:07:37,800 --> 01:07:40,060 Um, and this is where reliability 1283 01:07:40,060 --> 01:07:42,020 for the exploitation comes in. 1284 01:07:42,140 --> 01:07:44,260 Because if you're writing an exploit 1285 01:07:44,260 --> 01:07:46,640 and it works, let's say, on an English version of Windows, 1286 01:07:46,940 --> 01:07:49,560 um, make sure that it also works on a Japanese 1287 01:07:49,560 --> 01:07:51,040 or Chinese version of Windows 1288 01:07:51,040 --> 01:07:53,840 because you're probably using it more against Chinese web servers 1289 01:07:53,840 --> 01:07:55,100 than against English ones. 1290 01:07:55,620 --> 01:07:57,940 So, um, use a debugger. 1291 01:07:58,040 --> 01:07:59,360 Check it with a debugger. 1292 01:07:59,380 --> 01:08:00,600 Check it without a debugger. 1293 01:08:00,740 --> 01:08:03,620 Um, use different OS versions and languages. 1294 01:08:03,920 --> 01:08:06,600 Um, and just try if it works. 1295 01:08:06,620 --> 01:08:07,860 Make sure it is reliable. 1296 01:08:08,300 --> 01:08:09,360 Do you have anything to add? 1297 01:08:10,060 --> 01:08:10,620 For reliability? 1298 01:08:11,020 --> 01:08:11,280 No. 1299 01:08:12,700 --> 01:08:13,760 Sorry to wake you up. 1300 01:08:14,060 --> 01:08:18,580 So the good thing about this is 1301 01:08:18,580 --> 01:08:21,200 this is all there is about writing ODE. 1302 01:08:21,480 --> 01:08:24,460 So at this point in time, you actually got your own ODE. 1303 01:08:26,780 --> 01:08:28,600 Now, exploiting non-standard stuff, 1304 01:08:28,760 --> 01:08:31,840 um, is absolutely the same thing. 1305 01:08:31,980 --> 01:08:34,220 I had a lot of people last year's coming up, 1306 01:08:34,300 --> 01:08:36,140 how can you do this on Cisco? 1307 01:08:36,460 --> 01:08:37,600 There is no difference. 1308 01:08:37,600 --> 01:08:40,020 It is, again, a phenomenal machine. 1309 01:08:40,200 --> 01:08:41,080 It got a CPU. 1310 01:08:41,220 --> 01:08:42,420 It got random access memory. 1311 01:08:42,720 --> 01:08:44,000 It got some permanent storage. 1312 01:08:44,180 --> 01:08:45,180 It got network connectivity. 1313 01:08:45,480 --> 01:08:46,380 So why not hack it? 1314 01:08:46,740 --> 01:08:47,820 So go ahead. 1315 01:08:48,040 --> 01:08:48,640 Hack routers. 1316 01:08:48,640 --> 01:08:49,220 Hack printers. 1317 01:08:49,360 --> 01:08:50,040 Hack cell phones. 1318 01:08:50,420 --> 01:08:55,200 Hotel TV, um, pay TV stuff, ATMs, whatever comes to mind. 1319 01:08:55,240 --> 01:08:57,340 If you see something with an Ethernet jack in it, 1320 01:08:57,440 --> 01:08:59,640 declare it a target and start learning it. 1321 01:09:02,540 --> 01:09:06,000 So what you see then often is non-Intel CPUs, 1322 01:09:06,020 --> 01:09:07,580 something that's not in your system. 1323 01:09:07,580 --> 01:09:07,960 It's not in your PC. 1324 01:09:08,320 --> 01:09:11,140 Um, there are a few small differences, 1325 01:09:11,260 --> 01:09:13,480 but the major difference is it's nicer. 1326 01:09:14,080 --> 01:09:18,460 There's almost no CPU out there that is as ugly as Intel. 1327 01:09:18,820 --> 01:09:23,360 So as soon as you start learning different CPUs, 1328 01:09:23,360 --> 01:09:27,020 um, you will find out that there are really nice CPUs out there. 1329 01:09:27,140 --> 01:09:29,560 They're often fixed size instruction sets. 1330 01:09:29,840 --> 01:09:32,600 Um, they often have alignment requirements, 1331 01:09:32,920 --> 01:09:35,120 which is really important when you're writing shell code. 1332 01:09:35,120 --> 01:09:37,820 Um, they have different condition codes 1333 01:09:37,820 --> 01:09:39,400 and different conditional execution, 1334 01:09:39,880 --> 01:09:43,940 which can be really handy because you can write way cooler shell code 1335 01:09:43,940 --> 01:09:45,160 than you could on Intel. 1336 01:09:45,480 --> 01:09:48,960 Um, they have some tricky stuff like delayed branches, 1337 01:09:49,200 --> 01:09:51,140 and they usually have more registers, 1338 01:09:51,360 --> 01:09:53,320 so you can actually do more stuff with it. 1339 01:09:56,260 --> 01:09:59,180 Again, the process is absolutely the same. 1340 01:09:59,220 --> 01:10:02,380 All you want to do, um, on a different OS 1341 01:10:02,380 --> 01:10:04,600 that might have a different CPU, 1342 01:10:05,120 --> 01:10:06,940 um, get a shell first, 1343 01:10:07,200 --> 01:10:09,360 and then get a debugger running on this shell. 1344 01:10:09,720 --> 01:10:13,300 And all you need then is basically understand the platform. 1345 01:10:13,600 --> 01:10:15,160 There are a few things to understand, 1346 01:10:15,380 --> 01:10:17,500 like process management, memory management, 1347 01:10:18,160 --> 01:10:21,100 privilege mechanisms, and granularity. 1348 01:10:21,180 --> 01:10:23,880 It doesn't make sense if you're trying to, like, 1349 01:10:24,240 --> 01:10:26,060 write a local exploit on a platform 1350 01:10:26,060 --> 01:10:29,380 and then realize there's only one privilege level on the platform anyway. 1351 01:10:29,640 --> 01:10:33,580 So you're, like, exploiting to get the same privilege level you had before. 1352 01:10:33,760 --> 01:10:34,680 This is pointless. 1353 01:10:35,120 --> 01:10:35,780 Don't do it. 1354 01:10:36,870 --> 01:10:38,120 So read up on the stuff. 1355 01:10:38,260 --> 01:10:40,220 Find out how it's working, 1356 01:10:40,400 --> 01:10:41,620 but don't believe everything. 1357 01:10:41,860 --> 01:10:45,020 If it tells you it has buffer overflow protection against everything, 1358 01:10:45,400 --> 01:10:46,060 don't. 1359 01:10:46,120 --> 01:10:47,140 Don't believe it. 1360 01:10:47,240 --> 01:10:50,360 They wouldn't possibly do that. 1361 01:10:50,540 --> 01:10:53,180 And if they do it, they probably fucked it up. 1362 01:10:55,300 --> 01:10:57,140 So, exploiting black boxes. 1363 01:10:57,300 --> 01:10:59,540 Um, there are talks here on hardware hacking, 1364 01:10:59,720 --> 01:11:03,000 um, but I'm preferring a different approach, 1365 01:11:03,160 --> 01:11:04,900 which is basically black box testing. 1366 01:11:04,900 --> 01:11:09,720 Um, you can look for undocumented debugging 1367 01:11:09,720 --> 01:11:13,020 and hidden functionality in terms of logging capabilities. 1368 01:11:13,500 --> 01:11:14,760 This helps you a lot. 1369 01:11:14,840 --> 01:11:16,200 You can make a lot somehow. 1370 01:11:16,540 --> 01:11:18,500 A lot of information, um, 1371 01:11:18,660 --> 01:11:21,060 which helps you to determine how it works internally. 1372 01:11:21,540 --> 01:11:23,800 Um, if you have, like, 1373 01:11:23,880 --> 01:11:27,740 how many of you have those little, um, home routers at home 1374 01:11:27,740 --> 01:11:30,520 that do ADSL and wireless and stuff? 1375 01:11:30,700 --> 01:11:31,140 Raise your hand. 1376 01:11:32,140 --> 01:11:32,700 Okay. 1377 01:11:32,700 --> 01:11:36,900 I expect at least half of you next year with an exploit for it. 1378 01:11:37,120 --> 01:11:38,780 It is really, really easy. 1379 01:11:38,880 --> 01:11:40,400 Those things are totally broken, 1380 01:11:40,580 --> 01:11:42,980 and you don't even need complex debugging 1381 01:11:42,980 --> 01:11:46,120 because most of them actually have just an unsolder, um, 1382 01:11:46,220 --> 01:11:47,560 serial interface on it. 1383 01:11:47,680 --> 01:11:49,460 So connect to the serial interface. 1384 01:11:49,580 --> 01:11:50,320 See what it does. 1385 01:11:50,400 --> 01:11:53,300 It might actually even come with its own debugger already installed. 1386 01:11:54,660 --> 01:11:57,240 Um, if you have something more complex, 1387 01:11:57,420 --> 01:11:59,700 like you want to hack, um, your neighbor's car, 1388 01:11:59,980 --> 01:12:02,680 um, you need a JTAG. 1389 01:12:02,700 --> 01:12:06,900 JTAG interface, which is basically a, um, 1390 01:12:06,940 --> 01:12:09,060 on the JTAG interface in the first place 1391 01:12:09,060 --> 01:12:11,460 where you can use it for full-blown debugging if you want to. 1392 01:12:11,900 --> 01:12:14,460 Um, but try and error does as well. 1393 01:12:14,580 --> 01:12:15,040 It's fine. 1394 01:12:15,180 --> 01:12:17,500 If you have an overflow, try to find out, um, 1395 01:12:17,640 --> 01:12:19,420 if you can get code execution 1396 01:12:19,420 --> 01:12:21,760 the same way you do it on Windows or Linux. 1397 01:12:22,080 --> 01:12:24,440 Um, you have ways to find this out. 1398 01:12:24,560 --> 01:12:26,320 Take, like, an infinite loop 1399 01:12:26,840 --> 01:12:29,640 in the assembly language of this processor 1400 01:12:29,640 --> 01:12:31,540 and put this in as a shellcode. 1401 01:12:31,540 --> 01:12:33,000 And when it stops doing anything 1402 01:12:33,300 --> 01:12:34,760 but getting really, really hot, 1403 01:12:34,920 --> 01:12:37,600 it's probably running in circuits in this infinite loop. 1404 01:12:37,760 --> 01:12:40,280 So you get your code execution done. 1405 01:12:41,100 --> 01:12:42,500 Stop interpreting results. 1406 01:12:42,760 --> 01:12:45,180 Find out, um, not just, like, try stuff, 1407 01:12:45,300 --> 01:12:49,020 but also try to, um, think about what happens 1408 01:12:49,020 --> 01:12:50,100 and why it happened. 1409 01:12:51,400 --> 01:12:53,680 So basically this is the summary, 1410 01:12:53,800 --> 01:12:55,280 unless you have anything to add. 1411 01:12:56,520 --> 01:12:57,180 Do you? 1412 01:12:59,480 --> 01:13:01,520 You might want to spend actually less time 1413 01:13:01,540 --> 01:13:03,360 in front of the screen than you, like, 1414 01:13:03,420 --> 01:13:05,620 you think at the first glance because, like, 1415 01:13:05,740 --> 01:13:07,620 you read things differently on a screen 1416 01:13:07,620 --> 01:13:09,240 than you do on paper or you read in a park. 1417 01:13:10,000 --> 01:13:12,660 And, uh, it's a very common phenomenon, 1418 01:13:12,860 --> 01:13:13,760 especially in our circuits, 1419 01:13:13,920 --> 01:13:15,200 to spend all the time in front of the screen 1420 01:13:15,200 --> 01:13:17,260 and then don't see the forest or all the trees. 1421 01:13:17,900 --> 01:13:20,020 So it's a good idea to step back at times 1422 01:13:20,020 --> 01:13:21,320 and just look at different things. 1423 01:13:22,800 --> 01:13:23,600 Good point. 1424 01:13:24,640 --> 01:13:25,900 So those are great, 1425 01:13:26,000 --> 01:13:28,520 and, um, I guess I open up for questions 1426 01:13:28,520 --> 01:13:31,180 because, surprisingly, we even have time for that. 1427 01:13:34,460 --> 01:13:35,260 Come on, please. 1428 01:13:37,820 --> 01:13:39,940 If you don't have questions, you didn't get it. 1429 01:13:43,380 --> 01:13:44,180 Okay, so... 1430 01:13:45,640 --> 01:13:46,680 There is one! Cool! 1431 01:13:47,600 --> 01:13:48,000 . 1432 01:13:48,760 --> 01:13:49,160 . 1433 01:13:49,160 --> 01:13:49,240 . 1434 01:13:49,820 --> 01:13:50,220 . 1435 01:13:50,220 --> 01:13:50,320 . 1436 01:13:50,320 --> 01:13:50,400 . 1437 01:13:50,400 --> 01:13:50,560 . 1438 01:13:51,320 --> 01:13:51,720 . 1439 01:13:53,220 --> 01:13:53,620 . 1440 01:14:01,540 --> 01:14:02,100 . 1441 01:14:02,100 --> 01:14:03,200 . 1442 01:14:11,040 --> 01:14:12,160 . 1443 01:14:15,280 --> 01:14:16,400 . 1444 01:14:16,400 --> 01:14:16,460 . 1445 01:14:18,860 --> 01:14:19,980 . 1446 01:14:19,980 --> 01:14:21,860 . 1447 01:14:21,860 --> 01:14:22,960 . 1448 01:14:22,960 --> 01:14:22,980 . 1449 01:14:22,980 --> 01:14:23,000 . 1450 01:14:23,000 --> 01:14:23,020 . 1451 01:14:23,020 --> 01:14:23,200 . 1452 01:14:23,200 --> 01:14:23,260 . 1453 01:14:24,840 --> 01:14:31,340 Sir, okay, since everyone is already leaving, I declare this show as closed. 1454 01:14:59,400 --> 01:15:01,140 Thank you. 1455 01:15:36,060 --> 01:15:36,120 Thank you. 1456 01:16:06,500 --> 01:16:06,560 Thank you. 1457 01:16:35,340 --> 01:16:35,940 Thank you. 1458 01:17:06,320 --> 01:17:06,380 Thank you. 1459 01:17:33,160 --> 01:17:34,240 Thank you. 1460 01:17:59,740 --> 01:18:01,440 Thank you. 1461 01:18:35,660 --> 01:18:35,900 Thank you. 1462 01:19:04,400 --> 01:19:04,700 Thank you. 1463 01:19:34,920 --> 01:19:36,000 Thank you. 1464 01:20:06,180 --> 01:20:06,480 Thank you. 1465 01:20:30,160 --> 01:20:30,640 Thank you. 1466 01:21:05,520 --> 01:21:06,360 Thank you. 1467 01:21:30,320 --> 01:21:31,920 Thank you. 1468 01:22:05,460 --> 01:22:05,520 Thank you. 1469 01:22:34,680 --> 01:22:34,800 Thank you. 1470 01:23:03,340 --> 01:23:04,940 Thank you. 1471 01:23:33,820 --> 01:23:35,600 Thank you. 1472 01:24:04,080 --> 01:24:05,700 Thank you. 1473 01:24:35,540 --> 01:24:36,940 Thank you. 1474 01:25:02,560 --> 01:25:04,220 Thank you. 1475 01:25:34,960 --> 01:25:35,020 Thank you. 1476 01:26:05,260 --> 01:26:05,320 Thank you. 1477 01:26:35,000 --> 01:26:35,660 Thank you. 1478 01:27:03,860 --> 01:27:04,100 Thank you. 1479 01:27:26,780 --> 01:27:28,400 Thank you. 1480 01:28:05,360 --> 01:28:05,420 Thank you. 1481 01:28:34,820 --> 01:28:35,600 Thank you. 1482 01:29:03,680 --> 01:29:06,040 Thank you. 1483 01:29:36,660 --> 01:29:36,720 Thank you. 1484 01:30:02,860 --> 01:30:05,620 Thank you. 1485 01:30:34,100 --> 01:30:34,700 Thank you. 1486 01:31:07,720 --> 01:31:08,440 Thank you. 1487 01:31:51,840 --> 01:31:53,240 Thank you. 1488 01:32:21,840 --> 01:32:23,240 Thank you. 1489 01:32:51,840 --> 01:32:53,240 Thank you. 1490 01:33:21,340 --> 01:33:22,740 Thank you. 1491 01:33:51,340 --> 01:33:52,740 Thank you. 1492 01:34:21,840 --> 01:34:23,240 Thank you. 1493 01:34:51,840 --> 01:34:53,240 Thank you. 1494 01:35:21,840 --> 01:35:23,240 Thank you. 1495 01:35:51,840 --> 01:35:53,240 Thank you. 1496 01:36:21,340 --> 01:36:22,740 Thank you. 1497 01:36:51,840 --> 01:36:53,240 Thank you. 1498 01:37:21,340 --> 01:37:22,740 Thank you. 1499 01:37:23,260 --> 01:37:23,400 you 1500 01:37:53,260 --> 01:37:53,340 you 1501 01:38:23,260 --> 01:38:23,340 you 1502 01:38:53,260 --> 01:38:53,380 you 1503 01:39:23,260 --> 01:39:23,340 you 1504 01:39:53,260 --> 01:39:53,400 you 1505 01:40:23,260 --> 01:40:23,320 you 1506 01:40:53,260 --> 01:40:53,320 you 1507 01:41:23,260 --> 01:41:23,400 you 1508 01:41:53,260 --> 01:41:53,400 you 1509 01:42:23,260 --> 01:42:23,400 you 1510 01:42:53,260 --> 01:42:53,400 you 1511 01:43:23,260 --> 01:43:23,340 you 1512 01:43:53,260 --> 01:43:53,400 you 1513 01:44:23,260 --> 01:44:23,340 you 1514 01:44:53,260 --> 01:44:53,380 you 1515 01:45:23,260 --> 01:45:23,380 you 1516 01:45:53,260 --> 01:45:53,340 you 1517 01:46:23,260 --> 01:46:23,340 you 1518 01:46:53,260 --> 01:46:53,380 you 1519 01:47:23,260 --> 01:47:23,340 you 1520 01:47:53,260 --> 01:47:53,400 you 1521 01:48:23,260 --> 01:48:23,340 you 1522 01:48:53,260 --> 01:48:53,400 you 1523 01:49:23,260 --> 01:49:23,400 you 1524 01:49:53,260 --> 01:49:53,380 you 1525 01:50:23,260 --> 01:50:23,380 you 1526 01:50:53,260 --> 01:50:53,400 you 1527 01:51:23,260 --> 01:51:23,380 you 1528 01:51:53,260 --> 01:51:53,400 you 1529 01:52:23,260 --> 01:52:23,400 you 1530 01:52:53,260 --> 01:52:53,400 you 1531 01:53:23,260 --> 01:53:23,400 you 1532 01:53:53,260 --> 01:53:53,360 you 1533 01:54:23,260 --> 01:54:23,340 you 1534 01:54:53,260 --> 01:54:53,340 you 1535 01:55:23,260 --> 01:55:23,380 you 1536 01:55:53,260 --> 01:55:53,400 you 1537 01:56:23,260 --> 01:56:23,380 you 1538 01:56:53,260 --> 01:56:53,340 you 1539 01:57:23,260 --> 01:57:23,400 you 1540 01:57:53,260 --> 01:57:53,400 you 1541 01:58:23,260 --> 01:58:23,380 you 1542 01:58:53,260 --> 01:58:53,340 you 1543 01:59:23,260 --> 01:59:23,380 you 1544 01:59:53,260 --> 01:59:53,340 you 1545 02:00:23,260 --> 02:00:23,340 you 1546 02:00:53,260 --> 02:00:53,360 you 1547 02:01:23,260 --> 02:01:23,400 you 1548 02:01:53,260 --> 02:01:53,400 you 1549 02:02:23,260 --> 02:02:23,320 you 1550 02:02:53,260 --> 02:02:53,380 you 1551 02:03:23,260 --> 02:03:23,400 you 1552 02:03:53,260 --> 02:03:53,340 you 1553 02:04:23,260 --> 02:04:23,340 you 1554 02:04:53,260 --> 02:04:53,340 you 1555 02:05:23,260 --> 02:05:23,360 you 1556 02:05:53,260 --> 02:05:53,360 you 1557 02:06:23,260 --> 02:06:23,360 you 1558 02:06:53,260 --> 02:06:53,340 you 1559 02:07:23,260 --> 02:07:23,400 you 1560 02:07:53,260 --> 02:07:53,340 you 1561 02:08:23,260 --> 02:08:23,400 you 1562 02:08:53,260 --> 02:08:53,340 you 1563 02:09:23,260 --> 02:09:23,380 you 1564 02:09:53,260 --> 02:09:53,400 you 1565 02:10:23,260 --> 02:10:23,340 you 1566 02:10:53,260 --> 02:10:53,440 you 1567 02:11:23,260 --> 02:11:23,400 you 1568 02:11:53,260 --> 02:11:53,380 you 1569 02:12:23,260 --> 02:12:23,500 you