1 00:00:00,000 --> 00:00:00,640 What's up, guys? 2 00:00:02,480 --> 00:00:03,440 Oh, God. 3 00:00:05,040 --> 00:00:06,340 You guys are nuts. 4 00:00:07,040 --> 00:00:08,340 Look at this freaking crowd. 5 00:00:09,140 --> 00:00:13,260 All right, we have so much stuff to go over. 6 00:00:13,360 --> 00:00:14,580 Let's break some things, eh? 7 00:00:16,340 --> 00:00:19,020 But the beer is all the way over there, 8 00:00:19,120 --> 00:00:21,320 and I'm here, and the wire doesn't move. 9 00:00:21,440 --> 00:00:22,040 Oh, wait. 10 00:00:26,580 --> 00:00:27,460 Oh, wait. 11 00:00:29,480 --> 00:00:32,860 All right, so this is my seventh talk here, 12 00:00:33,020 --> 00:00:37,120 and for people who have been coming to my talks for a while, 13 00:00:37,300 --> 00:00:38,580 this is the freaking remix. 14 00:00:38,800 --> 00:00:40,920 There are little pieces of all the old talks 15 00:00:40,920 --> 00:00:42,920 that have been abused in really new ways. 16 00:00:43,100 --> 00:00:43,740 And why? 17 00:00:44,740 --> 00:00:47,260 I have discovered the web, and it is glorious. 18 00:00:48,020 --> 00:00:50,620 Oh, dear, that's totally not a moon. 19 00:00:50,700 --> 00:00:51,860 That's a web browser. 20 00:00:54,800 --> 00:00:57,080 Okay, they say this is like a new, 21 00:00:57,080 --> 00:00:58,020 new operating system. 22 00:00:58,240 --> 00:00:59,800 No, no, no, it's a new network stack, 23 00:00:59,940 --> 00:01:02,040 but you get to, like, send it code to teach it 24 00:01:02,040 --> 00:01:03,240 how to parse your packets. 25 00:01:03,780 --> 00:01:04,580 Holy hell. 26 00:01:04,980 --> 00:01:06,460 Oh, and, you know, just to make sure 27 00:01:06,460 --> 00:01:08,140 I'm not being too abusive here, 28 00:01:08,420 --> 00:01:10,260 oh, oh, oh, iPhone's in on it, too. 29 00:01:12,440 --> 00:01:14,980 The best part was not having to Photoshop the scene. 30 00:01:15,100 --> 00:01:16,740 It looks enough like an iPhone already. 31 00:01:18,820 --> 00:01:21,260 All right, so this is where the wild stuff 32 00:01:21,260 --> 00:01:22,120 seems to be lately. 33 00:01:22,460 --> 00:01:24,020 We're just cross-site scripting 34 00:01:24,020 --> 00:01:25,140 and cross-site request forgery 35 00:01:25,140 --> 00:01:26,140 have gotten ridiculous 36 00:01:26,140 --> 00:01:27,720 in terms of what they can do. 37 00:01:27,940 --> 00:01:29,960 The Super Bowl, we had a WMF attack. 38 00:01:30,240 --> 00:01:30,580 Oh, day. 39 00:01:30,780 --> 00:01:32,100 Two days before the Super Bowl, 40 00:01:32,280 --> 00:01:34,060 malicious image placed on this site. 41 00:01:34,180 --> 00:01:35,980 These guys got a couple million boxes. 42 00:01:36,420 --> 00:01:38,800 But then, then this is what really caught my attention. 43 00:01:39,080 --> 00:01:41,380 And this was actually the DNS rebinding test 44 00:01:41,380 --> 00:01:43,480 by a group at Stanford run by Dan Bonet. 45 00:01:43,880 --> 00:01:45,140 Actually, there's one of the guys 46 00:01:45,140 --> 00:01:46,260 that's actually here from it. 47 00:01:46,380 --> 00:01:47,840 His name's Andrew Bortz. 48 00:01:47,960 --> 00:01:49,640 His alias is Abortz. 49 00:01:49,640 --> 00:01:50,360 This is awesome. 50 00:01:52,600 --> 00:01:54,020 So what these guys did, 51 00:01:54,220 --> 00:01:56,080 you know, we've all known in the security realm, 52 00:01:56,140 --> 00:01:58,020 that ad networks are like the way 53 00:01:58,020 --> 00:02:00,280 to put crap on lots and lots of different places. 54 00:02:00,500 --> 00:02:02,240 And it's been a bit of a problem lately. 55 00:02:03,180 --> 00:02:04,240 Well, what they did is 56 00:02:04,240 --> 00:02:06,060 they put an ad on lots and lots of places 57 00:02:06,060 --> 00:02:07,260 and they were a bit of a problem. 58 00:02:08,160 --> 00:02:09,540 They had their little applet. 59 00:02:09,640 --> 00:02:10,720 It got network connectivity 60 00:02:10,720 --> 00:02:11,780 to all these different networks. 61 00:02:11,900 --> 00:02:14,340 And they got like in for 50 bucks, 62 00:02:14,480 --> 00:02:15,840 100,000 networks. 63 00:02:16,940 --> 00:02:17,300 Whoa. 64 00:02:18,080 --> 00:02:19,220 So you have my attention. 65 00:02:20,720 --> 00:02:23,720 You know, I was trying not to look at DNS anymore. 66 00:02:23,960 --> 00:02:24,820 You know, I've really kind of, 67 00:02:24,840 --> 00:02:26,120 you know, I did DNS over DNS. 68 00:02:26,120 --> 00:02:27,580 What more could there possibly be? 69 00:02:28,780 --> 00:02:29,260 Okay. 70 00:02:29,360 --> 00:02:31,300 When the words DNS, tunneling, 71 00:02:31,300 --> 00:02:32,760 and behind firewalls come up, 72 00:02:32,840 --> 00:02:33,820 my ears prick up like, 73 00:02:33,860 --> 00:02:35,300 ooh, this sounds like fun. 74 00:02:36,060 --> 00:02:37,600 So it turns out 75 00:02:37,600 --> 00:02:38,760 what we're talking about 76 00:02:38,760 --> 00:02:40,600 is an old, old, old, old, old bug. 77 00:02:40,960 --> 00:02:42,900 This goes back to like 1996. 78 00:02:43,820 --> 00:02:45,360 People dealt with it back then 79 00:02:45,360 --> 00:02:47,060 and promptly forgot about it. 80 00:02:47,440 --> 00:02:48,920 But you know what's great about design bugs? 81 00:02:49,180 --> 00:02:50,780 They freaking come back from the dead. 82 00:02:50,840 --> 00:02:51,520 They're like zombies. 83 00:02:54,040 --> 00:02:55,540 What Benet's group found 84 00:02:55,540 --> 00:02:56,100 is that they're like, 85 00:02:56,100 --> 00:02:57,380 you know, what happened is 86 00:02:57,380 --> 00:02:58,620 Martin Johns went ahead, 87 00:02:58,860 --> 00:02:59,820 revived the attack, 88 00:03:00,000 --> 00:03:00,560 said, hey, look, 89 00:03:00,640 --> 00:03:02,560 all this stuff from 11 years ago 90 00:03:02,560 --> 00:03:04,960 works against Flash and Java and MSXML 91 00:03:04,960 --> 00:03:05,980 and all these other things. 92 00:03:06,480 --> 00:03:07,960 Benet started going after it. 93 00:03:08,060 --> 00:03:09,860 R Snake went, started looking after it. 94 00:03:10,280 --> 00:03:11,380 And so I got in. 95 00:03:11,940 --> 00:03:13,520 Now, the effect of this bug, 96 00:03:13,620 --> 00:03:14,500 and I'm going to explain it, 97 00:03:14,580 --> 00:03:16,920 is that it breaks the security policy of the web. 98 00:03:17,120 --> 00:03:17,980 You know, nothing important. 99 00:03:19,820 --> 00:03:21,860 So to understand what's going on, 100 00:03:21,940 --> 00:03:23,360 we're going to start from scratch here. 101 00:03:23,600 --> 00:03:24,800 The web is interesting. 102 00:03:24,800 --> 00:03:26,100 On the web, 103 00:03:26,520 --> 00:03:28,780 components are pulled in from all over the place. 104 00:03:28,980 --> 00:03:30,320 You can get an image from over here. 105 00:03:30,480 --> 00:03:31,740 You can get some text from over there. 106 00:03:31,900 --> 00:03:32,980 Maybe you get a little JavaScript. 107 00:03:33,640 --> 00:03:35,220 You know, you can even embed 108 00:03:35,220 --> 00:03:37,480 an entirely different web page 109 00:03:37,480 --> 00:03:39,380 inside of the web page you're looking at. 110 00:03:39,600 --> 00:03:41,280 This is what's called an iframe. 111 00:03:41,500 --> 00:03:43,020 And it's a little window 112 00:03:43,020 --> 00:03:46,040 that can actually be any web page on the internet. 113 00:03:47,140 --> 00:03:48,720 Now, from a security perspective, 114 00:03:48,920 --> 00:03:50,040 this could be scary, you know? 115 00:03:50,100 --> 00:03:51,420 What if you had a little window 116 00:03:51,420 --> 00:03:52,380 that was Hotmail? 117 00:03:52,500 --> 00:03:54,200 And what if you were logged into Hotmail? 118 00:03:54,800 --> 00:03:56,700 Would this other site that created the little window, 119 00:03:56,820 --> 00:03:58,360 would it be able to read your mail? 120 00:03:58,880 --> 00:04:00,780 Well, the answer is actually no. 121 00:04:01,040 --> 00:04:03,860 They have something called the same origin policy, 122 00:04:04,220 --> 00:04:07,140 which you can think of as look, but don't touch. 123 00:04:07,440 --> 00:04:09,640 A web page, any web page you go to, 124 00:04:09,680 --> 00:04:12,080 can go ahead and they can embed Hotmail. 125 00:04:12,300 --> 00:04:13,940 They can show it to you. 126 00:04:14,040 --> 00:04:16,520 You can even read your mail inside the little embedding. 127 00:04:16,900 --> 00:04:18,180 They can show it to you, 128 00:04:18,200 --> 00:04:20,980 but they don't get to programmatically read it themselves. 129 00:04:21,820 --> 00:04:23,700 So the model is 130 00:04:23,700 --> 00:04:27,920 that you get to look inside your things from your own site, 131 00:04:28,100 --> 00:04:29,200 but not from others. 132 00:04:29,500 --> 00:04:31,780 So if foo.com has an iframe to foo.com, 133 00:04:32,000 --> 00:04:34,620 yeah, I can look inside, change things, update it, whatever. 134 00:04:34,900 --> 00:04:37,220 But if foo.com has an iframe to bar.com, 135 00:04:37,460 --> 00:04:39,220 nah, not as much access at all. 136 00:04:39,940 --> 00:04:41,980 So it's a reasonable security policy, right? 137 00:04:42,100 --> 00:04:43,960 You know, two things come from the same place. 138 00:04:43,980 --> 00:04:45,040 They must be trusted the same. 139 00:04:45,380 --> 00:04:48,420 And of course, same place equals the same name, right? 140 00:04:49,520 --> 00:04:49,960 No. 141 00:04:52,100 --> 00:04:53,680 The problem is, is that, 142 00:04:53,700 --> 00:04:57,120 names don't host anything on the internet. 143 00:04:57,260 --> 00:04:59,220 Everything comes from IP addresses. 144 00:04:59,820 --> 00:05:05,060 So we use DNS to convert between a name, foo.com, 145 00:05:05,260 --> 00:05:08,000 to an IP address, 1.2.3.4. 146 00:05:08,340 --> 00:05:11,200 Now, the assumption is that the translation 147 00:05:11,200 --> 00:05:14,880 between foo and 1.2.3.4 is relatively static. 148 00:05:15,060 --> 00:05:16,080 It doesn't change much. 149 00:05:16,120 --> 00:05:17,080 It is what it is. 150 00:05:17,240 --> 00:05:21,240 And you know, foo.com would only return its own IP addresses. 151 00:05:22,380 --> 00:05:22,700 No. 152 00:05:22,700 --> 00:05:25,460 Foo.com can return whatever it damn well pleases, 153 00:05:25,500 --> 00:05:27,320 whenever it damn well pleases. 154 00:05:27,620 --> 00:05:30,560 The problem is, foo.com can return IP addresses 155 00:05:30,560 --> 00:05:33,380 of things completely outside its security domain. 156 00:05:34,360 --> 00:05:36,820 So what this means, I'll go to bar.com. 157 00:05:37,020 --> 00:05:38,540 One moment, bar.com? 158 00:05:38,740 --> 00:05:40,540 Oh, no, that's some server out in Europe. 159 00:05:40,840 --> 00:05:44,100 Next moment, dude, that's your printer down the hall. 160 00:05:45,400 --> 00:05:48,740 Okay, bar.com now has both resources. 161 00:05:49,020 --> 00:05:52,500 The resource downloaded from the European 162 00:05:52,500 --> 00:05:56,760 server is able to script against the resource downloaded from your printer. 163 00:05:57,060 --> 00:05:59,260 So your printer's behind the firewall. 164 00:05:59,860 --> 00:06:03,780 That server on Europe can't go ahead and access the printer directly. 165 00:06:04,120 --> 00:06:05,880 But you know what it can access is you. 166 00:06:06,280 --> 00:06:09,900 You have a browser, and it will do whatever the server on Europe says. 167 00:06:10,240 --> 00:06:13,640 And if it says, hey, go mess with the printer this way, 168 00:06:13,740 --> 00:06:15,080 your browser will do it. 169 00:06:16,060 --> 00:06:19,180 You actually have a situation where the internet can go ahead, 170 00:06:19,320 --> 00:06:22,060 bounce off your browser, and do things on your internal network. 171 00:06:22,500 --> 00:06:25,740 Now, of course, this was originally done, you know, from a corporate perspective. 172 00:06:26,000 --> 00:06:29,900 How many people here run, like, Linksyses and little home routers and so on? 173 00:06:32,700 --> 00:06:35,480 Yeah, yeah, you know that web interface on this? 174 00:06:36,480 --> 00:06:39,400 Yeah, at one moment, it's the server on Europe. 175 00:06:39,600 --> 00:06:43,580 At the other moment, it's the web interface of your Linksys box, dude. 176 00:06:43,680 --> 00:06:47,360 I mean, yeah, you better have a good password on that. 177 00:06:49,400 --> 00:06:52,040 So the attack works because the browser doesn't know 178 00:06:52,040 --> 00:06:55,800 that bar.com from the external IP is different than bar.com from the internal IP. 179 00:06:56,080 --> 00:06:58,260 This is totally by design. 180 00:06:58,740 --> 00:07:02,400 Look, you go to Google, you go to Yahoo, you go to CNN, you go to Akamai, 181 00:07:02,520 --> 00:07:04,820 you know, all these frickin' places, all these providers, 182 00:07:04,980 --> 00:07:08,080 all these content distribution networks are actually distributed 183 00:07:08,080 --> 00:07:10,200 across lots and lots of different IP addresses. 184 00:07:10,560 --> 00:07:12,800 And they don't want to care that, you know, 185 00:07:12,820 --> 00:07:15,920 oh, you downloaded this script from this instance of Akamai, 186 00:07:16,020 --> 00:07:18,420 but it actually is now scripting against this instance of Akamai. 187 00:07:18,520 --> 00:07:20,180 My God, this terrifies these guys. 188 00:07:20,860 --> 00:07:21,860 It wouldn't scale. 189 00:07:22,800 --> 00:07:24,880 So we have two problems. 190 00:07:25,260 --> 00:07:29,840 First, we've got to detect that we've even done this cross-IP script at all. 191 00:07:29,920 --> 00:07:32,300 That, you know, hey, you know, foo.com's moved, dude. 192 00:07:32,320 --> 00:07:33,180 And like, what's going on? 193 00:07:33,680 --> 00:07:36,100 The second is, what do we do about it? 194 00:07:36,260 --> 00:07:39,860 And what scared a lot of people is, well, what if what we do about it 195 00:07:39,860 --> 00:07:41,480 means that Yahoo doesn't work anymore? 196 00:07:41,640 --> 00:07:43,660 Because let me tell you, Yahoo likes working. 197 00:07:45,120 --> 00:07:48,540 So the canonical attack is the firewall bypass. 198 00:07:49,000 --> 00:07:51,840 Most corporate networks draw a significant distinction between the 199 00:07:51,840 --> 00:07:53,440 external network and the internal network. 200 00:07:53,660 --> 00:07:57,400 Now, there are all sorts of arguments about whether this is good or bad, 201 00:07:57,580 --> 00:07:58,660 but it's this nice thing. 202 00:07:58,720 --> 00:07:59,420 It's called reality. 203 00:07:59,680 --> 00:08:00,360 Get with it. 204 00:08:01,520 --> 00:08:05,640 The model is that things can route out, but things outside cannot route in. 205 00:08:05,780 --> 00:08:09,020 The attack is, by bouncing off a lured browser, 206 00:08:09,360 --> 00:08:12,100 an attacker on the outside can access resources inside. 207 00:08:13,080 --> 00:08:15,700 So what are our levels of exploitation? 208 00:08:16,680 --> 00:08:19,960 The basic one, you don't use any plug-ins at all. 209 00:08:20,080 --> 00:08:21,760 The browser gives you iframes. 210 00:08:21,840 --> 00:08:22,620 You can move them around. 211 00:08:22,880 --> 00:08:24,480 You can just use that. 212 00:08:25,060 --> 00:08:28,580 And what you end up with is, you know, one iframe is from Europe, 213 00:08:28,640 --> 00:08:30,520 and inside of that iframe is another one. 214 00:08:30,600 --> 00:08:31,740 It's a machine down the hall. 215 00:08:31,940 --> 00:08:33,060 They're from the same name. 216 00:08:33,140 --> 00:08:34,480 They can script against one another. 217 00:08:34,740 --> 00:08:35,800 What do you get here? 218 00:08:36,260 --> 00:08:37,420 HTTP resources. 219 00:08:38,140 --> 00:08:38,740 That's it. 220 00:08:38,860 --> 00:08:40,060 No special magic. 221 00:08:40,480 --> 00:08:43,480 The next level of attack actually comes from web plug-ins. 222 00:08:43,480 --> 00:08:47,700 That'd be your MSXML, your XML HTTP request, and even Silverlight. 223 00:08:47,900 --> 00:08:51,380 What you get here is the addition of not just HTTP, 224 00:08:51,880 --> 00:08:55,040 but because these things were built to interact with web services, 225 00:08:55,260 --> 00:08:59,460 now you get to go ahead, have all these arbitrary headers and, you know, messages, 226 00:08:59,600 --> 00:09:02,460 you know, things to control the infrastructure a bit more. 227 00:09:03,140 --> 00:09:07,620 But the real thing, the fun stuff, you know, for all the love of web services 228 00:09:07,620 --> 00:09:10,680 out in the professional world, you know, the corporate world, 229 00:09:11,360 --> 00:09:14,660 man, these guys are excited about getting back to raw sockets. 230 00:09:16,060 --> 00:09:21,480 So it turns out both Flash and Java have ways of giving you raw TCP and UDP access to things. 231 00:09:21,840 --> 00:09:24,860 So now you have a bunch of things that aren't the web at all 232 00:09:24,860 --> 00:09:26,940 that you're now reaching through your browser. 233 00:09:27,140 --> 00:09:30,140 And what we're seeing is, oh, man, you can do bad things with this. 234 00:09:32,280 --> 00:09:33,980 So let's look at Java first. 235 00:09:34,080 --> 00:09:36,980 Java was the original target of the 1996 Princeton attack. 236 00:09:37,300 --> 00:09:42,240 And, you know, they kind of solved the problem in their applet interface 11 years ago. 237 00:09:42,840 --> 00:09:46,020 And not only did they solve it 11 years ago, they kept it solved. 238 00:09:46,360 --> 00:09:47,160 Frickin' awesome. 239 00:09:48,500 --> 00:09:50,580 Except they had two different interfaces. 240 00:09:50,580 --> 00:09:54,640 So you could run a little Java applet and it would totally be safe 241 00:09:54,640 --> 00:09:57,280 and it would be un-re-bindable because Java would do its own download. 242 00:09:57,740 --> 00:09:58,740 Sweetness and light. 243 00:09:59,080 --> 00:10:01,220 Unfortunately, you could also use the second model 244 00:10:01,220 --> 00:10:04,540 that's supported in Firefox and Safari called Live Connect, 245 00:10:04,820 --> 00:10:08,080 where JavaScript gets to call Java objects correctly. 246 00:10:08,400 --> 00:10:10,200 And one of these objects is socket. 247 00:10:11,280 --> 00:10:13,160 No applet, no security. 248 00:10:13,380 --> 00:10:17,100 It's one of these situations where they put this big, huge wall over here, 249 00:10:17,240 --> 00:10:20,000 but look over there, there's a little bit of a back door. 250 00:10:20,000 --> 00:10:21,160 Don't pay attention. 251 00:10:21,840 --> 00:10:22,840 Works like a charm. 252 00:10:23,780 --> 00:10:26,660 You actually get some UDP out of that, which is kind of terrifying. 253 00:10:27,380 --> 00:10:30,760 But Flash. Flash is the big thing that I've been playing with. 254 00:10:30,980 --> 00:10:34,960 Flash has worked hardest to make arbitrary socket connections work when they're supposed to. 255 00:10:35,560 --> 00:10:38,180 You know, I feel bad about attacking Flash. 256 00:10:38,400 --> 00:10:42,240 I mean, these guys have worked their butt off to make this stuff actually safe and secure, 257 00:10:42,360 --> 00:10:44,520 and they made a beautiful security model. 258 00:10:44,920 --> 00:10:48,480 I mean, we're talking this is exactly what they should have done at every step of the way. 259 00:10:48,480 --> 00:10:51,280 They, unfortunately, did not deal with DNS rebinding, 260 00:10:51,360 --> 00:10:54,340 so all of their security model just collapses. 261 00:10:55,400 --> 00:10:58,660 This is what happens when you download your security policy from the wrong IP address. 262 00:10:58,820 --> 00:10:59,220 Crap. 263 00:11:04,480 --> 00:11:07,740 So what are the mechanisms for actually rebinding an address? 264 00:11:07,920 --> 00:11:09,820 There are lots of ways of using it, but, you know, 265 00:11:09,840 --> 00:11:12,160 how do you actually make this move in the first place? 266 00:11:12,460 --> 00:11:18,400 Now, I don't actually have it on my slide, but the reason I bring this up is there are kind of, sort of, 267 00:11:18,480 --> 00:11:22,540 a few people bringing up apocalyptically bad solutions to this problem. 268 00:11:23,140 --> 00:11:26,360 There's this whole class of solutions that pretty much can be defined as, 269 00:11:26,460 --> 00:11:29,420 there's not a hacker in the room when the solution was brought up. 270 00:11:30,060 --> 00:11:33,240 Please, all of you, your career goal should be, 271 00:11:33,300 --> 00:11:36,480 be the hacker in the room when dumb solutions are proposed. 272 00:11:37,740 --> 00:11:40,440 This is our value to society. 273 00:11:43,540 --> 00:11:47,740 So how do you actually cause the DNS infrastructure to accept a change of address? 274 00:11:47,740 --> 00:11:52,100 It actually was built to hold things around for a long period of time, 275 00:11:52,240 --> 00:11:54,900 so, you know, there's a reason people have this delusion. 276 00:11:55,160 --> 00:11:57,080 Well, there are three mechanisms, right? 277 00:11:57,380 --> 00:12:00,980 We've got a temporal mechanism, where we change things in time. 278 00:12:01,120 --> 00:12:02,740 Well, I'll just walk through them. 279 00:12:03,040 --> 00:12:04,800 Temporal, spatial, ridiculous. 280 00:12:06,360 --> 00:12:09,700 So our traditional rebinding method, and by far the easiest, 281 00:12:09,940 --> 00:12:13,620 look, records in DNS that map names to IP addresses, 282 00:12:13,780 --> 00:12:17,600 these records have a little time to live value that say how long they're valid. 283 00:12:17,740 --> 00:12:21,920 You know what, you can totally put a zero in there, and now it won't cache. 284 00:12:22,280 --> 00:12:25,180 So every single time it tries to make a connection, 285 00:12:25,480 --> 00:12:28,000 it'll go ahead and say, hmm, I'm making another connection. 286 00:12:28,180 --> 00:12:30,420 Has the address changed? Has the address changed? 287 00:12:31,520 --> 00:12:34,000 Amazingly enough, that's exactly the behavior we want. 288 00:12:35,460 --> 00:12:38,900 So some networks actually say, ah, we have our security solution. 289 00:12:39,280 --> 00:12:44,320 We'll say, an address has to be valid for at least five minutes, or at least ten minutes. 290 00:12:44,440 --> 00:12:46,360 And this is awesome, we have protected our customers. 291 00:12:46,640 --> 00:12:47,720 Because, you know, hackers are really good at this. 292 00:12:47,740 --> 00:12:50,240 They're really impatient people and can't wait five or ten minutes. 293 00:12:53,040 --> 00:12:54,660 Oh, oh, it gets worse. 294 00:12:55,520 --> 00:12:57,680 Watch this. Here's another little hack. 295 00:12:58,260 --> 00:13:02,980 You know, you can return multiple addresses at the same time in DNS. 296 00:13:03,560 --> 00:13:08,360 So when they ask for the address, you say, oh, it's both the machine out in Europe 297 00:13:08,860 --> 00:13:12,220 and the machine down the hall, and you can store that for like a day. 298 00:13:13,140 --> 00:13:14,320 And this works great. 299 00:13:14,760 --> 00:13:17,020 Now, of course, every once in a while, 300 00:13:17,020 --> 00:13:19,580 the browser will go ahead and pick the wrong one. 301 00:13:20,080 --> 00:13:22,680 So guess what you do? You try again. 302 00:13:23,720 --> 00:13:27,420 It turns out you can totally detect when you did it right and when you did it wrong. 303 00:13:27,700 --> 00:13:32,000 And I don't have time to go into the full method, but trust me, it's not that hard. 304 00:13:33,860 --> 00:13:35,860 The ridiculous method. This one's fun. 305 00:13:36,760 --> 00:13:40,580 Every once in a while, a bit of a tangent, every once in a while, 306 00:13:40,620 --> 00:13:44,080 you get people who try to use things as security technologies that really weren't. 307 00:13:44,220 --> 00:13:47,000 They're trying to use DNS, TTLs as security technologies. 308 00:13:47,020 --> 00:13:52,160 I haven't seen a screw up this bad since people tried to use virtualization as a security technology. 309 00:13:56,040 --> 00:13:57,860 Tommy the Tank Engine Security. 310 00:13:58,480 --> 00:13:59,860 You know, you guys know what that is? 311 00:14:00,440 --> 00:14:02,800 I think it's safe. I think it's safe. I think... 312 00:14:02,800 --> 00:14:03,160 Oh, fuck. 313 00:14:05,860 --> 00:14:06,340 God. 314 00:14:07,060 --> 00:14:09,340 Yeah, you know what virtual means? Not real. 315 00:14:13,440 --> 00:14:14,400 Okay. Okay. 316 00:14:14,760 --> 00:14:17,000 So overwriting a TTL, when you ask for it, 317 00:14:17,000 --> 00:14:20,080 and you actually control the record, turns out to be really easy. 318 00:14:20,280 --> 00:14:22,860 And this is by design. This is not surprising. 319 00:14:23,280 --> 00:14:25,440 Watch out. So I call it C-nyping. 320 00:14:26,160 --> 00:14:30,100 You know, when you look up a name, you can get back not just an address. 321 00:14:30,400 --> 00:14:32,000 You can get back, like, a different name. 322 00:14:32,200 --> 00:14:36,220 It says, yeah, I know you looked up foo, but what you really wanted is bar. 323 00:14:36,800 --> 00:14:41,380 It doesn't just say that. It goes, and bar's real IP address is this. 324 00:14:42,000 --> 00:14:46,720 Okay. When it says bar's real IP address is this, it overrides any TTLs 325 00:14:46,720 --> 00:14:47,720 that are already there. 326 00:14:48,660 --> 00:14:50,420 So watch. Here's the demo, right? 327 00:14:50,600 --> 00:14:53,820 We're going to look up 1.foo.mallory.com, and it's going to say, 328 00:14:53,920 --> 00:14:57,160 oh, yeah, I'm really bar.foo, and here's bar.foo's IP address. 329 00:14:57,480 --> 00:14:59,400 And, you know, that's now bar.foo's IP address, 330 00:14:59,540 --> 00:15:01,660 and it's going to be valid for 111 seconds. 331 00:15:03,020 --> 00:15:07,260 Unless I do a second query, where I look up 2.foo.mallory.com, 332 00:15:07,440 --> 00:15:11,280 and it says, oh, you know, this is at bar.foo.mallory.com as well. 333 00:15:11,560 --> 00:15:16,580 But look at this new IP address. It's all nice and fresh and has 120 seconds to be valid. 334 00:15:16,720 --> 00:15:18,440 Oh, look, bar's now moved. 335 00:15:19,360 --> 00:15:24,260 Yeah, do not use TTLs as some kind of magic security trick. 336 00:15:24,320 --> 00:15:25,480 It doesn't actually work. 337 00:15:26,880 --> 00:15:27,920 So, review. 338 00:15:28,280 --> 00:15:31,420 By swapping addresses from out from underneath the web browser 339 00:15:31,420 --> 00:15:35,040 by any of a number of means, we can get arbitrary TCP 340 00:15:35,040 --> 00:15:38,020 and sometimes UDP access to hosts reachable behind the client. 341 00:15:38,240 --> 00:15:39,400 Well, what can we do with this? 342 00:15:40,320 --> 00:15:41,620 I'm thinking VPN. 343 00:15:42,980 --> 00:15:45,180 So it's actually totally easy. 344 00:15:45,980 --> 00:15:50,520 Okay, yeah, it takes, like, seven programming languages and six protocols. 345 00:15:51,280 --> 00:15:52,120 Totally easy. 346 00:15:54,500 --> 00:15:57,760 Frickin' web coders, you guys change languages like... 347 00:15:57,760 --> 00:16:00,560 It's like you're in the middle of China, and it's like, oh, I've walked ten blocks, 348 00:16:00,720 --> 00:16:02,440 I have a new dialect. It's great. 349 00:16:04,640 --> 00:16:07,640 So, we got three actors in this little dance, right? 350 00:16:07,940 --> 00:16:10,820 We got a browser. The browser's got the good stuff. 351 00:16:10,920 --> 00:16:12,400 It has access to the internal resources. 352 00:16:12,840 --> 00:16:15,000 We got the attacker. He won. 353 00:16:15,000 --> 00:16:16,680 He wants that access, the internal resources. 354 00:16:17,120 --> 00:16:18,540 And then we got a proxy. 355 00:16:18,740 --> 00:16:21,400 And this proxy is gonna send code to the browser 356 00:16:21,400 --> 00:16:24,420 to copy messages back and forth to and from the attacker. 357 00:16:25,060 --> 00:16:27,780 Now, we're gonna start with a proxy running software that I wrote. 358 00:16:28,060 --> 00:16:29,340 I'm calling it Slurpee. 359 00:16:29,500 --> 00:16:32,300 The reason behind the name will be clear shortly. 360 00:16:33,560 --> 00:16:36,320 So, Slurpee. Slurpee's a multi-protocol server. 361 00:16:36,520 --> 00:16:38,380 It's built using the Perl object environment. 362 00:16:39,300 --> 00:16:41,800 Perl is great because of all of its massive libraries 363 00:16:41,800 --> 00:16:43,740 that mean I don't need to code things from scratch. 364 00:16:45,260 --> 00:16:47,080 It kind of speaks a few languages. 365 00:16:47,500 --> 00:16:50,500 So, the first thing it does is it talks to the attacker 366 00:16:51,140 --> 00:16:54,200 and gets TCP streams that need to be delivered through the browser. 367 00:16:54,480 --> 00:16:58,340 And these streams contain routing data saying where it would like it really to go. 368 00:16:59,000 --> 00:17:01,140 You got HTTP requests from the browser. 369 00:17:01,320 --> 00:17:04,220 Browser says, hey, what am I supposed to copy where? 370 00:17:05,220 --> 00:17:08,940 You've got DNS requests that this server also has to handle. 371 00:17:09,220 --> 00:17:13,080 Hey, you know, I'm swapping DNS around, so my proxy needs to own DNS. 372 00:17:13,080 --> 00:17:17,380 And then there's this fourth thing, which is XML socket requests. 373 00:17:17,840 --> 00:17:21,000 It turns out there's a routing policy mechanism in Flash. 374 00:17:21,280 --> 00:17:22,960 I'm telling you, these guys worked pretty hard. 375 00:17:24,120 --> 00:17:26,180 Unfortunately, I can provide that, too. 376 00:17:26,780 --> 00:17:29,600 So, the basic theme is that the attacker connects to the proxy, 377 00:17:29,720 --> 00:17:32,000 which manages the appropriate resources on the browser 378 00:17:32,000 --> 00:17:33,680 to service the attacker's connection. 379 00:17:34,580 --> 00:17:37,480 So, let's talk about how we actually build this. 380 00:17:38,300 --> 00:17:40,740 So, we start out with an iframe. 381 00:17:40,860 --> 00:17:42,080 I call it a bucket. 382 00:17:43,080 --> 00:17:47,080 And what this bucket does, it says, hey, proxy, got anything for me? 383 00:17:47,480 --> 00:17:48,780 And now that can be nothing. 384 00:17:48,840 --> 00:17:50,620 There might be no connections requests. 385 00:17:51,200 --> 00:17:54,940 But eventually, eventually, the bucket says, oh, yeah, 386 00:17:55,060 --> 00:17:56,660 I totally got something for you. 387 00:17:56,840 --> 00:17:57,560 Here you go. 388 00:17:57,620 --> 00:18:00,380 I want a connection to 10.0.0.1 port 80. 389 00:18:01,160 --> 00:18:05,440 And the browser goes, oh, crap, I got to go service this. 390 00:18:05,820 --> 00:18:09,860 So, what it does is for every individual IP address that it sees 391 00:18:09,860 --> 00:18:12,660 it's going to need to talk to, it goes and opens 392 00:18:12,660 --> 00:18:13,480 another iframe. 393 00:18:13,700 --> 00:18:17,020 And this iframe, all it's supposed to do is service 394 00:18:17,020 --> 00:18:18,300 connections for that IP address. 395 00:18:19,040 --> 00:18:21,380 And this iframe is called a socket. 396 00:18:22,240 --> 00:18:23,920 It's like a socket, but it sucks. 397 00:18:26,460 --> 00:18:30,580 So, what you end up with is that this child iframe actually comes 398 00:18:30,580 --> 00:18:34,220 from a different DNS name, meaning it can have a different mapping, 399 00:18:34,260 --> 00:18:35,700 as far as the browser knows, even. 400 00:18:35,900 --> 00:18:38,560 It can have a different IP address than the parent. 401 00:18:39,020 --> 00:18:39,740 And it will. 402 00:18:40,560 --> 00:18:41,420 Just not yet. 403 00:18:42,100 --> 00:18:45,940 So, we end up here with a bucket of sockets. 404 00:18:46,200 --> 00:18:49,480 And now, we need to go ahead and service these sockets. 405 00:18:49,580 --> 00:18:51,560 We need to actually get them into doing sockets. 406 00:18:51,940 --> 00:18:54,060 This brings up the obvious question. 407 00:18:55,380 --> 00:18:58,740 How many DNS requests does it take to get to the center of your 408 00:18:58,740 --> 00:18:59,340 corporate network? 409 00:19:02,320 --> 00:19:05,420 You have no idea how happy I was with the answer. 410 00:19:06,720 --> 00:19:08,320 So, we have query one. 411 00:19:09,240 --> 00:19:11,220 Query one involves loading the movie. 412 00:19:11,420 --> 00:19:12,940 And that comes from one. 413 00:19:13,740 --> 00:19:14,800 We have query two. 414 00:19:14,860 --> 00:19:16,600 That involves loading the security policy. 415 00:19:17,000 --> 00:19:18,880 We're still going to go ahead and we're going to have... 416 00:19:18,880 --> 00:19:20,260 I want to host the security policy. 417 00:19:20,380 --> 00:19:21,460 I don't want the real guy doing it. 418 00:19:21,740 --> 00:19:25,300 Two, now we need to go ahead and tell the server, hey, server, 419 00:19:26,100 --> 00:19:28,800 next time there's a lookup, don't come to me. 420 00:19:29,400 --> 00:19:30,920 Go to that IP over there. 421 00:19:31,760 --> 00:19:32,680 And we arm it. 422 00:19:32,840 --> 00:19:34,320 And we do query three. 423 00:19:35,040 --> 00:19:38,660 And we connect to 1001foo.proxyhost.com, port 80. 424 00:19:39,920 --> 00:19:40,820 All of a sudden. 425 00:19:40,820 --> 00:19:45,260 And now this DNS lookup resolves, uh-oh, 1001foo.proxyhost.com. 426 00:19:45,840 --> 00:19:47,940 I'm thinking 1001 is the address. 427 00:19:48,640 --> 00:19:49,080 Three. 428 00:19:49,620 --> 00:19:50,820 It takes three. 429 00:19:54,280 --> 00:19:55,160 So, okay. 430 00:19:55,260 --> 00:19:57,240 I'm totally going to do something I'm never supposed to do. 431 00:19:57,960 --> 00:20:00,120 You know what the difference between Black Hat and DEF CON is? 432 00:20:00,640 --> 00:20:02,940 I actually want to do a live demo for you guys. 433 00:20:08,400 --> 00:20:09,880 That and I have wired net. 434 00:20:09,940 --> 00:20:10,800 So, I actually can't. 435 00:20:10,800 --> 00:20:13,480 All right, I have no idea if this is going to work. 436 00:20:13,560 --> 00:20:14,880 It's live demo-tastic. 437 00:20:15,480 --> 00:20:18,640 All right, so here we have our little window. 438 00:20:18,780 --> 00:20:21,860 I know you can't see it much, but it's going ahead and it's updating. 439 00:20:22,000 --> 00:20:24,460 Hey, you know, do you have a, you got a connection for me? 440 00:20:24,640 --> 00:20:26,200 And I'm repeatedly saying no. 441 00:20:26,740 --> 00:20:29,760 Well, now what I'm going to do is I'm going to go over to my other window. 442 00:20:30,180 --> 00:20:37,840 And I'm going to say, hmm, I'd like to go to 2098142.254, port 80, protocol 6. 443 00:20:37,940 --> 00:20:38,900 Because I want to say TCP. 444 00:20:38,900 --> 00:20:40,740 And now I hit enter. 445 00:20:40,900 --> 00:20:42,760 Oh, you look at that, an iframe opened up in the back. 446 00:20:42,840 --> 00:20:43,780 I wonder why that happened. 447 00:20:45,300 --> 00:20:47,080 So, it gives me a little error message for fun. 448 00:20:47,720 --> 00:20:51,240 But wait, maybe, oh wait, it's socketed, it's connected. 449 00:20:52,040 --> 00:20:54,920 So, now, I know you can't read it, just trust me. 450 00:20:55,360 --> 00:21:04,240 We do get, slash, we hit enter, and, hey, I didn't write it for perf, let me tell you. 451 00:21:05,920 --> 00:21:06,560 Look at that. 452 00:21:07,800 --> 00:21:08,700 Browser just went ahead. 453 00:21:08,700 --> 00:21:09,680 Made a connection. 454 00:21:09,900 --> 00:21:10,800 Grabbed the web page. 455 00:21:11,080 --> 00:21:13,340 Now, I did this all by plain text protocols. 456 00:21:13,640 --> 00:21:15,880 You can do freaking anything over this. 457 00:21:16,160 --> 00:21:19,560 You can even do DNS because DNS runs over TCP 453. 458 00:21:22,580 --> 00:21:23,920 So, told you it worked. 459 00:21:25,520 --> 00:21:26,160 All right. 460 00:21:26,320 --> 00:21:28,200 So, how did I actually pull it off? 461 00:21:28,480 --> 00:21:30,440 So, there are data flows going on. 462 00:21:30,660 --> 00:21:34,540 We kind of have is this language called JSON, which, again, I know the screen sucks. 463 00:21:35,320 --> 00:21:38,560 But what JSON actually is is it goes ahead and says, okay, 464 00:21:38,560 --> 00:21:40,080 well, we've got our IP, 1001. 465 00:21:40,500 --> 00:21:43,380 We've got our connection on 1001, which is connection three. 466 00:21:43,880 --> 00:21:45,220 And then we have a bunch of things. 467 00:21:45,720 --> 00:21:50,200 We have a to browser field, which is data from the attacker to the browser. 468 00:21:50,600 --> 00:21:54,000 We have a from browser field, which is data from the browser to the attacker. 469 00:21:54,580 --> 00:21:57,900 And everything else is about state exchange, and we have acknowledgements, 470 00:21:57,900 --> 00:22:01,240 and, okay, I admit it, I ported TCP to JavaScript. 471 00:22:05,700 --> 00:22:08,240 And then it got really scary, but that's at the end of the talk. 472 00:22:08,560 --> 00:22:11,620 I should actually have my timer here so I know where the heck I am. 473 00:22:17,540 --> 00:22:18,120 All right. 474 00:22:18,980 --> 00:22:20,940 Well, it keeps the throat lubricated. 475 00:22:21,840 --> 00:22:22,320 All right. 476 00:22:22,600 --> 00:22:25,560 So, here's how we're managing our data flows. 477 00:22:26,400 --> 00:22:28,460 So, data is going to arrive by Flash. 478 00:22:28,560 --> 00:22:31,280 Flash has a little event handler that says, oh, my God, I got data. 479 00:22:32,040 --> 00:22:35,580 And what it does is Flash doesn't send the data back to the attacker itself. 480 00:22:35,740 --> 00:22:36,780 It doesn't even send it to the proxy. 481 00:22:36,980 --> 00:22:37,740 Oh, no, no, no. 482 00:22:37,740 --> 00:22:39,140 We got a web browser for that. 483 00:22:39,560 --> 00:22:43,740 So, Flash actually goes back into the web page that hosted it and says, 484 00:22:43,860 --> 00:22:44,720 all right, I got some data. 485 00:22:44,800 --> 00:22:45,380 Here, here you go. 486 00:22:46,180 --> 00:22:49,740 Now, the socket, the socket does not send the data either. 487 00:22:50,180 --> 00:22:54,220 What happens is the bucket goes around to each of the sockets and says, 488 00:22:54,360 --> 00:22:55,760 you got any data for me? 489 00:22:55,860 --> 00:22:57,060 You got any data for me? 490 00:22:57,160 --> 00:22:57,720 You got any, oh, okay. 491 00:22:57,820 --> 00:23:01,400 So, it turns out that iframes are actually running simultaneously with, 492 00:23:01,460 --> 00:23:02,400 you know, their parents. 493 00:23:02,720 --> 00:23:06,380 So, I had threading bugs in a web browser. 494 00:23:06,460 --> 00:23:07,020 Shoot me. 495 00:23:09,320 --> 00:23:11,880 So, I had to build a concurrency clean framework. 496 00:23:12,040 --> 00:23:14,200 My God, computer science came in useful. 497 00:23:15,600 --> 00:23:18,240 So, the bucket goes around, goes to each of the sockets, 498 00:23:18,320 --> 00:23:21,620 finds out that there's data to send, and then it goes ahead and sends this big 499 00:23:21,620 --> 00:23:24,400 list that looks exactly like that up to the server. 500 00:23:25,040 --> 00:23:29,540 Server proxy gets this big list, says, okay, let's pick out what's got to go 501 00:23:29,540 --> 00:23:32,240 where, let's send acknowledgements for what's got to go where, 502 00:23:32,440 --> 00:23:34,060 goes ahead and passes out data. 503 00:23:34,420 --> 00:23:36,240 Well, the attacker goes, great, I got data. 504 00:23:36,240 --> 00:23:38,120 Now, here's what I want some more of. 505 00:23:38,720 --> 00:23:39,960 Attacker provides some data. 506 00:23:40,400 --> 00:23:41,560 Attacker provides some data. 507 00:23:41,680 --> 00:23:45,820 It shows up in the exact same data structure, gets sent to the client. 508 00:23:46,000 --> 00:23:48,960 The bucket goes ahead and passes things out to each of the sockets. 509 00:23:49,500 --> 00:23:53,600 This architecture, not so much fast, frickin' flexible. 510 00:23:56,020 --> 00:23:57,620 So, obscure little things. 511 00:23:58,040 --> 00:24:03,140 One thing you might notice is that the iframes inside are actually in a different domain. 512 00:24:03,560 --> 00:24:05,700 Now, I told you earlier that, 513 00:24:06,240 --> 00:24:10,460 if foo.com tries to do bar.com, different domain, 514 00:24:10,820 --> 00:24:12,180 well, you can't look inside. 515 00:24:12,520 --> 00:24:14,760 You can't go ahead and read the DOM out. 516 00:24:14,820 --> 00:24:16,040 You can't read these variables. 517 00:24:16,260 --> 00:24:17,500 What are you doing? 518 00:24:18,600 --> 00:24:22,760 Well, it turns out this same origin policy actually has a little bit of an exception. 519 00:24:23,420 --> 00:24:27,620 If two pages are in the same domain, so they're both in, you know, proxyhost.com 520 00:24:27,620 --> 00:24:32,200 or notmalory.com or whatever, and they both say, hey, you know what? 521 00:24:32,300 --> 00:24:36,220 Even though we're in different subdomains, we want to be treated in the same domain. 522 00:24:36,240 --> 00:24:37,860 They can both claim this. 523 00:24:38,140 --> 00:24:41,720 And if they both do it, they'll both be allowed to script against each other. 524 00:24:42,340 --> 00:24:46,940 So, yeah, I actually used the same origin policy to attack the same origin policy. 525 00:24:47,700 --> 00:24:48,340 It's great. 526 00:24:49,680 --> 00:24:50,460 So, that's it. 527 00:24:50,600 --> 00:24:53,160 You know, a little bit of housekeeping for opening and closing sockets, 528 00:24:53,200 --> 00:24:55,080 and you're pretty much done. 529 00:24:55,740 --> 00:24:57,280 But what about the attacker? 530 00:24:57,440 --> 00:25:01,000 You know, I gave you a live demo, and I showed, you know, typing things out. 531 00:25:01,160 --> 00:25:05,900 Is it possible for us to do something more flexible than typing get slash into a TCP selection? 532 00:25:05,900 --> 00:25:07,200 Ooh, yeah. 533 00:25:09,120 --> 00:25:13,380 Who here was at my first DEF CON talk ever? 534 00:25:13,580 --> 00:25:14,100 Was anyone? 535 00:25:15,760 --> 00:25:16,360 Awesome! 536 00:25:17,520 --> 00:25:18,780 So, check this out. 537 00:25:18,980 --> 00:25:23,360 Back in the day, I used to use a tool called Slurp. 538 00:25:24,300 --> 00:25:26,560 Who here used Slurp back in the day? 539 00:25:28,080 --> 00:25:28,860 You, my people. 540 00:25:30,340 --> 00:25:31,780 Slurp is fantastic. 541 00:25:32,300 --> 00:25:33,980 Slurp was in 1995. 542 00:25:34,380 --> 00:25:35,880 The way you got... 543 00:25:35,900 --> 00:25:40,400 From your text connection, just a shell that you dialed into, 544 00:25:40,720 --> 00:25:46,400 Slurp let you get images and web browsers and graphics and pretty, pretty pictures. 545 00:25:46,680 --> 00:25:51,440 In fact, the PPP protocol is supported, I'm pretty sure stands for pretty, pretty pictures. 546 00:25:53,340 --> 00:25:56,040 Now, I talked about Slurp in 2001. 547 00:25:56,440 --> 00:25:58,580 Okay, it was old school back then. 548 00:25:59,160 --> 00:26:00,880 We know what it is now. 549 00:26:01,660 --> 00:26:02,920 Slurp does this. 550 00:26:03,060 --> 00:26:04,520 Given a stream of packets, 551 00:26:04,520 --> 00:26:06,200 create sockets. 552 00:26:06,740 --> 00:26:08,340 Just like the web browser. 553 00:26:09,240 --> 00:26:13,020 Create sockets and send the data and the packets to each of these sockets. 554 00:26:13,440 --> 00:26:16,440 Slurp was nat circa 1995. 555 00:26:17,620 --> 00:26:19,700 Now, if you want to go out and find Slurp, 556 00:26:20,500 --> 00:26:22,720 the latest versions kind of disappeared. 557 00:26:23,060 --> 00:26:24,560 I don't know what happened to them. 558 00:26:24,860 --> 00:26:29,600 I ended up having to go back to old hard drives from like three machines ago. 559 00:26:29,860 --> 00:26:31,100 And will you look at that? 560 00:26:31,140 --> 00:26:31,680 It's right there. 561 00:26:32,200 --> 00:26:32,820 Oh, yeah. 562 00:26:32,860 --> 00:26:34,040 I'm bringing Slurp back. 563 00:26:36,080 --> 00:26:36,820 That's right. 564 00:26:40,980 --> 00:26:42,200 Check this out. 565 00:26:42,680 --> 00:26:44,740 So we've got this code called PopTop. 566 00:26:44,940 --> 00:26:49,920 And what PopTop does is PopTop is a VPN server that works with Windows. 567 00:26:50,320 --> 00:26:53,460 And it'll actually go ahead and take the VPN connection. 568 00:26:53,700 --> 00:26:56,380 You know, we say, I want to make a connection to my workplace network. 569 00:26:56,760 --> 00:26:59,880 Well, one of the protocols it'll use is PPTP. 570 00:27:00,240 --> 00:27:02,820 Now, PPTP is an abomination. 571 00:27:03,360 --> 00:27:03,920 . 572 00:27:04,520 --> 00:27:07,780 I have no desire to express how horrifying a protocol it is. 573 00:27:08,020 --> 00:27:12,400 Just understand, PPTP ends up putting all of your packets 574 00:27:12,400 --> 00:27:16,760 through many layers of encapsulation into a stream of PPP data. 575 00:27:17,620 --> 00:27:22,940 Well, it turns out you can hand this stream of PPP to Slurp, 576 00:27:23,500 --> 00:27:25,720 which wants to go ahead and make socket connections. 577 00:27:26,460 --> 00:27:30,780 OK, so we have all the data from the applications coming into PPP. 578 00:27:30,940 --> 00:27:34,120 It comes into Slurp, and Slurp wants to make socket connections. 579 00:27:34,120 --> 00:27:37,580 What if we modified Slurp to, instead of making it themselves, 580 00:27:37,900 --> 00:27:39,960 go through the web browser I just told you about? 581 00:27:41,040 --> 00:27:47,020 Well, we now have Slurp connected to IE, thus the name of the software, Slurpee. 582 00:27:56,780 --> 00:28:01,120 So the way it works, the attacker runs the applications that run sockets. 583 00:28:01,220 --> 00:28:03,940 The sockets get their traffic sent over PPTP to Slurp. 584 00:28:03,940 --> 00:28:05,360 Slurp goes ahead and says, 585 00:28:05,500 --> 00:28:08,320 Hey, Slurpee, I got all these sockets. Go handle them for me. 586 00:28:08,680 --> 00:28:11,260 Proxy tells the browser, open the appropriate sockets. 587 00:28:11,440 --> 00:28:14,300 The browser opens the sockets, which themselves provide sockets. 588 00:28:14,440 --> 00:28:18,300 The proxy mediates the traffic between the attacker's sockets and the browser's sockets. 589 00:28:18,420 --> 00:28:19,980 And it all just works. 590 00:28:20,360 --> 00:28:22,880 You want to run Nessus over IE? You got Nessie. 591 00:28:23,400 --> 00:28:26,520 You want to run World of Warcraft over IE? You got Wowie. 592 00:28:29,000 --> 00:28:30,560 Pretty much anything over TCP. 593 00:28:30,900 --> 00:28:33,740 And if it's Firefox and Safari, you got some UDP. 594 00:28:34,880 --> 00:28:38,360 That's right, kids, VPN over IE. What could possibly go wrong? 595 00:28:42,420 --> 00:28:43,080 More toys. 596 00:28:44,960 --> 00:28:47,040 So lots of people have been looking into this. 597 00:28:47,480 --> 00:28:49,860 And I was wondering, well, what else can I use this for? 598 00:28:50,020 --> 00:28:51,780 You know, I'm kind of curious. This is kind of fun. 599 00:28:52,560 --> 00:28:55,080 Well, one thing that's been a big problem is click fraud. 600 00:28:55,220 --> 00:28:56,980 You know, if you can drive people's browsers around, 601 00:28:57,160 --> 00:29:00,900 you can go ahead and make them seem to click on things and do this and do that. 602 00:29:01,780 --> 00:29:02,140 Spam. 603 00:29:02,380 --> 00:29:03,920 Your browser will now say, 604 00:29:03,940 --> 00:29:04,400 send spam. 605 00:29:04,600 --> 00:29:07,040 That's exactly what I want to do when I go to a website. 606 00:29:07,380 --> 00:29:08,540 Make penis fast. 607 00:29:11,400 --> 00:29:12,740 What else can we do, though? 608 00:29:13,080 --> 00:29:16,520 Well, one thing that's pretty much inevitable is what's called stealth tor. 609 00:29:16,880 --> 00:29:20,540 This is where you go to a website and you are involuntarily added 610 00:29:20,540 --> 00:29:22,460 to a worldwide proxy network. 611 00:29:23,000 --> 00:29:25,940 Man, that's exactly what I think when I see a web ad. 612 00:29:26,100 --> 00:29:28,300 That could be a web proxy. 613 00:29:28,380 --> 00:29:28,720 Crap. 614 00:29:30,700 --> 00:29:33,020 Something else you can do is protect network neutrality. 615 00:29:33,020 --> 00:29:35,360 Oh, by the way, there's this stuff with peer-to-peer networking. 616 00:29:36,260 --> 00:29:39,440 And, um, see, Java provides UDP support. 617 00:29:39,680 --> 00:29:41,980 What that means is we can make the browsers go ahead 618 00:29:41,980 --> 00:29:44,080 and make all these UDP packets go around. 619 00:29:44,340 --> 00:29:48,460 And UDP is very nice in that it deals with NATS very, very nicely. 620 00:29:48,660 --> 00:29:53,360 You could actually build a cloud of browsers talking to each other 621 00:29:53,360 --> 00:29:55,860 with no central server managing them. 622 00:29:56,160 --> 00:29:58,520 It's not supposed to work. Oh, but it does. 623 00:29:59,780 --> 00:30:01,220 Then there was this one thing. 624 00:30:03,020 --> 00:30:05,540 Was anyone here at TCP IP drinking game last year? 625 00:30:08,300 --> 00:30:13,960 Anyone hear me talk very drunkenly about IP over spam? 626 00:30:17,440 --> 00:30:19,560 Okay, so I'm smashed, right? 627 00:30:19,880 --> 00:30:22,020 And there's this question that comes up, which is, 628 00:30:22,060 --> 00:30:24,440 how would you get around the Great Firewall of China? 629 00:30:25,020 --> 00:30:28,100 Now, of course, the person asking the question was expecting me to be like, 630 00:30:28,240 --> 00:30:30,480 oh, yes, you know, drop all the reset packets, 631 00:30:30,680 --> 00:30:32,680 and then, you know, it's the Harry Potter attack. 632 00:30:33,420 --> 00:30:35,740 Okay, I'm smashed. I got much better ideas. 633 00:30:37,280 --> 00:30:40,820 I'm like, look, China sends a crap ton of spam. 634 00:30:41,880 --> 00:30:43,860 China receives a crap ton of spam. 635 00:30:44,180 --> 00:30:46,800 That's a high-bandwidth, low-latency channel. 636 00:30:47,040 --> 00:30:48,880 Let's just copy our stuff into that. 637 00:30:51,240 --> 00:30:52,580 Okay, I was joking. 638 00:30:54,180 --> 00:30:58,940 And then I'm looking at this like, well, the browser does have IP inbound. 639 00:30:59,400 --> 00:31:02,000 Well, the browser does have spam outbound. 640 00:31:02,000 --> 00:31:04,440 Crap, I actually built it by accident. 641 00:31:06,060 --> 00:31:06,700 Damn it! 642 00:31:11,040 --> 00:31:13,440 Oh, I hate when that happens. 643 00:31:18,880 --> 00:31:24,940 So I had no idea people were so interested in this network neutrality thing. 644 00:31:25,760 --> 00:31:29,360 Last year, I'm messing with packets, and I'm like, oh, this is kind of cool. 645 00:31:29,540 --> 00:31:31,760 I can find when a provider is messing with me. 646 00:31:32,000 --> 00:31:32,380 Sweet! 647 00:31:34,100 --> 00:31:38,540 I've gotten so many people wanting that tool, so many people wanting that method, 648 00:31:38,720 --> 00:31:39,980 it's got a little bit of a bug. 649 00:31:40,340 --> 00:31:43,140 My method from last year for detecting messed-up networks, 650 00:31:43,380 --> 00:31:47,540 it kind of sort of involved flooding it with so much traffic 651 00:31:47,540 --> 00:31:49,220 that it actually started dropping packets. 652 00:31:50,220 --> 00:31:52,300 Yes, that's exactly what I want to do. 653 00:31:52,400 --> 00:31:55,280 I want to be the guy who tested networks by destroying them. 654 00:31:56,400 --> 00:31:57,540 Okay, that doesn't work. 655 00:31:57,960 --> 00:32:01,460 So I've actually been working over the last year, you know, 656 00:32:01,460 --> 00:32:01,980 kind of thinking about it. 657 00:32:01,980 --> 00:32:04,460 Thinking, you know, what else could I do to try to detect? 658 00:32:04,780 --> 00:32:06,760 And then I realized we're talking about it wrong. 659 00:32:07,060 --> 00:32:09,360 It's not about defending network neutrality. 660 00:32:09,360 --> 00:32:11,280 Network neutrality is a freaking status quo. 661 00:32:11,640 --> 00:32:15,200 That what's actually suggested is provider hostility. 662 00:32:16,620 --> 00:32:18,400 Okay, just a little secret. 663 00:32:18,540 --> 00:32:22,140 Every single person that I know working in router hardware 664 00:32:22,540 --> 00:32:24,680 is building stuff to make hostile networks. 665 00:32:25,080 --> 00:32:26,360 What do I define as hostile? 666 00:32:26,580 --> 00:32:30,140 If you're sniffing my traffic, you might very well be a hostile network. 667 00:32:30,400 --> 00:32:31,900 If you're altering my traffic, 668 00:32:31,900 --> 00:32:33,720 you're really a hostile network. 669 00:32:33,940 --> 00:32:36,460 And if you're selling my traffic to people, 670 00:32:36,700 --> 00:32:40,460 okay, look, we Napster music, they Napster us. 671 00:32:40,800 --> 00:32:44,180 The size of the B2B personal information market 672 00:32:44,180 --> 00:32:46,740 is way larger than the size of the music market. 673 00:32:48,220 --> 00:32:51,220 So for hostility, though, here's a nice little standard 674 00:32:51,220 --> 00:32:53,760 for if you know you're deploying a hostile network. 675 00:32:54,320 --> 00:32:57,440 If the US military would fucking kill you for doing it, 676 00:32:57,480 --> 00:32:58,700 you might be a hostile network. 677 00:32:59,840 --> 00:33:00,800 I'm just saying. 678 00:33:02,140 --> 00:33:05,700 So what do we need to detect provider hostility? 679 00:33:06,200 --> 00:33:09,340 Well, one of the problems is that if you download two things 680 00:33:09,340 --> 00:33:11,960 from two different pages and it comes at two different speeds, 681 00:33:12,980 --> 00:33:16,380 so they could have like different ISPs, different backhauls, 682 00:33:16,520 --> 00:33:19,540 different this, different that, it doesn't really tell you anything. 683 00:33:19,820 --> 00:33:22,100 And that's why they think they can get away with it. 684 00:33:22,480 --> 00:33:23,580 And I came along. 685 00:33:24,280 --> 00:33:28,540 So what we actually need is the ability for lots and lots 686 00:33:28,540 --> 00:33:31,680 and lots of different sites to actually seem to be 687 00:33:31,680 --> 00:33:34,280 hosted from the exact same place on the Internet. 688 00:33:34,840 --> 00:33:37,120 And it turns out we need to do two things. 689 00:33:37,320 --> 00:33:39,240 First, see if it's faster or slower. 690 00:33:39,420 --> 00:33:43,100 And second, see if they actually host the content from the website. 691 00:33:43,580 --> 00:33:47,780 One of the things that is actually a real problem 692 00:33:47,780 --> 00:33:50,640 and that it's starting to grow and it's starting to spread 693 00:33:50,640 --> 00:33:54,280 is something that I refer to as the Times Square effect. 694 00:33:54,820 --> 00:33:58,780 And as I realize it, I realize in horror, oh, dear God, 695 00:33:58,940 --> 00:34:00,760 I'm going to use awesome packet tools 696 00:34:00,760 --> 00:34:02,740 to save Internet advertising. 697 00:34:04,280 --> 00:34:06,860 This is not what I intended to do, but okay. 698 00:34:07,120 --> 00:34:09,260 This is the Times Square effect. Watch this. 699 00:34:11,020 --> 00:34:14,860 When you watch a movie and Times Square in New York City 700 00:34:14,860 --> 00:34:19,000 is in that movie, those ads aren't actually physically there. 701 00:34:19,180 --> 00:34:20,900 They're all digitally added. 702 00:34:21,220 --> 00:34:22,820 Now, why are they digitally added? 703 00:34:22,980 --> 00:34:24,100 Well, because they can be. 704 00:34:24,260 --> 00:34:26,300 It turns out there's no contractual relationship 705 00:34:26,300 --> 00:34:30,740 between the movie maker and the actual, you know, 706 00:34:30,760 --> 00:34:33,640 physical place that has those ads up on buildings. 707 00:34:34,480 --> 00:34:36,020 There's no contractual obligation. 708 00:34:36,540 --> 00:34:37,200 Well, you know what? 709 00:34:37,240 --> 00:34:39,960 Your ISP is actually under no contractual obligation 710 00:34:40,540 --> 00:34:42,680 to actually host the real contents of Google, 711 00:34:42,920 --> 00:34:45,100 to actually host the real contents of MySpace. 712 00:34:45,380 --> 00:34:46,720 There's none of it. 713 00:34:47,220 --> 00:34:51,980 And do you realize how much money you could make 714 00:34:51,980 --> 00:34:55,220 if you could sell the top link on Google? 715 00:34:55,960 --> 00:35:00,580 Okay. Google has built a neutral playground, a neutral framework, 716 00:35:00,580 --> 00:35:02,680 where the way to get to be the top link 717 00:35:02,680 --> 00:35:07,760 is to actually have the top best material for that subject. 718 00:35:08,200 --> 00:35:13,520 It turns out that it would be a lot easier. 719 00:35:13,780 --> 00:35:16,220 And in fact, Google would theoretically make a lot more money 720 00:35:16,220 --> 00:35:18,540 if they just sold that top link. 721 00:35:18,740 --> 00:35:21,420 Now, Google won't do it because their long-term brand 722 00:35:21,420 --> 00:35:24,880 is defended by actually having the best search results. 723 00:35:26,460 --> 00:35:29,420 But let me tell you, there are people out there who want to pay, 724 00:35:29,500 --> 00:35:30,560 and they want to pay a lot. 725 00:35:30,560 --> 00:35:30,940 They want to pay a lot of money. 726 00:35:31,100 --> 00:35:33,360 And the ISPs are starting to realize we like money. 727 00:35:36,360 --> 00:35:39,100 The web has been built on a model that man-in-the-middle attacks 728 00:35:39,100 --> 00:35:40,080 aren't going to happen. 729 00:35:40,360 --> 00:35:43,200 And what we're seeing is that entire companies are spawning 730 00:35:43,200 --> 00:35:45,480 that are doing man-in-the-middle attacks against advertising. 731 00:35:45,860 --> 00:35:47,820 Believe it or not, you don't mind ads that much. 732 00:35:48,600 --> 00:35:50,780 You might, some of them do, but you know what? 733 00:35:50,840 --> 00:35:51,960 You're the guys who don't click on them. 734 00:35:52,960 --> 00:35:56,380 Now, because of that, at least we expect that the ads we're seeing 735 00:35:56,380 --> 00:35:59,120 are going to, you know, the people actually running the web pages. 736 00:35:59,260 --> 00:35:59,600 No. 737 00:35:59,600 --> 00:36:02,720 The providers want to show their ads instead, and that's a problem. 738 00:36:04,040 --> 00:36:07,020 So, here's a modest proposal for actually building this. 739 00:36:07,360 --> 00:36:10,780 I've kind of noticed with my newfound knowledge of Flash, 740 00:36:11,020 --> 00:36:16,460 hey, look, we actually can do all sorts of crazy things with the DOM from Flash. 741 00:36:16,660 --> 00:36:18,060 We can hop things around. 742 00:36:18,300 --> 00:36:21,960 It turns out one of the things we can do is we can have a secure loader. 743 00:36:22,260 --> 00:36:26,260 We load this Flash applet over SSL, and then it goes ahead 744 00:36:26,260 --> 00:36:29,000 and it grabs stuff from all over the place, just like the browser does. 745 00:36:30,240 --> 00:36:34,480 But our loader has a list of hashes, and it says, hey, okay, well, 746 00:36:34,540 --> 00:36:35,920 this is what I'm supposed to get back. 747 00:36:36,500 --> 00:36:40,940 If I get something else back, if I get back a different ad, crap, 748 00:36:41,120 --> 00:36:43,660 I'm one of those evil networks, those bastards. 749 00:36:43,960 --> 00:36:45,200 All right, let's go soon. 750 00:36:45,300 --> 00:36:47,620 In the meantime, let's host the ad over a secure link. 751 00:36:48,520 --> 00:36:51,760 Like it or not, this is probably what the web is going to have to do, 752 00:36:51,820 --> 00:36:54,280 because the providers are getting really, really creepy. 753 00:36:54,960 --> 00:36:57,100 So, I'm building a tool set to do this. 754 00:36:57,480 --> 00:36:58,740 It's going to be called NDK. 755 00:36:58,740 --> 00:37:03,400 NDK stands for Not Domo-kun, because I would never go ahead 756 00:37:03,400 --> 00:37:07,220 and use the slogan of some big Japanese television show to name my software. 757 00:37:07,340 --> 00:37:08,380 That would just be wrong. 758 00:37:09,460 --> 00:37:10,660 So, Not Domo-kun. 759 00:37:11,800 --> 00:37:14,560 So, I know a lot of you guys might think, oh, you know, 760 00:37:14,580 --> 00:37:16,420 why am I helping the commercial realm? 761 00:37:16,680 --> 00:37:20,160 Well, guess why you have crypto in your browser in the first place. 762 00:37:20,380 --> 00:37:23,700 About, you know, a couple of years back, the people who wanted you to put 763 00:37:23,700 --> 00:37:27,320 your credit card over the internet, they're like, we like money too. 764 00:37:27,320 --> 00:37:30,600 In order for us to get money, we need good crypto. 765 00:37:30,780 --> 00:37:33,040 Therefore, we need good crypto, because we like money. 766 00:37:33,540 --> 00:37:36,400 The whole goal is aligning their goals with ours. 767 00:37:39,140 --> 00:37:41,660 So, is it possible? 768 00:37:41,900 --> 00:37:42,820 Interesting question. 769 00:37:43,300 --> 00:37:47,840 Is it possible to get better data regarding the spread of provider hostility? 770 00:37:48,580 --> 00:37:52,460 And it turns out we can totally start using all the DNS rebinding tools. 771 00:37:53,080 --> 00:37:53,780 Well, what? 772 00:37:53,860 --> 00:37:57,200 You know, we now have all sorts of mad control over the browser network. 773 00:37:57,320 --> 00:38:02,220 Which means all these things that were hard before in terms of checking up 774 00:38:02,220 --> 00:38:06,560 on networks, we now have the web browsers that are going to help us. 775 00:38:07,280 --> 00:38:08,380 So, here's what we're going to do. 776 00:38:09,240 --> 00:38:09,800 All right. 777 00:38:10,680 --> 00:38:12,800 Who here knows what a transparent proxy is? 778 00:38:14,700 --> 00:38:15,180 Rock. 779 00:38:15,540 --> 00:38:16,780 All right, so check this out. 780 00:38:17,740 --> 00:38:21,440 Transparent proxies, the way they work, you think you've got a real connection 781 00:38:21,440 --> 00:38:26,280 to the internet, but it turns out if you send out a request on port 80, all your 782 00:38:26,280 --> 00:38:28,740 traffic gets routed to this one guy. 783 00:38:29,100 --> 00:38:34,160 And then he looks at the host header on your request and says, oh, oh, oh, I know it came 784 00:38:34,160 --> 00:38:38,740 to me, but who you really wanted was CNN, who you really wanted was Yahoo, who you really 785 00:38:38,740 --> 00:38:39,400 wanted was whatever. 786 00:38:40,000 --> 00:38:44,980 Now, on its face, this causes real problems for Flash and Java, because Flash and Java 787 00:38:44,980 --> 00:38:50,000 are like, okay, we only want you to be able to connect back to the guy you got your applet 788 00:38:50,000 --> 00:38:50,220 from. 789 00:38:51,040 --> 00:38:55,240 Unfortunately, the guy you got your applet from was the transparent proxy, and guess 790 00:38:55,240 --> 00:38:56,260 how much of the internet is there? 791 00:38:56,260 --> 00:38:57,280 It's behind the transparent proxy? 792 00:38:57,520 --> 00:38:59,120 Oh, yeah, all of it. 793 00:38:59,940 --> 00:39:02,900 Not just the external network, the internal network, too. 794 00:39:03,100 --> 00:39:08,180 It's like, hey, transparent proxy, hey, 1.2.3.4, give me this host that's inside this network. 795 00:39:08,360 --> 00:39:08,960 Thing goes, okay. 796 00:39:10,520 --> 00:39:11,220 Here you go. 797 00:39:11,880 --> 00:39:12,360 Crap. 798 00:39:13,700 --> 00:39:17,320 Okay, proxies are so horrifyingly broken, it doesn't work. 799 00:39:18,220 --> 00:39:26,240 So what we can do, it turns out, remember I said earlier, what we want is to be able 800 00:39:26,240 --> 00:39:31,400 out of a neutrality test, what we want out of a hostility detection framework is to filter 801 00:39:31,400 --> 00:39:36,260 out all the changes that might come from the weirdness of the internet and instead just 802 00:39:36,260 --> 00:39:37,260 have the provider network. 803 00:39:37,580 --> 00:39:42,140 Well, there's a great thing about transparent proxies, they live on the provider network. 804 00:39:42,520 --> 00:39:47,200 So if a transparent proxy would, I don't know, perhaps be willing to go ahead and provide 805 00:39:47,890 --> 00:39:52,360 two different websites at two different speeds, well, that's entirely within the provider 806 00:39:52,360 --> 00:39:52,740 network. 807 00:39:53,280 --> 00:39:54,840 Straight up test for hostility. 808 00:39:55,160 --> 00:39:55,700 Awesome. 809 00:39:56,920 --> 00:39:58,780 But there's a difference, though. 810 00:39:59,240 --> 00:40:01,160 There's something called the silent sensor. 811 00:40:01,460 --> 00:40:06,060 It turns out none of the big ISPs, much to my surprise, actually seem to have transparent 812 00:40:06,060 --> 00:40:06,900 proxies deployed. 813 00:40:07,440 --> 00:40:13,000 You know, your Comcasts, your AT&Ts, you know, all these guys, they don't seem to do this. 814 00:40:13,080 --> 00:40:14,760 I think it's for scalability reasons. 815 00:40:14,980 --> 00:40:18,680 These proxies fall over and now you have a bunch of pissed-off customers. 816 00:40:19,340 --> 00:40:21,800 However, they may have filter boxes. 817 00:40:22,120 --> 00:40:25,700 What these filter boxes might do is they'll go ahead and they'll say, hmm. 818 00:40:25,700 --> 00:40:31,540 You connected to this IP address and you asked it for a host, CNN, Yahoo, MySpace, Google, whatever. 819 00:40:31,860 --> 00:40:34,380 And I either like it or don't like it. 820 00:40:34,740 --> 00:40:41,440 Well, now what we can do with Flash is we can go to an IP address, testyournetwork.com, port 80, 821 00:40:41,520 --> 00:40:47,840 and be like, yeah, this block of one meg, this one's from CNN, I promise. 822 00:40:48,980 --> 00:40:54,180 You can do it faster or slower and it'll tell you and it'll totally do the rules. 823 00:40:54,800 --> 00:40:56,020 Now, here's the problem. 824 00:40:56,720 --> 00:41:02,060 Problem is, is that I assume there's a jackass as smart as me in all these different carriers. 825 00:41:02,580 --> 00:41:06,600 And this guy's like, ah, I can totally detect him doing this. 826 00:41:06,860 --> 00:41:10,340 He'll have the wrong IP, he'll have the wrong this, he'll have the wrong that. 827 00:41:10,600 --> 00:41:16,760 So I was kind of curious, can I make a detection framework that even I can't defeat? 828 00:41:20,140 --> 00:41:21,480 Either way, I win. 829 00:41:26,180 --> 00:41:27,880 Well, so here's the problem. 830 00:41:28,100 --> 00:41:30,120 You know, we want to spoof sites on the internet. 831 00:41:30,280 --> 00:41:32,080 We want to use their real IPs. 832 00:41:32,080 --> 00:41:33,980 We want to have the real TTLs. 833 00:41:33,980 --> 00:41:35,420 We want to have the real ports. 834 00:41:35,560 --> 00:41:38,300 We want to see what they would see even though we're not man in the middle. 835 00:41:38,420 --> 00:41:41,940 We really don't want the real sites to mess with us as we're doing it. 836 00:41:42,840 --> 00:41:43,600 Good luck. 837 00:41:43,780 --> 00:41:48,680 I mean, we'd have to have like sequence numbers from the browser to know what the heck it's doing. 838 00:41:48,820 --> 00:41:52,940 And we're certainly not getting TCP sequence numbers from a browser, right? 839 00:41:57,220 --> 00:41:58,800 Oh, hell no. 840 00:42:01,420 --> 00:42:02,860 ActiveX is redeemed. 841 00:42:02,880 --> 00:42:09,840 There's an ActiveX plugin that will put a packet sniffer in a web browser and fire JavaScript events when a packet arrives. 842 00:42:10,840 --> 00:42:11,620 Holy crap. 843 00:42:18,060 --> 00:42:20,120 This really shouldn't exist. 844 00:42:23,200 --> 00:42:25,520 Okay, now we can have some fun. 845 00:42:25,720 --> 00:42:28,600 Oh, yeah, and I'm bringing packets back. 846 00:42:29,640 --> 00:42:30,800 So check this out. 847 00:42:30,860 --> 00:42:31,660 I'm building this tool. 848 00:42:31,720 --> 00:42:33,020 It's called Inspector Packet. 849 00:42:36,100 --> 00:42:40,200 I'm going to do Paquetto Kiritsu 3.0 just to release this. 850 00:42:41,140 --> 00:42:46,000 So what normally stops Mallory from pretending to be a random site on the internet? 851 00:42:46,220 --> 00:42:48,660 Well, you know Mallory doesn't know the sequence numbers to use. 852 00:42:48,780 --> 00:42:50,100 And Mallory has no idea. 853 00:42:50,120 --> 00:42:51,620 She doesn't compete with a real server. 854 00:42:52,060 --> 00:42:53,740 Well, what toy do we have now? 855 00:42:53,920 --> 00:42:55,540 We've got a sniffer running on Alice. 856 00:42:55,760 --> 00:42:57,440 We've got a sniffer running on the client. 857 00:42:57,800 --> 00:42:59,680 So check out what Mallory can do. 858 00:43:00,060 --> 00:43:04,720 Well, first of all, she can send all this data to Alice with the exact right sequence numbers. 859 00:43:05,020 --> 00:43:06,600 Totally has the codes to get in. 860 00:43:07,040 --> 00:43:08,460 Well, here's a problem, you know. 861 00:43:09,260 --> 00:43:15,080 Alice is going to acknowledge, not to Mallory, because the IP address is still, you know, CNN, MySpace, whatever. 862 00:43:16,320 --> 00:43:20,100 Alice is going to acknowledge and Mallory, and then, you know, the real server is going to be like, 863 00:43:20,100 --> 00:43:23,160 what the hell are you talking about? 864 00:43:23,260 --> 00:43:24,440 I didn't send you that data. 865 00:43:24,540 --> 00:43:25,560 Reset, reset, reset. 866 00:43:28,060 --> 00:43:33,120 Unless, you know, Mallory has the actual sequence number to send a reset to the server too. 867 00:43:33,580 --> 00:43:36,560 And it turns out Mallory can shut down MySpace. 868 00:43:36,660 --> 00:43:37,300 Be like, you know what? 869 00:43:37,380 --> 00:43:38,640 That client went away. 870 00:43:39,860 --> 00:43:44,360 Now, normally, normally what would happen is, you know, these packets arrive at, 871 00:43:44,380 --> 00:43:49,440 these packets arrive at MySpace or whatever and the server says, you know, 872 00:43:49,440 --> 00:43:52,820 I'm getting all the acknowledgements, but I don't have a session open to you. 873 00:43:52,960 --> 00:43:55,300 So, client, why don't you shut down your session? 874 00:43:55,920 --> 00:44:00,000 But then came security and security put in a firewall. 875 00:44:00,260 --> 00:44:02,880 And the firewall says, I don't have a session open to you. 876 00:44:02,980 --> 00:44:05,440 I'm going to pretend like I don't exist. 877 00:44:05,960 --> 00:44:07,940 I'm just going to be nice and silent. 878 00:44:08,400 --> 00:44:12,760 So, what this means is when Mallory shuts down the connection to MySpace, 879 00:44:13,440 --> 00:44:17,740 MySpace ignores now all the acknowledgements coming from Alice. 880 00:44:17,740 --> 00:44:19,540 It totally works. 881 00:44:19,920 --> 00:44:23,220 And now what this means is, you know, Mallory is sending traffic to Alice. 882 00:44:24,320 --> 00:44:28,020 Mallory's provider thinks MySpace is sending traffic to Alice. 883 00:44:28,260 --> 00:44:32,200 And when Alice acknowledges back, well, that goes back up to MySpace. 884 00:44:32,640 --> 00:44:38,280 But, and this is the great part, you know, Alice has a sniffer. 885 00:44:38,520 --> 00:44:43,800 And Alice is actually tunneling all those acknowledgements over an encrypted XGTPS stream. 886 00:44:44,000 --> 00:44:46,420 That's right, I'm doing TCPX over JavaScript. 887 00:44:46,820 --> 00:44:47,720 Not constantly. 888 00:44:47,720 --> 00:44:47,980 Kinda. 889 00:44:47,980 --> 00:44:51,140 I'm actually tunneling TCPX over JavaScript. 890 00:44:51,520 --> 00:44:52,000 Rock. 891 00:44:54,500 --> 00:44:56,780 So, why am I so eager to do this? 892 00:44:57,220 --> 00:44:59,000 Check out this level of evil here. 893 00:44:59,560 --> 00:45:03,200 You know, the goal is to identify the applications being used on the network. 894 00:45:03,400 --> 00:45:05,160 Some of these devices can go much further. 895 00:45:05,340 --> 00:45:10,000 Those from a company like Nares, for instance, can look inside all traffic from a specific IP address, 896 00:45:10,240 --> 00:45:16,440 pick out the HTTP traffic, drill further down, reassemble emails as they're typed out by the user. 897 00:45:16,560 --> 00:45:17,700 These guys are so eager. 898 00:45:17,720 --> 00:45:21,400 They're so eager to spy on you, they can't even wait for you to finish writing the email. 899 00:45:21,620 --> 00:45:23,380 They're like watching you as you go. 900 00:45:23,540 --> 00:45:25,420 What kind of creepy shit is this? 901 00:45:27,520 --> 00:45:29,440 Oh, I'm so messing with these guys. 902 00:45:29,740 --> 00:45:30,860 Now I can go ahead. 903 00:45:31,000 --> 00:45:32,560 They want to do deep packet inspection. 904 00:45:32,980 --> 00:45:36,940 I can pretend to be any site on the internet providing any content I want. 905 00:45:37,080 --> 00:45:38,400 And there's a real open question. 906 00:45:38,560 --> 00:45:39,600 Do I get to exploit them? 907 00:45:40,520 --> 00:45:42,340 I'm sending traffic to my client. 908 00:45:42,460 --> 00:45:44,200 I have no idea who's in the middle. 909 00:45:44,980 --> 00:45:47,640 Hey, if you're deeply inspected, 910 00:45:47,640 --> 00:45:49,340 and you're inspecting my traffic, and you have no right to, 911 00:45:49,420 --> 00:45:51,380 I'm not sure you have the right not to get exploited. 912 00:45:51,580 --> 00:45:52,140 I'm just saying. 913 00:46:01,820 --> 00:46:04,100 So, you know, if any of you are with one of these companies, 914 00:46:04,240 --> 00:46:06,100 I recommend inspecting this. 915 00:46:07,000 --> 00:46:07,320 Deeply. 916 00:46:10,460 --> 00:46:11,560 So, some conclusions. 917 00:46:12,040 --> 00:46:14,640 And then it looks like I'll have time to show off my little toy. 918 00:46:15,640 --> 00:46:15,960 Um... 919 00:46:16,740 --> 00:46:19,800 DNS rebinding is threatening the boundaries of networks. 920 00:46:20,200 --> 00:46:22,640 Your Linksys routers, your corporate networks, 921 00:46:22,760 --> 00:46:27,300 pretty much full TCP and partial UDP connectivity is getting exposed. 922 00:46:27,720 --> 00:46:28,840 This is not good. 923 00:46:28,980 --> 00:46:30,420 We have to do something about this. 924 00:46:30,620 --> 00:46:31,260 And you know what? 925 00:46:31,300 --> 00:46:34,560 A lot of people really are working very, very hard on fixing this. 926 00:46:34,940 --> 00:46:36,700 Beyond that, though, the web... 927 00:46:37,220 --> 00:46:38,440 Look, I love the web. 928 00:46:38,600 --> 00:46:42,200 The web was built for all resources that were publicly available. 929 00:46:42,540 --> 00:46:43,440 That was the idea. 930 00:46:43,580 --> 00:46:44,340 That was the model. 931 00:46:44,340 --> 00:46:46,980 We really need to have some better thinking 932 00:46:46,980 --> 00:46:49,860 in terms of how we handle private resources. 933 00:46:50,320 --> 00:46:54,600 Stuff that, you know, I can access, but you can't. 934 00:46:55,280 --> 00:46:57,940 The web really wasn't built for access control. 935 00:46:58,200 --> 00:46:59,620 And we need it. 936 00:46:59,740 --> 00:47:03,620 Because we're putting a crap ton of private stuff on websites. 937 00:47:04,340 --> 00:47:08,740 Beyond that, because of the spread of these provider-in-the-middle attacks, 938 00:47:09,080 --> 00:47:11,700 everyone running a website that depends on advertising, 939 00:47:12,040 --> 00:47:13,560 expect in a year or two 940 00:47:13,560 --> 00:47:16,200 that you're going to have to try to find some way to encrypt all your traffic. 941 00:47:16,340 --> 00:47:17,860 It sucks. It's horrible. 942 00:47:18,020 --> 00:47:20,900 In fact, SSL really isn't built to be able to do it right. 943 00:47:21,060 --> 00:47:21,820 But guess what? 944 00:47:21,920 --> 00:47:24,580 If you don't, other people's ads are going up instead of yours. 945 00:47:25,380 --> 00:47:30,560 And finally, people who are messing with my traffic, I mess back. 946 00:47:32,660 --> 00:47:34,540 So, that's the big stuff I've got. 947 00:47:35,320 --> 00:47:37,660 Now the fun little toy, because I got time. 948 00:47:39,780 --> 00:47:42,060 So, how did all this happen in the first place? 949 00:47:42,620 --> 00:47:43,140 You know? 950 00:47:43,560 --> 00:47:46,200 I sit down, I relax, put some music on. 951 00:47:47,920 --> 00:47:51,400 I may kind of, sort of, when I build stuff, get totally and utterly distracted. 952 00:47:52,000 --> 00:47:53,940 It's happened before. It'll happen again. 953 00:47:54,260 --> 00:47:56,860 I end up writing some completely random crap 954 00:47:56,860 --> 00:47:58,880 and then finding out, like, a month later, 955 00:47:59,000 --> 00:48:01,680 oh, that's why I built that. 956 00:48:04,840 --> 00:48:08,880 So, last year, I go ahead and I give this talk about dot plots. 957 00:48:09,100 --> 00:48:11,140 They're a way of visualizing data similarity. 958 00:48:11,140 --> 00:48:17,980 And I get back this two-line piece of feedback that had almost as much punctuation as text. 959 00:48:18,580 --> 00:48:21,180 It's like, dot plots, what the f... 960 00:48:21,960 --> 00:48:22,880 Well, thank you. 961 00:48:23,020 --> 00:48:24,140 Do you like it? 962 00:48:24,180 --> 00:48:24,860 Do you hate it? 963 00:48:26,120 --> 00:48:30,120 So, they're a mechanism for visually analyzing similarity across a data set. 964 00:48:30,300 --> 00:48:32,160 You know, go check out last year's talk for details. 965 00:48:33,020 --> 00:48:35,060 So, I thought I'd go ahead and port it to Winamp. 966 00:48:35,340 --> 00:48:36,400 I figured it'd be pretty. 967 00:48:36,560 --> 00:48:40,520 I mean, you know, I originally got the idea, if you look at music, it's very structural. 968 00:48:40,520 --> 00:48:42,040 There's very much repeats. 969 00:48:42,240 --> 00:48:43,620 There's things that go back and forth. 970 00:48:44,740 --> 00:48:47,360 I'm listening to music. I like pretty pictures. 971 00:48:47,700 --> 00:48:50,800 I think I'll like listening to music that generates pretty pictures. Cool. 972 00:48:52,200 --> 00:48:56,020 I figured it'd be nice to have something that I'd never be showing at Black Hat. 973 00:48:56,180 --> 00:48:57,580 Now, DEF CON, of course, because it's cool, 974 00:48:57,680 --> 00:49:00,680 but, you know, make something that the security geeks over there don't need to know. 975 00:49:01,820 --> 00:49:05,000 And I actually got, and this is what I was showing at the beginning of my talk, 976 00:49:05,140 --> 00:49:10,460 I actually got something that really generated very nice patterns out of arbitrary, 977 00:49:10,520 --> 00:49:10,980 arbitrary music. 978 00:49:11,200 --> 00:49:15,120 What I do is I take the spectrum and I compare it vertically and compare it horizontally. 979 00:49:15,520 --> 00:49:20,360 And it turns out I get these vertical lines that form when I have a beat. 980 00:49:20,580 --> 00:49:22,720 I mean, it's actual visual beat analysis. 981 00:49:23,340 --> 00:49:27,880 And just to show that it's actually accurate, when I speed up the beat, 982 00:49:28,040 --> 00:49:30,000 the lines shrink in on each other. 983 00:49:30,140 --> 00:49:33,680 When I slow it down, they get farther and farther away. 984 00:49:34,300 --> 00:49:36,360 Sweet. This is exactly what I wanted. 985 00:49:36,480 --> 00:49:37,160 This is cool. 986 00:49:37,900 --> 00:49:39,920 So, the images are based on 987 00:49:39,920 --> 00:49:41,200 spectral similarity. 988 00:49:41,560 --> 00:49:47,300 How similar is what I'm hearing now to what I've heard for the last n seconds? 989 00:49:47,820 --> 00:49:50,300 So, really dumb little method. 990 00:49:50,460 --> 00:49:51,800 Don't try this at home. 991 00:49:52,000 --> 00:49:57,100 But the idea was bass would be red, mid-range would be green, treble would be blue. 992 00:49:57,340 --> 00:50:01,960 And if you actually look at various instruments, various timbers of sound, 993 00:50:02,200 --> 00:50:07,300 they actually have different layouts in terms of how much relatively they're using of each. 994 00:50:07,520 --> 00:50:09,500 Well, that means you get different colors 995 00:50:09,500 --> 00:50:12,140 for different songs and different segments of songs. 996 00:50:13,700 --> 00:50:17,460 Now, our auditory system is almost certainly doing this kind of analysis. 997 00:50:17,560 --> 00:50:21,940 The idea is you compare what you're hearing now to what you've heard for the last couple of seconds. 998 00:50:23,080 --> 00:50:25,040 I just did it really, really badly. 999 00:50:25,480 --> 00:50:28,120 But I still got pretty pictures. See? That's pretty. 1000 00:50:28,260 --> 00:50:30,120 And it's actually directly responsive. 1001 00:50:31,660 --> 00:50:35,280 So, what we end up ending up with is two things. 1002 00:50:35,580 --> 00:50:39,180 First, we get a visual hash of auditory segments based on the 1003 00:50:39,180 --> 00:50:43,180 relative similarity and dissimilarity of bass, mid-range, and treble. 1004 00:50:43,840 --> 00:50:48,160 We also end up with these vertical lines forming whenever the same signal is repeated. 1005 00:50:48,460 --> 00:50:52,380 If it takes a long time to be repeated, you get a long distance in the line. 1006 00:50:53,520 --> 00:50:56,460 If it takes a short time, they really, really bunch up. 1007 00:50:56,720 --> 00:50:58,160 So, if you have a drum beat that's . . . 1008 00:50:58,640 --> 00:51:00,220 You get these lines that are just vertical. 1009 00:51:00,340 --> 00:51:01,740 It's just like right next to each other. 1010 00:51:03,560 --> 00:51:05,920 So, there's a trade-off in terms of blurring. 1011 00:51:05,980 --> 00:51:07,980 Wow, that is really blurry. I'm sorry. 1012 00:51:09,180 --> 00:51:11,080 The trade-off in blurring is this. 1013 00:51:11,160 --> 00:51:16,620 If you blur more, you end up seeing more of the underlying structure of the audio. 1014 00:51:16,760 --> 00:51:17,800 You see the repeats better. 1015 00:51:17,960 --> 00:51:20,700 If you blur less, you get a much higher accuracy 1016 00:51:20,700 --> 00:51:23,720 in terms of being able to detect when one section ends and another begins. 1017 00:51:24,080 --> 00:51:25,840 Of course, that's what I was doing last year. 1018 00:51:25,900 --> 00:51:30,320 I was trying to fuzz files by finding out when one thing ended and one thing began. 1019 00:51:32,700 --> 00:51:35,960 So, why was this here? Why did I present this back to Black Hat? 1020 00:51:36,600 --> 00:51:38,620 So, I'm doing web research, right? 1021 00:51:39,520 --> 00:51:42,860 Well, my buddy, Zane Lackey, who I think is . . . He's totally in the room. 1022 00:51:43,540 --> 00:51:44,680 Someone get this man a beer. 1023 00:51:45,740 --> 00:51:48,740 All right. So, I'm doing web research. 1024 00:51:48,820 --> 00:51:50,560 This is really not what I normally do. 1025 00:51:50,900 --> 00:51:53,200 And we go out for beers, because, you know, this is Zane's specialty, 1026 00:51:53,320 --> 00:51:55,400 and I'm always happy to see Zane when he comes to Seattle. 1027 00:51:56,040 --> 00:51:58,280 Seattle is also known, by the way, DEF CON North. 1028 00:51:59,840 --> 00:52:00,840 We all go out for beers. 1029 00:52:01,040 --> 00:52:03,900 And I'm like, oh, dude. So, I'm working on this really cool thing. 1030 00:52:03,960 --> 00:52:07,360 It makes pictures from sounds, and he's like, oh, yeah, for, like, audio captchas. 1031 00:52:10,700 --> 00:52:14,080 It was just supposed to be for pretty pictures. 1032 00:52:14,340 --> 00:52:15,880 But that's a great idea, dude. 1033 00:52:16,820 --> 00:52:19,060 So, I'm, like, silent for a minute. 1034 00:52:19,240 --> 00:52:22,160 I end up going straight home and start looking into this. 1035 00:52:22,420 --> 00:52:25,040 Now, audio captchas. What are audio captchas? 1036 00:52:25,300 --> 00:52:29,560 Captcha is a completely automated public Turing test to tell computers and humans apart. 1037 00:52:29,900 --> 00:52:33,400 There are lots and lots of websites that really have a problem with bots. 1038 00:52:33,820 --> 00:52:37,260 And the idea is they want to know that a human is there. 1039 00:52:38,020 --> 00:52:42,420 So, I get this email from someone about, you know, the fact that I'm doing captcha research. 1040 00:52:42,720 --> 00:52:44,640 And I say, well, what are you doing with captchas? 1041 00:52:44,960 --> 00:52:47,840 Check this quote out. Captcha is quite annoying. 1042 00:52:48,180 --> 00:52:52,600 I use a few programs to send auto messages and to steal friends from other pages. 1043 00:52:53,060 --> 00:52:55,680 Now, they had a way around the captcha system for a while, but not anymore. 1044 00:52:56,100 --> 00:52:58,040 I don't know. I got five different accounts. 1045 00:52:58,220 --> 00:52:59,260 I have 300 people a day. 1046 00:52:59,400 --> 00:53:03,440 And I'm sitting there typing 250 captcha codes a day on this damn thing. 1047 00:53:04,580 --> 00:53:06,680 Captchas exist to piss this guy off. 1048 00:53:07,260 --> 00:53:09,100 That is the purpose of a captcha. 1049 00:53:10,180 --> 00:53:15,360 So, the general idea is to use the human's superior ability to segment things, 1050 00:53:15,960 --> 00:53:19,820 segment data to differentiate humans and machines. 1051 00:53:20,560 --> 00:53:22,440 Image captchas use text. 1052 00:53:23,280 --> 00:53:24,860 Audio captchas use audio. 1053 00:53:25,000 --> 00:53:26,220 And they both put it over noise. 1054 00:53:26,680 --> 00:53:29,380 So, it turns out audio is much, much easier to hack. 1055 00:53:29,560 --> 00:53:32,140 You have a couple million neurons coming from your visual system. 1056 00:53:32,320 --> 00:53:35,180 You got about 35,000 coming from your auditory system. 1057 00:53:35,420 --> 00:53:36,980 This is why audio 1058 00:53:36,980 --> 00:53:38,780 compresses so much better than video. 1059 00:53:40,220 --> 00:53:44,020 So, I go ahead and I take this real-world captcha. 1060 00:53:49,860 --> 00:53:53,300 So, you're not going to be able to see it, unfortunately, because it's too dark. 1061 00:53:53,580 --> 00:53:59,260 But eventually, right where the mouse is, there's a repeat of the number eight. 1062 00:53:59,680 --> 00:54:01,100 And there's actually a red line. 1063 00:54:01,200 --> 00:54:02,160 Go ahead and grab the slides. 1064 00:54:02,640 --> 00:54:04,360 You see this big blob at eight. 1065 00:54:05,020 --> 00:54:05,860 You just heard nine? 1066 00:54:07,760 --> 00:54:08,860 All right, nine. 1067 00:54:10,320 --> 00:54:11,540 Okay, check this out. 1068 00:54:11,740 --> 00:54:13,700 There was a nine repeated at the end. 1069 00:54:14,080 --> 00:54:16,980 You see right near that mouse, that big white blob? 1070 00:54:17,740 --> 00:54:20,640 Oh, yeah, WinAM's totally picking out the captcha. 1071 00:54:21,120 --> 00:54:24,420 Turns out all the noise they put in, yeah, that's fine and great. 1072 00:54:24,580 --> 00:54:27,360 But, you know, you're saying the same things in the same ways. 1073 00:54:27,400 --> 00:54:30,360 And this method actually totally busts it. 1074 00:54:30,960 --> 00:54:35,860 So, recommendations for better captchas, guys, don't, oh, man, don't make speech 1075 00:54:35,860 --> 00:54:37,280 much louder than the noise. 1076 00:54:38,000 --> 00:54:39,800 It's like, quiet, quiet, quiet, quiet, quiet. 1077 00:54:40,040 --> 00:54:42,640 Big thing you're supposed to pay attention to, quiet, quiet, quiet, quiet. 1078 00:54:42,760 --> 00:54:43,420 Don't do that. 1079 00:54:44,960 --> 00:54:48,040 You know, humans do recognize more than just numbers. 1080 00:54:48,200 --> 00:54:50,300 It would be nice if you use more than just numbers. 1081 00:54:51,200 --> 00:54:54,960 Use sentences, use more than even words in isolation, because we're really good 1082 00:54:54,960 --> 00:54:56,740 at parsing out sentences in a context. 1083 00:54:57,420 --> 00:55:00,600 And finally, humans are intelligent, well, some of them. 1084 00:55:01,140 --> 00:55:03,580 Ask them simple questions they might be able to answer. 1085 00:55:04,580 --> 00:55:07,720 So, those are my toys, that's what I got, done.