1 00:00:00,000 --> 00:00:02,040 Next talk is going to be by Mike Zessman. 2 00:00:02,180 --> 00:00:03,100 So let's give him a big hand, please. 3 00:00:09,700 --> 00:00:11,260 All right, thank you very much. 4 00:00:11,500 --> 00:00:15,380 So, yeah, this talk is about, what's it called? 5 00:00:15,540 --> 00:00:18,040 Oh, yeah, criminal charges not pursued hacking PKI. 6 00:00:18,720 --> 00:00:21,660 So there's been a lot of talk about SSL in the media recently 7 00:00:21,660 --> 00:00:26,700 and pretty much ever since last summer when Dan put out his big DNS flaw. 8 00:00:26,700 --> 00:00:30,240 And all of a sudden it was very easy to become man in the middle for, you know, 9 00:00:30,280 --> 00:00:35,260 a large portion of the Internet, if not even just a local network. 10 00:00:35,680 --> 00:00:37,220 So what this talk is going to be about, 11 00:00:37,680 --> 00:00:42,240 it's about the web application flaws of certificate authority websites. 12 00:00:43,040 --> 00:00:46,200 So certificate authority websites like your VeriSigns and your Thoughts, 13 00:00:46,200 --> 00:00:48,380 I mean, that's where you go when you need SSL for your site, 14 00:00:48,440 --> 00:00:49,600 you have to go to one of these sites. 15 00:00:49,860 --> 00:00:52,880 And it's their job to make sure that you're who you say you are 16 00:00:52,880 --> 00:00:56,100 and that you're authorized to get a certificate for the domain 17 00:00:56,100 --> 00:00:56,680 that you're using. 18 00:00:56,700 --> 00:01:00,540 Obviously, we can't have people going around claiming to be PayPal 19 00:01:00,540 --> 00:01:06,080 and saying, yeah, give me a cert that all major browsers will trust as me being PayPal. 20 00:01:07,720 --> 00:01:08,980 So that's what we're going to talk about. 21 00:01:09,160 --> 00:01:12,460 Now, why do I feel like we need to have this talk? 22 00:01:13,040 --> 00:01:17,500 Well, I think CAs need to be held accountable for their lack of security, 23 00:01:17,660 --> 00:01:20,780 as we've seen over the last year since a lot of people have actually started 24 00:01:22,220 --> 00:01:24,000 looking at SSL as a target. 25 00:01:26,000 --> 00:01:29,240 Because the main problem is when CAs are successfully attacked, 26 00:01:29,540 --> 00:01:33,180 if you own a CA or you somehow game a CA's validation mechanism, 27 00:01:33,680 --> 00:01:34,940 the CA doesn't really hurt. 28 00:01:35,240 --> 00:01:37,940 Because, in fact, they might even make money off the deal 29 00:01:37,940 --> 00:01:39,880 because you're just buying a certificate from them. 30 00:01:40,080 --> 00:01:42,880 But the people who are going to suffer are users of the internet, 31 00:01:43,020 --> 00:01:44,440 the people who trust that CA. 32 00:01:44,740 --> 00:01:48,940 And unfortunately, nowadays, we don't really make those trust decisions on our own. 33 00:01:49,260 --> 00:01:50,960 We kind of just use a browser. 34 00:01:51,160 --> 00:01:52,900 And for the most part, most people, 35 00:01:53,740 --> 00:01:56,780 we'll just end up trusting whoever the browser trusts. 36 00:02:03,160 --> 00:02:05,980 So what I hope you guys take away from this presentation, 37 00:02:06,460 --> 00:02:10,540 we're going to talk about SSL rebinding, which is a new technique. 38 00:02:10,840 --> 00:02:13,020 I don't know how many people were here at Black Hat. 39 00:02:13,280 --> 00:02:14,900 I don't know. Raise your hands. I know there were a couple. 40 00:02:15,220 --> 00:02:16,680 How many of you came and saw my talk? 41 00:02:17,600 --> 00:02:20,060 All right. How many saw my demos fail epically? 42 00:02:20,460 --> 00:02:20,820 Okay. 43 00:02:21,900 --> 00:02:22,880 So we're going to go over... 44 00:02:22,880 --> 00:02:23,800 We're going to go over SSL rebinding, 45 00:02:23,940 --> 00:02:29,060 which is a technique that we use to bypass extended validation SSL, 46 00:02:29,140 --> 00:02:30,800 which is the next generation of SSL. 47 00:02:30,920 --> 00:02:36,080 But I think the technique can be used for many more applications than just EV. 48 00:02:36,320 --> 00:02:37,720 And we'll talk about that in a little bit. 49 00:02:38,720 --> 00:02:43,560 Really, I think this talk is focusing on general web application security awareness. 50 00:02:43,740 --> 00:02:45,420 So if you're either a web app pen tester 51 00:02:45,420 --> 00:02:48,340 or maybe you're in charge of some web applications or websites, 52 00:02:49,080 --> 00:02:52,860 hopefully you'll take away some valuable information. 53 00:02:52,880 --> 00:02:56,560 from this, based on how these CAs are failing to secure their own web apps. 54 00:02:57,300 --> 00:02:59,040 I think most importantly, 55 00:02:59,660 --> 00:03:04,540 what people should take away from this talk is a higher scrutiny approach to SSL PKI. 56 00:03:06,100 --> 00:03:10,320 You know, maybe we really shouldn't be just trusting whoever our browser trusts. 57 00:03:10,460 --> 00:03:12,860 Maybe we need to look in that certificate authority store 58 00:03:13,260 --> 00:03:17,380 and see that we're actually trusting certificate authorities from all over the world, 59 00:03:17,420 --> 00:03:21,100 not just VeriSign and the ones we know of, but some random 60 00:03:22,880 --> 00:03:25,480 certificate authority in Hong Kong, or wherever it may be. 61 00:03:27,740 --> 00:03:29,940 So a little bit about the title of this talk, 62 00:03:30,200 --> 00:03:32,800 Criminal Charges Not Pursued. 63 00:03:33,180 --> 00:03:37,000 So last December, and the way I've been doing this kind of research, 64 00:03:37,160 --> 00:03:40,140 it's been on the side, and my wife hasn't been too happy about that, 65 00:03:41,300 --> 00:03:44,100 but, you know, I've been looking at random certificate authorities 66 00:03:44,100 --> 00:03:48,320 and seeing how they actually process certificate signing requests. 67 00:03:48,680 --> 00:03:51,780 And I stumbled upon the StartCom site, and I found 68 00:03:51,780 --> 00:03:55,640 a pretty critical vulnerability in their validation mechanism 69 00:03:55,640 --> 00:04:00,600 that we're going to cover in detail coming up in a couple of slides. 70 00:04:01,600 --> 00:04:06,560 But one of the things they did is, after the event, or the critical event, 71 00:04:07,300 --> 00:04:11,880 they published a report based on everything that they saw from their perspective, 72 00:04:12,100 --> 00:04:14,100 in which they referred to me as the attacker, 73 00:04:14,340 --> 00:04:18,360 which was something I'd never really been referred to in the third person before. 74 00:04:18,620 --> 00:04:18,760 But... 75 00:04:20,480 --> 00:04:21,000 And... 76 00:04:21,000 --> 00:04:21,460 And... 77 00:04:21,460 --> 00:04:23,660 And they also pointed out that they were not pursuing criminal charges, 78 00:04:23,880 --> 00:04:25,500 which made me very happy. 79 00:04:26,820 --> 00:04:29,820 But I do want to say thank you to StartCom, 80 00:04:29,940 --> 00:04:33,260 because they're actually on top of their game, 81 00:04:33,420 --> 00:04:35,260 and they fixed this bug very quickly. 82 00:04:35,780 --> 00:04:40,140 So, I mean, it just says that these guys care about PKI first, 83 00:04:40,260 --> 00:04:44,100 and not the money, which I think is something we need to really think about. 84 00:04:44,200 --> 00:04:46,640 It can be very easy to just get on the CAs really hard, 85 00:04:46,740 --> 00:04:49,000 because, well, essentially they do have a license to print money. 86 00:04:49,000 --> 00:04:52,940 But there are some people out there who do value the trust. 87 00:04:54,900 --> 00:04:57,340 So, just to kind of go over the background a little bit, 88 00:04:57,420 --> 00:04:58,860 why SSL in the first place? 89 00:04:58,980 --> 00:05:00,480 Well, like I said last summer, 90 00:05:01,160 --> 00:05:04,840 Dan Kaminski came out with his ubiquitous DNS flaw, affected everybody. 91 00:05:05,220 --> 00:05:08,840 All of a sudden, you can very easily become the man in the middle for arbitrary domains. 92 00:05:09,840 --> 00:05:12,140 So, obviously, if you control DNS in any fashion, 93 00:05:12,300 --> 00:05:14,220 whether it be through some sort of DNS exploit, 94 00:05:14,460 --> 00:05:17,220 or running a rogue wireless access point, 95 00:05:17,440 --> 00:05:18,920 or compromising somebody's DNS, 96 00:05:19,000 --> 00:05:20,820 it can happen any number of ways, 97 00:05:21,060 --> 00:05:22,440 you become the man in the middle. 98 00:05:23,160 --> 00:05:26,020 And there was a discussion on the Daily Dave mailing list, 99 00:05:26,180 --> 00:05:28,840 which I think Halvar Flaky said, 100 00:05:29,100 --> 00:05:31,440 well, this is why SSL was invented. 101 00:05:31,640 --> 00:05:34,760 SSL is put in place to ensure end-to-end trust. 102 00:05:35,100 --> 00:05:38,160 So that I know that my data going out on the wire is encrypted, 103 00:05:38,380 --> 00:05:42,780 and I have a good assurance that I know who I'm actually talking to. 104 00:05:43,220 --> 00:05:44,760 But DNS is just one thing. 105 00:05:44,860 --> 00:05:47,480 I mean, we still have ARP spoofing, insecure wireless networks, 106 00:05:47,480 --> 00:05:48,920 and all that. 107 00:05:49,160 --> 00:05:54,020 So I think SSL is a target regardless of whether or not 108 00:05:54,020 --> 00:05:55,720 you can man in the middle half the internet. 109 00:05:56,060 --> 00:06:00,680 If your target is one guy who happens to use an insecure wireless network 110 00:06:00,680 --> 00:06:02,140 at the neighborhood cafe every day, 111 00:06:02,300 --> 00:06:05,320 these techniques are still going to be of value to you. 112 00:06:07,340 --> 00:06:10,240 So a little bit more about SSL PKI in general. 113 00:06:12,280 --> 00:06:14,200 Last summer, when I started looking at this, 114 00:06:14,240 --> 00:06:17,400 again, I was doing the talk on SSL VPNs at Black Hat, 115 00:06:17,480 --> 00:06:19,860 so SSL was kind of a big part of that. 116 00:06:20,780 --> 00:06:22,700 Kaminsky came out with his vulnerability, 117 00:06:22,940 --> 00:06:25,600 and I said, well, how hard is it to get an SSL certificate 118 00:06:25,600 --> 00:06:27,420 for a domain that you don't control? 119 00:06:27,760 --> 00:06:31,100 And it turned out to not be very difficult. 120 00:06:31,280 --> 00:06:33,400 I had one within a couple of hours. 121 00:06:34,600 --> 00:06:36,120 But moving forward from that, 122 00:06:36,160 --> 00:06:38,620 I started looking at SSL in general, SSL PKI, 123 00:06:39,080 --> 00:06:41,900 and you start to see that there's a really big attack surface 124 00:06:41,900 --> 00:06:43,180 involved in this technology. 125 00:06:43,320 --> 00:06:45,660 It's not just SSL clients and SSL servers, 126 00:06:45,740 --> 00:06:47,460 but it's the certificates, 127 00:06:47,480 --> 00:06:48,260 the certificate authorities themselves, 128 00:06:48,820 --> 00:06:53,320 it's the crypto APIs that we use to generate our key pairs, 129 00:06:54,180 --> 00:06:57,020 it's the browser, it's the SSL VPN client, 130 00:06:57,280 --> 00:06:59,220 and the indicators it shows to a user. 131 00:06:59,660 --> 00:07:02,800 All these things are subject to attack. 132 00:07:03,200 --> 00:07:05,940 And it actually branches out very quickly. 133 00:07:06,540 --> 00:07:08,360 You know, I haven't touched this one in a while, 134 00:07:08,500 --> 00:07:12,440 but already I know there's one certificate authority threat 135 00:07:12,440 --> 00:07:14,060 in the middle, it's kind of hard to see, 136 00:07:14,280 --> 00:07:17,400 but it's the weaponized CSR. 137 00:07:17,480 --> 00:07:18,820 Certificate Signing Request. 138 00:07:19,160 --> 00:07:21,760 Which if anyone sat through Moxie's talk this morning, 139 00:07:22,900 --> 00:07:24,300 that's essentially what he had. 140 00:07:24,440 --> 00:07:28,840 A crafted CSR that will end up causing a certificate authority 141 00:07:28,840 --> 00:07:32,500 to give him a cert that's pretty much valid for any domain name. 142 00:07:34,240 --> 00:07:37,480 So the SSL threat model I think is, I like it. 143 00:07:37,540 --> 00:07:39,900 I'm going to put this out on the internet, up on my blog. 144 00:07:40,140 --> 00:07:41,560 I think it's going to change over time. 145 00:07:41,860 --> 00:07:45,020 But I think it's pretty cool that you can pick any one of these nodes 146 00:07:45,020 --> 00:07:47,200 on this tree and say, all right, well, I'm going to go after that. 147 00:07:47,480 --> 00:07:52,080 And unfortunately for everyone, it seems like a lot of these attacks 148 00:07:52,080 --> 00:07:54,140 and threats can actually be realized. 149 00:07:55,880 --> 00:07:59,140 So a little bit more about the SSL track record. 150 00:07:59,380 --> 00:08:02,460 So I said before, one of the core goals of SSL 151 00:08:02,460 --> 00:08:05,180 is actually to protect data in transit. 152 00:08:05,560 --> 00:08:07,800 So we know when we put our bytes out on the wire 153 00:08:08,360 --> 00:08:11,060 and they're traversing untrusted networks over the internet, 154 00:08:11,260 --> 00:08:14,260 that random people can't just, well, sniff our packets 155 00:08:14,260 --> 00:08:15,320 and see what we're talking about. 156 00:08:15,320 --> 00:08:17,380 And that works pretty well. 157 00:08:18,160 --> 00:08:19,860 Implementation-specific bugs aside, 158 00:08:20,100 --> 00:08:23,780 like we had the Debian pseudo-random number generator bug 159 00:08:23,780 --> 00:08:26,540 where a large number of keys turned out to be very weak 160 00:08:26,540 --> 00:08:28,140 and we had some crypto attacks. 161 00:08:29,120 --> 00:08:32,420 But aside from that, for now, this is working well. 162 00:08:33,280 --> 00:08:35,680 One thing to note about this is encryption is free. 163 00:08:35,940 --> 00:08:38,680 Anyone with a crypto API can generate a key pair 164 00:08:38,680 --> 00:08:43,060 and start communicating using SSL. 165 00:08:43,740 --> 00:08:45,300 But then we also have site security. 166 00:08:45,320 --> 00:08:48,980 Site validation, which is another key component of SSL PKI. 167 00:08:49,200 --> 00:08:50,660 That's where we start talking about trust. 168 00:08:51,060 --> 00:08:54,660 And this is why when you go to a certificate authority, 169 00:08:56,200 --> 00:08:57,580 you have to pay them a little bit. 170 00:08:57,640 --> 00:08:58,340 This is their business. 171 00:08:59,020 --> 00:09:01,260 You give them a CSR, you pay them some money, 172 00:09:01,360 --> 00:09:04,860 they try to validate that you're authorized for the domain 173 00:09:04,860 --> 00:09:06,240 you're requesting a cert for, 174 00:09:06,420 --> 00:09:09,560 and then they give you the cert that's trusted by all the browsers. 175 00:09:10,860 --> 00:09:13,460 But when we talk about site validation, well, what does that mean? 176 00:09:13,520 --> 00:09:15,140 That means that when you're going to a website 177 00:09:15,320 --> 00:09:20,520 you have a good degree of assurance that you know who you're talking to. 178 00:09:20,580 --> 00:09:23,560 If you're trying to talk to bankofamerica.com, 179 00:09:24,240 --> 00:09:26,800 SSL is supposed to let you know that you're really talking 180 00:09:26,800 --> 00:09:28,960 to the real Bank of America web server, 181 00:09:29,140 --> 00:09:38,200 not bank-of-america.com or other sort of variations on the name. 182 00:09:39,200 --> 00:09:41,660 But what we see is that well over a decade, 183 00:09:41,940 --> 00:09:45,000 I think VeriSign actually came out with a press release 184 00:09:45,000 --> 00:09:50,980 last week saying in 14 years they've sold 4 million SSL certificates, 185 00:09:51,180 --> 00:09:52,360 and that's just VeriSign. 186 00:09:53,520 --> 00:09:59,460 But well over a decade of profits has not yielded adequate phishing prevention. 187 00:10:00,140 --> 00:10:03,060 I mean, we're still dealing with phishing attacks in spite of SSL. 188 00:10:03,900 --> 00:10:05,960 And as Moxie has shown us, 189 00:10:06,000 --> 00:10:09,000 now we have things like null-byte injection attacks 190 00:10:09,000 --> 00:10:10,660 in our certificate signing requests. 191 00:10:10,880 --> 00:10:13,220 It offers a whole new attack vector, 192 00:10:13,220 --> 00:10:16,500 allowing attackers to kind of exploit this trust. 193 00:10:20,460 --> 00:10:22,840 One of the things, though, to combat phishing 194 00:10:22,840 --> 00:10:28,280 that certificate authorities and web browser vendors have come up with 195 00:10:28,280 --> 00:10:31,820 is called EVSSL, or Extended Validation SSL. 196 00:10:33,580 --> 00:10:37,580 They kind of work together in an organization called the CAB Forum, 197 00:10:37,740 --> 00:10:40,300 which is a certificate authority slash browser forum. 198 00:10:40,520 --> 00:10:43,000 And it's like a non-profit industry group 199 00:10:43,220 --> 00:10:45,460 where the browser vendors and the CAs work together 200 00:10:45,460 --> 00:10:47,400 to try and make progress. 201 00:10:47,860 --> 00:10:49,240 What they came up with, 202 00:10:50,040 --> 00:10:51,540 and it's been out for a couple of years, 203 00:10:51,640 --> 00:10:52,540 it's not widely deployed, 204 00:10:52,680 --> 00:10:54,000 but there are sites out there using it. 205 00:10:54,100 --> 00:10:55,740 I use Bank of America, they use EV, 206 00:10:56,760 --> 00:10:58,500 are these EV certs. 207 00:10:58,500 --> 00:11:02,700 And essentially what EV is compared to regular SSL, 208 00:11:02,780 --> 00:11:05,160 which we've had for 14 years now at least, 209 00:11:06,240 --> 00:11:11,660 is that to get an EV cert requires rigorous offline validation process. 210 00:11:11,660 --> 00:11:14,640 This means you're showing your articles of incorporation, 211 00:11:15,760 --> 00:11:17,740 you're getting documents notarized. 212 00:11:19,280 --> 00:11:21,500 Essentially, it's not an automated process. 213 00:11:21,940 --> 00:11:24,580 It's not fill out a form on a web app, click a link, 214 00:11:24,720 --> 00:11:27,460 and get a trusted certificate, 215 00:11:28,540 --> 00:11:30,940 which is exactly what we have with DV, 216 00:11:31,160 --> 00:11:32,660 or Domain Validated SSL, 217 00:11:33,300 --> 00:11:35,820 which I'll just refer to as regular SSL from now on 218 00:11:35,820 --> 00:11:36,940 because it's easier to say. 219 00:11:37,380 --> 00:11:40,860 But essentially, so what's the difference between an EVSSL certificate 220 00:11:40,860 --> 00:11:43,440 and a regular SSL certificate? 221 00:11:43,900 --> 00:11:46,700 Well, in this screenshot, you see that we have this, 222 00:11:46,740 --> 00:11:48,780 we're connecting to paypal.com, 223 00:11:48,940 --> 00:11:51,860 and we have this green badge right next to the address bar. 224 00:11:52,080 --> 00:11:53,760 When we click on that green badge, 225 00:11:54,000 --> 00:11:56,720 we actually see identity information about the legal identity 226 00:11:56,720 --> 00:12:00,760 of the organization running www.paypal.com 227 00:12:01,840 --> 00:12:03,000 for that connection. 228 00:12:03,540 --> 00:12:06,420 And that's what we're going to talk about in another slide. 229 00:12:07,500 --> 00:12:09,860 But essentially, the idea behind EVSSL 230 00:12:09,860 --> 00:12:13,820 is to give your typical end user a very easy method 231 00:12:13,820 --> 00:12:17,200 of quickly recognizing what site they're connected to 232 00:12:17,200 --> 00:12:20,320 and then making a trust decision based on that identification. 233 00:12:21,240 --> 00:12:23,700 Now, what a lot of people are saying now, 234 00:12:24,480 --> 00:12:27,660 in light of some of the research that I did with Alex Soderov 235 00:12:27,660 --> 00:12:29,220 and that people have done before us, 236 00:12:29,280 --> 00:12:31,860 like Colin Jackson and Adam Barth, 237 00:12:31,940 --> 00:12:36,360 is that EV is only supposed to prevent phishing attacks. 238 00:12:36,980 --> 00:12:39,660 It's not supposed to prevent man-in-the-middle attacks. 239 00:12:40,440 --> 00:12:42,740 But like I said in the previous slide, 240 00:12:42,940 --> 00:12:45,800 there are two things that SSL in general is supposed to do. 241 00:12:45,920 --> 00:12:47,640 Number one, protect our bytes on the wire, 242 00:12:47,800 --> 00:12:48,560 make sure it's encrypted. 243 00:12:48,900 --> 00:12:51,120 And number two, site validation. 244 00:12:51,520 --> 00:12:54,700 Give us some idea of who we're actually talking to 245 00:12:54,700 --> 00:12:56,440 so that we can trust them. 246 00:12:56,960 --> 00:13:02,020 And I think the idea that EVSSL 247 00:13:02,020 --> 00:13:03,680 is only supposed to now all of a sudden 248 00:13:03,680 --> 00:13:05,920 fix one of those problems, the site validation, 249 00:13:06,160 --> 00:13:09,360 and not protect against man-in-the-middle attacks is flawed, 250 00:13:09,360 --> 00:13:11,780 and a number of steps backwards. 251 00:13:14,160 --> 00:13:16,580 Just another couple of technical notes 252 00:13:16,580 --> 00:13:19,060 about EV versus regular SSL 253 00:13:19,060 --> 00:13:23,240 is that you could install your own certificate authority cert 254 00:13:23,240 --> 00:13:26,200 inside a browser, inside a certificate trust store, 255 00:13:26,340 --> 00:13:30,320 and all of a sudden any regular SSL certs 256 00:13:30,320 --> 00:13:33,960 that you create and sign will be trusted by the browser, 257 00:13:34,060 --> 00:13:36,880 meaning you're not going to get warnings and pop-ups all over the place. 258 00:13:37,840 --> 00:13:39,340 With EV, that's a lot different. 259 00:13:39,360 --> 00:13:42,240 The EV root certificate authorities 260 00:13:42,240 --> 00:13:45,820 are actually hard-coded in the web browser. 261 00:13:46,140 --> 00:13:49,580 So you're not going to be able to get your own EV root into IE. 262 00:13:49,880 --> 00:13:52,940 You will be able to get your own EV root into Firefox 263 00:13:52,940 --> 00:13:56,520 if you jump through a lot of hoops and write a lot of code 264 00:13:56,520 --> 00:13:58,120 and compile your own version. 265 00:14:01,040 --> 00:14:04,380 So EV is kind of the next generation of SSL, 266 00:14:04,460 --> 00:14:07,420 but we still have DV, or regular SSL, 267 00:14:07,460 --> 00:14:08,720 and we still trust both of them. 268 00:14:09,360 --> 00:14:11,580 So what I'm kind of focusing on right now, 269 00:14:11,680 --> 00:14:14,340 because the EV certs, you have to, like I said, 270 00:14:14,360 --> 00:14:15,940 jump through all these offline hoops. 271 00:14:16,020 --> 00:14:17,460 You have to talk to people on the phone 272 00:14:17,460 --> 00:14:20,060 and fill out paperwork, talk to lawyers, 273 00:14:20,240 --> 00:14:22,420 all this nonsense from my perspective. 274 00:14:22,680 --> 00:14:25,520 But getting a DV certificate is still rather easy. 275 00:14:25,680 --> 00:14:28,060 It's still, for a lot of certificate authorities, 276 00:14:28,260 --> 00:14:29,180 an automated process. 277 00:14:29,980 --> 00:14:31,460 So just to kind of step through that, 278 00:14:31,540 --> 00:14:33,340 I don't know, maybe a show of hands, 279 00:14:33,460 --> 00:14:36,320 who here has ever purchased an SSL certificate from a... 280 00:14:36,800 --> 00:14:37,200 Okay. 281 00:14:37,200 --> 00:14:39,280 Maybe about less than half. 282 00:14:41,660 --> 00:14:43,180 A more detailed question. 283 00:14:43,380 --> 00:14:45,020 How many times have you done that in a year? 284 00:14:45,080 --> 00:14:45,780 More than once? 285 00:14:47,400 --> 00:14:48,060 All right. 286 00:14:48,120 --> 00:14:48,980 The numbers go down. 287 00:14:49,400 --> 00:14:51,380 So it's not a process that we do regularly. 288 00:14:51,840 --> 00:14:54,460 So that's why I think it's good to kind of step through 289 00:14:55,100 --> 00:14:57,040 the process of getting a DV cert. 290 00:14:57,520 --> 00:15:00,100 So the first thing you're going to do is use your crypto API. 291 00:15:00,500 --> 00:15:01,820 I use OpenSSL. 292 00:15:02,860 --> 00:15:04,260 You generate a private key, 293 00:15:04,400 --> 00:15:06,980 and then you generate a certificate 294 00:15:07,200 --> 00:15:08,940 signing request or a CSR. 295 00:15:10,260 --> 00:15:12,440 The CSR contains the public key, 296 00:15:12,540 --> 00:15:14,860 the other half of the key pair. 297 00:15:15,280 --> 00:15:16,740 You then go to a certificate authority. 298 00:15:17,080 --> 00:15:18,080 One other thing. 299 00:15:18,120 --> 00:15:19,360 When you're creating that CSR, 300 00:15:19,400 --> 00:15:21,660 that's when you tell it what the CN common name 301 00:15:21,660 --> 00:15:24,380 or the domain name that you're looking to secure is. 302 00:15:24,780 --> 00:15:28,740 So if your website is www.bank.com, 303 00:15:28,860 --> 00:15:34,040 you create the CSR with the CN of www.bank.com. 304 00:15:34,960 --> 00:15:37,040 Then you go fill out the CA order form, 305 00:15:37,200 --> 00:15:38,300 with your billing information, 306 00:15:38,540 --> 00:15:39,420 enter your credit card, 307 00:15:39,640 --> 00:15:41,000 paste the CSR in, 308 00:15:41,180 --> 00:15:42,440 hit submit. 309 00:15:42,600 --> 00:15:44,000 They start processing your order. 310 00:15:44,240 --> 00:15:48,020 With domain validated SSL or regular SSL, 311 00:15:48,120 --> 00:15:50,700 the way they determine that you're really authorized 312 00:15:51,380 --> 00:15:52,580 for that domain, 313 00:15:52,780 --> 00:15:54,440 www.bank.com, 314 00:15:54,600 --> 00:15:57,360 is they'll send an email containing a secret, 315 00:15:57,540 --> 00:15:58,920 a password of sorts, 316 00:15:59,100 --> 00:16:05,500 to a specific email alias at bank.com. 317 00:16:05,500 --> 00:16:08,760 Now you as a person who's actually placing the order, 318 00:16:08,940 --> 00:16:10,560 typically you have a choice. 319 00:16:10,740 --> 00:16:14,240 You can say which alias you want that email sent to. 320 00:16:14,380 --> 00:16:16,100 And obviously if it's legitimate, 321 00:16:16,340 --> 00:16:18,700 it would be an alias that you have control over. 322 00:16:18,800 --> 00:16:19,760 You can go check that mailbox, 323 00:16:20,140 --> 00:16:21,160 get that secret, 324 00:16:21,420 --> 00:16:22,520 click on a link, 325 00:16:22,660 --> 00:16:23,600 return the secret, 326 00:16:23,720 --> 00:16:26,540 and thereby you show the CA that you really are authorized 327 00:16:26,540 --> 00:16:28,000 for that domain, 328 00:16:28,200 --> 00:16:31,420 because you have control over this particular email alias. 329 00:16:32,040 --> 00:16:34,780 At that point once you confirm to the CA 330 00:16:34,780 --> 00:16:35,940 that you have the secret, 331 00:16:36,120 --> 00:16:37,260 you are who you say you are, 332 00:16:37,300 --> 00:16:40,480 they issue the certificate. 333 00:16:41,060 --> 00:16:42,960 Now I don't know about you, 334 00:16:43,080 --> 00:16:45,780 but email isn't really all that secure. 335 00:16:46,080 --> 00:16:50,620 So there are a number of methods of intercepting email, 336 00:16:50,780 --> 00:16:51,840 sniffing bites on the wire. 337 00:16:52,000 --> 00:16:54,020 Obviously this stuff is going out plain text. 338 00:16:54,180 --> 00:16:55,260 There's no encryption involved. 339 00:16:55,580 --> 00:16:58,020 So really anyone kind of downstream 340 00:16:58,020 --> 00:17:00,540 of the certificate authority's SMTP server 341 00:17:00,540 --> 00:17:02,100 could possibly get that secret. 342 00:17:02,320 --> 00:17:03,380 And theoretically, 343 00:17:04,800 --> 00:17:08,500 get an SSL certificate for a domain 344 00:17:08,500 --> 00:17:10,100 which they're not authorized for. 345 00:17:12,980 --> 00:17:14,520 Another important thing to note 346 00:17:15,220 --> 00:17:18,220 is that it's pretty easy to game these certificate authorities. 347 00:17:18,740 --> 00:17:20,920 They're not really going to be able to tell, 348 00:17:20,940 --> 00:17:21,820 in fact, 349 00:17:21,820 --> 00:17:23,000 who you actually are. 350 00:17:23,560 --> 00:17:27,460 So I'm going to talk about how I got some certificates for domains 351 00:17:27,460 --> 00:17:29,200 I don't control at the end of this presentation. 352 00:17:29,500 --> 00:17:32,200 But I did that using a completely fake alias 353 00:17:32,200 --> 00:17:33,660 and a cash credit card here. 354 00:17:34,080 --> 00:17:36,500 A Visa gift card that I bought at CVS. 355 00:17:37,080 --> 00:17:39,340 Now this was the first time I actually ever kind of 356 00:17:39,340 --> 00:17:40,660 went down that route of, you know, 357 00:17:40,680 --> 00:17:42,000 coming up with my own alias 358 00:17:42,000 --> 00:17:45,120 and really trying to do, you know, 359 00:17:46,340 --> 00:17:47,940 not reveal my own identity. 360 00:17:48,180 --> 00:17:50,360 And the one fatal flaw in my plan 361 00:17:50,360 --> 00:17:52,540 is that when I picked up the cash credit card, 362 00:17:52,640 --> 00:17:54,660 I didn't check the expiration date on it. 363 00:17:54,680 --> 00:17:56,420 And I actually bought one that was expired. 364 00:17:57,500 --> 00:18:00,520 So the right side screenshot is when I went back, 365 00:18:00,620 --> 00:18:02,060 because I paid a hundred bucks for this, 366 00:18:02,200 --> 00:18:03,340 and now I can't use it for anything. 367 00:18:04,820 --> 00:18:07,340 And apparently nobody ever does that. 368 00:18:07,460 --> 00:18:10,120 So nobody knew how to actually exchange this credit card. 369 00:18:10,340 --> 00:18:11,500 And in the end, 370 00:18:11,520 --> 00:18:13,220 they wanted my real driver's license too, 371 00:18:13,260 --> 00:18:15,340 which you see blurred out there on the CVS counter. 372 00:18:15,700 --> 00:18:18,420 So that was epic fail number one 373 00:18:18,420 --> 00:18:19,540 for the month of July for me. 374 00:18:19,720 --> 00:18:21,200 But just remember, 375 00:18:21,940 --> 00:18:23,140 check the expiration date. 376 00:18:23,460 --> 00:18:25,200 And once you get your cash credit card 377 00:18:25,200 --> 00:18:26,180 with your assumed identity, 378 00:18:26,500 --> 00:18:27,880 you can pretty much go to a CA 379 00:18:27,880 --> 00:18:30,360 and get a non-attributable SSL certificate. 380 00:18:30,740 --> 00:18:32,180 Where's the expiration date on this? 381 00:18:33,360 --> 00:18:34,500 On the back, 382 00:18:34,640 --> 00:18:35,420 the question was, 383 00:18:35,440 --> 00:18:37,520 where is the expiration date on the cash card? 384 00:18:37,900 --> 00:18:39,180 You can actually view it. 385 00:18:39,220 --> 00:18:41,600 It's in small print near the barcode. 386 00:18:42,740 --> 00:18:43,360 It's there. 387 00:18:43,520 --> 00:18:44,840 You just got to know to look for it. 388 00:18:44,960 --> 00:18:45,960 Some of them are stamped. 389 00:18:46,000 --> 00:18:47,080 Some of them are stamped. 390 00:18:47,340 --> 00:18:47,640 Okay. 391 00:18:48,980 --> 00:18:49,640 All right. 392 00:18:49,740 --> 00:18:50,540 So with that, 393 00:18:50,600 --> 00:18:53,240 we're going to go into a demonstration, 394 00:18:53,660 --> 00:18:56,940 a live internet demo that failed horribly at Black Hat, 395 00:18:57,060 --> 00:18:57,980 but will not fail now, 396 00:18:59,340 --> 00:19:00,700 of SSL rebinding. 397 00:19:00,780 --> 00:19:01,860 And what this attack shows, 398 00:19:01,860 --> 00:19:05,320 is that if you get a DV SSL certificate 399 00:19:05,320 --> 00:19:06,900 or a regular SSL certificate, 400 00:19:07,220 --> 00:19:09,460 which is subject to all sorts of technical attacks 401 00:19:09,460 --> 00:19:11,340 on certificate authority websites, 402 00:19:11,720 --> 00:19:15,660 you can reach equality with an EV cert, 403 00:19:15,780 --> 00:19:17,720 one of these certs that's really hard to get, 404 00:19:17,800 --> 00:19:19,120 and get that green badge 405 00:19:19,120 --> 00:19:20,740 or that green glow in the address bar 406 00:19:20,740 --> 00:19:25,200 that users love and trust so much. 407 00:19:26,240 --> 00:19:27,740 So with that, 408 00:19:30,160 --> 00:19:31,020 all right, 409 00:19:31,020 --> 00:19:32,680 my resolution got a little out of whack. 410 00:19:39,960 --> 00:19:42,820 So here in my XP workstation, 411 00:19:43,020 --> 00:19:43,920 this is our victim. 412 00:19:44,860 --> 00:19:46,800 And right here in this shell, 413 00:19:46,940 --> 00:19:47,740 this symbolizes, 414 00:19:47,900 --> 00:19:50,000 or this is actually the man in the middle. 415 00:19:50,200 --> 00:19:53,360 So the VM is connecting through my host OS. 416 00:19:53,800 --> 00:19:58,300 And I'm using IP firewall rules on OSX 417 00:19:58,300 --> 00:19:59,220 to reroute traffic. 418 00:19:59,920 --> 00:20:01,820 So we'll start our proxy here. 419 00:20:12,980 --> 00:20:13,720 All right, 420 00:20:13,780 --> 00:20:14,600 the proxy is running, 421 00:20:14,720 --> 00:20:16,600 starting evil PayPal SSL proxy. 422 00:20:18,180 --> 00:20:20,460 And I'll type in HTTPS. 423 00:20:25,980 --> 00:20:26,540 Okay, 424 00:20:26,540 --> 00:20:29,500 we see SSL rebinding a new connection. 425 00:20:29,880 --> 00:20:31,480 And now we see in the main window here 426 00:20:31,480 --> 00:20:32,520 that we see PayPal, 427 00:20:32,720 --> 00:20:33,680 we see this green glow. 428 00:20:34,100 --> 00:20:35,200 If I click on it, 429 00:20:35,260 --> 00:20:37,040 it says it's run by PayPal Inc. 430 00:20:43,040 --> 00:20:43,720 All right. 431 00:20:44,360 --> 00:20:45,740 So now we'll actually log in. 432 00:20:48,120 --> 00:20:50,020 And two things you need to look at here. 433 00:20:50,200 --> 00:20:50,700 Number one, 434 00:20:50,760 --> 00:20:52,260 I want you to look at the green bar. 435 00:20:52,520 --> 00:20:54,120 It's kind of hard to follow both things. 436 00:20:54,540 --> 00:20:55,660 But then we'll also see 437 00:20:55,660 --> 00:20:57,760 some really interesting information show up 438 00:20:57,760 --> 00:20:59,280 in the shell coming through the proxy. 439 00:20:59,560 --> 00:20:59,880 Now remember, 440 00:21:00,000 --> 00:21:03,340 the green glow means that you're connected to PayPal. 441 00:21:03,680 --> 00:21:05,220 That's what it's supposed to mean. 442 00:21:05,380 --> 00:21:06,820 This is an SSL connection 443 00:21:07,780 --> 00:21:11,000 that no one in the middle of the web browser, 444 00:21:11,060 --> 00:21:12,520 in between the web browser and the web server 445 00:21:12,520 --> 00:21:13,760 should be able to look at your data. 446 00:21:14,460 --> 00:21:15,500 We'll click log in. 447 00:21:18,180 --> 00:21:20,680 And we see my username and my mass password 448 00:21:20,680 --> 00:21:22,240 show up in the shell. 449 00:21:22,780 --> 00:21:23,580 Now right now, 450 00:21:23,600 --> 00:21:24,320 if you look at it, 451 00:21:24,920 --> 00:21:27,240 the green glow went away and then it came back. 452 00:21:27,940 --> 00:21:29,620 So now we're still logging in. 453 00:21:29,720 --> 00:21:32,120 We see some more information over in the shell now. 454 00:21:32,220 --> 00:21:34,420 We see how much money is in my PayPal account, 455 00:21:34,940 --> 00:21:36,340 even though we have the green glow. 456 00:21:36,840 --> 00:21:37,780 So what we've done, 457 00:21:37,940 --> 00:21:39,880 what SSL rebinding actually is, 458 00:21:41,140 --> 00:21:43,900 is it's an active man in the middle proxy 459 00:21:44,400 --> 00:21:44,980 that's saying, 460 00:21:45,060 --> 00:21:46,540 okay, for this TCP connection 461 00:21:46,540 --> 00:21:48,340 where you're requesting the login page, 462 00:21:48,620 --> 00:21:50,280 I'm going to let you terminate SSL 463 00:21:50,280 --> 00:21:51,340 with the real web server 464 00:21:51,340 --> 00:21:53,080 and the EVSSL certificate. 465 00:21:53,080 --> 00:21:56,940 And thereby showing the green glow in the web browser. 466 00:21:57,420 --> 00:21:59,060 User thinks everything is fine. 467 00:21:59,200 --> 00:21:59,960 They see the green glow. 468 00:22:00,160 --> 00:22:01,800 This is new super-duper SSL. 469 00:22:02,060 --> 00:22:04,020 There's no way I'm going to get it hacked. 470 00:22:05,160 --> 00:22:06,620 But then on the next connection, 471 00:22:06,860 --> 00:22:07,680 which actually happens 472 00:22:07,680 --> 00:22:09,560 when I enter my username and password 473 00:22:09,560 --> 00:22:10,640 and press log in, 474 00:22:10,760 --> 00:22:12,900 that causes the browser to send a post request. 475 00:22:13,260 --> 00:22:14,880 We create a new TCP connection 476 00:22:14,880 --> 00:22:16,840 that goes through the man in the middle again. 477 00:22:17,320 --> 00:22:18,780 This time the man in the middle says, 478 00:22:18,920 --> 00:22:20,820 okay, don't terminate SSL with them. 479 00:22:20,860 --> 00:22:21,920 Terminate SSL with me. 480 00:22:21,920 --> 00:22:23,140 Here's my DV, 481 00:22:23,400 --> 00:22:24,960 or my regular SSL certificate 482 00:22:24,960 --> 00:22:26,860 that's trusted by your web browser, 483 00:22:27,020 --> 00:22:28,560 which was very easy for me to get 484 00:22:28,560 --> 00:22:30,020 by hacking a CA website. 485 00:22:31,260 --> 00:22:32,180 The browser says, 486 00:22:32,340 --> 00:22:33,360 okay, that's fine with me. 487 00:22:33,900 --> 00:22:34,780 Terminates SSL. 488 00:22:34,840 --> 00:22:36,100 Sends the bytes over the wire 489 00:22:36,560 --> 00:22:37,820 right through the man in the middle 490 00:22:37,820 --> 00:22:39,700 who captures all your data in plain text. 491 00:22:41,620 --> 00:22:43,280 That goes through to the, 492 00:22:43,400 --> 00:22:45,800 or the man in the middle actually captures that data 493 00:22:45,800 --> 00:22:46,500 at this point. 494 00:22:47,020 --> 00:22:49,060 And instead of actually proxying it 495 00:22:49,060 --> 00:22:50,700 to the real web server, 496 00:22:50,880 --> 00:22:51,900 he keeps it 497 00:22:51,920 --> 00:22:53,460 and sends a redirect request 498 00:22:54,160 --> 00:22:55,180 down to the client, 499 00:22:55,300 --> 00:22:57,620 causing the client to send that request again. 500 00:22:58,160 --> 00:23:00,120 And this time when the client sends a request, 501 00:23:00,440 --> 00:23:01,360 the man in the middle says, 502 00:23:01,520 --> 00:23:04,240 okay, terminate with the real SSL server. 503 00:23:04,380 --> 00:23:05,360 With the real web server, 504 00:23:06,080 --> 00:23:06,480 EVSSL, 505 00:23:06,480 --> 00:23:07,120 and bang, 506 00:23:07,240 --> 00:23:08,780 the green glow comes right back 507 00:23:08,780 --> 00:23:10,420 with no prompt to the user. 508 00:23:10,640 --> 00:23:12,020 The only way a user would know 509 00:23:12,020 --> 00:23:13,140 that anything is going on 510 00:23:13,140 --> 00:23:14,880 is if they see that the green bar, 511 00:23:15,000 --> 00:23:16,180 the green glow goes away. 512 00:23:16,400 --> 00:23:18,760 But that could just be normal behavior to begin with. 513 00:23:20,320 --> 00:23:21,860 So that's an SSL reboot. 514 00:23:21,860 --> 00:23:22,340 SSL rebinding attack. 515 00:23:30,100 --> 00:23:31,880 And that was the SSL rebinding attack 516 00:23:31,880 --> 00:23:33,760 that failed horribly at Black Hat. 517 00:23:34,020 --> 00:23:35,540 So glad it worked out this time. 518 00:23:36,300 --> 00:23:36,960 All right. 519 00:23:39,040 --> 00:23:40,220 So move along. 520 00:23:40,360 --> 00:23:42,220 Got 25 minutes left it looks like. 521 00:23:42,560 --> 00:23:44,960 So one thing we need to know about SSL rebinding 522 00:23:44,960 --> 00:23:46,480 is that we need to man in the middle 523 00:23:46,480 --> 00:23:47,480 every other connection. 524 00:23:47,740 --> 00:23:49,820 Typically when you're man in the middling anything, 525 00:23:50,040 --> 00:23:50,480 you think, 526 00:23:50,480 --> 00:23:51,660 I want to get everything. 527 00:23:52,200 --> 00:23:55,060 But really in a web browser session 528 00:23:55,060 --> 00:23:56,240 or web application session, 529 00:23:56,780 --> 00:23:57,840 you're only going to need 530 00:23:57,840 --> 00:23:59,100 either the username or password 531 00:23:59,100 --> 00:24:00,440 or maybe post authentication 532 00:24:00,440 --> 00:24:02,300 to actually capture the user's session cookie. 533 00:24:03,540 --> 00:24:06,040 So what would happen if we tried to man in the middle 534 00:24:06,040 --> 00:24:08,940 every TCP connection and terminate with SSL 535 00:24:08,940 --> 00:24:10,320 and then redirect the browser 536 00:24:10,320 --> 00:24:11,620 is we'd get stuck in a loop. 537 00:24:11,900 --> 00:24:14,080 And the user would never see the green glow. 538 00:24:15,220 --> 00:24:17,940 So we came up with a very simple solution for this 539 00:24:17,940 --> 00:24:19,500 and that's simply to count each connection 540 00:24:19,500 --> 00:24:21,580 coming out of the client and alternate. 541 00:24:22,120 --> 00:24:24,940 You're not guaranteed to get every request. 542 00:24:25,380 --> 00:24:27,420 But if you miss the username and password, 543 00:24:27,620 --> 00:24:28,300 well, then you're going to get 544 00:24:28,300 --> 00:24:30,220 the authenticated session cookie later on. 545 00:24:30,520 --> 00:24:32,160 So it works very well. 546 00:24:32,580 --> 00:24:34,060 You know, in reality, 547 00:24:34,280 --> 00:24:37,400 you only need to capture one HTTP connection. 548 00:24:38,220 --> 00:24:40,280 The other interesting thing 549 00:24:40,280 --> 00:24:43,440 that I think was kind of novel about this attack 550 00:24:43,440 --> 00:24:46,860 is that you don't need to use 302s all the time 551 00:24:46,860 --> 00:24:49,000 because sometimes you need to intercept a post request 552 00:24:49,000 --> 00:24:51,760 and you need to get the browser to resend the post data. 553 00:24:52,560 --> 00:24:53,980 So you can do that two ways. 554 00:24:54,120 --> 00:24:55,760 You can use a 200 response, 555 00:24:56,020 --> 00:24:58,080 send down an HTML page with some JavaScript 556 00:24:58,080 --> 00:24:59,500 that redirects the browser 557 00:25:00,280 --> 00:25:02,060 with a fabricated form 558 00:25:02,060 --> 00:25:04,360 using all the data that was captured by the man in the middle. 559 00:25:04,680 --> 00:25:06,600 Or you can send down a 307, 560 00:25:06,860 --> 00:25:08,740 which is a variation of a 302, 561 00:25:08,840 --> 00:25:11,800 which tells the browser to replay the post 562 00:25:11,800 --> 00:25:13,400 and send the post data. 563 00:25:13,860 --> 00:25:15,540 There were some interesting things there. 564 00:25:16,720 --> 00:25:18,700 Firefox would obey the request, 565 00:25:18,700 --> 00:25:20,480 but it would prompt the user and say, 566 00:25:20,620 --> 00:25:22,520 hey, this website wants us to replay. 567 00:25:22,720 --> 00:25:24,540 Should we? You know, press OK or press No. 568 00:25:25,300 --> 00:25:26,820 IE would do the same thing, 569 00:25:26,880 --> 00:25:27,800 but without the prompt. 570 00:25:27,980 --> 00:25:29,300 IE would replay the request. 571 00:25:30,400 --> 00:25:32,340 This is IE 7 I'm talking about. 572 00:25:32,880 --> 00:25:34,180 The interesting thing, though, 573 00:25:34,220 --> 00:25:36,260 is if the URL, the original URL 574 00:25:36,260 --> 00:25:37,680 that the browser posts to 575 00:25:37,680 --> 00:25:41,060 and the redirect URL are the same, 576 00:25:41,300 --> 00:25:42,500 there's a bug in IE 577 00:25:42,500 --> 00:25:44,320 that wouldn't send the post request data. 578 00:25:44,620 --> 00:25:47,140 So you need to kind of fudge the URL on the request, 579 00:25:47,220 --> 00:25:48,680 make it look different to the browser. 580 00:25:48,700 --> 00:25:50,320 And you can do that very easily 581 00:25:50,320 --> 00:25:51,980 by just putting a hashtag on the end. 582 00:25:52,260 --> 00:25:53,040 And it worked. 583 00:25:53,200 --> 00:25:54,960 And with that, there's no JavaScript required. 584 00:25:55,540 --> 00:25:57,160 So that was kind of one of the things 585 00:25:57,160 --> 00:25:58,060 we wanted to accomplish. 586 00:26:00,300 --> 00:26:01,600 So that's SSL rebinding. 587 00:26:01,700 --> 00:26:04,080 That's what you do or one of the things you can do 588 00:26:04,080 --> 00:26:08,620 when you get a regular SSL cert illegitimately 589 00:26:08,620 --> 00:26:09,740 or however you get it. 590 00:26:09,780 --> 00:26:13,000 You can use it to spoof an EV SSL session. 591 00:26:13,860 --> 00:26:17,300 So now, OK, how do we get these regular SSL certs? 592 00:26:17,300 --> 00:26:20,600 Well, CAs use web applications. 593 00:26:21,120 --> 00:26:23,120 Has anybody here heard of OASP? 594 00:26:23,220 --> 00:26:25,240 The Open Web Application Security Project? 595 00:26:25,520 --> 00:26:26,760 Well, there's a whole big industry 596 00:26:26,760 --> 00:26:28,780 and a lot of money going into web application security. 597 00:26:29,300 --> 00:26:31,240 And unfortunately, it doesn't look like 598 00:26:31,240 --> 00:26:33,680 certificate authorities spend a lot of their money 599 00:26:33,680 --> 00:26:35,300 on web application security. 600 00:26:35,600 --> 00:26:37,580 Which is kind of funny when you think that 601 00:26:37,580 --> 00:26:40,820 maybe everybody here who's purchasing SSL certificates 602 00:26:40,820 --> 00:26:43,580 for their websites that they're trying to secure 603 00:26:43,580 --> 00:26:47,220 is relying on a company that might or might not 604 00:26:47,300 --> 00:26:48,880 actually care about the same thing. 605 00:26:50,080 --> 00:26:53,120 So here on this screen, we see a screenshot 606 00:26:53,120 --> 00:26:56,400 of obviously an EV SSL protected session 607 00:26:56,400 --> 00:26:59,780 with Komodo CA with cross-site scripting on it. 608 00:26:59,940 --> 00:27:03,740 I call that EV XSS, Extended Validation XSS. 609 00:27:04,240 --> 00:27:07,740 This way, you know exactly which site is getting XSSed. 610 00:27:09,140 --> 00:27:12,480 This is another screenshot from some other kind of random, 611 00:27:12,540 --> 00:27:15,780 small mom-and-pop CA, trustlogo.com, 612 00:27:15,780 --> 00:27:19,300 where you can validate other people's SSL certificates, 613 00:27:19,620 --> 00:27:22,720 and they themselves have a security pop-up 614 00:27:22,720 --> 00:27:24,740 because they're using SSL improperly. 615 00:27:27,620 --> 00:27:28,860 Trustlogo.com. 616 00:27:32,040 --> 00:27:33,420 Let's see, here's another one. 617 00:27:33,460 --> 00:27:38,120 Same site, some kind of verbose Oracle SQL error message. 618 00:27:38,300 --> 00:27:42,200 Possibly some SQL injection going on there in a post request. 619 00:27:43,760 --> 00:27:45,760 Some more EV SSL protected sessions. 620 00:27:45,780 --> 00:27:47,780 Some protected CA shenanigans. 621 00:27:47,980 --> 00:27:50,600 Here we have a default service exposed. 622 00:27:51,060 --> 00:27:54,100 It's the Axis Web Service something or other. 623 00:27:54,220 --> 00:27:54,760 I think it's from Apache. 624 00:27:56,360 --> 00:27:59,660 Same website. Here's their WSDL. 625 00:28:01,320 --> 00:28:02,580 XSS.com. 626 00:28:03,400 --> 00:28:06,740 Here's about, I don't know, six different VeriSign URLs 627 00:28:07,680 --> 00:28:10,840 reported to XSS with XSS in them. 628 00:28:10,940 --> 00:28:14,780 Most likely also protected via EV SSL, latest and greatest. 629 00:28:16,140 --> 00:28:19,800 Here's a small CA that nobody's probably ever heard of. 630 00:28:19,920 --> 00:28:21,740 They're actually based out of Spain somewhere, 631 00:28:22,020 --> 00:28:25,920 and they have a whole bunch of input validation flaws going on 632 00:28:25,920 --> 00:28:26,820 in their web application. 633 00:28:27,240 --> 00:28:31,480 And again, this is a web application where you request certificates 634 00:28:31,480 --> 00:28:34,460 and are supposed to go through their rigorous domain validation process. 635 00:28:35,980 --> 00:28:39,740 A little more EV XSS, this time on Thought. 636 00:28:39,920 --> 00:28:41,000 They're a pretty big name. 637 00:28:41,320 --> 00:28:45,220 Are these trusted virtual CA's? 638 00:28:46,960 --> 00:28:49,980 So the question was, are these trusted root certificate authorities? 639 00:28:50,220 --> 00:28:52,020 Are they trusted by all the major web browsers? 640 00:28:52,200 --> 00:28:52,960 And the answer is yes. 641 00:28:55,360 --> 00:28:56,820 This is an interesting one. 642 00:28:57,020 --> 00:29:00,140 It doesn't look like much, but last summer when I was poking around 643 00:29:00,140 --> 00:29:03,040 trying to get my very first illegitimate SSL certificate, 644 00:29:03,700 --> 00:29:06,540 basically the website I was looking at failed open. 645 00:29:07,880 --> 00:29:12,120 I guess to put it simply, the web application said, 646 00:29:12,220 --> 00:29:14,300 well, I don't really know who you are, so I'm going to show you 647 00:29:14,300 --> 00:29:16,860 everybody else's data, and you pick the data that you want. 648 00:29:18,920 --> 00:29:23,560 So I've done my best to mask somebody's tax ID number there. 649 00:29:23,800 --> 00:29:26,220 But that was a major certificate authority as well, 650 00:29:26,380 --> 00:29:27,560 somebody who should know better. 651 00:29:29,600 --> 00:29:32,580 Now, last summer, the certificate that I did end up getting 652 00:29:32,580 --> 00:29:35,980 was a certificate for login.live.com, 653 00:29:36,160 --> 00:29:39,400 which if anybody knows about Microsoft service offerings, 654 00:29:40,240 --> 00:29:44,040 Hotmail, Passport, the login.live.com is the main authentication 655 00:29:44,300 --> 00:29:44,480 portal. 656 00:29:44,780 --> 00:29:46,240 That's where you post your credentials to. 657 00:29:46,720 --> 00:29:50,040 What I didn't know at the time, though, I got this regular SSL cert. 658 00:29:50,120 --> 00:29:52,620 They actually used an EVSSL cert. 659 00:29:53,260 --> 00:29:58,140 So last summer I could have been doing this talk, but, well, who knew? 660 00:30:00,940 --> 00:30:03,700 So, you know, we see now that certificate authorities, 661 00:30:04,040 --> 00:30:06,120 they're not doing everything they need to be doing. 662 00:30:06,300 --> 00:30:09,540 But then still, why would somebody want to hack a certificate authority? 663 00:30:09,940 --> 00:30:13,040 Well, number one, they're just like any other e-commerce website. 664 00:30:13,520 --> 00:30:15,740 They're storing personal and business information. 665 00:30:16,240 --> 00:30:17,580 They've got credit card numbers. 666 00:30:18,100 --> 00:30:22,080 But personally for me, you know, I'm not out to do this for any, you know, 667 00:30:22,100 --> 00:30:26,400 malicious purposes, but it's kind of funny that they have one purpose, 668 00:30:26,480 --> 00:30:29,000 and that's to make sure that they give certificates out to the people 669 00:30:29,000 --> 00:30:32,960 who are authorized to have them, and they just seem to be failing at that. 670 00:30:33,260 --> 00:30:36,820 So I say for the lulz, too, because it's pretty funny when you get one. 671 00:30:39,140 --> 00:30:41,920 But to come at it from a more technical point of view, 672 00:30:41,920 --> 00:30:44,780 we want to take advantage of the trusted private keys. 673 00:30:45,080 --> 00:30:48,840 The trusted private keys that the CAs hold are what can sign a certificate 674 00:30:48,840 --> 00:30:53,320 to make it trusted by all these common web browsers, be it IE or Firefox, 675 00:30:53,720 --> 00:30:58,080 as well as other things like code signing certificates or personal e-mail certificates. 676 00:31:00,040 --> 00:31:03,340 A little bit about the certificate authority security measures 677 00:31:03,340 --> 00:31:05,680 in the domain validation process. 678 00:31:06,680 --> 00:31:10,560 Some of the things they look at are domain registration records. 679 00:31:10,560 --> 00:31:15,040 Some of them actually have phone authentication validation processes, 680 00:31:15,200 --> 00:31:16,360 which I haven't really explored. 681 00:31:16,680 --> 00:31:21,780 But mostly they focus on this e-mail to this predefined list of authorized e-mail addresses 682 00:31:21,780 --> 00:31:23,720 and the use of secret tokens. 683 00:31:24,300 --> 00:31:28,740 So they send an e-mail to the e-mail address specified, and they send the secret. 684 00:31:30,200 --> 00:31:33,660 Now what these tokens look like actually varies from CA to CA. 685 00:31:33,980 --> 00:31:37,440 So the first one we see from Thought looks a lot like an MD5 hash. 686 00:31:38,280 --> 00:31:39,860 I've tried to guess what's in it. 687 00:31:39,860 --> 00:31:40,920 I haven't been able to. 688 00:31:41,320 --> 00:31:43,420 The second one is from GeoTrust. 689 00:31:43,500 --> 00:31:44,680 They're owned by VeriSign. 690 00:31:45,240 --> 00:31:48,440 Below that is the Komodo authentication token. 691 00:31:48,780 --> 00:31:54,700 And then each CA has their own URL where this token or secret needs to be passed into, 692 00:31:54,900 --> 00:31:57,680 and that's where they say, well, we don't know what this token is. 693 00:31:57,760 --> 00:31:58,480 You can't do anything. 694 00:31:58,620 --> 00:32:00,320 Or, okay, we know that token. 695 00:32:00,500 --> 00:32:04,060 Do you want to approve this SSL certificate and let it get issued? 696 00:32:04,840 --> 00:32:06,940 So that's one of the keys there. 697 00:32:07,020 --> 00:32:09,080 If you can figure out how a certificate authority, 698 00:32:09,880 --> 00:32:10,840 generates this secret, 699 00:32:11,060 --> 00:32:14,500 you can own that certificate authority and generate as many certs as you want. 700 00:32:15,540 --> 00:32:16,900 I haven't been able to do that yet. 701 00:32:17,160 --> 00:32:18,080 Maybe one of you can. 702 00:32:19,400 --> 00:32:22,680 One other thing I found is that some CAs actually have a blacklist, 703 00:32:22,820 --> 00:32:25,440 meaning that if you try to get a certificate for, like, 704 00:32:26,700 --> 00:32:29,100 well, I tried to get one for VeriSign.com, 705 00:32:30,520 --> 00:32:31,840 and I got flagged. 706 00:32:31,840 --> 00:32:33,560 You know, I got a little greedy there. 707 00:32:34,520 --> 00:32:37,040 So there are sites that are on these blacklists, 708 00:32:38,840 --> 00:32:39,940 and that's okay. 709 00:32:40,100 --> 00:32:41,360 I mean, it's better than nothing, right? 710 00:32:41,500 --> 00:32:43,940 That's good for VeriSign, good for Bank of America, good for PayPal. 711 00:32:44,320 --> 00:32:47,200 But what about, I don't know, dod.mil or dod.gov 712 00:32:48,180 --> 00:32:52,680 or whatever random host name it is any one of us might be trying to secure? 713 00:32:53,640 --> 00:32:56,640 For example, sslvpn.yourcompany.com. 714 00:32:57,260 --> 00:32:58,680 Probably not going to be on the blacklist. 715 00:33:00,580 --> 00:33:02,640 Now, before we get into the real CA attacks, 716 00:33:04,460 --> 00:33:05,860 I just kind of wondered. 717 00:33:06,400 --> 00:33:07,020 I don't know. 718 00:33:07,060 --> 00:33:08,820 People leak stuff on the Internet all the time. 719 00:33:10,240 --> 00:33:12,900 So, yeah, you can Google for RSA private keys. 720 00:33:14,160 --> 00:33:16,420 I spent a whole day going through every one in Google, 721 00:33:16,540 --> 00:33:18,260 and, you know, it's kind of cool. 722 00:33:18,320 --> 00:33:18,600 It's funny. 723 00:33:18,700 --> 00:33:21,980 I only ended up getting one full key pair. 724 00:33:22,260 --> 00:33:24,600 You know, I found their private key like this, 725 00:33:24,620 --> 00:33:26,480 and then I just downloaded their SSL certificate, 726 00:33:26,700 --> 00:33:30,060 put it together, and it was for I don't even remember the domain name. 727 00:33:30,440 --> 00:33:33,920 You know, if Bank of America is going to fall victim to this, 728 00:33:33,980 --> 00:33:35,740 we've got bigger problems to worry about. 729 00:33:35,860 --> 00:33:37,520 But still, kind of funny. 730 00:33:37,580 --> 00:33:38,100 Kind of cool. 731 00:33:41,200 --> 00:33:42,540 This past winter, though, 732 00:33:42,580 --> 00:33:44,640 you probably heard about the MD5 collision attack 733 00:33:44,640 --> 00:33:48,060 where a number of researchers used 200 PlayStations 734 00:33:48,060 --> 00:33:49,940 and some crazy crypto attack 735 00:33:49,940 --> 00:33:52,380 to generate their own rogue certificate authority. 736 00:33:52,720 --> 00:33:54,800 This kind of trumps anything I'm going to talk about 737 00:33:54,800 --> 00:33:56,820 because I'm talking about getting a cert here, a cert there. 738 00:33:57,040 --> 00:34:00,500 These guys were able to build their own certificate authority 739 00:34:00,500 --> 00:34:03,560 that was just trusted by every major web browser. 740 00:34:03,560 --> 00:34:09,060 And they did that by exploiting weaknesses in MD5 hashing algorithm, 741 00:34:09,260 --> 00:34:11,140 which has been known to be broken for a while. 742 00:34:12,060 --> 00:34:15,660 So they did this crazy crypto attack using their 200 PlayStations, 743 00:34:15,700 --> 00:34:19,040 but the type of crypto attack they did was called a chosen prefix, 744 00:34:19,300 --> 00:34:22,520 where they had to get something from a specific certificate authority 745 00:34:22,520 --> 00:34:26,300 with known data that they've provided. 746 00:34:26,560 --> 00:34:29,980 And the way they did that was through an automated script 747 00:34:29,980 --> 00:34:33,540 that basically got certificates out of this browser. 748 00:34:33,540 --> 00:34:35,140 And they did that through their web application. 749 00:34:37,000 --> 00:34:40,000 So what could have kind of stopped them dead in their tracks 750 00:34:40,000 --> 00:34:42,780 or drastically increased the complexity of their attack 751 00:34:42,780 --> 00:34:44,780 would have been a hardened web application. 752 00:34:45,160 --> 00:34:48,480 The two specific attributes that they needed to be able to predict 753 00:34:48,480 --> 00:34:51,600 in the certificate authority were the time of issuing, 754 00:34:51,820 --> 00:34:54,860 the exact time and seconds that the certificate was issued, 755 00:34:55,000 --> 00:34:56,220 and the serial number. 756 00:34:56,480 --> 00:34:58,560 And they were able to do that through this web app. 757 00:34:59,040 --> 00:35:02,620 If this web app just added a simple random time delay 758 00:35:02,620 --> 00:35:03,520 in the issuing process, 759 00:35:03,540 --> 00:35:06,780 I mean, milliseconds, seconds, nothing much, 760 00:35:06,920 --> 00:35:10,400 it would have drastically increased the complexity of this attack. 761 00:35:10,660 --> 00:35:13,280 Similarly, if they used non-predictable serial numbers, 762 00:35:14,680 --> 00:35:15,820 that would have happened. 763 00:35:15,960 --> 00:35:18,900 So essentially here, yeah, we've got a broken crypto algorithm 764 00:35:18,900 --> 00:35:20,160 and this crazy crypto attack, 765 00:35:20,420 --> 00:35:24,360 but if the web application was designed with a defense-in-depth attitude, 766 00:35:25,360 --> 00:35:27,240 maybe this attack wouldn't have happened. 767 00:35:28,880 --> 00:35:31,820 Another certificate authority attack that happened last year, 768 00:35:31,940 --> 00:35:33,520 a user simply wanted to know, 769 00:35:33,520 --> 00:35:36,460 went to a reseller of the Komodo certificate authority, 770 00:35:36,780 --> 00:35:39,680 asked for a cert from Mozilla.com and got it. 771 00:35:40,060 --> 00:35:42,800 The answer? Validation was turned off. 772 00:35:43,000 --> 00:35:43,320 Whoops. 773 00:35:45,540 --> 00:35:48,440 When I started looking at some Komodo resellers, 774 00:35:48,580 --> 00:35:53,020 what I found was that the reseller itself actually controls 775 00:35:53,020 --> 00:35:54,660 the whole authorization process. 776 00:35:55,200 --> 00:35:58,120 So while Komodo goes through the web trust audit 777 00:35:58,120 --> 00:36:00,300 and jumps through all these hoops and pays a lot of money 778 00:36:00,300 --> 00:36:02,340 to actually become trusted by a web browser, 779 00:36:02,340 --> 00:36:04,840 they sign up resellers 780 00:36:04,840 --> 00:36:08,060 and then just offload the whole process 781 00:36:08,060 --> 00:36:10,320 of validating certificate requests on them. 782 00:36:10,540 --> 00:36:12,340 So what you see here in this screenshot, 783 00:36:12,680 --> 00:36:16,500 I set up a domain to capture the email 784 00:36:16,500 --> 00:36:17,980 containing the authorization code, 785 00:36:18,200 --> 00:36:23,040 and it actually came out of the CA reseller's 786 00:36:23,040 --> 00:36:25,980 shared hosting environment's SMTP server. 787 00:36:26,380 --> 00:36:28,120 So what that means is, hey, 788 00:36:28,240 --> 00:36:29,740 you own that shared hosting environment, 789 00:36:29,740 --> 00:36:32,840 well, you can pretty much generate certificates 790 00:36:33,980 --> 00:36:35,780 signed by Komodo at your will. 791 00:36:37,060 --> 00:36:40,980 But why try and own the shared hosting environment 792 00:36:40,980 --> 00:36:44,200 when you can just sign up and be a Komodo reseller 793 00:36:44,200 --> 00:36:45,180 with a cash credit card? 794 00:36:46,400 --> 00:36:48,900 So that's on my list of things to do. 795 00:36:50,940 --> 00:36:54,860 Now, here's the attack that actually kind of spawned 796 00:36:55,640 --> 00:36:56,660 the title of this talk. 797 00:36:56,740 --> 00:36:59,140 There's another certificate authority called StartCom, 798 00:36:59,740 --> 00:37:00,720 which I stumbled across. 799 00:37:02,520 --> 00:37:04,520 Essentially, they do it a little bit differently. 800 00:37:04,700 --> 00:37:07,100 Where they have a validation mechanism that you go through, 801 00:37:07,220 --> 00:37:08,660 you become validated for a domain, 802 00:37:08,840 --> 00:37:10,960 and then you can request certificates for that domain. 803 00:37:11,580 --> 00:37:12,640 So here I am. 804 00:37:12,800 --> 00:37:17,060 I'm requesting to be validated for IntrepidusGroup.com, 805 00:37:17,180 --> 00:37:18,460 which is the company I work for. 806 00:37:19,760 --> 00:37:21,820 And then they say, okay, well, 807 00:37:21,880 --> 00:37:23,520 we're going to send the verification email 808 00:37:23,520 --> 00:37:25,260 to one of these three email addresses. 809 00:37:25,360 --> 00:37:25,820 Pick one. 810 00:37:27,480 --> 00:37:28,600 I picked one, 811 00:37:28,600 --> 00:37:30,660 but then I met in the middle of my browser session 812 00:37:30,660 --> 00:37:32,780 using a local client proxy like Paros, 813 00:37:32,960 --> 00:37:35,500 and I changed it from whatever it was to my Gmail account. 814 00:37:37,620 --> 00:37:39,020 And then I checked my Gmail. 815 00:37:40,720 --> 00:37:42,260 And then I got the secret. 816 00:37:49,420 --> 00:37:51,640 And then I did it a couple more times, 817 00:37:52,600 --> 00:37:53,680 as you can see. 818 00:37:53,920 --> 00:37:55,080 And then I got greedy. 819 00:37:56,280 --> 00:37:58,580 So essentially, you could become validated for that domain, 820 00:37:58,600 --> 00:37:59,520 you could become validated for PayPal.com, 821 00:37:59,560 --> 00:38:02,000 and you could become validated for VeriSign.com. 822 00:38:02,200 --> 00:38:03,680 But then when you went through, hey, 823 00:38:03,760 --> 00:38:05,320 give me the certificate, I want it now, 824 00:38:05,480 --> 00:38:07,540 that's when you went through their blacklist. 825 00:38:07,680 --> 00:38:09,940 And they happened to blacklist VeriSign.com. 826 00:38:10,460 --> 00:38:11,680 And within a couple minutes, 827 00:38:11,780 --> 00:38:14,620 I had an email from the CEO saying, 828 00:38:14,740 --> 00:38:16,140 oh, it looks like you figured out how to bypass 829 00:38:16,140 --> 00:38:17,120 our validation mechanism. 830 00:38:17,320 --> 00:38:18,060 I was like, yeah, you know, 831 00:38:18,060 --> 00:38:19,140 I was writing up the disclosure. 832 00:38:19,340 --> 00:38:20,560 I didn't have a chance to send it yet. 833 00:38:21,400 --> 00:38:22,260 I really was. 834 00:38:23,680 --> 00:38:25,060 But StartCom was really cool. 835 00:38:25,280 --> 00:38:28,140 I mean, this was December 23, two days before Christmas. 836 00:38:28,140 --> 00:38:30,260 They fixed it that night, and I validated the fix. 837 00:38:30,480 --> 00:38:32,240 And I thought that was really cool. 838 00:38:34,420 --> 00:38:37,420 Another one, not as leet, but still very effective. 839 00:38:37,640 --> 00:38:39,920 This is how I got the login.live.com cert. 840 00:38:40,080 --> 00:38:42,000 It was through information leakage. 841 00:38:42,400 --> 00:38:43,860 Who exploits information leakage? 842 00:38:44,020 --> 00:38:44,480 I mean, come on. 843 00:38:45,780 --> 00:38:48,880 So here's the aliases you could pick on their order form. 844 00:38:49,080 --> 00:38:50,720 There's like 10 of them, whatever. 845 00:38:50,880 --> 00:38:54,740 I couldn't register any of those at login.live.com. 846 00:38:55,640 --> 00:38:57,080 But they sent me an email, 847 00:38:57,080 --> 00:38:58,280 which contains some more. 848 00:38:58,440 --> 00:39:00,740 I registered sslcerts at live.com. 849 00:39:00,960 --> 00:39:01,540 Got it. 850 00:39:01,880 --> 00:39:02,660 Got the email. 851 00:39:03,040 --> 00:39:03,780 Got the cert. 852 00:39:04,340 --> 00:39:05,500 And I'm out of time. 853 00:39:08,300 --> 00:39:11,220 But if anybody has any further questions, 854 00:39:11,340 --> 00:39:12,840 definitely come up and ping me. 855 00:39:13,500 --> 00:39:15,580 Reach out to me, and I'll tell you all I know.