1 00:00:00,000 --> 00:00:07,480 Okay, so my name is Moxie Marlinspike. I'm here for the Institute for Disruptive Studies. It's like an anarchist think tank. 2 00:00:09,340 --> 00:00:13,320 I'm going to be talking about some new tricks for defeating SSL in practice. 3 00:00:14,980 --> 00:00:19,800 I eventually hope to leave you guys with undetectable man-in-the-middle attacks against SSL connections. 4 00:00:20,940 --> 00:00:26,440 But it's part of a story. So I'm going to start, you know, I hate to repeat myself, 5 00:00:26,440 --> 00:00:30,900 but I'm going to start with the old and eventually come to the new. 6 00:00:32,400 --> 00:00:35,620 So the story starts with this concept of basic constraints. 7 00:00:37,860 --> 00:00:40,680 And that story starts with certificate chaining. 8 00:00:41,940 --> 00:00:46,540 So when people think about certificates, they usually think about certificates coming in pairs. 9 00:00:46,760 --> 00:00:48,140 They think of two types of certificates. 10 00:00:48,720 --> 00:00:53,240 CA certificates, you know, these things that are sort of all powerful, they're embedded in your web browser. 11 00:00:53,960 --> 00:00:55,800 And then site certificates. 12 00:00:56,440 --> 00:01:00,620 These are the things that identify leaf nodes or any given end entity. 13 00:01:02,000 --> 00:01:04,340 But sometimes the picture is a little bit more complicated. 14 00:01:05,500 --> 00:01:08,760 Instead of just two certificates, there could be more. 15 00:01:09,140 --> 00:01:10,580 You could have a certificate chain. 16 00:01:11,840 --> 00:01:14,580 The idea itself kind of makes sense. 17 00:01:15,080 --> 00:01:18,380 Perhaps you'd like to delegate signing authority to a third party, 18 00:01:19,180 --> 00:01:23,480 but that third party doesn't have their certificate embedded in every web browser since 1996. 19 00:01:24,340 --> 00:01:25,180 So what do you do? 20 00:01:25,300 --> 00:01:26,300 You sign the third party. 21 00:01:26,440 --> 00:01:28,680 They sign your certificate, and they, in turn, sign your certificate. 22 00:01:29,380 --> 00:01:37,100 And so, you know, when you get one of these things, you apply, you know, you hand the whole thing to a web browser and the web browser deals with it, okay? 23 00:01:38,840 --> 00:01:40,640 And, you know, it could be more than three. 24 00:01:41,000 --> 00:01:44,380 You can have any number of intermediate certificate authorities in the chain. 25 00:01:44,580 --> 00:01:48,200 I don't think that there's any standard that says how many is the maximum. 26 00:01:48,360 --> 00:01:49,480 I think it's implementation specific. 27 00:01:50,000 --> 00:01:51,940 I know for Firefox, it's like 25. 28 00:01:52,820 --> 00:01:56,400 So you could have a certificate chain with 25 intermediate CA. 29 00:01:56,440 --> 00:02:00,300 So the question is, how do we verify these things? 30 00:02:00,580 --> 00:02:02,100 You know, you get a certificate chain, what do you do? 31 00:02:04,180 --> 00:02:08,000 And what everyone says is you start with a leaf node, 32 00:02:08,480 --> 00:02:12,560 and you verify that the name on the leaf node is the same as the name of the site you're trying to connect to. 33 00:02:13,120 --> 00:02:17,440 Then you verify that the leaf certificate hasn't expired, and then you check its signature. 34 00:02:18,580 --> 00:02:22,640 And if the signing CA is in your list of trusted root certificate authorities, you stop. 35 00:02:23,480 --> 00:02:25,580 Otherwise, you move one up the chain, and you repeat. 36 00:02:28,480 --> 00:02:36,420 So here's, you know, a picture from IBM's website today, and, you know, it has a little graph about validating these things. 37 00:02:36,540 --> 00:02:42,040 And, you know, they lay it all out in the same way of you start with a leaf node, and you keep going back up. 38 00:02:42,940 --> 00:02:45,780 I've said before that I feel like when looking for security vulnerabilities, 39 00:02:45,960 --> 00:02:52,560 a good place to start is places where developers might not understand the full scope of what's going on, 40 00:02:53,160 --> 00:02:55,780 and yet feel really good about the solutions that they implement. 41 00:02:56,800 --> 00:03:02,140 So, for instance, when validating a certificate chain, it's attempting to use a simple recursive function. 42 00:03:03,440 --> 00:03:08,100 And this is a situation where, you know, a developer might implement a solution and think, 43 00:03:08,200 --> 00:03:12,220 man, I used recursion today, and it was awesome, you know? 44 00:03:12,960 --> 00:03:16,400 It was like the same function calling itself over, you know? 45 00:03:19,380 --> 00:03:24,820 But the results of sort of a naive recursive attempted validation is that you will ensure 46 00:03:24,820 --> 00:03:26,340 that a certificate chain is complete. 47 00:03:26,440 --> 00:03:28,000 But nothing more. 48 00:03:29,060 --> 00:03:30,400 And here's what I mean by that. 49 00:03:30,940 --> 00:03:33,300 So, let's say you have this picture, fairly common picture. 50 00:03:34,600 --> 00:03:39,460 Some root certificate authority, a couple of intermediate CAs, and then your leaf node 51 00:03:39,460 --> 00:03:42,560 that identifies a website you own, like thoughtcrime.org. 52 00:03:42,640 --> 00:03:43,660 It's a website I have. 53 00:03:44,700 --> 00:03:48,860 So, what is to stop me from doing this? 54 00:03:51,180 --> 00:03:54,860 Creating another certificate for some other website, paypal.com, 55 00:03:55,000 --> 00:03:56,420 and then signing it with my website. 56 00:03:56,440 --> 00:04:00,220 And then passing that whole chain to any client. 57 00:04:00,720 --> 00:04:03,640 If you go back and you look at what people say about how you validate these things, 58 00:04:03,800 --> 00:04:05,220 we haven't really done anything wrong. 59 00:04:06,660 --> 00:04:08,240 You know, all the signatures are valid. 60 00:04:08,940 --> 00:04:09,680 Nothing's expired. 61 00:04:10,380 --> 00:04:11,900 The chain itself is intact. 62 00:04:12,260 --> 00:04:16,520 And the root CA is embedded in the web browser and trusted. 63 00:04:18,460 --> 00:04:21,980 But we just created a certificate for PayPal, and we're not PayPal. 64 00:04:23,040 --> 00:04:26,240 So, the missing piece is this somewhat obscure field called 65 00:04:26,240 --> 00:04:27,000 Basic Constraints. 66 00:04:28,220 --> 00:04:31,720 The idea is that not all certificates should be able to do all things, right? 67 00:04:31,820 --> 00:04:36,160 Like if you have an end entity certificate for a website, that should really only be 68 00:04:36,160 --> 00:04:37,300 used to identify your website. 69 00:04:37,500 --> 00:04:42,260 It shouldn't be used to sign other certificates or for key revocation or anything like that. 70 00:04:43,740 --> 00:04:48,440 The problem was that back in the day, when most certificate authorities would issue certificates, 71 00:04:48,680 --> 00:04:49,620 they would just leave this field out. 72 00:04:50,860 --> 00:04:54,520 And you would think that, like, if you were writing an SSL implementation and you were 73 00:04:54,520 --> 00:04:55,940 sort of checking a certificate. 74 00:04:55,940 --> 00:05:00,820 If this thing was just absent, you would assume the conservative thing that this is not a 75 00:05:00,820 --> 00:05:01,800 certificate authority certificate. 76 00:05:02,700 --> 00:05:07,680 But it turns out that whether the field was there or not, most SSL implementations just 77 00:05:07,680 --> 00:05:08,600 didn't bother to check it. 78 00:05:09,560 --> 00:05:15,460 What this meant was that anyone with a valid leaf note certificate for any domain could 79 00:05:15,460 --> 00:05:18,340 create and sign a leaf certificate for any other domain. 80 00:05:19,100 --> 00:05:23,760 It essentially meant that anyone who had a valid leaf note certificate had a CA cert. 81 00:05:25,940 --> 00:05:30,860 And when presented with this complete chain, Internet Explorer, Conqueror, Outlook, OpenSSL, 82 00:05:31,300 --> 00:05:35,380 many different SSL implementations, all considered to be completely valid. 83 00:05:37,000 --> 00:05:42,320 So then back in 2002, Microsoft did something particularly annoying, and I blew this up 84 00:05:42,320 --> 00:05:43,020 by publishing it. 85 00:05:43,840 --> 00:05:47,340 And Microsoft claimed, okay, this is a real vulnerability, but it's basically impossible 86 00:05:47,340 --> 00:05:47,980 to exploit. 87 00:05:48,840 --> 00:05:50,740 So I published the tool that exploits it. 88 00:05:52,380 --> 00:05:53,920 That tool is called SSL Sniff. 89 00:05:55,440 --> 00:05:55,920 It's a tool called SSL Sniff. 90 00:05:55,940 --> 00:05:57,280 It works like you'd expect. 91 00:05:57,600 --> 00:05:58,820 Let's say you have a client and a server. 92 00:05:59,800 --> 00:06:01,780 Client's trying to connect to the server using SSL. 93 00:06:01,880 --> 00:06:03,360 It's trying to connect to PayPal. 94 00:06:04,480 --> 00:06:06,140 SSL Sniff would perform a man-in-the-middle attack. 95 00:06:06,640 --> 00:06:11,560 So it intercepts the client's connection request to the server and generates a certificate 96 00:06:11,560 --> 00:06:13,320 for the site that the client is trying to connect to. 97 00:06:13,400 --> 00:06:15,520 So it generates a certificate for PayPal.com on the fly. 98 00:06:16,140 --> 00:06:19,820 And then it signs it with any random leaf note certificate that you give it. 99 00:06:20,080 --> 00:06:21,800 And then it passes the whole chain back to the client. 100 00:06:23,920 --> 00:06:25,040 Simultaneously, on the server side. 101 00:06:25,040 --> 00:06:30,640 It makes a normal SSL connection to the server and then starts passing data back and forth 102 00:06:30,640 --> 00:06:31,540 between the client and the server. 103 00:06:32,000 --> 00:06:35,360 The important thing is that in the middle here, the data is in the clear. 104 00:06:35,760 --> 00:06:38,620 And you can log it or modify it or do whatever you want. 105 00:06:40,960 --> 00:06:41,360 Okay. 106 00:06:47,900 --> 00:06:52,840 So the question is, post-disclosure, you know, 2002 was a while ago. 107 00:06:53,500 --> 00:06:54,740 Is this thing still useful? 108 00:06:55,040 --> 00:06:55,920 Is this tool still useful? 109 00:06:59,300 --> 00:07:02,040 So first, you'd be surprised who still doesn't check basic constraints. 110 00:07:04,540 --> 00:07:08,480 The second thing was that even after, like, browsers had been patched, this tool was 111 00:07:08,480 --> 00:07:14,080 pretty effective because you'd be surprised, you know, most of the time, users would just 112 00:07:14,080 --> 00:07:14,980 click through the dialogs. 113 00:07:16,100 --> 00:07:22,200 And there's actually some kind of cool stuff you could do where, like, a lot of SSL implementations 114 00:07:22,200 --> 00:07:24,000 or web browsers would start to validate a certificate. 115 00:07:24,000 --> 00:07:27,700 And then as soon as something was wrong with the certificate, they would pop up a dialog 116 00:07:27,700 --> 00:07:29,160 telling you that something was wrong. 117 00:07:29,940 --> 00:07:34,440 And like, the second thing that they do after checking the name is check the time stamp 118 00:07:34,440 --> 00:07:35,720 to see whether it's expired or not. 119 00:07:36,120 --> 00:07:39,380 So you could, like, on the fly create certificates that expired ten minutes ago. 120 00:07:39,820 --> 00:07:42,400 The signatures are totally bogus, like, completely fucked. 121 00:07:42,760 --> 00:07:45,440 And it would pop up a dialog that's like, something is wrong. 122 00:07:45,740 --> 00:07:47,220 This certificate expired ten minutes ago. 123 00:07:48,080 --> 00:07:51,260 And you know, most users would be like, well, it only expired ten minutes ago. 124 00:07:51,420 --> 00:07:52,520 I mean, you know, it's not that bad. 125 00:07:52,620 --> 00:07:52,780 You know? 126 00:07:55,480 --> 00:07:58,640 But it wouldn't tell you about the signature problems or whatever, you know, because it 127 00:07:58,640 --> 00:07:59,620 would just get right there and stop. 128 00:08:00,140 --> 00:08:00,860 So yeah. 129 00:08:00,980 --> 00:08:02,260 So it was still useful in that sense. 130 00:08:03,440 --> 00:08:07,900 And then it's still just useful as a general tool for man-in-the-middle attacks on SSL. 131 00:08:08,160 --> 00:08:12,120 Like the folks that did the MD5 hash collision stuff, they used this tool to deploy their 132 00:08:12,120 --> 00:08:12,820 CA cert, right? 133 00:08:12,860 --> 00:08:17,400 Because once you get a CA cert, that's nice, but how do you do, like, on the fly man-in-the-middle 134 00:08:17,400 --> 00:08:17,940 attacks, right? 135 00:08:18,140 --> 00:08:21,960 Well, you need something that will intercept the connection, generate a certificate on 136 00:08:21,960 --> 00:08:22,180 the fly. 137 00:08:22,180 --> 00:08:25,900 Sign it with whatever certificate you give it, and then pass it back to the client, right? 138 00:08:26,000 --> 00:08:27,500 And that's exactly what this does. 139 00:08:28,500 --> 00:08:33,660 And so then there's other uses yet to be disclosed another day and today. 140 00:08:37,320 --> 00:08:39,240 More lately, I've been talking about SSL stripping. 141 00:08:41,120 --> 00:08:44,220 I've been talking about it a lot lately, so I'll try and be kind of brief. 142 00:08:44,840 --> 00:08:49,240 But SSL stripping is fundamentally about the concept of bridges, right? 143 00:08:49,620 --> 00:08:52,000 So the thing is that SSL is useful. 144 00:08:52,180 --> 00:08:54,640 But how it's deployed really matters. 145 00:08:57,580 --> 00:09:01,920 On the web, SSL is almost never encountered directly, right? 146 00:09:02,160 --> 00:09:07,420 Very few people type HTTPS colon forward forward slash something into their URL bar. 147 00:09:07,660 --> 00:09:11,060 Most people type bankofamerica.com enter, right? 148 00:09:11,180 --> 00:09:16,860 And so my sort of thesis is that SSL on the web is really only encountered in one of two 149 00:09:16,860 --> 00:09:17,080 ways. 150 00:09:17,240 --> 00:09:21,900 It's either encountered as a 302 redirect from an HTTP URL. 151 00:09:21,980 --> 00:09:22,160 Right? 152 00:09:22,160 --> 00:09:26,720 So it's either encountered by somebody typing bankofamerica.com enter into their URL bar, 153 00:09:26,880 --> 00:09:28,900 which makes an HTTP request to the server. 154 00:09:29,060 --> 00:09:34,340 The server responds with a 302 redirect that says, please, instead, connect to HTTPS colon 155 00:09:34,340 --> 00:09:36,020 forward forward slash bankofamerica.com. 156 00:09:36,140 --> 00:09:38,660 And the browser just sort of gets upgraded to SSL. 157 00:09:39,400 --> 00:09:42,060 And then the second way is through clicking on links, right? 158 00:09:42,120 --> 00:09:47,840 So most users browse along, and eventually they encounter a link that says sign in or 159 00:09:47,840 --> 00:09:50,480 shopping cart or check out or whatever. 160 00:09:50,700 --> 00:09:52,140 And that's the moment where SSL is used. 161 00:09:52,160 --> 00:09:53,380 They encounter SSL on the web. 162 00:09:54,600 --> 00:09:59,020 Both of those points are bridges between an insecure and a secure protocol. 163 00:10:00,340 --> 00:10:01,720 And they're weak points. 164 00:10:03,860 --> 00:10:07,660 So the idea is that maybe we can attack SSL before we even get there. 165 00:10:09,300 --> 00:10:13,620 So in the past, you know, SSL sniff would go after the SSL connection itself, right? 166 00:10:13,760 --> 00:10:16,420 Its job was to man in the middle the actual SSL connection. 167 00:10:16,940 --> 00:10:19,580 And so I wrote a different tool called SSL strip. 168 00:10:19,580 --> 00:10:24,420 And what it does is perform man in the middle attacks on the HTTP connections that will 169 00:10:24,420 --> 00:10:26,400 inevitably happen before an SSL connection. 170 00:10:27,280 --> 00:10:29,500 And that's not hard at all because it's not a secure protocol. 171 00:10:30,460 --> 00:10:35,040 So SSL strip basically just does a man in the middle attack on all the HTTP connections 172 00:10:35,040 --> 00:10:35,760 on a network. 173 00:10:36,220 --> 00:10:37,740 And it watches the traffic go by. 174 00:10:38,560 --> 00:10:42,700 And in its most basic form, it looks for these two points. 175 00:10:42,860 --> 00:10:44,620 Links and 302 redirects. 176 00:10:44,960 --> 00:10:49,560 And if it sees an HTTPS link, it swaps it for an identical HTTP link. 177 00:10:49,580 --> 00:10:51,800 And it keeps a map of what has changed. 178 00:10:52,840 --> 00:10:56,640 If it sees a 302 redirect, it looks for the location header, which is where the redirect 179 00:10:56,640 --> 00:10:57,320 URL will be. 180 00:10:57,740 --> 00:11:01,940 And if it sees an HTTPS link in there, it swaps it for an identical HTTP lookalike. 181 00:11:02,100 --> 00:11:03,700 And it keeps a map of what has changed. 182 00:11:04,520 --> 00:11:06,720 Then it continues to watch the HTTP traffic go by. 183 00:11:07,400 --> 00:11:12,180 And if it sees a request for a URL that it stripped, it proxies that out as SSL to the 184 00:11:12,180 --> 00:11:12,480 server. 185 00:11:12,840 --> 00:11:13,240 Right? 186 00:11:13,500 --> 00:11:15,300 So the server never knows anything's wrong. 187 00:11:15,440 --> 00:11:19,500 It's getting SSL connections on the URLs that it expects to get SSL connections for. 188 00:11:20,620 --> 00:11:24,040 And, you know, on the client side, it still just happens to be HTTP. 189 00:11:25,160 --> 00:11:28,200 And then you just keep watching the HTTPS traffic come back from the server. 190 00:11:29,700 --> 00:11:35,560 And you keep a map of all the relative CSS links, JavaScript links, you know, all that 191 00:11:35,560 --> 00:11:35,780 stuff. 192 00:11:35,960 --> 00:11:36,060 Right? 193 00:11:36,080 --> 00:11:36,820 Because that should be... 194 00:11:36,820 --> 00:11:38,280 Those should be SSL connections, too. 195 00:11:38,960 --> 00:11:40,980 And, of course, you log everything that you want to log. 196 00:11:42,140 --> 00:11:43,000 So how does this look? 197 00:11:43,080 --> 00:11:43,260 Right? 198 00:11:49,760 --> 00:11:54,820 So the idea behind most of this stuff is that there's been sort of an evolution in the way 199 00:11:54,820 --> 00:11:58,540 that browsers deal with what I would call positive or negative feedback. 200 00:11:59,200 --> 00:12:04,080 It used to be in the past that browsers, I felt, had this strong emphasis on positive 201 00:12:04,080 --> 00:12:04,440 feedback. 202 00:12:05,000 --> 00:12:06,880 That little padlock icon was everywhere. 203 00:12:07,100 --> 00:12:07,560 You know? 204 00:12:07,620 --> 00:12:10,060 It was in the status bar down at the bottom right. 205 00:12:10,260 --> 00:12:10,500 You know? 206 00:12:10,500 --> 00:12:13,000 Firefox's entire URL bar would turn gold. 207 00:12:13,560 --> 00:12:16,120 There's all these things telling you, this is secure. 208 00:12:17,500 --> 00:12:20,280 And by contrast, if there was a problem, it would just pop up a dialogue. 209 00:12:21,480 --> 00:12:26,120 But today I feel like there's been this evolution of toning down the positive feedback and 210 00:12:26,120 --> 00:12:27,380 ratcheting up the negative feedback. 211 00:12:27,760 --> 00:12:30,600 So all the little lock icons, there's just sort of less and less of them. 212 00:12:30,800 --> 00:12:34,620 There's less things to tell you that things are secure and more things to tell you that 213 00:12:34,620 --> 00:12:36,120 things are really bad. 214 00:12:36,380 --> 00:12:36,540 Right? 215 00:12:36,600 --> 00:12:37,920 There's not just dialogue boxes anymore. 216 00:12:38,120 --> 00:12:38,820 Like on Firefox. 217 00:12:38,820 --> 00:12:42,960 If there's a problem, it actually, the page renders out to say there's something really 218 00:12:42,960 --> 00:12:43,320 wrong. 219 00:12:43,600 --> 00:12:46,320 It takes something like five clicks or something to get through that. 220 00:12:46,520 --> 00:12:48,540 I mean, it's not the thing that users just click okay anymore. 221 00:12:49,540 --> 00:12:55,900 And so the idea is that if you can avoid the negative feedback, you're in really good 222 00:12:55,900 --> 00:12:56,180 shape. 223 00:12:56,360 --> 00:12:56,600 Right? 224 00:12:56,680 --> 00:13:00,080 And if you fail to trigger the positive feedback, maybe it's not so bad. 225 00:13:00,640 --> 00:13:05,540 That most user experiences, they just browse along until they encounter something that 226 00:13:05,540 --> 00:13:08,020 says look out, there's something very wrong. 227 00:13:08,020 --> 00:13:08,400 You know? 228 00:13:08,440 --> 00:13:11,620 And until they see that, they don't think anything's amiss. 229 00:13:12,160 --> 00:13:12,840 So okay. 230 00:13:12,940 --> 00:13:14,200 So how does this basic attack look? 231 00:13:14,380 --> 00:13:15,600 This SSL stripping attack, right? 232 00:13:15,760 --> 00:13:20,060 So this is like Gmail's login page on Firefox 3. 233 00:13:21,040 --> 00:13:22,420 You know, this is the secure version. 234 00:13:23,280 --> 00:13:24,240 This is the strip version. 235 00:13:26,740 --> 00:13:27,540 It's pretty subtle. 236 00:13:27,680 --> 00:13:28,520 No dialogue boxes. 237 00:13:28,640 --> 00:13:30,800 Nothing saying everything is wrong, you know? 238 00:13:31,620 --> 00:13:32,360 This is Safari. 239 00:13:32,620 --> 00:13:32,780 Right? 240 00:13:32,820 --> 00:13:33,720 This is the secure version. 241 00:13:34,700 --> 00:13:35,680 This is the strip version. 242 00:13:37,340 --> 00:13:37,740 Sure. 243 00:13:37,740 --> 00:13:41,960 So there's the only thing on Safari is if you look at the top right, there's that little 244 00:13:41,960 --> 00:13:43,540 blind embossed padlock. 245 00:13:44,440 --> 00:13:45,400 That's the thing that disappears. 246 00:13:47,900 --> 00:13:49,040 So not bad, right? 247 00:13:50,640 --> 00:13:55,340 And this evolution of positive and negative feedback really helps this technique, right? 248 00:13:55,680 --> 00:13:59,740 So this is I've been talking about this a lot, but this is just the starting point for 249 00:13:59,740 --> 00:14:00,340 this type of attack. 250 00:14:00,480 --> 00:14:04,420 Once you start to attack this bridge between HTTP and HTTPS, there's a whole ecosystem 251 00:14:04,420 --> 00:14:05,260 of things that you can do. 252 00:14:05,260 --> 00:14:10,540 One of the ways that I one of the things that I suggested of a different direction 253 00:14:10,540 --> 00:14:16,160 you can go from there is adopting homograph attacks to work in this situation as well. 254 00:14:16,260 --> 00:14:20,300 But there's a whole bunch of stuff that I've already written about it that if you're interested, 255 00:14:20,460 --> 00:14:21,360 you can find elsewhere. 256 00:14:22,020 --> 00:14:25,720 So the question today is where can we go from here, right? 257 00:14:27,460 --> 00:14:30,280 The larger question for me is where do we need to go from here, right? 258 00:14:30,320 --> 00:14:34,640 Like I maintain that this stripping attack is deadly in practice and will be deadly for 259 00:14:34,640 --> 00:14:35,120 a long time. 260 00:14:36,600 --> 00:14:42,000 That in field testing, it has 100% success rate, right? 261 00:14:44,660 --> 00:14:49,800 Like seriously, even there was some response to this where people were like, oh, this is 262 00:14:49,800 --> 00:14:51,200 a matter of user education. 263 00:14:51,560 --> 00:14:52,720 Users don't know what they're doing, right? 264 00:14:52,900 --> 00:14:57,840 And so I gave the same talk just about SSL stripping at Black Cat Europe in Amsterdam. 265 00:14:58,080 --> 00:15:02,440 And for like 20 minutes before the talk, I ran SSL strip on the network and I got like 266 00:15:02,960 --> 00:15:04,620 100 passwords from, you know, a hundred passwords. 267 00:15:04,640 --> 00:15:06,120 You know, so-called security professionals, right? 268 00:15:06,900 --> 00:15:10,980 And so I put their passwords up on a slide that was like, see, you know, if you see your 269 00:15:10,980 --> 00:15:13,420 password here, you also fell victim to this, right? 270 00:15:15,380 --> 00:15:20,180 Anyway, so this is deadly in practice, but, you know, what do we need, right? 271 00:15:20,500 --> 00:15:24,100 So there's some places that this technique does not reach, right? 272 00:15:24,420 --> 00:15:28,520 One of them is like people that are starting to use bookmarks now for their secure sites, 273 00:15:28,720 --> 00:15:28,840 right? 274 00:15:28,880 --> 00:15:34,140 So there's, you know, people that have their Gmail login bookmarked to be HTTPS, right? 275 00:15:34,180 --> 00:15:34,620 So they don't have that. 276 00:15:34,620 --> 00:15:35,460 They don't expose the bridge. 277 00:15:36,120 --> 00:15:38,320 And then the other thing is other protocols, right? 278 00:15:38,400 --> 00:15:46,800 There's plenty of SSL-based protocols like IMAP, IMAP-S, SMTPS, POP3S, you know, IRC, 279 00:15:47,640 --> 00:15:49,160 SSL over IRC, stuff like that. 280 00:15:49,320 --> 00:15:51,400 And those protocols don't expose this bridge. 281 00:15:51,640 --> 00:15:53,240 SSL VPNs, stuff like that. 282 00:15:53,620 --> 00:15:58,420 So what we need is a different technique to attack these points. 283 00:15:59,920 --> 00:16:00,440 Okay. 284 00:16:00,560 --> 00:16:03,060 So let's start thinking about that. 285 00:16:03,260 --> 00:16:04,520 The first thing is what's up? 286 00:16:04,620 --> 00:16:05,720 What's up with certificates, right? 287 00:16:05,960 --> 00:16:08,560 Everyone always talks about certificates, but what are they really? 288 00:16:09,080 --> 00:16:10,920 They're actually these pretty simple structures. 289 00:16:12,120 --> 00:16:18,100 The basic point of a certificate is to identify some subject and convey that subject's public 290 00:16:18,100 --> 00:16:18,340 key. 291 00:16:19,420 --> 00:16:24,100 The certificate is thought to be good because it's issued by some issuer that people might 292 00:16:24,100 --> 00:16:29,440 think is, you know, trustworthy, and it's known to be authentic based on that issuer's 293 00:16:29,440 --> 00:16:29,700 signature. 294 00:16:31,380 --> 00:16:33,200 You know, this is what a certificate looks like. 295 00:16:33,200 --> 00:16:38,180 This is Google's certificate, and you can see that, you know, the subject is Google 296 00:16:38,180 --> 00:16:42,160 and it's issued by thought and, you know, there's some public key in there, right? 297 00:16:43,980 --> 00:16:50,200 Now when designing a secure protocol, the three big things that you're after are secrecy, 298 00:16:50,220 --> 00:16:51,820 authenticity, and integrity. 299 00:16:52,960 --> 00:16:55,060 Most people talk about secrecy, you know. 300 00:16:55,100 --> 00:16:56,940 They think of encryption and they think secrecy. 301 00:16:57,040 --> 00:17:00,200 But if you don't have authenticity and integrity, you don't have anything. 302 00:17:00,480 --> 00:17:01,880 They're crucial. 303 00:17:02,600 --> 00:17:03,080 Okay. 304 00:17:03,080 --> 00:17:04,480 They're critical, and we will see why. 305 00:17:06,720 --> 00:17:10,280 You know, the basic SSL beginnings of a handshake look like this. 306 00:17:13,860 --> 00:17:17,700 Client sends a message to the server that says, hello, I am some client. 307 00:17:17,880 --> 00:17:19,060 I use SSL version whatever. 308 00:17:19,440 --> 00:17:21,180 These are the cipher suites that I support. 309 00:17:21,480 --> 00:17:25,460 I also like these compression methods, and here's a random number and some other information. 310 00:17:26,140 --> 00:17:28,360 The server responds, yes, hello, I am the server. 311 00:17:28,480 --> 00:17:30,320 I also support this version of SSL whatever. 312 00:17:30,500 --> 00:17:32,880 I think we should use this cipher suite. 313 00:17:33,080 --> 00:17:33,980 And this compression method. 314 00:17:34,920 --> 00:17:37,060 And by the way, here is my certificate. 315 00:17:39,160 --> 00:17:42,640 So as soon as the client gets the certificate, the first thing it's going to do is look at 316 00:17:42,640 --> 00:17:46,680 the subject and it's going to make sure that it's the same thing that's what it's trying 317 00:17:46,680 --> 00:17:47,560 to connect to, right? 318 00:17:47,700 --> 00:17:51,580 And so it's going to compare the subject with whatever you typed into the URL bar on 319 00:17:51,580 --> 00:17:55,840 your web browser or whatever you typed into the mail server field for your IMAP client 320 00:17:55,840 --> 00:18:01,720 or whatever you typed into the server field for your IRC client or for your VPN software 321 00:18:01,720 --> 00:18:02,400 or whatever. 322 00:18:03,180 --> 00:18:06,880 And this is really where the problems for us begin as attackers, right? 323 00:18:07,140 --> 00:18:08,980 Because we can perform a man in the middle attack here. 324 00:18:09,040 --> 00:18:12,780 We can intercept the client hello and we can respond with our own server hello that says 325 00:18:12,780 --> 00:18:13,620 yes, I am the server whatever. 326 00:18:14,140 --> 00:18:15,460 But we have to send a certificate. 327 00:18:16,760 --> 00:18:18,060 And what do we send, right? 328 00:18:18,860 --> 00:18:22,740 We can't send the real certificate from the actual server because it has a public key 329 00:18:22,740 --> 00:18:26,140 in it that we don't have the corresponding private key for and as soon as they start 330 00:18:26,140 --> 00:18:27,860 encrypting things, we won't be able to decrypt them. 331 00:18:29,060 --> 00:18:29,960 So this is a problem. 332 00:18:31,760 --> 00:18:33,060 So let's start by looking at this. 333 00:18:33,080 --> 00:18:34,340 Looking back into the past. 334 00:18:35,700 --> 00:18:40,800 So like in, you know, 2000, the late 90s or whatever, things were different. 335 00:18:41,460 --> 00:18:45,860 When I was applying for like certificates to exploit this basic constraints vulnerability 336 00:18:45,860 --> 00:18:50,500 that I talked about, I just needed to get a certificate for a domain that I owned, right? 337 00:18:50,980 --> 00:18:52,900 And back then, it was like it was crazy. 338 00:18:53,100 --> 00:18:54,220 There was notaries. 339 00:18:54,840 --> 00:18:57,920 I had to show actual state ID to people. 340 00:18:58,880 --> 00:19:02,020 There were phone calls with actual people involved. 341 00:19:02,020 --> 00:19:07,120 I actually remember talking on the phone with this guy at Verisign at one point, and 342 00:19:07,120 --> 00:19:09,440 he was like grilling me, you know? 343 00:19:09,460 --> 00:19:14,220 And I was thinking to myself, my God, how am I going to prove to this guy that I am 344 00:19:14,220 --> 00:19:14,520 me? 345 00:19:15,340 --> 00:19:15,840 You know? 346 00:19:15,880 --> 00:19:20,420 And this was like totally, you know, legit, just needed to get a cert for my domain, right? 347 00:19:21,560 --> 00:19:22,880 That is a bygone era. 348 00:19:23,800 --> 00:19:29,320 Today it's all about this thing, online domain validation, and all of this whole process 349 00:19:29,320 --> 00:19:31,020 was no reason all this stuff has been replaced. 350 00:19:31,020 --> 00:19:32,220 It's all been replaced by a website. 351 00:19:33,380 --> 00:19:36,860 You go to the website and you submit your certificate signing request. 352 00:19:38,340 --> 00:19:41,140 The certificate signing request is another basic structure. 353 00:19:41,240 --> 00:19:43,140 It's defined by the standard PKCS number 10. 354 00:19:43,760 --> 00:19:45,380 And it just has a few things in it, right? 355 00:19:45,500 --> 00:19:50,340 It's like, you know, version number that the thing supports, the subject, public key, 356 00:19:50,460 --> 00:19:52,320 and whatever attributes you might want. 357 00:19:52,780 --> 00:19:54,780 So here again is our old friend, the subject. 358 00:19:55,440 --> 00:20:00,740 This is the exact value that will later be included in the certificate that is issued 359 00:20:01,020 --> 00:20:02,260 by the certificate authority, right? 360 00:20:05,500 --> 00:20:09,960 You know, ideally, we might want it to say something like bankofamerica.com. 361 00:20:10,820 --> 00:20:14,800 When you submit a certificate to a certificate authority and it has bankofamerica.com as 362 00:20:14,800 --> 00:20:18,520 the subject, the first thing that the certificate authority does is look at the root domain. 363 00:20:19,740 --> 00:20:24,660 It does a WHOIS lookup for that and pulls out whatever contact information is in the 364 00:20:24,660 --> 00:20:25,120 WHOIS record. 365 00:20:25,420 --> 00:20:30,720 And then it sends an email or makes a phone call or something to whoever that might be. 366 00:20:31,460 --> 00:20:35,240 The important thing here is that it only looks at the root domain, right? 367 00:20:35,420 --> 00:20:38,500 Because this is where that information is contained, right? 368 00:20:38,620 --> 00:20:41,020 It doesn't give a shit about subdomains, right? 369 00:20:41,160 --> 00:20:45,540 It doesn't care if it's www or, you know, it could be certificate authorities or a total 370 00:20:45,540 --> 00:20:47,840 ripoff .bankofamerica.com, right? 371 00:20:48,480 --> 00:20:52,700 If you submit that, it will dutifully look up bankofamerica.com, pull out the WHOIS 372 00:20:52,700 --> 00:20:55,920 record and send whoever some contact email. 373 00:20:56,100 --> 00:20:57,040 There's no one to be offended. 374 00:20:57,300 --> 00:20:58,560 You know, there's no one looking at this. 375 00:20:58,580 --> 00:20:59,520 This is an automated process. 376 00:21:01,020 --> 00:21:01,320 Okay. 377 00:21:01,560 --> 00:21:04,060 So I am simplifying things a little bit. 378 00:21:06,540 --> 00:21:09,780 Subjects are not just, you know, an ASCII string in this thing, right? 379 00:21:09,840 --> 00:21:12,420 It's actually this structure called a distinguished name. 380 00:21:13,960 --> 00:21:18,760 To understand the structure, you have to understand that the X.509 standard is a total 381 00:21:18,760 --> 00:21:19,240 nightmare. 382 00:21:19,960 --> 00:21:22,740 There have been three revisions over the course of 20 years. 383 00:21:23,040 --> 00:21:26,300 Parts of the standard have literally been lost and then found again. 384 00:21:27,040 --> 00:21:27,800 I'm not kidding. 385 00:21:27,900 --> 00:21:31,000 When the 1988 standard was being, like, updated to the 1998 standard, it was completely gone. 386 00:21:31,020 --> 00:21:31,920 I think it was 2021 standard, I think. 387 00:21:32,080 --> 00:21:35,660 Whoever was just, like, cutting and pasting it over just forgot to cut part of it out 388 00:21:35,660 --> 00:21:36,300 and paste it in. 389 00:21:36,500 --> 00:21:38,160 And then that was published as the standard. 390 00:21:38,740 --> 00:21:41,460 And then people implemented the standard based on what was published. 391 00:21:41,860 --> 00:21:45,040 And then after the implementations were out there, people were like, oh, shit, we forgot 392 00:21:45,040 --> 00:21:45,780 part of the standard. 393 00:21:45,940 --> 00:21:47,000 And they put it back in. 394 00:21:47,840 --> 00:21:51,300 But then it was like there's all these implementations that already do it the wrong way, but it's 395 00:21:51,300 --> 00:21:54,260 kind of the right way because for a second it was the right standard, you know? 396 00:21:54,920 --> 00:21:56,860 And so it's like the standard, it's crazy. 397 00:21:57,080 --> 00:22:00,060 You know, it's like, well, okay, the standard says you do this, but really what you do is 398 00:22:00,060 --> 00:22:04,260 this because there's this time where they forgot part of the standard and, like, so 399 00:22:04,260 --> 00:22:07,380 what you do is you get the thing and you validate it, and if that doesn't work, you try this 400 00:22:07,380 --> 00:22:07,800 other thing. 401 00:22:08,020 --> 00:22:09,860 And it's insane. 402 00:22:10,080 --> 00:22:11,260 It's seriously insane, right? 403 00:22:12,340 --> 00:22:18,160 So the original sort of vision for these distinguished names was that each distinguished name would 404 00:22:18,160 --> 00:22:21,000 fit into this global information directory tree, right? 405 00:22:21,500 --> 00:22:25,220 So you know, for instance, if I were going to get a certificate with a distinguished 406 00:22:25,220 --> 00:22:29,960 name in it, you know, it would say country United States, state Pennsylvania, locale 407 00:22:29,960 --> 00:22:35,240 Pittsburgh, organization Institute for Disruptive Studies, organizational unit, research and 408 00:22:35,240 --> 00:22:37,560 development, common name Moxie Marlin Spike. 409 00:22:38,400 --> 00:22:41,380 In practice, when people are filling these things out, they get to locale and say, what 410 00:22:41,380 --> 00:22:42,100 the fuck is locale? 411 00:22:42,600 --> 00:22:46,080 And then just type whatever they want in there and the whole thing falls apart, right? 412 00:22:46,340 --> 00:22:50,540 My favorite quote is from this one guy who was trying to implement X509 and he says, 413 00:22:50,680 --> 00:22:53,920 there's nothing in any of these standards that would prevent me from including a one 414 00:22:53,920 --> 00:22:58,520 gigabit MPEG movie of me playing with my cat as one of the RDN components of the distinguished 415 00:22:58,520 --> 00:22:59,260 name in my certificate. 416 00:23:00,980 --> 00:23:02,720 And the thing is that he's right. 417 00:23:04,960 --> 00:23:06,200 It's crazy, right? 418 00:23:06,340 --> 00:23:08,120 So you know, whatever. 419 00:23:08,400 --> 00:23:15,280 In practice, none of this stuff really materialized and at the end of the day, especially when 420 00:23:15,280 --> 00:23:20,560 we're talking about certificates that are used with SSL, basically all implementations 421 00:23:20,560 --> 00:23:23,580 just ignore everything in the distinguished name except for the common name. 422 00:23:24,200 --> 00:23:28,380 And the convention is that in the common name field, you put your domain, whatever domain 423 00:23:28,380 --> 00:23:29,260 the certificate is valid for. 424 00:23:29,260 --> 00:23:33,160 So this is where bankofamerica.com would go in this common name of the certificate, 425 00:23:33,340 --> 00:23:34,840 of the distinguished name of the certificate. 426 00:23:36,640 --> 00:23:39,260 So how is the common name represented in a certificate? 427 00:23:43,700 --> 00:23:49,660 It's this, you know, X509 is specified by, it's an ASN.1 formatted deal. 428 00:23:50,460 --> 00:23:54,340 So a common name is basically, you know, the sequence that identifies it as the common 429 00:23:54,340 --> 00:23:56,040 name and then a string type. 430 00:23:57,880 --> 00:24:02,320 There are many different string types that are supported, but you can imagine one of 431 00:24:02,320 --> 00:24:04,660 the most common is just like an ASCII string, right? 432 00:24:04,720 --> 00:24:06,060 So an IA5 string. 433 00:24:06,360 --> 00:24:08,020 And an IA5 string looks like this. 434 00:24:08,140 --> 00:24:12,760 There's a one byte value that identifies it as an IA5 string, 0x16. 435 00:24:13,640 --> 00:24:18,160 And then there's a one byte length field that specifies the length of the string to follow. 436 00:24:18,600 --> 00:24:23,620 And then there's the actual value of the string, one byte per character, you know, ASCII byte 437 00:24:23,620 --> 00:24:24,200 per character. 438 00:24:27,520 --> 00:24:32,200 So, essentially, the common name field is a Pascal string. 439 00:24:32,920 --> 00:24:37,960 People remember Pascal strings, the way it worked was there was a preceding length field 440 00:24:37,960 --> 00:24:41,680 for every string that's X number of bytes and it would specify the length of the string 441 00:24:41,680 --> 00:24:42,480 to follow, right? 442 00:24:44,120 --> 00:24:46,940 This is different from how C strings are represented. 443 00:24:47,860 --> 00:24:53,420 In C, you know, your pointer to the string is just the pointer to the first character 444 00:24:53,420 --> 00:24:53,880 in the string. 445 00:24:53,960 --> 00:24:55,240 You have no idea how long the string is. 446 00:24:55,380 --> 00:24:55,820 Right? 447 00:24:55,820 --> 00:24:58,420 And then you have to walk through the string until you encounter a null character. 448 00:24:58,720 --> 00:25:01,780 And the null character indicates that you've gotten to the end of the string. 449 00:25:03,440 --> 00:25:08,540 So really the, you know, I guess one important thing to notice is that in Pascal strings, 450 00:25:08,840 --> 00:25:11,100 a null character has no special meaning. 451 00:25:12,100 --> 00:25:14,400 It's just another character in your character string. 452 00:25:14,580 --> 00:25:17,980 And it's not imbued with any special meaning, right? 453 00:25:20,280 --> 00:25:20,720 Anyway. 454 00:25:21,160 --> 00:25:24,940 So we'd like to get some certificate. 455 00:25:24,940 --> 00:25:29,620 We'd like to get a certificate with a subject that has a common name of www.paypal.com, right? 456 00:25:30,100 --> 00:25:32,860 The problem is that we don't own paypal.com so we can't do that. 457 00:25:34,180 --> 00:25:36,700 But I do own thoughtcrime.org. 458 00:25:37,660 --> 00:25:42,300 So I could put thoughtcrime.org in the common name field of a certificate and it would look 459 00:25:42,300 --> 00:25:45,000 up who has information for me and everything would be fine. 460 00:25:45,300 --> 00:25:46,760 And again, I can put whatever I want. 461 00:25:46,840 --> 00:25:48,280 I can get www.thoughtcrime.org. 462 00:25:48,460 --> 00:25:51,640 I can get verisigneedschildren.thoughtcrime.org. 463 00:25:52,640 --> 00:25:54,520 Even things that are just totally nonsensical. 464 00:25:54,520 --> 00:25:57,280 It doesn't have to exist, you know? 465 00:25:57,320 --> 00:25:57,720 They don't care. 466 00:25:57,780 --> 00:25:58,500 They don't give a shit about it. 467 00:25:58,580 --> 00:25:59,220 They totally ignore it. 468 00:25:59,300 --> 00:26:07,880 I can put whatever I want in there, even www.paypal.com, nullcharacter.thoughtcrime.org. 469 00:26:12,140 --> 00:26:18,220 So if I submit my certificate signing request for www.paypal.com, nullcharacter.thoughtcrime.org, 470 00:26:19,060 --> 00:26:23,880 they will dutifully look up thoughtcrime.org in the Whois database, pull out my contact 471 00:26:23,880 --> 00:26:25,460 information, and contact me. 472 00:26:34,420 --> 00:26:35,820 So then, you know, okay. 473 00:26:35,940 --> 00:26:37,260 Now we're doing our man in the middle attack. 474 00:26:37,500 --> 00:26:38,260 We intercept the client hello. 475 00:26:38,480 --> 00:26:39,480 We send back server hello. 476 00:26:39,640 --> 00:26:40,460 Yes, I am the server, whatever. 477 00:26:40,680 --> 00:26:44,940 And my certificate is www.paypal.com, nullcharacter.thoughtcrime.org. 478 00:26:46,880 --> 00:26:48,680 First thing the client is going to do is check the subject. 479 00:26:49,600 --> 00:26:49,960 Right? 480 00:26:50,080 --> 00:26:51,260 So they look in the URL bar. 481 00:26:51,380 --> 00:26:52,380 We typed in paypal.com. 482 00:26:52,520 --> 00:26:53,860 They want to compare it to the subject in the certificate. 483 00:26:53,860 --> 00:26:55,960 That code might look like this. 484 00:26:56,700 --> 00:26:59,180 You know, char star destination equals get domain we're connecting to. 485 00:26:59,440 --> 00:27:01,680 Char star common name is get common name from certificate. 486 00:27:02,180 --> 00:27:07,360 And if everything is okay, str comp destination and common name will be the same. 487 00:27:08,220 --> 00:27:10,560 And str comp is going to do this. 488 00:27:10,700 --> 00:27:10,820 Right? 489 00:27:10,940 --> 00:27:13,260 You have the pointer to both of these values. 490 00:27:13,540 --> 00:27:16,300 And it's going to check the first character in both strings and make sure they're the 491 00:27:16,300 --> 00:27:16,580 same. 492 00:27:16,840 --> 00:27:19,660 And if they are, it's going to continue with the next character. 493 00:27:19,800 --> 00:27:22,620 And it's going to keep going until it encounters a null character. 494 00:27:23,880 --> 00:27:26,900 Which indicates that this is the end of the string. 495 00:27:27,300 --> 00:27:29,800 And so it's going to return success. 496 00:27:31,060 --> 00:27:38,280 What this means is that in the eyes of most SSL implementations, this certificate is completely valid for www.paypal.com. 497 00:27:39,440 --> 00:27:41,360 So what are most SSL implementations? 498 00:27:41,740 --> 00:27:47,520 So if you look at the implementations themselves, NSS is vulnerable. 499 00:27:47,800 --> 00:27:49,600 The Microsoft crypto API is vulnerable. 500 00:27:49,880 --> 00:27:50,940 GNU TLS is vulnerable. 501 00:27:50,940 --> 00:27:54,740 And what that means is that all of the products that use those things are vulnerable. 502 00:27:54,940 --> 00:28:01,460 So every product that uses the Microsoft crypto API is vulnerable to this attack when validating certificates. 503 00:28:03,160 --> 00:28:05,340 You know, the popular thing are web browsers. 504 00:28:05,480 --> 00:28:07,420 So Firefox is vulnerable because it uses NSS. 505 00:28:08,140 --> 00:28:11,160 Internet explorer is vulnerable because, of course, it uses the MS crypto API. 506 00:28:11,740 --> 00:28:13,780 Chrome is vulnerable also for the same reason. 507 00:28:14,000 --> 00:28:15,460 And then, you know, links is vulnerable. 508 00:28:15,660 --> 00:28:16,400 Curl is vulnerable. 509 00:28:17,220 --> 00:28:17,940 Mail clients. 510 00:28:18,560 --> 00:28:19,320 Thunderbird is vulnerable. 511 00:28:19,560 --> 00:28:20,180 Outlook is vulnerable. 512 00:28:22,300 --> 00:28:22,700 Pigeon. 513 00:28:22,880 --> 00:28:23,280 AIM. 514 00:28:23,520 --> 00:28:24,200 IR SSI. 515 00:28:24,240 --> 00:28:24,800 Center ICQ. 516 00:28:25,620 --> 00:28:27,080 Even SSL VPNs are vulnerable. 517 00:28:27,580 --> 00:28:27,980 AEP. 518 00:28:28,200 --> 00:28:28,600 Citrix. 519 00:28:29,000 --> 00:28:29,780 A bunch of stuff. 520 00:28:29,980 --> 00:28:31,260 I couldn't even test them all. 521 00:28:32,520 --> 00:28:33,400 Basically almost everything. 522 00:28:35,220 --> 00:28:35,620 Okay. 523 00:28:35,680 --> 00:28:39,020 So now we've updated SSL sniff and we have a first cut of this. 524 00:28:39,220 --> 00:28:40,760 And we perform a man in the middle attack. 525 00:28:41,040 --> 00:28:48,260 And if we have a null prefix certificate for the site the client is going to connect to, we send that back and complete the man in the middle attack. 526 00:28:48,360 --> 00:28:49,940 Otherwise, we just let everything go through, right? 527 00:28:51,180 --> 00:28:54,440 So how does that look, right, compared to what we were talking about earlier? 528 00:28:54,620 --> 00:28:57,320 So this is Gmail's login page, secure site. 529 00:28:57,820 --> 00:28:59,020 This is the secure version. 530 00:29:00,100 --> 00:29:01,500 This is the attack version. 531 00:29:03,400 --> 00:29:04,540 I'll show that to you again. 532 00:29:06,500 --> 00:29:07,140 Secure version. 533 00:29:08,560 --> 00:29:09,260 Attack version. 534 00:29:10,980 --> 00:29:12,780 Essentially there is no visible difference. 535 00:29:13,400 --> 00:29:19,920 Even if the user were to inspect the certificate, you know, it tells you that it's doubled. 536 00:29:20,760 --> 00:29:24,880 Because, again, it has to display the C string and when it displays it, it null terminates it, right? 537 00:29:25,000 --> 00:29:32,660 Even if you were to look at the view certificate thing and actually look at the values of the certificate, again, everything looks indistinguishable. 538 00:29:32,940 --> 00:29:35,100 There's nothing that a user can do to know that they have been attacked. 539 00:29:36,060 --> 00:29:37,940 So what are some disadvantages to this attack, right? 540 00:29:38,360 --> 00:29:41,780 To me, the biggest disadvantage is that I think targeted attacks are lame. 541 00:29:42,880 --> 00:29:44,580 I think phishing is too much work. 542 00:29:45,060 --> 00:29:49,900 I don't want to have to get the certificate for this one site or whatever and then try and get everyone to go to it. 543 00:29:49,920 --> 00:29:55,380 Really what you want to do is man in the middle an entire network and get everything that everyone is doing. 544 00:29:56,140 --> 00:30:00,620 You don't want to have to anticipate, you know, I think they're going to visit these sites or whatever. 545 00:30:01,260 --> 00:30:02,700 Sometimes you don't even know, right? 546 00:30:02,860 --> 00:30:04,340 You don't even know what's going to happen. 547 00:30:04,420 --> 00:30:08,080 You want to just get everything and sometimes things are valuable that you didn't even know about. 548 00:30:09,340 --> 00:30:13,980 So, okay, maybe there's another trick in here somewhere that we can use to accomplish our goal. 549 00:30:15,640 --> 00:30:18,040 So the first thing we might try is actually looking at the source. 550 00:30:18,040 --> 00:30:22,760 And, you know, any SSL implementation that does this matching, right? 551 00:30:23,120 --> 00:30:27,100 So we can start with NSS, which is the thing that Firefox and all the Mozilla products use, right? 552 00:30:27,240 --> 00:30:28,360 So you can start and look at the source. 553 00:30:29,440 --> 00:30:30,440 Don't look at it too carefully. 554 00:30:30,560 --> 00:30:31,660 Just let your eyes go out of focus. 555 00:30:33,560 --> 00:30:38,640 Without actually looking at any individual line, just look at the shape of it. 556 00:30:40,140 --> 00:30:41,000 It's terrible, right? 557 00:30:41,720 --> 00:30:46,460 All these nested conditions, the, like, how it arcs out like that. 558 00:30:46,460 --> 00:30:47,440 It's too long. 559 00:30:47,620 --> 00:30:49,380 This thing goes on for, like, four pages or whatever. 560 00:30:50,380 --> 00:30:55,200 Just looking at the shape of this code, you know there's a bug in here somewhere. 561 00:31:05,180 --> 00:31:07,760 So then your eyes start to clear. 562 00:31:08,960 --> 00:31:10,640 And you look at the very first line. 563 00:31:12,680 --> 00:31:14,340 Register int xy. 564 00:31:16,460 --> 00:31:16,700 Register. 565 00:31:19,100 --> 00:31:21,000 This must be, like, 14-year-old code. 566 00:31:21,240 --> 00:31:23,160 You know, nobody uses register shadowing anymore. 567 00:31:23,340 --> 00:31:24,620 The compilers just ignore it, right? 568 00:31:24,940 --> 00:31:27,560 So that's, you know, another signal that maybe something is amiss. 569 00:31:28,380 --> 00:31:31,680 And then you look a little bit further and you get to the wildcard matching. 570 00:31:36,420 --> 00:31:39,860 And you look at that and you're like, wow, this is probably the least efficient way that you can do this. 571 00:31:40,540 --> 00:31:42,560 And then you realize, wow. 572 00:31:43,380 --> 00:31:45,900 You can get a certificate for star. 573 00:31:45,900 --> 00:31:48,280 Star, null character, .thoughtcrime.org. 574 00:32:00,460 --> 00:32:02,640 And this will match any domain. 575 00:32:03,760 --> 00:32:05,900 This is actually better than having a CA cert. 576 00:32:06,240 --> 00:32:11,600 Because if you have a CA cert, you actually have to, like, create another certificate and sign it to, like, present it to someone. 577 00:32:11,760 --> 00:32:14,620 You can just, if you have this thing, you can just hand them the same thing over and over again. 578 00:32:14,620 --> 00:32:15,520 And it matches for everything. 579 00:32:16,760 --> 00:32:19,340 There's also, like, other really weird stuff in there. 580 00:32:19,460 --> 00:32:22,840 Like, if you don't want to use a null character, you could get star.tildi.thoughtcrime.org. 581 00:32:22,920 --> 00:32:23,640 That would also work. 582 00:32:24,820 --> 00:32:25,980 It supports grouping. 583 00:32:26,540 --> 00:32:27,280 Which is weird. 584 00:32:28,800 --> 00:32:32,760 So, like, because wildcard certificates are a little extra or they cost more money. 585 00:32:32,880 --> 00:32:41,560 So if you don't want to shell out for a wildcard certificate, you can just get, like, paypal.com or mail.google.com or etrade.com or bankofamerica.com. 586 00:32:43,700 --> 00:32:44,600 Nullcharacter.thoughtcrime.org. 587 00:32:45,440 --> 00:32:47,900 And you only have to pay for one certificate this way. 588 00:32:50,140 --> 00:32:52,780 And, of course, here's your remote exploit in here. 589 00:32:53,160 --> 00:32:58,000 If you look at how it supports the grouping, it allocates based on the length of the string. 590 00:32:58,220 --> 00:33:02,740 Which is, you know, going to be calculated based on whatever null character might be in there. 591 00:33:03,640 --> 00:33:07,500 And then it loops through the string again looking for close paren. 592 00:33:07,640 --> 00:33:11,340 Just ignoring wherever the null character might be. 593 00:33:12,060 --> 00:33:15,200 And then it just copies until it hits the null character. 594 00:33:15,480 --> 00:33:20,500 So if you have, you know, a string like this, you allocate a buffer that's this big. 595 00:33:20,680 --> 00:33:22,580 And then you copy this much data. 596 00:33:23,020 --> 00:33:26,340 And this is actually, the stars actually align to make this exploitable. 597 00:33:26,560 --> 00:33:30,500 Like, there are so many things that should have stopped this from being exploitable. 598 00:33:30,720 --> 00:33:34,560 You know, the first thing you're like, okay, well, there's no way I can get shellcode past the Unicode filters or whatever. 599 00:33:34,700 --> 00:33:38,020 And then you look at the Unicode filters and you're like, no, actually, I can't get the shellcode past the Unicode. 600 00:33:38,920 --> 00:33:41,220 And, you know, then it's like, oh, but they stirdupe on it. 601 00:33:41,340 --> 00:33:43,460 So that would, like, terminate the null character thing. 602 00:33:43,760 --> 00:33:47,440 And you're like, no, but if you put a tilde in there, it just replaces that with a null character, you know. 603 00:33:48,040 --> 00:33:51,880 So anyway, the stars really align to make this exploitable, which is kind of insane. 604 00:33:52,960 --> 00:33:55,580 Oh, the other nice things about this is that no signature is required. 605 00:33:55,840 --> 00:33:57,820 You don't have to get a CA to sign your shellcode. 606 00:33:58,080 --> 00:34:06,960 Because, again, when I was talking before about how, you know, SSL implementations used to just stop at the first thing that they found that was wrong. 607 00:34:07,140 --> 00:34:09,760 And pop up a dialog box that was like, this expired ten minutes ago, whatever. 608 00:34:09,760 --> 00:34:10,980 So they went to fix that. 609 00:34:11,160 --> 00:34:18,380 And so now whenever they find anything that's wrong, they continue validating and check everything so that they can pop up a dialog that's like, X, Y, and Z is wrong, you know. 610 00:34:18,900 --> 00:34:24,580 And so, you know, even if the signature is bad on the certificate that you hand to the browser, it's like, okay, the signature is bad. 611 00:34:24,700 --> 00:34:28,980 But I better check the common name to make sure that I know whether to display an error or not. 612 00:34:29,200 --> 00:34:33,380 And, of course, then you, you know, exploit the client. 613 00:34:35,640 --> 00:34:38,500 Anyway, so now we have a second cut of SSL sniff. 614 00:34:38,500 --> 00:34:40,220 And we perform our man-in-the-middle attack. 615 00:34:40,460 --> 00:34:46,940 And if there's a null prefix certificate available for whatever the client is trying to connect to, we use that. 616 00:34:47,720 --> 00:34:52,280 Otherwise, if the client is NSS, then we pass them the universal wildcard certificate. 617 00:34:52,500 --> 00:34:53,340 And it just works for everything. 618 00:34:54,680 --> 00:35:01,620 So now basically we're in a situation where SSL sniff has to fingerprint the network to know what clients are what so that it knows what to attack in which way. 619 00:35:02,040 --> 00:35:03,500 So it fingerprints the network. 620 00:35:03,720 --> 00:35:06,780 And every NSS client's communication is intercepted. 621 00:35:06,780 --> 00:35:10,740 And then for the non-NSS clients, all the certs that you have are used. 622 00:35:11,640 --> 00:35:16,400 And whatever non-vulnerable clients exist are left alone so that you don't get detected. 623 00:35:17,400 --> 00:35:19,420 So what do we have to worry about as attackers, right? 624 00:35:19,820 --> 00:35:25,180 The two things that come to mind for me are certificate revocation and updates, right? 625 00:35:25,620 --> 00:35:36,080 So the first thing is that it would be unfortunate if some bitter certificate authority audited their system, discovered that a bunch of certificates had been issued with null characters in them, and then went to revoke those certificates. 626 00:35:36,880 --> 00:35:45,080 And then updates is that it would be unfortunate if some bitter SSL implementation actually fixed their thing and then our tricks stopped working. 627 00:35:45,880 --> 00:35:47,500 So let's start with certificate revocation. 628 00:35:48,440 --> 00:35:51,580 These days it's all about this thing called online certificate status protocol. 629 00:35:52,600 --> 00:36:04,860 And the deal is that whenever an SSL stack sees a new certificate, like something that it hasn't seen since it's been running in this session, it makes a quick request to the OCSP URL that's embedded in the certificate to check with the signing CA. 630 00:36:04,860 --> 00:36:13,280 So basically what happens is every time an SSL stack sees a certificate, it makes a quick, lightweight request to the certificate authority that says, hey, is this thing still valid? 631 00:36:13,420 --> 00:36:14,580 Have you revoked this yet? 632 00:36:16,280 --> 00:36:19,580 And the stack gets a signed response back from the OCSP provider. 633 00:36:20,100 --> 00:36:27,440 So as attackers, this is really deadly for us because if a certificate gets revoked, it's gone instantly, right? 634 00:36:27,580 --> 00:36:34,840 The old world of the certificate revocation lists where there was, like, you know, one per certificate authority and each one is, like, seven minutes long. 635 00:36:34,860 --> 00:36:38,220 It's not 100 megabytes long because it's just a list of every certificate that's ever been revoked ever. 636 00:36:38,900 --> 00:36:39,980 You know, that wasn't working. 637 00:36:40,120 --> 00:36:45,200 So they went to this model, and it's a deadly model for attackers who are forging certificates, right? 638 00:36:46,320 --> 00:36:51,640 So, you know, here again is Google's certificate, and you can see that there's this OCSP URL embedded in the certificate. 639 00:36:51,900 --> 00:36:57,920 And every time a browser sees this, it will make a quick request out to OCSP.thought.com and see what's up. 640 00:36:59,980 --> 00:37:01,460 So let's look at OCSP. 641 00:37:01,540 --> 00:37:02,260 How does this thing work? 642 00:37:02,600 --> 00:37:03,040 Right? 643 00:37:04,860 --> 00:37:08,560 So the OCSP response that comes back from the certificate authority looks like this. 644 00:37:08,680 --> 00:37:16,800 It's basically a one-byte response status and then some response bytes, the actual data that tells you what's going on with the status, right? 645 00:37:17,860 --> 00:37:19,880 And the response bytes look like this. 646 00:37:20,800 --> 00:37:25,780 There's, you know, basically some data that says, like, this is the deal, this is what's going on, and there's a signature in there. 647 00:37:26,960 --> 00:37:29,500 And, you know, as an attacker, this could be a problem. 648 00:37:29,740 --> 00:37:34,340 It might be difficult to forge the certificate or forge the signature, which is, you know, kind of a drag. 649 00:37:34,340 --> 00:37:42,180 But if you look at the signature, the interesting thing about it is that it only covers some of the response data. 650 00:37:44,740 --> 00:37:49,120 Notably, what it doesn't cover is all this other stuff, including the response status. 651 00:37:50,560 --> 00:37:54,980 And the response bytes themselves are actually optional, depending on the status, right? 652 00:37:55,360 --> 00:38:01,120 So if we look at, you know, what the status options are, the status structure looks like this, right? 653 00:38:01,460 --> 00:38:04,320 So you can either send, you know, one of these things. 654 00:38:04,320 --> 00:38:11,720 And so ideally we'd like to send, if we were, like, spoofing the OCSP provider, what we'd like to do is send back successful. 655 00:38:12,620 --> 00:38:17,780 But we can't, or it might be difficult to send back successful because if we did, we would have to include the optional response bytes. 656 00:38:18,000 --> 00:38:20,960 And that has a signature in it that might be difficult for us to forge. 657 00:38:21,520 --> 00:38:23,360 So we can't send back successful, right? 658 00:38:23,520 --> 00:38:25,080 So maybe we could send back something else. 659 00:38:27,860 --> 00:38:30,780 So if you start to look through these things, all right, what else do we got? 660 00:38:32,100 --> 00:38:32,700 Malformed request. 661 00:38:34,320 --> 00:38:35,240 That doesn't sound that good. 662 00:38:36,560 --> 00:38:39,140 We could send internal error. 663 00:38:40,020 --> 00:38:44,120 That also doesn't sound good because it has the word error in it, you know. 664 00:38:45,700 --> 00:38:47,360 And then you get try later. 665 00:38:49,740 --> 00:38:51,140 Well, that doesn't sound bad at all. 666 00:38:52,320 --> 00:38:56,060 You know, it's not really implying that there's a problem, you know. 667 00:38:56,220 --> 00:38:57,760 Definitely not a problem with our certificate. 668 00:38:57,880 --> 00:38:58,820 It's just saying try back later. 669 00:38:59,400 --> 00:39:03,520 It's even sort of suggesting that it might be successful at a later date, you know. 670 00:39:03,640 --> 00:39:04,300 Try back later. 671 00:39:04,320 --> 00:39:05,380 And it could work good. 672 00:39:06,700 --> 00:39:13,260 So the interesting thing about try later is that you don't have to include the optional response bytes when you send try later. 673 00:39:13,480 --> 00:39:20,460 So all you have to send back is the response itself, which is a single byte value that's literally 3. 674 00:39:21,860 --> 00:39:23,700 Actually, the ASCII character 3. 675 00:39:23,880 --> 00:39:25,780 So all you have to send back is 0x33. 676 00:39:26,920 --> 00:39:32,140 And it turns out that when you send that back for every SSL implementation that I've tried, 677 00:39:32,320 --> 00:39:34,300 they all agree that it also doesn't work. 678 00:39:34,320 --> 00:39:34,860 It doesn't sound too bad. 679 00:39:37,720 --> 00:39:44,180 So what this essentially means is this entire standard, this whole OCSP thing, can be defeated by the number 3. 680 00:39:52,720 --> 00:39:54,720 So now, okay, third cut. 681 00:39:54,900 --> 00:39:56,300 We have an OCSP or SSL SNF. 682 00:39:56,380 --> 00:39:57,320 We do everything that we do before. 683 00:39:57,740 --> 00:40:04,300 And now if we see an OCSP request for any of the URLs that are embedded in the forged certificates that we're using, 684 00:40:04,300 --> 00:40:07,140 we man in the middle of that and send back 3. 685 00:40:08,580 --> 00:40:09,220 And, yeah. 686 00:40:10,200 --> 00:40:13,120 So even if the certificates get revoked, no one will ever know. 687 00:40:14,720 --> 00:40:15,040 Okay. 688 00:40:15,120 --> 00:40:16,380 The other thing we've got to worry about is updates. 689 00:40:17,940 --> 00:40:22,280 You know, just by talking to you today, people are probably going to try and fix this. 690 00:40:23,540 --> 00:40:26,380 So it used to be that people, like, downloaded software, right? 691 00:40:26,620 --> 00:40:29,520 And, of course, it's a rapidly changing world. 692 00:40:29,780 --> 00:40:32,080 There's, you know, more and more bugs. 693 00:40:32,300 --> 00:40:33,080 There's more and more at stake. 694 00:40:33,080 --> 00:40:38,980 And you want to try and get the patches into people's hands faster and faster. 695 00:40:40,440 --> 00:40:44,320 So a lot of people have felt the need to deploy this self-updating software. 696 00:40:45,600 --> 00:40:47,300 So this is bad news for us, right? 697 00:40:47,360 --> 00:40:49,560 Because that means that things get patched quicker. 698 00:40:49,720 --> 00:40:52,200 There's a lower window for attacking software. 699 00:40:52,920 --> 00:40:57,680 But it also seems like their update mechanisms might be kind of a dangerous idea, right? 700 00:40:57,740 --> 00:41:02,620 You have software out there that's just, like, connecting somewhere and downloading other stuff and just running it, right? 701 00:41:02,620 --> 00:41:05,580 So maybe there's something we can do about our problem. 702 00:41:07,720 --> 00:41:09,340 So let's look at the Mozilla system. 703 00:41:09,980 --> 00:41:14,940 When you install Firefox or Thunderbird or any of the Mozilla products, it comes with this feature called automatic update service. 704 00:41:15,840 --> 00:41:17,280 And that's enabled by default. 705 00:41:19,600 --> 00:41:28,500 The way this works is you make an SSL connection or, you know, periodically, I think once a day, the browser makes an SSL connection to the update server. 706 00:41:28,820 --> 00:41:29,720 And it says, hello. 707 00:41:29,900 --> 00:41:32,100 I am, you know, whatever. 708 00:41:32,100 --> 00:41:33,840 Firefox, version whatever. 709 00:41:34,080 --> 00:41:37,600 Here's my build ID for my operating system, Linux, Windows, whatever. 710 00:41:37,900 --> 00:41:39,700 My locale, NUS, whatever. 711 00:41:39,840 --> 00:41:41,280 Channel, stable, nightly. 712 00:41:41,880 --> 00:41:43,100 Do you have any updates for me? 713 00:41:43,800 --> 00:41:47,000 And the update server responds, as a matter of fact, I do. 714 00:41:47,960 --> 00:41:53,260 Here's a totally unsigned blob of data that I would recommend that you just run. 715 00:41:56,860 --> 00:42:02,080 The deal is that they depend on their SSL connection for all the stuff that they need. 716 00:42:02,080 --> 00:42:02,760 All security of the system. 717 00:42:03,200 --> 00:42:03,280 Right? 718 00:42:04,260 --> 00:42:10,740 The idea is that since all of this is transmitted over SSL, no one could ever possibly, you know, intercept these requests. 719 00:42:12,320 --> 00:42:16,080 So, you know, we just send this data back through there and everything should be fine. 720 00:42:17,060 --> 00:42:20,580 And by default, the minor updates are downloaded and installed silently. 721 00:42:21,120 --> 00:42:24,200 And they only prompt the user once everything is done. 722 00:42:24,420 --> 00:42:27,980 Once everything has been downloaded and installed, it says, hey, we updated your system. 723 00:42:28,640 --> 00:42:29,200 Restart now. 724 00:42:29,380 --> 00:42:29,560 You know? 725 00:42:29,560 --> 00:42:34,960 And the interesting thing is that the update server is the thing that reports the version number of the update. 726 00:42:35,360 --> 00:42:39,520 So the update server is essentially what determines whether software gets installed silently or not. 727 00:42:41,320 --> 00:42:47,120 So the problem is going to be that as vendors start to release patches for this vulnerability, the update mechanisms themselves are vulnerable. 728 00:42:47,540 --> 00:42:48,020 Right? 729 00:42:48,080 --> 00:42:53,760 Because all we need is our universal wildcard cert or null prefix cert for AOS2.mozilla.org. 730 00:42:53,980 --> 00:42:57,600 And we can take control of the update mechanism to deliver whatever payloads we want. 731 00:42:59,040 --> 00:43:00,240 So this could be anything. 732 00:43:00,480 --> 00:43:02,300 It could be a root kit that logs keystrokes. 733 00:43:02,420 --> 00:43:04,780 It could be something that sends all the traffic to you. 734 00:43:05,220 --> 00:43:09,800 It could be a completely legitimate image that just happens to include our own CACerts for future use. 735 00:43:11,140 --> 00:43:13,320 Or just to be confusing, it could be a totally different app. 736 00:43:13,780 --> 00:43:13,880 You know? 737 00:43:14,000 --> 00:43:17,960 You could, like, get the update and it's, like, thank you for updating to Galleon 0.0.3. 738 00:43:18,720 --> 00:43:19,240 You know? 739 00:43:19,420 --> 00:43:21,560 Or just, like, you update and then notepad opens. 740 00:43:21,780 --> 00:43:22,300 You know? 741 00:43:22,360 --> 00:43:22,920 I don't know. 742 00:43:23,260 --> 00:43:27,560 The other cool thing is that this works not just for the Mozilla binaries, but for the 743 00:43:27,560 --> 00:43:27,580 application itself. 744 00:43:27,580 --> 00:43:28,380 It has extensions, too. 745 00:43:28,720 --> 00:43:33,220 So all the add-ons auto-update, where they connect to add-ons.mozilla.org over SSL. 746 00:43:33,280 --> 00:43:34,580 And they say, hey, do you have anything new for me? 747 00:43:34,680 --> 00:43:35,740 And it says, yes, here you go. 748 00:43:35,780 --> 00:43:36,180 Run this thing. 749 00:43:37,120 --> 00:43:41,120 So even if you don't want to mess with, like, root-kitting the binary, you can just root-kit whatever add-on you want. 750 00:43:41,580 --> 00:43:44,460 Which is actually just as good, because you can do anything from an add-on. 751 00:43:46,260 --> 00:43:46,900 I taught... 752 00:43:47,340 --> 00:43:50,980 I did a training at Black Hat called Intercepting Secure Communication. 753 00:43:51,320 --> 00:43:55,020 And at the end, we did an exercise where we had, like, a little malware competition for this vulnerability. 754 00:43:55,700 --> 00:43:57,200 And the people that won... 755 00:43:57,200 --> 00:44:03,700 Had an add-on that basically any time that you posted data to a form, it also posted a copy to them. 756 00:44:04,440 --> 00:44:07,320 So it's like the man-in-the-middle attack that keeps on giving or whatever. 757 00:44:07,540 --> 00:44:07,620 You know? 758 00:44:07,700 --> 00:44:08,260 It's kind of cool. 759 00:44:10,640 --> 00:44:11,360 So anything... 760 00:44:11,360 --> 00:44:16,420 You know, the problem is that in order to patch your system for this effectively, you're not going to be able to trust anything that comes through automatic updates. 761 00:44:16,760 --> 00:44:19,720 Or actually, at this point, anything that has ever come through automatic updates. 762 00:44:22,060 --> 00:44:24,340 So now, SSL sniff, I have a... 763 00:44:24,740 --> 00:44:26,280 The fourth cut is an updated aware. 764 00:44:27,020 --> 00:44:27,560 SSL sniff. 765 00:44:27,740 --> 00:44:28,700 So it does everything before. 766 00:44:28,920 --> 00:44:29,400 It does all the fingerprinting. 767 00:44:29,820 --> 00:44:30,440 OCSP denial. 768 00:44:30,820 --> 00:44:31,260 All this stuff. 769 00:44:31,440 --> 00:44:33,260 And now, it also watches for update requests. 770 00:44:33,680 --> 00:44:41,320 And if it sees one, you can specify on the command line, you know, update these platforms with this binary. 771 00:44:41,640 --> 00:44:44,580 And, you know, if you see an add-on, update it with this thing or whatever. 772 00:44:44,740 --> 00:44:48,580 And so it'll just hijack the updates and install code on your computer. 773 00:44:50,280 --> 00:44:50,680 Okay. 774 00:44:50,780 --> 00:44:52,440 As a quick postscript to all of this stuff. 775 00:44:53,680 --> 00:44:56,260 Stripping null characters from certificates is not a solution. 776 00:44:56,800 --> 00:45:01,720 So there's, like, a couple of stacks that aren't vulnerable to the thing that I've been talking about so far. 777 00:45:01,840 --> 00:45:04,220 Like Safari and Opera aren't vulnerable to that. 778 00:45:04,760 --> 00:45:09,400 But they appear to just strip the null character from the common name before they compare it. 779 00:45:09,480 --> 00:45:09,540 Right? 780 00:45:09,600 --> 00:45:16,280 So if you get paypal.com null character.thoughtcrime.org, they strip it and then compare it so it becomes paypal.com.thoughtcrime.org. 781 00:45:16,920 --> 00:45:18,680 And so that stops this attack. 782 00:45:18,800 --> 00:45:21,320 But it actually opens up an attack vector for a different attack. 783 00:45:23,180 --> 00:45:26,240 So the weird thing is that, like, some certificate authorities don't do that. 784 00:45:26,260 --> 00:45:27,620 Some of these are vulnerable to this internally. 785 00:45:28,220 --> 00:45:28,580 Right? 786 00:45:28,780 --> 00:45:39,540 So if you submit a CSR for paypal.com null character.thoughtcrime.org, the certificate authority itself trips over the null character and tries to validate the cert against paypal.com. 787 00:45:39,760 --> 00:45:41,560 So it thinks that you're paypal.com. 788 00:45:42,400 --> 00:45:48,860 But the interesting thing is that when you actually get the cert back, it gives you the entire thing that was originally in the subject. 789 00:45:49,060 --> 00:45:49,260 Right? 790 00:45:50,200 --> 00:45:53,860 So, you know, the problem is that, you know, we're not paypal. 791 00:45:53,940 --> 00:45:54,600 So we can't. 792 00:45:54,600 --> 00:45:56,780 You know, we would not be able to get a cert that way. 793 00:45:56,900 --> 00:45:58,020 But you can do other things. 794 00:45:58,140 --> 00:45:58,200 Right? 795 00:45:58,280 --> 00:46:00,540 So you could register a domain like sitekey.ba. 796 00:46:01,820 --> 00:46:07,200 And then you get a certificate for sitekey.ba null character inc of america.com. 797 00:46:08,260 --> 00:46:15,400 And so when the CAs are, like, internally vulnerable, they'll, like, do the authentication thing against sitekey.ba, which you own. 798 00:46:15,560 --> 00:46:15,780 Right? 799 00:46:15,840 --> 00:46:21,000 But then what you actually get back is sitekey.ba null character inc of america.com. 800 00:46:22,600 --> 00:46:23,040 Right? 801 00:46:23,040 --> 00:46:30,860 And so then when you actually present this to an SSL stack that strips the null character, it becomes sitekey.bankofamerica.com. 802 00:46:31,200 --> 00:46:33,720 And that would validate correctly against bank of america. 803 00:46:33,880 --> 00:46:39,960 So basically every SSL implementation, I think, is vulnerable to some variation of this. 804 00:46:41,740 --> 00:46:49,560 So in conclusion, we have a man in the middle attack that will intercept communication for, I think, almost all SSL and TLS implementations. 805 00:46:49,780 --> 00:46:52,300 In the case of NSS, we only need a single certificate. 806 00:46:52,300 --> 00:46:53,380 And we get all the traffic. 807 00:46:53,620 --> 00:46:55,200 We defeated OCSP as implemented. 808 00:46:55,700 --> 00:46:58,580 We can hijack the auto updates for applications and extensions. 809 00:46:59,120 --> 00:47:00,380 We've got an exploitable overflow. 810 00:47:01,080 --> 00:47:05,880 So in short, we've got your passwords, your communication, and control of the software that runs on your computer. 811 00:47:08,060 --> 00:47:08,540 Thanks. 812 00:47:18,240 --> 00:47:22,280 So SSL strip, the thing that I was talking about in the beginning, is available on my website. 813 00:47:22,280 --> 00:47:23,680 It's been available for a while. 814 00:47:24,700 --> 00:47:27,840 SSL sniff, the old version, is available on my website. 815 00:47:28,060 --> 00:47:36,800 And the new version that supports all of these new attacks will be available on my website sometime between today and Monday. 816 00:47:38,100 --> 00:47:40,660 So you can download all that stuff there at thoughtcrime.org. 817 00:47:41,860 --> 00:47:42,380 Thanks.