1 00:00:00,980 --> 00:00:04,400 My name is Rolof Teving. This is my beautiful assistant, Haroon Mir. 2 00:00:05,040 --> 00:00:08,880 We're doing a talk entitled, The Tale of Two Tested Proxies. 3 00:00:11,380 --> 00:00:13,800 And just to give you an idea of where we're from, 4 00:00:14,380 --> 00:00:19,360 we're also the guys that brought you tools called Wicto, Crowbar, Bidiblaw, 5 00:00:20,000 --> 00:00:23,940 we're the producers of Hacking by Numbers, Terry putting the tea back in cyberterrorism, 6 00:00:24,020 --> 00:00:28,260 the directors of When the Tables Turn, several sundress fairy tales, 7 00:00:28,260 --> 00:00:33,880 and contrary to popular belief, we were the inspiration for the Matrix Trilogy. 8 00:00:35,220 --> 00:00:38,980 So the talk is about two different proxies. 9 00:00:40,760 --> 00:00:45,180 I know most of you that are here have got a bit of a headache from the 303 party last night, 10 00:00:45,760 --> 00:00:48,120 so I'll try to keep it brief and to the point. 11 00:00:49,800 --> 00:00:53,900 We're talking about two proxies, and they're very different proxies. 12 00:00:55,440 --> 00:00:58,040 So don't get confused about the two different proxies. 13 00:00:58,260 --> 00:01:03,760 The first is called Suru, which I'm going to speak about, which is a web application proxy. 14 00:01:04,340 --> 00:01:09,240 It's kind of man in the middle, the same as things like the AdStack web proxy, 15 00:01:09,880 --> 00:01:11,060 WebScarab, those kind of things. 16 00:01:13,960 --> 00:01:19,640 And then Haroon, next to me, is going to speak about LR, which is a generic TCP proxy. 17 00:01:20,200 --> 00:01:23,940 So it's totally different things, and we're totally different people. 18 00:01:25,680 --> 00:01:26,120 Okay. 19 00:01:28,260 --> 00:01:30,960 So why do we need yet another proxy? 20 00:01:31,700 --> 00:01:33,480 Seems like we have lots of proxies. 21 00:01:33,520 --> 00:01:36,800 There's Burp proxy, there's Paros, there's AdStack web proxy, there's all of those things. 22 00:01:37,160 --> 00:01:40,320 Why would we want to have yet another proxy? 23 00:01:42,460 --> 00:01:46,580 Well, one of the things that we found was that none 24 00:01:46,580 --> 00:01:52,720 of those proxies actually does nice discovery of directories and files like we do it in Wicto 25 00:01:53,420 --> 00:01:54,400 with the backend miner. 26 00:01:54,640 --> 00:01:57,700 I don't know how many of these people in this room are using Wicto. 27 00:01:58,260 --> 00:01:58,780 Can I see hands? 28 00:01:59,400 --> 00:02:03,740 Okay. So you know the tab there that does the backend mining that looks for directories, 29 00:02:03,760 --> 00:02:07,660 looks for files, different extensions, different directories. 30 00:02:07,880 --> 00:02:10,620 We wanted something to do that a little bit more intelligent. 31 00:02:11,640 --> 00:02:16,100 We also wanted something that could fuzz variables a little bit more intelligent, 32 00:02:16,680 --> 00:02:22,980 but also wouldn't try to be too smart about that, because you get lots of these tools out there 33 00:02:23,560 --> 00:02:28,240 that are trying to be super smart about how they fuzz parameters well. 34 00:02:28,240 --> 00:02:33,380 It's within a web application, and that smartness that they put in there is really their downfall. 35 00:02:35,540 --> 00:02:39,440 We also want it to be fairly generic so that you can use it for just about anything. 36 00:02:40,720 --> 00:02:46,520 So after looking at how the guys use web application proxies for a long, long time, 37 00:02:47,960 --> 00:02:53,060 we found that there's really no one button kind of solution for web applications. 38 00:02:53,380 --> 00:02:56,600 You can't really take this one button, run it, and, you know, 39 00:02:56,640 --> 00:02:58,220 it finds everything about the application. 40 00:02:58,240 --> 00:03:02,320 It logs in automatically, bypass all of the forms, all of that kind of thing. 41 00:03:02,400 --> 00:03:03,720 It's not going to happen, right? 42 00:03:05,700 --> 00:03:10,200 But what we've seen is that people that are good at web application assessments, 43 00:03:11,880 --> 00:03:16,300 they really want to have full control over exactly what they send to the application, 44 00:03:16,820 --> 00:03:21,620 and then they inspect what they get back on the page, and then they make a change and they send it again. 45 00:03:22,260 --> 00:03:24,960 But a lot of the stuff that they do, they automate. 46 00:03:25,420 --> 00:03:26,360 They don't automate. 47 00:03:26,420 --> 00:03:28,220 They do it over and over and over. 48 00:03:28,240 --> 00:03:35,280 But there's just enough variation in that test that they do that you can't really automate it properly. 49 00:03:36,980 --> 00:03:41,940 So they want to have the control over the application and want to have control over exactly what they send, 50 00:03:42,260 --> 00:03:49,020 but they kind of want some power tools that can help them to do a lot of the stuff that they do repetitively. 51 00:03:51,920 --> 00:03:54,640 And this is where this proxy comes into play. 52 00:03:55,040 --> 00:03:58,020 I've also seen that lines between where the application, 53 00:03:58,240 --> 00:04:01,860 where the application starts and where the web server ends are kind of blurring. 54 00:04:01,980 --> 00:04:08,860 There's a lot of the components and extensions and stuff that's really sitting between application level on the one side 55 00:04:08,860 --> 00:04:11,900 and network level, network application on the other side. 56 00:04:13,520 --> 00:04:19,120 So this is what we set out to do, is to build a proxy that can do these things. 57 00:04:20,540 --> 00:04:23,240 And it didn't happen just in one day. 58 00:04:23,580 --> 00:04:27,940 So I'm going to give you a quick brief history and you can kind of figure out how we got, 59 00:04:28,240 --> 00:04:29,060 to where we are now. 60 00:04:31,240 --> 00:04:34,700 It really started off by when we did work on Vecto. 61 00:04:34,900 --> 00:04:39,140 And for Vecto, what we wanted was we wanted something that could do, 62 00:04:39,860 --> 00:04:42,820 you know, that won't be fooled by friendly 404s. 63 00:04:43,300 --> 00:04:47,580 So we started looking at the content of what a page returns 64 00:04:47,580 --> 00:04:51,460 and matching the content between a test page and the real page. 65 00:04:51,720 --> 00:04:54,100 And that's really where the cleverness of Vecto sits. 66 00:04:54,300 --> 00:04:56,940 It sits in the content comparison algorithm. 67 00:04:58,240 --> 00:05:02,080 And, sadly, some people still don't know how to use that AI option. 68 00:05:06,020 --> 00:05:07,120 Dude, you can't do that. 69 00:05:07,220 --> 00:05:07,740 That's mine. 70 00:05:08,020 --> 00:05:08,800 You're talking. 71 00:05:09,160 --> 00:05:09,640 Okay. 72 00:05:10,100 --> 00:05:18,380 So, so we created, yeah, then we created Crowbar in early 2005, and it's also sad, 73 00:05:18,480 --> 00:05:21,420 but most people don't know how to use it or how it works. 74 00:05:21,560 --> 00:05:24,460 And it's really one of the most powerful applications that we built. 75 00:05:25,120 --> 00:05:27,260 And we extended the thinking in Crowbar. 76 00:05:27,260 --> 00:05:30,780 That we say, we want something that is really a generic brute forcer. 77 00:05:31,180 --> 00:05:37,580 So we would send a request that, that test, a test request, and then we send the real request, 78 00:05:37,760 --> 00:05:40,340 and we would see how these two match up. 79 00:05:40,840 --> 00:05:42,640 You'll see later on how it sits together. 80 00:05:44,480 --> 00:05:45,600 So how does it work? 81 00:05:45,800 --> 00:05:48,220 And, and hopefully this is the last time I'm going to talk about this. 82 00:05:49,140 --> 00:05:53,580 In Vecto, we basically, if we want to test for a file, let's say login.pl that sits 83 00:05:53,580 --> 00:05:56,820 in the script directory, we would first test for, 84 00:05:57,260 --> 00:05:59,820 something in the script directory that we know that does not exist. 85 00:06:01,920 --> 00:06:05,300 Like moo, moo, moo, moo, moo, right? 86 00:06:07,080 --> 00:06:11,980 And that's the base request, that's the base response request that builds the base response. 87 00:06:12,540 --> 00:06:13,940 In Crowbar, we do the same thing. 88 00:06:14,100 --> 00:06:18,660 If we want to test for a username and a password, we would test for something that we know never 89 00:06:18,660 --> 00:06:20,360 would be correct, like moo and blah. 90 00:06:20,740 --> 00:06:25,560 And then we would actually use the actual test that we want to perform and check the 91 00:06:25,560 --> 00:06:26,760 content between the two. 92 00:06:26,760 --> 00:06:29,480 And compare the content between those two requests. 93 00:06:29,720 --> 00:06:35,100 If the content are the same, then of course the file doesn't exist or the login attempt 94 00:06:35,100 --> 00:06:35,740 was unsuccessful. 95 00:06:36,260 --> 00:06:40,360 But if they differ, then we know we got a different page, which is interesting. 96 00:06:41,780 --> 00:06:44,760 So how does the content comparison algorithm really work? 97 00:06:44,880 --> 00:06:45,840 Sorry, I've got a question there. 98 00:06:45,880 --> 00:06:49,280 Can I take them at the end, because we're going to kind of, is that okay? 99 00:06:50,580 --> 00:06:52,760 I promise I won't forget you, sir. 100 00:06:53,220 --> 00:06:53,700 Okay. 101 00:06:53,860 --> 00:06:55,960 How does the content comparison work? 102 00:06:57,520 --> 00:06:58,460 Well, let's see. 103 00:06:58,540 --> 00:07:02,200 Step one, what we do is we crop the header, if we can. 104 00:07:02,960 --> 00:07:07,120 If there's nothing in the body, we use the header, because then that's all we have left. 105 00:07:08,300 --> 00:07:14,500 We split the strings, let's say we're comparing string A and B, we split string A and string 106 00:07:14,500 --> 00:07:19,580 B on new lines, on tag brackets, and on a space. 107 00:07:19,840 --> 00:07:24,220 And let's say we call that collection A, and that results in collection A and collection 108 00:07:24,220 --> 00:07:24,540 B. 109 00:07:24,680 --> 00:07:24,880 Okay. 110 00:07:26,760 --> 00:07:31,600 So we count all the blank items both in collection A and collection B, and we do a little loopy 111 00:07:31,600 --> 00:07:37,480 thing that says, you know, for every item in collection A, loop through all of the items 112 00:07:37,480 --> 00:07:42,780 in collection B, and if they are equal, increment the counter, and if you found a match within 113 00:07:42,780 --> 00:07:48,320 that, break out of the loop and look for the next thing that we want to match within those 114 00:07:48,320 --> 00:07:48,520 strings. 115 00:07:48,700 --> 00:07:54,160 And then what we return is we return two times the counter divided by the number of 116 00:07:54,160 --> 00:07:55,520 elements in collection A. 117 00:07:55,660 --> 00:07:56,100 Okay. 118 00:07:56,760 --> 00:07:58,940 So we end up with three elements in collection B minus the blanks. 119 00:08:00,500 --> 00:08:02,240 Now, this is what it looks like. 120 00:08:03,760 --> 00:08:05,820 So let's say I'm testing two strings. 121 00:08:06,200 --> 00:08:10,320 The first string is, I'm testing this, doodle sock-dook. 122 00:08:10,780 --> 00:08:13,980 And the second string is, I'm testing this karst krelikis. 123 00:08:14,640 --> 00:08:19,360 And collection A is, I'm testing this doodle sock-dook, and collection B is, I'm testing 124 00:08:19,360 --> 00:08:23,500 this karst krelikis, because now, we split and all those different things, right? 125 00:08:24,080 --> 00:08:26,740 And there's four words matching within the two strings. 126 00:08:26,740 --> 00:08:33,320 collections a blank count is zero and we have the number of items in collection a 127 00:08:33,320 --> 00:08:39,480 is five number of items in collection B is five so our return is 80% match 0.8 128 00:08:39,480 --> 00:08:47,040 if we have I'm I was testing and I am testing them them things then our return 129 00:08:47,040 --> 00:08:56,940 is two times the amount of words that match which is I and testing and we got 130 00:08:56,940 --> 00:09:01,200 a 50% match because we got eight words in total that's how easy it is it's 131 00:09:01,200 --> 00:09:09,900 nothing like super you know fuzzy neural networks it's just kind of easy okay so 132 00:09:09,900 --> 00:09:15,160 with this we have the ability to in crowbar set a level a fuzzy logic 133 00:09:15,160 --> 00:09:17,020 trigger level which is if it is a fuzzy logic trigger level which is if it is a 134 00:09:17,020 --> 00:09:23,780 below this particular level outside of that level of the compare then put that 135 00:09:23,780 --> 00:09:29,680 in your results okay you'll see how it works just now incredible we also did 136 00:09:29,680 --> 00:09:35,660 some content extraction so we for in this example for instance we we mining 137 00:09:35,660 --> 00:09:39,740 here the numbers that you see they circled if you can see them I know it's 138 00:09:39,740 --> 00:09:46,600 hard at the back you probably don't see a thing right okay then you'll see here 139 00:09:46,600 --> 00:09:47,000 what we doing so first we're going to make a circle that has a value of 140 00:09:47,000 --> 00:09:48,800 is we basically put in names into 141 00:09:48,800 --> 00:09:50,820 Google and our start token 142 00:09:50,820 --> 00:09:52,540 and end token is of about 143 00:09:52,540 --> 00:09:54,500 and the bold 144 00:09:54,500 --> 00:09:55,760 tag 145 00:09:56,480 --> 00:09:58,460 closing tag which means 146 00:09:58,460 --> 00:10:00,700 we're looking at what Google returns 147 00:10:00,700 --> 00:10:02,700 how many hits does Google returns on different 148 00:10:02,700 --> 00:10:04,700 names and you'll see here you got 149 00:10:04,700 --> 00:10:06,840 Peter has a hit count 150 00:10:06,840 --> 00:10:08,500 of 990 151 00:10:09,320 --> 00:10:10,560 million while 152 00:10:10,560 --> 00:10:11,620 someone like 153 00:10:12,820 --> 00:10:14,920 you know let's 154 00:10:14,920 --> 00:10:16,600 see Ada has 155 00:10:16,600 --> 00:10:18,800 a count of 124 156 00:10:18,800 --> 00:10:20,160 million and you might go 157 00:10:20,160 --> 00:10:22,660 I can write this and pull in like two 158 00:10:22,660 --> 00:10:24,720 lines of code but you'll see later why this 159 00:10:24,720 --> 00:10:25,280 is interesting 160 00:10:27,340 --> 00:10:28,500 now why does 161 00:10:28,500 --> 00:10:30,420 Wicto suck and it actually does suck 162 00:10:30,420 --> 00:10:31,220 right 163 00:10:33,140 --> 00:10:34,740 one of the features that we 164 00:10:34,740 --> 00:10:36,620 use in Wicto a lot a lot of people use it 165 00:10:36,620 --> 00:10:38,620 is the back end miner thing but what if the 166 00:10:38,620 --> 00:10:40,300 entire site sits in 167 00:10:40,300 --> 00:10:42,560 slash corp you know 168 00:10:42,560 --> 00:10:44,760 then we're not going to find any directories 169 00:10:44,760 --> 00:10:45,780 in slash corp right 170 00:10:45,780 --> 00:10:47,680 so one of the thinkings behind 171 00:10:47,680 --> 00:10:49,920 the mirroring option in Wicto 172 00:10:49,920 --> 00:10:51,360 was that you mirror the site first 173 00:10:51,360 --> 00:10:53,820 you get all the directories that exist on the 174 00:10:53,820 --> 00:10:55,720 site you load it back into the back 175 00:10:55,720 --> 00:10:57,740 end miner and then you search within those 176 00:10:57,740 --> 00:10:59,220 directories for other interesting 177 00:10:59,220 --> 00:11:00,300 directories correct 178 00:11:01,320 --> 00:11:02,920 but what if the site 179 00:11:03,440 --> 00:11:04,740 has a form based login 180 00:11:05,240 --> 00:11:07,300 so there's a username password field 181 00:11:07,300 --> 00:11:09,580 and the whole site sits behind 182 00:11:09,580 --> 00:11:10,340 that then what 183 00:11:11,700 --> 00:11:13,320 well that's why Wicto sucks 184 00:11:13,320 --> 00:11:14,880 because it can't know that 185 00:11:14,880 --> 00:11:16,540 It doesn't know what to do. 186 00:11:17,520 --> 00:11:24,500 It doesn't do any fancy stuff like looking at directories within directories if the directory name isn't in the list. 187 00:11:25,200 --> 00:11:33,380 And so at the end of the day, we say, or I say, Wicto is a blind chicken pecking away at dirt. 188 00:11:34,780 --> 00:11:35,300 Yes. 189 00:11:37,660 --> 00:11:38,180 Okay. 190 00:11:38,980 --> 00:11:40,600 We also have a problem with this. 191 00:11:40,680 --> 00:11:44,380 We can't see when there's, let's say we look for a file. 192 00:11:44,880 --> 00:11:49,180 We see that a file has been served to login.asp sitting somewhere. 193 00:11:50,060 --> 00:11:57,420 Wouldn't it be nice if in that directory we also looked for something like login.zip and login.bat and login.asp tilde? 194 00:11:57,740 --> 00:12:01,420 Well, it wouldn't be login.asp tilde, but, you know, you get the idea. 195 00:12:01,620 --> 00:12:03,120 So we start looking for other extensions. 196 00:12:05,600 --> 00:12:11,760 That's just one of the things that we can do very easily if we sit in line with that, in a proxy, 197 00:12:11,840 --> 00:12:14,860 that we sit in line with the request and we can see what request has been sent. 198 00:12:14,880 --> 00:12:18,340 We can also do fuzzing with Tsuru. 199 00:12:18,900 --> 00:12:19,440 Okay? 200 00:12:20,320 --> 00:12:21,700 Is it something I said? 201 00:12:22,260 --> 00:12:22,800 Sorry. 202 00:12:24,280 --> 00:12:31,580 If we have a content comparison algorithm, then what we can do is we can send junk into different parameters, right? 203 00:12:31,860 --> 00:12:35,100 And send, like, let's say a thousand different strings. 204 00:12:35,400 --> 00:12:37,720 A thousand different strings in one parameter. 205 00:12:37,900 --> 00:12:40,060 See how it reacts? 206 00:12:40,500 --> 00:12:44,380 And look at the content compared to a base response. 207 00:12:46,060 --> 00:12:46,480 Right? 208 00:12:46,620 --> 00:12:48,240 And group responses together. 209 00:12:49,020 --> 00:12:55,640 So that we say, for a thousand requests that I've done to this application, I only get three pages as a result. 210 00:12:57,160 --> 00:12:58,680 So I'm going to show you how that works. 211 00:13:02,520 --> 00:13:05,140 So I'm going to try to keep the mic here as well. 212 00:13:05,360 --> 00:13:07,780 So here we've got this little site. 213 00:13:08,720 --> 00:13:10,900 I can log in there, test, and test. 214 00:13:12,140 --> 00:13:13,500 And you can see that it failed. 215 00:13:15,340 --> 00:13:20,680 And if we go to Tsuru, this is why I said you should sit close because, you know, that's a small font. 216 00:13:23,280 --> 00:13:25,160 Now you can see here there's a request. 217 00:13:25,300 --> 00:13:25,900 It's a post. 218 00:13:26,000 --> 00:13:27,620 It resulted in a 200 okay. 219 00:13:27,900 --> 00:13:29,160 It's got three parameters. 220 00:13:29,740 --> 00:13:31,020 I double click on it. 221 00:13:31,560 --> 00:13:36,900 And it basically shows me this request editor that I will keep still anytime soon. 222 00:13:37,500 --> 00:13:44,100 And I can say, okay, take the username parameter and fuzz it with all of the strings that I have. 223 00:13:45,160 --> 00:13:45,600 Okay. 224 00:13:45,940 --> 00:13:46,980 That's just the file. 225 00:13:48,160 --> 00:13:48,600 Okay. 226 00:13:48,680 --> 00:13:55,560 The file sits, the file simply sits in the, let's see what's happening, getting base response. 227 00:13:56,140 --> 00:13:56,580 Okay. 228 00:13:56,680 --> 00:13:59,780 The file simply sits in here in a config. 229 00:14:01,260 --> 00:14:03,040 So I can actually go to that file. 230 00:14:03,720 --> 00:14:06,000 And I can edit the file here right on the fly. 231 00:14:06,080 --> 00:14:11,680 It's just a text file with all of the type of strings that I want to test against this thing. 232 00:14:14,020 --> 00:14:14,460 Okay. 233 00:14:14,460 --> 00:14:18,560 And I just want to see why I'm not getting to it right now. 234 00:14:28,360 --> 00:14:29,200 Oh, there we go. 235 00:14:30,120 --> 00:14:37,200 And there on the right-hand side, you will see that it starts to actually do all of those requests to the server. 236 00:14:38,280 --> 00:14:43,520 I can then go and I can say, well, group the responses with the tolerance of 0.02. 237 00:14:43,520 --> 00:14:45,920 That 0.02 is just the ob number. 238 00:14:46,260 --> 00:14:50,540 Remember, a thing that matches completely yields a 1. 239 00:14:50,740 --> 00:14:52,780 Something that doesn't match at all yields a 0. 240 00:14:53,760 --> 00:14:54,240 Okay. 241 00:14:54,320 --> 00:15:00,220 So with the tolerance of 0.02 between different requests, group those responses. 242 00:15:00,560 --> 00:15:01,960 So I'm going to click on auto group. 243 00:15:02,420 --> 00:15:07,360 And even at the back, you should be able to see that we get three different responses. 244 00:15:07,980 --> 00:15:10,700 There are three different unique responses. 245 00:15:10,920 --> 00:15:12,800 Let's look at the responses that that generated. 246 00:15:12,800 --> 00:15:19,120 I can browse the request immediately there for all of those. 247 00:15:19,520 --> 00:15:22,060 And that is basically a CGI error that I get. 248 00:15:22,120 --> 00:15:23,400 Standard CGI error, right? 249 00:15:23,780 --> 00:15:28,140 That's one group of requests that I've made that resulted in this CGI error. 250 00:15:30,660 --> 00:15:35,340 This one over here, if I click on it, you'll see it gets to login failed. 251 00:15:35,440 --> 00:15:36,160 Please try again. 252 00:15:36,700 --> 00:15:40,480 Which is what happens when I put anything in there that doesn't work. 253 00:15:40,920 --> 00:15:42,700 Over here, you'll see there's one request. 254 00:15:44,560 --> 00:15:46,740 That got a totally different response. 255 00:15:47,100 --> 00:15:51,340 And that is standard SQL injection, single quote, or 1 equals 1 dash dash. 256 00:15:51,960 --> 00:15:57,720 If I browse that response, you can see that that gives me access to the application itself. 257 00:16:00,540 --> 00:16:01,060 Okay. 258 00:16:01,100 --> 00:16:05,120 So clearly, I can test with any strings that I want. 259 00:16:05,520 --> 00:16:10,140 And I can basically say, show me how the application behaves in different ways. 260 00:16:10,240 --> 00:16:12,520 This application can behave in three different ways. 261 00:16:12,520 --> 00:16:16,100 Whenever I send, you know, junk into the username field. 262 00:16:18,380 --> 00:16:26,220 On the recon side of things, if I set my target to be intranet.postsense.net, I do directory mining. 263 00:16:26,460 --> 00:16:30,040 I put on directory smart scanning and file smart scanning. 264 00:16:30,420 --> 00:16:32,580 I clear everything and I manually reload. 265 00:16:33,380 --> 00:16:37,960 You'll see that it's now got 118, 117 jobs that it has to perform. 266 00:16:38,080 --> 00:16:39,000 And I can set the speed. 267 00:16:39,140 --> 00:16:41,280 These are recon jobs that it's performing. 268 00:16:41,280 --> 00:16:46,820 I can set the speed at which this thing is basically running on this side over here. 269 00:16:47,760 --> 00:16:48,240 Okay. 270 00:16:48,360 --> 00:16:55,340 Because maybe I don't want to have this reconnaissance process while it's trying to find these files interfere with my browsing experience. 271 00:16:55,640 --> 00:16:55,840 Right? 272 00:16:56,240 --> 00:17:04,100 Because if you're flatlining this thing and it's starting to look at files, then you can fully understand that your link is going to get saturated. 273 00:17:04,520 --> 00:17:08,180 Well, in South Africa, our links get saturated by things like this. 274 00:17:08,540 --> 00:17:09,020 Okay. 275 00:17:09,420 --> 00:17:11,260 So I can up this a little bit. 276 00:17:11,280 --> 00:17:15,000 Make it a little bit faster. 277 00:17:19,140 --> 00:17:22,280 Over here, you can see the structure of the site so far that we've seen. 278 00:17:25,480 --> 00:17:28,820 Our VMware is not responding very well at this stage. 279 00:17:30,960 --> 00:17:32,060 There we go. 280 00:17:37,080 --> 00:17:41,260 We also have on this tab over here, we've got a little bit more information. 281 00:17:41,260 --> 00:17:42,260 We've got miscellaneous tools. 282 00:17:42,380 --> 00:17:53,460 So you've got a one-click convert from your user input, the word sense post to MD5, to hex, to SHA1, base64 encode, base64 decode, all of those kind of things. 283 00:17:54,440 --> 00:17:57,900 You've got a search and replace on the outgoing, search and replace on the incoming. 284 00:18:00,660 --> 00:18:02,100 Just want to see what's happening over here. 285 00:18:02,140 --> 00:18:03,300 So I'm going to leave this for a bit. 286 00:18:03,520 --> 00:18:06,700 We'll get back to this as soon as it's done. 287 00:18:13,320 --> 00:18:13,760 Okay. 288 00:18:13,980 --> 00:18:15,200 Is this where I was? 289 00:18:15,320 --> 00:18:15,960 I hope so. 290 00:18:16,360 --> 00:18:16,800 Okay. 291 00:18:18,440 --> 00:18:22,060 So there you can see actually what we've done with the request editor. 292 00:18:22,260 --> 00:18:25,000 We see the different requests being broken up into different parts. 293 00:18:26,940 --> 00:18:34,040 And we can pause the request, nicely break it up into its different parts, and let the user select exactly what part he wants to fuzz. 294 00:18:34,400 --> 00:18:37,420 You can also fuzz anything within the HTTP request. 295 00:18:37,620 --> 00:18:41,240 So in this case here, you'll see what I've encircled there. 296 00:18:41,240 --> 00:18:43,380 There's the user agent. 297 00:18:44,820 --> 00:18:54,360 So I can fuzz the user agent, see how the application would respond to different user agents that I'm sending in. 298 00:18:54,700 --> 00:19:02,160 Maybe if it's a mobile application, it would look differently when my user agent is set to that of a mobile phone. 299 00:19:03,020 --> 00:19:06,700 We can also extract anything from the reply that comes back. 300 00:19:07,200 --> 00:19:11,220 In this case here, we're always extracting by default the title that comes back. 301 00:19:15,320 --> 00:19:21,440 Other things why Suru is nice, we have a thing called automatic relationship discovery. 302 00:19:22,440 --> 00:19:25,760 So for instance, well, let me first tell you what it is. 303 00:19:25,940 --> 00:19:31,020 So it basically looks at every parameter that you send into the system at any time. 304 00:19:31,700 --> 00:19:40,340 And it then, in real time, works out the SHA-1 hash, the MD5 hash, base64 encode, base64 decode, 305 00:19:40,360 --> 00:19:41,220 of every parameter. 306 00:19:41,240 --> 00:19:42,940 And puts that into a structure. 307 00:19:43,380 --> 00:19:47,500 And when you click on the auto relationship discovery button, 308 00:19:47,720 --> 00:19:50,180 it basically goes through all of the parameters that you've set, 309 00:19:50,360 --> 00:19:52,860 plus all of the derivatives of those parameters, 310 00:19:53,100 --> 00:19:54,620 and see if there's any kind of match. 311 00:19:54,960 --> 00:19:57,040 Why would it want to do that? 312 00:19:57,700 --> 00:20:00,080 For instance, if we log into an application, 313 00:20:00,260 --> 00:20:06,200 and let's say, as a cookie, we get sent back the MD5 of, let's say, the username, 314 00:20:06,380 --> 00:20:08,600 which is really a bad idea, right? 315 00:20:10,300 --> 00:20:15,080 Then this tool will tell us, Suru will tell us, listen, those two things match. 316 00:20:15,280 --> 00:20:19,180 The MD5 of the username is actually the cookie. 317 00:20:19,780 --> 00:20:22,800 Now imagine you're testing an application with 300, 400 pages. 318 00:20:24,080 --> 00:20:27,360 That's useful, because you're not going to keep track of all the parameters 319 00:20:27,360 --> 00:20:28,760 and everything that goes through, right? 320 00:20:30,400 --> 00:20:34,200 We also have search and replace on both incoming and outgoing streams, 321 00:20:34,400 --> 00:20:37,540 with the ability to change binary data. 322 00:20:38,600 --> 00:20:41,200 So what you see there is the picture of Google, 323 00:20:41,360 --> 00:20:43,220 the little Google picture thingy. 324 00:20:43,900 --> 00:20:49,700 When we've replaced binary hex 03 to hex 30, 325 00:20:50,360 --> 00:20:52,560 and that's going to screw around with the picture, right? 326 00:20:52,640 --> 00:20:57,080 Because those are things that's contained in the binary stream that's coming into you. 327 00:20:59,620 --> 00:21:04,180 Other reasons why Suru is really nice, it's really usable. 328 00:21:04,520 --> 00:21:06,900 We've really tried to make it super usable. 329 00:21:07,060 --> 00:21:08,240 So it uses IE. 330 00:21:08,600 --> 00:21:11,220 It's an IE browser object to replay requests. 331 00:21:11,700 --> 00:21:13,640 So you don't have issues with authentication, 332 00:21:14,820 --> 00:21:18,800 or, you know, digest authentication, NTLM authentication, those kind of things. 333 00:21:19,920 --> 00:21:23,500 We can instantly replay requests while we're busy with it. 334 00:21:24,120 --> 00:21:26,980 And we can keep track of requests that we played back, 335 00:21:27,160 --> 00:21:29,240 because it marks the request and says, 336 00:21:29,320 --> 00:21:32,480 this is a request that you edited and played back to the system. 337 00:21:33,320 --> 00:21:37,760 Something that was quite interesting to handle was XML and multi-part posts. 338 00:21:38,600 --> 00:21:41,100 Multi-part posts are nasty, nasty little things. 339 00:21:41,480 --> 00:21:44,140 It also handles multi-part posts very nicely, 340 00:21:44,280 --> 00:21:45,860 handles XML very nicely. 341 00:21:46,320 --> 00:21:47,320 Where do we see XML? 342 00:21:47,480 --> 00:21:48,800 We see it with web services, right? 343 00:21:48,880 --> 00:21:53,720 So if you have a thick application that is using a web service over SOAP, 344 00:21:53,820 --> 00:21:56,580 then you're going to see those XML coming into Suru as well. 345 00:21:56,660 --> 00:21:57,740 So it renders it nicely. 346 00:21:57,860 --> 00:21:59,880 You can edit the stuff, that kind of thing. 347 00:22:00,140 --> 00:22:01,580 You can save and load sessions. 348 00:22:02,720 --> 00:22:04,180 So you can work on something, say, 349 00:22:04,280 --> 00:22:06,800 whoa, whoa, whoa, I want to save this and I want to come back to it later. 350 00:22:06,900 --> 00:22:08,180 You can save it, load it, it's nice. 351 00:22:08,600 --> 00:22:11,060 You can instantly fuzz any variable, as you've seen. 352 00:22:12,120 --> 00:22:15,580 You can fuzz any part of the HTTP header. 353 00:22:15,720 --> 00:22:18,320 Those fuzz strings that you have, you can keep it in a file. 354 00:22:18,760 --> 00:22:21,800 So it's not limited to someone's fuzz strings 355 00:22:21,800 --> 00:22:23,820 that they decided to give with the application. 356 00:22:24,100 --> 00:22:26,560 You just add on top of them whatever you want, 357 00:22:26,720 --> 00:22:28,780 and it will always pull it out and tell you, 358 00:22:31,120 --> 00:22:32,940 the application responded differently 359 00:22:32,940 --> 00:22:35,820 when you set this particular parameter in there. 360 00:22:37,480 --> 00:22:38,340 You have access. 361 00:22:38,600 --> 00:22:40,680 You have instant access to the HTTP raw request, 362 00:22:40,800 --> 00:22:43,560 which means you can go to that main window. 363 00:22:43,800 --> 00:22:46,160 You can add anything in the middle window right there, 364 00:22:46,320 --> 00:22:48,120 a post, a get, doesn't matter what it is. 365 00:22:48,280 --> 00:22:51,380 You can send it to the browser, 366 00:22:51,480 --> 00:22:54,880 or you can send a raw response, a raw request, 367 00:22:55,100 --> 00:22:58,100 and it will automatically calculate the content length for you. 368 00:22:58,200 --> 00:22:59,160 So you don't have to do that. 369 00:22:59,360 --> 00:23:01,880 So that's useful in certain cases, right? 370 00:23:04,940 --> 00:23:07,820 We got one-click directory mining, all of that kind of things. 371 00:23:07,820 --> 00:23:09,560 So you've seen all of those kind of things. 372 00:23:10,420 --> 00:23:12,120 Let's go back and see what's happening. 373 00:23:13,280 --> 00:23:15,740 It's not very, it doesn't look very promising. 374 00:23:16,240 --> 00:23:17,080 Let's switch back. 375 00:23:19,500 --> 00:23:21,840 Getting the demo kind of gremlins. 376 00:23:22,140 --> 00:23:26,320 I did this thing outside five minutes ago, 377 00:23:26,480 --> 00:23:29,900 but it's the Zen energy in the room that's just wrong. 378 00:23:30,900 --> 00:23:31,760 Okay, nice. 379 00:23:32,860 --> 00:23:35,700 It's a very nice new man-in-the-middle proxy. 380 00:23:35,700 --> 00:23:39,540 It allows the analyst the freedom of thought, 381 00:23:39,720 --> 00:23:41,880 so you can still control exactly what you want, 382 00:23:42,080 --> 00:23:45,560 but it automates the parts of the application assessment 383 00:23:45,560 --> 00:23:47,120 that's really mundane and boring. 384 00:23:47,860 --> 00:23:52,440 It's really a good combination between the best features of Wicto, 385 00:23:52,440 --> 00:23:54,940 Crowbar, and EO, and a really useful proxy. 386 00:23:56,920 --> 00:23:59,040 If you're new to application assessment, 387 00:23:59,220 --> 00:24:01,840 if you're new to web application assessment work, 388 00:24:02,020 --> 00:24:03,900 then I suggest you start off with something 389 00:24:03,900 --> 00:24:05,680 that's a little bit less complex. 390 00:24:05,700 --> 00:24:10,020 As my colleague told me when he saw this the first time, 391 00:24:10,100 --> 00:24:12,540 he says, this looks like the control console of a Boeing. 392 00:24:13,520 --> 00:24:17,680 So it's not that friendly for first-time users, 393 00:24:18,620 --> 00:24:21,300 but as you get used to the other proxies, 394 00:24:21,340 --> 00:24:22,900 you'll find that they have certain limitations, 395 00:24:25,520 --> 00:24:27,540 and you want to use something like this 396 00:24:27,540 --> 00:24:28,760 to overcome those limitations. 397 00:24:29,180 --> 00:24:31,640 When you get to that stage, you might want to switch over. 398 00:24:32,740 --> 00:24:34,680 It was written in-house by ourselves, 399 00:24:34,680 --> 00:24:40,260 and we do hundreds and hundreds of web application tests every year, 400 00:24:40,380 --> 00:24:45,420 so it was written by people that actually is doing web application testing, 401 00:24:46,120 --> 00:24:49,500 and therefore the interface and the way that it works 402 00:24:50,220 --> 00:24:52,820 is geared towards people that actually have to do the work 403 00:24:52,820 --> 00:24:54,240 and not by people that can program. 404 00:24:54,640 --> 00:24:57,200 That's probably why you don't see the results on the other page. 405 00:25:00,220 --> 00:25:03,380 The URL at the bottom there, if you want to write it down, 406 00:25:04,860 --> 00:25:07,720 tripwsensepost.com slash research slash suru, 407 00:25:08,600 --> 00:25:13,020 and this is the stage where I hand you over to my beautiful assistant 408 00:25:13,020 --> 00:25:15,000 and colleague, Haroon, 409 00:25:16,480 --> 00:25:17,860 and I'm going to switch over here. 410 00:25:17,920 --> 00:25:18,720 Let's see if it works. 411 00:25:22,380 --> 00:25:24,000 Okay, thanks for the sound effects. 412 00:25:24,520 --> 00:25:27,440 My voice is a little bit scratchy for no good reason. 413 00:25:27,540 --> 00:25:29,020 I didn't go big last night, 414 00:25:29,060 --> 00:25:31,180 unlike some of the guys I spoke to earlier, 415 00:25:31,800 --> 00:25:33,360 so you're just going to have to forgive me. 416 00:25:34,000 --> 00:25:35,980 For something completely different, 417 00:25:36,240 --> 00:25:40,500 what we're going to talk about now is a tool called LR, 418 00:25:41,320 --> 00:25:44,200 largely because we never got around to naming it 419 00:25:44,200 --> 00:25:45,960 because it's not that packaged a tool. 420 00:25:47,140 --> 00:25:49,500 LR is a generic TCP proxy 421 00:25:49,500 --> 00:25:53,040 where LR at the moment starts for last resort. 422 00:25:53,280 --> 00:25:55,060 You've used all the tools you can, 423 00:25:55,200 --> 00:25:56,940 and nothing seems to be doing it for you. 424 00:25:57,460 --> 00:25:59,020 We fall back to LR. 425 00:25:59,820 --> 00:26:01,140 A quick background. 426 00:26:01,980 --> 00:26:03,020 Suru is neat. 427 00:26:03,380 --> 00:26:04,140 It's neat and well packaged 428 00:26:04,140 --> 00:26:06,860 and has a shiny C-sharp interface. 429 00:26:07,240 --> 00:26:11,580 It's even got something like 62 pages of documentation, I believe, 430 00:26:12,580 --> 00:26:13,720 and videos. 431 00:26:14,080 --> 00:26:16,120 Ross just corrected the number, but I'm going to skip it. 432 00:26:17,280 --> 00:26:19,100 Suru is neat and well packaged, 433 00:26:19,320 --> 00:26:21,000 and LR is not. 434 00:26:22,040 --> 00:26:25,460 LR is a collection of other people's cool tools 435 00:26:26,190 --> 00:26:28,240 tied together with some duct tape, 436 00:26:28,420 --> 00:26:30,680 which in this case happens to be Python. 437 00:26:31,800 --> 00:26:33,160 I'll say at the outset, 438 00:26:33,420 --> 00:26:36,200 almost everything that you can do with LR 439 00:26:36,200 --> 00:26:39,820 you can get by using a combination of other tools. 440 00:26:41,680 --> 00:26:46,800 The truth of it is that LR just makes it convenient for you, 441 00:26:46,880 --> 00:26:48,380 and we'll go into why I did it anyway. 442 00:26:49,160 --> 00:26:51,140 What does the whole thing mean? 443 00:26:51,700 --> 00:26:54,140 The first thing it means is that clearly 444 00:26:54,140 --> 00:26:56,760 I have no future in sales or marketing. 445 00:26:58,080 --> 00:27:00,580 The second thing, really quickly, 446 00:27:00,580 --> 00:27:03,560 someday LR will grow up 447 00:27:03,560 --> 00:27:06,860 and become a neat, shiny Suru-like thing 448 00:27:06,860 --> 00:27:08,820 for genetic TCP connections. 449 00:27:09,740 --> 00:27:13,140 Today, what it is is a bunch of really simple scripts 450 00:27:13,140 --> 00:27:16,280 that allow you to modify TCP packets 451 00:27:16,280 --> 00:27:20,440 kind of in the same way that Suru allows you to alter HTTP. 452 00:27:22,560 --> 00:27:27,380 There's very little or no cleverness in LR that belongs to me. 453 00:27:27,520 --> 00:27:30,460 It's built on top of two much cleverer projects. 454 00:27:30,580 --> 00:27:33,840 One of which is Philippe Biondi's SCAPI, 455 00:27:34,380 --> 00:27:36,880 and the other is Neil Pickett's IPQ. 456 00:27:38,080 --> 00:27:39,460 We wrote it in Python 457 00:27:39,460 --> 00:27:41,680 just because all the cool kids were doing it. 458 00:27:42,120 --> 00:27:43,340 It was peer pressure. 459 00:27:45,440 --> 00:27:48,380 The question for why we actually did it, 460 00:27:48,500 --> 00:27:51,640 one of the reasons that I don't have up on the board there 461 00:27:51,640 --> 00:27:54,500 is just because we had this idea and wanted to play with it. 462 00:27:54,700 --> 00:27:56,320 We wanted to see if it would work. 463 00:27:57,100 --> 00:27:58,880 One of the other reasons was because 464 00:27:58,880 --> 00:28:01,420 there's lots of limitations in current tools 465 00:28:01,420 --> 00:28:04,240 that get annoying when you just want to get something sorted. 466 00:28:05,200 --> 00:28:07,900 We also wanted to take a look at how simple 467 00:28:08,580 --> 00:28:12,320 something that to date has been pretty complex actually can be. 468 00:28:12,980 --> 00:28:15,480 We end up with a pretty simple framework 469 00:28:15,480 --> 00:28:17,960 for you to be able to do this, and hopefully you'll see it. 470 00:28:19,560 --> 00:28:22,080 Pretty much it was just to go into the possibilities. 471 00:28:22,240 --> 00:28:24,160 Some of the stuff that you can get right 472 00:28:24,660 --> 00:28:27,020 once you're in the position to mangle TCP packets 473 00:28:27,020 --> 00:28:28,300 before sending them on. 474 00:28:30,520 --> 00:28:32,980 One of the first questions you get 475 00:28:32,980 --> 00:28:35,220 are someone saying, what about ITR? 476 00:28:35,260 --> 00:28:36,320 What about NGREP? 477 00:28:36,520 --> 00:28:39,100 What about insert tool that they've been using until now? 478 00:28:39,960 --> 00:28:42,040 Lots of those tools are okay. 479 00:28:42,740 --> 00:28:45,620 All of them that I've seen require you 480 00:28:45,620 --> 00:28:49,380 to point your server towards the proxy. 481 00:28:49,720 --> 00:28:53,060 You make ITR your server, you connect to it, 482 00:28:53,200 --> 00:28:54,760 it connects to the real server. 483 00:28:55,960 --> 00:28:58,440 That's pretty okay, but in some instances, 484 00:28:58,440 --> 00:28:59,500 this becomes a problem. 485 00:28:59,660 --> 00:29:01,800 For example, when you're doing some malware analysis. 486 00:29:02,400 --> 00:29:05,580 What you really want to do is sit in line, 487 00:29:05,760 --> 00:29:07,780 watch the request go through, say, 488 00:29:07,940 --> 00:29:09,520 I want to mangle this now. 489 00:29:09,720 --> 00:29:12,400 I see this DNS request going out. 490 00:29:12,520 --> 00:29:14,460 I want to give it an arbitrary response. 491 00:29:14,880 --> 00:29:16,640 Or I see this request for a file. 492 00:29:16,800 --> 00:29:18,060 I want to give it another file. 493 00:29:19,700 --> 00:29:21,720 Lots of them are closed source, 494 00:29:21,920 --> 00:29:25,020 and lots of them require some hardcore packet foo. 495 00:29:25,020 --> 00:29:30,720 If you take a look at anything written in libnet or libdnet, 496 00:29:30,900 --> 00:29:33,860 those are great products, great tool sets. 497 00:29:34,440 --> 00:29:37,240 You're going to end up using several hundred lines 498 00:29:37,240 --> 00:29:39,020 before you send out a few packets. 499 00:29:39,640 --> 00:29:43,180 We were going for really simple, really quick and easy. 500 00:29:44,540 --> 00:29:47,720 Ultimately, we wanted you to be able to modify packets 501 00:29:47,720 --> 00:29:49,760 and payloads as they go through, 502 00:29:49,900 --> 00:29:53,860 and for you to be able to do them within complex sequences. 503 00:29:55,020 --> 00:29:57,140 Maybe you don't want to change every packet. 504 00:29:57,300 --> 00:29:59,100 Maybe you want to change the tenth packet 505 00:29:59,100 --> 00:30:01,400 if the day of the week starts with W. 506 00:30:02,320 --> 00:30:05,600 Basically, we wanted you to sit in a comfortable scripting environment 507 00:30:05,600 --> 00:30:08,880 and say, I want to change X, I want to change Y, 508 00:30:09,100 --> 00:30:10,640 and go forward from there. 509 00:30:11,740 --> 00:30:13,720 We wanted to do it really quickly 510 00:30:13,720 --> 00:30:15,960 because we've got more important things to do, 511 00:30:16,020 --> 00:30:18,620 like retain our title as Office Minesweeper Champion. 512 00:30:21,640 --> 00:30:24,960 How it currently works is really simple. 513 00:30:25,020 --> 00:30:30,520 At the moment, it's sitting on top of IPQ or IPDivert. 514 00:30:31,080 --> 00:30:33,920 All that happens there is we've got a firewall rule 515 00:30:33,920 --> 00:30:36,760 that grabs the packet as it goes onto the network 516 00:30:36,760 --> 00:30:39,060 and moves it to a user space process. 517 00:30:40,320 --> 00:30:42,020 Once it's in user space, 518 00:30:42,260 --> 00:30:44,980 we then use Python and SCAPI specifically 519 00:30:44,980 --> 00:30:46,760 to mangle the packet. 520 00:30:47,520 --> 00:30:52,480 Neil Pickett's IPQ is allowing us to grab this packet off the IPQ, 521 00:30:52,600 --> 00:30:54,560 and SCAPI is then allowing us 522 00:30:54,560 --> 00:30:57,360 to say what that packet is and what we can do with it. 523 00:30:58,720 --> 00:31:01,200 Really quickly, if I'm going to do this, 524 00:31:01,360 --> 00:31:04,200 it's only fair that we pay homage to SCAPI. 525 00:31:05,800 --> 00:31:09,540 SCAPI is available at secdev.org by Philippe Biondi. 526 00:31:10,500 --> 00:31:13,360 It's by far currently the easiest way, 527 00:31:13,480 --> 00:31:15,580 most convenient way to generate packets. 528 00:31:16,720 --> 00:31:20,800 This year it was 28 on Fyodor's top 100 security tools, 529 00:31:21,400 --> 00:31:24,260 which means that most people have yet to discover 530 00:31:24,560 --> 00:31:25,520 how cool SCAPI is. 531 00:31:26,180 --> 00:31:29,280 If you haven't used SCAPI, I'd advise it. 532 00:31:29,380 --> 00:31:32,180 Go play with it. It's really worth the effort. 533 00:31:33,120 --> 00:31:36,800 These two quick examples stolen from Philippe's slides 534 00:31:36,800 --> 00:31:40,480 that he gave earlier this year shows that creating a packet 535 00:31:40,480 --> 00:31:42,060 is simply a case of saying, 536 00:31:42,240 --> 00:31:46,120 I want IP destination this, ID this, TTL this, 537 00:31:46,360 --> 00:31:48,140 make me a packet and send it. 538 00:31:48,940 --> 00:31:51,660 In his slides he says he wants the equivalent 539 00:31:51,660 --> 00:31:53,860 of you ordering fast food. 540 00:31:54,560 --> 00:31:56,200 You should be able to say, I want a burger, 541 00:31:56,380 --> 00:31:59,720 extra onions, whole the cheese, make it now. 542 00:32:00,600 --> 00:32:03,740 What you see down there is an example of the land attack, 543 00:32:05,000 --> 00:32:07,220 famous for old IR Sears. 544 00:32:08,400 --> 00:32:10,980 Literally what used to be a few lines of code 545 00:32:10,980 --> 00:32:13,560 is now a one line SCAPI script. 546 00:32:16,900 --> 00:32:20,320 Quickly, SPLR is going to grab the packet through IPQ, 547 00:32:20,960 --> 00:32:23,400 then decode the packet using SCAPI, 548 00:32:24,040 --> 00:32:25,820 mangle the packet using SCAPI, 549 00:32:25,900 --> 00:32:28,900 and then put it back on the wire using IPQ again. 550 00:32:29,360 --> 00:32:31,560 You understand why I say the heavy lifting 551 00:32:31,560 --> 00:32:32,760 is done by other people. 552 00:32:34,120 --> 00:32:36,260 At this point, we were supposed to give you 553 00:32:36,260 --> 00:32:38,360 a live example of this on the internet, 554 00:32:38,540 --> 00:32:40,680 which we can't because we have no internet, 555 00:32:40,880 --> 00:32:42,680 but we've got several other examples 556 00:32:42,680 --> 00:32:44,580 that work locally on VMs. 557 00:32:45,520 --> 00:32:46,960 For this first example, 558 00:32:47,100 --> 00:32:48,580 which you're just going to have to trust me for, 559 00:32:49,420 --> 00:32:53,080 we do a simple Google search replacing a search 560 00:32:53,400 --> 00:32:55,040 for foo with a search for bar. 561 00:32:55,500 --> 00:32:58,880 At this point, you should be saying 562 00:32:58,880 --> 00:33:01,540 that's a pretty easy packet modification to make 563 00:33:01,540 --> 00:33:04,120 because we haven't altered the payload size. 564 00:33:04,640 --> 00:33:08,040 As long as you're not altering the payload size of the packet, 565 00:33:09,100 --> 00:33:11,220 modifications are a pretty straightforward thing to do. 566 00:33:12,000 --> 00:33:15,960 Then you get bitten as soon as you change your TCP packet payload 567 00:33:15,960 --> 00:33:19,800 with new checksums and with sequence numbers. 568 00:33:19,800 --> 00:33:22,440 One of the things you bump into here 569 00:33:22,440 --> 00:33:26,440 is a common misconception about TCP sequence numbers. 570 00:33:26,740 --> 00:33:28,360 I'm not sure where this started, 571 00:33:28,560 --> 00:33:30,200 but there's actually text on the internet. 572 00:33:30,400 --> 00:33:32,240 You even see it wrong in some books, 573 00:33:33,020 --> 00:33:36,060 which basically describe the TCP flow that says 574 00:33:36,940 --> 00:33:40,820 the sender sets his initial sequence number to something, 575 00:33:41,160 --> 00:33:44,520 sends a packet, which in this case is five As, 576 00:33:45,260 --> 00:33:47,740 and what you find in incorrect text 577 00:33:47,740 --> 00:33:49,620 is that the receiver, 578 00:33:49,800 --> 00:33:52,120 then adds one to the sequence number 579 00:33:52,120 --> 00:33:53,860 and sends the packet back. 580 00:33:54,360 --> 00:33:56,260 Clearly this is incorrect. 581 00:33:56,680 --> 00:34:00,520 Your receiver doesn't just add one to the sequence number. 582 00:34:00,880 --> 00:34:04,000 The receiver adds the number of bytes of data 583 00:34:04,000 --> 00:34:05,440 that he received in the payload 584 00:34:05,440 --> 00:34:08,000 and increments that to the sequence number, 585 00:34:08,160 --> 00:34:09,500 sending it back to the sender. 586 00:34:09,960 --> 00:34:11,540 He tells the sender, 587 00:34:11,580 --> 00:34:14,560 this is how many bytes of data I received from you 588 00:34:14,560 --> 00:34:16,480 since your sequence number. 589 00:34:17,600 --> 00:34:19,780 Why this causes a problem 590 00:34:19,800 --> 00:34:23,120 for us when we're doing arbitrary changing 591 00:34:23,660 --> 00:34:25,860 is because you're creating a desync 592 00:34:25,860 --> 00:34:27,560 between the client and the server. 593 00:34:28,220 --> 00:34:30,400 We'll have to find a way around that. 594 00:34:31,180 --> 00:34:32,760 It puts us in the position 595 00:34:32,760 --> 00:34:35,340 to do a classic man-in-the-middle attack. 596 00:34:36,280 --> 00:34:39,720 All we do is sit in the middle of this TCP stream 597 00:34:39,720 --> 00:34:43,120 and don't let sequence number or act numbers 598 00:34:43,120 --> 00:34:45,220 go through as they want to. 599 00:34:46,000 --> 00:34:48,480 The client sends through his sequence number, 600 00:34:49,800 --> 00:34:50,140 then sends the request. 601 00:34:50,140 --> 00:34:51,400 If you take a look at this example, 602 00:34:51,560 --> 00:34:54,280 I have to tell you this photograph here 603 00:34:54,280 --> 00:34:55,400 is completely arbitrary 604 00:34:55,400 --> 00:34:56,920 and has nothing to do with the presentation. 605 00:34:58,180 --> 00:35:01,480 I asked someone at work to do this Visio for me 606 00:35:01,480 --> 00:35:04,000 and he said he would do it if I gave him mad props. 607 00:35:05,500 --> 00:35:06,760 I'm not sure if this counts, 608 00:35:06,880 --> 00:35:09,580 but that's Shal getting mad props 609 00:35:09,580 --> 00:35:10,540 because of his Visio. 610 00:35:13,560 --> 00:35:14,820 At this point, 611 00:35:14,860 --> 00:35:18,300 we have a client that sent the request for foo. 612 00:35:19,800 --> 00:35:22,600 We grab this with our proxy 613 00:35:22,600 --> 00:35:26,040 and we change the search to foo foo foo. 614 00:35:26,320 --> 00:35:29,800 The problem is we've now added six 615 00:35:29,800 --> 00:35:32,360 to the data that the client sent. 616 00:35:33,380 --> 00:35:34,740 What's going to happen is 617 00:35:34,740 --> 00:35:36,620 the server's going to act nine 618 00:35:36,620 --> 00:35:39,920 and the client is waiting for an act three. 619 00:35:40,860 --> 00:35:43,000 This desync is going to be a problem 620 00:35:43,000 --> 00:35:44,920 because you're going to end up in a loop 621 00:35:44,920 --> 00:35:46,760 where the client's going to keep retransmitting 622 00:35:46,760 --> 00:35:48,340 saying, what the hell are you talking about? 623 00:35:48,340 --> 00:35:50,000 The server's going to be saying, 624 00:35:50,180 --> 00:35:51,640 I already told you I saw that. 625 00:35:52,920 --> 00:35:54,920 What LR does in the middle 626 00:35:54,920 --> 00:35:56,660 is just does this translation. 627 00:35:57,120 --> 00:35:58,660 It says, we added six. 628 00:35:58,960 --> 00:36:00,600 As the sequence number comes past, 629 00:36:00,780 --> 00:36:01,860 we're going to subtract six 630 00:36:01,860 --> 00:36:03,880 and keep both sides happy 631 00:36:03,880 --> 00:36:05,620 by playing man in the middle. 632 00:36:07,960 --> 00:36:09,440 Once we're in line, 633 00:36:09,640 --> 00:36:11,000 it puts us in a position 634 00:36:11,000 --> 00:36:14,360 to alter any data that's going to the client 635 00:36:14,360 --> 00:36:15,340 or to the server. 636 00:36:15,700 --> 00:36:16,960 It becomes interesting 637 00:36:16,960 --> 00:36:18,220 for the new wave 638 00:36:18,220 --> 00:36:20,440 that everyone seems to be focusing on these days, 639 00:36:20,560 --> 00:36:21,980 which is client-side fuzzing. 640 00:36:22,740 --> 00:36:23,960 It becomes interesting 641 00:36:23,960 --> 00:36:25,620 for just about any 642 00:36:25,620 --> 00:36:28,380 lame client-side security bugs. 643 00:36:29,160 --> 00:36:30,960 If we're going to talk about 644 00:36:30,960 --> 00:36:32,300 lame client-side security bugs, 645 00:36:32,540 --> 00:36:34,580 we probably have to say something 646 00:36:34,580 --> 00:36:38,060 about the VNC 4.1 authentication bypass. 647 00:36:39,800 --> 00:36:41,320 Sometime earlier this year, 648 00:36:41,520 --> 00:36:44,660 someone writing his own VNC client 649 00:36:45,600 --> 00:36:47,720 figured out that the VNC protocol 650 00:36:47,720 --> 00:36:49,640 actually had this bug in it. 651 00:36:50,160 --> 00:36:51,600 The client and server 652 00:36:52,200 --> 00:36:53,860 decide that they're both speaking 653 00:36:53,860 --> 00:36:55,500 remote frame buffer, 654 00:36:55,660 --> 00:36:56,400 whatever version. 655 00:36:57,300 --> 00:37:00,100 Then the server sends the client an array saying, 656 00:37:00,260 --> 00:37:02,180 I'll happily talk to you 657 00:37:02,180 --> 00:37:04,140 with authentication type one, 658 00:37:04,260 --> 00:37:05,300 which is password, 659 00:37:05,600 --> 00:37:07,880 or two, which is certificate, 660 00:37:08,060 --> 00:37:08,780 or whatever. 661 00:37:09,320 --> 00:37:11,000 The client then sends back, 662 00:37:11,160 --> 00:37:11,820 that's cool. 663 00:37:11,980 --> 00:37:13,220 I'll talk to you 664 00:37:13,220 --> 00:37:15,200 with authentication type one, 665 00:37:15,340 --> 00:37:16,180 which is password. 666 00:37:16,760 --> 00:37:18,900 The problem that turned out is 667 00:37:18,900 --> 00:37:20,980 the server never checked 668 00:37:20,980 --> 00:37:23,540 that the option that the client chose 669 00:37:23,960 --> 00:37:25,040 was one of the options 670 00:37:25,040 --> 00:37:26,100 that it actually offered. 671 00:37:26,780 --> 00:37:28,000 The server said, 672 00:37:28,220 --> 00:37:29,560 I'll like to speak to you 673 00:37:29,560 --> 00:37:30,820 with two, three, or four. 674 00:37:31,100 --> 00:37:31,920 The client said, 675 00:37:32,000 --> 00:37:33,240 that's cool, let's do zero. 676 00:37:33,580 --> 00:37:35,400 The server said, cool, let's do it. 677 00:37:37,560 --> 00:37:40,900 Where the client was actually choosing type zero, 678 00:37:40,980 --> 00:37:42,380 which meant no password. 679 00:37:43,540 --> 00:37:47,040 It was easy enough to build a tool for this. 680 00:37:47,140 --> 00:37:49,500 All you have to do is alter the VNC client 681 00:37:49,500 --> 00:37:51,100 to always offer up zero. 682 00:37:51,520 --> 00:37:52,860 If you wanted to, 683 00:37:53,040 --> 00:37:55,200 you could achieve this using, 684 00:37:55,420 --> 00:37:56,880 in our case, LR. 685 00:37:57,860 --> 00:38:00,320 Hopefully, I'll have good luck with the demos. 686 00:38:01,220 --> 00:38:03,080 This mic is clearly in my way. 687 00:38:04,060 --> 00:38:06,540 If we go XVNC viewer 688 00:38:07,260 --> 00:38:08,940 to the Win2K box, 689 00:38:09,260 --> 00:38:10,680 what you should see 690 00:38:11,220 --> 00:38:13,080 is that the WinVNC box 691 00:38:13,220 --> 00:38:14,880 comes up and asks for a password. 692 00:38:15,340 --> 00:38:16,480 At which point, 693 00:38:16,520 --> 00:38:17,540 we put in our password 694 00:38:17,540 --> 00:38:19,000 and everything is happy. 695 00:38:19,760 --> 00:38:20,640 At this point, 696 00:38:20,740 --> 00:38:21,880 what I'm going to do is 697 00:38:21,880 --> 00:38:24,540 pass the packets through our proxy. 698 00:38:25,160 --> 00:38:26,080 This time, 699 00:38:26,180 --> 00:38:27,420 we're going to tell the proxy 700 00:38:27,420 --> 00:38:29,480 that actually what we wanted to do 701 00:38:29,480 --> 00:38:31,440 is modify that authentication type 702 00:38:31,800 --> 00:38:32,900 to always be zero. 703 00:38:33,700 --> 00:38:35,700 Running the exact same client, 704 00:38:36,000 --> 00:38:37,100 what you should see 705 00:38:37,100 --> 00:38:40,580 is authentication completely bypassed. 706 00:38:40,580 --> 00:38:41,420 In this case, 707 00:38:41,420 --> 00:38:42,700 because the proxy got in the way 708 00:38:42,700 --> 00:38:43,040 and said, 709 00:38:43,220 --> 00:38:45,240 hey, let's not do this authentication stuff, 710 00:38:45,400 --> 00:38:46,220 let's just skip it. 711 00:38:46,760 --> 00:38:47,620 At this point, 712 00:38:47,660 --> 00:38:49,060 you're passing through a proxy 713 00:38:49,060 --> 00:38:50,060 that's written in Python. 714 00:38:50,580 --> 00:38:52,000 It's going to be a little slow, 715 00:38:52,560 --> 00:38:53,660 but it should work 716 00:38:53,660 --> 00:38:55,240 for just about anything 717 00:38:55,240 --> 00:38:56,240 that you want to do. 718 00:39:01,140 --> 00:39:02,700 I'm going to go back to my slides 719 00:39:02,700 --> 00:39:03,480 if I can find it. 720 00:39:07,580 --> 00:39:09,280 Once we're at this stage, 721 00:39:09,520 --> 00:39:11,220 obviously, we're in the position 722 00:39:11,220 --> 00:39:13,080 to do header modification. 723 00:39:13,080 --> 00:39:14,300 We have the TCP packet. 724 00:39:14,640 --> 00:39:15,720 At this point, 725 00:39:15,780 --> 00:39:16,900 it becomes totally trivial. 726 00:39:18,000 --> 00:39:19,880 We're looking for a good example 727 00:39:19,880 --> 00:39:20,740 to show you guys. 728 00:39:21,320 --> 00:39:23,280 The one obvious one that comes up 729 00:39:23,280 --> 00:39:25,000 was a problem that FreeBSD had 730 00:39:25,000 --> 00:39:26,440 a little while back 731 00:39:26,440 --> 00:39:29,540 where if you changed the header flag 732 00:39:30,200 --> 00:39:32,540 or the ECE flag in the header, 733 00:39:32,760 --> 00:39:33,920 if you set it, 734 00:39:34,980 --> 00:39:36,780 FreeBSD firewalls thought that 735 00:39:36,780 --> 00:39:38,660 you are part of an established session 736 00:39:38,660 --> 00:39:40,620 and just sent you through. 737 00:39:41,580 --> 00:39:42,940 What we've got here 738 00:39:43,080 --> 00:39:45,940 is a FreeBSD version that was vulnerable to this. 739 00:39:46,800 --> 00:39:49,300 And for those of you with super sharp vision, 740 00:39:49,560 --> 00:39:51,300 what you should be able to see 741 00:39:51,300 --> 00:39:53,500 is that this firewall has two rules. 742 00:39:54,700 --> 00:39:56,220 The first rule says, 743 00:39:56,580 --> 00:39:59,820 allow TCP if it's part of an established session. 744 00:40:00,340 --> 00:40:02,920 And the next rule says, deny everything else. 745 00:40:03,400 --> 00:40:06,480 Okay, so if you're familiar with this type of firewalling, 746 00:40:06,540 --> 00:40:08,840 you should know that nothing should get through. 747 00:40:09,000 --> 00:40:11,480 Okay, I can't send any SYN packets through, 748 00:40:11,480 --> 00:40:18,300 which should leave me sitting quite badly. 749 00:40:19,020 --> 00:40:20,440 Okay, so at this point, 750 00:40:20,580 --> 00:40:25,040 if I tried to telnet to the FreeBSD box on port 22, 751 00:40:25,780 --> 00:40:28,680 okay, as expected, I should get back nothing. 752 00:40:29,260 --> 00:40:31,060 Okay, and this should work 753 00:40:31,060 --> 00:40:33,320 for just about all the services on this box. 754 00:40:33,480 --> 00:40:36,180 Okay, I shouldn't be able to surf to it 755 00:40:36,180 --> 00:40:37,520 or anything like that. 756 00:40:37,660 --> 00:40:39,000 Okay, it should just spin its wheels. 757 00:40:39,900 --> 00:40:41,080 At this point, 758 00:40:41,480 --> 00:40:42,620 all we're going to do is 759 00:40:43,780 --> 00:40:46,100 start sending packets through us again. 760 00:40:46,800 --> 00:40:48,300 Okay, and at this time, 761 00:40:48,820 --> 00:40:52,000 we're going to tell our proxy 762 00:40:52,000 --> 00:40:54,400 to add the ECE flag to everything. 763 00:40:55,060 --> 00:40:56,840 Okay, what you should see is 764 00:40:56,840 --> 00:41:00,540 that same telnet this time happily goes through. 765 00:41:01,040 --> 00:41:02,760 Okay, and in fact, 766 00:41:02,760 --> 00:41:05,340 you should find that just about any connection to that box 767 00:41:05,940 --> 00:41:07,980 should happily go through to the server. 768 00:41:08,360 --> 00:41:09,440 Okay, so again, 769 00:41:09,600 --> 00:41:11,380 all the proxy is doing, 770 00:41:11,480 --> 00:41:12,780 is saying, grab the packet, 771 00:41:13,000 --> 00:41:14,900 you ask me to modify the header, 772 00:41:15,160 --> 00:41:15,900 here you go, 773 00:41:16,100 --> 00:41:17,640 and the stuff goes through. 774 00:41:18,120 --> 00:41:20,100 Okay, the bug in FreeBSD is pretty old, 775 00:41:20,280 --> 00:41:22,880 but you guys know there'll be other bugs. 776 00:41:24,680 --> 00:41:27,180 Okay, the interesting thing about this is 777 00:41:27,180 --> 00:41:29,560 we released an exploit for this way back 778 00:41:30,040 --> 00:41:31,780 to allow you to do the same thing, 779 00:41:31,940 --> 00:41:33,040 and originally, 780 00:41:33,180 --> 00:41:36,340 even though it stole stuff from LibNet, 781 00:41:37,380 --> 00:41:39,460 the amount of code that you needed 782 00:41:39,460 --> 00:41:41,460 was around 270 lines, 783 00:41:41,480 --> 00:41:41,640 and the amount of code that you needed 784 00:41:41,640 --> 00:41:42,300 was around 1,000 lines of C code, 785 00:41:42,440 --> 00:41:43,780 okay, to achieve this. 786 00:41:44,940 --> 00:41:46,280 Using LR today, 787 00:41:47,240 --> 00:41:49,960 you can do it in 20 lines of Python code, 788 00:41:50,180 --> 00:41:52,760 okay, and about four or six of those lines 789 00:41:52,760 --> 00:41:53,760 are actually comments. 790 00:41:54,260 --> 00:41:55,660 Okay, so pretty much, 791 00:41:55,680 --> 00:41:56,460 you should be able to say, 792 00:41:56,520 --> 00:41:58,580 grab this packet, do this, pass it on, 793 00:41:59,240 --> 00:42:00,840 and you'll be a happy camper. 794 00:42:02,700 --> 00:42:04,640 Okay, other uses for it, 795 00:42:04,740 --> 00:42:07,060 we found you can use it nicely 796 00:42:07,060 --> 00:42:09,080 if you're doing some sort of malware analysis. 797 00:42:09,560 --> 00:42:10,940 Okay, it's really useful. 798 00:42:11,480 --> 00:42:12,520 And at this point, 799 00:42:12,660 --> 00:42:14,960 you get the joy of hooking up 800 00:42:14,960 --> 00:42:16,660 with a clever project like Scappy. 801 00:42:17,100 --> 00:42:19,400 Okay, so I don't actually know 802 00:42:19,400 --> 00:42:20,580 when a packet's going through, 803 00:42:20,700 --> 00:42:22,020 what that packet is, 804 00:42:22,240 --> 00:42:23,580 or what that packet contains. 805 00:42:23,940 --> 00:42:25,720 I simply ask Scappy, 806 00:42:25,860 --> 00:42:27,540 hey, show me its IP field. 807 00:42:28,180 --> 00:42:29,700 You look like your UDP, 808 00:42:30,460 --> 00:42:33,500 please show me what your UDP request is, 809 00:42:33,580 --> 00:42:34,960 or your DNS request is. 810 00:42:35,100 --> 00:42:37,780 Show me what your DNS request ID is. 811 00:42:37,900 --> 00:42:39,320 And Scappy happily says, 812 00:42:39,580 --> 00:42:40,760 well, this is what it is. 813 00:42:41,480 --> 00:42:44,680 And if you've ever tried to modify a DNS request 814 00:42:44,680 --> 00:42:46,160 as it went by on the wire, 815 00:42:46,380 --> 00:42:49,080 you'd know that it's not just a text record, okay? 816 00:42:49,140 --> 00:42:50,280 There's some ID stuff. 817 00:42:50,720 --> 00:42:52,520 There's some stuff that identifies it. 818 00:42:52,580 --> 00:42:54,920 In this case, I skip all that complexity 819 00:42:54,920 --> 00:42:58,360 and leave the cleverness to the guy that wrote Scappy. 820 00:42:58,640 --> 00:43:00,980 I say, make your DNS result, 821 00:43:01,580 --> 00:43:03,000 woowowow.foo.com. 822 00:43:03,480 --> 00:43:05,160 Scappy does its Scappy magic 823 00:43:05,160 --> 00:43:06,480 and gives me a packet. 824 00:43:06,620 --> 00:43:08,340 And I say, send this packet out. 825 00:43:09,280 --> 00:43:09,760 Okay. 826 00:43:10,380 --> 00:43:11,800 What this needs, 827 00:43:12,000 --> 00:43:15,700 and for those of you who caught the Matasano talk on PDB, 828 00:43:16,400 --> 00:43:17,900 anyone who's doing this stuff 829 00:43:17,900 --> 00:43:19,360 bumps into the same problem. 830 00:43:19,940 --> 00:43:23,000 So I've effectively fixed the desync 831 00:43:23,000 --> 00:43:25,320 between client and server by sitting in the middle. 832 00:43:25,540 --> 00:43:26,980 But what you don't fix 833 00:43:26,980 --> 00:43:29,420 is the fact that you type slower 834 00:43:29,420 --> 00:43:31,740 than TCP expects you to be. 835 00:43:32,180 --> 00:43:34,960 Okay, so while you're sitting mangling your packet, 836 00:43:35,180 --> 00:43:36,340 the client's going, 837 00:43:36,500 --> 00:43:38,240 I sent this and didn't get a response. 838 00:43:38,480 --> 00:43:39,000 Resend. 839 00:43:39,000 --> 00:43:40,740 I sent this and didn't get a response. 840 00:43:41,000 --> 00:43:41,500 Resend. 841 00:43:41,740 --> 00:43:44,300 Okay, and what you really want to avoid more than the noise 842 00:43:44,300 --> 00:43:46,280 is the client and the server 843 00:43:46,280 --> 00:43:49,280 breaking off communication because of a timeout. 844 00:43:49,720 --> 00:43:52,380 Okay, so nobody's really solved this. 845 00:43:52,940 --> 00:43:54,740 I figure we know how to. 846 00:43:54,820 --> 00:43:56,900 We just didn't have time before getting here. 847 00:43:57,400 --> 00:44:03,060 So we'll try it before putting the actual TGZ up. 848 00:44:03,960 --> 00:44:05,620 Basically, what we're looking for 849 00:44:05,620 --> 00:44:08,380 is to tell both client and server 850 00:44:08,380 --> 00:44:10,920 that you're now being debugged. 851 00:44:10,960 --> 00:44:12,380 Please stop what you're doing. 852 00:44:12,720 --> 00:44:15,380 The problem is we're doing it by sitting on the wire 853 00:44:15,380 --> 00:44:17,460 so we don't have direct control 854 00:44:17,460 --> 00:44:19,180 of the client or the server. 855 00:44:19,900 --> 00:44:22,920 Okay, what I figure we can do for this 856 00:44:22,920 --> 00:44:25,800 is to steal an idea that tarpits use. 857 00:44:26,220 --> 00:44:29,540 Okay, if you've ever used a tarpit for anything, 858 00:44:29,780 --> 00:44:33,480 you'll know that if you set your TCP window size to zero, 859 00:44:34,140 --> 00:44:36,360 okay, and talk to a client or a server, 860 00:44:36,520 --> 00:44:38,280 you're basically telling that client, 861 00:44:38,380 --> 00:44:38,820 client or server, 862 00:44:39,020 --> 00:44:40,660 I'm too busy right now. 863 00:44:40,880 --> 00:44:42,180 Please stop talking 864 00:44:42,180 --> 00:44:44,520 till I tell you you can start talking again. 865 00:44:45,260 --> 00:44:47,480 Okay, and what my plan is with this 866 00:44:47,480 --> 00:44:49,720 is that we have LR sitting in the center 867 00:44:49,720 --> 00:44:52,080 and as soon as you want to mangle the packet, 868 00:44:52,360 --> 00:44:54,540 it spoofs a TCP window zero 869 00:44:54,540 --> 00:44:56,260 to both the client and server saying, 870 00:44:56,860 --> 00:44:58,780 can you please just give me a second? 871 00:44:59,180 --> 00:45:00,700 Okay, both guys stop 872 00:45:00,700 --> 00:45:02,040 and when you're ready, 873 00:45:02,100 --> 00:45:03,900 you send them both a window update saying, 874 00:45:04,040 --> 00:45:05,600 okay, let's start talking again. 875 00:45:05,880 --> 00:45:08,300 Okay, I can't theoretically see any reason 876 00:45:08,380 --> 00:45:09,380 why it shouldn't work 877 00:45:09,380 --> 00:45:11,440 and so far nobody's come up and told me 878 00:45:11,440 --> 00:45:12,920 I'm a total idiot. 879 00:45:13,440 --> 00:45:14,080 I lie. 880 00:45:14,220 --> 00:45:15,480 People have told me I'm a total idiot. 881 00:45:15,600 --> 00:45:17,240 They haven't told me I'm a total idiot for this. 882 00:45:17,840 --> 00:45:21,360 Okay, so we'll try it as soon as we get back 883 00:45:21,360 --> 00:45:23,760 and it should be on the final version of the TGZ 884 00:45:23,760 --> 00:45:24,560 that we put up. 885 00:45:26,100 --> 00:45:28,080 Okay, so with this, 886 00:45:28,140 --> 00:45:28,880 what you should have 887 00:45:29,400 --> 00:45:31,940 is a really trivial, easy way 888 00:45:31,940 --> 00:45:33,420 for you to mangle packets. 889 00:45:33,940 --> 00:45:36,640 Remember, one of the core objectives with this 890 00:45:37,180 --> 00:45:38,080 was just, 891 00:45:38,080 --> 00:45:39,040 test for guys to see 892 00:45:39,040 --> 00:45:41,360 how simple the stuff actually is to do. 893 00:45:41,980 --> 00:45:44,440 Just about all of those things that I used 894 00:45:44,440 --> 00:45:45,680 for the FreeBSD thing, 895 00:45:45,880 --> 00:45:46,860 for the VNC thing, 896 00:45:47,540 --> 00:45:49,180 they're about 30 lines of Python. 897 00:45:50,000 --> 00:45:53,280 Okay, where at least half of it is templatable. 898 00:45:53,600 --> 00:45:54,620 Okay, where you're saying, 899 00:45:54,780 --> 00:45:56,500 here's the packet coming in. 900 00:45:56,600 --> 00:45:58,160 If the packet looks like this, 901 00:45:58,200 --> 00:45:59,120 change it like that. 902 00:45:59,340 --> 00:46:00,100 And you literally, 903 00:46:00,380 --> 00:46:03,100 for those of you who've seen any Python script, 904 00:46:03,240 --> 00:46:04,360 you know that it's pretty readable 905 00:46:04,360 --> 00:46:06,700 unlike most of my old Perl. 906 00:46:07,420 --> 00:46:07,900 Okay? 907 00:46:08,440 --> 00:46:09,860 So you should be in a position 908 00:46:09,860 --> 00:46:11,520 to mangle the stuff pretty easily. 909 00:46:12,080 --> 00:46:13,820 You should be in a position to say, 910 00:46:13,920 --> 00:46:15,620 well, hold on, if we can do this, 911 00:46:15,740 --> 00:46:17,700 we can do the following 10 things. 912 00:46:18,060 --> 00:46:19,320 Okay, which is pretty much 913 00:46:19,320 --> 00:46:20,560 what we want you guys to do, 914 00:46:20,600 --> 00:46:21,480 to go back and say, 915 00:46:21,620 --> 00:46:23,300 well, you can use it for the following 916 00:46:23,300 --> 00:46:25,100 and you can do much cooler stuff with it. 917 00:46:26,100 --> 00:46:27,600 The TGZ for this stuff 918 00:46:27,600 --> 00:46:29,000 will be available at 919 00:46:29,000 --> 00:46:31,400 www.sensepost.com forward slash research 920 00:46:32,020 --> 00:46:33,460 as soon as we get home 921 00:46:33,460 --> 00:46:34,600 and actually upload it. 922 00:46:35,060 --> 00:46:36,420 So yeah, download it, 923 00:46:36,460 --> 00:46:37,760 play with it, give us feedback. 924 00:46:38,080 --> 00:46:40,080 And other than that, just have fun. 925 00:46:40,540 --> 00:46:42,760 With that, we go back to the good-looking one. 926 00:46:44,520 --> 00:46:45,720 Who needs to alter? 927 00:46:48,300 --> 00:46:52,820 So, in conclusion then to our talk, 928 00:46:53,900 --> 00:46:56,040 we basically, when we train people, 929 00:46:56,300 --> 00:46:58,740 we say, listen, it's not about the tools, 930 00:46:58,840 --> 00:46:59,640 it's about the thinking. 931 00:47:01,300 --> 00:47:03,120 And if hacking is art, 932 00:47:03,280 --> 00:47:05,540 then tools are really the brushes. 933 00:47:06,660 --> 00:47:08,580 But a monkey with a brush 934 00:47:08,580 --> 00:47:09,860 is still just a monkey, right? 935 00:47:12,180 --> 00:47:14,180 So, the bottom line with these things are, 936 00:47:14,280 --> 00:47:16,100 we preach to everyone 937 00:47:16,100 --> 00:47:17,380 that it's not about the tools, 938 00:47:17,500 --> 00:47:18,660 it's not about your exploits, 939 00:47:18,680 --> 00:47:19,440 it's about the thinking, 940 00:47:19,580 --> 00:47:20,960 it's the way that you think about things. 941 00:47:21,480 --> 00:47:23,700 But having nice tools really makes it easier 942 00:47:23,700 --> 00:47:25,340 to really make cool stuff. 943 00:47:26,500 --> 00:47:29,240 So, again, we don't want to sit here and say, 944 00:47:29,360 --> 00:47:30,840 hey, look at this tool, look at this tool, 945 00:47:30,860 --> 00:47:31,520 look at that tool. 946 00:47:33,080 --> 00:47:33,480 But, 947 00:47:35,540 --> 00:47:36,560 it is quite cool, I think. 948 00:47:37,700 --> 00:47:40,540 The stuff is available, again, at that URL, 949 00:47:41,820 --> 00:47:42,620 tripwsensepost.com. 950 00:47:42,760 --> 00:47:43,840 You can have a look there, 951 00:47:43,880 --> 00:47:45,880 go to the research area as well, if you want to. 952 00:47:46,360 --> 00:47:47,480 And at this stage, 953 00:47:47,680 --> 00:47:49,840 I want to take some questions. 954 00:47:50,000 --> 00:47:51,320 There was a sir there that I said, 955 00:47:51,820 --> 00:47:52,940 I promise I won't forget. 956 00:47:53,720 --> 00:47:55,880 If there's any questions at this stage, 957 00:47:55,960 --> 00:47:57,740 I think we've got five more minutes. 958 00:47:58,480 --> 00:47:59,280 Two more minutes? 959 00:48:02,360 --> 00:48:03,560 Do you guys use the mic? 960 00:48:03,620 --> 00:48:05,440 Because then I don't have to repeat the question. 961 00:48:06,020 --> 00:48:07,420 Two quick questions. 962 00:48:07,520 --> 00:48:10,780 What's the support for HTTPS on those tools for SSL? 963 00:48:11,080 --> 00:48:14,020 And what's the support for internal proxies? 964 00:48:14,960 --> 00:48:15,520 Okay. 965 00:48:15,760 --> 00:48:16,680 Good question. 966 00:48:16,780 --> 00:48:18,100 The first was SSL. 967 00:48:18,140 --> 00:48:19,540 Yeah, there's full support for SSL. 968 00:48:19,600 --> 00:48:21,460 We do it, as all the other proxies do, 969 00:48:22,120 --> 00:48:23,380 man-in-the-mill with a certificate. 970 00:48:23,620 --> 00:48:24,460 Same thing. 971 00:48:24,820 --> 00:48:26,780 In terms of internal proxies, 972 00:48:26,880 --> 00:48:29,120 you mean training proxies together. 973 00:48:30,700 --> 00:48:32,260 Now, I haven't done that, 974 00:48:32,320 --> 00:48:33,620 because it's actually not, 975 00:48:33,760 --> 00:48:34,840 it's not, 976 00:48:35,540 --> 00:48:36,660 it's doable, it's totally doable, 977 00:48:36,820 --> 00:48:37,540 but I haven't done it. 978 00:48:37,620 --> 00:48:38,580 So it's just implementation. 979 00:48:39,060 --> 00:48:41,440 So I'm sorry, at the moment, you can't train it. 980 00:48:43,000 --> 00:48:43,440 No. 981 00:48:45,500 --> 00:48:46,480 Depends on which one. 982 00:48:46,640 --> 00:48:49,320 So LR source code, it's just source code, 983 00:48:49,400 --> 00:48:50,000 it's just Python. 984 00:48:51,420 --> 00:48:52,980 So I just have a question about 985 00:48:52,980 --> 00:48:54,640 how you handle packet loss, 986 00:48:54,800 --> 00:48:56,560 because if you're changing the payload size, 987 00:48:57,280 --> 00:49:00,100 and then you change the sequence number, 988 00:49:00,180 --> 00:49:01,620 you're adding and subtracting these digits, 989 00:49:01,820 --> 00:49:05,080 if it says, all right, we lost three packets, 990 00:49:05,080 --> 00:49:07,300 and it's going to continuously send those first three, 991 00:49:07,440 --> 00:49:08,600 not the whole... 992 00:49:09,140 --> 00:49:09,700 Absolutely. 993 00:49:09,940 --> 00:49:12,980 At this point, the easy answer is it totally screws you over. 994 00:49:13,200 --> 00:49:13,760 Okay. 995 00:49:15,260 --> 00:49:17,420 As does fragmented packets. 996 00:49:17,780 --> 00:49:18,340 Okay. 997 00:49:18,520 --> 00:49:21,540 You can get away from both in the short term 998 00:49:21,540 --> 00:49:24,000 by having your firewall handle it for you. 999 00:49:24,420 --> 00:49:27,100 So do reassembly at the firewall level. 1000 00:49:27,440 --> 00:49:30,940 I wouldn't advise you to use LR as a genetic proxy 1001 00:49:31,400 --> 00:49:33,260 while you're just oddly surfing around. 1002 00:49:33,440 --> 00:49:34,760 So you want to use it 1003 00:49:34,760 --> 00:49:36,540 while you're doing testing on an application. 1004 00:49:37,400 --> 00:49:39,220 It's not going to handle heavy loads. 1005 00:49:39,420 --> 00:49:42,160 You're simulating an IP stack in Python. 1006 00:49:43,040 --> 00:49:44,940 So yeah, at this point, we're not. 1007 00:49:45,080 --> 00:49:47,620 And to be honest, I don't think I'd build it in 1008 00:49:47,620 --> 00:49:49,520 because I think it would be more trouble than it's worth. 1009 00:49:50,620 --> 00:49:53,540 I have about three questions regarding Suru. 1010 00:49:53,800 --> 00:49:56,420 Your import-export format for saving sessions, 1011 00:49:56,740 --> 00:49:59,100 what kind of formats are they in, XML, CSV? 1012 00:50:02,380 --> 00:50:04,480 No, it's Suru format. 1013 00:50:04,760 --> 00:50:09,000 So no, it's totally text. 1014 00:50:09,140 --> 00:50:10,980 So you can modify it if you want to read it. 1015 00:50:11,120 --> 00:50:12,600 But it's totally proprietary. 1016 00:50:13,020 --> 00:50:14,040 It's not XML. 1017 00:50:14,300 --> 00:50:15,140 It's not CSV. 1018 00:50:16,540 --> 00:50:19,000 You can probably convert it if you want to. 1019 00:50:19,080 --> 00:50:21,240 But at this stage, it's not any of those. 1020 00:50:21,460 --> 00:50:21,680 Okay. 1021 00:50:21,780 --> 00:50:23,820 And dealing with your auto-relationship discovery 1022 00:50:23,820 --> 00:50:26,880 where you look at the parameters and different encoding methods, 1023 00:50:27,140 --> 00:50:29,920 do you look for clear text also through other parameters? 1024 00:50:30,500 --> 00:50:32,060 No, we actually don't. 1025 00:50:32,240 --> 00:50:34,740 So it's something that we thought, you know, we're going to do. 1026 00:50:34,740 --> 00:50:35,240 We thought about doing. 1027 00:50:35,440 --> 00:50:36,800 At the moment, we don't do it. 1028 00:50:37,120 --> 00:50:38,780 So if I understand you correctly, 1029 00:50:38,980 --> 00:50:41,360 that is if there's clear text in one parameter 1030 00:50:41,360 --> 00:50:43,820 that is contained within some of the other parameters? 1031 00:50:44,140 --> 00:50:44,540 Yeah, correct. 1032 00:50:44,680 --> 00:50:46,360 So like if you have, you know, you have some post 1033 00:50:46,360 --> 00:50:47,640 and it has a username or password 1034 00:50:47,640 --> 00:50:49,480 and then it's putting that username in the get request? 1035 00:50:49,720 --> 00:50:49,740 No. 1036 00:50:49,820 --> 00:50:51,560 At the moment, we don't look at the clear text. 1037 00:50:51,680 --> 00:50:52,460 It's easy to add. 1038 00:50:52,600 --> 00:50:55,080 It should be, like, trivial to add. 1039 00:50:55,380 --> 00:50:55,740 Okay. 1040 00:50:55,860 --> 00:50:59,200 And then last question is, so mainly the way 1041 00:50:59,200 --> 00:51:01,960 that the new WICTO backend that you put in Suru works 1042 00:51:01,960 --> 00:51:04,320 is that it works off of 200 versus 400. 1043 00:51:04,740 --> 00:51:07,380 Um, or mismatched responses. 1044 00:51:07,880 --> 00:51:11,900 If you have 302s in those and they're, you know, 1045 00:51:11,960 --> 00:51:13,080 popping over to the same website, 1046 00:51:13,340 --> 00:51:15,840 does it look at anything else in there, like content length or? 1047 00:51:16,200 --> 00:51:20,460 At the moment, within the directory and file mining in Suru, 1048 00:51:20,520 --> 00:51:22,880 we don't look at status code at all anymore. 1049 00:51:23,200 --> 00:51:24,380 We took it out completely. 1050 00:51:24,800 --> 00:51:25,380 So length only? 1051 00:51:25,960 --> 00:51:26,540 Um, sorry? 1052 00:51:26,780 --> 00:51:28,480 So you only look at length only? 1053 00:51:29,060 --> 00:51:30,240 We don't look at length. 1054 00:51:30,340 --> 00:51:33,500 We look at the comparison to that and a base response. 1055 00:51:33,820 --> 00:51:34,120 Okay. 1056 00:51:34,740 --> 00:51:35,460 So it's the same. 1057 00:51:35,600 --> 00:51:40,140 What we found is in, um, so it does the same testing 1058 00:51:40,140 --> 00:51:44,060 like we do in WICTO with the AI option switched on. 1059 00:51:44,380 --> 00:51:48,440 And we decided to leave it like that because the results 1060 00:51:48,440 --> 00:51:51,580 that we're getting is quite, it seems to be, well, 1061 00:51:51,700 --> 00:51:54,180 it's a lot more reliable than looking at status code. 1062 00:51:54,480 --> 00:51:54,740 Sure. 1063 00:51:54,820 --> 00:51:55,480 Okay, thank you. 1064 00:51:55,540 --> 00:51:55,980 Thanks. 1065 00:51:56,060 --> 00:51:56,100 Thanks. 1066 00:51:57,480 --> 00:52:00,580 I was wondering how LR handled TTL values. 1067 00:52:01,580 --> 00:52:04,320 Well, as it stands, it handles it 1068 00:52:04,740 --> 00:52:05,700 exactly as SCAPI would. 1069 00:52:05,960 --> 00:52:09,540 Sorry, the question is how LR handles TTL values. 1070 00:52:10,400 --> 00:52:14,700 It handles it as SCAPI would, which means by default, 1071 00:52:14,820 --> 00:52:17,980 it'll leave anything you don't specifically mangle. 1072 00:52:18,360 --> 00:52:21,200 So if the packet's coming through with the TTL of X, 1073 00:52:21,360 --> 00:52:25,260 unless you choose to make TTL Y, it'll handle it exactly 1074 00:52:25,260 --> 00:52:28,680 as another hop on the way and pass it through just fine. 1075 00:52:29,420 --> 00:52:33,000 So again, that's not, that's none of my cleverness. 1076 00:52:33,380 --> 00:52:34,660 SCAPI handles the stuff. 1077 00:52:34,740 --> 00:52:35,280 It handles the stuff really well. 1078 00:52:35,640 --> 00:52:38,820 Anything that you don't mangle in a packet, SCAPI will try to 1079 00:52:38,820 --> 00:52:40,240 intelligently fill in for you. 1080 00:52:40,520 --> 00:52:42,620 And in this case, that's exactly what it'll do. 1081 00:52:42,680 --> 00:52:43,500 It'll just pass it through. 1082 00:52:44,260 --> 00:52:45,340 So any more questions? 1083 00:52:46,500 --> 00:52:49,700 Thanks for your attendance on this late day in DEF CON. 1084 00:52:49,800 --> 00:52:49,940 Thanks.