1 00:00:09,000 --> 00:00:13,460 Now, see, this is the part of the presentation when I usually photograph the audience, but 2 00:00:13,460 --> 00:00:15,760 I want to issue you with a warning. 3 00:00:15,940 --> 00:00:21,380 What we're going to review here is how to audit, how to legally audit or search for 4 00:00:21,380 --> 00:00:26,060 vulnerabilities in web applications that you have written permission to do those kind of 5 00:00:26,060 --> 00:00:26,240 things. 6 00:00:26,240 --> 00:00:28,200 So make sure you do get permission in writing. 7 00:00:29,200 --> 00:00:31,420 Maybe some of you are familiar with Randall Schwartz. 8 00:00:32,120 --> 00:00:32,880 Nice guy. 9 00:00:32,940 --> 00:00:35,600 He's finished last and with three counts of felony. 10 00:00:38,000 --> 00:00:42,820 So check out the link and his legal case years ago working for a small company called Intel, 11 00:00:43,020 --> 00:00:47,880 and he got in trouble for doing some sysadmin stuff on boxes that technically weren't his. 12 00:00:48,220 --> 00:00:51,520 So you've been warned because you don't want to go to jail. 13 00:00:52,060 --> 00:00:53,340 No, sir, please. 14 00:00:53,360 --> 00:00:54,600 I can't go to prison. 15 00:00:54,720 --> 00:00:56,060 They're peeing a cup in front. 16 00:00:56,240 --> 00:00:56,740 What's going on here? 17 00:00:56,820 --> 00:00:58,400 I saw it in a movie. 18 00:00:58,740 --> 00:00:59,540 All right. 19 00:01:01,160 --> 00:01:01,980 All right. 20 00:01:02,140 --> 00:01:07,700 The following presentation is based on actual case studies, actual vulnerability assessments 21 00:01:07,700 --> 00:01:11,300 that I've done over the last whatever number of years since early 96. 22 00:01:11,480 --> 00:01:12,900 So these are true stories. 23 00:01:13,000 --> 00:01:13,780 They're not fiction. 24 00:01:14,060 --> 00:01:14,860 You want answers? 25 00:01:15,120 --> 00:01:16,000 I think I'm entitled. 26 00:01:16,220 --> 00:01:17,240 You want answers? 27 00:01:17,240 --> 00:01:18,260 I want the truth. 28 00:01:18,460 --> 00:01:20,100 You can't handle the truth. 29 00:01:20,720 --> 00:01:21,380 All right. 30 00:01:21,400 --> 00:01:23,500 Last sound effect for quite some time so you can relax. 31 00:01:24,520 --> 00:01:25,800 So we're about to see. 32 00:01:26,240 --> 00:01:30,620 The point of pointing out that the real is that if these folks made these problems, 33 00:01:30,800 --> 00:01:33,280 maybe your corporation could be having the same problems. 34 00:01:33,420 --> 00:01:35,260 And we're talking the big boys. 35 00:01:35,420 --> 00:01:39,940 I've been fortunate enough to be in the right place at the right time to do some assessments for, 36 00:01:40,460 --> 00:01:43,440 I refer to one of them as Big Bank under NDA. 37 00:01:43,600 --> 00:01:48,520 I can't say who it is, but very large banks, global banking, business of business banking, 38 00:01:49,180 --> 00:01:53,060 online reservation systems, 401K programs. 39 00:01:53,660 --> 00:01:54,460 You've named it. 40 00:01:54,480 --> 00:01:54,940 I've seen it. 41 00:01:55,000 --> 00:01:56,140 So I've taken some of the. 42 00:01:56,240 --> 00:02:03,640 Vulnerabilities that I've discovered and I've sort of put them in here, changed it around so you can't tell who it is and make it more interesting. 43 00:02:05,420 --> 00:02:06,120 All right. 44 00:02:06,200 --> 00:02:07,000 So why are we here? 45 00:02:07,160 --> 00:02:11,740 We're going to talk about various web-based vulnerabilities, web application vulnerabilities, 46 00:02:11,880 --> 00:02:18,180 and the tools and methods needed in order to locate them and identify them. 47 00:02:18,800 --> 00:02:22,060 What we're not going to talk about is comprehensive methodology. 48 00:02:22,780 --> 00:02:25,460 I believe I'm speaking at USENIX Tuesday. 49 00:02:25,460 --> 00:02:30,100 On a full day on this, so come on down and check that out. 50 00:02:30,220 --> 00:02:34,480 But otherwise, we're just going to skim through it real quick and hit the high points and show you some examples. 51 00:02:34,680 --> 00:02:36,100 We're not going to cover all tools. 52 00:02:36,280 --> 00:02:45,100 My apologies in advance if your tool didn't make it in the presentation and you think the ones I'm demoing are not as cool. 53 00:02:45,320 --> 00:02:45,720 Sorry. 54 00:02:46,620 --> 00:02:52,260 And we're not going to talk about solutions, although part of the solution to any problem is to know you have a problem, right? 55 00:02:52,320 --> 00:02:53,260 That's always the first step. 56 00:02:53,620 --> 00:02:55,260 So that's probably. 57 00:02:55,260 --> 00:02:56,940 We're going to talk about, as far as we're going to cover it, is awareness. 58 00:02:58,300 --> 00:02:59,400 A little bit about me. 59 00:02:59,760 --> 00:03:00,820 Any Penn Staters? 60 00:03:01,340 --> 00:03:02,880 Woo, I'm the only one. 61 00:03:02,920 --> 00:03:03,120 Okay. 62 00:03:05,060 --> 00:03:06,060 All righty then. 63 00:03:06,100 --> 00:03:10,220 I started my illustrious career at a little known company known as Bellcore. 64 00:03:10,420 --> 00:03:14,400 Perhaps some of you know them because you're on their networks. 65 00:03:14,520 --> 00:03:17,560 Years ago as a phone freaker, Bell Communications Research. 66 00:03:18,300 --> 00:03:20,100 And now I'm working for Maven. 67 00:03:20,380 --> 00:03:21,940 And that's me on the right. 68 00:03:22,140 --> 00:03:23,580 Wow, that's a great story. 69 00:03:23,680 --> 00:03:24,780 I'd love to hear the end of it sometime. 70 00:03:24,780 --> 00:03:25,440 Bye-bye. 71 00:03:25,500 --> 00:03:25,960 All right. 72 00:03:27,700 --> 00:03:28,580 Here's the agenda. 73 00:03:28,740 --> 00:03:31,680 We're going to very, very briefly define the problem. 74 00:03:31,880 --> 00:03:33,640 I think we know what the problem is. 75 00:03:33,820 --> 00:03:36,660 And then we'll get into a tool set. 76 00:03:36,760 --> 00:03:43,820 Kind of build up a set of tools that cover the key functionality required to look at the security of a web-based application. 77 00:03:44,660 --> 00:03:47,200 And then very quickly we'll try to move through that. 78 00:03:47,340 --> 00:03:48,860 There's a lot of reference material. 79 00:03:49,160 --> 00:03:50,580 Stuff I'm not going to cover in detail. 80 00:03:50,760 --> 00:03:54,760 But it will serve as a good reference later when you download these slides off of the DEF CON. 81 00:03:54,780 --> 00:03:56,480 Or off of our site. 82 00:03:57,280 --> 00:04:01,300 Once we have our tool set, we're going to take a look at some various points of attack. 83 00:04:01,500 --> 00:04:03,460 Points of weakness within a web-based application. 84 00:04:03,960 --> 00:04:08,580 And then we'll start pulling out the tools and going to town and doing some demos. 85 00:04:09,100 --> 00:04:17,120 And then finally, after I point out all the various problems, we'll give a list of resources of where you can go and download best practices. 86 00:04:17,420 --> 00:04:21,760 You know, how to code, how to filter user input, all that good stuff. 87 00:04:21,920 --> 00:04:23,800 How to secure your web-based applications. 88 00:04:23,800 --> 00:04:24,960 So I won't leave you hanging. 89 00:04:25,080 --> 00:04:27,060 I'll give you some resources for further research. 90 00:04:27,900 --> 00:04:28,680 All right. 91 00:04:28,720 --> 00:04:29,380 What is the problem? 92 00:04:29,500 --> 00:04:30,800 Can't we just all get along? 93 00:04:31,660 --> 00:04:32,180 No. 94 00:04:32,940 --> 00:04:33,980 No, we can't. 95 00:04:34,040 --> 00:04:36,460 Websites are getting hacked for all various different reasons. 96 00:04:37,260 --> 00:04:39,240 Perhaps some sort of genetic deficiency. 97 00:04:39,580 --> 00:04:40,420 Not deficiency. 98 00:04:40,820 --> 00:04:41,340 Enhancement. 99 00:04:41,440 --> 00:04:41,800 Sorry. 100 00:04:43,960 --> 00:04:50,100 But regardless of the reason, the bottom line is sites are getting hacked. 101 00:04:50,260 --> 00:04:52,680 And there's lots of great sites out there. 102 00:04:52,680 --> 00:04:55,860 That show you the defacements like Zone H. 103 00:04:57,280 --> 00:05:02,000 And we're not just talking about websites being scribbled on. 104 00:05:02,120 --> 00:05:05,160 In a lot of cases, we're talking about applications that have been exploited. 105 00:05:05,400 --> 00:05:10,740 And in fact, I have here captured some of the latest headlines under security tracker. 106 00:05:10,900 --> 00:05:12,480 Because they have a category for applications. 107 00:05:12,940 --> 00:05:16,280 And so you can zoom in here and take a look at all these web-based applications. 108 00:05:17,040 --> 00:05:18,400 Most of them are web-based. 109 00:05:18,480 --> 00:05:20,680 And they show you how. 110 00:05:21,500 --> 00:05:21,980 How. 111 00:05:21,980 --> 00:05:22,800 You know. 112 00:05:23,420 --> 00:05:26,520 Various things can be exploited right through the comfort of your own browser. 113 00:05:27,120 --> 00:05:28,640 And here's a nice one here. 114 00:05:29,280 --> 00:05:30,080 Further down. 115 00:05:30,760 --> 00:05:32,200 Where you can do command injection. 116 00:05:32,640 --> 00:05:37,140 But just by modifying the URL, we're going to see some attacks like that. 117 00:05:37,260 --> 00:05:39,780 Only we won't be able to put it into the URL. 118 00:05:39,880 --> 00:05:41,180 We'll have to do it through a cookie. 119 00:05:41,780 --> 00:05:43,600 And again, real examples. 120 00:05:45,960 --> 00:05:46,520 All right. 121 00:05:46,540 --> 00:05:50,720 So the bottom line is somebody's going to be flipping burgers because the website got hacked. 122 00:05:50,820 --> 00:05:51,460 That's the problem. 123 00:05:51,980 --> 00:05:52,500 The websites are getting hacked. 124 00:05:52,800 --> 00:05:56,120 Very big problem. 125 00:05:56,360 --> 00:05:58,840 And it's only going to get worse as everything's being webified. 126 00:05:59,760 --> 00:06:03,700 Old database or mainframe apps are now webified. 127 00:06:04,180 --> 00:06:05,040 The military. 128 00:06:05,220 --> 00:06:05,840 I've seen articles. 129 00:06:05,920 --> 00:06:08,700 The military is talking about webified weapon systems. 130 00:06:09,260 --> 00:06:09,740 Yeah. 131 00:06:10,800 --> 00:06:13,020 We're going to need you to not do that. 132 00:06:14,020 --> 00:06:14,500 Yeah. 133 00:06:14,580 --> 00:06:16,620 Especially when you see the examples that I do have. 134 00:06:16,800 --> 00:06:18,500 So that's probably the biggest thing that worries me. 135 00:06:18,500 --> 00:06:22,500 Here are the essential techniques that we need for our toolkit. 136 00:06:22,720 --> 00:06:26,900 We need to be able to intercept and manipulate raw hypertext transfer protocol. 137 00:06:27,120 --> 00:06:29,300 That's the stuff going between the browser and the server. 138 00:06:30,980 --> 00:06:34,360 And we also would like the ability to mirror a website. 139 00:06:34,820 --> 00:06:36,440 And I'll cover that briefly. 140 00:06:36,620 --> 00:06:38,040 But I don't have any demos for that. 141 00:06:38,280 --> 00:06:41,560 Also, we want to automate fake browser requests. 142 00:06:41,920 --> 00:06:42,760 Brute forcing. 143 00:06:42,960 --> 00:06:44,600 Not just authentication either. 144 00:06:44,820 --> 00:06:46,940 Brute forcing various elements. 145 00:06:46,940 --> 00:06:49,260 Some folks call it fuzzing. 146 00:06:49,640 --> 00:06:51,080 And I'll show you some stuff for that. 147 00:06:51,300 --> 00:06:56,460 And then finally in your toolkit, one of the more important things is to be able to decompile Java applets. 148 00:06:56,820 --> 00:07:03,380 And so that's what we're going to very quickly build a toolkit and then move on to see it in action. 149 00:07:04,460 --> 00:07:08,600 The first and foremost thing is to be able to intercept and manipulate your traffic. 150 00:07:09,620 --> 00:07:10,720 Why do you want to do this? 151 00:07:10,780 --> 00:07:13,280 Well, you can bypass all sorts of client-side restrictions. 152 00:07:13,740 --> 00:07:16,360 Way back in the day, people thought you could, you know, 153 00:07:16,360 --> 00:07:19,540 filter user input by using client-side JavaScript. 154 00:07:19,980 --> 00:07:23,900 That doesn't really work when the person owns the system, the client-side system. 155 00:07:24,120 --> 00:07:25,240 And they can bypass all that. 156 00:07:25,600 --> 00:07:32,780 Want to be able to maybe violate the HTTP protocol by adding in headers that are too large and things like that. 157 00:07:33,000 --> 00:07:35,840 Maybe insert alternate choices in the pull-down menu. 158 00:07:36,060 --> 00:07:39,140 Or pretty much just change any portion of the traffic. 159 00:07:39,220 --> 00:07:41,000 And we'll see several examples of that today. 160 00:07:42,760 --> 00:07:44,580 And also, not to be forgotten. 161 00:07:44,580 --> 00:07:48,340 It's very important if you're intercepting your traffic, you want to record it. 162 00:07:48,620 --> 00:07:54,280 Later on, you'll be able to search through it for various things like hidden comments within the HTML. 163 00:07:55,220 --> 00:07:57,520 All right, so let's cover a little bit of history. 164 00:07:57,700 --> 00:08:04,440 This is old news, but Achilles was the world's first publicly released general purpose web application security assessment tool. 165 00:08:05,200 --> 00:08:06,400 Anybody heard of it? 166 00:08:06,920 --> 00:08:07,820 Yeah, okay. 167 00:08:08,040 --> 00:08:10,620 So that was a little idea I came up with a couple years back. 168 00:08:10,740 --> 00:08:14,540 I was actually using something similar, only less stable. 169 00:08:14,580 --> 00:08:18,740 And if you can imagine anything being less stable than Achilles, there you go. 170 00:08:18,940 --> 00:08:21,300 And so I got with my friend Roberto. 171 00:08:21,620 --> 00:08:25,560 And he just coded it up real fast and threw it out on the net. 172 00:08:25,900 --> 00:08:27,740 And my apologies. 173 00:08:28,040 --> 00:08:30,580 So it was released in October 2000. 174 00:08:31,020 --> 00:08:35,060 Shortly after this was released, Rainforest Public came out with something. 175 00:08:35,180 --> 00:08:37,440 And then the folks at AdStay came out with something. 176 00:08:37,540 --> 00:08:38,560 And a couple other people. 177 00:08:38,660 --> 00:08:39,660 And now there's a whole bunch. 178 00:08:39,740 --> 00:08:41,020 And they're all vastly superior. 179 00:08:41,260 --> 00:08:43,460 I include it in here for historical purposes. 180 00:08:43,460 --> 00:08:45,480 So what was it? 181 00:08:45,520 --> 00:08:47,340 And what are the others like as well? 182 00:08:47,520 --> 00:08:49,420 It's like a matrix style web proxy. 183 00:08:49,480 --> 00:08:54,920 You can freeze frame your traffic and be able to manipulate it and then send it on its way. 184 00:08:55,500 --> 00:09:00,860 And the really nice thing about Achilles is that you can modify traffic in either direction. 185 00:09:01,400 --> 00:09:05,300 And you can also modify SSL traffic. 186 00:09:05,440 --> 00:09:06,000 It doesn't matter. 187 00:09:06,080 --> 00:09:07,640 Encryption does not protect your website. 188 00:09:08,100 --> 00:09:11,340 I know the vendors like to say it's secure HTTP. 189 00:09:11,760 --> 00:09:13,440 No, it's private HTTP. 190 00:09:13,440 --> 00:09:14,520 It's not HTTP in transit. 191 00:09:14,720 --> 00:09:19,100 But it doesn't really secure your website from buffer overflows and all sorts of manipulation. 192 00:09:22,440 --> 00:09:24,020 And again, apologies. 193 00:09:24,260 --> 00:09:25,580 Achilles only runs under Windows. 194 00:09:25,700 --> 00:09:29,380 But you can force it to run it under UNIX with Wine. 195 00:09:29,760 --> 00:09:33,760 But it's basically a big kludge and just like notepad with an attitude. 196 00:09:34,140 --> 00:09:35,460 And this is kind of what it looks like. 197 00:09:35,600 --> 00:09:38,040 You can intercept your traffic and modify it. 198 00:09:38,060 --> 00:09:39,680 And I'll give you a little demo of that later on. 199 00:09:39,740 --> 00:09:41,300 But here we see a request coming. 200 00:09:41,420 --> 00:09:42,300 Actually, a reply. 201 00:09:42,300 --> 00:09:43,780 Coming back from a web server. 202 00:09:43,960 --> 00:09:46,460 And they're trying to set a cookie for us. 203 00:09:46,560 --> 00:09:51,420 And this is our opportunity to modify the cookie once and for all before it gets into our memory. 204 00:09:52,440 --> 00:09:56,760 Most other tools that are in this category will let you modify it on the way out. 205 00:09:56,920 --> 00:09:58,380 So you have to modify it every time. 206 00:09:58,520 --> 00:10:04,560 This is a nice way to modify once and for all without having to repeat it over and over. 207 00:10:04,700 --> 00:10:06,560 So this is how it works with SSL. 208 00:10:06,660 --> 00:10:08,440 You have a web browser talking to Achilles. 209 00:10:08,680 --> 00:10:12,280 Achilles acts like a web browser when it talks to the server. 210 00:10:12,280 --> 00:10:17,620 But when the web browser, it's when the real web browser talks to Achilles, it acts like a server, web server. 211 00:10:17,860 --> 00:10:23,680 So when it comes to breaking SSL, it creates two SSL sessions. 212 00:10:23,880 --> 00:10:31,360 And so now your browser will warn you, hey, the digital certificate from Yahoo is signed by somebody named Dasquid. 213 00:10:31,680 --> 00:10:33,200 And it's not Verisign. 214 00:10:34,000 --> 00:10:36,480 Dasquid is Rob's old Navy nickname. 215 00:10:36,680 --> 00:10:39,120 So it has a little certificate and everything. 216 00:10:39,340 --> 00:10:41,340 And so it does man in the middle. 217 00:10:41,340 --> 00:10:42,840 But it obviously doesn't break crypto. 218 00:10:42,900 --> 00:10:45,320 If it broke SSL, it would have made more headlines. 219 00:10:45,600 --> 00:10:46,200 So no. 220 00:10:46,580 --> 00:10:50,040 But for auditing purposes, it does the job. 221 00:10:51,440 --> 00:10:52,540 I see everything. 222 00:10:53,080 --> 00:10:55,520 So just a real quick demo then. 223 00:10:55,860 --> 00:10:58,940 And then I promise we will move on to vastly superior tools. 224 00:11:02,160 --> 00:11:06,120 Is there any work being done on Achilles? 225 00:11:06,280 --> 00:11:06,760 No. 226 00:11:07,780 --> 00:11:10,700 There might be if you request it nicely. 227 00:11:10,700 --> 00:11:12,480 But he doesn't seem interested. 228 00:11:12,940 --> 00:11:16,880 I tried to explain to him how important this really was when it came out because it was the first. 229 00:11:17,880 --> 00:11:18,960 Will he give out the source? 230 00:11:19,120 --> 00:11:19,780 Probably not. 231 00:11:19,960 --> 00:11:24,480 But I know a couple of people that came up to me and said they reversed it and that the code was really poorly written. 232 00:11:24,880 --> 00:11:27,380 And I was like, where do you work? 233 00:11:27,500 --> 00:11:28,680 And they're like, oh, CrankHall, CrankHall. 234 00:11:28,740 --> 00:11:29,640 And they walk away. 235 00:11:30,320 --> 00:11:32,340 I think he was working for IBM actually. 236 00:11:32,640 --> 00:11:34,580 So no, I don't have the source either. 237 00:11:34,840 --> 00:11:38,520 And that's the problem with coming up with a great idea and then having someone else code it. 238 00:11:38,680 --> 00:11:39,860 They control the source. 239 00:11:39,860 --> 00:11:40,880 They can do whatever they want. 240 00:11:41,160 --> 00:11:43,260 So I'll put a request in. 241 00:11:43,300 --> 00:11:46,560 I think it's time for a new version, maybe something that doesn't crash every five minutes. 242 00:11:47,860 --> 00:11:50,000 So I'll give you a quick demo. 243 00:11:54,580 --> 00:11:58,240 So you just configure your browser real quick to use a proxy. 244 00:11:58,460 --> 00:12:01,160 Many of you probably use a proxy at work to get out. 245 00:12:02,580 --> 00:12:07,020 Well, you just change it to this proxy, which is you can run it on local host. 246 00:12:07,100 --> 00:12:08,800 You can run it on another box and connect. 247 00:12:10,780 --> 00:12:17,820 And once it's running, you can intercept your traffic. 248 00:12:17,880 --> 00:12:18,700 And here it is. 249 00:12:18,820 --> 00:12:20,180 And so you can go ahead. 250 00:12:20,380 --> 00:12:23,040 Let me zoom in real quick before it crashes. 251 00:12:23,220 --> 00:12:27,840 You can see what I'm about to send and send it on its way. 252 00:12:29,620 --> 00:12:36,180 Now, the interesting part comes in when you go to modify traffic. 253 00:12:36,180 --> 00:12:39,980 Let me go ahead and modify something real quick. 254 00:12:43,440 --> 00:12:45,460 You can turn off the point and click. 255 00:12:45,540 --> 00:12:50,300 You can just have it flow through uninterrupted for a while if you're tired of always going over and clicking it. 256 00:12:51,360 --> 00:12:54,180 So let me go ahead and show you this. 257 00:12:56,420 --> 00:13:04,720 So we zoom in here, and I can go ahead and bypass any client-side restrictions and add a whole bunch of, you know, 4,000 digits for the pin. 258 00:13:04,720 --> 00:13:09,300 And Achilles will go ahead and take the content length and rewrite it for you to the proper amount, 259 00:13:09,480 --> 00:13:14,660 which at the time it came out was a big relief for me because, you know, back in my day, 260 00:13:14,720 --> 00:13:17,900 we were sitting there having to do that manually. 261 00:13:18,280 --> 00:13:24,680 And so nothing terrible happens, but we'll get back to this application called Buggy Bank later with some more sophisticated tools. 262 00:13:24,800 --> 00:13:28,500 It will automatically go in and manipulate things for us. 263 00:13:28,540 --> 00:13:33,040 But I'm going to go ahead and turn off Achilles so I don't accidentally surf through it later. 264 00:13:34,140 --> 00:13:34,580 And... 265 00:13:37,320 --> 00:13:41,780 You know, it's like the Model T. 266 00:13:41,880 --> 00:13:45,260 It's nice in a museum, but I wouldn't want to go off-roading in it. 267 00:13:45,620 --> 00:13:46,200 All right. 268 00:13:48,140 --> 00:13:50,740 It modifies traffic in both directions. 269 00:13:50,880 --> 00:13:56,040 So when you tell your buddy, hey, we got a new web proxy for the company, so you got to surf through this. 270 00:13:56,120 --> 00:13:59,560 And when they're surfing the website, you can change things on the inbound. 271 00:13:59,600 --> 00:14:04,000 So now new tapes emerge on US Hunt, Hunt's Dark Tangent. 272 00:14:04,000 --> 00:14:07,940 So, you know, you could modify it and modify things on the way in and... 273 00:14:09,460 --> 00:14:10,500 Stupid party tricks. 274 00:14:10,580 --> 00:14:12,300 I'm not sure what good that is for security. 275 00:14:12,500 --> 00:14:13,900 Although, social engineering. 276 00:14:15,200 --> 00:14:15,940 All right. 277 00:14:16,000 --> 00:14:17,720 So what are some of the better tools out there? 278 00:14:18,680 --> 00:14:21,480 My vote goes to Web Proxy by AtStake. 279 00:14:21,680 --> 00:14:22,980 Version 1 was free. 280 00:14:23,280 --> 00:14:24,780 It's still online somewhere. 281 00:14:25,040 --> 00:14:27,900 If you look hard enough, it's Java-based. 282 00:14:28,040 --> 00:14:30,180 It will run on anything that runs Java. 283 00:14:30,560 --> 00:14:31,660 Version 2 is commercial. 284 00:14:31,880 --> 00:14:33,540 I don't know the functionality difference. 285 00:14:33,540 --> 00:14:37,180 And then if you're really hardcore, you want to use the Spike Proxy. 286 00:14:38,100 --> 00:14:41,200 Just some more references for you when you download the slides. 287 00:14:41,420 --> 00:14:45,520 Lots of good tools out there that are like Achilles only, stable. 288 00:14:48,260 --> 00:14:54,600 And finally, there are some tools that are more like browser replacements and or extensions to the browser. 289 00:14:54,720 --> 00:14:55,440 And we'll see some of these. 290 00:14:55,760 --> 00:14:58,520 They put functionality in your browser. 291 00:14:58,960 --> 00:15:03,520 So now, like, it's extremely easy to manipulate hidden formats. 292 00:15:03,520 --> 00:15:03,620 You don't have to worry about that. 293 00:15:03,620 --> 00:15:03,680 You don't have to worry about the form elements. 294 00:15:04,940 --> 00:15:08,680 And just to also want to mention, these other tool kits are out there. 295 00:15:08,720 --> 00:15:11,460 These are more all-purpose. 296 00:15:11,820 --> 00:15:14,520 They don't just simply intercept and let you modify something. 297 00:15:14,820 --> 00:15:15,920 They do more than that. 298 00:15:15,980 --> 00:15:18,300 They'll maybe crawl the website for you. 299 00:15:18,400 --> 00:15:20,840 They'll automatically modify things for you. 300 00:15:20,920 --> 00:15:21,800 Very powerful. 301 00:15:22,780 --> 00:15:24,700 And so check those out as well. 302 00:15:25,120 --> 00:15:26,180 So a little bit more. 303 00:15:26,400 --> 00:15:29,780 Let's take a little closer look at Web Proxy by AtStake. 304 00:15:30,080 --> 00:15:32,300 What happens is, once you start it up, 305 00:15:33,520 --> 00:15:35,480 and your browser's configured to use it, 306 00:15:35,560 --> 00:15:38,940 all you have to do then is surf to a special... 307 00:15:39,440 --> 00:15:40,460 Actually, I already have it open. 308 00:15:40,700 --> 00:15:44,820 You just surf to the special keyword Web Proxy, 309 00:15:44,840 --> 00:15:46,100 and the interface pops up. 310 00:15:46,220 --> 00:15:47,020 I kind of like that. 311 00:15:47,140 --> 00:15:48,200 Some people don't. 312 00:15:48,240 --> 00:15:51,900 But you can go in here, and you can create intercepts. 313 00:15:51,940 --> 00:15:54,800 And what an intercept is, you tell it, 314 00:15:54,820 --> 00:15:58,360 look, whenever you see this string, 315 00:15:58,600 --> 00:16:00,080 and that's four I's. 316 00:16:00,100 --> 00:16:03,120 I just picked I because it reminds me of the word intercept. 317 00:16:03,520 --> 00:16:05,840 Four I's, when you see that going out, 318 00:16:05,960 --> 00:16:08,420 I want you to freeze the traffic matrix style, 319 00:16:08,540 --> 00:16:09,360 and let me change it. 320 00:16:09,560 --> 00:16:10,680 And that'll come in very handy 321 00:16:10,680 --> 00:16:12,400 when we want to start manipulating our cookies 322 00:16:12,400 --> 00:16:13,640 and things like that. 323 00:16:13,820 --> 00:16:14,580 And we'll talk about that 324 00:16:14,580 --> 00:16:16,820 when we get to the actual attacking portion. 325 00:16:17,120 --> 00:16:19,780 But for now, this is just a toolbox. 326 00:16:21,480 --> 00:16:23,960 One of the more powerful features is the fuzz feature. 327 00:16:24,160 --> 00:16:27,980 It allows you to go in and say, for example, 328 00:16:28,880 --> 00:16:32,340 let's go to this and let's... 329 00:16:32,340 --> 00:16:34,460 I created an intercept of four f's, 330 00:16:34,500 --> 00:16:37,260 so when it sees my pin was equal to f, f, f, f, 331 00:16:37,420 --> 00:16:39,120 it pops up this interface and says, 332 00:16:39,260 --> 00:16:40,160 hey, what do you want to change? 333 00:16:40,340 --> 00:16:42,320 And I zoomed in here, and I say, well, 334 00:16:42,960 --> 00:16:45,140 oh, look, there's a hidden form element called transaction. 335 00:16:45,440 --> 00:16:47,560 Why don't we go ahead and automatically kind of 336 00:16:47,560 --> 00:16:49,340 hack through a whole bunch of choices for that? 337 00:16:50,000 --> 00:16:55,180 And it has a list, user-definable list of things it'll try. 338 00:16:55,280 --> 00:16:58,560 It'll try various SQL injection, cross-site scripting, 339 00:16:59,080 --> 00:17:00,200 whatever you want. 340 00:17:00,340 --> 00:17:01,680 You can put it into a text file. 341 00:17:01,680 --> 00:17:02,740 It will try. 342 00:17:03,340 --> 00:17:07,320 The text file it comes with, known as fuzz strings, 343 00:17:07,620 --> 00:17:10,480 is kind of limited, so you want to add some of your own. 344 00:17:10,700 --> 00:17:12,000 And I'll tell you where to get some. 345 00:17:13,020 --> 00:17:14,480 One of them is from a... 346 00:17:14,480 --> 00:17:17,100 There's a Nessus plug-in that actually does some fuzzing as well. 347 00:17:17,340 --> 00:17:18,540 You could just look at the source, 348 00:17:18,620 --> 00:17:20,480 and you could see the various things you're trying. 349 00:17:20,540 --> 00:17:21,740 So we're done, and here's what it did. 350 00:17:22,160 --> 00:17:24,500 It actually went through, and it sort of brute-forced 351 00:17:24,500 --> 00:17:28,320 that one form element, and it tried all of these things. 352 00:17:28,400 --> 00:17:29,160 It tried a zero. 353 00:17:29,320 --> 00:17:30,360 It tried a minus one. 354 00:17:30,360 --> 00:17:33,220 It tried some special characters. 355 00:17:33,460 --> 00:17:36,560 It tried some file name stuff. 356 00:17:37,300 --> 00:17:41,220 And it apparently was successful or found something down here, 357 00:17:41,300 --> 00:17:43,620 and it turns out that that's cross-site scripting. 358 00:17:43,620 --> 00:17:48,640 If you would go in here and look and analyze it a little bit, 359 00:17:48,680 --> 00:17:50,620 you would see that it's cross-site scripting. 360 00:17:51,800 --> 00:17:54,000 But we won't do that right now. 361 00:17:54,140 --> 00:17:55,740 I just wanted to show you that it has the ability 362 00:17:55,740 --> 00:17:58,040 to automatically go through and hack. 363 00:17:58,140 --> 00:18:00,340 Now, there's some vendors who've done this. 364 00:18:00,360 --> 00:18:03,600 You sell tools that do this for lots of money. 365 00:18:04,080 --> 00:18:05,100 This one's free. 366 00:18:05,360 --> 00:18:09,200 Or the commercial version of AtStake is only like $995. 367 00:18:10,180 --> 00:18:10,940 There you go. 368 00:18:10,980 --> 00:18:11,920 You buy two, right? 369 00:18:12,260 --> 00:18:15,020 That's cheap compared to the other tools that are out there. 370 00:18:15,540 --> 00:18:18,840 And some of those other vendors use phrases like 371 00:18:18,840 --> 00:18:20,300 robo-hacking technology. 372 00:18:21,820 --> 00:18:23,360 It's a for loop, man. 373 00:18:23,420 --> 00:18:25,260 It's just going, and it's just repeating through. 374 00:18:25,620 --> 00:18:27,220 Or artificial intelligence. 375 00:18:27,340 --> 00:18:29,520 Say, listen, if a vendor ever tells you their product 376 00:18:29,520 --> 00:18:30,540 has artificial intelligence, 377 00:18:30,820 --> 00:18:33,520 they're referring to their sales and marketing force, okay? 378 00:18:35,120 --> 00:18:35,640 Yeah. 379 00:18:37,420 --> 00:18:38,680 Right. Okay. 380 00:18:41,380 --> 00:18:43,820 Another nice feature about the AtStake tool 381 00:18:43,820 --> 00:18:45,300 is it has a console, 382 00:18:45,400 --> 00:18:47,540 and you can see all the stuff flying by. 383 00:18:47,780 --> 00:18:50,080 And so this is your opportunity to see the headers 384 00:18:50,080 --> 00:18:53,460 and to notice when certain cookies come into play, 385 00:18:53,620 --> 00:18:54,480 things like that. 386 00:18:59,520 --> 00:19:00,340 And we've already seen that. 387 00:19:00,560 --> 00:19:02,820 How many folks have seen the FAQ? 388 00:19:03,500 --> 00:19:06,160 How many folks have seen the Web Proxy tool? 389 00:19:07,260 --> 00:19:08,940 Did you read the FAQ? 390 00:19:09,000 --> 00:19:11,880 It says, are there any undocumented features? 391 00:19:12,640 --> 00:19:13,080 Yes. 392 00:19:13,760 --> 00:19:15,180 And then it just moves on. 393 00:19:16,920 --> 00:19:19,980 Does anyone know what those undocumented features are? 394 00:19:20,040 --> 00:19:20,260 Anybody? 395 00:19:21,420 --> 00:19:22,260 We'll see here. 396 00:19:22,400 --> 00:19:23,060 Okay, one guy. 397 00:19:23,360 --> 00:19:23,840 All right. 398 00:19:23,880 --> 00:19:26,220 If this is not the one you know about, we've got to talk. 399 00:19:26,480 --> 00:19:28,480 So this is worth the price of admission right here. 400 00:19:28,480 --> 00:19:29,940 Let me tell you about one of the features it has. 401 00:19:30,400 --> 00:19:31,820 Never mind how I know this. 402 00:19:32,080 --> 00:19:33,360 Crank call. Okay. 403 00:19:34,380 --> 00:19:35,940 It can be a transparent proxy. 404 00:19:37,120 --> 00:19:38,980 And what that allows you to do is, 405 00:19:39,040 --> 00:19:41,960 if you're forced to absolutely go through a proxy 406 00:19:42,470 --> 00:19:45,320 because the application insists on it, 407 00:19:45,820 --> 00:19:48,040 well, then what you need is a proxy in the middle 408 00:19:48,040 --> 00:19:51,400 between you and the official proxy that's invisible, transparent. 409 00:19:51,860 --> 00:19:54,200 And that's what a transparent proxy will allow you to do. 410 00:19:54,480 --> 00:19:56,460 The official proxy won't know 411 00:19:56,460 --> 00:19:58,460 that you're using yet another proxy. 412 00:19:58,480 --> 00:20:01,960 So how you do it is you would just add that line 413 00:20:02,480 --> 00:20:04,800 into the config file when you start it up. 414 00:20:05,280 --> 00:20:07,240 And I hope nobody's mad that I revealed that. 415 00:20:07,360 --> 00:20:10,500 But hey, they're the ones with the FAQ teasing you, 416 00:20:10,660 --> 00:20:12,760 practically begging you to investigate further. 417 00:20:14,260 --> 00:20:15,200 So there you go. 418 00:20:16,160 --> 00:20:18,600 How or why that would be useful in real auditing situations 419 00:20:18,600 --> 00:20:20,700 is left as an exercise to the viewer. 420 00:20:21,200 --> 00:20:22,540 But it is useful. 421 00:20:23,320 --> 00:20:25,020 And then finally, IE Booster. 422 00:20:25,080 --> 00:20:28,460 This has got to be this ridiculously easy to use. 423 00:20:28,480 --> 00:20:31,780 My grandmother can now start manipulating hidden form elements. 424 00:20:32,020 --> 00:20:33,080 And come to think of it, 425 00:20:33,140 --> 00:20:36,420 she really did get a good deal on that plasma TV, right? 426 00:20:36,620 --> 00:20:38,100 She's shopping online, 427 00:20:38,300 --> 00:20:40,220 and we see there's two form elements. 428 00:20:40,320 --> 00:20:41,500 It's asking for our account name, 429 00:20:42,000 --> 00:20:45,680 and it's asking for a password. 430 00:20:45,820 --> 00:20:46,760 But we just right-click. 431 00:20:46,980 --> 00:20:49,200 And I'm sorry, this is only for IE. 432 00:20:49,320 --> 00:20:51,720 So folks out there with Mozilla, 433 00:20:52,320 --> 00:20:54,960 send me the URL if you know there's an extension like this. 434 00:20:55,100 --> 00:20:56,180 I'm sure there is. 435 00:20:56,460 --> 00:20:58,060 There's new extensions added. 436 00:20:58,560 --> 00:21:00,960 To your right-click menu, to your context menu. 437 00:21:01,200 --> 00:21:04,840 And one of them is show all the forms and the applets. 438 00:21:05,280 --> 00:21:06,500 And so that's kind of nice, 439 00:21:06,560 --> 00:21:08,240 because then you click in, click on that, 440 00:21:08,880 --> 00:21:12,540 and it shows you there's a hidden form element. 441 00:21:12,680 --> 00:21:14,260 And oh, look, it's in a little text box 442 00:21:14,260 --> 00:21:16,180 in case you want to modify it. 443 00:21:16,820 --> 00:21:18,540 Hmm. Nice. 444 00:21:18,680 --> 00:21:21,040 And so we go in and we can modify that 445 00:21:21,040 --> 00:21:23,080 and just send it on its way. 446 00:21:23,400 --> 00:21:25,380 Look, Mom, no skill. Right? 447 00:21:26,460 --> 00:21:27,320 That's pretty scary. 448 00:21:27,320 --> 00:21:29,640 That's one you show to your boss to get their attention 449 00:21:29,640 --> 00:21:31,660 when they say, oh, well, you know, 450 00:21:32,140 --> 00:21:33,800 it's all complicated or something. 451 00:21:34,300 --> 00:21:35,360 Just show them that one. 452 00:21:35,460 --> 00:21:36,980 They'll even be able to use it probably. 453 00:21:41,060 --> 00:21:44,760 Another technique within our toolkit is a brute force, 454 00:21:45,340 --> 00:21:46,920 specifically brute forcing authentication. 455 00:21:49,080 --> 00:21:52,040 And Brutus used to be one of my favorites. 456 00:21:52,140 --> 00:21:53,800 It's GUI-based on Windows, 457 00:21:53,960 --> 00:21:56,400 and it will brute force web-based authentication. 458 00:21:56,400 --> 00:21:57,180 It does... 459 00:21:57,180 --> 00:22:00,400 What kind of music do you usually have here? 460 00:22:00,780 --> 00:22:02,060 Oh, we got both kinds. 461 00:22:02,160 --> 00:22:03,640 We got country and western. 462 00:22:03,940 --> 00:22:05,500 It does both kinds. 463 00:22:05,700 --> 00:22:08,940 It does basic authentication and form-based. 464 00:22:09,220 --> 00:22:12,820 And so it also does a lot of other protocols, 465 00:22:13,080 --> 00:22:15,380 pretty much any text-based protocol. 466 00:22:15,960 --> 00:22:18,980 Brutus, you can write a script in Brutus very easily 467 00:22:18,980 --> 00:22:21,240 with a GUI click-and-drag type thing 468 00:22:21,240 --> 00:22:25,700 to build a script to brute force any kind of custom clear text protocol 469 00:22:25,700 --> 00:22:26,960 that you want to brute force. 470 00:22:27,080 --> 00:22:28,060 So it's nice in that respect. 471 00:22:28,300 --> 00:22:30,840 It's great for the command line challenge. 472 00:22:31,180 --> 00:22:33,920 And one of the really nice features is it has this. 473 00:22:34,060 --> 00:22:36,260 When it comes time to brute forcing a password, 474 00:22:37,040 --> 00:22:38,660 you can load in a dictionary file 475 00:22:38,660 --> 00:22:42,800 or you can let it build a word list on the fly. 476 00:22:43,300 --> 00:22:46,400 So no longer do you have to sit around with a text file 477 00:22:46,400 --> 00:22:48,960 of all possible six-digit numbers. 478 00:22:49,120 --> 00:22:51,920 You can just build it on the fly, save yourself some disk space. 479 00:22:53,960 --> 00:22:55,360 Less forensics evidence, too. 480 00:22:55,700 --> 00:22:57,320 I mean, all right, so. 481 00:22:58,340 --> 00:22:58,780 What? 482 00:22:59,180 --> 00:23:01,700 It also has a permutator built in as well. 483 00:23:01,780 --> 00:23:06,000 It'll turn your password dictionary file into elite speak or whatever 484 00:23:06,000 --> 00:23:09,460 by making the fives, you know, S's into fives and all that good stuff. 485 00:23:10,240 --> 00:23:11,360 Very handy tool. 486 00:23:11,500 --> 00:23:14,260 But the one I'm going to demo is wwwhack later on. 487 00:23:15,760 --> 00:23:17,080 But a point of interest, 488 00:23:18,040 --> 00:23:20,460 these are other authentication brute forcing tools, 489 00:23:22,360 --> 00:23:24,020 is ScreamingCobra was an interesting, 490 00:23:24,020 --> 00:23:25,780 historically speaking, 491 00:23:25,980 --> 00:23:27,700 because it would crawl your website, 492 00:23:27,940 --> 00:23:30,140 find all the forms with form elements, 493 00:23:30,280 --> 00:23:31,400 hidden or otherwise, 494 00:23:31,700 --> 00:23:33,000 and would automatically fuzz them. 495 00:23:34,860 --> 00:23:36,940 But it's not being updated, 496 00:23:37,080 --> 00:23:38,260 it doesn't support SSL, 497 00:23:38,360 --> 00:23:39,760 but it's a Perl script, I believe, 498 00:23:39,860 --> 00:23:41,080 so it's open source. 499 00:23:41,400 --> 00:23:43,160 And you can go ahead and change that. 500 00:23:43,600 --> 00:23:47,280 And also, Nessus has a plug-in that'll brute force CGI parameters. 501 00:23:47,660 --> 00:23:50,060 There's a nice little list of things to try 502 00:23:50,060 --> 00:23:53,800 or things to add to your other fuzz program. 503 00:23:55,720 --> 00:23:58,420 And finally, some more references on where to get word lists 504 00:23:58,420 --> 00:24:00,980 and tools that'll build variations. 505 00:24:01,540 --> 00:24:04,080 That is to permutate the word to make the zero, 506 00:24:04,300 --> 00:24:05,960 O's into zeroes and things like that. 507 00:24:06,400 --> 00:24:08,020 I think the last thing in our toolkit, 508 00:24:08,320 --> 00:24:09,240 well, no, next to last, 509 00:24:09,340 --> 00:24:10,800 is we want to decompile applets. 510 00:24:11,240 --> 00:24:13,300 You know, Java's compiled into bytecode, 511 00:24:13,520 --> 00:24:14,920 but that can be decompiled. 512 00:24:15,460 --> 00:24:16,860 Where are you going to get an applet from? 513 00:24:16,960 --> 00:24:19,600 Some applications use client-side code. 514 00:24:19,720 --> 00:24:20,700 They send you an applet. 515 00:24:20,760 --> 00:24:23,040 If you've ever used IBM's Host on Demand, 516 00:24:23,040 --> 00:24:23,740 um, 517 00:24:23,800 --> 00:24:24,760 oh, man, that thing's a mess. 518 00:24:25,000 --> 00:24:26,280 It sends you all these applets, 519 00:24:26,380 --> 00:24:29,680 and it's like a web front-end to old mainframe applications. 520 00:24:30,700 --> 00:24:31,880 Yeah, that's what we want to do. 521 00:24:31,940 --> 00:24:33,520 We want to webify our mainframes. 522 00:24:33,840 --> 00:24:35,860 We want to put rollerblades on a dinosaur. 523 00:24:35,940 --> 00:24:36,260 Yeah. 524 00:24:36,820 --> 00:24:37,740 Somebody's going to get hurt. 525 00:24:37,940 --> 00:24:38,500 All right? 526 00:24:38,540 --> 00:24:41,000 This thing was not meant to have that many concurrent users 527 00:24:41,000 --> 00:24:41,880 and all that good stuff. 528 00:24:41,940 --> 00:24:43,820 So anyway, that's where I stand on that. 529 00:24:44,180 --> 00:24:46,660 And, uh, so you have client-side code. 530 00:24:46,780 --> 00:24:50,220 You could also maybe steal the applets from the server 531 00:24:50,220 --> 00:24:52,360 because of server-side weaknesses. 532 00:24:52,360 --> 00:24:54,180 The web server's misconfigured, 533 00:24:54,220 --> 00:24:56,080 and you can retrieve any files. 534 00:24:56,160 --> 00:24:57,120 So what file are you going to pull? 535 00:24:57,320 --> 00:24:58,340 Pull their source code. 536 00:24:58,820 --> 00:24:59,980 Decompile it, and there you go. 537 00:25:00,200 --> 00:25:01,600 And then, of course, a lot of applications, 538 00:25:01,760 --> 00:25:03,060 like Web Proxy, 539 00:25:03,180 --> 00:25:04,780 are being distributed as Java. 540 00:25:04,920 --> 00:25:08,060 So you could, uh, within the bounds of the law, 541 00:25:08,720 --> 00:25:10,740 decompile them and start doing all sorts of stuff 542 00:25:10,740 --> 00:25:11,740 and reverse-engineer them. 543 00:25:12,380 --> 00:25:13,560 Not that I'm saying you should. 544 00:25:14,740 --> 00:25:15,380 And, uh, 545 00:25:16,420 --> 00:25:17,980 they may contain sensitive information. 546 00:25:18,060 --> 00:25:19,140 Why would you want to do that? 547 00:25:19,400 --> 00:25:21,620 Um, well, we have seen 548 00:25:21,620 --> 00:25:23,880 during audits applets 549 00:25:23,880 --> 00:25:25,580 which have hard-wired credentials 550 00:25:26,120 --> 00:25:27,360 because they think, 551 00:25:27,460 --> 00:25:28,400 well, it's compiled, 552 00:25:28,540 --> 00:25:30,580 even though the applet's on the client side. 553 00:25:30,900 --> 00:25:32,920 It's, you know, it's hard-wired in, 554 00:25:33,000 --> 00:25:34,020 and it's using encryption, 555 00:25:34,200 --> 00:25:35,440 so nobody will be able to see it. 556 00:25:35,480 --> 00:25:37,480 And it's compiled, so nobody will be able to see it. 557 00:25:37,540 --> 00:25:39,060 But you can actually pull it out. 558 00:25:39,140 --> 00:25:40,640 And or secret URLs, 559 00:25:40,880 --> 00:25:43,160 and or undocumented features and things like that. 560 00:25:46,920 --> 00:25:49,700 And there's some tools for decompiling Java. 561 00:25:50,960 --> 00:25:51,440 Finally, 562 00:25:51,620 --> 00:25:53,960 the last tool you probably want in your toolkit 563 00:25:53,960 --> 00:25:57,020 is something that'll crawl and mirror a website. 564 00:25:57,280 --> 00:25:58,980 The theory behind this is 565 00:25:58,980 --> 00:26:01,660 you could go out through a whole bunch of web sites, 566 00:26:02,040 --> 00:26:03,400 pull down the HTML 567 00:26:03,960 --> 00:26:05,620 that they're willing to serve to you, 568 00:26:05,740 --> 00:26:08,300 and then search through them for inappropriate things 569 00:26:08,300 --> 00:26:09,420 like hidden comments, 570 00:26:10,180 --> 00:26:12,040 the meta-generator tag. 571 00:26:12,380 --> 00:26:14,860 It'll tell you if they're using front page or not. 572 00:26:15,340 --> 00:26:16,380 And, uh, and or, 573 00:26:16,560 --> 00:26:18,920 you also want to try to find a mirroring package 574 00:26:18,920 --> 00:26:21,020 that will record the HTTP headers. 575 00:26:21,620 --> 00:26:23,180 My preferred method when doing assessments 576 00:26:23,180 --> 00:26:26,220 is to fire up one of these proxies 577 00:26:26,220 --> 00:26:28,100 and put it into recording mode 578 00:26:28,100 --> 00:26:29,940 and just let it dump everything to a file, 579 00:26:30,400 --> 00:26:32,340 then pull out a command line with grep, 580 00:26:32,460 --> 00:26:33,120 search tool, 581 00:26:33,280 --> 00:26:34,600 and then just go to town. 582 00:26:34,840 --> 00:26:37,060 And so that's probably the preferred way. 583 00:26:37,200 --> 00:26:39,640 I don't know that I would let some automated thing 584 00:26:39,640 --> 00:26:42,560 go through my web app and start pounding away, 585 00:26:43,300 --> 00:26:45,600 but their entire product's based on that theory, 586 00:26:45,700 --> 00:26:46,500 so I have to be careful. 587 00:26:47,400 --> 00:26:49,420 And here's some headers we've seen. 588 00:26:50,580 --> 00:26:52,120 The xbender header. 589 00:26:52,420 --> 00:26:55,220 Care to contribute to the anti-mugging you fund? 590 00:26:55,520 --> 00:26:57,980 Uh, bender, as in Futurama. 591 00:26:58,640 --> 00:27:00,640 Who knows where these headers are coming from? 592 00:27:01,520 --> 00:27:02,120 Slash dot. 593 00:27:02,220 --> 00:27:04,820 If you go to slash dot dot org website, 594 00:27:05,200 --> 00:27:07,640 uh, use one of these proxies 595 00:27:07,640 --> 00:27:08,600 and take a look at the traffic. 596 00:27:08,780 --> 00:27:11,760 They throw in the bender headers for whatever reason. 597 00:27:12,000 --> 00:27:15,740 And then, um, occasionally the xfry header as well. 598 00:27:18,080 --> 00:27:19,660 And there's some tools for you. 599 00:27:19,720 --> 00:27:21,200 We're not going to do any demos for that. 600 00:27:21,320 --> 00:27:22,840 So now we have our little toolkit. 601 00:27:22,980 --> 00:27:24,240 Let's get busy. 602 00:27:24,440 --> 00:27:26,200 And these are the main points of attack 603 00:27:26,200 --> 00:27:27,260 we want to look at today. 604 00:27:27,340 --> 00:27:30,060 This by no means is all of it, 605 00:27:30,080 --> 00:27:33,600 but this covers really some of the core essential problems 606 00:27:33,600 --> 00:27:34,760 with web-based applications 607 00:27:35,820 --> 00:27:37,040 that are worth investigating. 608 00:27:38,120 --> 00:27:39,500 So first up is authentication. 609 00:27:41,700 --> 00:27:43,920 No surprise here, you can brute force stuff. 610 00:27:44,100 --> 00:27:45,460 So I'll give a real quick demo. 611 00:27:45,460 --> 00:27:49,320 Only because I want to make sure everyone's aware 612 00:27:49,320 --> 00:27:50,200 that there are tools. 613 00:27:50,680 --> 00:27:52,160 Yeah, sure, you can phone home. 614 00:27:52,440 --> 00:27:54,220 So this tool is, uh, 615 00:27:55,420 --> 00:27:57,180 ET is phoning home 616 00:27:57,180 --> 00:27:59,820 and trying to contact like a porn ad server. 617 00:28:00,560 --> 00:28:03,260 So I'm not sure you might consider that a feature 618 00:28:03,260 --> 00:28:05,840 or, I'm not sure. 619 00:28:06,100 --> 00:28:08,600 But, um, anyway, 620 00:28:08,760 --> 00:28:11,040 since I'm not on any network that I'm aware of, 621 00:28:11,120 --> 00:28:12,040 it should be safe. 622 00:28:13,460 --> 00:28:15,380 I want to make sure you realize 623 00:28:15,460 --> 00:28:17,900 that these tools are now dirt simple. 624 00:28:18,060 --> 00:28:19,760 So let me see if I can find a login 625 00:28:21,300 --> 00:28:22,500 for it to brute force. 626 00:28:23,660 --> 00:28:24,300 Here's one. 627 00:28:24,320 --> 00:28:24,860 We'll go here. 628 00:28:25,020 --> 00:28:26,160 Go to the login page. 629 00:28:29,320 --> 00:28:30,300 Bring up the tool. 630 00:28:30,700 --> 00:28:32,940 It does, it brute forces various protocols, 631 00:28:33,140 --> 00:28:35,720 but the one we're interested in is HTTP, uh, 632 00:28:36,400 --> 00:28:37,720 form-based, right? 633 00:28:37,820 --> 00:28:39,280 So we'll click on that. 634 00:28:41,560 --> 00:28:44,140 And automatically, out of memory, 635 00:28:44,140 --> 00:28:46,620 it knows that I have a browser open 636 00:28:47,260 --> 00:28:48,140 with this URL. 637 00:28:48,780 --> 00:28:49,680 So it's just like, 638 00:28:49,800 --> 00:28:51,420 hey, is that the URL you want to brute force? 639 00:28:51,560 --> 00:28:52,140 It's very friendly. 640 00:28:54,560 --> 00:28:55,700 Now, let's go back. 641 00:28:55,820 --> 00:28:57,900 Let me, uh, let me go back here. 642 00:28:57,960 --> 00:28:59,280 Let's, uh, right-click this with, 643 00:28:59,380 --> 00:29:01,360 and take a look at the underlying structure 644 00:29:02,220 --> 00:29:02,620 with... 645 00:29:03,900 --> 00:29:05,080 Wow, what a mess. 646 00:29:05,300 --> 00:29:07,820 This has got a lot of hidden form elements. 647 00:29:08,880 --> 00:29:10,860 This script will discern 648 00:29:10,860 --> 00:29:12,360 through artificial intelligence 649 00:29:12,360 --> 00:29:15,280 how to brute force this particular form. 650 00:29:15,380 --> 00:29:16,100 It will know, 651 00:29:16,120 --> 00:29:17,960 through a simple search, 652 00:29:18,140 --> 00:29:20,820 I'm sure, that the form element called username 653 00:29:21,360 --> 00:29:23,100 is probably the username. 654 00:29:23,380 --> 00:29:25,900 And the one called password 655 00:29:25,900 --> 00:29:27,480 is probably the password. 656 00:29:27,700 --> 00:29:29,960 So they have real simple, obvious names. 657 00:29:30,120 --> 00:29:31,300 So when you click the, 658 00:29:31,300 --> 00:29:34,100 the auto-magic artificial robo button, 659 00:29:34,600 --> 00:29:35,160 um, 660 00:29:35,460 --> 00:29:37,020 all right, now I'll be mean. 661 00:29:37,500 --> 00:29:39,160 Boom, it fills in 662 00:29:40,300 --> 00:29:42,340 username field is user name, 663 00:29:42,340 --> 00:29:43,800 and password field is password. 664 00:29:44,020 --> 00:29:45,580 And it has a little database of, you know, 665 00:29:45,600 --> 00:29:48,120 PIN, or P-A-S-S for password, 666 00:29:48,280 --> 00:29:50,980 or P-W-D, or things like that. 667 00:29:51,260 --> 00:29:53,040 Um, and then all the rest, 668 00:29:53,060 --> 00:29:54,680 it just kind of shoves on the command line, 669 00:29:54,800 --> 00:29:55,960 or on the, on the URL. 670 00:29:56,100 --> 00:29:58,960 So that's all it takes for this tool 671 00:29:58,960 --> 00:30:00,700 to learn and be able to brute force 672 00:30:00,700 --> 00:30:01,900 any generic form. 673 00:30:02,540 --> 00:30:03,020 Sweet. 674 00:30:03,900 --> 00:30:05,120 You give it a string 675 00:30:06,660 --> 00:30:09,100 that is always found when, uh, 676 00:30:09,700 --> 00:30:11,240 when authentication fails. 677 00:30:12,460 --> 00:30:14,480 It's a very subtle but useful feature. 678 00:30:14,700 --> 00:30:16,900 You teach it what a failure is. 679 00:30:17,080 --> 00:30:19,380 Because we all can find out what the failure is. 680 00:30:19,480 --> 00:30:20,320 You just go to a website. 681 00:30:20,660 --> 00:30:22,740 If you're doing a, a blind pen test 682 00:30:22,740 --> 00:30:24,360 where they won't give you test accounts, 683 00:30:24,580 --> 00:30:26,280 you fail the, the login. 684 00:30:26,820 --> 00:30:28,900 Anybody can fail a login. It's easy. 685 00:30:29,280 --> 00:30:29,920 And, uh, 686 00:30:31,460 --> 00:30:34,720 and it returns a string like return to calendar. 687 00:30:35,300 --> 00:30:38,140 So if we continue to brute force 688 00:30:38,140 --> 00:30:40,340 and we no longer see that string, 689 00:30:40,340 --> 00:30:42,580 maybe, just maybe, 690 00:30:42,720 --> 00:30:44,200 um, we got in. 691 00:30:44,380 --> 00:30:46,420 And now I've lost my, my tool here. 692 00:30:46,480 --> 00:30:46,920 Where is it? 693 00:30:48,460 --> 00:30:49,340 Okay. Hmm. 694 00:30:51,740 --> 00:30:52,340 Uh-oh. 695 00:30:52,360 --> 00:30:53,160 Now I broke it. 696 00:30:57,180 --> 00:30:57,980 There we go. 697 00:31:00,540 --> 00:31:02,360 So we tell it to look for the string 698 00:31:02,360 --> 00:31:03,240 return to calendar. 699 00:31:03,800 --> 00:31:05,900 We got that and you just hit go 700 00:31:05,900 --> 00:31:07,980 and it, it does what it's gotta do. 701 00:31:08,040 --> 00:31:10,240 And it keeps sending that particular request. 702 00:31:10,340 --> 00:31:10,980 Over and over. 703 00:31:11,460 --> 00:31:12,900 Until finally it says 704 00:31:12,900 --> 00:31:14,780 the username is Al Gore 705 00:31:14,780 --> 00:31:17,000 and the password is lockbox. 706 00:31:18,560 --> 00:31:20,020 Is that true? Really? 707 00:31:20,220 --> 00:31:21,020 Did it work? 708 00:31:21,300 --> 00:31:22,600 Sure. Let's, let's find out. 709 00:31:22,960 --> 00:31:25,120 Um, I'm gonna go ahead and close this tool down. 710 00:31:25,380 --> 00:31:27,700 At which point it yet again tries to phone home. 711 00:31:28,500 --> 00:31:29,220 All right. 712 00:31:29,480 --> 00:31:33,000 And we'll type in Al Gore lockbox. 713 00:31:33,220 --> 00:31:34,160 And what do you know? 714 00:31:34,220 --> 00:31:34,780 It ain't kidding. 715 00:31:34,980 --> 00:31:35,760 It really worked. 716 00:31:36,320 --> 00:31:37,160 Whoop-dee-doo. 717 00:31:38,120 --> 00:31:39,380 Whoop-dee-friggin-doo. 718 00:31:39,580 --> 00:31:40,000 You say, well, 719 00:31:40,340 --> 00:31:42,020 we can just lock our accounts, 720 00:31:42,160 --> 00:31:44,060 temporarily lock them, 721 00:31:44,120 --> 00:31:45,880 to slow that tool down, 722 00:31:46,460 --> 00:31:47,960 make it grind to a halt. 723 00:31:48,880 --> 00:31:50,060 Does that protect us? 724 00:31:50,540 --> 00:31:51,660 Hmm, sometimes. 725 00:31:52,540 --> 00:31:54,280 So this next one is kind of interesting. 726 00:31:54,560 --> 00:31:57,580 Uh, this was found in some online banking in Europe. 727 00:31:57,800 --> 00:31:59,600 I call it pin harvesting 728 00:31:59,600 --> 00:32:01,680 because what you could do is lock an account 729 00:32:01,680 --> 00:32:03,520 and keep on brute forcing 730 00:32:03,520 --> 00:32:05,780 until eventually you get the password. 731 00:32:06,120 --> 00:32:07,680 Uh, even though the account was locked. 732 00:32:07,760 --> 00:32:08,760 So, so first, 733 00:32:08,760 --> 00:32:11,540 let me tell you what username harvesting is. 734 00:32:11,620 --> 00:32:13,200 That's where you go to an app 735 00:32:13,200 --> 00:32:14,740 and you go to log in 736 00:32:14,740 --> 00:32:17,060 and based on a failed log in attempt 737 00:32:17,060 --> 00:32:18,220 you can figure out 738 00:32:18,220 --> 00:32:20,440 what is valid and what is not valid. 739 00:32:20,680 --> 00:32:22,700 So if we type in gibberish, 740 00:32:22,880 --> 00:32:23,980 it says, hey, 741 00:32:24,880 --> 00:32:25,940 that's not a valid, 742 00:32:26,080 --> 00:32:26,760 that's not a valid, 743 00:32:26,860 --> 00:32:28,080 there's no user by that name. 744 00:32:28,180 --> 00:32:30,200 But if you type in, you know, Al Gore, 745 00:32:35,940 --> 00:32:37,460 it says bad password. 746 00:32:37,520 --> 00:32:38,600 So we, we have the ability 747 00:32:38,600 --> 00:32:39,600 to collect usernames, 748 00:32:39,680 --> 00:32:40,440 harvest usernames. 749 00:32:40,520 --> 00:32:43,240 That is not terribly significant 750 00:32:43,240 --> 00:32:46,080 unless the username is a private credential 751 00:32:46,080 --> 00:32:48,360 like in some banks do this, 752 00:32:48,440 --> 00:32:49,480 your bank card number, 753 00:32:49,600 --> 00:32:51,260 your 16-digit bank card number. 754 00:32:51,520 --> 00:32:53,400 And if you give error messages like that, 755 00:32:53,560 --> 00:32:56,980 you've now supplied an online bank card validator. 756 00:32:57,220 --> 00:32:58,180 You know, probably, 757 00:32:58,420 --> 00:33:00,460 it would be very useful to some people, 758 00:33:00,560 --> 00:33:03,060 but not to your customers. 759 00:33:03,300 --> 00:33:06,900 So that's username harvesting. 760 00:33:07,080 --> 00:33:08,580 Then what I do, 761 00:33:08,600 --> 00:33:10,220 what I discovered was password harvesting 762 00:33:10,220 --> 00:33:12,240 where I'm doing this assessment 763 00:33:12,240 --> 00:33:14,060 and it's a big bank, right? 764 00:33:14,240 --> 00:33:16,560 And I was doing their assessment in the US 765 00:33:16,560 --> 00:33:18,440 and then a couple months later in Europe 766 00:33:18,440 --> 00:33:19,900 and then finally in Asia. 767 00:33:20,260 --> 00:33:21,500 Asia was the worst, 768 00:33:21,540 --> 00:33:22,360 had the worst security. 769 00:33:22,680 --> 00:33:23,960 I'll show you that later. 770 00:33:24,040 --> 00:33:25,840 We could run commands on it. 771 00:33:26,920 --> 00:33:28,160 This one we could, 772 00:33:28,260 --> 00:33:29,000 in Europe, 773 00:33:29,080 --> 00:33:32,340 we could only basically get people's pin numbers. 774 00:33:33,000 --> 00:33:34,940 When you lock your account, 775 00:33:35,160 --> 00:33:36,620 you get a message. 776 00:33:37,400 --> 00:33:38,980 And in German, 777 00:33:39,020 --> 00:33:39,700 that says roughly, 778 00:33:39,780 --> 00:33:40,980 unfortunately this pin is wrong. 779 00:33:41,840 --> 00:33:44,340 That's when you try the wrong pin on a locked account. 780 00:33:44,700 --> 00:33:45,100 Eventually, 781 00:33:45,760 --> 00:33:46,800 your account's locked, 782 00:33:46,980 --> 00:33:47,980 you get the right pin, 783 00:33:48,160 --> 00:33:49,480 the error message changed. 784 00:33:50,160 --> 00:33:51,460 That's just plain wrong. 785 00:33:52,220 --> 00:33:53,900 So I don't speak German, 786 00:33:54,000 --> 00:33:56,120 but I know how to see two text strings change. 787 00:33:56,500 --> 00:33:58,500 And so I'm all out of the chair doing my little, 788 00:33:58,580 --> 00:33:59,200 you know, dance. 789 00:33:59,380 --> 00:34:00,900 And then I realized the bank auditor's 790 00:34:00,900 --> 00:34:01,660 right there next to me. 791 00:34:01,700 --> 00:34:01,920 And I was like, 792 00:34:02,020 --> 00:34:03,980 oh, sir, you have a problem. 793 00:34:04,100 --> 00:34:04,580 You know. 794 00:34:06,740 --> 00:34:07,900 Very interesting procedure. 795 00:34:08,100 --> 00:34:11,280 The bank always had somebody there right next to me. 796 00:34:11,460 --> 00:34:12,780 And I figured it out later. 797 00:34:12,980 --> 00:34:13,740 You know, they said, 798 00:34:13,820 --> 00:34:14,840 oh, we'll help facilitate. 799 00:34:14,860 --> 00:34:15,660 If you need something, 800 00:34:15,940 --> 00:34:17,260 you know, the web server's not responding. 801 00:34:17,280 --> 00:34:20,660 It was so that if I decided to retire early, 802 00:34:20,740 --> 00:34:21,820 I'd have to split the money. 803 00:34:21,900 --> 00:34:22,440 That's what it was. 804 00:34:23,340 --> 00:34:23,740 And. 805 00:34:25,820 --> 00:34:26,400 All right. 806 00:34:26,420 --> 00:34:26,900 So finally, 807 00:34:27,040 --> 00:34:30,080 the last thing I think I'll put here for authentication is, 808 00:34:30,120 --> 00:34:32,460 maybe you don't need to authenticate at all. 809 00:34:32,940 --> 00:34:33,980 So, for example, 810 00:34:34,120 --> 00:34:36,240 this calendar software, 811 00:34:36,900 --> 00:34:38,080 that we have here, 812 00:34:38,240 --> 00:34:40,900 let's just back up to a public web, 813 00:34:41,440 --> 00:34:42,420 public site here. 814 00:34:43,340 --> 00:34:44,320 We notice 815 00:34:44,320 --> 00:34:48,220 the name of the calendar's embedded as a form element. 816 00:34:48,320 --> 00:34:50,260 Calendar equals vapor external. 817 00:34:50,600 --> 00:34:53,240 So what if we were to go to 818 00:34:55,140 --> 00:34:56,260 March 2002 819 00:34:58,640 --> 00:35:00,500 and change that name. 820 00:35:00,580 --> 00:35:03,480 I'm going to go ahead and change that calendar name 821 00:35:04,060 --> 00:35:05,480 to the word private. 822 00:35:06,620 --> 00:35:07,260 No, no. 823 00:35:07,720 --> 00:35:11,900 We could brute force this with any of those point and click tools. 824 00:35:12,620 --> 00:35:13,660 And lo and behold, 825 00:35:13,880 --> 00:35:15,380 things start popping up 826 00:35:15,380 --> 00:35:17,340 because now we don't have to authenticate 827 00:35:17,340 --> 00:35:18,620 as long as you know the calendar name. 828 00:35:18,700 --> 00:35:21,180 And I'm sure many of you have seen applications like that 829 00:35:21,180 --> 00:35:22,720 where, you know, 830 00:35:22,760 --> 00:35:25,840 you can suddenly get in just because of a URL problem. 831 00:35:26,700 --> 00:35:28,760 We don't need no stinking password. 832 00:35:30,580 --> 00:35:31,280 All right. 833 00:35:33,180 --> 00:35:35,040 Authentication might not affect your application 834 00:35:35,040 --> 00:35:36,400 because you don't have authentication. 835 00:35:36,620 --> 00:35:37,780 Maybe it's an online shop. 836 00:35:37,980 --> 00:35:40,600 As long as you have a valid credit card number 837 00:35:40,600 --> 00:35:42,400 or someone's valid credit card number 838 00:35:42,400 --> 00:35:43,480 and a shipping address, 839 00:35:43,700 --> 00:35:44,340 they'll send you stuff. 840 00:35:44,460 --> 00:35:45,340 You don't need to authenticate. 841 00:35:46,120 --> 00:35:46,780 Well then, 842 00:35:46,900 --> 00:35:48,500 what would affect you 843 00:35:48,500 --> 00:35:49,840 and pretty much every other application 844 00:35:50,720 --> 00:35:51,940 is session tracking. 845 00:35:52,580 --> 00:35:55,320 This is where you don't have a constant TCP connection 846 00:35:55,320 --> 00:35:56,220 to the web server. 847 00:35:56,420 --> 00:35:57,400 You make a little connection. 848 00:35:57,740 --> 00:35:58,720 You request something. 849 00:35:58,960 --> 00:35:59,640 You make a request. 850 00:35:59,880 --> 00:36:00,860 They send you the reply 851 00:36:00,860 --> 00:36:01,880 and you disconnect. 852 00:36:02,340 --> 00:36:03,980 And then the question is, 853 00:36:04,100 --> 00:36:05,180 from click to click, 854 00:36:05,300 --> 00:36:06,600 from submission to submission, 855 00:36:06,620 --> 00:36:09,040 how do they know you're the same you? 856 00:36:09,140 --> 00:36:10,680 How do they know you're the same person? 857 00:36:10,780 --> 00:36:12,040 They can't go by IP address 858 00:36:12,560 --> 00:36:13,720 because they're not unique. 859 00:36:13,920 --> 00:36:15,000 People use proxies 860 00:36:15,000 --> 00:36:16,300 and people are NATed and stuff. 861 00:36:16,500 --> 00:36:17,820 And so you have lots of people 862 00:36:17,820 --> 00:36:19,640 appearing as a single IP address. 863 00:36:20,120 --> 00:36:21,600 And so what you need to do is something. 864 00:36:21,760 --> 00:36:22,800 You need a unique identifier 865 00:36:22,800 --> 00:36:24,120 embedded in the traffic 866 00:36:24,560 --> 00:36:25,680 called a session identifier 867 00:36:25,680 --> 00:36:26,900 or a session ID. 868 00:36:27,440 --> 00:36:30,500 That is either usually in the cookie. 869 00:36:30,760 --> 00:36:32,380 It's a more popular way of doing it. 870 00:36:32,440 --> 00:36:34,000 Or embedded in the URL. 871 00:36:34,280 --> 00:36:35,700 So the next time you're at Amazon, 872 00:36:35,700 --> 00:36:38,480 notice that every single URL on the page 873 00:36:38,480 --> 00:36:41,520 has the same big serial number on it. 874 00:36:43,320 --> 00:36:45,520 And so that session tracking, 875 00:36:45,680 --> 00:36:49,480 if I can figure out what your session ID is, 876 00:36:49,700 --> 00:36:50,960 I can become you. 877 00:36:51,120 --> 00:36:52,480 It's a small window of opportunity. 878 00:36:52,520 --> 00:36:54,460 It's just while you're logged into the application. 879 00:36:54,820 --> 00:36:57,480 But still, it's a viable attack method, 880 00:36:57,640 --> 00:36:59,100 especially since there are ways 881 00:36:59,100 --> 00:37:00,860 to get the session ID in real time 882 00:37:00,860 --> 00:37:02,680 from other users. 883 00:37:03,020 --> 00:37:04,640 So let's take a look at some of those attacks. 884 00:37:04,640 --> 00:37:06,400 You could predict it. 885 00:37:06,480 --> 00:37:07,800 And that's pretty easy. 886 00:37:07,880 --> 00:37:09,220 What you do is you just figure out 887 00:37:09,220 --> 00:37:11,920 when and where this application first 888 00:37:11,920 --> 00:37:13,420 gives you a session ID. 889 00:37:13,680 --> 00:37:16,380 And you would use a proxy tool 890 00:37:16,380 --> 00:37:19,320 and look for suddenly the URLs change 891 00:37:19,320 --> 00:37:20,500 and there's numbers in them 892 00:37:20,500 --> 00:37:21,840 or there's a cookie. 893 00:37:23,340 --> 00:37:25,740 Let's, for instance, say it's a cookie. 894 00:37:25,920 --> 00:37:27,360 Figure out where you get that cookie 895 00:37:27,360 --> 00:37:28,400 and then take that URL 896 00:37:28,400 --> 00:37:30,500 and then just request it over and over again. 897 00:37:30,940 --> 00:37:32,760 I'll show you a nice little GUI tool again. 898 00:37:33,000 --> 00:37:33,860 Or, of course, 899 00:37:33,860 --> 00:37:34,920 if you're on the command line, 900 00:37:35,060 --> 00:37:35,860 you could just use curl. 901 00:37:36,500 --> 00:37:37,640 I'll show you that later. 902 00:37:38,180 --> 00:37:39,180 Collect a whole bunch 903 00:37:39,900 --> 00:37:42,500 and then do highly sophisticated 904 00:37:42,500 --> 00:37:45,640 mathematical analysis known as subtraction 905 00:37:45,640 --> 00:37:48,360 and then look for a pattern. 906 00:37:48,840 --> 00:37:50,980 So let's take a look at this. 907 00:37:51,020 --> 00:37:52,660 This is a nice little tool by iDefense. 908 00:37:52,820 --> 00:37:54,580 You guys hear iDefense? 909 00:37:55,140 --> 00:37:55,580 Okay. 910 00:37:56,120 --> 00:37:56,740 All right. 911 00:37:56,780 --> 00:37:58,820 So a nice little GUI tool 912 00:37:58,820 --> 00:38:00,560 and very easy to use. 913 00:38:02,240 --> 00:38:03,740 And let's take a look at this. 914 00:38:03,860 --> 00:38:04,480 So what we can do 915 00:38:04,480 --> 00:38:06,100 is just use it to collect cookies. 916 00:38:09,020 --> 00:38:10,800 I happen to know for a fact 917 00:38:11,300 --> 00:38:18,100 that Buggy Bank issues a cookie right here. 918 00:38:18,220 --> 00:38:19,200 So I take that URL 919 00:38:21,520 --> 00:38:23,580 and I can just go ahead and collect them. 920 00:38:24,920 --> 00:38:28,300 And then I think I see a pattern. 921 00:38:29,840 --> 00:38:30,640 136, 137. 922 00:38:31,160 --> 00:38:32,680 That's the UNIX timestamp, 923 00:38:32,680 --> 00:38:36,120 the number of seconds since January 1, 1970. 924 00:38:36,360 --> 00:38:40,000 So yeah, not a terribly sophisticated session ID 925 00:38:40,000 --> 00:38:41,400 for this particular application. 926 00:38:42,300 --> 00:38:44,200 But that's just a fake example. 927 00:38:44,440 --> 00:38:46,360 I'll show you some real stuff. 928 00:38:47,440 --> 00:38:50,040 These are mock-up examples of past assessments. 929 00:38:50,460 --> 00:38:54,320 This is some credit union software. 930 00:38:55,060 --> 00:38:56,780 The numbers were much bigger 931 00:38:57,360 --> 00:38:59,400 and more random than this, 932 00:38:59,480 --> 00:39:01,360 but this was just a quick example I put together. 933 00:39:01,360 --> 00:39:03,380 And I'm looking at it and I say, 934 00:39:03,420 --> 00:39:05,440 well, as time goes by, 935 00:39:05,500 --> 00:39:06,940 time is increasing downward, 936 00:39:07,160 --> 00:39:09,300 the session ID is always getting bigger. 937 00:39:10,240 --> 00:39:11,860 Hmm, that's not random. 938 00:39:12,120 --> 00:39:15,000 So let me do some 939 00:39:16,480 --> 00:39:18,600 highly sophisticated mathematics here. 940 00:39:19,220 --> 00:39:20,420 I'll take one cell 941 00:39:20,420 --> 00:39:22,320 and I minus out the one before it 942 00:39:22,320 --> 00:39:23,060 and I get the delta. 943 00:39:23,220 --> 00:39:24,440 And I say, okay, there's a delta 944 00:39:24,440 --> 00:39:27,420 between one cell and the other. 945 00:39:28,900 --> 00:39:30,980 It's 10,293. 946 00:39:31,600 --> 00:39:33,380 What about the next delta? 947 00:39:33,620 --> 00:39:35,800 Oh, man, it's different. 948 00:39:35,980 --> 00:39:37,860 Oh, I guess I'm done. 949 00:39:38,020 --> 00:39:38,700 I'll just stop here. 950 00:39:38,780 --> 00:39:39,380 But wait, you know, 951 00:39:39,400 --> 00:39:40,720 maybe I should just kind of keep going 952 00:39:40,720 --> 00:39:41,480 just in case. 953 00:39:42,120 --> 00:39:42,700 Uh-oh. 954 00:39:48,880 --> 00:39:49,280 Loser. 955 00:39:49,280 --> 00:39:50,740 Yes, true story. 956 00:39:52,220 --> 00:39:53,520 Is Alfredo in the audience? 957 00:39:53,720 --> 00:39:55,280 I caught a co-worker years ago. 958 00:39:55,340 --> 00:39:56,720 We were working on this together 959 00:39:56,720 --> 00:39:57,840 and I called him up and said, 960 00:39:57,880 --> 00:39:59,800 hey, log in and view cookies 961 00:39:59,800 --> 00:40:01,340 and tell me when you log in. 962 00:40:01,340 --> 00:40:02,680 And he logged in. 963 00:40:02,800 --> 00:40:03,160 He goes, okay. 964 00:40:03,200 --> 00:40:03,680 I'm looking at it. 965 00:40:03,740 --> 00:40:05,140 I said, dude, is your session ID 966 00:40:09,140 --> 00:40:09,580 7294732879404296? 967 00:40:10,520 --> 00:40:11,280 How'd you know? 968 00:40:13,520 --> 00:40:14,760 I know Kung Fu. 969 00:40:17,740 --> 00:40:19,240 Until I told him then, 970 00:40:19,280 --> 00:40:20,280 he was like, you know. 971 00:40:20,600 --> 00:40:21,600 But even still, 972 00:40:21,660 --> 00:40:23,160 even if it's a little bit more complicated, 973 00:40:23,220 --> 00:40:26,220 this is a reasonable simulation 974 00:40:26,220 --> 00:40:28,540 of a recent assessment I did 975 00:40:28,540 --> 00:40:31,100 for a recreational facility. 976 00:40:31,340 --> 00:40:33,940 It's an online reservation system. 977 00:40:34,020 --> 00:40:34,560 You go online, 978 00:40:34,640 --> 00:40:35,580 make ski reservations 979 00:40:35,580 --> 00:40:36,580 and stuff like that. 980 00:40:36,860 --> 00:40:40,500 And that looks thoroughly, 981 00:40:40,700 --> 00:40:41,920 that looks better, right? 982 00:40:42,000 --> 00:40:42,920 That looks more random. 983 00:40:43,000 --> 00:40:44,060 Some numbers are getting bigger 984 00:40:45,060 --> 00:40:46,640 and some are getting smaller. 985 00:40:46,720 --> 00:40:47,620 Sometimes it gets smaller. 986 00:40:50,080 --> 00:40:53,680 And you can really start getting freaky 987 00:40:53,680 --> 00:40:54,360 with this analysis. 988 00:40:54,500 --> 00:40:55,300 I told my wife, 989 00:40:55,380 --> 00:40:55,860 I said, you know, 990 00:40:55,940 --> 00:40:57,700 I made her watch A Beautiful Mind. 991 00:40:57,940 --> 00:40:58,280 I said, look, 992 00:40:58,380 --> 00:40:59,900 those are the signs to look for. 993 00:40:59,900 --> 00:41:01,960 If you see me in front of my computer, 994 00:41:02,100 --> 00:41:04,560 and the patterns are starting to pop out. 995 00:41:06,180 --> 00:41:06,940 No, I'm serious. 996 00:41:08,760 --> 00:41:10,900 I look back at some of the reports I've written 997 00:41:10,900 --> 00:41:13,480 and I spent just a little too much time analyzing. 998 00:41:13,820 --> 00:41:14,860 But I was successful 999 00:41:14,860 --> 00:41:17,060 in attacking systems like this. 1000 00:41:17,540 --> 00:41:18,660 And when I say attacking, 1001 00:41:18,800 --> 00:41:20,020 I mean auditing with permission. 1002 00:41:21,280 --> 00:41:22,480 I do, I do. 1003 00:41:22,540 --> 00:41:23,420 I get paid good money. 1004 00:41:23,660 --> 00:41:27,720 So look, suddenly it's not so random. 1005 00:41:27,800 --> 00:41:29,660 The delta starts to smooth out. 1006 00:41:29,900 --> 00:41:31,260 So it's not totally unpredictable. 1007 00:41:31,680 --> 00:41:34,820 So there was an application like this recently. 1008 00:41:34,860 --> 00:41:37,800 And I was able to figure it out. 1009 00:41:37,880 --> 00:41:40,160 And basically there were groups of digits. 1010 00:41:40,260 --> 00:41:42,360 And some of the digits were very predictable. 1011 00:41:42,420 --> 00:41:42,920 Other ones. 1012 00:41:42,980 --> 00:41:44,660 And eventually was able to pick up 1013 00:41:44,660 --> 00:41:45,640 other people's session IDs. 1014 00:41:49,640 --> 00:41:52,080 So maybe you don't have to predict it. 1015 00:41:52,120 --> 00:41:53,360 Maybe you could just brute force 1016 00:41:53,360 --> 00:41:58,740 through the total space of possible session IDs. 1017 00:41:58,740 --> 00:42:00,940 And so the iDefense tool 1018 00:42:00,940 --> 00:42:03,420 will allow you to brute force a session ID 1019 00:42:03,420 --> 00:42:04,360 if it's in a URL. 1020 00:42:05,740 --> 00:42:08,360 It claims to do the cookie as well, 1021 00:42:08,480 --> 00:42:09,800 but there's a little coding flaw 1022 00:42:09,800 --> 00:42:11,080 and it doesn't work. 1023 00:42:11,300 --> 00:42:13,080 So you'll have to wait for version two. 1024 00:42:13,400 --> 00:42:15,440 Or you could just use curl. 1025 00:42:15,600 --> 00:42:16,840 I think I'll show you that later. 1026 00:42:17,460 --> 00:42:19,540 And so you can brute force a URL. 1027 00:42:19,720 --> 00:42:21,440 Again, this part does not work. 1028 00:42:22,420 --> 00:42:23,440 If you want to know why, 1029 00:42:23,540 --> 00:42:25,120 put a sniffer on the line and you'll see why. 1030 00:42:25,420 --> 00:42:26,740 It's using the wrong headers. 1031 00:42:28,080 --> 00:42:29,700 So what I can do is... 1032 00:42:32,740 --> 00:42:33,980 We'll look at that in a moment. 1033 00:42:36,120 --> 00:42:38,760 So for example, we take a look at buggy bank. 1034 00:42:39,140 --> 00:42:40,700 Let's log in as Fred. 1035 00:42:46,120 --> 00:42:48,060 And I'll view my account balance. 1036 00:42:48,340 --> 00:42:51,840 And something I notice is my... 1037 00:42:51,840 --> 00:42:53,460 There's something embedded in the URL. 1038 00:42:53,980 --> 00:42:56,580 In every URL after I authenticate, 1039 00:42:56,740 --> 00:42:58,780 I see something called SID123. 1040 00:42:59,720 --> 00:43:01,880 Now you might think this is a far-fetched example. 1041 00:43:02,120 --> 00:43:04,440 This is probably one of the first assessments 1042 00:43:04,440 --> 00:43:06,360 I ever did way back in the day. 1043 00:43:06,540 --> 00:43:10,440 And they were using like a three or four digit session ID. 1044 00:43:11,780 --> 00:43:12,900 I'll give them some credit. 1045 00:43:13,280 --> 00:43:15,080 All these parameters were encrypted. 1046 00:43:15,660 --> 00:43:19,640 It was just a matter of finding the old CGI script. 1047 00:43:19,800 --> 00:43:21,520 They had the old version still on the server 1048 00:43:21,520 --> 00:43:23,240 that would decrypt it for me. 1049 00:43:23,440 --> 00:43:24,660 It's really convenient. 1050 00:43:24,880 --> 00:43:25,360 You know? 1051 00:43:25,360 --> 00:43:27,780 And then once I saw that it was three digits, 1052 00:43:27,940 --> 00:43:30,180 and they were issued sequentially, 1053 00:43:30,980 --> 00:43:33,380 I was able to work them backwards 1054 00:43:33,380 --> 00:43:36,140 and pull out everybody's completed credit card application. 1055 00:43:37,080 --> 00:43:39,400 And that's when one of my bosses was like, 1056 00:43:39,480 --> 00:43:40,900 hey, could you sort through those 1057 00:43:40,900 --> 00:43:43,120 and find single women with good credit ratings? 1058 00:43:43,240 --> 00:43:45,820 It's like, with no dependents? 1059 00:43:46,980 --> 00:43:48,340 It's like, no, I cannot. 1060 00:43:49,740 --> 00:43:50,260 But... 1061 00:43:54,480 --> 00:43:56,440 And so to brute force that, 1062 00:43:57,280 --> 00:43:58,840 you can go ahead and... 1063 00:43:58,840 --> 00:44:01,200 I just already worked out the syntax here. 1064 00:44:01,260 --> 00:44:02,060 You would take that URL 1065 00:44:02,060 --> 00:44:06,540 and put it into the brute force tool here. 1066 00:44:06,700 --> 00:44:08,780 And it has a syntax where you tell it 1067 00:44:08,780 --> 00:44:10,640 what digit to start on 1068 00:44:10,640 --> 00:44:13,220 and what type of digit range to use. 1069 00:44:13,320 --> 00:44:15,600 And the number one means zero through nine. 1070 00:44:15,800 --> 00:44:19,240 And that's all explained in a little info button here. 1071 00:44:19,240 --> 00:44:20,540 I won't bore you with that. 1072 00:44:20,760 --> 00:44:23,320 So bottom line is we want to go ahead 1073 00:44:23,320 --> 00:44:24,920 and brute force that URL, 1074 00:44:25,400 --> 00:44:26,480 changing that number, 1075 00:44:26,640 --> 00:44:28,500 looking for the occurrence of the phrase 1076 00:44:28,500 --> 00:44:29,580 your account balance, 1077 00:44:30,060 --> 00:44:31,740 or account balances are. 1078 00:44:32,960 --> 00:44:35,020 So that's the shoring we want to look for. 1079 00:44:35,160 --> 00:44:35,680 If we... 1080 00:44:36,580 --> 00:44:38,860 Because if we just randomly guess a number, 1081 00:44:39,180 --> 00:44:40,700 we're probably going to get an error message. 1082 00:44:41,000 --> 00:44:41,440 Right. 1083 00:44:42,460 --> 00:44:45,280 So then we'll just let this brute force. 1084 00:44:48,420 --> 00:44:50,920 And it seems to stop at 133. 1085 00:44:52,100 --> 00:44:53,060 And sure enough, 1086 00:44:53,280 --> 00:44:56,120 you go in and you back up 1087 00:44:56,120 --> 00:44:58,100 and you type in that number and it's... 1088 00:45:00,020 --> 00:45:01,760 And it goes from Fred Bucket to... 1089 00:45:01,760 --> 00:45:02,720 Oh, it's my account. 1090 00:45:04,000 --> 00:45:05,640 And a very healthy account it is. 1091 00:45:05,960 --> 00:45:06,400 Right. 1092 00:45:07,120 --> 00:45:08,000 Okay, so... 1093 00:45:11,120 --> 00:45:13,300 Now, I don't want you to think I'm, you know, 1094 00:45:13,300 --> 00:45:15,180 Mr. Gooey Tool or something, right? 1095 00:45:16,880 --> 00:45:19,960 So I have to put in some little command line kung fu here. 1096 00:45:20,580 --> 00:45:21,520 If you haven't... 1097 00:45:21,520 --> 00:45:23,800 If you're doing any kind of work with web applications 1098 00:45:23,800 --> 00:45:25,140 and you haven't tried curl, 1099 00:45:25,460 --> 00:45:26,820 you need to try it today. 1100 00:45:27,300 --> 00:45:27,900 All right. 1101 00:45:28,020 --> 00:45:28,660 Don't delay. 1102 00:45:28,840 --> 00:45:30,560 So here's an example of a command. 1103 00:45:30,640 --> 00:45:32,180 You can embed your own cookies. 1104 00:45:32,580 --> 00:45:34,620 You can embed your own post data. 1105 00:45:35,420 --> 00:45:37,560 And then finally, the URL you want to attack. 1106 00:45:37,880 --> 00:45:41,960 I mean, this is basically a command line browser, sort of. 1107 00:45:41,960 --> 00:45:43,460 It only does a single request 1108 00:45:43,460 --> 00:45:45,040 and you get the response back. 1109 00:45:45,280 --> 00:45:46,900 But because it's on the command line, 1110 00:45:47,040 --> 00:45:50,920 you just wrap it in a purl minus E little script 1111 00:45:50,920 --> 00:45:52,320 right on the command line 1112 00:45:52,320 --> 00:45:53,700 and you can start getting busy. 1113 00:45:53,940 --> 00:45:56,520 So here's an example of where this would go out 1114 00:45:57,040 --> 00:46:00,120 and grab our account balance. 1115 00:46:00,460 --> 00:46:01,540 Not a big deal. 1116 00:46:01,860 --> 00:46:04,740 However, if you iterate over the session value 1117 00:46:04,740 --> 00:46:06,960 or at least the last three digits of the session value, 1118 00:46:07,220 --> 00:46:08,780 you can go back through 1119 00:46:08,780 --> 00:46:11,660 and start finding other people's session IDs. 1120 00:46:12,480 --> 00:46:13,460 And so... 1121 00:46:17,260 --> 00:46:20,080 And so that's left as an exercise to the reader. 1122 00:46:21,020 --> 00:46:21,580 And... 1123 00:46:23,920 --> 00:46:26,780 So never underestimate the power of purl and curl. 1124 00:46:27,080 --> 00:46:29,940 Two great tastes that taste great together. 1125 00:46:30,360 --> 00:46:31,100 All right. 1126 00:46:33,160 --> 00:46:35,500 Finally, maybe you can't brute force it. 1127 00:46:35,580 --> 00:46:37,120 Maybe you can't predict it. 1128 00:46:37,200 --> 00:46:38,640 What else is there to do? 1129 00:46:39,260 --> 00:46:40,260 Steal it, right? 1130 00:46:41,480 --> 00:46:42,600 And so... 1131 00:46:42,600 --> 00:46:44,160 Or as they say in your... 1132 00:46:44,160 --> 00:46:46,700 in London, you can pinch it, right? 1133 00:46:46,860 --> 00:46:49,980 And so probably the easiest way to do that 1134 00:46:49,980 --> 00:46:51,400 is through cross-site scripting. 1135 00:46:51,640 --> 00:46:53,680 This is where you either trick someone 1136 00:46:53,680 --> 00:46:54,940 into clicking a URL. 1137 00:46:55,140 --> 00:46:57,000 That URL contains JavaScript. 1138 00:46:57,500 --> 00:46:59,320 They send that JavaScript off to a website 1139 00:46:59,320 --> 00:47:00,480 that reflects it back. 1140 00:47:00,780 --> 00:47:03,020 And that person ends up hacking themselves. 1141 00:47:03,580 --> 00:47:05,500 Or you embed it into a website. 1142 00:47:05,660 --> 00:47:08,040 So imagine this little piece of JavaScript down here 1143 00:47:08,040 --> 00:47:09,080 embedded in a website 1144 00:47:09,080 --> 00:47:11,580 in like a forum or a news group. 1145 00:47:11,920 --> 00:47:13,080 And then someone... 1146 00:47:13,080 --> 00:47:14,600 some poor unfortunate soul 1147 00:47:14,600 --> 00:47:15,780 surfs to it. 1148 00:47:16,320 --> 00:47:19,060 And suddenly what it will do 1149 00:47:19,060 --> 00:47:20,400 is it will pop open a window 1150 00:47:21,080 --> 00:47:24,040 and contact EvilSight on port 888 1151 00:47:24,040 --> 00:47:26,820 and embed all their cookies. 1152 00:47:27,080 --> 00:47:30,220 So for example, suppose this JavaScript 1153 00:47:30,220 --> 00:47:32,140 was embedded in a news forum 1154 00:47:32,140 --> 00:47:33,460 for Vaporware. 1155 00:47:33,660 --> 00:47:35,060 The Vaporware Corporation. 1156 00:47:35,540 --> 00:47:38,240 Anybody viewing that calendar entry that had this 1157 00:47:38,240 --> 00:47:40,680 would send all their Vaporware cookies 1158 00:47:40,680 --> 00:47:42,880 which include the session tracking, 1159 00:47:43,080 --> 00:47:43,720 in many cases. 1160 00:47:46,000 --> 00:47:47,940 So let's take a look at what that looks like. 1161 00:47:49,800 --> 00:47:51,900 I'm going to go ahead and use my little cheat sheet here 1162 00:47:51,900 --> 00:47:56,280 to bring up my command line. 1163 00:47:58,920 --> 00:48:00,620 And I'm going to go ahead and start up 1164 00:48:02,160 --> 00:48:03,400 everybody's favorite, Netcat. 1165 00:48:05,580 --> 00:48:06,960 Some people make a good living 1166 00:48:06,960 --> 00:48:09,720 talking about nothing but Netcat. 1167 00:48:10,740 --> 00:48:11,320 Hey, Ed. 1168 00:48:11,320 --> 00:48:12,300 All right, so... 1169 00:48:14,540 --> 00:48:15,360 All right. 1170 00:48:15,740 --> 00:48:17,080 So there we go. 1171 00:48:17,620 --> 00:48:18,100 We're... 1172 00:48:18,100 --> 00:48:19,160 Our evil hacker, 1173 00:48:19,380 --> 00:48:21,240 who apparently has a very sunny disposition 1174 00:48:21,240 --> 00:48:22,480 because it's a white background. 1175 00:48:22,780 --> 00:48:25,860 Our evil hacker is listening on port 888 1176 00:48:25,860 --> 00:48:27,720 for some poor unsuspecting victim. 1177 00:48:27,860 --> 00:48:28,940 And who would that victim be? 1178 00:48:29,120 --> 00:48:29,960 Well, let's... 1179 00:48:31,260 --> 00:48:33,580 Let's go ahead back to our bank and log in. 1180 00:48:33,760 --> 00:48:36,040 And we know there's a user on here called Al Gore. 1181 00:48:36,400 --> 00:48:38,560 So of course there's a user called George W. 1182 00:48:39,500 --> 00:48:39,980 And... 1183 00:48:40,640 --> 00:48:42,080 How do you spell strategery? 1184 00:48:47,160 --> 00:48:47,960 Okay, good. 1185 00:48:48,160 --> 00:48:48,520 All right. 1186 00:48:48,620 --> 00:48:49,740 So then we'll... 1187 00:48:49,740 --> 00:48:50,840 We've got a real... 1188 00:48:50,840 --> 00:48:51,320 You know what? 1189 00:48:51,340 --> 00:48:53,000 I'm already logged in on this other... 1190 00:48:53,000 --> 00:48:54,160 Well, I'm supposed to be. 1191 00:48:54,540 --> 00:48:55,620 Is it already logged in? 1192 00:48:55,700 --> 00:48:55,760 No. 1193 00:48:56,340 --> 00:48:59,380 So we'll go to a private calendar 1194 00:48:59,380 --> 00:49:00,680 just for the company 1195 00:49:00,680 --> 00:49:03,160 where other employees are posting things. 1196 00:49:03,620 --> 00:49:04,140 I'll go there. 1197 00:49:04,720 --> 00:49:06,000 I'll view that calendar. 1198 00:49:06,500 --> 00:49:09,960 Switch to where I know the booby trap is. 1199 00:49:09,980 --> 00:49:11,520 March 2002. 1200 00:49:11,900 --> 00:49:13,400 And I see a little thing that says, 1201 00:49:13,540 --> 00:49:14,060 Hi, George. 1202 00:49:14,580 --> 00:49:16,360 And so that looks enticing. 1203 00:49:16,540 --> 00:49:17,560 I think I'll click on that. 1204 00:49:18,960 --> 00:49:20,200 And watch carefully. 1205 00:49:21,200 --> 00:49:22,200 What was that? 1206 00:49:22,460 --> 00:49:23,120 Oh, I don't know. 1207 00:49:23,280 --> 00:49:24,480 Probably just ignore that. 1208 00:49:25,440 --> 00:49:26,440 Nothing to see here. 1209 00:49:26,580 --> 00:49:28,400 What happened was a pop-up appeared, 1210 00:49:29,320 --> 00:49:30,640 spoke to evil site, 1211 00:49:30,740 --> 00:49:31,640 sending our cookies. 1212 00:49:31,920 --> 00:49:35,260 Evil site was nice enough to send a little piece of JavaScript 1213 00:49:35,260 --> 00:49:35,820 that said, 1214 00:49:35,880 --> 00:49:37,000 Dear Mr. Pop-up window, 1215 00:49:37,220 --> 00:49:38,100 you can close. 1216 00:49:38,740 --> 00:49:39,620 You can close. 1217 00:49:39,620 --> 00:49:41,400 And hide all evidence of your existence. 1218 00:49:41,660 --> 00:49:43,460 Now, when I did that recently for a customer, 1219 00:49:43,580 --> 00:49:44,720 I went the extra step, 1220 00:49:44,800 --> 00:49:46,240 and I did a pop-under window. 1221 00:49:46,460 --> 00:49:47,820 So they didn't see anything. 1222 00:49:48,080 --> 00:49:50,900 And I was able to show them in a controlled fashion 1223 00:49:50,900 --> 00:49:53,500 that I was able to take over other accounts. 1224 00:49:55,400 --> 00:49:57,200 Here's our little happy hacker site. 1225 00:49:57,960 --> 00:49:59,640 And we see that somebody connected 1226 00:49:59,640 --> 00:50:00,980 with a browser request. 1227 00:50:01,500 --> 00:50:03,760 Apparently George W. is using IE. 1228 00:50:03,940 --> 00:50:04,740 That makes sense. 1229 00:50:05,020 --> 00:50:07,220 And look. 1230 00:50:07,360 --> 00:50:09,160 They sent their cookie. 1231 00:50:09,620 --> 00:50:12,500 That's their session tracking mechanism for that user. 1232 00:50:12,620 --> 00:50:14,660 So real time, grab the cookie. 1233 00:50:14,800 --> 00:50:16,500 So cross-site scripting is most dangerous 1234 00:50:16,500 --> 00:50:18,380 when it can be embedded into a website. 1235 00:50:19,040 --> 00:50:21,320 Because all the victims are already authenticated. 1236 00:50:21,600 --> 00:50:23,300 And in real time, 1237 00:50:23,380 --> 00:50:26,820 they're live, active, useful session IDs. 1238 00:50:27,000 --> 00:50:28,000 That's the most dangerous. 1239 00:50:28,460 --> 00:50:31,700 And then second would be someone being able to reflect it off your site, 1240 00:50:31,760 --> 00:50:34,060 being of a slightly lesser concern. 1241 00:50:37,000 --> 00:50:37,520 Okay. 1242 00:50:40,460 --> 00:50:42,360 Wrapping up here with the last two sections, 1243 00:50:42,480 --> 00:50:43,780 there's unexpected user input. 1244 00:50:44,020 --> 00:50:44,900 We've all seen this. 1245 00:50:45,020 --> 00:50:46,980 You can get SQL injection errors 1246 00:50:46,980 --> 00:50:48,440 and various things like that. 1247 00:50:48,560 --> 00:50:51,240 I want to show you one from BigBank 1248 00:50:51,240 --> 00:50:54,840 where they were using a cookie 1249 00:50:54,840 --> 00:50:56,460 to encrypt account numbers. 1250 00:50:56,780 --> 00:50:58,260 You would type in your account number. 1251 00:50:58,380 --> 00:50:59,760 They would PGP encrypt it, 1252 00:51:00,340 --> 00:51:01,320 give you back the cookie. 1253 00:51:01,420 --> 00:51:02,240 You could store it. 1254 00:51:02,540 --> 00:51:04,980 When you go back to the website to log in, 1255 00:51:05,040 --> 00:51:06,480 rather than typing in, 1256 00:51:06,480 --> 00:51:08,480 your very large account number, 1257 00:51:08,620 --> 00:51:10,920 you would send them automatically the cookie 1258 00:51:10,920 --> 00:51:12,080 upon surfing there. 1259 00:51:12,260 --> 00:51:14,300 They would dynamically decrypt it 1260 00:51:14,300 --> 00:51:16,780 and put the last four digits in the HTML 1261 00:51:16,780 --> 00:51:19,060 and give you a nice little drop-down box 1262 00:51:19,060 --> 00:51:20,280 of all your cookies. 1263 00:51:20,580 --> 00:51:21,420 It's kind of nice. 1264 00:51:21,480 --> 00:51:22,980 I mean, of all your account numbers. 1265 00:51:23,160 --> 00:51:24,440 So if you had like five accounts, 1266 00:51:24,660 --> 00:51:26,520 you could choose which one of those accounts 1267 00:51:26,520 --> 00:51:27,340 you want to log into. 1268 00:51:27,440 --> 00:51:28,200 Just select it. 1269 00:51:28,240 --> 00:51:30,040 Type in your four-digit PIN and go. 1270 00:51:30,340 --> 00:51:31,380 Very convenient. 1271 00:51:31,660 --> 00:51:32,960 There's only a problem, though. 1272 00:51:33,040 --> 00:51:35,140 That data was being passed to PGP. 1273 00:51:35,140 --> 00:51:37,300 The data that was on your system 1274 00:51:37,300 --> 00:51:38,860 and being sent to them. 1275 00:51:39,200 --> 00:51:42,420 Now, you manipulate the cookie 1276 00:51:42,420 --> 00:51:44,680 and you get an error message about PGP. 1277 00:51:44,980 --> 00:51:46,020 So, for example, 1278 00:51:46,040 --> 00:51:51,580 if we go to Buggy Bank here 1279 00:51:52,820 --> 00:51:54,800 and do a funds transfer. 1280 00:51:55,560 --> 00:51:56,080 Whoops. 1281 00:51:56,200 --> 00:51:57,960 I guess I'm not logged in as a legitimate user. 1282 00:51:58,760 --> 00:51:59,820 It's been tampering. 1283 00:52:03,240 --> 00:52:04,000 Let's see. 1284 00:52:05,500 --> 00:52:08,740 And I define an intercept with web proxy. 1285 00:52:08,900 --> 00:52:09,620 Freeze it. 1286 00:52:10,060 --> 00:52:11,440 Go in here to my cookie. 1287 00:52:12,920 --> 00:52:13,840 This cookie here. 1288 00:52:13,960 --> 00:52:16,640 And add some garbage like a semicolon. 1289 00:52:19,680 --> 00:52:22,280 I end up getting a very cryptic little message. 1290 00:52:22,940 --> 00:52:24,360 You could almost overlook it. 1291 00:52:24,400 --> 00:52:24,880 It's so small. 1292 00:52:25,680 --> 00:52:26,120 PGP. 1293 00:52:26,340 --> 00:52:26,520 Hmm. 1294 00:52:26,680 --> 00:52:27,460 So you start thinking about it. 1295 00:52:27,520 --> 00:52:30,460 How are they getting my cookie data to PGP? 1296 00:52:30,580 --> 00:52:32,040 Well, PGP is an encryption tool 1297 00:52:32,040 --> 00:52:33,620 that works on a command line. 1298 00:52:33,620 --> 00:52:36,460 And, of course, they're probably running it as root, right? 1299 00:52:36,520 --> 00:52:37,600 It's run everything as root. 1300 00:52:37,940 --> 00:52:39,180 And it always works. 1301 00:52:39,680 --> 00:52:41,540 And so PGP cookie data. 1302 00:52:41,620 --> 00:52:42,560 But if I control this, 1303 00:52:42,760 --> 00:52:45,480 then I control the command line, don't I? 1304 00:52:45,500 --> 00:52:47,780 Couldn't I put some junk in the cookie 1305 00:52:47,780 --> 00:52:50,500 and then a semicolon followed by commands? 1306 00:52:51,340 --> 00:52:53,120 No, that couldn't possibly work. 1307 00:52:55,080 --> 00:52:55,880 And, yeah. 1308 00:52:56,240 --> 00:52:57,580 This was another one 1309 00:52:57,580 --> 00:52:58,780 where I jumped up out of the chair 1310 00:52:58,780 --> 00:52:59,700 and was dancing around. 1311 00:52:59,820 --> 00:53:01,320 And then I turned around to the guy and said, 1312 00:53:01,440 --> 00:53:02,740 Sir, you have a problem. 1313 00:53:03,620 --> 00:53:05,000 Did my little hacker dance. 1314 00:53:05,360 --> 00:53:06,980 Netstat space minus NA. 1315 00:53:08,480 --> 00:53:11,900 I prefer netstat as my command injection of choice 1316 00:53:11,900 --> 00:53:14,560 because it runs on both kinds, 1317 00:53:14,820 --> 00:53:15,600 country and western. 1318 00:53:15,860 --> 00:53:17,160 Unix and Windows. 1319 00:53:17,420 --> 00:53:18,460 Same syntax. 1320 00:53:19,040 --> 00:53:20,800 So now I'm running commands 1321 00:53:20,800 --> 00:53:22,520 on one of the world's largest banks 1322 00:53:22,520 --> 00:53:24,440 on their application server. 1323 00:53:24,840 --> 00:53:26,740 And you haven't retired yet? 1324 00:53:27,080 --> 00:53:27,340 No. 1325 00:53:27,460 --> 00:53:28,060 So... 1326 00:53:28,620 --> 00:53:29,420 I've fallen. 1327 00:53:29,920 --> 00:53:32,060 And I can't get up. 1328 00:53:32,160 --> 00:53:32,320 Yeah. 1329 00:53:32,320 --> 00:53:33,660 So that was bad news for them. 1330 00:53:34,300 --> 00:53:36,260 And finally, 1331 00:53:36,600 --> 00:53:38,600 one last thing I want to cover real quick 1332 00:53:38,600 --> 00:53:39,760 is an application flaw. 1333 00:53:40,120 --> 00:53:41,080 Application logic. 1334 00:53:41,720 --> 00:53:44,220 This is where you try to do a transaction 1335 00:53:44,220 --> 00:53:45,720 and there are certain steps required. 1336 00:53:46,080 --> 00:53:47,480 But you do them in the wrong order. 1337 00:53:47,740 --> 00:53:48,480 Think about this. 1338 00:53:48,580 --> 00:53:49,440 You want to transfer money 1339 00:53:49,440 --> 00:53:51,200 from account A to account B. 1340 00:53:51,600 --> 00:53:52,040 First, 1341 00:53:52,220 --> 00:53:54,500 are you authorized to take money out of the account? 1342 00:53:54,700 --> 00:53:55,860 Always an essential question. 1343 00:53:56,140 --> 00:53:58,500 Are you authorized to put money into the other account 1344 00:53:58,500 --> 00:53:59,640 because maybe it's not yours 1345 00:53:59,640 --> 00:54:01,100 or maybe it's a money market account 1346 00:54:01,100 --> 00:54:02,860 and you're not allowed to put money into it 1347 00:54:02,860 --> 00:54:04,560 but only so many times per year? 1348 00:54:04,920 --> 00:54:05,440 Finally, 1349 00:54:05,460 --> 00:54:06,040 last, 1350 00:54:06,760 --> 00:54:09,020 once those first two are answered correctly, 1351 00:54:09,220 --> 00:54:09,740 you say, 1352 00:54:09,820 --> 00:54:10,860 do you have enough money? 1353 00:54:11,460 --> 00:54:13,600 But this credit union software, 1354 00:54:13,980 --> 00:54:15,680 so this affected lots of credit unions, 1355 00:54:17,960 --> 00:54:19,920 was doing step C first. 1356 00:54:20,400 --> 00:54:22,740 So the way that played out was, 1357 00:54:23,540 --> 00:54:25,760 the way that played out is you could... 1358 00:54:25,760 --> 00:54:27,120 Let me go back here. 1359 00:54:29,040 --> 00:54:29,820 Log in. 1360 00:54:29,820 --> 00:54:31,520 Super secret pin. 1361 00:54:31,920 --> 00:54:33,860 And do a funds transfer 1362 00:54:33,860 --> 00:54:39,060 and go ahead and do $5 and intercept it. 1363 00:54:40,480 --> 00:54:41,600 Oh, I'm out of time. 1364 00:54:42,060 --> 00:54:42,760 That's okay. 1365 00:54:43,700 --> 00:54:45,580 And I'm going to go ahead and change the from account 1366 00:54:45,580 --> 00:54:46,580 to someone else's 1367 00:54:46,580 --> 00:54:49,140 and I'll try to steal $5 1368 00:54:49,140 --> 00:54:50,920 and it catches me. 1369 00:54:50,980 --> 00:54:51,200 You know, 1370 00:54:51,240 --> 00:54:53,480 your pathetic attempt has been detected. 1371 00:54:53,640 --> 00:54:55,080 Please assume the fetal position. 1372 00:54:56,660 --> 00:54:57,940 The mafia boy maneuver. 1373 00:54:58,160 --> 00:54:58,400 So, 1374 00:54:58,400 --> 00:55:02,280 or whoever that kid was that dropped to the ground 1375 00:55:02,280 --> 00:55:03,320 when they busted in his door. 1376 00:55:03,800 --> 00:55:05,160 I'm sure I would have done the same. 1377 00:55:06,620 --> 00:55:07,740 But now you think about it. 1378 00:55:07,760 --> 00:55:09,080 What if they're checking the balance first? 1379 00:55:09,220 --> 00:55:10,280 So instead of $5, 1380 00:55:10,560 --> 00:55:13,120 I'm going to do $5 million. 1381 00:55:14,260 --> 00:55:16,560 And what comes back now is an error message. 1382 00:55:18,660 --> 00:55:20,120 What's the error message you give someone 1383 00:55:20,120 --> 00:55:21,280 when they exceed their balance? 1384 00:55:21,440 --> 00:55:22,660 Why, you give them the balance. 1385 00:55:22,740 --> 00:55:24,840 So I now have the ability to collect balances 1386 00:55:25,420 --> 00:55:26,980 on any account number. 1387 00:55:31,980 --> 00:55:33,320 And correct me if I'm wrong, 1388 00:55:33,400 --> 00:55:34,880 that was for credit union software, right? 1389 00:55:34,940 --> 00:55:35,860 Or was that for one bank? 1390 00:55:36,980 --> 00:55:38,520 Yeah, credit union software. 1391 00:55:39,560 --> 00:55:40,980 Cold state, that's where it started. 1392 00:55:41,200 --> 00:55:41,400 Okay. 1393 00:55:41,540 --> 00:55:42,100 Yeah, okay. 1394 00:55:42,140 --> 00:55:43,540 My ex-coworkers are in the back. 1395 00:55:44,180 --> 00:55:46,080 So yeah, this was a nice little feature. 1396 00:55:46,200 --> 00:55:46,720 Let me just, 1397 00:55:47,480 --> 00:55:48,840 let's view this form. 1398 00:55:49,020 --> 00:55:50,280 Let me grab my cookie. 1399 00:55:50,500 --> 00:55:51,740 I'm going to grab my session ID 1400 00:55:51,740 --> 00:55:54,440 because then what I want to do is do some more. 1401 00:56:00,000 --> 00:56:03,040 I wrote a little script just for you guys 1402 00:56:03,040 --> 00:56:04,380 that would go through 1403 00:56:08,880 --> 00:56:11,360 and it would go ahead and just 1404 00:56:13,260 --> 00:56:14,680 take my current session ID. 1405 00:56:14,700 --> 00:56:15,640 Notice we're not going to, 1406 00:56:15,640 --> 00:56:16,320 nice, 1407 00:56:16,660 --> 00:56:19,000 we're not going to brute force session IDs 1408 00:56:19,000 --> 00:56:19,800 or anything like this. 1409 00:56:19,860 --> 00:56:21,260 We're going to take our session ID 1410 00:56:24,900 --> 00:56:26,280 and as us, 1411 00:56:26,460 --> 00:56:27,720 as, yeah, I know. 1412 00:56:27,800 --> 00:56:28,280 All right. 1413 00:56:28,920 --> 00:56:30,620 It goes through and iterates through 1414 00:56:30,620 --> 00:56:32,040 lots and lots of different account numbers, 1415 00:56:32,180 --> 00:56:34,240 collecting balances along the way. 1416 00:56:36,820 --> 00:56:37,940 Oh, but don't worry, 1417 00:56:38,120 --> 00:56:40,400 the website's using SSL so it's protected. 1418 00:56:42,520 --> 00:56:43,920 I'm hacking in privacy. 1419 00:56:44,100 --> 00:56:44,960 Thanks, Verisign. 1420 00:56:48,400 --> 00:56:49,260 All right. 1421 00:56:49,480 --> 00:56:50,280 So in conclusion, 1422 00:56:50,960 --> 00:56:52,420 brains and clues are not included. 1423 00:56:52,480 --> 00:56:53,860 You have to know what you're looking for. 1424 00:56:53,920 --> 00:56:55,500 Beware of robo-hacking devices. 1425 00:56:56,100 --> 00:56:58,340 They're only going to crash your back-end data 1426 00:56:58,340 --> 00:56:59,700 databases, I assure you of that. 1427 00:56:59,920 --> 00:57:01,660 And no one tool does it all yet. 1428 00:57:03,920 --> 00:57:05,080 I know Kung Fu. 1429 00:57:05,380 --> 00:57:05,980 You're eventually, 1430 00:57:06,240 --> 00:57:07,460 if you really want to do the job right, 1431 00:57:07,560 --> 00:57:07,980 you're going to have to, 1432 00:57:07,980 --> 00:57:09,700 you're going to have to show me. 1433 00:57:09,740 --> 00:57:10,880 You're going to have to show me your Kung Fu 1434 00:57:10,880 --> 00:57:12,340 with various things I recommend, 1435 00:57:12,500 --> 00:57:13,080 Pearl and Curl. 1436 00:57:13,440 --> 00:57:14,560 And then, by all means, 1437 00:57:14,620 --> 00:57:16,660 download WebMaven, aka Buggy Bank, 1438 00:57:16,840 --> 00:57:18,280 and go hack yourself, okay? 1439 00:57:18,540 --> 00:57:19,540 It's a fake app. 1440 00:57:19,740 --> 00:57:21,720 It allows you to, you know, 1441 00:57:21,720 --> 00:57:23,320 practice legally and safely 1442 00:57:23,320 --> 00:57:24,580 in the comfort of your own home. 1443 00:57:25,520 --> 00:57:27,440 And various other resources are listed. 1444 00:57:27,440 --> 00:57:29,840 I encourage you to check out the presentation slides 1445 00:57:29,840 --> 00:57:30,920 by downloading... 1446 00:57:30,920 --> 00:57:31,380 One more question, 1447 00:57:31,440 --> 00:57:32,660 and I'm beating the shit out of you. 1448 00:57:32,680 --> 00:57:32,900 I'm sorry. 1449 00:57:32,960 --> 00:57:33,520 Were there any questions? 1450 00:57:33,840 --> 00:57:34,860 No time for questions. 1451 00:57:35,460 --> 00:57:36,080 Where's the download? 1452 00:57:36,480 --> 00:57:37,100 Where's the download? 1453 00:57:37,320 --> 00:57:37,920 The slides? 1454 00:57:38,660 --> 00:57:39,560 Defcon.org, right? 1455 00:57:39,640 --> 00:57:40,420 All the media's there. 1456 00:57:40,540 --> 00:57:40,840 You're going to... 1457 00:57:41,200 --> 00:57:42,400 Or our website... 1458 00:57:42,400 --> 00:57:43,120 One more question, 1459 00:57:43,180 --> 00:57:44,420 and I'm beating the shit out of you. 1460 00:57:44,480 --> 00:57:44,600 All right. 1461 00:57:44,640 --> 00:57:45,180 No more questions. 1462 00:57:47,080 --> 00:57:49,000 And since you asked the question, 1463 00:57:49,120 --> 00:57:49,820 you can have the speakers. 1464 00:57:50,060 --> 00:57:50,860 That's the quickest way 1465 00:57:50,860 --> 00:57:51,820 I can figure out how to do this. 1466 00:57:51,900 --> 00:57:54,080 So, yeah, feel free to visit our website 1467 00:57:54,560 --> 00:57:56,400 in a passive, non-hostile fashion. 1468 00:57:56,940 --> 00:57:57,260 And... 1469 00:57:57,440 --> 00:57:58,640 Download the slides from there. 1470 00:57:59,180 --> 00:57:59,780 Thank you.