1 00:00:00,000 --> 00:00:04,880 Hi, everyone. Thanks for coming. Today with Baptiste, I'm going to present you Bad Memory. 2 00:00:05,140 --> 00:00:10,700 For those who wonder, Gustav is not here today. He has a visa issue, so he's stuck in Stockholm. 3 00:00:12,160 --> 00:00:17,080 So Bad Memory is a talk a little bit different from what you might have seen before. 4 00:00:17,560 --> 00:00:22,940 We try to give you something which is out-of-the-box thinking, and we're going to show you a lot of cool attacks. 5 00:00:23,440 --> 00:00:28,660 And we have made a lot of videos for you because usually the gods of demo are against me, 6 00:00:28,660 --> 00:00:29,860 so now I'm doing video. 7 00:00:30,740 --> 00:00:36,320 They are on YouTube, so if you want to watch a video afterward, you can just browse the channel and you have them. 8 00:00:39,260 --> 00:00:45,960 Usually, and you're all there for security, there are three ways we can know and know how to break a security mechanism. 9 00:00:46,520 --> 00:00:50,000 The first one is when you find a design flaw. 10 00:00:50,380 --> 00:00:57,300 For instance, WEP is broken by design. You all know that. And you also have the most well-known way, 11 00:00:57,380 --> 00:00:58,640 which is we try to find 12 00:00:58,640 --> 00:01:02,200 an exploit and find vulnerability into the code, its implementation. 13 00:01:02,780 --> 00:01:09,760 And the third one, which would be the focus of this talk, is how you can try to make this security mechanism a little bit irrelevant. 14 00:01:11,160 --> 00:01:12,420 Closer, okay, sorry. 15 00:01:13,560 --> 00:01:17,240 So what do we mean by irrelevant? For a second, bear with me. 16 00:01:17,520 --> 00:01:22,040 Let's assume you have this nice house in Wonderland, and of course you like your house, 17 00:01:22,060 --> 00:01:24,520 so you're going to prevent people to try to break through it. 18 00:01:25,060 --> 00:01:28,160 The way you do that is you have a nice security mechanism, 19 00:01:28,160 --> 00:01:32,760 which is a door. So the bigger the door, the more secure you are. 20 00:01:33,080 --> 00:01:37,480 But a clever attacker might try to do what we call side channel, 21 00:01:37,660 --> 00:01:42,480 and that would be the focus of this talk, is try to break through the windows or try to break through the roof, right? 22 00:01:42,620 --> 00:01:48,980 So that's what we call side channel. Now what we're going to tell you is not about Wonderland, it's about real security. 23 00:01:49,360 --> 00:01:50,760 So what we have is 24 00:01:51,920 --> 00:01:57,460 four different stories in this talk. So the first one will be how you can actually break into a 25 00:01:57,460 --> 00:02:03,540 WPA network from a web page. The second one will be how you can attack HTTPS with cache injection. 26 00:02:03,920 --> 00:02:08,520 The third one would be how you can steal private data with what we call framework attack. 27 00:02:08,920 --> 00:02:16,180 And the third one would be how to attack this guy, smartphone, with something which is a new generation of click jacking. 28 00:02:17,140 --> 00:02:17,620 So, 29 00:02:18,680 --> 00:02:19,160 well, 30 00:02:20,560 --> 00:02:22,460 hopefully we'll be as loud as this guy. 31 00:02:23,860 --> 00:02:24,340 So, 32 00:02:26,220 --> 00:02:26,700 obviously, 33 00:02:26,700 --> 00:02:32,760 over the year, we see something which is really good. We see people moving away from web, or at least they should, 34 00:02:33,280 --> 00:02:37,000 from something which is more secure, which is WPA, right? And 35 00:02:37,400 --> 00:02:41,440 so the world is more secure. And even at the DEF CON this year, we have a secure network. 36 00:02:41,640 --> 00:02:44,700 So the world ship is kind of empty now. But, hey, 37 00:02:45,540 --> 00:02:52,500 still something remains. We are still storing the WPA key through a web interface. And our idea was, well, 38 00:02:53,000 --> 00:02:56,680 maybe we can't break WPA because we don't really know how to do that right now. 39 00:02:56,700 --> 00:03:02,360 But we probably can try to attack this web interface. And to confirm that, we went to a store and by like a 40 00:03:02,360 --> 00:03:08,960 huge bunch of routers from different brands, eight of them, and try to our hypothesis. And the result was 41 00:03:08,960 --> 00:03:15,940 that we are able to break all of this brand and actually retrieve the WPA key. What I'm going to show you now is how we do that. 42 00:03:16,820 --> 00:03:22,320 So the basic idea of this attack is we are able to execute a malicious JavaScript 43 00:03:23,240 --> 00:03:26,080 inside the local network because the user is browsing the web. 44 00:03:26,080 --> 00:03:27,700 It's not an unreasonable assumption. 45 00:03:28,140 --> 00:03:30,920 First reason is because a lot of websites have XSS vulnerability. 46 00:03:31,380 --> 00:03:35,280 Go to XSSD, the website, if you do not trust me. 47 00:03:35,360 --> 00:03:36,140 There is a ton of them. 48 00:03:36,300 --> 00:03:38,020 But also because you can serve ads. 49 00:03:38,300 --> 00:03:40,900 And actually, ads contain malicious code. 50 00:03:40,980 --> 00:03:41,520 It's well known. 51 00:03:41,800 --> 00:03:44,060 For instance, at the beginning of this year, 52 00:03:44,260 --> 00:03:48,940 Avast released a study which shows that a lot of ad advertisement networks 53 00:03:48,940 --> 00:03:52,040 did a very bad job at sanitizing the advertisement. 54 00:03:52,480 --> 00:03:55,080 And as a result, there is a lot of malware which are distributed 55 00:03:55,080 --> 00:03:56,160 via an ad network. 56 00:03:56,500 --> 00:03:58,300 In case you wonder how much it costs, 57 00:03:58,560 --> 00:04:01,260 if you want to have 100,000 impressions, it's about $100. 58 00:04:01,460 --> 00:04:02,980 So it's a really cost-effective attack. 59 00:04:04,520 --> 00:04:08,420 How many of you are familiar with what we call the browser same origin policy? 60 00:04:08,740 --> 00:04:09,360 Raise your hand. 61 00:04:10,180 --> 00:04:11,180 Not that much people. 62 00:04:11,360 --> 00:04:11,540 Okay. 63 00:04:11,640 --> 00:04:15,600 So just make sure everyone is on the page and will follow what we're going to explain. 64 00:04:16,060 --> 00:04:20,580 So same origin policy is one of the key security mechanisms you have in the browser. 65 00:04:20,920 --> 00:04:24,860 It's basically meant to protect you when you are browsing multiple websites 66 00:04:24,860 --> 00:04:25,060 online. 67 00:04:25,080 --> 00:04:30,120 At the same time, because you have multiple tabs or you have one iframe inside your page, 68 00:04:30,360 --> 00:04:31,720 the basic idea is the following. 69 00:04:32,000 --> 00:04:37,200 If you have two origins, in the screen you have evil.com and you have mail.google.com, 70 00:04:37,480 --> 00:04:43,060 the same origin policy, do something very simple, which is you can, one origin can post data. 71 00:04:43,220 --> 00:04:45,380 Doesn't mean that the other origin has to process them, 72 00:04:45,480 --> 00:04:47,140 but you can post data from one origin to another. 73 00:04:47,580 --> 00:04:49,340 That's how web service can interact together. 74 00:04:49,860 --> 00:04:53,060 But you are not able from one origin to read the other one, 75 00:04:53,160 --> 00:04:54,900 which effectively prevents a bad. 76 00:04:55,080 --> 00:04:59,580 So you don't have to die to read your Gmail or malicious page to read your bank account, right? 77 00:04:59,660 --> 00:05:00,700 That's the same origin policy. 78 00:05:00,960 --> 00:05:06,400 So we can post data, provided there is no CSR defense, but we can't actually read data. 79 00:05:06,580 --> 00:05:09,760 And you will see that it actually makes this attack a little bit hard, 80 00:05:09,900 --> 00:05:12,560 and as a major hurdle we had to work around. 81 00:05:13,020 --> 00:05:13,460 Okay. 82 00:05:13,520 --> 00:05:14,760 So back to the attack. 83 00:05:15,060 --> 00:05:16,260 The attack work as follows. 84 00:05:16,840 --> 00:05:24,800 At the beginning, the attacker will pay ads or fail an XSS in a well-known website and will be able to inject a 85 00:05:24,800 --> 00:05:26,940 malicious JavaScript inside the local network. 86 00:05:27,340 --> 00:05:31,520 At this point, you have to realize that the firewall is completely useless. 87 00:05:31,800 --> 00:05:35,640 There is not any more firewall because you're already inside the network. 88 00:05:36,020 --> 00:05:40,420 Similarly, you might say, hey, the router interface is only available from inside the network. 89 00:05:40,840 --> 00:05:47,440 Well, that's not an issue because we are already inside, so we can access from the browser of the user the web interface. 90 00:05:48,040 --> 00:05:54,180 So the first thing we have to do, the first thing that this malicious ad has to do is to locate 91 00:05:54,940 --> 00:05:57,600 the IP of the router because we have no clue of that. 92 00:05:57,780 --> 00:06:02,440 A good way to do that is to look at the RFC and try all the probable IP. 93 00:06:02,620 --> 00:06:05,980 We do that by using such a request, which is a synchronous request. 94 00:06:06,380 --> 00:06:08,260 And we try to see the page load or not. 95 00:06:08,400 --> 00:06:11,600 If the page load, then there is a web interface, and it's likely that it's a router. 96 00:06:11,800 --> 00:06:16,380 So we go to common IP until we find the right one. 97 00:06:19,500 --> 00:06:19,900 Okay. 98 00:06:21,460 --> 00:06:22,840 So at that point, 99 00:06:23,660 --> 00:06:24,580 there is two kinds. 100 00:06:24,800 --> 00:06:25,700 There are five routers in the world. 101 00:06:25,900 --> 00:06:32,580 One which is web authentication or web login, which is the same thing you see on Facebook, Gmail, all that kind of stuff. 102 00:06:32,700 --> 00:06:38,720 It's basically an authentication where you have the username and password which is inside the HTML form. 103 00:06:39,020 --> 00:06:48,280 The other type of authentication is the one you had in previous life or web 1.0, which was the basic authentication. 104 00:06:48,480 --> 00:06:51,060 It's an ugly pop-up you have with username and password. 105 00:06:51,380 --> 00:06:53,880 And we kind of have to know which one you are using. 106 00:06:53,880 --> 00:06:58,760 Because if you are using a basic auth, we can't really try to brute force it. 107 00:06:58,860 --> 00:07:00,880 And the type of attack is a little bit different. 108 00:07:01,240 --> 00:07:04,580 And once again, the same origin policy prevents us to read the page. 109 00:07:04,780 --> 00:07:08,160 So we don't have any idea which kind of authentication is used. 110 00:07:08,460 --> 00:07:13,220 Fortunately for us, we found one or two bugs in Firefox that are currently reported. 111 00:07:13,480 --> 00:07:20,020 And we are able to know with 100% accuracy because of this bug which kind of authentication you are using. 112 00:07:20,900 --> 00:07:23,240 So when we know which authentication you are using, 113 00:07:23,240 --> 00:07:25,660 what we are doing is what we call fingerprinting the router. 114 00:07:25,840 --> 00:07:28,420 We need to know which model and which brand you have. 115 00:07:28,820 --> 00:07:31,400 Because each brand and each model have a different kind of vulnerability. 116 00:07:32,040 --> 00:07:34,280 To do that, we do two tricks. 117 00:07:34,460 --> 00:07:39,780 The first one is really well-known, is we try to fetch well-known image from the routers. 118 00:07:39,880 --> 00:07:42,520 Every brand has a different logo, which has a different size. 119 00:07:42,720 --> 00:07:48,280 So we can fit them in JavaScript and read the properties to get an idea of which image are present. 120 00:07:48,980 --> 00:07:52,920 The other one which we come up with is actually to defeat the basic code idea. 121 00:07:53,240 --> 00:07:59,220 Which is, if you have a basic code, if you are mistaken, you will see an ugly pop-up and the user will click cancel and you're dead. 122 00:07:59,440 --> 00:08:03,320 So we're doing port scanning, because you can do that with XHR requests. 123 00:08:03,520 --> 00:08:06,460 XHR requests are not bound to a specific port. 124 00:08:06,600 --> 00:08:10,200 You can do a lot of them, except some specific one like support SMTP port. 125 00:08:10,580 --> 00:08:14,780 So with this, we first do a first pass of scanning all the port. 126 00:08:15,100 --> 00:08:18,880 Get an idea of what router you might have and do further fingerprinting with image. 127 00:08:19,200 --> 00:08:23,220 As a result, we can tell which one are positive, which one are negative. 128 00:08:23,240 --> 00:08:25,580 And have a pretty good idea of who you are. 129 00:08:25,640 --> 00:08:29,740 Actually, now we're in implementation, we have a fingerprinting which works 100%. 130 00:08:29,740 --> 00:08:34,520 And we were able to actually know each brand and each model at 100% accuracy. 131 00:08:35,140 --> 00:08:39,720 When we are at this point, what we have to do is authenticate to the router. 132 00:08:40,000 --> 00:08:41,800 Remember, the router is protected by a password. 133 00:08:42,240 --> 00:08:48,060 So before I'm going a little bit further, how many of you ever change the router password at home? 134 00:08:49,540 --> 00:08:50,980 All of you. Fantastic. 135 00:08:53,780 --> 00:08:54,940 I don't trust you. 136 00:08:56,960 --> 00:08:58,180 No, seriously, I don't. 137 00:08:58,340 --> 00:09:01,740 But okay, let's assume you are all making the right choice. 138 00:09:01,960 --> 00:09:03,440 And of course, let me raise your hand. 139 00:09:03,500 --> 00:09:05,860 Who chooses a password which is more than 10 characters? 140 00:09:06,180 --> 00:09:07,200 Raise all your hand. 141 00:09:08,360 --> 00:09:09,660 Come on. Okay. Right. 142 00:09:09,780 --> 00:09:11,440 So everyone has a secure, strong password. 143 00:09:11,580 --> 00:09:15,180 Never use one-time password only for their own router. Right. 144 00:09:15,400 --> 00:09:21,480 Well, the nice thing for us is if the default password doesn't work, what we can do, 145 00:09:22,040 --> 00:09:25,380 is we can actually brute force it for two reasons. 146 00:09:25,500 --> 00:09:29,320 The first one is this kind of router do not have CSRF defense. 147 00:09:29,540 --> 00:09:32,160 So we are able to try as many login as we want. 148 00:09:32,460 --> 00:09:36,400 And we're able to inject page from the malicious JavaScript to the router. 149 00:09:36,760 --> 00:09:41,740 And the second one is we know we are successfully logged or not by using what we call timing attack. 150 00:09:42,160 --> 00:09:45,540 So a timing attack is the idea that if the page is not logged, 151 00:09:45,680 --> 00:09:48,380 you only see login and password which is really fast to display. 152 00:09:48,600 --> 00:09:51,060 So the loading time will be really, really fast. 153 00:09:51,060 --> 00:09:52,920 In the order of 300 milliseconds. 154 00:09:53,220 --> 00:09:58,300 If we are logged, there is a ton of stuff like basic setup, router setup, wireless setup, 155 00:09:58,420 --> 00:09:59,940 you know, this whole huge page. 156 00:10:00,220 --> 00:10:03,020 So which takes about one second to one second and a half. 157 00:10:03,240 --> 00:10:07,100 Since we are on a local network, it's really reliable because we don't have any latencies. 158 00:10:07,280 --> 00:10:11,260 Remember, it's from the router to the browser which is inside the local network. 159 00:10:11,480 --> 00:10:13,980 So the latency doesn't play a role here. 160 00:10:14,160 --> 00:10:15,900 So we can do a good guess. 161 00:10:16,320 --> 00:10:20,280 If you are using basic code, and that's kind of the irony of the story, 162 00:10:20,280 --> 00:10:24,320 is basic code is more secure because we have only one try. 163 00:10:24,780 --> 00:10:29,240 We don't have a way to brute force basic code because we have no way to actually tell whether you're successful or not. 164 00:10:29,560 --> 00:10:31,340 And if we fail, we have a pop-up. 165 00:10:31,540 --> 00:10:34,420 We found a way at some point to actually remove the pop-up, 166 00:10:34,500 --> 00:10:36,960 but we can't still know whether it's successful or not. 167 00:10:37,340 --> 00:10:43,540 So, well, in any case, we are able to brute force most of the router which moves to the web authentication part, 168 00:10:43,740 --> 00:10:44,480 a web login form. 169 00:10:45,060 --> 00:10:49,600 And as a bonus point, at some point we had one which was even better, 170 00:10:49,600 --> 00:10:53,160 is we tried to authenticate, and somehow our code was messed up, 171 00:10:53,240 --> 00:10:58,020 and Bati showed me, hey, it's still working, and we are looking at each other and what happened. 172 00:10:58,160 --> 00:11:00,880 Actually, some of the routers actually do not enforce permissions, 173 00:11:00,900 --> 00:11:05,140 so you can actually inject anything you want in it with a supplying password. 174 00:11:05,620 --> 00:11:08,880 I'm not going to tell you which brand because otherwise everyone is going to throw them away. 175 00:11:09,580 --> 00:11:11,720 But, yeah, very famous brand. 176 00:11:12,900 --> 00:11:17,640 So, once again, even if we are able to be authenticated to the router, 177 00:11:17,880 --> 00:11:19,580 we have no way to do that. 178 00:11:19,600 --> 00:11:24,800 We have no way to read directly the page which contains the WPA key, right? 179 00:11:25,040 --> 00:11:27,540 So, at that point, we have to find new vulnerability, 180 00:11:27,880 --> 00:11:31,140 and this time we found vulnerability inside the routers. 181 00:11:31,500 --> 00:11:34,200 And what we are going to use is we are going to use XSS vulnerability. 182 00:11:34,660 --> 00:11:38,180 We found five out of the eight brands we looked at had XSS vulnerability. 183 00:11:38,820 --> 00:11:40,660 And what we are going to do is very simple. 184 00:11:40,840 --> 00:11:44,080 We are going to inject a payload, which is an external JavaScript. 185 00:11:44,800 --> 00:11:47,560 And this external JavaScript will be injected into the router, 186 00:11:47,560 --> 00:11:52,100 and we can do that because, once again, there is no CSRF defense, 187 00:11:52,160 --> 00:11:54,680 so there is no check where the input came from. 188 00:11:56,000 --> 00:12:00,420 So, some of you might wonder here, well, this might work, so you can have an injection, 189 00:12:00,600 --> 00:12:02,920 but what about if the injection is not in the right page? 190 00:12:03,180 --> 00:12:07,360 So, usually when we found an XSS is not on the page which has a WPA key, 191 00:12:07,560 --> 00:12:11,420 well, it doesn't matter because we have what we call cross contamination, 192 00:12:13,200 --> 00:12:17,500 origin contamination, which means that if you have an XSS in one page, 193 00:12:17,540 --> 00:12:20,400 we can use that to actually open an iframe, 194 00:12:20,520 --> 00:12:22,960 and this iframe would be inside the same origin. 195 00:12:23,120 --> 00:12:26,880 So, this time the same origin policy doesn't prevent us to read inside the iframe. 196 00:12:27,220 --> 00:12:29,360 And from this, we are just able to read the key. 197 00:12:29,900 --> 00:12:32,060 At this point, we are almost done. 198 00:12:32,220 --> 00:12:39,280 It's almost mission complete because nothing prevents us to send back the key home to the attacker, right? 199 00:12:39,600 --> 00:12:43,420 So, you might wonder, well, what happens if you can't find an XSS vulnerability? 200 00:12:44,060 --> 00:12:46,120 Well, there is two things for you here. 201 00:12:46,120 --> 00:12:48,040 The first is you can use click jacking, 202 00:12:48,120 --> 00:12:53,380 and we found that most of any routers do not have any click jacking defense, 203 00:12:53,580 --> 00:12:55,760 so you can use a trick found by Paul Stone, 204 00:12:55,940 --> 00:12:59,340 showing that the blackouts are up to a 10, which is the drag and drop click jacking. 205 00:12:59,560 --> 00:13:02,940 If you can lure the user into drag and dropping, which is not that hard, 206 00:13:03,600 --> 00:13:07,380 think of making a fake game, then you can extract any data you want from a page. 207 00:13:07,580 --> 00:13:11,020 So, all you have to do is frame the page and have the user do a drag and drop, 208 00:13:11,100 --> 00:13:16,020 for example, feeding a puppy or moving around their mouse, 209 00:13:16,120 --> 00:13:16,500 or whatever. 210 00:13:17,160 --> 00:13:21,860 And we found that 8 out of 8 routers have never done that. 211 00:13:22,140 --> 00:13:27,100 And two days ago, Craig Effner also showed that you can use DNS rebinding attack 212 00:13:27,100 --> 00:13:30,440 to actually access a page from outside, so you can do this as well. 213 00:13:30,860 --> 00:13:32,680 And so, you have the key, right? 214 00:13:32,820 --> 00:13:35,120 So, the key is gone, and we have one problem. 215 00:13:35,700 --> 00:13:36,900 Can you guess what it is? 216 00:13:39,960 --> 00:13:42,220 Well, I have a key, but where is the network, right? 217 00:13:42,860 --> 00:13:45,660 You have a nice key, a long key, and the key doesn't tell you much, 218 00:13:45,660 --> 00:13:46,820 where the router is. 219 00:13:47,120 --> 00:13:50,380 So, we have the key, we don't know where the router is. 220 00:13:50,500 --> 00:13:52,840 Well, turns out that there is an app for that. 221 00:13:55,520 --> 00:13:57,660 And actually, it's a courtesy of Firefox. 222 00:13:58,040 --> 00:14:03,440 So, Firefox did introduce, for those who don't know that, in 3.5, I guess, 223 00:14:03,620 --> 00:14:06,560 something which is called location-aware browsing. 224 00:14:06,880 --> 00:14:09,380 So, what it looks like, for those who never see it, 225 00:14:09,460 --> 00:14:12,120 is it's a little pop-up on the top which says, 226 00:14:12,260 --> 00:14:14,620 do you want to share your location with the page? 227 00:14:14,620 --> 00:14:18,340 It's used to give you, to give the page information of where you are, 228 00:14:18,440 --> 00:14:20,340 so they can provide you more relevant information, 229 00:14:20,660 --> 00:14:24,000 like a restaurant or a place to go to. 230 00:14:24,380 --> 00:14:28,500 And under the hood, what has happened is there are partnerships with Google, 231 00:14:28,620 --> 00:14:31,720 and Google uses this little car you see on the bottom, 232 00:14:31,840 --> 00:14:35,100 which are touring all the cities in the world and gathering a lot of information. 233 00:14:35,500 --> 00:14:39,240 And there were a lot of discussion whether it's a good thing or a bad thing 234 00:14:39,240 --> 00:14:40,680 for Google to collect that much data. 235 00:14:41,080 --> 00:14:44,480 Well, this is one example of where this data is actually harmful. 236 00:14:44,620 --> 00:14:48,980 So, what happened under the hood, and it's also has been found by Sammy Canva, 237 00:14:49,040 --> 00:14:51,700 which do, I think, a talk here, which is how I met your girlfriend. 238 00:14:52,520 --> 00:14:57,060 The idea is that Google, you can, there is a protocol with Google 239 00:14:57,060 --> 00:14:59,380 where you actually supply the MAC address, 240 00:14:59,560 --> 00:15:01,840 and Google will do a lookup in the database 241 00:15:01,840 --> 00:15:04,220 and give you what they believe is the correct coordinate. 242 00:15:04,740 --> 00:15:09,080 And since your access point is usually up 24 hours a day, 243 00:15:09,500 --> 00:15:11,720 there is a good chance that if your city is big enough, 244 00:15:11,780 --> 00:15:14,600 they will know where you are, and you can know where your location is, 245 00:15:14,620 --> 00:15:18,900 with a 500 meter precision, more or less, at least in our test. 246 00:15:19,620 --> 00:15:22,140 So, you do all these requests, you get longitude, latitude, 247 00:15:22,620 --> 00:15:25,760 and of course, if you're using Google, what about just asking for a map? 248 00:15:26,180 --> 00:15:31,580 So, actually, the attacker just gets a nice map of where the network is. 249 00:15:31,700 --> 00:15:34,120 So, you have the WPA key, you have the network position, 250 00:15:34,400 --> 00:15:35,480 then you're all set, right? 251 00:15:35,840 --> 00:15:38,400 What about, who cares about WPA? You have the key. 252 00:15:38,820 --> 00:15:41,060 And who wants to see how it looks like in real? 253 00:15:41,960 --> 00:15:42,520 No one? 254 00:15:42,740 --> 00:15:43,000 Yeah. 255 00:15:43,060 --> 00:15:43,740 Yeah, okay. 256 00:15:44,620 --> 00:15:48,260 Okay, so this is a demo of our code, fully written in JavaScript. 257 00:15:48,680 --> 00:15:51,720 So, you see in the step one, we are doing a fingerprinting of the browser 258 00:15:51,720 --> 00:15:53,920 to know which kind of exploit we can use. 259 00:15:54,140 --> 00:15:58,420 Then we're going to port scan, find what kind of authentication we are using. 260 00:15:58,560 --> 00:15:59,380 It's a bug in Firefox. 261 00:16:00,020 --> 00:16:03,160 Then fingerprinting the routers, injecting an XSS in this case, 262 00:16:03,240 --> 00:16:07,020 and then we have to wait, because it's an injected XSS in this case, 263 00:16:07,100 --> 00:16:08,560 in this SMC case. 264 00:16:08,940 --> 00:16:11,100 So, we have to wait 20 seconds until it reboots, 265 00:16:11,120 --> 00:16:14,480 and then we're going to, in an invisible iframe, open it, 266 00:16:14,480 --> 00:16:16,460 and here's your MAC address and your key. 267 00:16:16,600 --> 00:16:18,800 And this is actually the location of my own house. 268 00:16:19,120 --> 00:16:23,440 So, if you live near me in Palo Alto, happy to take a free beer, right? 269 00:16:25,300 --> 00:16:26,480 Wow, it doesn't hurt to try. 270 00:16:27,900 --> 00:16:29,820 And that's the end of our first story. 271 00:16:30,540 --> 00:16:33,060 The second story is about HTTPS. 272 00:16:34,900 --> 00:16:40,100 And HTTPS, so we're going to show you how we can actually try to make HTTPS a little bit irrelevant. 273 00:16:40,500 --> 00:16:41,240 Same idea. 274 00:16:42,160 --> 00:16:47,120 It's a kind of complex attack, so I'm going to go through five steps. 275 00:16:47,380 --> 00:16:49,900 First, I'm going to give you a background on how a page is actually constructed, 276 00:16:50,220 --> 00:16:52,360 because that's where all the stories begin. 277 00:16:52,640 --> 00:16:57,100 Then I'm going to discuss a little bit about what a cache injection attack is, 278 00:16:57,260 --> 00:17:00,940 and I'm going to show you what are the current defense in the browser against that, 279 00:17:01,000 --> 00:17:01,660 because there is some. 280 00:17:01,860 --> 00:17:04,660 And then I'm going to show you how we were able to bypass them, actually. 281 00:17:05,320 --> 00:17:08,540 So, a web page starts with an HTML5. 282 00:17:08,720 --> 00:17:10,340 We all know that. 283 00:17:11,120 --> 00:17:12,400 HTML5, sorry, not 5. 284 00:17:12,660 --> 00:17:18,660 And we add to that a bunch of images, and we usually add a lot of JavaScript. 285 00:17:19,520 --> 00:17:20,920 And maybe some Flash. 286 00:17:21,180 --> 00:17:23,180 And all of this came from different origins. 287 00:17:23,340 --> 00:17:26,180 You don't see it in your browser, but you can have, for instance, a map from Google, 288 00:17:26,480 --> 00:17:29,860 some accommodation from Yelp, and even some information from Facebook. 289 00:17:30,500 --> 00:17:32,740 Just yesterday, I went to Pandora and said, 290 00:17:32,840 --> 00:17:34,600 Hey, this is a group you like on Facebook. 291 00:17:34,980 --> 00:17:36,200 Do you want to listen to it? 292 00:17:36,760 --> 00:17:39,580 They didn't ask for it, but they're probably communicating with Facebook. 293 00:17:40,340 --> 00:17:45,960 So, to make this faster, there is one key mechanism into the browser, 294 00:17:46,080 --> 00:17:48,280 which is the cache. 295 00:17:48,640 --> 00:17:50,440 The cache mechanism works as follows. 296 00:17:50,560 --> 00:17:54,580 When you request a page, this page might embed a JavaScript library. 297 00:17:55,940 --> 00:17:58,660 And so the browser is going to fetch it the first time, 298 00:17:58,740 --> 00:18:01,640 and if there is a proper header with this JavaScript library, 299 00:18:01,920 --> 00:18:03,320 it will stay into the cache. 300 00:18:03,500 --> 00:18:07,820 And the headers say, do not request me this file until a certain amount of time. 301 00:18:07,820 --> 00:18:10,680 So, the next time you're browsing a page, 302 00:18:10,820 --> 00:18:13,340 and this page has the same JavaScript, 303 00:18:13,620 --> 00:18:16,040 then it's not going to download it. 304 00:18:16,120 --> 00:18:17,580 It's going to get it from the cache, right? 305 00:18:18,060 --> 00:18:19,840 And this is a fairly common practice. 306 00:18:20,980 --> 00:18:26,700 I did a bit of crowding on the top 100, 100,000 websites, 307 00:18:26,980 --> 00:18:30,700 and I see that 43% at least have an external JavaScript. 308 00:18:31,740 --> 00:18:36,140 Can you guess which is the most popular JavaScript library in the world right now? 309 00:18:37,880 --> 00:18:38,320 Google. 310 00:18:38,560 --> 00:18:39,120 Which one of Google? 311 00:18:40,260 --> 00:18:40,960 Google Apps. 312 00:18:41,320 --> 00:18:41,760 Google Apps? 313 00:18:41,940 --> 00:18:42,380 Google Ads. 314 00:18:42,560 --> 00:18:42,840 Google Ads? 315 00:18:42,840 --> 00:18:43,540 No, you're wrong. 316 00:18:44,380 --> 00:18:45,260 Google Analytics. 317 00:18:45,260 --> 00:18:45,320 Google Analytics. 318 00:18:45,520 --> 00:18:45,800 You're right. 319 00:18:45,920 --> 00:18:47,500 And the second one is the Jig Query. 320 00:18:47,660 --> 00:18:52,620 So, the first one is Google Analytics by far, followed by Jig Query, 321 00:18:52,740 --> 00:18:55,180 and then you have SWF Object, 322 00:18:55,440 --> 00:19:00,080 which is basically the library used to load Flash objects into your page. 323 00:19:00,520 --> 00:19:01,740 Google Ads is fourth. 324 00:19:02,100 --> 00:19:05,600 And then you have Prototype, which is another JavaScript framework. 325 00:19:05,600 --> 00:19:09,020 So, all of these guys are JavaScript libraries shared. 326 00:19:09,180 --> 00:19:10,140 So, some of them are different. 327 00:19:10,640 --> 00:19:11,860 Google Analytics is shared. 328 00:19:11,920 --> 00:19:14,600 You have one instance of Google Analytics shared by everyone, 329 00:19:14,840 --> 00:19:17,540 and some people have their own version of Jig Query, right? 330 00:19:18,460 --> 00:19:23,640 But all of them are external JavaScript files embedded into the page. 331 00:19:23,920 --> 00:19:25,320 So, the attacks already work like this. 332 00:19:26,180 --> 00:19:30,580 One time, let's say in the middle, after a huge work, 333 00:19:30,720 --> 00:19:33,520 you go back to a coffee shop and you browse your email. 334 00:19:33,820 --> 00:19:35,580 So, at that point, you are in the middle. 335 00:19:35,600 --> 00:19:37,980 You have an insecure network, let's say, as in the DEF CON. 336 00:19:38,140 --> 00:19:40,740 You connect your laptop and God knows what happened to you. 337 00:19:41,100 --> 00:19:44,820 Well, in this case, what we know for sure is that there is a guy 338 00:19:44,820 --> 00:19:46,320 who is going to do a man in the middle. 339 00:19:46,580 --> 00:19:49,840 What happened during this man in the middle is you're going to request any page. 340 00:19:50,040 --> 00:19:50,840 It could be CNN. 341 00:19:51,020 --> 00:19:52,140 It could be whatever you want. 342 00:19:52,500 --> 00:20:00,260 And the attacker will stop this page and will add a link to a JavaScript library, 343 00:20:00,500 --> 00:20:01,760 which you didn't request. 344 00:20:02,060 --> 00:20:05,480 But it doesn't matter because you can modify any HTML. 345 00:20:05,600 --> 00:20:07,000 You can change the page, which is not over HTTPS. 346 00:20:07,260 --> 00:20:08,360 There is no integrity on that. 347 00:20:09,040 --> 00:20:15,120 And your browser will, after that, parse it and actually request it 348 00:20:15,120 --> 00:20:16,400 because that's his job. 349 00:20:16,700 --> 00:20:20,900 And at that point, instead of requesting it to the real server, 350 00:20:21,180 --> 00:20:25,040 the attacker will supply you a malicious version of it, right? 351 00:20:26,320 --> 00:20:29,940 So, later, you go back home and you might decide to write a blog post, 352 00:20:30,360 --> 00:20:32,360 like how awesome was the TalkBad memory. 353 00:20:32,360 --> 00:20:36,460 And you go there and you try to log in. 354 00:20:36,560 --> 00:20:43,200 And actually, bloggers use Google Analytics, I guess, or Gcoin, one of the two. 355 00:20:43,340 --> 00:20:45,060 And so you're going to go there. 356 00:20:45,260 --> 00:20:48,880 And instead of looking for the real JavaScript libraries, 357 00:20:49,020 --> 00:20:51,120 what he's going to do is he's going to load the JavaScript, 358 00:20:51,360 --> 00:20:52,880 the poisoned JavaScript library. 359 00:20:53,380 --> 00:20:57,100 And this poisoned JavaScript library will not trigger any error because it's already accepted. 360 00:20:57,460 --> 00:21:01,940 And this malicious library will actually steal your login and password over HTTPS. 361 00:21:01,940 --> 00:21:02,980 And you will see nothing. 362 00:21:03,380 --> 00:21:05,080 It doesn't matter if you move any location. 363 00:21:05,300 --> 00:21:08,240 As long as you didn't clear your browser cache, it will be in effect. 364 00:21:08,680 --> 00:21:12,380 And as I said, a single library is used by many websites, 365 00:21:12,500 --> 00:21:16,020 which makes this attack so powerful is that Google Analytics is used by many, many websites. 366 00:21:16,700 --> 00:21:19,660 GQuery over CDN, Google CDN is used by many, many websites. 367 00:21:19,920 --> 00:21:22,580 So if an attacker is able to inject one of these libraries to you, 368 00:21:22,700 --> 00:21:25,200 he's going to compromise the law of your HTTPS session. 369 00:21:27,720 --> 00:21:30,520 So you might say, hey, there is a defense against that, right? 370 00:21:30,520 --> 00:21:32,680 What is the defense against this one? 371 00:21:40,080 --> 00:21:42,220 You have a warning, remember? 372 00:21:42,420 --> 00:21:47,880 Every time you try to connect to a site over HTTPS which don't have the proper SSL certificate, 373 00:21:48,240 --> 00:21:49,100 you get a warning. 374 00:21:49,820 --> 00:21:51,200 Did you attend the talk before? 375 00:21:53,320 --> 00:21:55,940 So, yeah, you have this warning, fairly strong warning. 376 00:21:56,040 --> 00:21:57,820 Say, hey, this is not the correct certificate. 377 00:21:58,220 --> 00:21:59,320 The domain name mismatch. 378 00:21:59,480 --> 00:22:00,480 Do not click through it. 379 00:22:01,000 --> 00:22:04,780 The Firefox one has three clicks until you get to the point. 380 00:22:05,200 --> 00:22:09,880 So every time the attacker tries to connect to a bad library, malicious library, 381 00:22:10,160 --> 00:22:13,040 he will have to defeat this warning. 382 00:22:14,260 --> 00:22:15,880 So how do we defeat that? 383 00:22:16,120 --> 00:22:19,580 Well, the first thing is you can always trust the user to do the bad choice, right? 384 00:22:19,820 --> 00:22:23,140 Just trust the user to just ignore the warning and go through. 385 00:22:23,840 --> 00:22:26,180 And actually, the user is kind of right in this case. 386 00:22:26,260 --> 00:22:27,440 So this is Twitter.com, right? 387 00:22:27,520 --> 00:22:28,700 How many of you have a Twitter account? 388 00:22:29,780 --> 00:22:31,160 Okay, so many people. 389 00:22:31,320 --> 00:22:34,040 So if you go to Twitter.com over HTTPS, it works. 390 00:22:34,540 --> 00:22:37,440 Now, if you go to www.twitter.com, you get this. 391 00:22:37,760 --> 00:22:38,120 Why? 392 00:22:38,260 --> 00:22:43,880 Because the Twitter certificate is for Twitter.com, not www.twitter.com. 393 00:22:43,980 --> 00:22:46,700 And actually, EV cert prevents you from having a wildcard in it. 394 00:22:46,800 --> 00:22:50,600 So until they have two certificates in two different IPs, they can't do that. 395 00:22:51,080 --> 00:22:52,000 Same thing for YouTube. 396 00:22:52,120 --> 00:22:58,040 If you try to go to youtube.https.youtube.com, you get a Google certificate, so you get a warning. 397 00:22:58,040 --> 00:23:01,380 So the user is kind of trying to disobey this warning. 398 00:23:01,520 --> 00:23:03,340 How many of you ever clicked through this kind of warning? 399 00:23:04,680 --> 00:23:06,040 Yeah, a lot of people as well. 400 00:23:06,180 --> 00:23:09,240 See, you're trying to not pay attention to this kind of warning. 401 00:23:09,600 --> 00:23:16,480 And even from quality shows that actually 92% of the SSR certificates have a mismatch. 402 00:23:16,660 --> 00:23:21,120 So it's likely that at any point, the user will go through them. 403 00:23:22,340 --> 00:23:26,620 Same thing if you think that the positive warning, like site identity, 404 00:23:26,620 --> 00:23:29,720 gives any idea and the user will pay attention to it. 405 00:23:29,860 --> 00:23:32,060 This is a Firefox study for Firefox 4. 406 00:23:32,220 --> 00:23:33,960 It's a heat map where users are clicking. 407 00:23:34,260 --> 00:23:38,180 The one you don't see is actually the one where you have HTTPS information. 408 00:23:38,620 --> 00:23:39,840 No one is clicking on it. 409 00:23:40,280 --> 00:23:42,040 So positive warnings don't work as well. 410 00:23:42,260 --> 00:23:43,800 This is a more detailed stat. 411 00:23:44,100 --> 00:23:49,640 And actually, the more expensive the SSR certificate becomes, the less people are clicking on it. 412 00:23:50,520 --> 00:23:51,920 And it's bigger, right? 413 00:23:52,120 --> 00:23:52,600 So... 414 00:23:53,820 --> 00:23:54,300 But... 415 00:23:54,300 --> 00:23:58,560 It wouldn't be a DEF CON talk if I was just saying, hey, just trust the user. 416 00:23:58,820 --> 00:24:04,060 What about we try to trick the browser into not displaying the warning so it's actually more effective? 417 00:24:04,560 --> 00:24:04,900 Right? 418 00:24:05,080 --> 00:24:06,180 So we're going to do that. 419 00:24:06,960 --> 00:24:08,280 The first one is IE. 420 00:24:08,760 --> 00:24:10,860 So this is a warning you have for Internet Explorer. 421 00:24:11,580 --> 00:24:13,360 It's a pretty strong warning, right? 422 00:24:13,380 --> 00:24:17,820 You have two red shields and it says, it's not recommended to continue. 423 00:24:18,200 --> 00:24:20,100 It will happen a lot of bad things to you. 424 00:24:20,540 --> 00:24:22,380 And they hope that the user won't click. 425 00:24:22,520 --> 00:24:23,220 Of course, he will click. 426 00:24:23,220 --> 00:24:27,200 But assume for a second the user is responsible like you and won't click. 427 00:24:28,140 --> 00:24:31,360 Then we can actually find a corner case where actually it's not displayed. 428 00:24:31,500 --> 00:24:34,480 Or it's displayed in such a weird fashion that you might be confused. 429 00:24:34,880 --> 00:24:36,120 Do you want to see a demo of that? 430 00:24:38,920 --> 00:24:39,720 Thank you. 431 00:24:41,240 --> 00:24:42,260 So here you go. 432 00:24:42,360 --> 00:24:43,420 So this is a page. 433 00:24:43,800 --> 00:24:45,900 We're going to click to the page with the bad warning. 434 00:24:46,040 --> 00:24:47,340 And this is the warning you get. 435 00:24:47,540 --> 00:24:48,980 This yellow bar on the top. 436 00:24:49,120 --> 00:24:49,680 And that's it. 437 00:24:49,960 --> 00:24:52,260 And what you can do is just display the content. 438 00:24:52,260 --> 00:24:53,860 Or display the content. 439 00:24:54,540 --> 00:24:56,320 There is absolutely no choice for you. 440 00:24:56,780 --> 00:24:59,320 And you're going to accept it, of course. 441 00:24:59,720 --> 00:25:04,160 And then when you go to Blogger, you're already dead by now. 442 00:25:04,340 --> 00:25:04,640 Right? 443 00:25:04,760 --> 00:25:05,520 It's in the cache. 444 00:25:06,020 --> 00:25:10,420 And now the SSL certificate on the top is valid, as you can see. 445 00:25:10,580 --> 00:25:13,980 And if I enter a login and password, I'm not going to give you mine. 446 00:25:14,080 --> 00:25:16,840 But then you see we are displaying it. 447 00:25:16,940 --> 00:25:19,140 And this will last until your browser is cached. 448 00:25:19,460 --> 00:25:22,240 And the nice thing about this vulnerability in IE is that you can do this. 449 00:25:22,240 --> 00:25:22,600 You can cache. 450 00:25:22,720 --> 00:25:26,500 When you click your display and secure content, we actually did cache five different libraries. 451 00:25:27,120 --> 00:25:31,420 So if you go to Twitter, over HTTPS, and you see the on the top. 452 00:25:31,580 --> 00:25:33,380 And we're going to do non-mixed content. 453 00:25:33,560 --> 00:25:34,780 This is not a warning because of the attack. 454 00:25:34,980 --> 00:25:38,280 But because on the bottom left, there is image over HTTP. 455 00:25:38,620 --> 00:25:41,400 So we're going to do fully over HTTPS. 456 00:25:42,020 --> 00:25:43,540 And you see the bar is green. 457 00:25:43,740 --> 00:25:44,560 Everything looks secure. 458 00:25:44,840 --> 00:25:46,240 You enter your email and your password. 459 00:25:46,840 --> 00:25:47,580 And guess what? 460 00:25:49,580 --> 00:25:50,160 Here you go. 461 00:25:51,740 --> 00:25:53,800 So no warning, no nothing. 462 00:25:54,440 --> 00:25:58,120 And you get all your SSL session compromised forever. 463 00:25:58,560 --> 00:26:00,400 Or at least you change browser or clear cache. 464 00:26:00,700 --> 00:26:02,480 How many people are clearing the cache? 465 00:26:04,040 --> 00:26:04,560 Everyone. 466 00:26:06,260 --> 00:26:06,780 Okay. 467 00:26:06,900 --> 00:26:08,600 I'm going to stop asking questions. 468 00:26:10,720 --> 00:26:11,240 Okay. 469 00:26:11,360 --> 00:26:12,960 So we found a bunch of these. 470 00:26:13,500 --> 00:26:19,020 Microsoft asked us to actually do not explain you how we find them until they are all fixed. 471 00:26:19,020 --> 00:26:20,640 So we're not going to give you any details. 472 00:26:20,740 --> 00:26:21,800 We're going to show you a screenshot. 473 00:26:23,400 --> 00:26:25,000 This is one other inconsistency. 474 00:26:25,120 --> 00:26:25,980 This one is really weird. 475 00:26:27,580 --> 00:26:29,840 Basically, they show you the name is not correct. 476 00:26:29,960 --> 00:26:30,820 And you have your certificate. 477 00:26:31,340 --> 00:26:33,480 But you don't have the right warning. 478 00:26:33,600 --> 00:26:35,180 So people might also be confused by this one. 479 00:26:35,400 --> 00:26:37,020 Although I prefer the previous one. 480 00:26:38,420 --> 00:26:39,800 Let's move to Firefox, right? 481 00:26:39,980 --> 00:26:41,600 So here is the Firefox warning. 482 00:26:42,120 --> 00:26:43,080 This one is different. 483 00:26:43,380 --> 00:26:46,860 They actually try to make it very painful to the user by doing three-click. 484 00:26:47,160 --> 00:26:48,500 So they hope that the user... 485 00:26:49,020 --> 00:26:50,700 It's not responsible but lazy. 486 00:26:50,840 --> 00:26:53,300 So it's not going to do three-click to get to the page. 487 00:26:54,660 --> 00:26:59,240 And actually Firefox do a very, very good job into displaying the warning. 488 00:26:59,420 --> 00:27:04,400 And sadly we didn't find any corner case where we are not able to display it. 489 00:27:04,520 --> 00:27:06,520 So we had to become more creative. 490 00:27:07,020 --> 00:27:08,900 How many of you ever heard about click jacking? 491 00:27:09,380 --> 00:27:10,080 Raise your hand. 492 00:27:10,480 --> 00:27:10,760 Okay. 493 00:27:10,800 --> 00:27:11,460 Half of the audience. 494 00:27:11,680 --> 00:27:14,460 So for those who never heard about click jacking, just one slide. 495 00:27:14,640 --> 00:27:15,660 Everyone on the same page. 496 00:27:16,300 --> 00:27:17,400 This is click jacking. 497 00:27:17,400 --> 00:27:21,520 So the idea is the attacker displays you a page like the best game ever. 498 00:27:21,960 --> 00:27:25,300 Download this awesome movie, Iron Man 2. 499 00:27:25,700 --> 00:27:27,000 What's the next new movie? 500 00:27:27,140 --> 00:27:27,620 Inception. 501 00:27:27,820 --> 00:27:29,360 You can click here to download it. 502 00:27:29,440 --> 00:27:30,560 And the user is going to do that. 503 00:27:30,760 --> 00:27:38,520 What happens under the hood is you have a transparent div on top of it which has another input box. 504 00:27:38,840 --> 00:27:46,000 And when the user is trying to do something, what will happen is he will click on this invisible button and do something he will regret later. 505 00:27:46,000 --> 00:27:50,180 Of course, here for Twitter, they have frame bursting defense so it doesn't work. 506 00:27:50,280 --> 00:27:51,300 But just to give you an example. 507 00:27:51,520 --> 00:27:55,740 So you click and instead of clicking to download or start, you're actually clicking on leaving Twitter. 508 00:27:56,420 --> 00:28:02,040 So that's how we solve the Firefox challenge is, well, sure, we can't remove it. 509 00:28:02,160 --> 00:28:03,300 But we can click jack it. 510 00:28:03,820 --> 00:28:05,800 And that's exactly what we're going to show you. 511 00:28:06,440 --> 00:28:09,300 So we were able to remove two out of the three clicks. 512 00:28:10,260 --> 00:28:11,520 So I assume you have this. 513 00:28:11,940 --> 00:28:14,320 You want to download something and you have a user argument. 514 00:28:14,480 --> 00:28:15,140 So you click on it. 515 00:28:15,140 --> 00:28:17,300 And actually you just click jack your warning. 516 00:28:17,460 --> 00:28:19,120 And you see only the last pop-up. 517 00:28:19,520 --> 00:28:21,240 The big warning is completely gone. 518 00:28:21,420 --> 00:28:27,020 And if I go to Twitter.com, same as previously, you're going to blogger. 519 00:28:27,060 --> 00:28:27,260 Sorry. 520 00:28:27,380 --> 00:28:27,740 Oops. 521 00:28:27,980 --> 00:28:31,220 If you go to blogger and enter your username and password, same story. 522 00:28:31,480 --> 00:28:33,560 The warning is the SSL is perfectly valid. 523 00:28:33,840 --> 00:28:37,780 And you see the shirt on the top, the blue indicator for Firefox. 524 00:28:38,040 --> 00:28:39,580 And you see the user and password. 525 00:28:40,180 --> 00:28:43,340 That's how you can do cache injection against HTTPS. 526 00:28:45,140 --> 00:28:50,500 For the third part of the talk, I'm going to let Baptiste show you how it works. 527 00:28:50,640 --> 00:28:51,680 And they're all yours. 528 00:28:52,280 --> 00:28:52,880 Thanks. 529 00:28:53,160 --> 00:29:01,960 So for the third part of this presentation, I will show you how we can actually steal private data from users using framework attacks. 530 00:29:03,160 --> 00:29:06,960 Framework attacks is an evolution of click jacking and scrolling attack. 531 00:29:07,300 --> 00:29:14,360 Click jacking, just presented previously by Ellie, is a term coined by Jeremiah Grossman and Robert Hansen in 2008. 532 00:29:15,220 --> 00:29:19,720 Scrolling attack is a new attack shown by Paul Stone in the Black Hat Europe this year. 533 00:29:20,660 --> 00:29:22,620 This attack works as follows. 534 00:29:24,160 --> 00:29:28,140 In the first step, the attacker will double frame the target website. 535 00:29:28,540 --> 00:29:32,860 Here in this example, it will be the mobile version of Yahoo Mail. 536 00:29:33,980 --> 00:29:39,640 In a second time, the attacker will use a browser feature called the Anchor Scrolling. 537 00:29:40,200 --> 00:29:43,960 This feature makes the page scroll automatically to a specific ID. 538 00:29:43,960 --> 00:29:47,080 When adding it as a hashtag in the URL. 539 00:29:47,760 --> 00:29:53,520 So here in this example, every email can be associated to a specific ID. 540 00:29:53,800 --> 00:29:59,800 For example, the first mail from Jocelyn is associated to the ID checkbox 29. 541 00:30:00,780 --> 00:30:05,540 So if I add this ID in the URL, automatically the page will scroll. 542 00:30:07,680 --> 00:30:12,920 Paul Stone showed that actually from the outside frame, the attacker frame, 543 00:30:12,920 --> 00:30:16,220 you can actually know if the targeted website scrolls or not. 544 00:30:17,400 --> 00:30:24,500 And at this point, it breaks the same origin policy because you can know if an element is present on the page or not. 545 00:30:25,020 --> 00:30:29,600 If the page doesn't contain any email, the checkbox element will not be present. 546 00:30:29,740 --> 00:30:30,780 So the page will not scroll. 547 00:30:31,080 --> 00:30:34,220 So we can actually know if there is any email in the inbox or not. 548 00:30:35,300 --> 00:30:42,860 In the following demo, here I will show you how we can actually conduct an attack against the mobile version of Yahoo Mail. 549 00:30:45,220 --> 00:30:48,680 Here you can see the victim inbox containing an email from me. 550 00:30:48,780 --> 00:30:54,080 So if I search for my email, automatically the page will contain the ID checkbox 29. 551 00:30:54,880 --> 00:30:56,740 So we can actually scroll to it. 552 00:30:57,120 --> 00:31:03,240 But if I search for a non-existing sender, the search will be empty. 553 00:31:03,340 --> 00:31:04,960 So the ID will not be present. 554 00:31:05,500 --> 00:31:10,920 We use this binary test to actually search in the inbox 555 00:31:10,920 --> 00:31:12,900 to know if the victim is present or not. 556 00:31:12,920 --> 00:31:14,920 So we can actually know if the victim received email from specific senders. 557 00:31:18,360 --> 00:31:23,700 Here, as you can see, I can know if I received an email from any of you from me. 558 00:31:24,160 --> 00:31:26,280 This is a very serious security breach. 559 00:31:26,580 --> 00:31:36,400 As you can imagine, you can actually know if the victim received an account in a specific bank or other drugs on a specific website, 560 00:31:36,720 --> 00:31:38,060 looking in his inbox. 561 00:31:40,620 --> 00:31:42,900 However, to prevent this kind of attack, 562 00:31:42,920 --> 00:31:45,460 framing attacks like click-jacking and scrolling attacks, 563 00:31:45,800 --> 00:31:49,100 most websites use a specific defense called frame-busting, 564 00:31:49,320 --> 00:31:54,580 which makes a framed page become the top of the page automatically. 565 00:31:55,100 --> 00:31:58,160 However, Facebook uses a slightly different approach. 566 00:31:59,200 --> 00:32:04,300 When framed, Facebook displays a huge dark div on the top of the page, 567 00:32:04,420 --> 00:32:08,220 which prevents the user from interacting with the content. 568 00:32:09,020 --> 00:32:11,940 But he's still able to see his information. 569 00:32:13,500 --> 00:32:16,160 But when you click on this dark div, 570 00:32:16,300 --> 00:32:18,240 automatically the page will frame-bust. 571 00:32:22,080 --> 00:32:25,900 However, it will not prevent us from scrolling to specific IDs. 572 00:32:26,360 --> 00:32:29,800 So we can conduct an attack, a framing attack on Facebook. 573 00:32:30,160 --> 00:32:34,540 Using three different IDs, we can actually know if the user is logged on Facebook, 574 00:32:35,540 --> 00:32:37,840 who he is, and who are his friends. 575 00:32:38,180 --> 00:32:41,320 For example, to know if he's logged or not, 576 00:32:41,320 --> 00:32:44,200 have you any idea for an ID we can try to check? 577 00:32:47,020 --> 00:32:50,620 Actually, we are not searching for a specific ID if he's logged. 578 00:32:50,700 --> 00:32:53,640 We are searching if an ID is not present on the page. 579 00:32:53,900 --> 00:33:00,440 For example, the registration form is shown only on a non-logged page. 580 00:33:00,840 --> 00:33:04,140 So if I frame the first page, it will not scroll, 581 00:33:04,220 --> 00:33:06,740 so I will know that the user is not logged. 582 00:33:07,860 --> 00:33:10,040 So here is the demo. 583 00:33:10,620 --> 00:33:13,900 On the left side, you can see the framing attack result. 584 00:33:14,240 --> 00:33:16,940 And on the right side, what really happened under the hood. 585 00:33:17,120 --> 00:33:20,460 On the real attack, it will be definitely not shown. 586 00:33:22,880 --> 00:33:25,340 Here, as you can see, the page on the right didn't scroll. 587 00:33:25,660 --> 00:33:28,680 So I know that the user is logged. 588 00:33:32,460 --> 00:33:36,220 Here, we are looking for the logged user and the page scrolled. 589 00:33:36,220 --> 00:33:39,940 So we know that the ID we are looking for is not the right one. 590 00:33:40,540 --> 00:33:46,920 If we search for the AD ID, here the page doesn't scroll, 591 00:33:47,100 --> 00:33:48,500 so we know who is logged. 592 00:33:49,260 --> 00:33:53,120 This is basically the same test to know the friendship relation, 593 00:33:54,660 --> 00:33:57,360 but using a different ID to search. 594 00:34:15,940 --> 00:34:21,840 But actually, Facebook updated their defense against this kind of attack. 595 00:34:22,360 --> 00:34:28,940 Just yesterday, well actually Wednesday, Facebook made a different defense. 596 00:34:29,380 --> 00:34:31,640 Now they don't display any contents anymore, 597 00:34:31,840 --> 00:34:35,480 they just display Facebook logo on the framed page. 598 00:34:35,760 --> 00:34:39,260 So we cannot anymore use framing attack on Facebook. 599 00:34:40,480 --> 00:34:42,480 Okay, that's it for this third story. 600 00:34:42,660 --> 00:34:46,720 I will really finish with maybe the more powerful attack in the fourth story. 601 00:34:48,980 --> 00:34:54,740 Okay, so for the last ten minutes, we're going to speak a little bit about this guy, smartphone. 602 00:34:55,180 --> 00:34:56,400 How many of you have a smartphone? 603 00:34:58,160 --> 00:35:00,180 Okay, once again, everyone. Good. 604 00:35:03,160 --> 00:35:06,440 So, I mean, it's not a surprise, it will not come as a surprise to anyone. 605 00:35:07,400 --> 00:35:09,320 A lot of smartphones have been sold. 606 00:35:09,320 --> 00:35:15,320 54 million in this first quarter in 2010, so it's a lot of smartphones. 607 00:35:16,240 --> 00:35:17,460 This has two effects. 608 00:35:17,900 --> 00:35:21,100 The first one is AT&T is not working anymore in San Francisco. 609 00:35:21,640 --> 00:35:29,400 And the second one is many popular websites have rolled out a mobile version of their website 610 00:35:29,400 --> 00:35:32,020 to accommodate this kind of small device. 611 00:35:32,560 --> 00:35:36,640 And people might not realize that by now, 612 00:35:36,760 --> 00:35:39,220 but the browser you have in your iPhone, 613 00:35:39,320 --> 00:35:42,820 or in your Android phone, or Nokia, or Blackberry, 614 00:35:42,880 --> 00:35:47,200 is very, very different from the one you are using on your desktop counterpart. 615 00:35:47,580 --> 00:35:49,980 In particular, because there is a lot of new feature, 616 00:35:50,120 --> 00:35:52,340 which has been added for usability purpose. 617 00:35:52,680 --> 00:35:59,180 The screen is so small that what you try to do is to maximize the space which is used for display. 618 00:35:59,840 --> 00:36:06,080 And this actually conflicts with something we have been used for almost 20 years now, 619 00:36:06,200 --> 00:36:09,300 which is the idea that all the security indicators you have, 620 00:36:09,320 --> 00:36:12,000 in your browser, are located on the top of it, 621 00:36:12,080 --> 00:36:13,260 which is what we call the Chrome. 622 00:36:13,420 --> 00:36:18,320 So privileged version, privileged part of the... 623 00:36:23,380 --> 00:36:23,900 Okay. 624 00:36:25,640 --> 00:36:27,120 Wow. Impressive. 625 00:36:27,900 --> 00:36:28,740 Micro attack. 626 00:36:29,440 --> 00:36:29,960 Okay. 627 00:36:31,180 --> 00:36:33,800 So we try the Chrome. 628 00:36:33,980 --> 00:36:38,660 We really try the Chrome on the browser to display information, 629 00:36:38,660 --> 00:36:41,440 such as the URL that you can't spoof, and the identity. 630 00:36:41,800 --> 00:36:46,240 And the phone, people try to do full usability purpose, 631 00:36:46,540 --> 00:36:50,220 so they are trying to remove as many information which are closer to the screen. 632 00:36:50,740 --> 00:36:54,180 There is also something which makes them very, very different under the hood, 633 00:36:54,260 --> 00:36:57,740 is because phone, you're actually moving from one application to another, 634 00:36:58,080 --> 00:37:01,680 and since Apple did not decide to do multitasking yet, 635 00:37:01,860 --> 00:37:03,340 or to claim, 636 00:37:03,440 --> 00:37:08,640 then the cookie that usually expire when you close your browser, 637 00:37:08,640 --> 00:37:09,760 and the data couldn't write, 638 00:37:10,080 --> 00:37:12,580 do live into the browser forever, 639 00:37:12,860 --> 00:37:14,780 and basically they're not killing session cookie. 640 00:37:16,440 --> 00:37:18,920 So let me show you a demo of what I mean, 641 00:37:19,060 --> 00:37:21,460 because I think it's more visual than... 642 00:37:21,460 --> 00:37:23,720 and it would work a thousand words. 643 00:37:24,300 --> 00:37:26,240 This is Wells Fargo mobile website. 644 00:37:26,360 --> 00:37:27,520 Any Wells Fargo user here? 645 00:37:28,720 --> 00:37:29,200 Okay. 646 00:37:29,360 --> 00:37:30,740 Does it look like the real website? 647 00:37:31,780 --> 00:37:32,840 Completely? Yeah. 648 00:37:32,960 --> 00:37:34,420 And that's the correct ID. 649 00:37:34,660 --> 00:37:37,060 And if you see, the lock is here, 650 00:37:37,060 --> 00:37:39,420 and the URL is correct. 651 00:37:39,520 --> 00:37:40,320 The lock is correct. 652 00:37:40,440 --> 00:37:41,120 There is no warning. 653 00:37:41,340 --> 00:37:44,240 We didn't fake anything on this part of the list. 654 00:37:44,500 --> 00:37:47,080 And look what happened when you click on sign in. 655 00:37:50,860 --> 00:37:51,420 Here you go. 656 00:37:52,680 --> 00:37:53,980 Any idea how we did that? 657 00:37:56,360 --> 00:37:57,400 No fake keyboard. 658 00:37:57,600 --> 00:37:58,920 No, we didn't fake the keyboard. 659 00:37:59,080 --> 00:38:01,860 That's a capture of a real Android keyboard. 660 00:38:04,020 --> 00:38:05,620 Yeah, you get the correct idea. 661 00:38:05,620 --> 00:38:07,740 The problem with the phone, 662 00:38:07,980 --> 00:38:09,640 and I think if I show you this picture, 663 00:38:09,760 --> 00:38:11,420 people will see better what I mean, 664 00:38:11,600 --> 00:38:13,760 is actually we can draw an image 665 00:38:13,760 --> 00:38:15,120 which looks like a URL bar, 666 00:38:15,320 --> 00:38:16,180 which is not one, 667 00:38:16,280 --> 00:38:18,180 and actually we can use the usability feature 668 00:38:18,180 --> 00:38:19,780 to scroll to it. 669 00:38:19,940 --> 00:38:21,100 That is not our idea. 670 00:38:21,340 --> 00:38:22,840 It was in the paper. 671 00:38:22,900 --> 00:38:24,080 When we come up with the idea, 672 00:38:24,220 --> 00:38:25,920 we look back in the reference literature, 673 00:38:26,180 --> 00:38:28,040 and actually there is a paper two years ago. 674 00:38:28,140 --> 00:38:30,020 We say it would be very, very dangerous, 675 00:38:30,080 --> 00:38:31,760 and I think no one pays attention to it. 676 00:38:32,140 --> 00:38:34,480 I hope people will start to pay attention to that, 677 00:38:34,500 --> 00:38:35,240 and that's really... 678 00:38:35,660 --> 00:38:38,340 I mean, that's the most easy attack to do, right? 679 00:38:38,420 --> 00:38:39,600 You can display any website. 680 00:38:39,720 --> 00:38:40,540 We choose WebFago. 681 00:38:40,660 --> 00:38:41,980 We can choose Gmail, whatever. 682 00:38:42,300 --> 00:38:43,300 So there's a scrolling attack. 683 00:38:44,000 --> 00:38:46,480 What we want to show you is tap jacking. 684 00:38:46,560 --> 00:38:47,920 So what is a tap jacking? 685 00:38:48,100 --> 00:38:51,420 Well, you take a click jacking, 686 00:38:51,780 --> 00:38:52,980 you take the mobile phone, 687 00:38:53,040 --> 00:38:54,980 you squish very, very hard, 688 00:38:55,080 --> 00:38:58,360 and bam, you have tap jacking. 689 00:38:58,640 --> 00:39:02,400 And tap jacking is actually click jacking on a phone 690 00:39:02,400 --> 00:39:03,860 for a very, very good reason. 691 00:39:05,260 --> 00:39:10,080 Six months ago, we looked at how many websites 692 00:39:10,080 --> 00:39:13,020 are using frame-busting defense against click jacking, 693 00:39:13,100 --> 00:39:17,080 and this is the desktop part of this website, 694 00:39:17,260 --> 00:39:19,620 and you see that people are kind of doing a good job. 695 00:39:19,820 --> 00:39:21,540 Can you guess how many websites are using 696 00:39:22,460 --> 00:39:24,320 click jacking defense on their mobile site? 697 00:39:25,000 --> 00:39:25,400 One. 698 00:39:26,340 --> 00:39:26,740 Two. 699 00:39:28,660 --> 00:39:30,320 Like this, right? 700 00:39:30,860 --> 00:39:32,480 Yeah, that's Twitter and Facebook, 701 00:39:32,520 --> 00:39:34,400 because we went to them and knocked on their door. 702 00:39:35,240 --> 00:39:36,720 And say, hey, you should do something. 703 00:39:38,380 --> 00:39:41,220 Actually, how many of you remember the worm on Twitter 704 00:39:41,220 --> 00:39:44,420 which was in May 2009 where we actually had this thing 705 00:39:44,420 --> 00:39:45,780 which is a do not click here, 706 00:39:45,920 --> 00:39:47,880 and you try the user to disobey and click here, 707 00:39:48,000 --> 00:39:49,980 and generating more and more tweets? 708 00:39:50,160 --> 00:39:50,960 Do you remember this one? 709 00:39:51,520 --> 00:39:52,220 It was a huge one. 710 00:39:52,320 --> 00:39:55,380 We actually took down Twitter for at least a day. 711 00:39:55,980 --> 00:39:58,120 We were able to actually reproduce it on the phone. 712 00:39:59,660 --> 00:40:00,300 Here's the demo. 713 00:40:00,620 --> 00:40:02,620 And what happened here under the hood is 714 00:40:02,620 --> 00:40:04,300 you have an invisible iframe, 715 00:40:05,240 --> 00:40:07,300 and we are using a very cool feature from the phone, 716 00:40:07,400 --> 00:40:07,940 which is zooming. 717 00:40:08,280 --> 00:40:10,840 So basically, the tweet button is actually the entire screen. 718 00:40:11,200 --> 00:40:12,820 So it doesn't matter where you click. 719 00:40:12,900 --> 00:40:14,480 You're actually clicking on I want to tweet, 720 00:40:14,600 --> 00:40:16,240 and you're going to tweet something for us, 721 00:40:16,300 --> 00:40:17,120 and you don't see it. 722 00:40:17,540 --> 00:40:19,020 So if you go to Twitter.com, 723 00:40:21,160 --> 00:40:22,460 and we're not picking that up, 724 00:40:25,680 --> 00:40:26,920 we go to the mobile website, 725 00:40:27,020 --> 00:40:28,060 because at that time, 726 00:40:28,160 --> 00:40:29,320 they didn't have a frame-busting defense. 727 00:40:29,600 --> 00:40:31,060 We were able to do a tab jacking. 728 00:40:31,160 --> 00:40:31,920 Of course, we could have said, 729 00:40:32,060 --> 00:40:33,560 do not click on this link. 730 00:40:33,560 --> 00:40:34,560 Show us a game. 731 00:40:34,600 --> 00:40:35,240 Click on it, 732 00:40:35,340 --> 00:40:36,280 and do a worm. 733 00:40:36,380 --> 00:40:37,360 Of course, we're good guys. 734 00:40:37,400 --> 00:40:38,020 We didn't do that. 735 00:40:38,120 --> 00:40:39,160 So that was a tab jacking. 736 00:40:41,340 --> 00:40:43,980 Twitter was really, really efficient to fix that code, 737 00:40:44,060 --> 00:40:45,460 so now they have a frame-busting code, 738 00:40:45,580 --> 00:40:46,440 so this worm is safe. 739 00:40:46,580 --> 00:40:49,440 But I really hope that you will try to scroll up 740 00:40:49,860 --> 00:40:51,460 when you try to log to your bank 741 00:40:51,460 --> 00:40:52,540 and realize that, actually, 742 00:40:52,620 --> 00:40:53,580 if someone is using JavaScript, 743 00:40:53,780 --> 00:40:54,920 it will prevent you to do that. 744 00:40:55,680 --> 00:40:57,460 So it's kind of a plus right now. 745 00:40:59,040 --> 00:41:00,540 If I have two more minutes, 746 00:41:00,600 --> 00:41:01,460 what I want to show you 747 00:41:01,460 --> 00:41:02,520 is what we're going to demo. 748 00:41:02,520 --> 00:41:03,800 We're going to demo Sunday. 749 00:41:04,060 --> 00:41:05,140 Sunday, we have another talk. 750 00:41:05,280 --> 00:41:06,660 We hope you're going to join us. 751 00:41:06,760 --> 00:41:08,400 We're going to speak about game security 752 00:41:08,400 --> 00:41:10,360 and to show you how cool it is. 753 00:41:10,720 --> 00:41:12,480 Here is my invincible tank. 754 00:41:12,680 --> 00:41:13,720 You can see he's . 755 00:41:14,280 --> 00:41:15,360 And we're going to show you 756 00:41:15,360 --> 00:41:17,920 how we can do attack on a game 757 00:41:18,800 --> 00:41:20,080 on Friday afternoon. 758 00:41:20,380 --> 00:41:21,760 So I hope you will stay at DEF CON 759 00:41:21,760 --> 00:41:22,860 and come to see us. 760 00:41:23,260 --> 00:41:23,840 Track five. 761 00:41:24,380 --> 00:41:25,620 Thanks, everyone, for showing us.