1 00:00:00,000 --> 00:00:02,900 All right. Thank you very much, everybody, for coming. 2 00:00:03,660 --> 00:00:07,040 We have a lot of slides, so we're going to go right into it. 3 00:00:07,580 --> 00:00:14,680 My name is Wayne Huang, and we have our colleague, Roman, with us, Fernandez. 4 00:00:15,780 --> 00:00:20,120 We work for Armorize Technologies. I'm co-founder and CTO to Armorize Technologies. 5 00:00:21,380 --> 00:00:28,720 So today we're going to be talking about dry exploit, circumventing automated and manual detection of browser exploits. 6 00:00:28,720 --> 00:00:33,620 What's up there is the Chinese wording for drive-by-download, 7 00:00:33,760 --> 00:00:40,540 which actually existed for many years before the term drive-by-download came about, 8 00:00:40,720 --> 00:00:45,320 because this type of attack was quite prevalent in Asia. 9 00:00:47,920 --> 00:00:52,780 I was doing research. I was doing black box scanners at that time, 10 00:00:52,860 --> 00:00:58,480 and we weren't able to crawl a lot of the web pages because of the dynamic contents, 11 00:00:58,720 --> 00:00:59,960 so we started to embed IE. 12 00:01:00,640 --> 00:01:04,680 And we wanted to have mass crawling and SQL injection results. 13 00:01:05,760 --> 00:01:13,400 We had many crawlers crawl for many days, and then the end result was all of the boxes ended up with malware in it. 14 00:01:14,420 --> 00:01:16,540 We're like, oh my gosh, so what happened? 15 00:01:16,700 --> 00:01:22,160 So actually, we submitted a paper to the WWW conference in 2002. 16 00:01:22,920 --> 00:01:27,680 In the paper, we described how we embedded IE, and because we had to embed IE, 17 00:01:27,780 --> 00:01:28,620 we had to CMS. 18 00:01:28,720 --> 00:01:35,660 We had to embed box IE in order to prevent these exploits from attacking our IE. 19 00:01:36,380 --> 00:01:40,520 So that was how this technology started. 20 00:01:41,180 --> 00:01:43,580 The slides are not in your CD. I apologize. 21 00:01:44,820 --> 00:01:50,560 It's right now on Slideshare, so if you go to www.drivesploit.org, 22 00:01:51,380 --> 00:01:54,320 or you follow the Twitter, you can download it right now. 23 00:01:55,560 --> 00:01:58,400 So today we're going to be showing one type of browser exploit, 24 00:01:58,720 --> 00:02:00,760 which is the drive-by-downloads. 25 00:02:00,880 --> 00:02:02,200 Let's define that. 26 00:02:03,820 --> 00:02:07,680 So hackers distribute malware by poisoning legitimate websites, 27 00:02:08,720 --> 00:02:17,220 and what's typical is they inject malicious iframes into legitimate HTML content. 28 00:02:19,540 --> 00:02:24,120 And the affected websites essentially become a delivery mechanism for malware. 29 00:02:25,700 --> 00:02:27,200 They appear normal, 30 00:02:27,200 --> 00:02:30,920 and the victims do not need to click or agree to anything, 31 00:02:31,940 --> 00:02:37,000 and simply connecting to the infected website executes the attack. 32 00:02:38,340 --> 00:02:41,640 Recent incidents include the Aurora incident, 33 00:02:41,880 --> 00:02:49,300 which began sometime in June last year until February of this year, 34 00:02:49,420 --> 00:02:55,000 when Google reported and the news went to the media. 35 00:02:55,560 --> 00:02:57,180 It was a targeted attack. 36 00:02:57,200 --> 00:02:59,360 It used the IE zero-day, 37 00:02:59,520 --> 00:03:04,180 and it was confirmed publicly by Google, Adobe, Juniper Networks, and Rackspace, 38 00:03:04,400 --> 00:03:09,960 and a total of 34 organizations were targeted, according to coverage on media. 39 00:03:10,840 --> 00:03:14,020 A recent one, DNF666. 40 00:03:14,580 --> 00:03:19,180 If you haven't heard of this, you can go to our blog, just Google for the keyword. 41 00:03:19,780 --> 00:03:24,440 It started since March 2010, initially leveraging Adobe zero-day. 42 00:03:25,040 --> 00:03:27,140 The victims included Wall Street Journal, 43 00:03:27,140 --> 00:03:28,440 Jerusalem Post, 44 00:03:28,740 --> 00:03:37,400 and then we later found out that all of that effort was just to steal accounts to online games in Asia. 45 00:03:37,760 --> 00:03:42,920 So the second wave and the third wave targeted only Asian websites, 46 00:03:43,200 --> 00:03:46,780 while the first wave hit Wall Street Journal and Jerusalem Post. 47 00:03:48,360 --> 00:03:50,760 And it happened to CNN, 48 00:03:51,500 --> 00:03:52,220 GameSpot, 49 00:03:52,360 --> 00:03:53,140 US Treasury, 50 00:03:53,520 --> 00:03:54,500 Sony PlayStation, 51 00:03:55,040 --> 00:03:56,100 Washington Post, 52 00:03:56,100 --> 00:03:57,020 and Post in the past. 53 00:03:57,840 --> 00:04:00,360 So let's dissect drive-by downloads. 54 00:04:00,660 --> 00:04:02,340 What happens is very simple. 55 00:04:03,640 --> 00:04:07,060 The visitor links to an exploit server. 56 00:04:07,920 --> 00:04:11,240 The exploit server serves him a legitimate page, 57 00:04:12,080 --> 00:04:14,520 but it includes a browser exploit, 58 00:04:14,860 --> 00:04:18,420 and also a payload, or what we call a downloader. 59 00:04:19,020 --> 00:04:23,140 The exploit in this part is usually obfuscated. 60 00:04:23,140 --> 00:04:26,580 So when it executes, it will deobfuscate itself. 61 00:04:27,740 --> 00:04:29,380 And then it will exploit the browser. 62 00:04:32,440 --> 00:04:38,320 And at this time, the dropper will execute, which is the payload or the show code. 63 00:04:39,300 --> 00:04:43,480 And it will cause the browser to link back to the malware server. 64 00:04:45,960 --> 00:04:49,340 And the malware server, which is usually different from the exploit server, 65 00:04:50,260 --> 00:04:51,940 will distribute malware back. 66 00:04:55,220 --> 00:04:58,340 And then finally, the malware will link to a CNC. 67 00:05:00,640 --> 00:05:02,660 And that's basically the attack. 68 00:05:02,780 --> 00:05:03,400 It's very simple. 69 00:05:03,620 --> 00:05:07,240 But now the key is, who would visit an exploit server? 70 00:05:07,520 --> 00:05:08,280 Nobody would. 71 00:05:08,500 --> 00:05:10,040 So the key here is traffic. 72 00:05:10,160 --> 00:05:14,140 And actually, why these two servers are usually separate is because, 73 00:05:15,040 --> 00:05:17,440 at least in Asia, it's two ecosystems. 74 00:05:17,920 --> 00:05:21,100 There are people, there are groups responsible for developing browsers, 75 00:05:21,100 --> 00:05:25,400 and then developing the browser exploits. 76 00:05:25,420 --> 00:05:30,980 And then there are groups responsible for getting traffic to the exploit servers. 77 00:05:31,300 --> 00:05:36,500 And then there are groups responsible for developing the actual malware, 78 00:05:36,720 --> 00:05:40,100 which is quite hard, because that malware has to bypass antivirus. 79 00:05:42,960 --> 00:05:46,420 And so what happens is you would typically, 80 00:05:46,780 --> 00:05:50,500 the attacker would try to infect one of the very high traffic websites, 81 00:05:50,500 --> 00:05:52,560 what Google calls the landing website. 82 00:05:52,900 --> 00:05:56,280 And then so from there delivers a URL generator, 83 00:05:56,700 --> 00:06:04,340 which is a piece of JavaScript that generates iframes or JavaScript sources, typically. 84 00:06:05,280 --> 00:06:10,660 And this iframe would then cause the browser to start loading content from the exploit server. 85 00:06:13,240 --> 00:06:16,260 Recent incidents, DNF666. 86 00:06:16,720 --> 00:06:19,500 And then in May to June, 87 00:06:21,140 --> 00:06:24,700 there was mass shared hosting compromise, 88 00:06:25,360 --> 00:06:29,900 which included GoDaddy, Rackspace, Network Solutions, Bluehost, and Dreamhost. 89 00:06:30,120 --> 00:06:32,140 Some of these, after being compromised, 90 00:06:32,480 --> 00:06:34,560 wasn't used to serve drive-by-downloads, 91 00:06:34,560 --> 00:06:38,960 but instead other types of malware such as fake antivirus. 92 00:06:39,160 --> 00:06:44,900 But some were, after compromise, were serving drive-by-downloads. 93 00:06:45,380 --> 00:06:48,320 And then this is a part of a very typical 94 00:06:48,320 --> 00:06:50,080 continuous targeted attack, 95 00:06:51,140 --> 00:06:53,660 the same incidents to Aurora, 96 00:06:53,980 --> 00:06:57,160 that basically is a persistent threat. 97 00:06:57,400 --> 00:06:58,960 That's a continuous threat. 98 00:07:00,180 --> 00:07:02,020 And when this happens nowadays, 99 00:07:02,400 --> 00:07:04,460 it's very hard to remove, 100 00:07:05,160 --> 00:07:07,800 because a lot of times the URL generator 101 00:07:09,140 --> 00:07:15,440 is inserted not into just a plain PHP file, 102 00:07:15,440 --> 00:07:20,740 but it would disguise itself as a legitimate WordPress or Joomla file, 103 00:07:20,920 --> 00:07:27,560 or it would insert itself into a WordPress stored procedure 104 00:07:28,200 --> 00:07:30,680 or somewhere in the Joomla database. 105 00:07:31,100 --> 00:07:33,340 And it's going to take you a lot of time 106 00:07:33,340 --> 00:07:35,900 and a lot of SQL commands to dig that out. 107 00:07:36,780 --> 00:07:38,720 And all throughout this time, 108 00:07:38,820 --> 00:07:41,200 you wouldn't know how to remove that malicious iframe 109 00:07:41,200 --> 00:07:43,180 or malicious JavaScript from your website. 110 00:07:43,360 --> 00:07:44,460 And that makes you look very bad. 111 00:07:47,700 --> 00:07:50,820 And that was all we've talked about so far 112 00:07:50,820 --> 00:07:54,880 is only one type of malicious JavaScript injection, 113 00:07:55,220 --> 00:07:58,640 and that is when they physically tamper your data. 114 00:07:59,380 --> 00:08:02,620 Another type is when they don't physically tamper your data. 115 00:08:04,200 --> 00:08:09,320 Typically what happened for many years in the past in Asia 116 00:08:09,320 --> 00:08:15,060 is attacks coupled with ARP spoofing. 117 00:08:15,060 --> 00:08:20,260 So, for example, the ZxARPs tool is very, very mature, very robust. 118 00:08:21,920 --> 00:08:25,140 If the attacker is able to compromise other machines 119 00:08:25,140 --> 00:08:29,620 on the same lane segment as your web server, 120 00:08:30,040 --> 00:08:32,780 they may not choose to infect the web server directly, 121 00:08:33,000 --> 00:08:37,100 because then it's very easy for you to find the injection and fix it. 122 00:08:37,280 --> 00:08:41,280 They would compromise another machine that can do ARP spoofing 123 00:08:41,280 --> 00:08:44,260 and then would use a tool like ZxARPs 124 00:08:44,260 --> 00:08:46,720 to act as main in the middle, 125 00:08:47,340 --> 00:08:50,220 and then it would become the main in the middle, 126 00:08:50,360 --> 00:08:54,920 and then it would just basically be passing traffic through, 127 00:08:55,100 --> 00:08:59,160 but for every HTTP response that it gets from the server, 128 00:08:59,440 --> 00:09:03,760 it would inject a malicious script or iframe and then pass it back. 129 00:09:04,260 --> 00:09:10,100 So in that case, your visitors tell you that your website is compromised, 130 00:09:10,420 --> 00:09:12,340 you go in, you dig the database, you dig the files, 131 00:09:12,400 --> 00:09:13,120 you don't find anything. 132 00:09:13,120 --> 00:09:15,120 Well, because they haven't tampered anything. 133 00:09:16,060 --> 00:09:22,900 In March 2009, what happened was websites like tw.msn.com 134 00:09:22,900 --> 00:09:26,660 and taiwan.cine.com and other sites 135 00:09:30,020 --> 00:09:33,420 was attacked and embedded with malicious content, 136 00:09:33,660 --> 00:09:36,700 and down there you can see a Cisco advisory regarding it. 137 00:09:36,860 --> 00:09:41,920 The incident lasted a total of 12 days before it was totally contained, 138 00:09:41,920 --> 00:09:44,200 because what happened, as we figured out, 139 00:09:44,300 --> 00:09:46,760 was the injection was in the middle of the route. 140 00:09:47,360 --> 00:09:51,520 So it wasn't on the lane, it wasn't on the web server itself, 141 00:09:51,840 --> 00:09:59,540 but it was on one vendor's equipment that was a layer 47 equipment 142 00:09:59,540 --> 00:10:01,660 in the middle of the route that was compromised 143 00:10:01,660 --> 00:10:04,440 and that was used to inject the iframes. 144 00:10:04,660 --> 00:10:07,920 So this is the second type of this type of attack. 145 00:10:08,900 --> 00:10:10,780 So now we're going to do a live demo. 146 00:10:12,520 --> 00:10:18,780 Using DIG, using a persistent cross-site scripting vulnerability in DIG. 147 00:10:20,100 --> 00:10:22,540 They have fixed this vulnerability already, 148 00:10:22,820 --> 00:10:27,380 but our link is still there. 149 00:10:27,600 --> 00:10:32,660 So let's go to DIG first. 150 00:10:34,500 --> 00:10:36,240 Firefox, where are you? 151 00:10:42,000 --> 00:10:43,800 Oh, lovely Firefox. 152 00:10:47,560 --> 00:10:50,800 Okay, there we go. Safari. 153 00:10:51,440 --> 00:10:59,880 Okay, so usually when you view one of the DIG pages, 154 00:11:00,280 --> 00:11:01,680 what you see is this. 155 00:11:02,720 --> 00:11:09,460 You would see the DIG link and the description 156 00:11:09,460 --> 00:11:13,300 and people who dug it, this kind of thing. 157 00:11:13,980 --> 00:11:22,400 But let's look at the source code. 158 00:11:36,060 --> 00:11:37,620 There we go. 159 00:11:43,420 --> 00:11:46,540 And here you would see that... 160 00:11:49,240 --> 00:11:54,760 Let me just zoom it for you because the room is so big. 161 00:11:55,320 --> 00:11:59,260 That includes www.zcrack.org slash g. 162 00:12:00,500 --> 00:12:06,560 And it's included as an iframe source, right, as you see here, 163 00:12:06,660 --> 00:12:07,360 which shouldn't happen. 164 00:12:07,360 --> 00:12:09,120 So it's a very simple... 165 00:12:09,960 --> 00:12:13,300 It's a very simple persistent cross-site scripting 166 00:12:13,300 --> 00:12:15,160 that exists in DIG. 167 00:12:15,860 --> 00:12:19,300 And the attacker, who is us for the demo, 168 00:12:20,200 --> 00:12:23,220 has used that to inject that iframe. 169 00:12:23,580 --> 00:12:28,840 So let's start our DriveSploit. 170 00:12:35,660 --> 00:12:36,480 Okay. 171 00:12:40,660 --> 00:12:41,480 So... 172 00:12:44,510 --> 00:12:47,260 So we've implemented the DriveSploit framework 173 00:12:47,260 --> 00:12:48,620 on top of Metasploit. 174 00:12:49,490 --> 00:12:51,860 So now I'm starting Metasploit. 175 00:12:52,820 --> 00:12:54,220 It's a little smaller. 176 00:13:01,780 --> 00:13:03,720 And let's... 177 00:13:03,720 --> 00:13:04,820 Sorry. 178 00:13:07,300 --> 00:13:08,680 Exploit. 179 00:13:12,480 --> 00:13:16,200 And let's go to... 180 00:13:23,220 --> 00:13:25,260 The victim machine. 181 00:13:29,180 --> 00:13:30,500 Visit the DIG URL. 182 00:13:43,880 --> 00:13:44,480 Okay. 183 00:13:44,580 --> 00:13:45,480 So as you can see, 184 00:13:47,760 --> 00:13:48,720 Metasploit is serving, 185 00:13:48,880 --> 00:13:53,540 and we've chosen to use Meterpreter as the payload. 186 00:13:54,660 --> 00:13:58,820 And now Meterpreter is starting to work. 187 00:13:58,820 --> 00:14:00,840 We're putting a new process in Notepad 188 00:14:00,840 --> 00:14:03,740 and migrating itself into Notepad. 189 00:14:04,180 --> 00:14:05,260 It's completed. 190 00:14:08,680 --> 00:14:09,320 Okay. 191 00:14:09,480 --> 00:14:11,840 So as you can see, the Internet Explorer is gone. 192 00:14:12,880 --> 00:14:13,400 But... 193 00:14:16,380 --> 00:14:18,100 We now have an open session. 194 00:14:20,740 --> 00:14:21,840 Connect to it. 195 00:14:22,800 --> 00:14:24,140 See all the processes. 196 00:14:24,500 --> 00:14:27,360 So we basically have now a shell 197 00:14:27,360 --> 00:14:29,880 into the victim's system. 198 00:14:31,120 --> 00:14:32,520 So let's just kill ourselves. 199 00:14:33,120 --> 00:14:35,500 And it's attached to actually another process. 200 00:14:35,740 --> 00:14:37,240 Notepad.exe. 201 00:14:37,280 --> 00:14:40,900 So that even though IE is dead, 202 00:14:41,040 --> 00:14:41,960 it's all right. 203 00:14:49,100 --> 00:14:50,380 So I'll kill myself. 204 00:14:55,200 --> 00:14:55,880 Okay. 205 00:14:55,880 --> 00:15:00,080 So that's basically a very simple demonstration 206 00:15:00,880 --> 00:15:04,080 of a typical drive-by-download process. 207 00:15:04,840 --> 00:15:06,320 So what happened was 208 00:15:07,540 --> 00:15:10,440 DIG had a persistent cross-site scripting vulnerability. 209 00:15:10,640 --> 00:15:13,400 The attacker used that to inject the iframe. 210 00:15:13,820 --> 00:15:15,700 And in the backend, 211 00:15:15,900 --> 00:15:18,660 Metasploit or DriveSploit was used 212 00:15:18,660 --> 00:15:21,800 to serve the JavaScript exploit. 213 00:15:23,280 --> 00:15:23,960 Okay. 214 00:15:23,960 --> 00:15:25,880 The motivation behind building this. 215 00:15:26,580 --> 00:15:27,340 We provide... 216 00:15:27,340 --> 00:15:29,460 Armorize provides solutions that monitors websites 217 00:15:29,460 --> 00:15:31,820 and detect malicious content 24 by 7. 218 00:15:32,020 --> 00:15:34,140 We use multiple behavior, heuristic, 219 00:15:34,220 --> 00:15:35,620 and signature-based technologies. 220 00:15:37,000 --> 00:15:39,500 Most technologies are developed on our own. 221 00:15:39,720 --> 00:15:42,360 But we also integrate in a virus 222 00:15:42,960 --> 00:15:46,540 because behavior-based technologies that we use 223 00:15:46,540 --> 00:15:47,840 are very, very costly. 224 00:15:48,060 --> 00:15:50,780 And when you have to scan millions and millions of URLs a day, 225 00:15:50,940 --> 00:15:53,780 you end up paying hosting companies, 226 00:15:53,780 --> 00:15:55,200 a whole bunch of money. 227 00:15:55,460 --> 00:15:59,020 So we started a while back 228 00:15:59,640 --> 00:16:02,900 looking if we can find some antivirus solutions 229 00:16:03,520 --> 00:16:05,880 that can be coupled with our behavior analysis. 230 00:16:06,360 --> 00:16:08,120 But they're very, very expensive. 231 00:16:10,000 --> 00:16:15,260 And so we spent a lot of time testing our own technologies 232 00:16:15,260 --> 00:16:17,360 and also selecting antivirus technologies. 233 00:16:17,880 --> 00:16:20,280 And the key is how good are... 234 00:16:20,280 --> 00:16:22,480 The key to this type of testing is 235 00:16:22,480 --> 00:16:24,660 how good are we and them 236 00:16:24,660 --> 00:16:27,820 at detecting new drive-by downloads 237 00:16:28,480 --> 00:16:29,620 instead of old ones. 238 00:16:29,800 --> 00:16:32,780 But how do you get new drive-by downloads that don't exist? 239 00:16:33,120 --> 00:16:34,120 That's the problem. 240 00:16:34,800 --> 00:16:38,940 So we ended up getting the old exploits 241 00:16:38,940 --> 00:16:42,860 and then mutating them by hand 242 00:16:43,480 --> 00:16:45,960 to generate new exploits 243 00:16:45,960 --> 00:16:50,040 and then testing out all these antivirus technologies in our own. 244 00:16:50,220 --> 00:16:52,200 And we ended up 245 00:16:52,480 --> 00:16:53,940 writing big messes of code. 246 00:16:54,160 --> 00:16:55,500 It was very hard to debug. 247 00:16:56,040 --> 00:16:58,040 And it was just taking us a lot of time. 248 00:16:58,440 --> 00:17:00,520 So we needed a good framework to help us 249 00:17:00,520 --> 00:17:04,260 replicate, manipulate, and mutate exploits found in the wild. 250 00:17:04,780 --> 00:17:06,700 Note we didn't say obfuscate. 251 00:17:07,220 --> 00:17:08,060 There's a difference. 252 00:17:08,240 --> 00:17:09,820 Because when we say mutate, 253 00:17:09,860 --> 00:17:14,140 we're changing the raw, basic JavaScript exploit 254 00:17:14,140 --> 00:17:15,440 in its raw form 255 00:17:16,100 --> 00:17:17,940 and not in its obfuscated form 256 00:17:18,480 --> 00:17:19,600 into new derivatives. 257 00:17:19,600 --> 00:17:23,700 So DriveSploit is born on top of Metasploit. 258 00:17:25,720 --> 00:17:26,820 Initial findings. 259 00:17:27,140 --> 00:17:29,660 Antivirus capabilities differ greatly. 260 00:17:30,160 --> 00:17:33,800 Desktop and API versions differ greatly in performance. 261 00:17:33,960 --> 00:17:36,620 Meaning that an antivirus technology 262 00:17:36,620 --> 00:17:39,940 which really performs well 263 00:17:39,940 --> 00:17:41,860 for its desktop version 264 00:17:41,860 --> 00:17:43,880 may perform very poorly 265 00:17:43,880 --> 00:17:45,800 for its API version 266 00:17:45,800 --> 00:17:47,600 which is the version that we want to use. 267 00:17:47,780 --> 00:17:48,160 Right? 268 00:17:48,160 --> 00:17:50,120 It's basically a library or a console 269 00:17:50,840 --> 00:17:54,000 or an API for us to call. 270 00:17:54,660 --> 00:17:57,100 And also cost is not equal to performance. 271 00:17:59,360 --> 00:18:01,840 Surprisingly, the most expensive ones 272 00:18:01,840 --> 00:18:04,660 may not be the ones with the best performance 273 00:18:04,660 --> 00:18:06,220 at least according to our testing. 274 00:18:08,900 --> 00:18:11,520 And so antivirus versus drive-by downloads. 275 00:18:13,860 --> 00:18:16,900 So we ended up getting quite confused 276 00:18:16,900 --> 00:18:20,080 and we started calling these antivirus companies 277 00:18:20,080 --> 00:18:21,180 and we were like, 278 00:18:22,000 --> 00:18:24,100 you know, the results don't make sense, 279 00:18:24,260 --> 00:18:24,740 blah, blah, blah. 280 00:18:24,780 --> 00:18:25,820 And they're like, well, what are you testing? 281 00:18:25,980 --> 00:18:26,820 Well, we're testing JavaScript. 282 00:18:27,340 --> 00:18:28,960 And then they don't want to answer the call. 283 00:18:29,340 --> 00:18:32,320 And we call again and we're testing JavaScript. 284 00:18:32,760 --> 00:18:36,140 Well, you know, can you give us some explanation? 285 00:18:36,400 --> 00:18:37,760 Well, JavaScript is sissy stuff. 286 00:18:38,160 --> 00:18:38,560 You know? 287 00:18:40,260 --> 00:18:43,040 So JavaScript to them is not hardcore stuff. 288 00:18:43,180 --> 00:18:44,500 Maybe it's true, right? 289 00:18:44,600 --> 00:18:45,380 I mean, yeah. 290 00:18:45,380 --> 00:18:48,980 PEs and everything and assembly, these are very hard. 291 00:18:49,160 --> 00:18:51,420 But unfortunately, we have to deal with JavaScript 292 00:18:51,420 --> 00:18:52,840 when we deal with drive-by-download. 293 00:18:53,580 --> 00:18:55,460 And so according to their explanation, 294 00:18:56,460 --> 00:19:00,500 as you can see, in our drive-by-download process, 295 00:19:00,780 --> 00:19:01,900 the URL generator is JavaScript. 296 00:19:02,220 --> 00:19:02,900 The exploit is JavaScript. 297 00:19:03,360 --> 00:19:06,200 The malware itself is the PE binary. 298 00:19:06,980 --> 00:19:09,560 And they'll say, and this is why they said, 299 00:19:09,680 --> 00:19:12,220 well, you know, we'll detect this part. 300 00:19:12,520 --> 00:19:15,360 So during the drive-by-download detection process, 301 00:19:15,380 --> 00:19:20,900 in the end, that's going to exist and we're going to detect that. 302 00:19:21,140 --> 00:19:23,060 But unfortunately, that's not the case. 303 00:19:23,220 --> 00:19:23,560 Why? 304 00:19:23,680 --> 00:19:28,580 Because usually a malicious domain serving that piece of malware 305 00:19:28,580 --> 00:19:30,460 is going to be taken down two, three days later. 306 00:19:30,700 --> 00:19:33,360 But the injected domain, such as dig.com, 307 00:19:33,640 --> 00:19:36,100 the injection is still going to be there for a long time. 308 00:19:36,280 --> 00:19:39,980 And although that piece of malware is not valid anymore, 309 00:19:40,180 --> 00:19:43,500 is not active anymore, we still want to be able to detect that. 310 00:19:44,320 --> 00:19:49,200 The other thing is, nowadays, a lot of DNS, a lot of ISPs, 311 00:19:49,280 --> 00:19:52,940 when they find out that that domain is malicious and serving malware, 312 00:19:53,180 --> 00:19:56,380 would block that domain, even though that domain is still active. 313 00:19:56,700 --> 00:20:00,140 And then sometimes it's just in the economy, 314 00:20:00,280 --> 00:20:02,320 the subscription period is over. 315 00:20:02,420 --> 00:20:05,340 You paid us to serve for two days. 316 00:20:06,440 --> 00:20:07,740 It's now past the period. 317 00:20:07,900 --> 00:20:10,120 You haven't paid up, so we're temporarily shutting it down. 318 00:20:10,280 --> 00:20:12,880 That doesn't mean that we're not going to reopen again. 319 00:20:12,880 --> 00:20:16,160 And so we want to focus on all of the JavaScript. 320 00:20:18,700 --> 00:20:21,420 And that's why we can't just rely on PE detection. 321 00:20:23,080 --> 00:20:25,820 So the deal here is ECMA scripts, 322 00:20:26,080 --> 00:20:29,600 which is JavaScript, VBScript, AdobeJS, and ActionScript. 323 00:20:31,300 --> 00:20:33,480 And so we want to take this part out. 324 00:20:34,400 --> 00:20:39,620 We want to take this part out and replace the exploit server with Metasploit 325 00:20:40,320 --> 00:20:44,540 and use Maturbator or something similar as Payload, 326 00:20:44,700 --> 00:20:46,420 which basically does memory injection. 327 00:20:47,000 --> 00:20:52,820 Instead of trying to download a piece of malware and writing it to disk 328 00:20:52,820 --> 00:20:54,780 and have that malware do the malicious stuff, 329 00:20:55,000 --> 00:21:00,640 we want a payload such as Maturbator, which also exists in the wild. 330 00:21:01,240 --> 00:21:03,580 And so that we can test this out, 331 00:21:03,680 --> 00:21:07,840 and we can test out the abilities of technologies just detecting 332 00:21:07,840 --> 00:21:09,460 the injected malware. 333 00:21:09,620 --> 00:21:11,640 And we can also test out JavaScript or the JavaScript exploits. 334 00:21:13,820 --> 00:21:16,300 So drive-by-downloads, what do they want to do? 335 00:21:16,560 --> 00:21:18,880 They want to avoid detection at the victim's desktop. 336 00:21:19,120 --> 00:21:21,440 They also want to avoid detection by UTM's gateways. 337 00:21:21,600 --> 00:21:24,380 And they also want to avoid detection by automated monitors, 338 00:21:24,720 --> 00:21:29,880 which are services like those that we provide or live for as long 339 00:21:29,880 --> 00:21:32,520 and they basically want to live for as long as possible. 340 00:21:34,540 --> 00:21:35,580 So conclusion. 341 00:21:37,020 --> 00:21:38,000 What are we going to do? 342 00:21:38,000 --> 00:21:39,220 First, reduce exposure. 343 00:21:40,160 --> 00:21:42,000 And you do that by selectively. 344 00:21:43,100 --> 00:21:44,060 Serve selectively. 345 00:21:44,540 --> 00:21:48,460 For example, you can serve to each IP only once. 346 00:21:48,600 --> 00:21:50,400 You lock the IP that you've served to. 347 00:21:50,600 --> 00:21:54,900 Because if a visitor visits you for the first time 348 00:21:54,900 --> 00:21:57,420 and your exploit doesn't succeed, forget about it. 349 00:21:57,580 --> 00:21:59,540 But don't serve to him the second time 350 00:21:59,540 --> 00:22:01,960 because he might be somebody working at an antivirus company. 351 00:22:02,460 --> 00:22:03,920 Avoid detection and analysis. 352 00:22:04,680 --> 00:22:06,140 Then you've got to mutate well. 353 00:22:06,140 --> 00:22:13,180 So DriveSploit basically is trying to mimic these two goals of drive-by-downloads. 354 00:22:15,160 --> 00:22:16,580 Serve selectively. 355 00:22:16,800 --> 00:22:22,420 So at the HTTP level, this is what we implemented into DriveSploit. 356 00:22:23,200 --> 00:22:25,480 Serve only to fresh IPs. 357 00:22:26,540 --> 00:22:28,980 Serve only to particular referrers. 358 00:22:29,140 --> 00:22:34,600 This happened to the Gumbler mass SQL injection that happened in Japan. 359 00:22:34,600 --> 00:22:42,900 And few security vendors were able to detect this on the spot when it exploded 360 00:22:43,380 --> 00:22:46,180 because Gumbler was very selective about the referrer. 361 00:22:46,280 --> 00:22:49,020 It only served to referrers from Google. 362 00:22:50,820 --> 00:22:53,620 And in our case, in our example, for example, 363 00:22:53,660 --> 00:22:57,120 since we've infected dig.com, 364 00:22:57,240 --> 00:23:04,020 we can also specify what we are going to only serve to referrers coming from dig.com. 365 00:23:04,600 --> 00:23:05,600 Makes sense, right? 366 00:23:05,680 --> 00:23:07,000 If you're connecting to us directly, 367 00:23:07,260 --> 00:23:11,060 sorry, you're not somebody that we want to infect. 368 00:23:11,440 --> 00:23:13,680 We want to keep our zero day for a bit longer. 369 00:23:15,580 --> 00:23:18,320 Particular agent strings so that we only serve 370 00:23:18,320 --> 00:23:20,740 if this exploit is for IE7 only, 371 00:23:20,860 --> 00:23:22,600 we want to serve to IE7 only. 372 00:23:22,680 --> 00:23:24,680 If you connect with the Firefox, we want to serve to you. 373 00:23:24,760 --> 00:23:27,440 If you're a Google crawler, if you're a Yahoo crawler, 374 00:23:27,540 --> 00:23:28,560 we don't want to serve to you. 375 00:23:29,880 --> 00:23:30,300 Blacklist. 376 00:23:31,620 --> 00:23:33,680 Blacklist of security vendor, 377 00:23:33,680 --> 00:23:37,060 well-known crawler IPs and security vendor IPs, 378 00:23:37,060 --> 00:23:38,260 we don't want to serve to those. 379 00:23:39,640 --> 00:23:42,260 And that basically covers the first part, 380 00:23:42,360 --> 00:23:44,000 which is serve selectively. 381 00:23:44,120 --> 00:23:45,520 The second part, script mutation. 382 00:23:45,960 --> 00:23:49,940 This part is for both the exploit and also for the payload. 383 00:23:52,680 --> 00:23:55,020 The goal here is not to obfuscate. 384 00:23:55,540 --> 00:24:01,360 A lot of JavaScript exploits has been using existing JavaScript packers, 385 00:24:02,960 --> 00:24:05,700 but that's very easily picked up by endovirus. 386 00:24:05,900 --> 00:24:07,060 So the new ones don't. 387 00:24:08,660 --> 00:24:10,460 The goal is not to obfuscate, 388 00:24:10,520 --> 00:24:14,860 but it is to mutate the raw form and bypass signatures. 389 00:24:15,580 --> 00:24:19,300 So we want to try not to have fixed components 390 00:24:20,560 --> 00:24:22,520 when we generate the JavaScript code 391 00:24:22,520 --> 00:24:25,020 or the new mutated JavaScript code. 392 00:24:25,220 --> 00:24:27,960 And we want to try to use common operations. 393 00:24:28,440 --> 00:24:30,860 So we don't want to use rare operations 394 00:24:30,860 --> 00:24:33,180 that nobody used because endovirus can say, 395 00:24:33,280 --> 00:24:34,480 well, this operation, you know, 396 00:24:34,560 --> 00:24:38,060 only 0.01% of JavaScript use those 397 00:24:38,060 --> 00:24:39,680 and they're mostly exploits. 398 00:24:39,720 --> 00:24:40,760 We don't want to have those. 399 00:24:43,500 --> 00:24:47,520 So this is basically what makes up of a JavaScript exploit. 400 00:24:47,760 --> 00:24:48,660 There's a shellcode. 401 00:24:48,880 --> 00:24:50,660 There is the memory correction part, 402 00:24:51,060 --> 00:24:52,520 heap spray, and trigger. 403 00:24:52,760 --> 00:24:54,940 This is how a piece of shellcode looks like. 404 00:24:55,000 --> 00:24:57,920 Basically just a very long list of strings 405 00:24:57,920 --> 00:25:00,660 which converts to bytes. 406 00:25:00,860 --> 00:25:03,280 This is the memory corruption part. 407 00:25:03,400 --> 00:25:08,540 Oh, we're using IEPers as our example here. 408 00:25:09,100 --> 00:25:10,660 Memory corruption part. 409 00:25:11,060 --> 00:25:15,600 And we're using the exploit that's provided by Metasploit 410 00:25:15,600 --> 00:25:17,680 for IEPers vulnerability. 411 00:25:18,820 --> 00:25:20,760 And this is the heap spraying part. 412 00:25:21,100 --> 00:25:23,000 And finally, this is the trigger. 413 00:25:23,120 --> 00:25:26,540 This is the actual trigger that would execute 414 00:25:26,540 --> 00:25:28,840 the piece of malicious JavaScript. 415 00:25:30,860 --> 00:25:33,840 And then usually this whole part is sometimes, 416 00:25:34,140 --> 00:25:35,700 especially in the old days, 417 00:25:36,000 --> 00:25:41,080 obfuscated into a big blob and then deobfuscated. 418 00:25:42,020 --> 00:25:43,820 So there's the obfuscated form 419 00:25:43,820 --> 00:25:45,180 and there's the primitive form 420 00:25:47,740 --> 00:25:50,580 as we've mentioned in a previous slide. 421 00:25:51,840 --> 00:25:54,040 And so you would start with the trigger 422 00:25:54,040 --> 00:25:57,580 and the trigger would then cause the deobfuscator 423 00:25:57,580 --> 00:25:59,060 to deobfuscate the blob 424 00:25:59,060 --> 00:26:02,140 and then execute the heap spray 425 00:26:02,760 --> 00:26:03,960 and then the memory corruption. 426 00:26:04,280 --> 00:26:06,260 So with this entire part, 427 00:26:06,380 --> 00:26:09,080 the primitive or raw form we want to mutate 428 00:26:09,080 --> 00:26:11,280 and then for the triggering part 429 00:26:11,280 --> 00:26:15,100 we want to prevent in case we are inside 430 00:26:15,100 --> 00:26:17,740 a sandboxed or detection environment. 431 00:26:18,140 --> 00:26:21,420 So we want to know if we're inside a sandboxed environment 432 00:26:21,420 --> 00:26:23,800 then we want to prevent ourselves 433 00:26:23,800 --> 00:26:26,740 from executing anything. 434 00:26:30,400 --> 00:26:33,640 So mutation features implemented so far. 435 00:26:34,660 --> 00:26:37,560 We've implemented five main features so far. 436 00:26:37,740 --> 00:26:40,620 One is JavaScript random variable auto-replacement. 437 00:26:41,080 --> 00:26:43,400 It accepts a piece of JavaScript. 438 00:26:43,560 --> 00:26:46,620 It parses the JavaScript according to the JavaScript grammar. 439 00:26:46,900 --> 00:26:49,320 It identifies all names, 440 00:26:49,600 --> 00:26:51,820 including variable names and function names. 441 00:26:52,040 --> 00:26:54,260 And it auto-replaces those variable names 442 00:26:54,260 --> 00:26:56,260 and function names with random names. 443 00:26:56,620 --> 00:26:59,040 There is already a class in Metaverse 444 00:26:59,060 --> 00:27:02,180 called obfuscate.js that does similar things 445 00:27:02,180 --> 00:27:06,840 but you have to identify all the names yourself 446 00:27:07,480 --> 00:27:10,140 for it, which is very error-prone 447 00:27:10,140 --> 00:27:12,080 in our testing process because sometimes 448 00:27:12,080 --> 00:27:14,980 we just miss some variables or function names. 449 00:27:15,260 --> 00:27:18,120 And also when we do that it just creates a big mess. 450 00:27:18,340 --> 00:27:20,000 So we want to have one function call and say 451 00:27:20,000 --> 00:27:21,220 this is a piece of JavaScript. 452 00:27:21,440 --> 00:27:23,680 We place all the variable names and function names 453 00:27:23,680 --> 00:27:25,800 with random variables of our definition. 454 00:27:26,280 --> 00:27:29,040 We want every random variable to be a function 455 00:27:29,060 --> 00:27:32,440 of four to ten characters in length. 456 00:27:33,080 --> 00:27:34,560 So right now it's all random. 457 00:27:34,680 --> 00:27:36,580 We're thinking about adding a dictionary to it 458 00:27:36,580 --> 00:27:37,620 so it doesn't look strange. 459 00:27:38,000 --> 00:27:41,240 If it's a dictionary of, I don't know, a thousand words, 460 00:27:41,980 --> 00:27:42,660 that may work. 461 00:27:44,120 --> 00:27:46,100 And it passes back the new JavaScript 462 00:27:46,980 --> 00:27:49,700 and the vector of old-new name mapping. 463 00:27:49,840 --> 00:27:51,780 So you know which of your variables is replaced 464 00:27:51,780 --> 00:27:54,560 with which name. 465 00:27:56,780 --> 00:27:58,260 And this is the actual... 466 00:27:58,260 --> 00:28:00,340 This is how you actually use it in DriveSploit. 467 00:28:01,180 --> 00:28:03,300 The second one is very, very commonly used. 468 00:28:03,480 --> 00:28:05,480 It's called JavaScript Concat String Authentication. 469 00:28:09,420 --> 00:28:10,860 So this is how you use it. 470 00:28:10,920 --> 00:28:15,140 Basically you call it and you give it a piece of string 471 00:28:15,140 --> 00:28:16,580 which can be the shellcode. 472 00:28:17,260 --> 00:28:18,160 And this is... 473 00:28:18,660 --> 00:28:21,020 Metasploit, as you know, has a lot of encoders already. 474 00:28:21,340 --> 00:28:24,920 But when you're putting shellcode inside JavaScript 475 00:28:25,380 --> 00:28:27,480 you have a lot of ways to further 476 00:28:29,180 --> 00:28:32,040 obfuscate that piece of shellcode 477 00:28:32,040 --> 00:28:34,680 because you can execute JavaScript. 478 00:28:35,060 --> 00:28:37,060 So this is a very commonly used 479 00:28:37,060 --> 00:28:38,940 but very effective algorithm. 480 00:28:39,280 --> 00:28:43,840 And that is I give you a piece of shellcode 481 00:28:43,840 --> 00:28:46,840 and then you split the strings. 482 00:28:47,140 --> 00:28:48,940 And then you generate JavaScript 483 00:28:48,940 --> 00:28:50,840 that add the strings back 484 00:28:50,840 --> 00:28:53,640 and pass me back the JavaScript. 485 00:28:54,320 --> 00:28:55,760 So I'll show you how this works. 486 00:28:56,220 --> 00:28:57,580 This, for example, 487 00:28:57,580 --> 00:28:58,940 is our shellcode string. 488 00:28:59,780 --> 00:29:01,980 We would randomly chop it 489 00:29:01,980 --> 00:29:04,400 according to how you want us to chop it. 490 00:29:04,500 --> 00:29:05,340 So, for example, 491 00:29:05,360 --> 00:29:08,080 chop every four to eight characters. 492 00:29:08,460 --> 00:29:12,040 And we randomly chop it into segments. 493 00:29:12,720 --> 00:29:16,420 We would then assign the segments to variables. 494 00:29:17,980 --> 00:29:18,580 Okay? 495 00:29:18,780 --> 00:29:20,120 To layer one variables. 496 00:29:20,340 --> 00:29:22,500 And then we would scramble these assignments 497 00:29:23,280 --> 00:29:24,960 so that they look like this. 498 00:29:25,740 --> 00:29:26,480 All right? 499 00:29:26,480 --> 00:29:27,700 So now as you can see 500 00:29:27,700 --> 00:29:29,220 the middle section appears first. 501 00:29:29,460 --> 00:29:30,740 This makes it very hard 502 00:29:30,740 --> 00:29:33,480 for heuristic based detection 503 00:29:34,200 --> 00:29:36,120 pattern based detection algorithms. 504 00:29:36,660 --> 00:29:37,980 So that's layer one. 505 00:29:38,500 --> 00:29:40,020 And then we would do layer two. 506 00:29:41,000 --> 00:29:41,560 Right? 507 00:29:41,740 --> 00:29:42,600 We would add these 508 00:29:42,600 --> 00:29:43,860 we would then add 509 00:29:44,280 --> 00:29:45,600 add these two together 510 00:29:45,600 --> 00:29:46,680 into layer two variables. 511 00:29:47,380 --> 00:29:48,540 And then we would 512 00:29:50,500 --> 00:29:51,380 then again 513 00:29:52,500 --> 00:29:53,300 scramble these. 514 00:29:54,680 --> 00:29:55,240 Okay? 515 00:29:55,240 --> 00:29:56,040 And we would continue 516 00:29:56,040 --> 00:29:57,440 until we added everything together. 517 00:29:57,620 --> 00:29:58,040 So finally 518 00:29:58,040 --> 00:29:59,720 this is the script 519 00:29:59,720 --> 00:30:01,720 that we'll be passing back to you. 520 00:30:02,140 --> 00:30:03,840 Of course all the variable names 521 00:30:03,840 --> 00:30:04,740 are going to be randomized. 522 00:30:05,960 --> 00:30:08,200 They're just put this way 523 00:30:08,200 --> 00:30:09,900 for easier reading. 524 00:30:10,480 --> 00:30:12,620 And D1 is underlined 525 00:30:12,620 --> 00:30:13,580 because we're going to give you 526 00:30:13,580 --> 00:30:16,740 this whole new chunk of JavaScript 527 00:30:16,740 --> 00:30:19,200 and the variable name 528 00:30:19,200 --> 00:30:20,080 so that you know 529 00:30:20,080 --> 00:30:22,120 that that variable name in the end 530 00:30:22,120 --> 00:30:24,520 contains your shellcode string. 531 00:30:26,500 --> 00:30:27,820 The third one is 532 00:30:27,820 --> 00:30:30,080 JavaScript random text insertion. 533 00:30:30,800 --> 00:30:32,080 And what it does is 534 00:30:32,080 --> 00:30:34,540 it's also very commonly used in the wild. 535 00:30:34,700 --> 00:30:36,080 What we want to do here is not 536 00:30:36,080 --> 00:30:37,300 just is not 537 00:30:37,300 --> 00:30:38,840 the goal is not to beat antivirus. 538 00:30:39,060 --> 00:30:40,720 The goal is to simulate 539 00:30:40,720 --> 00:30:42,240 what's been used in the wild 540 00:30:42,240 --> 00:30:44,000 so that we can compare technologies. 541 00:30:44,720 --> 00:30:45,240 So 542 00:30:46,280 --> 00:30:47,320 so insert 543 00:30:47,320 --> 00:30:48,360 so this function call 544 00:30:48,360 --> 00:30:49,240 would ask 545 00:30:49,240 --> 00:30:50,920 us to generate 546 00:30:50,920 --> 00:30:52,880 ask DriveSploit to generate 547 00:30:52,880 --> 00:30:54,060 a random 548 00:30:54,060 --> 00:30:56,580 four character string 549 00:30:56,580 --> 00:30:58,120 and then insert 550 00:30:58,120 --> 00:30:59,820 into the original string 551 00:30:59,820 --> 00:31:02,040 for every six to ten characters. 552 00:31:05,840 --> 00:31:07,800 And then we'll return you the new string. 553 00:31:09,780 --> 00:31:11,560 And number four is 554 00:31:11,560 --> 00:31:12,660 numeric literal mutation. 555 00:31:13,220 --> 00:31:14,520 A lot of times 556 00:31:15,060 --> 00:31:17,580 JavaScript's antivirus is sampled 557 00:31:17,580 --> 00:31:20,380 by these fixed numeric literals. 558 00:31:20,500 --> 00:31:23,160 And so we'll have a function 559 00:31:23,160 --> 00:31:24,040 that's essentially 560 00:31:24,060 --> 00:31:24,640 a Slack space. 561 00:31:24,900 --> 00:31:25,720 So basically 562 00:31:25,720 --> 00:31:26,920 you pass us 563 00:31:26,920 --> 00:31:27,840 a numeric literal 564 00:31:27,840 --> 00:31:28,640 or a hex 565 00:31:28,640 --> 00:31:29,640 code 566 00:31:29,640 --> 00:31:33,020 and we would then 567 00:31:33,020 --> 00:31:33,840 generate 568 00:31:33,840 --> 00:31:35,400 randomly generate 569 00:31:35,400 --> 00:31:36,200 a computation 570 00:31:36,200 --> 00:31:37,400 that computes back 571 00:31:37,400 --> 00:31:38,540 to this 572 00:31:39,060 --> 00:31:40,360 to this 573 00:31:40,360 --> 00:31:41,640 hex code 574 00:31:41,640 --> 00:31:42,300 or byte 575 00:31:42,300 --> 00:31:42,960 to this byte. 576 00:31:43,160 --> 00:31:43,780 Right? 577 00:31:43,900 --> 00:31:44,760 So that your JavaScript 578 00:31:44,760 --> 00:31:46,000 every time you serve 579 00:31:46,000 --> 00:31:46,980 every time you serve 580 00:31:46,980 --> 00:31:48,520 to a new visitor 581 00:31:48,520 --> 00:31:49,400 your JavaScript 582 00:31:49,400 --> 00:31:50,100 is going to look 583 00:31:50,100 --> 00:31:51,680 different every time. 584 00:31:51,800 --> 00:31:52,260 Well that's 585 00:31:52,260 --> 00:31:52,800 basically 586 00:31:52,800 --> 00:31:54,640 what happens in the wild 587 00:31:54,640 --> 00:31:55,760 so we want to simulate that. 588 00:31:57,620 --> 00:31:58,760 And so before 589 00:31:58,760 --> 00:32:00,300 your JavaScript code 590 00:32:00,300 --> 00:32:00,920 would look like 591 00:32:00,920 --> 00:32:01,760 something like this 592 00:32:01,760 --> 00:32:02,860 the line above 593 00:32:02,860 --> 00:32:03,920 now your JavaScript 594 00:32:03,920 --> 00:32:04,900 looks something like 595 00:32:04,900 --> 00:32:05,800 the line below. 596 00:32:10,960 --> 00:32:11,600 Okay. 597 00:32:14,100 --> 00:32:16,160 And then for the triggers 598 00:32:16,700 --> 00:32:17,680 so we finished 599 00:32:17,680 --> 00:32:18,280 we've covered 600 00:32:18,620 --> 00:32:20,160 for the first part 601 00:32:20,160 --> 00:32:21,180 five features 602 00:32:21,180 --> 00:32:21,840 for mutation 603 00:32:21,840 --> 00:32:22,880 and now 604 00:32:22,880 --> 00:32:23,840 for trigger prevention. 605 00:32:24,800 --> 00:32:26,400 So we want to see 606 00:32:26,400 --> 00:32:27,160 we want to know 607 00:32:27,160 --> 00:32:28,040 if we're in a sandbox 608 00:32:28,040 --> 00:32:28,520 environment 609 00:32:28,520 --> 00:32:29,660 and if we do 610 00:32:29,660 --> 00:32:30,980 and if we're not 611 00:32:30,980 --> 00:32:32,820 in a real humans browser 612 00:32:32,820 --> 00:32:34,200 we don't want 613 00:32:34,200 --> 00:32:35,280 to execute. 614 00:32:38,080 --> 00:32:39,400 And this can be done 615 00:32:39,400 --> 00:32:40,880 a lot of times 616 00:32:40,880 --> 00:32:41,340 you see 617 00:32:41,340 --> 00:32:42,100 you see that 618 00:32:42,100 --> 00:32:42,520 the trigger 619 00:32:43,180 --> 00:32:43,740 function 620 00:32:43,740 --> 00:32:45,380 is set 621 00:32:45,380 --> 00:32:46,520 on event handlers 622 00:32:46,520 --> 00:32:47,340 div 623 00:32:47,620 --> 00:32:47,900 unload 624 00:32:47,900 --> 00:32:49,440 and image unload. 625 00:32:50,660 --> 00:32:51,660 You see more 626 00:32:51,840 --> 00:32:52,220 image unload 627 00:32:52,220 --> 00:32:53,000 these days. 628 00:32:53,480 --> 00:32:54,680 Anybody want to guess 629 00:32:54,680 --> 00:32:55,900 which one is more effective? 630 00:32:59,980 --> 00:33:00,420 Div? 631 00:33:02,000 --> 00:33:03,040 Who think it's div? 632 00:33:04,560 --> 00:33:05,760 Who think it's image? 633 00:33:07,160 --> 00:33:07,600 Okay. 634 00:33:07,640 --> 00:33:08,780 A lot more people for image. 635 00:33:08,920 --> 00:33:09,120 Somebody 636 00:33:09,120 --> 00:33:10,020 somebody say why? 637 00:33:13,620 --> 00:33:14,500 All right. 638 00:33:14,580 --> 00:33:14,980 Come on. 639 00:33:15,780 --> 00:33:16,220 Why? 640 00:33:16,380 --> 00:33:16,700 Yes. 641 00:33:16,840 --> 00:33:17,060 Yes. 642 00:33:17,140 --> 00:33:18,140 The answer is yes. 643 00:33:18,280 --> 00:33:20,080 The answer is image unload 644 00:33:20,080 --> 00:33:20,860 is more effective. 645 00:33:24,280 --> 00:33:25,040 It's 646 00:33:25,040 --> 00:33:25,500 Yes. 647 00:33:26,720 --> 00:33:28,680 And the other reason is 648 00:33:31,060 --> 00:33:31,820 Oh. 649 00:33:32,780 --> 00:33:33,900 The right answer is 650 00:33:33,900 --> 00:33:34,740 image load 651 00:33:34,740 --> 00:33:35,260 well 652 00:33:35,260 --> 00:33:36,060 image unload 653 00:33:36,060 --> 00:33:37,400 is very effective 654 00:33:37,400 --> 00:33:38,220 for 655 00:33:38,220 --> 00:33:39,860 for some of the newest 656 00:33:39,860 --> 00:33:40,740 and very accurate 657 00:33:40,740 --> 00:33:41,820 technologies 658 00:33:41,820 --> 00:33:42,900 for example 659 00:33:42,900 --> 00:33:43,220 ours. 660 00:33:44,380 --> 00:33:45,460 Div unload 661 00:33:45,460 --> 00:33:46,440 is very effective 662 00:33:46,440 --> 00:33:47,220 for 663 00:33:47,220 --> 00:33:48,300 older technologies 664 00:33:48,300 --> 00:33:48,880 that 665 00:33:48,880 --> 00:33:49,560 do not 666 00:33:49,560 --> 00:33:50,040 implement 667 00:33:50,040 --> 00:33:50,960 the DOM. 668 00:33:51,140 --> 00:33:51,800 Okay. 669 00:33:51,820 --> 00:33:52,720 So basically you take 670 00:33:52,720 --> 00:33:54,080 SpiderMonkey or Rhino 671 00:33:54,080 --> 00:33:55,060 and use it 672 00:33:55,060 --> 00:33:55,500 as your 673 00:33:55,500 --> 00:33:56,480 JavaScript interpreter. 674 00:33:56,860 --> 00:33:57,380 These 675 00:33:57,380 --> 00:33:58,600 JavaScript interpreters 676 00:33:58,600 --> 00:33:59,420 don't have the DOM. 677 00:33:59,980 --> 00:34:01,140 Newer technologies 678 00:34:01,140 --> 00:34:01,600 like 679 00:34:01,600 --> 00:34:02,440 JSUnpack 680 00:34:02,440 --> 00:34:03,540 or VeriSign 681 00:34:03,540 --> 00:34:04,880 implements 682 00:34:04,880 --> 00:34:05,600 the DOM objects 683 00:34:05,600 --> 00:34:06,180 themselves. 684 00:34:06,820 --> 00:34:07,280 Right. 685 00:34:07,380 --> 00:34:08,120 So if you're 686 00:34:08,120 --> 00:34:09,540 if you're only using 687 00:34:09,540 --> 00:34:10,640 a JavaScript interpreter 688 00:34:10,640 --> 00:34:12,060 because it's 689 00:34:12,060 --> 00:34:12,580 very hard 690 00:34:12,580 --> 00:34:13,800 to reuse IE. 691 00:34:13,920 --> 00:34:14,340 So typically 692 00:34:14,340 --> 00:34:15,740 we use some versions 693 00:34:15,740 --> 00:34:16,620 of Firefox 694 00:34:16,620 --> 00:34:18,240 or just some versions 695 00:34:18,240 --> 00:34:18,800 of either 696 00:34:18,800 --> 00:34:19,820 SpiderMonkey 697 00:34:19,820 --> 00:34:20,400 or Rhino. 698 00:34:20,400 --> 00:34:21,520 Some versions of 699 00:34:21,520 --> 00:34:22,200 open source 700 00:34:22,200 --> 00:34:23,740 JavaScript interpreter. 701 00:34:24,220 --> 00:34:25,220 And div unload 702 00:34:25,220 --> 00:34:25,940 is very effective 703 00:34:25,940 --> 00:34:26,420 for that 704 00:34:26,420 --> 00:34:27,600 for the older ones 705 00:34:27,600 --> 00:34:27,940 because 706 00:34:27,940 --> 00:34:29,240 they don't have the DOM. 707 00:34:29,360 --> 00:34:30,360 They don't have DOM implementation. 708 00:34:30,960 --> 00:34:31,800 Image unload 709 00:34:31,800 --> 00:34:32,720 is effective 710 00:34:33,320 --> 00:34:34,220 for technologies 711 00:34:34,220 --> 00:34:34,720 that 712 00:34:35,400 --> 00:34:35,840 really 713 00:34:35,840 --> 00:34:36,940 sandbox IE 714 00:34:36,940 --> 00:34:38,200 and run IE 715 00:34:38,200 --> 00:34:39,500 as the detector. 716 00:34:40,460 --> 00:34:41,060 Because 717 00:34:41,060 --> 00:34:42,080 and the reason 718 00:34:42,080 --> 00:34:42,380 is because 719 00:34:42,380 --> 00:34:43,060 well IE 720 00:34:43,060 --> 00:34:44,560 has image unload 721 00:34:44,560 --> 00:34:45,060 but 722 00:34:45,920 --> 00:34:46,880 what happens 723 00:34:46,880 --> 00:34:47,380 is when you're 724 00:34:47,380 --> 00:34:47,900 crawling millions 725 00:34:47,900 --> 00:34:48,700 of pages a day 726 00:34:50,400 --> 00:34:50,640 it causes 727 00:34:50,640 --> 00:34:51,380 this introduces 728 00:34:51,380 --> 00:34:52,100 a lot of bandwidth. 729 00:34:52,440 --> 00:34:53,540 And bandwidth 730 00:34:53,540 --> 00:34:54,340 and loading 731 00:34:54,340 --> 00:34:55,200 big images 732 00:34:55,200 --> 00:34:56,200 is just very, 733 00:34:56,300 --> 00:34:56,800 very costly. 734 00:34:57,480 --> 00:34:58,440 And so 735 00:34:58,440 --> 00:34:59,420 there's a feature 736 00:34:59,420 --> 00:34:59,980 in IE 737 00:34:59,980 --> 00:35:01,500 to disable 738 00:35:01,500 --> 00:35:02,240 image rendering. 739 00:35:02,740 --> 00:35:03,360 Right. 740 00:35:03,480 --> 00:35:04,500 You click on tools 741 00:35:04,500 --> 00:35:04,900 options 742 00:35:04,900 --> 00:35:05,420 and you can 743 00:35:05,420 --> 00:35:06,860 disable image rendering. 744 00:35:07,040 --> 00:35:07,180 When you 745 00:35:07,180 --> 00:35:07,660 and 746 00:35:08,800 --> 00:35:10,040 some vendors 747 00:35:10,040 --> 00:35:10,520 do that 748 00:35:10,520 --> 00:35:11,520 and when you disable that 749 00:35:11,520 --> 00:35:12,140 image unload 750 00:35:12,140 --> 00:35:12,660 doesn't fire. 751 00:35:13,300 --> 00:35:13,920 Okay. 752 00:35:14,040 --> 00:35:15,080 So they pretty much 753 00:35:15,080 --> 00:35:15,700 figured out 754 00:35:15,700 --> 00:35:17,160 what each 755 00:35:17,160 --> 00:35:18,760 what these 756 00:35:18,760 --> 00:35:19,720 detectors are. 757 00:35:19,920 --> 00:35:21,300 What these detectors 758 00:35:21,300 --> 00:35:21,800 are doing 759 00:35:21,800 --> 00:35:22,640 to detect them. 760 00:35:24,000 --> 00:35:25,060 The third one 761 00:35:25,060 --> 00:35:25,500 is very 762 00:35:25,500 --> 00:35:26,780 is also very 763 00:35:26,780 --> 00:35:27,520 commonly used. 764 00:35:28,240 --> 00:35:29,140 It's just some 765 00:35:29,140 --> 00:35:29,660 do while 766 00:35:29,660 --> 00:35:30,320 loop. 767 00:35:30,500 --> 00:35:31,460 Some arbitrary 768 00:35:31,460 --> 00:35:32,280 do while loop. 769 00:35:32,500 --> 00:35:33,540 But if you see 770 00:35:33,540 --> 00:35:34,160 here what 771 00:35:34,160 --> 00:35:34,680 what's 772 00:35:36,720 --> 00:35:37,480 what's here 773 00:35:37,480 --> 00:35:37,960 is 774 00:35:39,220 --> 00:35:39,960 in a 775 00:35:39,960 --> 00:35:40,340 do while 776 00:35:41,520 --> 00:35:42,120 there's 777 00:35:42,120 --> 00:35:42,520 an extra 778 00:35:42,520 --> 00:35:43,560 semicolon 779 00:35:44,400 --> 00:35:45,200 which is 780 00:35:45,200 --> 00:35:45,720 actually 781 00:35:45,720 --> 00:35:46,080 a 782 00:35:46,080 --> 00:35:46,640 grammatic 783 00:35:46,640 --> 00:35:46,980 error. 784 00:35:47,160 --> 00:35:48,260 But IE 785 00:35:48,260 --> 00:35:48,980 is so smart 786 00:35:48,980 --> 00:35:49,800 that it can 787 00:35:49,800 --> 00:35:50,780 recover from that 788 00:35:50,780 --> 00:35:51,480 and continue 789 00:35:52,120 --> 00:35:52,680 while 790 00:35:52,680 --> 00:35:53,520 SpiderMonkey 791 00:35:53,520 --> 00:35:54,000 or Firefox 792 00:35:54,000 --> 00:35:54,920 just throws 793 00:35:54,920 --> 00:35:55,400 an exception. 794 00:35:55,960 --> 00:35:57,100 So if you're using 795 00:35:57,100 --> 00:35:57,640 some versions 796 00:35:57,640 --> 00:35:59,120 of SpiderMonkey 797 00:35:59,120 --> 00:36:00,380 it would throw 798 00:36:00,380 --> 00:36:00,740 an exception 799 00:36:00,740 --> 00:36:01,600 and then 800 00:36:01,600 --> 00:36:02,660 it wouldn't execute. 801 00:36:03,140 --> 00:36:03,540 While 802 00:36:03,540 --> 00:36:04,680 if you're 803 00:36:04,680 --> 00:36:05,340 a user 804 00:36:05,340 --> 00:36:06,060 using IE 805 00:36:06,060 --> 00:36:06,680 and if I'm 806 00:36:06,680 --> 00:36:07,280 serving you 807 00:36:07,280 --> 00:36:08,200 an IE 808 00:36:08,200 --> 00:36:08,400 based 809 00:36:09,180 --> 00:36:09,740 IE 810 00:36:09,740 --> 00:36:10,320 exploit 811 00:36:10,320 --> 00:36:11,400 then it would 812 00:36:11,400 --> 00:36:12,040 work just fine. 813 00:36:14,020 --> 00:36:14,580 Oops. 814 00:36:17,160 --> 00:36:17,580 Sorry about that. 815 00:36:23,780 --> 00:36:24,580 Okay. 816 00:36:24,700 --> 00:36:25,840 So we 817 00:36:25,840 --> 00:36:26,240 implemented 818 00:36:26,240 --> 00:36:26,780 some of 819 00:36:26,780 --> 00:36:27,040 these 820 00:36:27,040 --> 00:36:28,340 and then 821 00:36:28,340 --> 00:36:29,340 we tested 822 00:36:29,340 --> 00:36:29,700 it out. 823 00:36:30,580 --> 00:36:31,700 So we 824 00:36:31,700 --> 00:36:32,140 implemented 825 00:36:32,140 --> 00:36:32,500 these 826 00:36:32,500 --> 00:36:32,940 in 827 00:36:32,940 --> 00:36:33,360 drive 828 00:36:33,360 --> 00:36:33,600 exploit 829 00:36:33,600 --> 00:36:35,060 and then 830 00:36:35,060 --> 00:36:36,280 we 831 00:36:36,280 --> 00:36:37,400 generated 832 00:36:37,400 --> 00:36:37,720 the 833 00:36:37,720 --> 00:36:37,980 XML 834 00:36:37,980 --> 00:36:38,460 files 835 00:36:38,460 --> 00:36:39,280 and then 836 00:36:39,280 --> 00:36:39,360 we 837 00:36:39,360 --> 00:36:39,460 uploaded 838 00:36:39,460 --> 00:36:40,160 them to 839 00:36:40,160 --> 00:36:40,720 VirusTotal 840 00:36:40,720 --> 00:36:42,100 and we 841 00:36:42,100 --> 00:36:42,640 used IE 842 00:36:42,640 --> 00:36:42,920 peers 843 00:36:42,920 --> 00:36:43,980 as the 844 00:36:43,980 --> 00:36:44,540 JavaScript 845 00:36:44,540 --> 00:36:45,060 exploit. 846 00:36:45,340 --> 00:36:46,280 The plain 847 00:36:46,280 --> 00:36:46,600 IE 848 00:36:46,600 --> 00:36:46,900 peers 849 00:36:46,900 --> 00:36:47,920 on VirusTotal 850 00:36:47,920 --> 00:36:49,160 hit 851 00:36:49,160 --> 00:36:49,940 17 852 00:36:49,940 --> 00:36:50,660 detections 853 00:36:51,760 --> 00:36:52,400 and 854 00:36:55,620 --> 00:36:56,260 randomizing 855 00:36:56,260 --> 00:36:56,540 variables 856 00:36:56,540 --> 00:36:57,120 although 857 00:36:57,120 --> 00:36:57,540 it was 858 00:36:57,540 --> 00:36:58,060 pretty hard 859 00:36:58,060 --> 00:36:58,440 to do 860 00:36:58,440 --> 00:36:58,780 considering 861 00:36:58,780 --> 00:36:59,200 we had 862 00:36:59,200 --> 00:36:59,500 to parse 863 00:36:59,500 --> 00:36:59,920 JavaScript 864 00:36:59,920 --> 00:37:00,960 wasn't 865 00:37:00,960 --> 00:37:01,480 really effective. 866 00:37:03,700 --> 00:37:04,880 So in 867 00:37:04,880 --> 00:37:05,440 Taiwanese we 868 00:37:05,440 --> 00:37:05,940 call this 869 00:37:05,940 --> 00:37:06,540 Bo Cai. 870 00:37:06,740 --> 00:37:07,420 It means 871 00:37:07,420 --> 00:37:07,940 too bad 872 00:37:07,940 --> 00:37:08,860 for us. 873 00:37:13,200 --> 00:37:14,400 When we 874 00:37:14,400 --> 00:37:14,740 used 875 00:37:14,740 --> 00:37:15,200 random 876 00:37:15,200 --> 00:37:15,880 text 877 00:37:15,880 --> 00:37:16,380 injection 878 00:37:16,380 --> 00:37:17,700 into the 879 00:37:17,700 --> 00:37:18,140 show code 880 00:37:18,140 --> 00:37:18,460 itself 881 00:37:18,460 --> 00:37:19,700 we brought 882 00:37:19,700 --> 00:37:20,100 this down 883 00:37:20,100 --> 00:37:20,640 to 13. 884 00:37:20,880 --> 00:37:21,340 So from 885 00:37:21,340 --> 00:37:22,220 17 to 886 00:37:22,220 --> 00:37:22,540 13 887 00:37:22,540 --> 00:37:23,760 which is 888 00:37:23,760 --> 00:37:24,000 good. 889 00:37:26,160 --> 00:37:26,920 When we 890 00:37:26,920 --> 00:37:27,040 used 891 00:37:27,040 --> 00:37:27,600 random 892 00:37:27,600 --> 00:37:28,000 variables 893 00:37:28,000 --> 00:37:28,640 plus 894 00:37:30,620 --> 00:37:31,200 string 895 00:37:31,900 --> 00:37:32,740 show code 896 00:37:32,740 --> 00:37:32,960 string 897 00:37:32,960 --> 00:37:33,380 injection 898 00:37:33,380 --> 00:37:34,120 plus 899 00:37:34,120 --> 00:37:35,120 concatenation 900 00:37:35,120 --> 00:37:35,560 meaning 901 00:37:35,560 --> 00:37:36,020 splitting 902 00:37:36,020 --> 00:37:36,500 it up 903 00:37:36,500 --> 00:37:37,820 we ended 904 00:37:37,820 --> 00:37:37,980 up 905 00:37:37,980 --> 00:37:38,220 with 906 00:37:38,220 --> 00:37:38,560 11 907 00:37:38,560 --> 00:37:39,540 out 908 00:37:39,540 --> 00:37:39,880 of 909 00:37:39,880 --> 00:37:40,620 42. 910 00:37:40,840 --> 00:37:41,200 So from 911 00:37:41,200 --> 00:37:41,920 17 down 912 00:37:41,920 --> 00:37:42,300 to 11. 913 00:37:42,560 --> 00:37:43,140 So at 914 00:37:43,140 --> 00:37:43,480 this point 915 00:37:43,480 --> 00:37:43,940 we pretty 916 00:37:43,940 --> 00:37:44,160 much 917 00:37:44,160 --> 00:37:44,500 thought 918 00:37:44,500 --> 00:37:45,240 that 919 00:37:45,240 --> 00:37:46,100 since we 920 00:37:46,100 --> 00:37:46,460 reduced 921 00:37:46,460 --> 00:37:47,180 six of 922 00:37:47,180 --> 00:37:48,100 them we 923 00:37:48,100 --> 00:37:48,700 pretty much 924 00:37:48,700 --> 00:37:49,080 thought that 925 00:37:49,080 --> 00:37:49,760 roughly six 926 00:37:49,760 --> 00:37:50,360 of these 927 00:37:50,360 --> 00:37:50,900 antivirus 928 00:37:50,900 --> 00:37:51,220 detectors 929 00:37:51,220 --> 00:37:51,900 were based 930 00:37:51,900 --> 00:37:52,240 on the 931 00:37:52,240 --> 00:37:52,620 show code 932 00:37:52,620 --> 00:37:52,960 itself. 933 00:37:54,040 --> 00:37:55,320 So when we 934 00:37:55,320 --> 00:37:55,640 completely 935 00:37:55,640 --> 00:37:55,960 scrambled 936 00:37:55,960 --> 00:37:56,380 the show 937 00:37:56,380 --> 00:37:57,700 code we 938 00:37:57,700 --> 00:37:58,880 only bypassed 939 00:37:58,880 --> 00:37:59,220 six of 940 00:37:59,220 --> 00:37:59,920 them while 941 00:37:59,920 --> 00:38:00,540 the others 942 00:38:01,420 --> 00:38:02,460 was also 943 00:38:02,460 --> 00:38:02,980 sampling 944 00:38:02,980 --> 00:38:03,520 the rest 945 00:38:03,520 --> 00:38:04,060 part of 946 00:38:04,060 --> 00:38:04,180 the 947 00:38:04,180 --> 00:38:04,560 JavaScript 948 00:38:04,560 --> 00:38:05,120 JavaScript which 949 00:38:05,120 --> 00:38:05,580 included 950 00:38:05,580 --> 00:38:06,300 the 951 00:38:06,300 --> 00:38:07,540 memory 952 00:38:07,540 --> 00:38:07,760 corruption 953 00:38:07,760 --> 00:38:09,020 part and 954 00:38:09,020 --> 00:38:09,560 the 955 00:38:09,560 --> 00:38:10,020 heap 956 00:38:10,020 --> 00:38:10,180 spray 957 00:38:10,180 --> 00:38:10,960 part and 958 00:38:10,960 --> 00:38:11,060 the 959 00:38:11,060 --> 00:38:11,260 trigger 960 00:38:11,260 --> 00:38:11,460 part. 961 00:38:13,900 --> 00:38:14,920 And so 962 00:38:14,920 --> 00:38:15,260 when we 963 00:38:15,260 --> 00:38:15,620 used 964 00:38:16,440 --> 00:38:17,200 concatenation 965 00:38:17,200 --> 00:38:17,880 of 966 00:38:17,880 --> 00:38:18,860 show 967 00:38:18,860 --> 00:38:19,240 code 968 00:38:19,240 --> 00:38:19,940 plus 969 00:38:19,940 --> 00:38:20,740 the 970 00:38:20,740 --> 00:38:20,980 rest 971 00:38:20,980 --> 00:38:21,160 of 972 00:38:21,160 --> 00:38:21,280 the 973 00:38:21,280 --> 00:38:21,660 code 974 00:38:21,660 --> 00:38:22,740 it 975 00:38:22,740 --> 00:38:23,020 came 976 00:38:23,020 --> 00:38:23,200 down 977 00:38:23,200 --> 00:38:23,420 to 978 00:38:34,560 --> 00:38:34,700 zero. 979 00:38:34,720 --> 00:38:36,240 So it 980 00:38:36,240 --> 00:38:37,540 happens 981 00:38:37,540 --> 00:38:37,840 to be 982 00:38:37,840 --> 00:38:38,040 down 983 00:38:38,040 --> 00:38:38,240 here. 984 00:38:40,100 --> 00:38:41,020 And this 985 00:38:41,020 --> 00:38:41,580 one to 986 00:38:41,580 --> 00:38:42,060 be honest 987 00:38:42,060 --> 00:38:42,920 is very 988 00:38:42,920 --> 00:38:43,180 good. 989 00:38:44,220 --> 00:38:44,780 Okay. 990 00:38:51,120 --> 00:38:52,220 And when 991 00:38:52,220 --> 00:38:52,700 we used 992 00:38:53,300 --> 00:38:53,640 injection 993 00:38:53,640 --> 00:38:54,420 of 994 00:38:54,420 --> 00:38:55,120 the 995 00:38:55,120 --> 00:38:55,340 show 996 00:38:55,340 --> 00:38:55,640 code 997 00:38:55,640 --> 00:38:56,520 plus 998 00:38:57,400 --> 00:38:58,080 concatenation 999 00:38:58,080 --> 00:38:58,740 of the 1000 00:38:58,740 --> 00:38:59,120 rest of 1001 00:38:59,120 --> 00:38:59,280 the 1002 00:38:59,280 --> 00:39:00,400 code just 1003 00:39:00,400 --> 00:39:00,900 these two 1004 00:39:00,900 --> 00:39:01,180 simple 1005 00:39:01,180 --> 00:39:02,480 combinations were 1006 00:39:02,480 --> 00:39:02,880 down to 1007 00:39:02,880 --> 00:39:03,100 zero. 1008 00:39:05,540 --> 00:39:06,480 And adding 1009 00:39:06,480 --> 00:39:06,780 random 1010 00:39:06,780 --> 00:39:07,320 vars of 1011 00:39:07,320 --> 00:39:07,720 course the 1012 00:39:07,720 --> 00:39:07,900 same. 1013 00:39:09,560 --> 00:39:10,140 But 1014 00:39:10,920 --> 00:39:11,500 virus 1015 00:39:11,500 --> 00:39:12,600 total uses 1016 00:39:12,600 --> 00:39:13,240 versions that 1017 00:39:13,240 --> 00:39:13,700 we use 1018 00:39:13,700 --> 00:39:14,400 which is 1019 00:39:14,400 --> 00:39:14,800 the API 1020 00:39:14,800 --> 00:39:16,200 version or 1021 00:39:16,200 --> 00:39:17,600 the console 1022 00:39:17,600 --> 00:39:18,080 version. 1023 00:39:19,100 --> 00:39:20,180 But antivirus 1024 00:39:20,180 --> 00:39:20,420 desktop 1025 00:39:20,420 --> 00:39:21,380 versions is 1026 00:39:21,380 --> 00:39:21,580 much 1027 00:39:21,580 --> 00:39:21,960 stronger. 1028 00:39:23,480 --> 00:39:24,060 Why? 1029 00:39:24,260 --> 00:39:24,680 Because they 1030 00:39:24,680 --> 00:39:25,080 can monitor 1031 00:39:25,080 --> 00:39:25,280 host 1032 00:39:25,280 --> 00:39:25,780 environment. 1033 00:39:26,160 --> 00:39:26,800 They hook 1034 00:39:26,800 --> 00:39:27,440 into browsers. 1035 00:39:28,960 --> 00:39:29,740 So it's 1036 00:39:29,740 --> 00:39:30,340 easier for 1037 00:39:30,340 --> 00:39:30,600 them to 1038 00:39:30,600 --> 00:39:30,900 get the 1039 00:39:30,900 --> 00:39:31,320 raw form 1040 00:39:31,320 --> 00:39:31,960 of exploit. 1041 00:39:32,080 --> 00:39:32,220 If you 1042 00:39:32,220 --> 00:39:32,600 hook into 1043 00:39:32,600 --> 00:39:33,300 the browser you 1044 00:39:33,300 --> 00:39:33,580 can see 1045 00:39:33,580 --> 00:39:34,200 exactly what 1046 00:39:34,200 --> 00:39:34,360 the 1047 00:39:34,360 --> 00:39:34,700 JavaScript 1048 00:39:34,700 --> 00:39:35,880 engine is 1049 00:39:35,880 --> 00:39:36,200 doing. 1050 00:39:36,320 --> 00:39:36,520 If you 1051 00:39:36,520 --> 00:39:37,000 hook deep 1052 00:39:37,000 --> 00:39:37,520 into the 1053 00:39:37,520 --> 00:39:37,820 IE 1054 00:39:37,820 --> 00:39:38,080 JavaScript 1055 00:39:38,080 --> 00:39:39,000 engine and 1056 00:39:39,000 --> 00:39:39,380 as soon 1057 00:39:39,380 --> 00:39:39,780 as you 1058 00:39:39,780 --> 00:39:41,020 create a 1059 00:39:41,020 --> 00:39:41,140 new 1060 00:39:41,140 --> 00:39:42,540 variable with 1061 00:39:42,540 --> 00:39:43,160 a raw form 1062 00:39:43,160 --> 00:39:43,860 of show 1063 00:39:43,860 --> 00:39:44,800 code then I 1064 00:39:44,800 --> 00:39:45,220 can say 1065 00:39:45,220 --> 00:39:46,340 boom you 1066 00:39:46,340 --> 00:39:46,540 are an 1067 00:39:46,540 --> 00:39:46,840 exploit. 1068 00:39:49,500 --> 00:39:50,440 And so 1069 00:39:53,120 --> 00:39:54,640 and they 1070 00:39:54,640 --> 00:39:55,240 can also 1071 00:39:55,240 --> 00:39:55,620 do 1072 00:39:55,620 --> 00:39:56,520 behavior 1073 00:39:56,520 --> 00:39:56,980 analysis. 1074 00:39:57,280 --> 00:39:58,180 For example 1075 00:39:58,180 --> 00:39:58,660 buffer 1076 00:39:58,660 --> 00:39:59,080 overflow 1077 00:39:59,080 --> 00:40:00,380 behavior or 1078 00:40:00,380 --> 00:40:00,980 download to 1079 00:40:00,980 --> 00:40:01,180 file 1080 00:40:01,180 --> 00:40:02,220 behavior which 1081 00:40:02,220 --> 00:40:02,880 makes detection 1082 00:40:02,880 --> 00:40:03,140 a lot 1083 00:40:03,140 --> 00:40:03,520 easier. 1084 00:40:12,180 --> 00:40:12,820 Okay. 1085 00:40:14,260 --> 00:40:15,540 So this 1086 00:40:15,540 --> 00:40:15,840 is the 1087 00:40:15,840 --> 00:40:16,620 result of 1088 00:40:16,620 --> 00:40:17,720 our limited 1089 00:40:17,720 --> 00:40:19,320 testing of 1090 00:40:19,320 --> 00:40:20,080 dry exploit 1091 00:40:20,080 --> 00:40:21,080 against these 1092 00:40:21,080 --> 00:40:21,380 end of 1093 00:40:21,380 --> 00:40:21,540 ours. 1094 00:40:21,980 --> 00:40:22,960 We listed 1095 00:40:22,960 --> 00:40:24,240 out we 1096 00:40:24,240 --> 00:40:25,000 abbreviate 1097 00:40:25,000 --> 00:40:25,280 it you 1098 00:40:25,280 --> 00:40:25,640 can guess. 1099 00:40:27,920 --> 00:40:29,140 And we 1100 00:40:29,140 --> 00:40:29,820 tried out 1101 00:40:29,820 --> 00:40:30,100 the big 1102 00:40:30,100 --> 00:40:31,140 ones and 1103 00:40:31,140 --> 00:40:31,480 as you 1104 00:40:31,480 --> 00:40:31,900 can see 1105 00:40:31,900 --> 00:40:33,000 there was 1106 00:40:33,000 --> 00:40:33,340 one 1107 00:40:33,340 --> 00:40:33,720 vendor 1108 00:40:34,420 --> 00:40:35,520 which dry 1109 00:40:35,520 --> 00:40:35,760 exploit 1110 00:40:35,760 --> 00:40:36,400 could not 1111 00:40:36,400 --> 00:40:36,540 be. 1112 00:40:41,140 --> 00:40:41,860 more features 1113 00:40:41,860 --> 00:40:42,460 for example 1114 00:40:42,460 --> 00:40:43,360 concatenation 1115 00:40:43,360 --> 00:40:44,500 of the 1116 00:40:44,500 --> 00:40:44,700 show 1117 00:40:44,700 --> 00:40:45,240 code plus 1118 00:40:45,240 --> 00:40:45,880 concatenation 1119 00:40:45,880 --> 00:40:46,140 of the 1120 00:40:46,140 --> 00:40:46,580 code itself 1121 00:40:46,580 --> 00:40:47,020 or injection 1122 00:40:47,020 --> 00:40:47,380 of the 1123 00:40:47,380 --> 00:40:47,600 show 1124 00:40:47,600 --> 00:40:48,200 code plus 1125 00:40:48,200 --> 00:40:48,800 concatenation 1126 00:40:48,800 --> 00:40:49,140 of the 1127 00:40:49,140 --> 00:40:49,620 code itself 1128 00:40:49,620 --> 00:40:50,800 we started 1129 00:40:50,800 --> 00:40:51,120 to be 1130 00:40:51,120 --> 00:40:51,620 more and 1131 00:40:51,620 --> 00:40:52,260 more in 1132 00:40:52,260 --> 00:40:52,620 a virus. 1133 00:40:53,800 --> 00:40:54,440 There was 1134 00:40:54,440 --> 00:40:54,880 one vendor 1135 00:40:54,880 --> 00:40:55,540 worth 1136 00:40:55,540 --> 00:40:56,040 mentioning 1137 00:40:56,040 --> 00:40:57,220 and this 1138 00:40:57,220 --> 00:40:58,700 vendor as 1139 00:40:58,700 --> 00:40:58,980 you can 1140 00:40:58,980 --> 00:40:59,340 see it 1141 00:41:11,140 --> 00:41:11,920 folder it 1142 00:41:11,920 --> 00:41:12,500 couldn't find 1143 00:41:12,500 --> 00:41:13,060 a lot of 1144 00:41:13,060 --> 00:41:13,340 the 1145 00:41:13,340 --> 00:41:14,440 exploits. 1146 00:41:14,500 --> 00:41:15,060 But when we 1147 00:41:15,060 --> 00:41:15,660 actually run 1148 00:41:15,660 --> 00:41:16,200 the IE 1149 00:41:16,200 --> 00:41:17,000 and have 1150 00:41:17,000 --> 00:41:17,700 made exploits 1151 00:41:17,700 --> 00:41:18,220 served to 1152 00:41:18,220 --> 00:41:18,900 us then 1153 00:41:19,540 --> 00:41:20,120 it's 1154 00:41:20,120 --> 00:41:20,640 basically 1155 00:41:20,640 --> 00:41:21,880 using its 1156 00:41:22,600 --> 00:41:23,180 hips 1157 00:41:23,180 --> 00:41:23,920 host space 1158 00:41:23,920 --> 00:41:24,580 intrusion 1159 00:41:24,580 --> 00:41:24,820 prevention 1160 00:41:24,820 --> 00:41:25,740 system it 1161 00:41:25,740 --> 00:41:26,140 was able to 1162 00:41:26,140 --> 00:41:26,640 detect every 1163 00:41:26,640 --> 00:41:27,000 one of 1164 00:41:27,000 --> 00:41:27,660 them doing 1165 00:41:27,660 --> 00:41:28,100 buffer 1166 00:41:28,100 --> 00:41:28,700 overflows. 1167 00:41:32,880 --> 00:41:34,040 So we're 1168 00:41:34,640 --> 00:41:35,220 originally 1169 00:41:35,220 --> 00:41:35,720 going to do a 1170 00:41:41,140 --> 00:41:41,220 lot of 1171 00:41:41,220 --> 00:41:42,080 of these 1172 00:41:42,080 --> 00:41:42,620 features we 1173 00:41:42,620 --> 00:41:43,080 can bypass 1174 00:41:43,080 --> 00:41:43,880 most of 1175 00:41:43,880 --> 00:41:44,460 them but I 1176 00:41:44,460 --> 00:41:45,020 think we're 1177 00:41:45,020 --> 00:41:45,240 going to be 1178 00:41:45,240 --> 00:41:45,740 out of time 1179 00:41:45,740 --> 00:41:46,520 and we'll 1180 00:41:46,520 --> 00:41:47,940 leave time 1181 00:41:47,940 --> 00:41:48,260 for some 1182 00:41:48,260 --> 00:41:48,680 questions. 1183 00:41:48,920 --> 00:41:49,620 So finally 1184 00:41:49,620 --> 00:41:50,940 again this 1185 00:41:50,940 --> 00:41:51,380 is to be 1186 00:41:51,380 --> 00:41:51,820 triggering 1187 00:41:51,820 --> 00:41:52,240 behavior 1188 00:41:52,240 --> 00:41:52,720 based 1189 00:41:52,720 --> 00:41:53,680 encryption. 1190 00:41:55,280 --> 00:41:56,100 When we 1191 00:41:56,100 --> 00:41:56,660 turn on 1192 00:41:56,660 --> 00:41:57,080 this feature 1193 00:41:57,080 --> 00:41:57,440 and we 1194 00:41:57,440 --> 00:41:58,020 submit to 1195 00:41:58,020 --> 00:41:58,560 webpubweb 1196 00:41:58,560 --> 00:41:58,940 for example 1197 00:41:58,940 --> 00:41:59,260 it doesn't 1198 00:41:59,260 --> 00:41:59,480 find 1199 00:41:59,480 --> 00:41:59,700 anything. 1200 00:42:02,260 --> 00:42:03,180 And what 1201 00:42:03,180 --> 00:42:03,960 happens is 1202 00:42:04,480 --> 00:42:05,000 if you 1203 00:42:05,000 --> 00:42:06,560 change our 1204 00:42:06,560 --> 00:42:07,040 eval 1205 00:42:07,040 --> 00:42:07,860 into alert 1206 00:42:08,480 --> 00:42:09,300 and you 1207 00:42:09,300 --> 00:42:09,740 alert it 1208 00:42:09,740 --> 00:42:10,420 in Firefox 1209 00:42:10,420 --> 00:42:11,100 it doesn't 1210 00:42:11,100 --> 00:42:11,480 show you 1211 00:42:11,480 --> 00:42:11,780 anything. 1212 00:42:12,880 --> 00:42:14,080 But you 1213 00:42:14,080 --> 00:42:15,040 alert in 1214 00:42:15,040 --> 00:42:15,420 IE 1215 00:42:16,060 --> 00:42:16,860 and it 1216 00:42:16,860 --> 00:42:17,340 shows you 1217 00:42:17,340 --> 00:42:17,840 the actual 1218 00:42:19,060 --> 00:42:19,800 what we're 1219 00:42:19,800 --> 00:42:20,080 trying to 1220 00:42:20,080 --> 00:42:20,340 do the 1221 00:42:20,340 --> 00:42:20,700 exploit. 1222 00:42:21,200 --> 00:42:22,160 So what we 1223 00:42:22,160 --> 00:42:22,820 did is 1224 00:42:22,820 --> 00:42:23,360 we said 1225 00:42:23,360 --> 00:42:23,760 okay we're 1226 00:42:23,760 --> 00:42:23,960 going to 1227 00:42:29,480 --> 00:42:29,940 only be 1228 00:42:29,940 --> 00:42:30,560 generated 1229 00:42:30,560 --> 00:42:31,840 if you 1230 00:42:31,840 --> 00:42:32,260 are the 1231 00:42:32,260 --> 00:42:32,660 correct 1232 00:42:32,660 --> 00:42:32,920 target 1233 00:42:32,920 --> 00:42:33,260 browser. 1234 00:42:33,700 --> 00:42:34,480 So if 1235 00:42:34,480 --> 00:42:34,640 you're 1236 00:42:34,640 --> 00:42:35,160 IE7 1237 00:42:35,160 --> 00:42:37,340 then only 1238 00:42:37,340 --> 00:42:38,080 IE7 1239 00:42:38,080 --> 00:42:42,180 is going 1240 00:42:42,180 --> 00:42:42,400 to be 1241 00:42:42,400 --> 00:42:42,620 able to 1242 00:42:42,620 --> 00:42:42,900 generate 1243 00:42:42,900 --> 00:42:43,440 that key. 1244 00:42:43,860 --> 00:42:44,780 So as you 1245 00:42:44,780 --> 00:42:45,100 can see 1246 00:42:45,100 --> 00:42:45,920 every browser 1247 00:42:45,920 --> 00:42:46,660 has a 1248 00:42:46,660 --> 00:42:46,960 lot of 1249 00:42:46,960 --> 00:42:47,280 different 1250 00:42:47,280 --> 00:42:48,300 features 1251 00:42:48,300 --> 00:42:48,940 and different 1252 00:42:48,940 --> 00:42:49,400 behaviors. 1253 00:42:49,820 --> 00:42:50,760 The rendering 1254 00:42:59,480 --> 00:42:59,560 is based 1255 00:42:59,560 --> 00:43:00,660 on HTML 1256 00:43:01,320 --> 00:43:01,920 parsing 1257 00:43:01,920 --> 00:43:02,520 based on 1258 00:43:02,520 --> 00:43:03,000 JavaScript 1259 00:43:03,000 --> 00:43:03,840 differences 1260 00:43:03,840 --> 00:43:04,720 all these 1261 00:43:04,720 --> 00:43:05,060 we put 1262 00:43:05,060 --> 00:43:05,480 all these 1263 00:43:05,480 --> 00:43:05,840 together 1264 00:43:05,840 --> 00:43:06,800 and we 1265 00:43:06,800 --> 00:43:07,120 came up 1266 00:43:07,120 --> 00:43:07,600 with a 1267 00:43:07,600 --> 00:43:07,860 lot of 1268 00:43:07,860 --> 00:43:08,080 checks. 1269 00:43:09,460 --> 00:43:10,600 So you 1270 00:43:10,600 --> 00:43:10,980 would say 1271 00:43:10,980 --> 00:43:11,780 okay this 1272 00:43:11,780 --> 00:43:12,120 exploit 1273 00:43:12,120 --> 00:43:12,420 works 1274 00:43:12,420 --> 00:43:12,980 only for 1275 00:43:12,980 --> 00:43:13,400 IE6. 1276 00:43:14,200 --> 00:43:15,020 Give me 1277 00:43:15,020 --> 00:43:15,360 an encrypted 1278 00:43:15,360 --> 00:43:16,220 version 1279 00:43:16,220 --> 00:43:16,780 of my 1280 00:43:16,780 --> 00:43:17,200 JavaScript 1281 00:43:17,200 --> 00:43:17,640 exploit 1282 00:43:17,640 --> 00:43:18,960 and give 1283 00:43:18,960 --> 00:43:19,080 me 1284 00:43:19,080 --> 00:43:19,920 JavaScript 1285 00:43:19,920 --> 00:43:20,900 to generate 1286 00:43:20,900 --> 00:43:21,580 the 1287 00:43:21,580 --> 00:43:22,220 decoding 1288 00:43:22,220 --> 00:43:22,400 key. 1289 00:43:24,260 --> 00:43:25,020 And the 1290 00:43:25,020 --> 00:43:25,320 key is 1291 00:43:25,320 --> 00:43:25,480 only 1292 00:43:25,480 --> 00:43:26,100 correctly 1293 00:43:26,100 --> 00:43:26,580 generated 1294 00:43:26,580 --> 00:43:26,900 if 1295 00:43:26,900 --> 00:43:27,200 JavaScript 1296 00:43:27,200 --> 00:43:27,620 is 1297 00:43:27,620 --> 00:43:27,860 run 1298 00:43:27,860 --> 00:43:28,460 under 1299 00:43:28,460 --> 00:43:28,820 IE6. 1300 00:43:30,100 --> 00:43:30,860 So what 1301 00:43:30,860 --> 00:43:31,160 we would 1302 00:43:31,160 --> 00:43:31,500 do is 1303 00:43:31,500 --> 00:43:31,900 we would 1304 00:43:31,900 --> 00:43:32,440 say okay 1305 00:43:32,440 --> 00:43:33,440 in order 1306 00:43:33,440 --> 00:43:34,040 to correctly 1307 00:43:34,040 --> 00:43:34,340 detect 1308 00:43:35,000 --> 00:43:35,600 IE6 1309 00:43:35,600 --> 00:43:35,920 we're 1310 00:43:35,920 --> 00:43:36,000 going 1311 00:43:36,000 --> 00:43:36,360 to use 1312 00:43:36,360 --> 00:43:36,860 we're 1313 00:43:36,860 --> 00:43:37,340 going to use 1314 00:43:37,340 --> 00:43:37,980 this subset 1315 00:43:37,980 --> 00:43:38,440 of our 1316 00:43:38,440 --> 00:43:38,800 checks 1317 00:43:38,800 --> 00:43:39,360 1, 1318 00:43:39,420 --> 00:43:39,600 3, 1319 00:43:39,640 --> 00:43:39,840 4, 1320 00:43:39,900 --> 00:43:40,120 6, 1321 00:43:40,200 --> 00:43:40,460 8, 1322 00:43:40,580 --> 00:43:41,060 9, 1323 00:43:41,120 --> 00:43:41,380 12, 1324 00:43:41,400 --> 00:43:41,620 14. 1325 00:43:42,600 --> 00:43:43,200 All right 1326 00:43:43,200 --> 00:43:43,480 and we're 1327 00:43:43,480 --> 00:43:43,780 going to 1328 00:43:43,780 --> 00:43:44,100 generate 1329 00:43:44,100 --> 00:43:44,760 we're 1330 00:43:44,760 --> 00:43:45,020 going to 1331 00:43:45,020 --> 00:43:45,160 assign 1332 00:43:45,160 --> 00:43:45,420 them 1333 00:43:45,420 --> 00:43:45,900 to each 1334 00:43:45,900 --> 00:43:46,260 variable. 1335 00:43:47,600 --> 00:43:48,000 We're 1336 00:43:48,000 --> 00:43:48,140 going to 1337 00:43:48,140 --> 00:43:48,520 generate 1338 00:43:48,520 --> 00:43:49,000 this piece 1339 00:43:49,000 --> 00:43:49,200 of 1340 00:43:49,200 --> 00:43:49,540 JavaScript 1341 00:43:49,540 --> 00:43:50,420 to be 1342 00:43:50,420 --> 00:43:50,760 served 1343 00:43:50,760 --> 00:43:51,000 together 1344 00:43:51,000 --> 00:43:51,340 with 1345 00:43:51,340 --> 00:43:51,460 the 1346 00:43:51,460 --> 00:43:51,780 exploit 1347 00:43:51,780 --> 00:43:52,860 and we 1348 00:43:52,860 --> 00:43:53,000 would 1349 00:43:53,000 --> 00:43:53,300 generate 1350 00:43:53,300 --> 00:43:53,540 the 1351 00:43:53,540 --> 00:43:53,820 correct 1352 00:43:53,820 --> 00:43:54,340 answers. 1353 00:43:54,540 --> 00:43:55,100 If you 1354 00:43:55,100 --> 00:43:55,240 are 1355 00:43:55,240 --> 00:43:55,700 IE6 1356 00:43:55,700 --> 00:43:56,200 the 1357 00:43:56,200 --> 00:43:56,580 correct 1358 00:43:56,580 --> 00:43:57,080 answers 1359 00:43:57,080 --> 00:43:57,660 should 1360 00:43:57,660 --> 00:43:57,880 be 1361 00:43:57,880 --> 00:43:58,580 those. 1362 00:44:01,380 --> 00:44:02,120 And then 1363 00:44:02,120 --> 00:44:02,220 we 1364 00:44:02,220 --> 00:44:02,440 would 1365 00:44:02,440 --> 00:44:03,080 scramble 1366 00:44:03,080 --> 00:44:03,460 it up. 1367 00:44:03,800 --> 00:44:04,440 So as 1368 00:44:04,440 --> 00:44:04,700 you can 1369 00:44:04,700 --> 00:44:04,960 see 1370 00:44:04,960 --> 00:44:05,420 the 1371 00:44:06,800 --> 00:44:07,140 R 1372 00:44:07,480 --> 00:44:07,900 value 1373 00:44:07,900 --> 00:44:08,340 is 1374 00:44:08,340 --> 00:44:08,800 scrambled 1375 00:44:08,800 --> 00:44:09,620 up but 1376 00:44:09,620 --> 00:44:10,640 the L 1377 00:44:10,640 --> 00:44:10,860 value 1378 00:44:10,860 --> 00:44:11,480 which is 1379 00:44:11,480 --> 00:44:12,180 ABCDE 1380 00:44:12,180 --> 00:44:12,620 remains 1381 00:44:12,620 --> 00:44:13,160 the same 1382 00:44:14,100 --> 00:44:15,180 and that 1383 00:44:15,180 --> 00:44:15,900 effectively 1384 00:44:15,900 --> 00:44:16,840 scrambles 1385 00:44:16,840 --> 00:44:17,220 up the 1386 00:44:17,220 --> 00:44:17,460 bits, 1387 00:44:17,560 --> 00:44:17,920 the correct 1388 00:44:17,920 --> 00:44:18,200 bits. 1389 00:44:18,380 --> 00:44:19,100 Which means 1390 00:44:19,100 --> 00:44:20,220 although we're 1391 00:44:20,220 --> 00:44:20,680 serving to 1392 00:44:20,680 --> 00:44:20,940 a lot 1393 00:44:20,940 --> 00:44:21,520 of IE6 1394 00:44:22,280 --> 00:44:22,960 we're 1395 00:44:22,960 --> 00:44:23,300 generating 1396 00:44:23,300 --> 00:44:23,660 a one 1397 00:44:23,660 --> 00:44:23,920 time 1398 00:44:23,920 --> 00:44:24,240 key 1399 00:44:24,240 --> 00:44:24,820 for 1400 00:44:36,320 --> 00:44:37,000 the 1401 00:44:37,000 --> 00:44:37,260 And so 1402 00:44:37,260 --> 00:44:37,740 we'll use 1403 00:44:37,740 --> 00:44:38,160 this as 1404 00:44:38,160 --> 00:44:38,460 the one 1405 00:44:38,460 --> 00:44:38,640 time 1406 00:44:38,640 --> 00:44:38,900 key 1407 00:44:40,280 --> 00:44:40,960 and 1408 00:44:40,960 --> 00:44:41,780 we'll 1409 00:44:41,780 --> 00:44:42,280 encrypt 1410 00:44:42,280 --> 00:44:43,380 and we'll 1411 00:44:43,380 --> 00:44:43,580 use 1412 00:44:43,580 --> 00:44:44,200 server side 1413 00:44:44,200 --> 00:44:44,560 script 1414 00:44:44,560 --> 00:44:45,440 which in 1415 00:44:45,440 --> 00:44:45,840 case 1416 00:44:45,840 --> 00:44:46,600 Metasploit 1417 00:44:46,600 --> 00:44:47,200 is in 1418 00:44:47,200 --> 00:44:47,420 Ruby 1419 00:44:47,420 --> 00:44:48,120 to 1420 00:44:48,120 --> 00:44:48,580 generate 1421 00:44:48,580 --> 00:44:48,920 to 1422 00:44:48,920 --> 00:44:49,480 encrypt 1423 00:44:49,480 --> 00:44:49,620 the 1424 00:44:49,620 --> 00:44:49,960 JavaScript 1425 00:44:49,960 --> 00:44:50,760 using 1426 00:44:50,760 --> 00:44:51,920 that 1427 00:44:51,920 --> 00:44:52,360 key. 1428 00:45:03,520 --> 00:45:04,440 And then 1429 00:45:04,960 --> 00:45:05,620 it's 1430 00:45:05,620 --> 00:45:06,040 very very 1431 00:45:06,040 --> 00:45:06,380 effective 1432 00:45:06,380 --> 00:45:06,940 right now 1433 00:45:06,940 --> 00:45:07,860 against most 1434 00:45:07,860 --> 00:45:08,720 behavior based 1435 00:45:09,480 --> 00:45:10,200 technologies 1436 00:45:10,200 --> 00:45:11,340 because 1437 00:45:11,340 --> 00:45:12,100 unless 1438 00:45:12,100 --> 00:45:12,920 you're 1439 00:45:12,920 --> 00:45:13,160 running 1440 00:45:13,160 --> 00:45:15,020 the exact 1441 00:45:15,020 --> 00:45:15,860 version of 1442 00:45:15,860 --> 00:45:16,580 IE or 1443 00:45:16,580 --> 00:45:17,120 operating 1444 00:45:17,120 --> 00:45:17,360 system 1445 00:45:17,360 --> 00:45:18,400 or 1446 00:45:18,400 --> 00:45:19,080 what have 1447 00:45:19,080 --> 00:45:19,260 you 1448 00:45:19,260 --> 00:45:20,720 then you're 1449 00:45:20,720 --> 00:45:21,000 not going 1450 00:45:21,000 --> 00:45:21,240 to be able 1451 00:45:21,240 --> 00:45:22,040 to decode 1452 00:45:22,040 --> 00:45:22,420 this piece 1453 00:45:22,420 --> 00:45:22,600 of 1454 00:45:22,600 --> 00:45:22,880 JavaScript. 1455 00:45:25,540 --> 00:45:26,260 So 1456 00:45:26,260 --> 00:45:27,540 conclusion 1457 00:45:27,540 --> 00:45:28,780 why is 1458 00:45:28,780 --> 00:45:29,200 it so hard 1459 00:45:29,200 --> 00:45:29,380 for 1460 00:45:29,380 --> 00:45:29,840 antivirus 1461 00:45:29,840 --> 00:45:31,160 because 1462 00:45:31,160 --> 00:45:31,860 antivirus 1463 00:45:31,860 --> 00:45:32,380 is designed 1464 00:45:32,380 --> 00:45:32,920 to install 1465 00:45:32,920 --> 00:45:33,620 on desktops 1466 00:45:33,620 --> 00:45:34,020 and notebooks 1467 00:45:34,020 --> 00:45:34,840 so 1468 00:45:34,840 --> 00:45:35,620 desktops 1469 00:45:35,620 --> 00:45:36,060 and notebooks 1470 00:45:36,060 --> 00:45:37,000 have very complicated 1471 00:45:37,000 --> 00:45:37,440 behaviors 1472 00:45:37,440 --> 00:45:38,800 strict resource 1473 00:45:38,800 --> 00:45:39,200 complaints 1474 00:45:39,200 --> 00:45:39,900 and therefore 1475 00:45:39,900 --> 00:45:40,540 AVs and 1476 00:45:40,540 --> 00:45:41,500 gateway vendors 1477 00:45:41,500 --> 00:45:42,480 rely on 1478 00:45:42,480 --> 00:45:43,080 signature based 1479 00:45:43,080 --> 00:45:43,480 technology 1480 00:45:43,480 --> 00:45:44,020 that has 1481 00:45:44,020 --> 00:45:44,560 been lightweight 1482 00:45:44,560 --> 00:45:45,120 and accurate 1483 00:45:46,300 --> 00:45:47,000 but 1484 00:45:47,000 --> 00:45:47,500 JavaScript 1485 00:45:47,500 --> 00:45:48,460 especially 1486 00:45:48,460 --> 00:45:48,860 driver 1487 00:45:48,860 --> 00:45:49,040 downloads 1488 00:45:49,780 --> 00:45:50,420 are just 1489 00:45:50,420 --> 00:45:51,340 in disposable 1490 00:45:51,340 --> 00:45:51,800 JavaScript. 1491 00:45:52,200 --> 00:45:53,140 They're generated 1492 00:45:53,140 --> 00:45:53,640 every time 1493 00:45:53,640 --> 00:45:54,600 they're served. 1494 00:45:55,620 --> 00:45:56,540 Disposable PDF 1495 00:45:56,540 --> 00:45:56,860 script 1496 00:45:56,860 --> 00:45:57,380 disposable 1497 00:45:58,180 --> 00:45:58,780 ECMA 1498 00:45:58,780 --> 00:45:59,080 scripts 1499 00:45:59,080 --> 00:45:59,700 basically 1500 00:45:59,700 --> 00:46:01,360 and JavaScript 1501 00:46:01,360 --> 00:46:02,020 packing is 1502 00:46:02,020 --> 00:46:02,440 the norm 1503 00:46:02,440 --> 00:46:03,360 so you can't say 1504 00:46:03,360 --> 00:46:03,860 every time you 1505 00:46:03,860 --> 00:46:04,240 see a 1506 00:46:04,240 --> 00:46:04,900 packed JavaScript 1507 00:46:05,680 --> 00:46:06,440 you're seeing 1508 00:46:06,440 --> 00:46:07,000 something malicious 1509 00:46:07,000 --> 00:46:07,920 because people love 1510 00:46:07,920 --> 00:46:08,560 to pack their 1511 00:46:08,560 --> 00:46:08,900 JavaScript 1512 00:46:08,900 --> 00:46:10,260 because they don't 1513 00:46:10,260 --> 00:46:10,500 want their 1514 00:46:10,500 --> 00:46:10,900 source code 1515 00:46:10,900 --> 00:46:11,480 to be taken 1516 00:46:11,480 --> 00:46:11,900 sometimes. 1517 00:46:18,860 --> 00:46:19,640 everybody uses 1518 00:46:19,640 --> 00:46:20,300 and so 1519 00:46:20,300 --> 00:46:21,660 it's very hard 1520 00:46:21,660 --> 00:46:22,160 to just use 1521 00:46:22,160 --> 00:46:22,660 heuristics 1522 00:46:22,660 --> 00:46:23,200 and say 1523 00:46:23,200 --> 00:46:24,520 packed JavaScript 1524 00:46:24,520 --> 00:46:25,320 is malicious 1525 00:46:25,320 --> 00:46:25,640 JavaScript. 1526 00:46:28,480 --> 00:46:29,160 Okay, 1527 00:46:29,260 --> 00:46:29,540 how about 1528 00:46:29,540 --> 00:46:30,200 behavior based 1529 00:46:30,200 --> 00:46:31,480 such as 1530 00:46:31,480 --> 00:46:32,100 Honeyclined 1531 00:46:32,100 --> 00:46:32,600 Sandbox 1532 00:46:32,600 --> 00:46:33,320 SpiderMonkey 1533 00:46:33,320 --> 00:46:33,700 Rhino 1534 00:46:33,700 --> 00:46:34,360 JSON Pack 1535 00:46:34,360 --> 00:46:34,980 Web Publet 1536 00:46:34,980 --> 00:46:35,580 Python 1537 00:46:35,580 --> 00:46:36,300 Honeyclined. 1538 00:46:36,440 --> 00:46:37,120 Well, 1539 00:46:37,300 --> 00:46:38,240 use VBScript 1540 00:46:38,240 --> 00:46:39,000 for example 1541 00:46:39,000 --> 00:46:39,740 is an effective 1542 00:46:39,740 --> 00:46:40,540 way we haven't 1543 00:46:40,540 --> 00:46:40,900 demoed it 1544 00:46:40,900 --> 00:46:41,460 here. 1545 00:46:42,900 --> 00:46:43,740 Don't serve 1546 00:46:48,860 --> 00:46:49,400 and also 1547 00:46:49,400 --> 00:46:50,100 very little 1548 00:46:50,100 --> 00:46:50,560 but effective 1549 00:46:50,560 --> 00:46:51,360 techniques 1550 00:46:51,360 --> 00:46:51,920 for example 1551 00:46:51,920 --> 00:46:52,360 sleep 1552 00:46:52,360 --> 00:46:52,980 for 1553 00:46:54,120 --> 00:46:55,160 some time 1554 00:46:55,160 --> 00:46:56,140 right because 1555 00:46:56,140 --> 00:46:56,900 if you have to 1556 00:46:56,900 --> 00:46:57,480 scan millions 1557 00:46:57,480 --> 00:46:57,980 and millions 1558 00:46:57,980 --> 00:46:58,780 of pages a day 1559 00:46:58,780 --> 00:46:59,280 if you're Google 1560 00:46:59,280 --> 00:47:00,020 you don't have 1561 00:47:00,020 --> 00:47:00,720 time to wait 1562 00:47:00,720 --> 00:47:01,360 for three minutes 1563 00:47:01,360 --> 00:47:02,180 to see 1564 00:47:02,180 --> 00:47:02,840 if some 1565 00:47:02,840 --> 00:47:03,300 JavaScript 1566 00:47:04,700 --> 00:47:05,220 executes 1567 00:47:05,220 --> 00:47:05,560 or not 1568 00:47:05,560 --> 00:47:07,000 and so that 1569 00:47:07,000 --> 00:47:08,560 one line 1570 00:47:08,560 --> 00:47:09,220 can be pretty 1571 00:47:09,220 --> 00:47:09,480 effective 1572 00:47:09,480 --> 00:47:10,260 it's not sleep 1573 00:47:10,260 --> 00:47:10,980 it's set timeout 1574 00:47:10,980 --> 00:47:11,220 but 1575 00:47:11,220 --> 00:47:12,600 it's the same concept 1576 00:47:12,600 --> 00:47:13,480 or time lock puzzles. 1577 00:47:14,340 --> 00:47:15,640 So future work 1578 00:47:15,640 --> 00:47:18,400 what we haven't 1579 00:47:18,400 --> 00:47:19,040 implemented here 1580 00:47:19,040 --> 00:47:20,180 that is very 1581 00:47:20,180 --> 00:47:21,040 widely used 1582 00:47:21,040 --> 00:47:22,000 is randomly 1583 00:47:22,000 --> 00:47:22,480 chopped up 1584 00:47:22,480 --> 00:47:22,900 scripts and 1585 00:47:22,900 --> 00:47:23,560 split into 1586 00:47:23,560 --> 00:47:24,300 individual files 1587 00:47:24,300 --> 00:47:26,320 generating VBScript 1588 00:47:26,320 --> 00:47:26,900 instead of 1589 00:47:26,900 --> 00:47:27,240 JavaScript 1590 00:47:28,260 --> 00:47:28,940 encrypting 1591 00:47:28,940 --> 00:47:29,140 using 1592 00:47:29,820 --> 00:47:31,000 data existing 1593 00:47:31,000 --> 00:47:31,940 outside of 1594 00:47:31,940 --> 00:47:32,260 HTML 1595 00:47:32,260 --> 00:47:33,020 for example 1596 00:47:33,020 --> 00:47:33,940 HTTP headers 1597 00:47:33,940 --> 00:47:34,680 so that 1598 00:47:34,680 --> 00:47:36,280 you can't 1599 00:47:36,280 --> 00:47:36,780 submit that 1600 00:47:36,780 --> 00:47:37,520 piece of HTML 1601 00:47:37,520 --> 00:47:37,820 to an 1602 00:47:37,820 --> 00:47:38,040 enterprise 1603 00:47:38,040 --> 00:47:38,380 vendor 1604 00:47:38,380 --> 00:47:38,820 because 1605 00:47:39,380 --> 00:47:40,300 the key 1606 00:47:40,300 --> 00:47:41,480 to correctly 1607 00:47:41,480 --> 00:47:42,420 decrypt itself 1608 00:47:42,420 --> 00:47:43,300 is in the 1609 00:47:43,300 --> 00:47:43,920 HTTP header 1610 00:47:43,920 --> 00:47:44,760 which is not a part 1611 00:47:44,760 --> 00:47:45,040 of the 1612 00:47:45,040 --> 00:47:46,220 HTML 1613 00:47:46,980 --> 00:47:48,240 so all these 1614 00:47:48,240 --> 00:47:48,620 are 1615 00:47:49,180 --> 00:47:49,900 future work 1616 00:47:49,900 --> 00:47:50,900 and DriveSploit 1617 00:47:50,900 --> 00:47:51,620 is open source 1618 00:47:51,620 --> 00:47:52,540 and we really 1619 00:47:52,540 --> 00:47:53,720 are looking for 1620 00:47:53,720 --> 00:47:54,200 contributors 1621 00:47:54,200 --> 00:47:55,080 to join us. 1622 00:47:57,160 --> 00:47:57,800 Discussion 1623 00:47:59,100 --> 00:47:59,740 and 1624 00:48:00,160 --> 00:48:01,360 the talk 1625 00:48:01,360 --> 00:48:01,880 that we heard 1626 00:48:01,880 --> 00:48:02,480 this morning 1627 00:48:03,440 --> 00:48:04,080 the 1628 00:48:06,060 --> 00:48:06,700 by 1629 00:48:06,700 --> 00:48:08,360 a cursory 1630 00:48:08,380 --> 00:48:08,640 of 1631 00:48:08,640 --> 00:48:09,260 EFF 1632 00:48:09,260 --> 00:48:10,420 basically said 1633 00:48:10,420 --> 00:48:10,720 that 1634 00:48:11,580 --> 00:48:13,300 94.2% 1635 00:48:13,300 --> 00:48:14,320 of 1636 00:48:14,320 --> 00:48:15,320 typical desktop 1637 00:48:15,320 --> 00:48:15,800 browsers 1638 00:48:15,800 --> 00:48:16,560 are unique 1639 00:48:16,560 --> 00:48:17,420 can be uniquely 1640 00:48:17,420 --> 00:48:18,240 fingerprinted 1641 00:48:18,240 --> 00:48:19,360 as you know 1642 00:48:19,360 --> 00:48:20,120 drive by download 1643 00:48:20,120 --> 00:48:21,100 is widely used 1644 00:48:21,100 --> 00:48:22,200 in targeted attacks 1645 00:48:22,200 --> 00:48:23,220 so 1646 00:48:23,220 --> 00:48:24,560 if 1647 00:48:24,560 --> 00:48:25,580 the percentage 1648 00:48:25,580 --> 00:48:26,240 is that high 1649 00:48:26,240 --> 00:48:27,520 because in targeted 1650 00:48:27,520 --> 00:48:28,780 what people don't 1651 00:48:28,780 --> 00:48:29,340 understand about 1652 00:48:29,340 --> 00:48:29,960 drive by downloads 1653 00:48:29,960 --> 00:48:30,840 is not the 1654 00:48:30,840 --> 00:48:31,200 technology 1655 00:48:31,200 --> 00:48:31,720 it's not 1656 00:48:31,720 --> 00:48:33,280 why drive by downloads 1657 00:48:33,280 --> 00:48:33,660 are used 1658 00:48:33,660 --> 00:48:34,800 effectively 1659 00:48:38,560 --> 00:48:39,480 it's when 1660 00:48:40,280 --> 00:48:40,780 it's in 1661 00:48:41,380 --> 00:48:42,340 what's a targeted attack 1662 00:48:42,340 --> 00:48:42,940 it's targeted 1663 00:48:42,940 --> 00:48:43,540 meaning 1664 00:48:44,320 --> 00:48:45,040 you're a targeted 1665 00:48:45,040 --> 00:48:45,640 person 1666 00:48:45,640 --> 00:48:46,640 that the 1667 00:48:46,640 --> 00:48:47,980 attacker wants to attack 1668 00:48:47,980 --> 00:48:49,440 you call your colleague 1669 00:48:49,440 --> 00:48:49,960 and say hey 1670 00:48:49,960 --> 00:48:50,920 I want to know this data 1671 00:48:50,920 --> 00:48:52,060 can you send me the email 1672 00:48:52,060 --> 00:48:52,580 right away 1673 00:48:53,360 --> 00:48:54,200 the attacker 1674 00:48:54,200 --> 00:48:55,060 knows about it 1675 00:48:55,060 --> 00:48:55,280 somehow 1676 00:48:55,280 --> 00:48:56,040 immediately 1677 00:48:56,040 --> 00:48:57,380 and sends you the email 1678 00:48:57,380 --> 00:48:57,860 immediately 1679 00:48:57,860 --> 00:48:59,600 with a drive by download 1680 00:48:59,600 --> 00:49:00,660 that's a targeted attack 1681 00:49:01,360 --> 00:49:02,420 and this happens 1682 00:49:02,420 --> 00:49:03,360 quite a lot 1683 00:49:03,360 --> 00:49:04,740 and so 1684 00:49:04,740 --> 00:49:05,460 in targeted attack 1685 00:49:05,460 --> 00:49:06,500 this actually 1686 00:49:06,500 --> 00:49:07,160 can be used 1687 00:49:07,160 --> 00:49:07,560 because 1688 00:49:07,560 --> 00:49:08,820 you should have 1689 00:49:08,820 --> 00:49:09,700 enough knowledge 1690 00:49:09,700 --> 00:49:10,920 about your target 1691 00:49:10,920 --> 00:49:12,600 to know what 1692 00:49:12,600 --> 00:49:13,580 his browser is 1693 00:49:13,580 --> 00:49:14,300 and then you 1694 00:49:14,300 --> 00:49:15,060 and then you can 1695 00:49:15,060 --> 00:49:15,720 encrypt 1696 00:49:15,720 --> 00:49:17,140 your exploit 1697 00:49:17,140 --> 00:49:17,520 so that 1698 00:49:17,520 --> 00:49:17,940 that 1699 00:49:17,940 --> 00:49:19,460 very few browsers 1700 00:49:19,920 --> 00:49:21,160 other than his browser 1701 00:49:21,160 --> 00:49:21,980 in his environment 1702 00:49:21,980 --> 00:49:23,100 can decode 1703 00:49:23,100 --> 00:49:24,580 your piece of 1704 00:49:24,580 --> 00:49:24,860 JavaScript 1705 00:49:24,860 --> 00:49:27,400 and that ends the talk 1706 00:49:27,400 --> 00:49:27,920 I'm sorry 1707 00:49:27,920 --> 00:49:28,960 we're out of time 1708 00:49:28,960 --> 00:49:29,520 for questions 1709 00:49:29,520 --> 00:49:30,220 but I'll be here 1710 00:49:30,220 --> 00:49:31,220 to answer your questions 1711 00:49:31,220 --> 00:49:31,900 thank you