1 00:00:04,080 --> 00:00:09,360 A lot of them are actually detailed on the conference CD. Oh, hey Jeff. Give a hand for Jeff Moss. 2 00:00:15,440 --> 00:00:18,700 We're going to take this off the screen for a second as we enter the IP address. 3 00:00:21,280 --> 00:00:23,620 No particular reason, I trust each and every one of you. 4 00:00:32,880 --> 00:00:38,240 Well, Michael is entering the address information. My name is Dave Endler, Michael Sutton. We 5 00:00:38,240 --> 00:00:42,000 work for iDefense. iDefense is a security intelligence company, just to give you a bit 6 00:00:42,000 --> 00:00:47,240 of background. Michael and I work for iDefense Labs, the security research arm of iDefense, 7 00:00:47,360 --> 00:00:49,900 and one of our keen interests is web application security. 8 00:00:51,160 --> 00:00:56,240 Today we're going to talk about a very narrow aspect of web application security, but it's 9 00:00:56,240 --> 00:00:59,980 an important aspect because these types of vulnerabilities that we're going to talk 10 00:00:59,980 --> 00:01:06,580 about are extremely prevalent on a lot of websites and web application software, softwares 11 00:01:06,580 --> 00:01:12,720 out there. Additionally, it takes about half a second and half a brain to exploit these 12 00:01:12,720 --> 00:01:16,960 vulnerabilities. We're just going to walk through some of the basics, go through some 13 00:01:17,640 --> 00:01:23,220 basic concepts of how state mechanisms are applied in a web application sense, and how 14 00:01:23,220 --> 00:01:26,580 you can easily break through those. Essentially, we're going to be talking about how to brute 15 00:01:26,580 --> 00:01:29,960 force an application, not necessarily with the traditional user-neutral application, 16 00:01:29,960 --> 00:01:36,040 username and password, 123, 123, guest, guest, but brute forcing that state mechanism that's 17 00:01:36,040 --> 00:01:37,560 usually transparent to the user. 18 00:01:48,480 --> 00:01:53,100 While we're getting started, just in terms of the legality of testing these types of 19 00:01:53,100 --> 00:01:58,240 mechanisms, in the course of our research, we treated a lot of the holes we found. We 20 00:01:58,240 --> 00:01:59,940 are going to be actually demonstrating the legality of testing these types of mechanisms. 21 00:01:59,960 --> 00:02:02,780 We're going to be evaluating some live holes that we notified the vendor of about a year 22 00:02:02,780 --> 00:02:09,260 ago. They're still there. Most of them either ignored us or were somewhat responsible in 23 00:02:09,260 --> 00:02:15,540 their response. One in particular, and I'm not going to say much more about it, but 24 00:02:15,540 --> 00:02:19,860 one in particular threatened to sue us. These types of vulnerabilities, while they might 25 00:02:19,860 --> 00:02:23,880 not seem that large, we go through the same sorts of responsible disclosure problems 26 00:02:23,880 --> 00:02:28,480 that all of you do as well. If Jennifer Granik is in the audience, thank you very much for 27 00:02:28,480 --> 00:02:29,860 your help and that of your students. 28 00:02:30,340 --> 00:02:35,160 She was actually able to provide some feedback and did a lot of the legwork when we were contacted 29 00:02:35,160 --> 00:02:40,960 by this company. I'm not going to say anything more about it. Even if I'm completely drunk 30 00:02:40,960 --> 00:02:43,180 tonight, you're not going to be able to get me to say who it is. 31 00:03:14,740 --> 00:03:17,360 But I'm having a good time pretending it is. 32 00:03:20,640 --> 00:03:25,040 Sorry, we don't want to spend a lot of time on the network part, but while they work on 33 00:03:25,040 --> 00:03:28,140 that, I just want to give another plug. This is actually in the presentation, so it's not 34 00:03:28,140 --> 00:03:29,000 taking time out of it. 35 00:03:29,660 --> 00:03:29,940 I'm going to give another plug. This is actually in the presentation, so it's not taking time out of it. 36 00:03:29,960 --> 00:03:35,860 I'm one of the leaders of the open web application security project, OWASP. It's actually a group 37 00:03:35,860 --> 00:03:40,960 of volunteers. It's a group of people in an open source community trying to work on some 38 00:03:40,960 --> 00:03:44,780 projects that raise the general level of awareness of web application security. It 39 00:03:44,780 --> 00:03:50,520 seems in the last few years, as an industry, we've just become aware that this is its own 40 00:03:50,520 --> 00:03:55,240 discipline. If you take a look at the website, and I was going to walk you through some of 41 00:03:55,240 --> 00:03:59,340 the projects we're working on, it's OWASP.org, O-W-A-S-P dot O-R-G. 42 00:03:59,960 --> 00:04:04,160 We're always looking for volunteers. I think there's probably a ton of talent in the audience. 43 00:04:04,220 --> 00:04:10,920 If you'd like to add your name to a project, and some of the projects are kind of a documentation 44 00:04:10,920 --> 00:04:17,240 side and software side, the documentation side is actually working on web testing and web 45 00:04:17,240 --> 00:04:22,040 building documents to actually provide guidelines. How do you build a secure web application? 46 00:04:22,280 --> 00:04:26,280 How do you actually test it afterwards? When we were all looking at the stuff on the internet 47 00:04:26,280 --> 00:04:29,940 already, there really wasn't anything out there besides possibly the open web application. 48 00:04:29,960 --> 00:04:34,700 We're looking at the open source testing methodology from ideahamster.org. Take a 49 00:04:34,700 --> 00:04:37,960 look at the site. If you think there are things on there that interest you, drop me an email. 50 00:04:38,080 --> 00:04:44,740 The email will be on the presentation shortly. Let's just get going. We might take a pause 51 00:04:44,740 --> 00:04:47,500 halfway through if we get connectivity, but I don't want to delay much more. 52 00:04:59,960 --> 00:05:03,740 Here's just an overview of what we're talking about. In general, we'll just go through some 53 00:05:03,740 --> 00:05:10,320 basics so we're all on the same page. Go through some fun exploitation examples, and then talk 54 00:05:10,320 --> 00:05:15,620 about what developers... Essentially, there's three audiences. When I say developers, I 55 00:05:15,620 --> 00:05:20,480 mean people who actually buy the software from the vendors, like BEA, WebLogic, or ATG's 56 00:05:20,480 --> 00:05:28,460 Dynamo, or Tomcat, etc. Then, what can users do to protect themselves? Essentially, not 57 00:05:28,460 --> 00:05:29,620 much, but we're going to get into that. 58 00:05:29,960 --> 00:05:34,860 What can vendors do? Particularly, the onus of these types of security vulnerabilities 59 00:05:34,860 --> 00:05:38,440 are mostly on the vendors, unfortunately, to fix before they actually get shipped to 60 00:05:38,440 --> 00:05:38,640 market. 61 00:05:41,400 --> 00:05:45,820 Essentially, let's not spend a lot of time on these basics, but you log into a web application. 62 00:05:46,180 --> 00:05:51,560 Web applications are typically protected by user accounts, varying levels. You might have 63 00:05:51,560 --> 00:05:58,920 a user access, editor access, administrative access. You log in, and thereafter, the website, 64 00:05:59,180 --> 00:05:59,940 web server, web application, web application, web application, web application, web application, 65 00:05:59,940 --> 00:06:03,240 web application knows who you are. You don't have to actually enter your username and password 66 00:06:03,240 --> 00:06:04,660 after each click. It's pretty straightforward. 67 00:06:05,740 --> 00:06:09,680 In the traditional sense, if someone wanted to, they had nothing to do on a weekend, they 68 00:06:09,680 --> 00:06:13,480 could just enter in a bunch of usernames and passwords, and that would be it. Great 69 00:06:13,480 --> 00:06:21,040 traditional brute force of a web application. What happens after you log in, since HTTP 70 00:06:21,040 --> 00:06:27,060 is a stateless protocol, developers essentially need a way to recognize that the person who 71 00:06:27,060 --> 00:06:29,920 is actually clicking the next click is you. They're not going to be able to access the 72 00:06:29,920 --> 00:06:33,160 website. It'd be really bad if you saw other people's banking information. It'd be even 73 00:06:33,160 --> 00:06:38,940 worse if they saw your information. In fact, I just said the same thing, but I said it 74 00:06:38,940 --> 00:06:41,940 like this. Thanks for the two people who got that joke. 75 00:06:43,260 --> 00:06:47,400 Essentially what happens is we generate a unique string, which is thereafter called 76 00:06:47,400 --> 00:06:51,480 the session ID. It's also called a token. I've heard people call it a nonce. Essentially, 77 00:06:51,520 --> 00:06:55,880 it's just a unique string that you know and the web application knows, so that essentially 78 00:06:55,880 --> 00:06:58,380 you can thereafter be recognized as that user. 79 00:06:58,380 --> 00:07:03,520 A decent example is you go into a bar, the bouncer asks you to see your ID and a credit 80 00:07:03,520 --> 00:07:09,100 card. You authenticate, so to speak. He stamps on your hand a unique number. That way when 81 00:07:09,100 --> 00:07:13,880 you go to the bar, you show the bartender your stamp. She looks at the number, references 82 00:07:13,880 --> 00:07:19,180 it, and she charges you a drink. That's great, but what if I either see your hand or if I 83 00:07:19,180 --> 00:07:27,000 can guess what number you have? Essentially, these are the two types of exploitation scenarios. 84 00:07:27,280 --> 00:07:28,100 Is this too loud? 85 00:07:28,380 --> 00:07:29,280 Too echoey? 86 00:07:29,720 --> 00:07:34,400 These are the two types of exploitation scenarios. Session replay is essentially seeing what 87 00:07:34,400 --> 00:07:39,340 someone is doing and mimicking them with their credentials so that some action they took 88 00:07:39,340 --> 00:07:47,980 occurs again. For instance, if I see Michael in the bar ordering a drink, say he orders 89 00:07:47,980 --> 00:07:52,800 a Bloody Mary, then what I can do is the typical example. I would walk over, mimic 90 00:07:52,800 --> 00:07:57,560 exactly everything he did with his credentials, and then order him 10 more drinks, and then 91 00:07:57,560 --> 00:07:58,080 he gets charged. 92 00:07:59,040 --> 00:08:03,160 Additionally, session hijacking would be if I dressed up like him, put the number on 93 00:08:03,160 --> 00:08:07,920 my hand again, either tied him up in the back or just, you know, I don't even need to. 94 00:08:08,300 --> 00:08:10,140 Oh, wow, that sounds real bad. 95 00:08:14,260 --> 00:08:15,980 Please don't file a harassment suit. 96 00:08:17,120 --> 00:08:21,540 And then I would actually order drinks for myself, charging him. So that gives you a 97 00:08:21,540 --> 00:08:26,520 decent example on what those two types of attacks are. So in theory, the username and 98 00:08:26,520 --> 00:08:28,360 password of a user gets exchanged. 99 00:08:28,360 --> 00:08:31,060 The user gets exchanged for this session ID, which is usually a long, hard-to-guess 100 00:08:31,060 --> 00:08:35,740 string. So in theory, you would think that the security levels and standards behind that 101 00:08:35,740 --> 00:08:39,960 long string should be the same as your username and password. Many companies make you go through, 102 00:08:40,020 --> 00:08:45,900 you know, many hoops of password selections because, you know, it doesn't satisfy this 103 00:08:45,900 --> 00:08:51,040 aspect or, you know, too many lowercase characters or, you know, it's based on a common dictionary 104 00:08:51,040 --> 00:08:55,920 word. Unfortunately, a lot of users and developers and vendors don't realize that that session 105 00:08:55,920 --> 00:08:58,340 ID is just as important to the authentication process. 106 00:08:58,340 --> 00:09:00,400 It's just as important to the authentication and state mechanism of the web application. 107 00:09:00,920 --> 00:09:08,140 So it should, in theory, be just as strong, but unfortunately, it isn't. So again, just 108 00:09:08,140 --> 00:09:15,180 to further emphasize that that session ID string should be just as secure as a username 109 00:09:15,180 --> 00:09:15,680 and password. 110 00:09:24,880 --> 00:09:28,220 Thanks for bearing with us, guys. I appreciate it. 111 00:09:28,340 --> 00:09:33,660 This is a fantastic turnout for first presentation of the day. I'm sure you guys all stayed in 112 00:09:33,660 --> 00:09:34,960 last night, took it easy. 113 00:09:36,200 --> 00:09:43,100 Nice to see you take this stuff seriously. That's great. We'll just give a quick overview 114 00:09:43,100 --> 00:09:48,240 on how session IDs are passed and the way that they're stored and set up. When we think 115 00:09:48,240 --> 00:09:52,380 of session IDs, we often think of cookies. That's not necessarily the only way that they 116 00:09:52,380 --> 00:09:57,120 can be passed. A session ID is just a variable, a variable that gets passed between the browser 117 00:09:57,120 --> 00:10:01,500 and the server, as David mentioned, as a means of maintaining state. So it can be 118 00:10:01,500 --> 00:10:06,840 stored anywhere that variables can be passed back and forth. That would, besides cookies, 119 00:10:07,000 --> 00:10:13,640 also include things such as directly embedded within the URL using the get method, or it 120 00:10:13,640 --> 00:10:19,280 could be a hidden field within an HTML form. And we'll show some of that and discuss why 121 00:10:19,280 --> 00:10:26,120 or why not that's a good idea. As far as how that session ID, that unique alphanumeric 122 00:10:27,120 --> 00:10:32,480 string is generated, that's generally transparent to the individual that's actually coding 123 00:10:32,480 --> 00:10:37,940 the web application. They don't need to specifically come up with an algorithm to generate it. 124 00:10:38,140 --> 00:10:43,860 That's generally done on their behalf by either the web server or the web application server. 125 00:10:44,480 --> 00:10:49,500 Those of you who may be familiar with ASP pages, for example, you know there's a session 126 00:10:49,500 --> 00:10:55,080 object and creating a session variable is as simple as calling that object, giving the 127 00:10:55,080 --> 00:10:57,100 variable a name, and everything is done in that way. 128 00:10:57,120 --> 00:11:01,800 And in the background, the IIS server does that for you. So that's, I mean, it's good 129 00:11:01,800 --> 00:11:07,240 and bad. It makes it a lot easier for the developer, but at the same time, you're somewhat 130 00:11:07,240 --> 00:11:13,420 at the mercy of that server that you're using. If they're not using a good algorithm to generate 131 00:11:13,420 --> 00:11:16,720 that session ID, you may or may not be stuck with that. 132 00:11:18,780 --> 00:11:26,680 Yeah, sure. Just basically two types of cookies, persistent cookies and session or non-persistent 133 00:11:26,680 --> 00:11:27,040 cookies. 134 00:11:27,120 --> 00:11:32,340 The persistent cookies basically refers to how long that cookie is stored. The non-persistent 135 00:11:32,340 --> 00:11:38,280 simply stays in main memory. Persistent is stored on your hard drive. The persistent 136 00:11:38,280 --> 00:11:42,240 cookies are those that you would generally use when you have that remember me option 137 00:11:42,240 --> 00:11:47,300 on a website. And again, there's security implications to that because, as we'll see, 138 00:11:47,360 --> 00:11:54,120 a session ID is effectively a form of authentication. So that needs to be protected. We'll get into 139 00:11:54,120 --> 00:11:55,660 specifics about that. 140 00:11:57,640 --> 00:12:05,580 This is just a diagram of what a basic cookie looks like, just so you understand the structure 141 00:12:05,580 --> 00:12:10,640 of it. I've got those fields numbered one through seven, so I'll refer to them that 142 00:12:10,640 --> 00:12:15,140 way. First field, that's the name of the web server that actually issued that cookie 143 00:12:15,140 --> 00:12:20,500 and has the ability to receive that cookie. Number two is a Boolean variable, true-false. 144 00:12:20,640 --> 00:12:26,540 It just determines if other servers on that same domain can also receive that cookie. 145 00:12:26,540 --> 00:12:32,840 Number three, the path to specific pages on the web server that can receive the cookie. 146 00:12:33,020 --> 00:12:38,380 So it gives you a greater level of granularity as far as where that cookie information will 147 00:12:38,380 --> 00:12:38,920 be sent to. 148 00:12:39,520 --> 00:12:46,920 Four, another Boolean variable. That determines if you need a secure connection, an SSL connection 149 00:12:46,920 --> 00:12:50,940 before the cookie will be passed. And we'll refer back to that a few times because that's 150 00:12:50,940 --> 00:12:51,580 an important one. 151 00:12:51,860 --> 00:12:56,520 Number five, that's the expiry. I mentioned persistent versus non-persistent. 152 00:12:56,520 --> 00:13:03,080 Session or non-persistent cookies, that date there, that expiry date is in Unix time, 153 00:13:03,240 --> 00:13:08,980 so it's the number of seconds since January 1970, January 1, 1970. And if you don't give 154 00:13:08,980 --> 00:13:14,380 it an expiry date by default, it's going to be a non-persistent cookie and be deleted 155 00:13:14,380 --> 00:13:18,800 when you close the web browser. Six and seven, that's the actual payload of that cookie or 156 00:13:18,800 --> 00:13:23,940 the data in a name value format. So in this case, the name of the session ID is Apache, 157 00:13:24,200 --> 00:13:25,520 that's how you would refer to it. 158 00:13:25,520 --> 00:13:27,620 And seven is the session ID itself. 159 00:13:29,640 --> 00:13:34,860 These are just some examples of various sites. You'll see that they all follow that format. 160 00:13:35,620 --> 00:13:40,420 Star Wars, they have the Wookie Cookie, and the other ones are a little less creative 161 00:13:40,420 --> 00:13:40,680 than that. 162 00:13:42,580 --> 00:13:48,040 I mentioned there's various places that you can store that session ID. We discussed cookies. 163 00:13:48,240 --> 00:13:53,380 Another one is directly within the URL itself. You'll see at the end of each of these URLs, 164 00:13:53,600 --> 00:13:55,500 that string is stored. 165 00:13:55,520 --> 00:13:56,540 This is basically a session ID. 166 00:13:57,320 --> 00:14:02,620 And obviously that's not a very secure way of sending it, because if somebody gets a hold of that URL, 167 00:14:03,260 --> 00:14:08,580 effectively your authentication is embedded into the URL. Somebody's not going to need to log in 168 00:14:08,580 --> 00:14:12,660 with a username and password, so not a secure way of doing it. 169 00:14:12,760 --> 00:14:17,020 But there are situations where you may want to do that. You see greeting card sites often use this 170 00:14:17,020 --> 00:14:23,100 basically so that a user can go to a unique greeting card. And we'll walk through those examples as well. 171 00:14:25,860 --> 00:14:27,900 Let's just talk about that later. I'm not sure we can. 172 00:14:29,060 --> 00:14:36,300 Then the third thing that I mentioned as far as how session IDs can be passed would be within hidden fields 173 00:14:36,300 --> 00:14:37,880 within an HTML form. 174 00:14:38,780 --> 00:14:43,120 Again, not a very secure way of doing it, but there may be situations where you want to do that. 175 00:14:43,260 --> 00:14:50,420 I think people often mistakenly believe that it's more secure than it is because an end user can't visibly see it 176 00:14:50,420 --> 00:14:53,340 the way they can see a session ID embedded within a URL. 177 00:14:53,600 --> 00:14:55,500 But as you know, there's nothing wrong with that. 178 00:14:55,500 --> 00:14:58,080 There's nothing to seeing this. You just have to view the source code of the web page. 179 00:15:00,460 --> 00:15:09,280 I just want to put this entire talk sort of in perspective in that we're talking about one very specific 180 00:15:09,280 --> 00:15:13,760 technical vulnerability on web application security. 181 00:15:15,080 --> 00:15:18,840 But with anything in security, you need to look at the big picture. 182 00:15:19,060 --> 00:15:24,660 I mean, you could have a fantastic algorithm. It gives you a very unique pseudo-random difficulty, 183 00:15:25,500 --> 00:15:26,960 and it's impossible to guess session ID. 184 00:15:27,380 --> 00:15:33,500 But if other aspects of security that interact with that are very poor, it doesn't do you any good. 185 00:15:33,700 --> 00:15:39,260 I mean, let's say your policy called for that cookie to be a persistent one, so it's stored on the hard drive. 186 00:15:39,560 --> 00:15:42,240 Who cares if it's a hard-to-guess algorithm? 187 00:15:42,380 --> 00:15:47,200 If somebody can grab that cookie and there's poor physical and logical security around the server, 188 00:15:47,360 --> 00:15:48,140 it doesn't mean anything. 189 00:15:48,380 --> 00:15:54,280 So just keep in perspective that this is only one aspect of web application security. 190 00:15:56,900 --> 00:16:02,120 We'll walk through an example. We won't be able to go to the web page, but on this one, 191 00:16:02,900 --> 00:16:12,740 I mentioned that greeting card sites are a good example of a site that embeds a session ID directly within the URL. 192 00:16:13,720 --> 00:16:17,520 And you've all walked through this. You know how it operates. 193 00:16:17,860 --> 00:16:21,160 You want to send a greeting card to somebody. You log into their site. 194 00:16:21,320 --> 00:16:25,200 You make the greeting card, and they receive an email, something like this, that says, 195 00:16:25,500 --> 00:16:27,600 click on this URL to see your greeting card. 196 00:16:27,900 --> 00:16:31,240 And at the end of it, it'll have the session ID right in there. 197 00:16:32,260 --> 00:16:37,700 Now, when you first look at it, the session ID is that last 16 characters there. 198 00:16:37,820 --> 00:16:43,860 I mean, it looks random. If you only look at one, it's just a long, hard-to-guess string. 199 00:16:44,020 --> 00:16:48,700 So if you wanted to brute force that, you're going to have to go through 10 to the power of 16 combinations, 200 00:16:48,980 --> 00:16:50,820 which will take a very long time to do. 201 00:16:51,320 --> 00:16:55,400 But the only way to see if something is truly random is to look at more than one. 202 00:16:55,500 --> 00:17:00,500 And see if there's anything in common between those URLs, those session IDs. 203 00:17:00,780 --> 00:17:05,880 So in this case, what we did is just kept regenerating that greeting card over and over again, 204 00:17:06,020 --> 00:17:09,880 just technically, literally by hitting the back button and doing it over. 205 00:17:11,200 --> 00:17:17,200 And when we started to look at those variables, we noticed that they weren't all that random. 206 00:17:17,300 --> 00:17:22,520 The first three characters, that 83, seems to be some kind of a constant, never changes. 207 00:17:23,040 --> 00:17:25,060 And then the next, I don't know, 208 00:17:25,500 --> 00:17:28,940 10 or 8 characters, that actually turns out to be the date. 209 00:17:29,140 --> 00:17:33,820 And that's an important thing that you want to be careful when you're generating a session ID, 210 00:17:34,020 --> 00:17:37,640 that it's not using something that is known to the user. 211 00:17:37,820 --> 00:17:41,940 And obviously, if the user is creating that greeting card, they know what time they created it, 212 00:17:42,020 --> 00:17:43,640 so it's easy for them to figure out. 213 00:17:43,820 --> 00:17:50,800 In this case, we did this on July 25th at 12.21, and you can see that in the 7.25, 12.21. 214 00:17:51,380 --> 00:17:54,820 And so what we end up with is actually only four or five, 215 00:17:55,780 --> 00:18:03,560 digits that are actually truly the random, or supposedly random portion of that session ID. 216 00:18:03,980 --> 00:18:07,940 And in this case, they're actually sequential, so they're not even that random at all. 217 00:18:08,020 --> 00:18:12,900 So we've gone from having to brute force something that was 10 to the power of 16, 218 00:18:13,120 --> 00:18:18,940 down to something that's about 10,000, 100,000 digits, which is much more reasonable. 219 00:18:24,640 --> 00:18:29,480 We'll save the demo on this for a second, because we'll either, if we have internet access, we'll try it that way. 220 00:18:29,560 --> 00:18:31,100 If not, we'll switch over to the other computer. 221 00:18:31,560 --> 00:18:36,240 But basically, if you want to brute force that, you've got 10,000 combinations. 222 00:18:36,500 --> 00:18:40,680 One way is obviously get a web browser, start typing it in manually. 223 00:18:41,700 --> 00:18:44,880 And if you've got nothing better to do, that might be a good way to do it. 224 00:18:45,000 --> 00:18:48,100 But an easier way is to automate that. 225 00:18:48,180 --> 00:18:48,920 You might want to write a password. 226 00:18:48,940 --> 00:18:49,880 You might want to write a Perl script or something. 227 00:18:50,160 --> 00:18:57,140 In this case, we actually wrote a tool that will allow you to brute force session IDs in various scenarios, 228 00:18:57,300 --> 00:18:58,920 in cookies, within URLs. 229 00:19:00,780 --> 00:19:01,960 That's the tool right there. 230 00:19:02,100 --> 00:19:03,920 We'll demo it on the other box. 231 00:19:04,720 --> 00:19:07,640 But actually, David, do you want to just talk about the sections there? 232 00:19:08,540 --> 00:19:16,020 So essentially, when we were looking at a lot of web applications in our audits in past lives, 233 00:19:17,240 --> 00:19:22,600 really the only decent way to tell if a session ID is predictable is by looking at it. 234 00:19:22,640 --> 00:19:25,740 It would be nice if there were some neat AI program or neural net. 235 00:19:25,860 --> 00:19:28,600 You could just run it through, and it would have a yes or no button. 236 00:19:28,680 --> 00:19:29,440 And yes, predictable. 237 00:19:29,600 --> 00:19:30,320 No, not predictable. 238 00:19:31,160 --> 00:19:36,700 But unfortunately, the easiest way to figure it out is just by looking at a bunch of session IDs generated in sequence, 239 00:19:37,380 --> 00:19:38,560 very close to one another. 240 00:19:39,360 --> 00:19:43,120 So essentially, this is a tool that has three aspects to it, three mini tools. 241 00:19:43,340 --> 00:19:44,420 I'm not sure if you can see it. 242 00:19:44,520 --> 00:19:46,000 But this should be on the screen. 243 00:19:46,000 --> 00:19:46,620 Defcon CD. 244 00:19:46,860 --> 00:19:47,880 It's an open source tool. 245 00:19:48,060 --> 00:19:52,460 You can look at the spaghetti visual basic code that I put together. 246 00:19:53,140 --> 00:19:59,740 Essentially, the top part allows you to sample those session IDs that are generated just from the website. 247 00:20:00,000 --> 00:20:00,960 This is version one. 248 00:20:01,360 --> 00:20:05,840 Version two would be nice if you could actually generate the session IDs after you log into that website. 249 00:20:06,060 --> 00:20:10,320 So you'd have to actually include the post information in that as well with the credentials. 250 00:20:10,800 --> 00:20:15,560 So essentially, you can just, if we have time later, if we get network connection, 251 00:20:15,660 --> 00:20:15,980 I'll show you. 252 00:20:16,000 --> 00:20:19,040 Using redhat.com is the example. 253 00:20:19,140 --> 00:20:26,700 They actually use the IP address, your IP address, to append to some bit of entropy, some random numbers. 254 00:20:27,220 --> 00:20:30,380 They don't use that necessarily for authentication, but it's just a decent example. 255 00:20:30,840 --> 00:20:37,160 This middle part of the tool is basic authentication brute forcing, which really isn't within the scope of our presentation. 256 00:20:37,440 --> 00:20:41,540 But we had all the same hooks in there to do a lot of this anyway, so we might as well. 257 00:20:41,640 --> 00:20:42,600 It was kind of an added bonus. 258 00:20:43,380 --> 00:20:45,980 The last part is where the real meat of this brute forcing is. 259 00:20:45,980 --> 00:20:51,340 I'm just going to put these two windows sort of side by side, almost as if we're running it in real time. 260 00:20:51,780 --> 00:20:58,040 If you switch your eyes really quickly, you may actually see some movement, but I'm not sure if that's from what you were doing last night. 261 00:20:58,960 --> 00:21:05,600 Essentially, what you can see is we pasted a really long URL into the URL field. 262 00:21:06,340 --> 00:21:14,520 The scenario is essentially if I know that Michael sent his girlfriend a really scintillating greeting card, and I can figure out when the time was, 263 00:21:14,520 --> 00:21:16,200 at least I have a range to work with. 264 00:21:18,560 --> 00:21:22,580 What we can do is we'll show you another example. 265 00:21:23,360 --> 00:21:25,500 We have a standalone box with a web server. 266 00:21:25,620 --> 00:21:27,020 At least you can see some of the cookie generation. 267 00:21:28,600 --> 00:21:36,900 But then you paste that URL in and use a combination of regular expressions to tell the tool which characters you want to grind through. 268 00:21:37,580 --> 00:21:39,360 I'll just give you a brief demo on this computer. 269 00:21:55,440 --> 00:21:58,300 So this, we'll just run it locally off of my machine. 270 00:21:58,420 --> 00:22:01,320 This, I apologize, I'm totally not a redneck. 271 00:22:01,480 --> 00:22:05,320 This was an application from a school project. 272 00:22:05,460 --> 00:22:09,360 And this morning as we were in the hotel room, we were like, we need something that makes session IDs. 273 00:22:09,540 --> 00:22:10,680 I was like, cool, I got it. 274 00:22:10,720 --> 00:22:11,680 It's left over from school. 275 00:22:12,080 --> 00:22:14,500 But it just didn't work. 276 00:22:14,520 --> 00:22:15,520 Just ignore it, all right? 277 00:22:15,640 --> 00:22:17,520 Pretend it's like a Linux site or something. 278 00:22:22,200 --> 00:22:23,780 Michael, there's a fantasy NASCAR. 279 00:22:23,860 --> 00:22:24,660 Is that an oxymoron? 280 00:22:28,660 --> 00:22:29,600 Sorry, wrong tool. 281 00:22:30,100 --> 00:22:32,300 So we have IIS running on this server. 282 00:22:32,460 --> 00:22:34,660 It's standalone, so stop getting your laptops out. 283 00:22:35,560 --> 00:22:38,220 What we're doing is we're just, you want to just slide through the window? 284 00:22:38,460 --> 00:22:38,980 Yeah, sure. 285 00:22:40,080 --> 00:22:44,120 So all we were doing is we know that the website uses session IDs. 286 00:22:45,020 --> 00:22:47,420 And so we want to see that randomness. 287 00:22:47,420 --> 00:22:49,320 So we want to generate a succession of them. 288 00:22:49,360 --> 00:22:53,720 So with that first part, we're able to just put the URL directly into there. 289 00:22:54,420 --> 00:22:58,240 Say we want how many cookies, in this case 10, and just get the cookies. 290 00:22:58,320 --> 00:23:00,160 And then it's spit out in the bottom. 291 00:23:00,320 --> 00:23:02,020 And in this case, they are fairly random. 292 00:23:02,200 --> 00:23:03,600 IIS does a reasonable job. 293 00:23:04,920 --> 00:23:12,460 But that's the first step of allowing you to look at it and then decide, is there some non-randomness that I can brute force? 294 00:23:12,460 --> 00:23:16,560 Actually, why don't you walk through the regular expression, please? 295 00:23:16,740 --> 00:23:17,060 Sure. 296 00:23:28,540 --> 00:23:30,640 So we'll see the URL and cookie field. 297 00:23:31,660 --> 00:23:33,080 You can actually brute force either. 298 00:23:33,220 --> 00:23:36,760 If you wanted to just brute force the URL, we put the regular expressions in there. 299 00:23:36,800 --> 00:23:39,640 If you want the URL constant, you paste the cookie in. 300 00:23:39,680 --> 00:23:42,120 And essentially, it takes care of all the formatting for you. 301 00:23:42,460 --> 00:23:47,060 You just have to have a basic variable equals value format here. 302 00:23:47,260 --> 00:24:01,840 So we have ASP session ID, blah, blah, blah, blah, blah, equals, and then this really long string. 303 00:24:02,520 --> 00:24:04,900 So let's try and just brute force the last digit. 304 00:24:05,560 --> 00:24:09,080 We put the starting digit or the starting character in there, which is going to be A. 305 00:24:09,240 --> 00:24:11,040 I don't know if you can see this on the screen. 306 00:24:11,680 --> 00:24:12,040 Okay. 307 00:24:12,460 --> 00:24:13,180 I'll just walk you through it. 308 00:24:13,180 --> 00:24:18,740 You put the character there, and essentially, if you just click on the tab, you can test it out when you try it out on the CD. 309 00:24:19,080 --> 00:24:20,240 Just click the info tab. 310 00:24:20,320 --> 00:24:24,080 It's kind of obscure, but once you actually look at it, you'll understand what the ranges mean. 311 00:24:24,460 --> 00:24:29,460 You can do 0 through 9, little a through little z, big A through big Z, and then the combination of those together. 312 00:24:30,800 --> 00:24:33,800 So essentially, what you see here is us grinding through each one. 313 00:24:34,220 --> 00:24:35,960 You'll see two radio buttons at the bottom. 314 00:24:36,660 --> 00:24:41,340 The first one is just, I'm going to click on it here, just look for a non-404 header, 315 00:24:41,340 --> 00:24:48,960 which means you're grinding through a URL with a possible cookie in there, and you're getting a page back. 316 00:24:49,940 --> 00:24:56,360 Assuming that the web server hasn't customized their error message, you may get a 200 success. 317 00:24:56,680 --> 00:24:57,500 This is the web page. 318 00:24:57,640 --> 00:24:59,220 Congratulations, you've authenticated. 319 00:24:59,760 --> 00:25:05,000 Some websites have custom error messages, like these aren't the web pages you're looking for. 320 00:25:05,880 --> 00:25:07,740 Go away, nosy, et cetera. 321 00:25:08,000 --> 00:25:11,200 So what you can do is actually click on this radio button and tell it, 322 00:25:11,200 --> 00:25:16,500 what a successful web brute force would look like, what string in it it would have, 323 00:25:16,640 --> 00:25:19,720 such as welcome to your account, et cetera. 324 00:25:20,720 --> 00:25:22,280 So that's the tool in a nutshell. 325 00:25:22,520 --> 00:25:23,980 Why don't you do mini-browser as well? 326 00:25:24,200 --> 00:25:24,540 Yeah. 327 00:25:26,000 --> 00:25:29,360 And this is just another tool, mini-browser, that we like to use. 328 00:25:31,440 --> 00:25:37,280 Essentially, it's just a browser with different fields that you can kind of watch the web transaction take place. 329 00:25:38,140 --> 00:25:41,020 This is Michael's NASCAR login. 330 00:25:41,020 --> 00:25:45,120 If you look at the log, you'll see the cookie actually getting passed back and forth. 331 00:25:45,560 --> 00:25:50,860 If you actually click on cookies, you can see them all listed out pretty nicely. 332 00:25:51,000 --> 00:25:52,640 We're going to show you another example of this later. 333 00:26:06,420 --> 00:26:07,220 I'm sorry? 334 00:26:08,440 --> 00:26:08,840 . 335 00:26:10,580 --> 00:26:12,040 It's versioned Visual Basic. 336 00:26:12,920 --> 00:26:16,580 It's open source, so you can actually see the code for yourself and improve it. 337 00:26:16,880 --> 00:26:18,840 Send it back to me, and I'll take credit for it. 338 00:26:19,720 --> 00:26:20,640 I'm just joking. 339 00:26:20,640 --> 00:26:25,200 If you want to actually help out with it, I'd be glad to post a new version with any improvements. 340 00:26:25,620 --> 00:26:27,120 And there are some improvements I have in mind. 341 00:26:31,220 --> 00:26:32,380 Let's actually switch sides again. 342 00:26:34,040 --> 00:26:34,400 Sorry. 343 00:26:37,800 --> 00:26:39,460 So, okay, why is this bad? 344 00:26:39,640 --> 00:26:42,500 Obviously it's bad because you can actually get into a user's account 345 00:26:42,500 --> 00:26:43,860 without their username and password. 346 00:26:44,600 --> 00:26:46,560 It's really easy to exploit, as you saw. 347 00:26:46,600 --> 00:26:49,240 Now you all have the tool, it's even easier to exploit. 348 00:26:50,720 --> 00:26:53,960 Unlike typical login scenarios like on an operating system 349 00:26:53,960 --> 00:26:55,580 or a lot of other web applications, 350 00:26:55,980 --> 00:26:59,200 if you have five failed logins, sometimes the account is locked out. 351 00:26:59,400 --> 00:27:03,580 But brute-forcing session IDs, it's really hard to detect a fail. 352 00:27:03,580 --> 00:27:07,080 There's no necessarily a failed login scenario 353 00:27:07,080 --> 00:27:11,180 in brute-forcing a session ID or getting a bad session ID. 354 00:27:11,940 --> 00:27:14,360 Additionally, there aren't a lot of intrusion detection systems 355 00:27:14,360 --> 00:27:15,980 that detect these types of attacks. 356 00:27:16,660 --> 00:27:20,540 I would say none, but I have a feeling that some are actually coming out 357 00:27:20,540 --> 00:27:25,040 that would start to detect these types of exploits. 358 00:27:26,400 --> 00:27:29,100 Additionally, really the only way you'll know that someone is trying to do this 359 00:27:29,100 --> 00:27:31,960 is by looking at your log data, which I don't think a lot of us do. 360 00:27:32,880 --> 00:27:33,560 Essentially, you would... 361 00:27:33,560 --> 00:27:34,640 You'd either see a lot of error messages, 362 00:27:35,320 --> 00:27:40,240 or you'd see a lot of error messages that are followed by the successful login 363 00:27:40,240 --> 00:27:42,740 on your access, your successful access log. 364 00:27:43,740 --> 00:27:46,740 I'm just going to mention that, this last point, 365 00:27:47,400 --> 00:27:50,100 there's a myth that I'm sure a lot of you run up against, 366 00:27:50,180 --> 00:27:53,720 that SSL secures all, and obviously it doesn't. 367 00:27:53,720 --> 00:27:56,800 What I wanted to say is SSL server-side doesn't really do much 368 00:27:56,800 --> 00:27:58,460 to protect you against these types of attacks. 369 00:27:59,000 --> 00:28:03,540 When I say server-side, which really describes most of the SSL certificates, 370 00:28:03,560 --> 00:28:04,780 there's a lot of certificate scenarios out there. 371 00:28:04,880 --> 00:28:07,500 The web server has a certificate, the client doesn't. 372 00:28:07,760 --> 00:28:11,880 In another PKI sense, if you wanted to actually issue certificates to your clients, 373 00:28:12,000 --> 00:28:13,620 authenticate them in that way as well, 374 00:28:13,840 --> 00:28:16,260 that might actually protect against a lot of these attacks 375 00:28:16,260 --> 00:28:19,180 because it would redirect you to an authentication screen. 376 00:28:20,000 --> 00:28:23,120 Unfortunately, this really isn't feasible in a business sense. 377 00:28:23,280 --> 00:28:26,140 If you're in a very small environment, you could do this, or an intranet. 378 00:28:28,020 --> 00:28:33,200 I just wanted to point out kind of a news hit that occurred for this type of attack. 379 00:28:34,480 --> 00:28:36,900 Essentially, it's interesting that a few years ago, 380 00:28:37,040 --> 00:28:39,200 web application security was a dot on the radar. 381 00:28:39,380 --> 00:28:42,500 Now you see exploit scripting hole exposes hotmail, 382 00:28:42,600 --> 00:28:43,940 and you see this on CNN.com. 383 00:28:44,700 --> 00:28:48,000 It's good in a way because users and the internet community 384 00:28:48,000 --> 00:28:51,040 are becoming aware that these types of attacks are bad. 385 00:28:51,220 --> 00:28:55,200 Unfortunately, this was based on a bug track posting by, I think, Mark Slimko. 386 00:28:55,640 --> 00:28:58,880 He said, hey, I'm a Verizon wireless customer, 387 00:28:58,980 --> 00:29:01,320 and when I logged in, I got this URL. 388 00:29:02,180 --> 00:29:03,380 I'm not sure if you can see it. 389 00:29:03,560 --> 00:29:03,680 It's on the screen. 390 00:29:04,240 --> 00:29:06,920 There's a portion in red, and that's an ID. 391 00:29:07,100 --> 00:29:08,220 He got redirected to this URL. 392 00:29:08,520 --> 00:29:12,360 In fact, all Verizon wireless customers were redirected to a URL similar to this. 393 00:29:12,560 --> 00:29:14,440 The only difference was that number was different. 394 00:29:14,580 --> 00:29:18,340 Well, it seems that by incrementing or decrementing that number, 395 00:29:18,440 --> 00:29:24,060 you can see other users' information, billing information, credit card information. 396 00:29:24,360 --> 00:29:24,780 Oops. 397 00:29:26,780 --> 00:29:31,200 It's good in a way because I'm sure Verizon fixed it very quickly 398 00:29:31,200 --> 00:29:32,400 once this news item came out. 399 00:29:32,500 --> 00:29:33,540 It's bad because who knows? 400 00:29:33,560 --> 00:29:34,860 Who knows how many other customers were affected? 401 00:29:35,980 --> 00:29:37,320 I'm not sure if you can see the screen. 402 00:29:37,580 --> 00:29:39,100 This is securitypimps.com. 403 00:29:40,100 --> 00:29:41,140 It's an actual site. 404 00:29:41,920 --> 00:29:43,200 It's actually my site. 405 00:29:43,380 --> 00:29:46,500 I'm not really doing much with it except just playing around with Flash 406 00:29:46,500 --> 00:29:48,600 and maybe forming a hacker group someday. 407 00:29:48,800 --> 00:29:49,320 I'm not sure. 408 00:29:49,360 --> 00:29:52,340 We'd have to be based outside of Nevada just because of the name. 409 00:29:52,360 --> 00:29:53,780 We're outside of Las Vegas in Nevada. 410 00:29:54,440 --> 00:29:55,680 That joke really bombed. 411 00:29:57,540 --> 00:30:00,220 Essentially, I host this at register.com. 412 00:30:00,780 --> 00:30:03,140 Register.com lets you, as a registrar, 413 00:30:03,560 --> 00:30:07,800 they provide you a web access portal, 414 00:30:07,980 --> 00:30:10,340 a web application that you can manage your domain in. 415 00:30:10,440 --> 00:30:12,320 It's the domain manager, so you log in, 416 00:30:12,760 --> 00:30:14,120 change any DNS settings. 417 00:30:14,900 --> 00:30:18,800 I was trying to change the setting one day when I forgot my password. 418 00:30:18,960 --> 00:30:21,600 Essentially, what you do in the forgotten password scheme 419 00:30:22,060 --> 00:30:23,460 is you put in the domain name, 420 00:30:23,560 --> 00:30:26,920 and an email gets sent to the administrative contact of that domain. 421 00:30:27,180 --> 00:30:30,200 No matter who you are, you can cause this to occur. 422 00:30:30,320 --> 00:30:31,880 You can cause the forgotten password to occur. 423 00:30:33,580 --> 00:30:37,040 The email got sent to pimpdaddy at securitypimps.com. 424 00:30:37,160 --> 00:30:37,520 That's me. 425 00:30:37,620 --> 00:30:39,980 I'm not going to make a joke about it since the first one bombed. 426 00:30:41,680 --> 00:30:42,680 We're running a long time. 427 00:30:43,940 --> 00:30:45,580 Essentially, you get this long URL. 428 00:30:46,840 --> 00:30:49,620 If in a three-day time period someone visits that URL, 429 00:30:50,180 --> 00:30:52,000 you're not even asked for your old password. 430 00:30:52,140 --> 00:30:53,020 You can change the password. 431 00:30:53,920 --> 00:30:54,860 Think of it this way. 432 00:30:54,940 --> 00:30:55,940 If I know your domain, 433 00:30:56,440 --> 00:30:58,740 or if I know a domain that's hosted on register.com, 434 00:30:59,200 --> 00:31:02,960 I can plug in the domain name and figure out 435 00:31:02,960 --> 00:31:04,740 that, well, let me go back. 436 00:31:04,820 --> 00:31:06,420 By pressing back and submit a few times, 437 00:31:06,500 --> 00:31:08,300 I got these URLs in my email as well. 438 00:31:09,980 --> 00:31:12,300 Obviously, those session IDs after, 439 00:31:12,560 --> 00:31:14,040 can you see the numbers? 440 00:31:16,880 --> 00:31:17,320 Sure. 441 00:31:17,440 --> 00:31:18,540 If you can't, essentially, 442 00:31:19,300 --> 00:31:22,040 we whittled down what was a 12-digit session ID 443 00:31:22,040 --> 00:31:24,100 to what was now five. 444 00:31:25,160 --> 00:31:27,940 If you had a domain on register.com 445 00:31:27,940 --> 00:31:28,840 and you knew someone else, 446 00:31:28,840 --> 00:31:30,280 you could submit them at the same time. 447 00:31:30,580 --> 00:31:32,580 Essentially, figure out what that was in proximity. 448 00:31:32,960 --> 00:31:34,620 Probably shave that time off. 449 00:31:35,000 --> 00:31:36,500 I think I figured it out. 450 00:31:36,620 --> 00:31:39,140 If you wanted to submit it 451 00:31:39,140 --> 00:31:40,820 when someone goes home from work around six 452 00:31:40,820 --> 00:31:42,780 and try and brute force it 453 00:31:42,780 --> 00:31:44,980 when someone actually shows up again around eight or nine, 454 00:31:45,640 --> 00:31:48,340 you could probably do that 50% of the time 455 00:31:48,340 --> 00:31:50,780 if you were doing maybe one request a second. 456 00:31:54,240 --> 00:31:56,660 We won't go through these examples. 457 00:31:57,080 --> 00:31:58,700 One is DFilm, 458 00:31:59,340 --> 00:32:01,060 and one is Sendomatic. 459 00:32:01,160 --> 00:32:02,780 I'll just explain really quick. 460 00:32:03,680 --> 00:32:05,640 That's a situation where a session ID 461 00:32:05,640 --> 00:32:07,600 was passed directly within the URL, 462 00:32:07,760 --> 00:32:09,180 and there was no randomness. 463 00:32:09,260 --> 00:32:11,280 They were just purely incrementing that number. 464 00:32:12,180 --> 00:32:14,880 DFilm is where you make your own little personal flash movie 465 00:32:14,880 --> 00:32:15,960 and send it to somebody. 466 00:32:16,300 --> 00:32:20,300 They weren't at all using that session ID for security. 467 00:32:20,500 --> 00:32:25,520 They were just using it to allow you to see a unique video or whatever. 468 00:32:27,060 --> 00:32:28,900 The important thing to note there 469 00:32:28,900 --> 00:32:31,920 is that they may not have been planning security in there 470 00:32:31,920 --> 00:32:32,940 because you can just... 471 00:32:32,960 --> 00:32:34,380 increment that session ID. 472 00:32:34,500 --> 00:32:37,240 You'll see somebody else's video, 473 00:32:37,360 --> 00:32:39,540 or Sendomatic is one of those sites 474 00:32:39,540 --> 00:32:41,940 where you set up a party and you send invites to people. 475 00:32:42,060 --> 00:32:44,160 If you increment it, you can see other people's parties 476 00:32:44,160 --> 00:32:46,040 and invite your friends to their party 477 00:32:46,040 --> 00:32:46,920 and all that kind of stuff. 478 00:32:48,320 --> 00:32:50,860 Even though they may not have used it, 479 00:32:51,380 --> 00:32:53,680 they may have not planned security in there, 480 00:32:53,740 --> 00:32:55,980 their users may not have that same perception. 481 00:32:56,220 --> 00:32:57,920 They may think that they are the only people 482 00:32:57,920 --> 00:33:01,900 who can see their greetings and their invitations. 483 00:33:01,900 --> 00:33:06,160 So never design something to your security specifications. 484 00:33:06,680 --> 00:33:09,120 You have to design it to your end-user specifications. 485 00:33:09,400 --> 00:33:11,200 If they think there's security in there, 486 00:33:11,280 --> 00:33:12,120 find out there's not. 487 00:33:12,340 --> 00:33:14,180 That's not a good way to keep your clients around. 488 00:33:17,700 --> 00:33:18,880 We have about 10 minutes. 489 00:33:19,320 --> 00:33:21,660 We're probably going to run 5 minutes late, just to let you know. 490 00:33:21,720 --> 00:33:24,040 I'm a big believer in doing things on time, 491 00:33:24,120 --> 00:33:26,140 especially having brief presentations 492 00:33:26,140 --> 00:33:28,680 and agreeing to end when you're going to end. 493 00:33:28,760 --> 00:33:31,120 But we started a little late, so just to let you know. 494 00:33:33,180 --> 00:33:35,500 FreeServers.com is where I host security pimps. 495 00:33:35,880 --> 00:33:37,280 Again, same sort of scenario. 496 00:33:37,460 --> 00:33:39,220 You have a web application, you log in, 497 00:33:39,340 --> 00:33:41,880 and in this case, I actually can change the content. 498 00:33:42,180 --> 00:33:44,720 FreeServers is a free web hosting service. 499 00:33:45,060 --> 00:33:46,800 Essentially, you can pick from a bunch of domains. 500 00:33:48,060 --> 00:33:52,660 This one, I just picked testing123.itgo.com. 501 00:33:53,500 --> 00:33:56,560 So essentially, you log in, username and password. 502 00:33:56,660 --> 00:33:58,600 You go into your login screen. 503 00:33:58,920 --> 00:34:00,280 You can change content. 504 00:34:00,500 --> 00:34:01,880 You can upload content. 505 00:34:01,900 --> 00:34:02,580 You can delete content. 506 00:34:03,980 --> 00:34:06,620 So using MiniBrowser, just as an example. 507 00:34:06,780 --> 00:34:09,400 We can't do this online, but we log in. 508 00:34:09,480 --> 00:34:11,840 You can see that our cookie is actually... 509 00:34:11,840 --> 00:34:13,680 Go to the next screen where you can actually see it. 510 00:34:14,020 --> 00:34:15,860 All right, so it looks like a fairly random cookie. 511 00:34:16,040 --> 00:34:18,920 But every time I logged in, I actually got the same cookie. 512 00:34:19,360 --> 00:34:24,420 So a lot of developers make the mistake of obfuscating. 513 00:34:25,300 --> 00:34:26,420 Say that in the morning. 514 00:34:27,500 --> 00:34:31,120 The session ID with just a very basic encoding mechanism, 515 00:34:31,120 --> 00:34:32,660 like base64 or hex. 516 00:34:32,900 --> 00:34:33,720 And they think, 517 00:34:33,720 --> 00:34:35,600 haha, no one will ever figure that out. 518 00:34:35,880 --> 00:34:39,360 Well, just for kicks, I put it through a base64 decoder. 519 00:34:40,880 --> 00:34:42,760 And SecurityStats actually has a decent one. 520 00:34:42,920 --> 00:34:45,420 If we were to go to this link and paste it, 521 00:34:45,520 --> 00:34:49,760 you would see that that string decoded, base64 decoded, 522 00:34:49,760 --> 00:34:52,880 is my domain name, colon, and then my password. 523 00:34:53,080 --> 00:34:53,980 Just to let you know, 524 00:34:54,040 --> 00:34:55,420 everyone who's firing up your browser, 525 00:34:55,520 --> 00:34:56,660 change the password already. 526 00:34:56,800 --> 00:34:58,040 So don't try and log in. 527 00:34:59,060 --> 00:34:59,860 So essentially, 528 00:34:59,860 --> 00:35:03,420 this is a case where I don't necessarily need to brute force it 529 00:35:03,420 --> 00:35:05,200 in the traditional sense, character by character, 530 00:35:05,380 --> 00:35:06,880 but I can use a dictionary attack. 531 00:35:07,220 --> 00:35:08,000 So what I did, 532 00:35:08,760 --> 00:35:12,100 wrote a Perl script, which is included in a paper on your CD. 533 00:35:12,480 --> 00:35:13,900 All these Perl scripts are included. 534 00:35:14,500 --> 00:35:15,260 Wrote a paper. 535 00:35:15,340 --> 00:35:16,740 It basically runs through a dictionary attack. 536 00:35:17,060 --> 00:35:19,860 Takes the password words, 537 00:35:20,700 --> 00:35:21,600 appends it to the domain, 538 00:35:21,820 --> 00:35:22,960 runs base64 on it, 539 00:35:23,000 --> 00:35:24,300 and tries to load a browser. 540 00:35:24,620 --> 00:35:27,080 And essentially sees if we get a successful login. 541 00:35:27,300 --> 00:35:29,620 So yeah, just go ahead. 542 00:35:30,340 --> 00:35:32,940 Or if you really have nothing to do on the weekend, 543 00:35:33,920 --> 00:35:36,700 you can definitely brute force every single character, 544 00:35:36,880 --> 00:35:37,960 but why bother? 545 00:35:41,620 --> 00:35:42,640 And just to mention, 546 00:35:43,740 --> 00:35:45,840 some sites actually use the URL and the cookie 547 00:35:45,840 --> 00:35:47,540 to store the session ID. 548 00:35:47,680 --> 00:35:50,760 We showed Amazon earlier as one that actually stores the URL, 549 00:35:50,840 --> 00:35:53,120 and before you raise your hand after and say, 550 00:35:53,240 --> 00:35:54,820 well, they use the cookie as well, it's true. 551 00:35:55,020 --> 00:35:58,800 But they actually use a lot of the same information in the URL. 552 00:35:58,800 --> 00:35:59,840 Let's just store it in the cookie. 553 00:36:00,780 --> 00:36:02,520 So while you think you're really clever 554 00:36:02,520 --> 00:36:04,240 by using a cookie to store this information, 555 00:36:04,420 --> 00:36:06,000 you're doing all the things you should be doing 556 00:36:06,000 --> 00:36:09,320 by storing it over SSL or sending it over SSL, 557 00:36:09,380 --> 00:36:10,300 if it's also in the URL, 558 00:36:10,480 --> 00:36:12,420 then someone may still be able to get that information. 559 00:36:13,340 --> 00:36:15,380 Additionally, if you're storing information in the URL, 560 00:36:15,660 --> 00:36:18,140 let a proxy server store that information in logs. 561 00:36:18,380 --> 00:36:20,460 So if someone were to break into your proxy server 562 00:36:20,980 --> 00:36:23,980 and see a session ID from a past login, 563 00:36:24,200 --> 00:36:27,240 that authentication information is right in there and viewable. 564 00:36:28,880 --> 00:36:30,760 Essentially, just to break the six common problems 565 00:36:30,760 --> 00:36:31,800 behind session IDs, 566 00:36:32,360 --> 00:36:34,340 the first four actually relate to brute forcing. 567 00:36:34,520 --> 00:36:35,480 So weak algorithm. 568 00:36:37,440 --> 00:36:39,360 Obviously, if I generate an algorithm, 569 00:36:39,500 --> 00:36:42,600 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, blah, blah, blah, blah, 12, 570 00:36:42,680 --> 00:36:44,380 not a very good algorithm. It's predictable. 571 00:36:45,500 --> 00:36:46,620 Reverse-engineerable as well. 572 00:36:46,680 --> 00:36:48,800 You just saw the username and password 573 00:36:49,460 --> 00:36:51,040 and through some encoding mechanism. 574 00:36:51,740 --> 00:36:54,340 The second problem, no form of account lockout. 575 00:36:54,380 --> 00:36:56,680 There's really no real way to combat this. 576 00:36:56,820 --> 00:36:58,740 If you saw an IP address coming in 577 00:36:58,800 --> 00:37:00,420 trying to brute force a session ID, 578 00:37:00,500 --> 00:37:02,660 you can't exactly lock out an IP address 579 00:37:02,660 --> 00:37:03,760 on the Internet realistically, 580 00:37:04,620 --> 00:37:07,720 especially because of the way ISPs tend to randomize 581 00:37:08,320 --> 00:37:10,200 IP addresses like AOL. 582 00:37:10,260 --> 00:37:11,600 I believe AOL still does this. 583 00:37:11,880 --> 00:37:13,780 After each click of a web browser, 584 00:37:13,880 --> 00:37:15,620 your IP address actually changes. 585 00:37:17,040 --> 00:37:20,220 So that's just another problem that exacerbates this. 586 00:37:20,300 --> 00:37:21,000 Short T-space. 587 00:37:21,760 --> 00:37:23,080 I thought of a decent example. 588 00:37:23,100 --> 00:37:24,040 This is my luggage lock. 589 00:37:24,260 --> 00:37:26,800 And essentially, assume that there's a random code 590 00:37:26,800 --> 00:37:28,560 each time, every time I lock it. 591 00:37:29,780 --> 00:37:30,580 It's great. 592 00:37:30,860 --> 00:37:33,380 You need code every time, so no one can guess it. 593 00:37:34,100 --> 00:37:35,700 Unfortunately, it's easy to brute force. 594 00:37:35,880 --> 00:37:37,800 I have four dials on here, zero to nine. 595 00:37:38,180 --> 00:37:40,500 Now, obviously, someone could brute force that 596 00:37:40,500 --> 00:37:41,720 probably within a day. 597 00:37:41,820 --> 00:37:43,480 Again, if they were doing all these other things 598 00:37:43,480 --> 00:37:44,900 on that weekend, they had nothing to do. 599 00:37:45,620 --> 00:37:46,800 What we could do, though, 600 00:37:46,880 --> 00:37:48,640 is if we wanted to increase the key space, 601 00:37:48,800 --> 00:37:51,020 we could either create a bunch of dials 602 00:37:51,020 --> 00:37:53,000 that go all the way out for two feet 603 00:37:53,000 --> 00:37:54,900 that also had zero to nine on it, 604 00:37:54,920 --> 00:37:57,160 or we could increase the length of the dials, 605 00:37:57,160 --> 00:37:58,500 including some other characters on it. 606 00:37:59,060 --> 00:38:01,500 So I'll just give you an idea of what I mean by key space. 607 00:38:04,040 --> 00:38:05,680 Again, indefinite expiration on the server. 608 00:38:05,800 --> 00:38:07,080 If you click the Remember Me button, 609 00:38:07,120 --> 00:38:09,180 it gives an attacker however long they want 610 00:38:09,180 --> 00:38:10,340 to brute force a session ID. 611 00:38:10,480 --> 00:38:11,140 Pretty straightforward. 612 00:38:11,920 --> 00:38:13,640 Not going to spend a lot of time on the last two. 613 00:38:14,080 --> 00:38:15,480 Essentially, you all understand that 614 00:38:15,480 --> 00:38:17,360 if you capture a session ID in transit 615 00:38:17,780 --> 00:38:19,820 or if you're able to get a user to load 616 00:38:19,820 --> 00:38:22,280 some malicious Trojan horse that then sends it to you, 617 00:38:22,320 --> 00:38:23,560 you can then log into his application. 618 00:38:27,240 --> 00:38:28,860 These are just some tools, 619 00:38:28,960 --> 00:38:30,500 all free tools that you can use 620 00:38:30,500 --> 00:38:33,420 as a website web application developer 621 00:38:33,420 --> 00:38:36,500 to help you or as an auditor of somebody else's stuff 622 00:38:36,500 --> 00:38:37,860 to determine if it's secure 623 00:38:37,860 --> 00:38:40,720 or whatever else you guys choose to use it for. 624 00:38:41,680 --> 00:38:43,560 The first one, Session Auditor, 625 00:38:44,320 --> 00:38:45,460 that was a tool that we showed you, 626 00:38:45,520 --> 00:38:46,300 the one that we wrote, 627 00:38:46,460 --> 00:38:49,660 and allows you to brute force those session IDs. 628 00:38:50,260 --> 00:38:52,580 Web Sleuth is a great tool. 629 00:38:52,580 --> 00:38:54,400 It does a lot of different things. 630 00:38:54,680 --> 00:38:57,140 Sessions Auditor is actually embedded within that tool, 631 00:38:57,220 --> 00:38:58,400 so you get the same functionality, 632 00:38:58,600 --> 00:39:00,440 but Web Sleuth will allow you to do a lot more. 633 00:39:01,120 --> 00:39:02,340 And then the last four, 634 00:39:02,480 --> 00:39:04,260 Web Proxy, HTTP Push, 635 00:39:04,420 --> 00:39:05,720 Achilles, and Mini Browser. 636 00:39:05,960 --> 00:39:07,340 We showed you Mini Browser. 637 00:39:07,480 --> 00:39:10,080 Those are all effectively personal proxies, 638 00:39:10,080 --> 00:39:11,620 so what they're allowing you to do 639 00:39:11,620 --> 00:39:13,280 is not to brute force that session ID, 640 00:39:13,400 --> 00:39:15,600 but to intercept the communications 641 00:39:15,600 --> 00:39:17,640 between the browser and the server 642 00:39:17,640 --> 00:39:19,660 so that you can see what's happening in the background. 643 00:39:19,720 --> 00:39:22,000 You can see how that session ID is getting passed, 644 00:39:22,180 --> 00:39:22,560 and you can see how that session ID is getting passed, 645 00:39:22,580 --> 00:39:23,220 and with most of those, 646 00:39:23,320 --> 00:39:25,240 it'll also allow you to adjust things 647 00:39:25,240 --> 00:39:27,340 before that session ID is sent, 648 00:39:27,480 --> 00:39:29,680 so you're sort of doing a manual brute force. 649 00:39:31,080 --> 00:39:32,440 What can you do as a user? 650 00:39:32,520 --> 00:39:33,520 Obviously, as a user, 651 00:39:33,580 --> 00:39:36,320 you're at the mercy of the application, 652 00:39:36,620 --> 00:39:38,100 the web application that you're using, 653 00:39:38,180 --> 00:39:40,360 but there are still some common sense, 654 00:39:40,380 --> 00:39:42,220 protective measures that you can take. 655 00:39:42,360 --> 00:39:44,580 One, logging out when your session is done, 656 00:39:44,680 --> 00:39:47,420 so that if they're using that session cookie 657 00:39:47,420 --> 00:39:48,840 to use the session ID, 658 00:39:49,060 --> 00:39:50,560 it'll get wiped off the server. 659 00:39:50,560 --> 00:39:52,680 If somebody steals it, 660 00:39:52,680 --> 00:39:53,820 it's not going to work for them anymore. 661 00:39:54,500 --> 00:39:55,980 Don't select your Remember Me option. 662 00:39:56,180 --> 00:39:58,560 Remember Me option is good in some situations 663 00:39:58,560 --> 00:40:00,400 if security's not involved, 664 00:40:00,660 --> 00:40:03,720 but all that's doing is maintaining that session ID 665 00:40:03,720 --> 00:40:05,120 on your hard drive, 666 00:40:05,340 --> 00:40:07,360 and if somebody has access to your hard drive, 667 00:40:07,520 --> 00:40:08,280 they can grab it, 668 00:40:08,320 --> 00:40:09,620 and everybody knows where to find it. 669 00:40:09,840 --> 00:40:11,940 Netscape stores the cookies in a certain place, 670 00:40:11,980 --> 00:40:13,580 i.e., stores it in a certain place. 671 00:40:13,620 --> 00:40:14,500 It's always in the same place. 672 00:40:16,140 --> 00:40:17,900 That ties into the third one. 673 00:40:18,900 --> 00:40:20,260 Use SSL when you can. 674 00:40:20,260 --> 00:40:21,780 David mentioned it's not perfect, 675 00:40:21,900 --> 00:40:25,200 because if you can get something at one of the endpoints 676 00:40:25,200 --> 00:40:27,060 or at a proxy in the middle, 677 00:40:27,140 --> 00:40:28,360 you can still intercept it, 678 00:40:28,420 --> 00:40:31,000 but it does prevent somebody from sniffing that session ID, 679 00:40:31,260 --> 00:40:32,540 which is obviously a good thing. 680 00:40:33,800 --> 00:40:35,500 Patching your browser with anything, 681 00:40:35,700 --> 00:40:37,180 you've got to keep the patches up to date. 682 00:40:37,540 --> 00:40:40,260 The big thing right now is cross-site scripting attacks. 683 00:40:40,620 --> 00:40:42,180 We see new ones every day, 684 00:40:42,400 --> 00:40:45,500 and keeping your browser patches up to date 685 00:40:45,500 --> 00:40:50,140 will help you from not allowing somebody 686 00:40:50,260 --> 00:40:51,740 to grab your session ID 687 00:40:51,740 --> 00:40:53,220 through a cross-site scripting attack. 688 00:40:54,940 --> 00:40:57,560 A session ID is an authentication mechanism, 689 00:40:57,780 --> 00:41:00,720 so treat it the way you would treat a username and password. 690 00:41:00,940 --> 00:41:03,680 If you're passing it around in an email, 691 00:41:03,920 --> 00:41:05,140 just keep that in mind, 692 00:41:05,180 --> 00:41:06,700 that that's what it's doing. 693 00:41:08,580 --> 00:41:10,600 Just to follow on to cross-site scripting, 694 00:41:11,190 --> 00:41:13,460 obviously cross-site scripting is a server-side problem, 695 00:41:13,680 --> 00:41:16,740 but there are a few browser-specific issues 696 00:41:16,740 --> 00:41:19,960 that some cross-site scripting works on older versions 697 00:41:20,260 --> 00:41:22,820 like Netscape that don't work on the newer versions, etc. 698 00:41:23,340 --> 00:41:25,640 Obviously, a lot of cross-site scripting stuff 699 00:41:25,640 --> 00:41:27,620 is dependent on the vendor to either fix 700 00:41:27,620 --> 00:41:30,280 or make sure it doesn't affect authentication. 701 00:41:31,220 --> 00:41:32,680 What can you do as a software vendor 702 00:41:32,680 --> 00:41:34,100 if you're actually here in the audience 703 00:41:34,100 --> 00:41:36,300 and you've grown your facial hair out in the last week 704 00:41:36,300 --> 00:41:37,980 wanting to mingle in? 705 00:41:39,420 --> 00:41:41,820 These are the things that software vendors can do 706 00:41:41,820 --> 00:41:44,260 to make sure that their applications 707 00:41:44,260 --> 00:41:46,580 are more resilient to application brute forcing. 708 00:41:47,000 --> 00:41:48,600 Obviously, you're not going to be immune to it 709 00:41:48,600 --> 00:41:50,540 by the very nature of most of these state mechanisms. 710 00:41:51,640 --> 00:41:54,360 Regenerate the session ID after a set period of time. 711 00:41:54,620 --> 00:41:57,760 This helps if someone actually sees the information in your proxy. 712 00:41:58,760 --> 00:42:00,440 It just makes it harder for an attacker. 713 00:42:01,260 --> 00:42:03,800 My favorite is create booby-trapped session IDs 714 00:42:03,800 --> 00:42:04,740 in the application. 715 00:42:05,100 --> 00:42:07,940 If you have essentially... 716 00:42:08,600 --> 00:42:10,000 I have five minutes. 717 00:42:10,200 --> 00:42:14,980 My five-minute over plan isn't going to go over well. 718 00:42:15,900 --> 00:42:17,940 Essentially, just create a booby-trapped ID 719 00:42:17,940 --> 00:42:19,900 so that one that never gets generated, 720 00:42:20,080 --> 00:42:21,460 but one that you can detect 721 00:42:21,460 --> 00:42:22,720 if someone's going through a range. 722 00:42:23,420 --> 00:42:25,720 When practical, limit the successful sessions 723 00:42:25,720 --> 00:42:27,020 to specific IP addresses. 724 00:42:27,480 --> 00:42:29,880 Again, this will only work in an internet environment. 725 00:42:30,160 --> 00:42:33,980 This really isn't realistic for an internet application. 726 00:42:34,260 --> 00:42:35,900 In an environment where you have control 727 00:42:35,900 --> 00:42:38,620 over the physical aspects of where people are logging in, 728 00:42:38,720 --> 00:42:40,500 for instance, if you only want someone to log in 729 00:42:40,500 --> 00:42:42,780 from this desk and this sock, 730 00:42:43,700 --> 00:42:47,320 then really that's the only way this option will play. 731 00:42:48,120 --> 00:42:50,460 Auto-expire the sessions if someone walks away. 732 00:42:52,440 --> 00:42:54,200 The last one is something cool. 733 00:42:54,880 --> 00:42:55,940 It's kind of hard to explain, 734 00:42:56,100 --> 00:42:57,880 but essentially when we talked about a replay attack, 735 00:42:58,520 --> 00:43:00,480 if you're going to check out of a shopping cart, 736 00:43:00,680 --> 00:43:03,180 someone actually sees that checkout request 737 00:43:03,180 --> 00:43:05,400 and then just fires a bunch more checkout requests. 738 00:43:06,040 --> 00:43:08,300 On Amazon, you get 10 copies of 739 00:43:08,300 --> 00:43:10,800 Kama Sutra for Dummies instead of the one you ordered. 740 00:43:11,620 --> 00:43:13,700 Essentially, what you can do is the page before that, 741 00:43:13,820 --> 00:43:16,160 put a nonce or another type of session ID 742 00:43:16,160 --> 00:43:17,920 that requires you actually come from 743 00:43:17,940 --> 00:43:19,600 that page, and Yahoo does this. 744 00:43:19,680 --> 00:43:20,460 They call it a crumbs. 745 00:43:21,000 --> 00:43:22,420 That's their official term for it. 746 00:43:23,320 --> 00:43:25,060 Most important, just use a good algorithm 747 00:43:25,060 --> 00:43:26,740 and make sure the inputs to that algorithm 748 00:43:26,740 --> 00:43:30,800 aren't based on time or user ID or password. 749 00:43:31,040 --> 00:43:33,340 Some good pseudo-number random generators, 750 00:43:34,520 --> 00:43:37,080 EGADS, YAROW, Y-A-R-R-O-W. 751 00:43:38,560 --> 00:43:40,800 What can you do as someone who actually has to buy 752 00:43:40,800 --> 00:43:41,760 this type of software? 753 00:43:41,860 --> 00:43:44,220 Well, a lot of this software actually does have 754 00:43:44,220 --> 00:43:46,860 the ability to generate hard to guess, 755 00:43:46,860 --> 00:43:48,160 hard to brute force session IDs. 756 00:43:48,260 --> 00:43:49,300 You just have to configure it. 757 00:43:49,360 --> 00:43:50,280 Some of them have a few levels, 758 00:43:50,420 --> 00:43:52,580 but unfortunately, out of the box, 759 00:43:52,740 --> 00:43:55,180 they are very, very low level. 760 00:43:55,480 --> 00:43:56,860 Again, test your system. 761 00:43:57,520 --> 00:43:59,360 You should be able to know as a vendor 762 00:43:59,360 --> 00:44:03,400 or as a developer if your system is prone to these attacks. 763 00:44:03,640 --> 00:44:05,680 It's your responsibility, in a sense, to your users. 764 00:44:07,600 --> 00:44:09,740 I want to leave just one or two minutes for questions, 765 00:44:09,840 --> 00:44:11,480 but essentially, we talked about OWASP. 766 00:44:14,060 --> 00:44:15,340 We already talked about OWASP. 767 00:44:15,340 --> 00:44:17,580 In conclusion, users, just be aware. 768 00:44:18,160 --> 00:44:20,400 Developers, configure your sites properly 769 00:44:20,400 --> 00:44:23,180 and your systems properly and test them. 770 00:44:23,380 --> 00:44:26,740 And software vendors, fix your software. 771 00:44:28,020 --> 00:44:28,920 Just some resources. 772 00:44:30,140 --> 00:44:31,380 Yeah, if you have questions, 773 00:44:31,600 --> 00:44:33,340 you might just come up after. 774 00:44:34,260 --> 00:44:36,640 Unless you really have one that's burning a hole 775 00:44:36,640 --> 00:44:37,500 and you want everyone to hear. 776 00:44:37,700 --> 00:44:39,180 Yeah, just one question, sorry. 777 00:44:43,040 --> 00:44:43,640 I'm sorry. 778 00:44:43,640 --> 00:44:44,500 Can you say that once more? 779 00:44:48,120 --> 00:44:49,140 The question is, 780 00:44:49,220 --> 00:44:51,280 can you use the SSL session ID for session tracking? 781 00:44:51,440 --> 00:44:53,780 There's actually a decent thread about this, 782 00:44:53,860 --> 00:44:55,740 I believe, on the web application security list. 783 00:44:55,960 --> 00:44:59,040 The answer is no, you really can't for a lot of reasons. 784 00:44:59,620 --> 00:45:01,580 One, it was just never meant to integrate well 785 00:45:01,580 --> 00:45:02,780 into web applications. 786 00:45:03,160 --> 00:45:05,740 Often, you have proxy servers that may strip that out 787 00:45:05,740 --> 00:45:07,620 before they actually get to the web application. 788 00:45:07,960 --> 00:45:10,020 But if anyone wants more detail on that question 789 00:45:10,020 --> 00:45:11,680 or they just want to come up after, please do. 790 00:45:11,820 --> 00:45:12,600 Thanks for attending. 791 00:45:12,600 --> 00:45:13,580 Sorry we started late. 792 00:45:42,680 --> 00:45:44,760 Thank you.