1 00:00:00,000 --> 00:00:05,180 All right, so at Black Hat, we did a 150-minute presentation called Tactical Exploitation. 2 00:00:06,340 --> 00:00:10,320 At DEF CON, we're going to do a 40-minute presentation called Tactical Exploitation. 3 00:00:12,380 --> 00:00:14,620 You may want to record it and play it back slowly. 4 00:00:17,580 --> 00:00:21,760 We tried not to sacrifice content, so we'll see how well we can do this. 5 00:00:22,040 --> 00:00:24,540 Worst case, after this, we're not going to do any Q&A here. 6 00:00:24,780 --> 00:00:29,540 We're going to go to the Track 1 Q&A room, and we can actually do additional demos there if anyone's interested. 7 00:00:31,940 --> 00:00:35,060 So, first thing, this talk is called Tactical Exploitation. 8 00:00:35,340 --> 00:00:38,620 It's about a different way to do pen testing, a different way to look at your targets. 9 00:00:39,960 --> 00:00:45,480 Personally, I've been kind of sick of how folks who are new to the security industry are getting started by running Nessus 10 00:00:45,480 --> 00:00:48,140 and following that up with Core Impact or Metasploit, and that's all they do. 11 00:00:48,460 --> 00:00:53,320 And this talk is really supposed to be a way to look at those other ways to get in, other ways to get shells, 12 00:00:53,500 --> 00:00:58,300 other ways to compromise a network that don't depend on an existing vulnerability or a specific tool. 13 00:00:59,140 --> 00:01:00,740 So, first off, who are we? 14 00:01:01,080 --> 00:01:02,220 My name is H.D. Moore. 15 00:01:02,420 --> 00:01:05,540 I'm a director of security research at a company called Breaking Point Systems. 16 00:01:05,840 --> 00:01:10,520 We do network test equipment, and it's not really that interesting to most of the folks here. 17 00:01:11,060 --> 00:01:14,100 I'm also the founder of the Metasploit project and one of the core developers. 18 00:01:15,520 --> 00:01:16,480 I'm Val Smith. 19 00:01:17,280 --> 00:01:22,100 I've been contributing to the Metasploit project for several years, and I'm one of the founders of Fence of Computing. 20 00:01:24,700 --> 00:01:25,800 So, why you should care. 21 00:01:26,420 --> 00:01:28,260 This talks about a different approach to owning. 22 00:01:28,300 --> 00:01:31,840 So, instead of looking for a specific vulnerability, a new zero-day, a new something, 23 00:01:32,880 --> 00:01:36,440 basically looking at what you actually have and just using the stuff you already have to get a shell. 24 00:01:37,200 --> 00:01:42,780 All sorts of new techniques, new tools, kind of rehashing some really old stuff that still works really well. 25 00:01:43,000 --> 00:01:46,100 And it's all, you know, real-world tested and mother-approved. 26 00:01:48,300 --> 00:01:51,620 So, first off, the first section of this is going to be about target profiling. 27 00:01:51,720 --> 00:01:54,780 Some discovery tools you may or may not know about, hopefully some new stuff in there. 28 00:01:55,820 --> 00:01:58,040 One of the fun demos we're going to do today is, 29 00:01:58,300 --> 00:02:00,940 actually first published in, I think, 1999 or 2001. 30 00:02:01,500 --> 00:02:05,040 And the difference is, I can still get a shell on an XPSP2 box with it, so I don't care. 31 00:02:05,480 --> 00:02:07,740 So, when you see things like that that are kind of old research, 32 00:02:08,040 --> 00:02:11,880 the point is, now they're really feasible, they're really easy to do, and we've automated the crap out of it. 33 00:02:12,420 --> 00:02:14,720 The second section of this is all about getting remote access. 34 00:02:14,980 --> 00:02:18,740 We're going to cover things like trust relationships, fun NTLM stuff, all kinds of cool stuff. 35 00:02:23,940 --> 00:02:27,680 Okay, so, basically we're going to talk about the tactical approach. 36 00:02:28,740 --> 00:02:30,060 Vulnerabilities are transient. 37 00:02:30,200 --> 00:02:35,000 They come and go, you know, you'll have O-Day today, tomorrow it'll be patched. 38 00:02:35,060 --> 00:02:39,100 So, really, you need a long-term approach to breaking into computers. 39 00:02:39,820 --> 00:02:42,420 Target the applications, the things that people use. 40 00:02:43,280 --> 00:02:46,080 Target the processes, the things that they have running on their servers. 41 00:02:46,260 --> 00:02:49,220 Not necessarily big commercial products, things they write in-house. 42 00:02:49,540 --> 00:02:50,920 Especially target the people. 43 00:02:51,600 --> 00:02:53,160 The people are a big part of this. 44 00:02:53,700 --> 00:02:58,160 Trusts, you know, networks trust each other, people trust each other, accounts trust each other. 45 00:02:58,300 --> 00:03:00,560 So, target those things, and you will gain access. 46 00:03:02,740 --> 00:03:04,820 So, let me do this. 47 00:03:05,660 --> 00:03:10,580 Sorry, we're still trying to figure out how, after we've chopped up our content, how to split it up. 48 00:03:10,700 --> 00:03:13,860 So, give us some leeway. 49 00:03:14,520 --> 00:03:15,860 So, first off, crackers are opportunities. 50 00:03:16,060 --> 00:03:17,160 They're going to break into whatever they can. 51 00:03:17,560 --> 00:03:21,560 If you have a job breaking into a bank, and they say, well, you can test this server, this server, and this server, 52 00:03:21,680 --> 00:03:24,420 but not this server at not this time, well, that's your restriction. 53 00:03:24,580 --> 00:03:26,100 It's not the restriction a real attacker's going to have. 54 00:03:26,560 --> 00:03:28,200 So, make sure, when you're talking to a client, 55 00:03:28,300 --> 00:03:30,100 about a possible engagement, you make those things clear, 56 00:03:30,340 --> 00:03:34,900 that anything they restrict you from doing is probably the most severe thing that is the point of attack. 57 00:03:36,140 --> 00:03:38,660 I can't tell you the number of times we've done a pen test, and someone has said, 58 00:03:38,820 --> 00:03:40,500 well, you can test everything but our domain controller. 59 00:03:40,860 --> 00:03:43,360 It's like, the only reason I'm doing this pen test is to crack your domain controller. 60 00:03:43,800 --> 00:03:45,100 So, keep those things in mind. 61 00:03:45,220 --> 00:03:48,640 Like, you really want to make sure your client, or whoever you're doing your pen test or attack against, 62 00:03:48,760 --> 00:03:52,340 understands that whenever they put a restriction on your scope, they're doing themselves a disservice. 63 00:03:53,300 --> 00:03:56,380 And anything you don't test, someone else is going to test, whether they want to or not. 64 00:03:58,100 --> 00:03:59,680 So, hacking's really not about exploits. 65 00:03:59,700 --> 00:04:02,680 It's all about the data, but it's not about, it's all about the data, 66 00:04:02,740 --> 00:04:04,840 but it's not about getting root, or getting admin, or anything else. 67 00:04:07,260 --> 00:04:11,220 Sure, so, you know, see what you can go after. 68 00:04:11,360 --> 00:04:14,400 Can you go after corporate information, design information, 69 00:04:15,180 --> 00:04:16,940 things that the company doesn't want you to have. 70 00:04:17,120 --> 00:04:19,580 I mean, getting root on a box is cool, but what can you do with that? 71 00:04:19,780 --> 00:04:23,580 A lot of times, having access as a regular user is actually more important than being root. 72 00:04:23,740 --> 00:04:25,280 They're logged less, they're watched less. 73 00:04:25,280 --> 00:04:26,960 You can move around the network. 74 00:04:27,820 --> 00:04:31,600 Hacking is using what you have at hand, not necessarily exploits, 75 00:04:31,660 --> 00:04:34,400 to gain further access to more hosts and to more data. 76 00:04:34,940 --> 00:04:40,320 Whether it's passwords, trust relationships, hijacking services, authentication systems, 77 00:04:40,580 --> 00:04:42,380 and we'll go into detail on all these different things. 78 00:04:43,780 --> 00:04:46,020 Security is primarily a people problem. 79 00:04:46,360 --> 00:04:48,860 People write your software, people introduce your bugs, 80 00:04:49,900 --> 00:04:52,780 people screw up and double-click on the viruses that you send them, 81 00:04:52,900 --> 00:04:53,940 people secure your network. 82 00:04:54,120 --> 00:04:55,260 So, identify the meat wherefore. 83 00:05:02,120 --> 00:05:05,420 So, there's lots of great tools for finding out who actually works in an organization, 84 00:05:05,700 --> 00:05:07,840 or what they do, or getting a list of email addresses. 85 00:05:08,160 --> 00:05:09,400 There's tons of great tools for this stuff. 86 00:05:09,920 --> 00:05:13,640 One that I want to focus on today, just because it's so freaking awesome and not many people 87 00:05:13,640 --> 00:05:16,460 know about it, is a tool called Evolution from Paterva.com. 88 00:05:17,180 --> 00:05:19,180 Does anyone here actually use Paterva, excuse me, Evolution? 89 00:05:21,140 --> 00:05:22,700 Wow, okay, so like one or two folks. 90 00:05:22,900 --> 00:05:23,260 Great. 91 00:05:23,260 --> 00:05:26,660 Well, this is definitely a badass tool you should be using. 92 00:05:27,080 --> 00:05:30,940 So what Paterva does is you give it a piece of information, like a name, an address, an 93 00:05:30,940 --> 00:05:32,400 email address, something like that. 94 00:05:32,560 --> 00:05:35,980 It'll go through and find everything related to that using about 40 or 50 different backends. 95 00:05:36,180 --> 00:05:38,340 It'll crawl Facebook, trying to find pictures of you. 96 00:05:38,460 --> 00:05:39,500 It'll crawl Flickr. 97 00:05:39,660 --> 00:05:42,300 It'll go through your LinkedIn account and try to find associations. 98 00:05:42,760 --> 00:05:46,060 It'll go through a company name related to your LinkedIn account and gives you this really 99 00:05:46,060 --> 00:05:50,220 cool graph-like interface you can use to basically dig into more information about a given person, 100 00:05:50,300 --> 00:05:51,380 product, domain, et cetera. 101 00:05:52,660 --> 00:05:53,240 So, all that stuff. 102 00:05:53,260 --> 00:05:53,880 All these types of tools. 103 00:05:53,980 --> 00:05:58,200 What they give us is the full name, the username, email address, employment history, phone numbers, 104 00:05:58,340 --> 00:05:59,220 list of personal websites. 105 00:05:59,620 --> 00:06:02,000 This is a huge amount of information you can grab from these tools. 106 00:06:03,380 --> 00:06:07,220 Here's an example of actually running the Evolution GUI tool against HDMore, which you 107 00:06:07,220 --> 00:06:11,260 find my email address, you find websites I've been mentioned on, you actually get my phone 108 00:06:11,260 --> 00:06:11,840 number out of it. 109 00:06:12,380 --> 00:06:17,800 And at this point, if I decided to double-click the hdm.metasport.com link here, it would actually 110 00:06:17,800 --> 00:06:21,440 go through and find every other email address at metasport.com or find any other place where 111 00:06:21,440 --> 00:06:22,320 that address has been referenced. 112 00:06:22,320 --> 00:06:23,500 So, where have I done posting? 113 00:06:23,680 --> 00:06:27,160 Where have I, any other place my address has shown up in a listing? 114 00:06:27,860 --> 00:06:28,800 Same thing down here. 115 00:06:28,880 --> 00:06:33,180 Gmail, the browser fund site, you'll find any site that links to that site and so on. 116 00:06:38,120 --> 00:06:42,300 Okay, so this is basically like a little case study of how important this information 117 00:06:42,300 --> 00:06:44,060 is when you're breaking into networks. 118 00:06:44,400 --> 00:06:48,820 A lot of people tend to focus on an IP address, a range of IP addresses, but this information 119 00:06:48,820 --> 00:06:49,680 really helps you out. 120 00:06:50,480 --> 00:06:51,660 In one example. 121 00:06:51,660 --> 00:06:56,000 We started with a company that we were going after, that we knew we wanted to target, and 122 00:06:56,000 --> 00:06:58,720 a specific type of information at this company. 123 00:06:59,120 --> 00:07:00,580 What the job descriptions were. 124 00:07:00,740 --> 00:07:05,280 So we started searching the internet for what people are likely to be working on the 125 00:07:05,900 --> 00:07:08,280 information or the work that we really want to target. 126 00:07:08,880 --> 00:07:11,580 So in this particular case, we found an online personnel directory. 127 00:07:12,180 --> 00:07:14,960 We found people with access to the data that we wanted. 128 00:07:15,720 --> 00:07:18,400 A lot of times you can find people's resumes out on their sites. 129 00:07:18,560 --> 00:07:19,600 They don't know it's linked. 130 00:07:19,740 --> 00:07:21,440 They have it in some hidden directory. 131 00:07:21,660 --> 00:07:25,260 But that's good information because it tells you they're working on the systems that you 132 00:07:25,260 --> 00:07:25,820 want to go after. 133 00:07:26,300 --> 00:07:30,500 In a lot of big corporations or large targets, the email address is the username. 134 00:07:31,340 --> 00:07:35,660 So if their email address is joe at whatever dot com, they're going to be logging in as 135 00:07:35,660 --> 00:07:35,880 Joe. 136 00:07:36,140 --> 00:07:37,060 So target that. 137 00:07:38,400 --> 00:07:43,420 In this particular example, we had a guy, we'll call him Joe Targetstein, and he was 138 00:07:43,420 --> 00:07:46,100 a lead engineer in a big semiconductor department of a company. 139 00:07:46,800 --> 00:07:48,940 We found his email address in the online directory. 140 00:07:49,300 --> 00:07:50,260 Old news groups. 141 00:07:50,360 --> 00:07:51,640 Gave us a hint as to what his hosting was. 142 00:07:51,660 --> 00:07:52,140 What his username might be. 143 00:07:52,440 --> 00:07:53,640 So what do we have? 144 00:07:53,840 --> 00:07:57,180 I mean, just searching the internet about a person, we now have a username to target, 145 00:07:57,320 --> 00:08:01,380 a hostname to target, to go after a very specific information that we want to get. 146 00:08:01,540 --> 00:08:03,100 Not just get root on a random machine. 147 00:08:07,520 --> 00:08:07,980 All right. 148 00:08:08,000 --> 00:08:09,920 So we're actually going to be flying through a lot of this material pretty quick. 149 00:08:10,240 --> 00:08:12,720 The way it's kind of structured is we're going to talk about different ways to do discovery. 150 00:08:12,920 --> 00:08:15,500 We start with the people, going to the networks, the applications, and so on. 151 00:08:15,700 --> 00:08:18,600 And we're halfway in, we actually flip to actually doing exploits against hosts. 152 00:08:18,980 --> 00:08:21,340 So if this sounds like kind of boring remedial stuff. 153 00:08:21,340 --> 00:08:24,920 Well, yes, but it's important, and we're going to go into why it's important as we go through 154 00:08:24,920 --> 00:08:25,360 this process. 155 00:08:26,160 --> 00:08:27,680 The next thing we're going to talk about is network discovery. 156 00:08:27,880 --> 00:08:30,060 Basically identifying every asset that your target has. 157 00:08:30,640 --> 00:08:33,840 So if you know that a bank, you know what their domain name is, and you're trying to 158 00:08:33,840 --> 00:08:37,160 do a pen testing against that site, they may not be the only server they have. 159 00:08:37,260 --> 00:08:38,720 May not be the only place they've hosted a resource. 160 00:08:39,400 --> 00:08:42,200 You need to go through and find every MX record against every single host. 161 00:08:42,320 --> 00:08:45,280 You need to find out what internal networks they have, what branch networks they have. 162 00:08:45,440 --> 00:08:46,640 How are the branch networks connected? 163 00:08:47,600 --> 00:08:49,520 What outsource services do they run? 164 00:08:49,640 --> 00:08:50,780 Do they have an outsource spam gateway? 165 00:08:51,340 --> 00:08:54,660 All these things are critical to your asset and critical to breaking in and need to know 166 00:08:54,660 --> 00:08:55,360 how to find them. 167 00:08:56,200 --> 00:08:57,580 There's a lot of really good tools for this. 168 00:08:57,820 --> 00:09:01,300 There's things like, you know, VOs, bruteforcers, there's MMAP, you know, the different open 169 00:09:01,300 --> 00:09:05,520 source resource tools, but we're going to go and skip ahead to some things that most 170 00:09:05,520 --> 00:09:06,760 folks probably haven't heard of before. 171 00:09:07,740 --> 00:09:09,000 So lots of fun things. 172 00:09:09,200 --> 00:09:11,300 The neat things about these services is that they're services. 173 00:09:11,520 --> 00:09:15,280 They go through someone else's server to bring you information about your target. 174 00:09:15,440 --> 00:09:18,360 So in other words, the target has no idea that you're profiling them or pulling information 175 00:09:18,360 --> 00:09:19,180 about them at all. 176 00:09:20,620 --> 00:09:21,320 Val, do you want to talk about that? 177 00:09:21,340 --> 00:09:22,000 Do you want to cover the first two? 178 00:09:22,860 --> 00:09:23,300 Sure. 179 00:09:24,920 --> 00:09:26,340 All right, that mic sucks. 180 00:09:27,900 --> 00:09:32,100 So the idea behind this is to use other people's services to do your attacks. 181 00:09:32,760 --> 00:09:36,400 You know, what people currently do is they'll attack an address or they'll attack a network 182 00:09:36,400 --> 00:09:37,780 from wherever their lab is. 183 00:09:37,940 --> 00:09:42,440 So your target is going to get things in their logs to let them know that this kind of stuff's 184 00:09:42,440 --> 00:09:42,860 going on. 185 00:09:43,380 --> 00:09:46,400 There's a lot of good websites out there like Central Ops, Digital Point. 186 00:09:46,740 --> 00:09:51,140 What these sites do is provide the services that you would normally do by hand off their 187 00:09:51,340 --> 00:09:53,580 web page, which means that attacks are coming from their networks. 188 00:09:54,240 --> 00:09:56,800 Central Ops will give you like a dossier on your target. 189 00:09:57,720 --> 00:10:03,280 Domain name, mapped IP address, who owns the network, who owns the domain name, even in 190 00:10:03,280 --> 00:10:06,240 some cases what ports are open for a certain subset of standard ports. 191 00:10:06,600 --> 00:10:07,760 A lot of good information. 192 00:10:08,160 --> 00:10:10,880 Digital Point is a great site because it'll do DNS zone transfers. 193 00:10:11,360 --> 00:10:14,080 Super old thing that still works today. 194 00:10:14,240 --> 00:10:14,980 I use it all the time. 195 00:10:15,420 --> 00:10:19,940 So this is good intelligence gathering for your targets, and it's about building up a 196 00:10:19,940 --> 00:10:21,460 picture of what to attack. 197 00:10:25,960 --> 00:10:26,760 All right. 198 00:10:26,820 --> 00:10:27,400 This works. 199 00:10:27,540 --> 00:10:27,720 Great. 200 00:10:28,420 --> 00:10:32,340 So the other two sites I'm going to talk about are DomainTools.com and Paterva.com. 201 00:10:32,860 --> 00:10:35,380 A minute ago I showed you the Paterva GUI interface. 202 00:10:35,740 --> 00:10:38,920 So if you download their product, install it, try it, you'll see this neat little graph 203 00:10:38,920 --> 00:10:39,120 interface. 204 00:10:39,540 --> 00:10:43,340 However, they've got a web demo as well, and the web demo basically runs all the same tests 205 00:10:43,340 --> 00:10:44,780 but coming from their server, not yours. 206 00:10:45,560 --> 00:10:47,500 The next one we'll talk about is Domain Tools. 207 00:10:47,780 --> 00:10:49,860 And Domain Tools used to be called WhoIsThatSC? 208 00:10:49,940 --> 00:10:51,560 Has anyone actually used that service before? 209 00:10:52,480 --> 00:10:52,840 Excellent. 210 00:10:53,020 --> 00:10:53,220 All right. 211 00:10:53,240 --> 00:10:53,500 Great. 212 00:10:53,940 --> 00:10:57,600 Well, there's a really cool feature of Domain Tools, and what that is is any time a domain 213 00:10:57,600 --> 00:11:00,600 is registered, they get that domain sent to them by the registrars. 214 00:11:00,780 --> 00:11:02,660 And they say, okay, you know, this new domain exists. 215 00:11:02,900 --> 00:11:06,680 So we're going to reverse DNS that domain, find out what it resolves to, put it into 216 00:11:06,680 --> 00:11:09,660 a big-ass database, and later on we're going to allow someone to query and say, okay, 217 00:11:09,720 --> 00:11:11,200 what domains exist on a given IP address? 218 00:11:11,560 --> 00:11:14,720 In other words, they keep track of every domain on the freaking Internet and give you 219 00:11:14,720 --> 00:11:16,760 a list of what V hosts are on a given IP address for you. 220 00:11:17,100 --> 00:11:18,760 So some fun examples of that. 221 00:11:18,760 --> 00:11:24,220 If you run Domain Tools, this reverse IP thing against Defcon.org, you find a great list 222 00:11:24,220 --> 00:11:26,520 of all these cool different domains running on the same server. 223 00:11:26,820 --> 00:11:30,700 You've got DarkTangent, you've got Defcon.net, and Defcon.net's interesting because it resolves 224 00:11:30,700 --> 00:11:33,580 to more than one IP address, and we'll go into that a little bit later. 225 00:11:33,840 --> 00:11:36,540 You've got HackerJeopardy, and this thing called HackerPoetry. 226 00:11:37,840 --> 00:11:39,120 Has that been announced by anybody? 227 00:11:39,300 --> 00:11:42,240 Because I'm going to put a bolt in my head if I have to listen to any HackerPoetry. 228 00:11:42,380 --> 00:11:43,360 It sounds horrible. 229 00:11:45,080 --> 00:11:48,740 And just in case you don't know who the DarkTangent is, you can now go to thedarktangent.com. 230 00:11:51,420 --> 00:11:54,760 With Defcon.net, I mentioned before that it resolves to two different IPs. 231 00:11:54,960 --> 00:11:56,180 So this is the first IP. 232 00:11:56,380 --> 00:11:58,540 If you look at the second IP, we go on to the next slide. 233 00:11:58,840 --> 00:12:03,540 And here you can actually see that Defcon.net is actually the same server in one case as 234 00:12:03,540 --> 00:12:08,500 zeroday.com, zeroday.net, securityzen.com, and zeroday.com with a Z. 235 00:12:08,920 --> 00:12:12,680 And there's actually a bunch of personal domains I ripped out for Jeff and Ping's sake, just 236 00:12:12,680 --> 00:12:14,340 like Republic of Ping, all these other great ones. 237 00:12:14,480 --> 00:12:17,140 So I pulled those ones out, but they're entertaining to look at at least. 238 00:12:17,760 --> 00:12:18,740 So if you're ever mad at me, I'll tell you why. 239 00:12:18,760 --> 00:12:21,520 If you're mad that someone else stole zeroday.com, they're not using it, you can bitch at Jeff. 240 00:12:22,060 --> 00:12:23,860 But apparently, he's had it for like 10 years. 241 00:12:24,040 --> 00:12:28,320 He's had it so long that when he first registered the domain, all the Wares kids were like pestering 242 00:12:28,320 --> 00:12:29,980 him, trying to say, hey, can I use that for my Wares stuff? 243 00:12:30,460 --> 00:12:33,480 Because you know, zeroday used to be about Wares, and now zeroday is about security 244 00:12:33,480 --> 00:12:33,760 stuff. 245 00:12:33,920 --> 00:12:36,400 So he has all these security guys saying, hey, can you use that for my security stuff? 246 00:12:36,880 --> 00:12:41,040 So I suggested that we use it for kind of like a power sellers for zero bay. 247 00:12:41,960 --> 00:12:45,900 So if you're a real power seller for your zeroday, you can actually get an email address 248 00:12:45,900 --> 00:12:48,660 at odata.com, and hopefully Jeff will go with that. 249 00:12:50,240 --> 00:12:51,220 So what does this get us? 250 00:12:51,700 --> 00:12:55,840 These different sites will do proxy DNS probes, they do zone transfers, you can list a virtual 251 00:12:55,840 --> 00:12:59,540 host for every IP address, you can do port scans, trace routes, all kinds of great stuff. 252 00:12:59,820 --> 00:13:01,520 And the best thing is none of it comes from your system. 253 00:13:01,820 --> 00:13:05,060 So even if the client says, hey, you're not allowed to test this, or hey, I only want 254 00:13:05,060 --> 00:13:07,500 you to do tests against this IP, you're not testing it, they are. 255 00:13:09,660 --> 00:13:14,200 So I'm just saying, you may not be in breach of your agreement, but it works. 256 00:13:17,580 --> 00:13:18,740 So those are kind of the benefits. 257 00:13:18,760 --> 00:13:22,140 The next thing we're talking about is active discovery. 258 00:13:22,620 --> 00:13:24,100 And we're still talking about network discovery. 259 00:13:24,320 --> 00:13:27,800 How do we figure out what IPs they use, what networks they use, where they come from, how 260 00:13:27,800 --> 00:13:31,260 they browse the web from, what's their NAT gateway, all those types of information. 261 00:13:31,940 --> 00:13:35,080 One of my favorite techniques for this is just doing SMTP bounces. 262 00:13:35,520 --> 00:13:38,840 Just about anybody with an Exchange server configured will bounce an email back out from 263 00:13:38,840 --> 00:13:43,820 their Exchange server with usually the internal headers, internal host names, internal version 264 00:13:43,820 --> 00:13:45,600 numbers of exchange inside the headers of that email. 265 00:13:45,900 --> 00:13:48,260 So don't be scared just to email your target. 266 00:13:48,760 --> 00:13:51,840 I mean, they get so much freaking spam each day that if you send them a jumbled email, 267 00:13:52,000 --> 00:13:53,100 they're not going to know the difference. 268 00:13:53,360 --> 00:13:53,880 It's great. 269 00:13:54,120 --> 00:13:55,460 So abuse that. 270 00:13:56,620 --> 00:13:57,020 Sorry. 271 00:13:57,160 --> 00:13:57,340 Go back. 272 00:13:58,500 --> 00:14:02,560 Also, there's things like definitely brute force vhosts, so definitely even though who 273 00:14:02,560 --> 00:14:06,640 is that SE or domain tools doesn't show what host names are on a given IP address, try 274 00:14:06,640 --> 00:14:10,620 connecting to and just sending a host header of intranet or www or admin, things like that. 275 00:14:10,780 --> 00:14:14,380 You'll find all kinds of great cases where the user had misconfigured the server and 276 00:14:14,380 --> 00:14:16,340 actually hosts their intranet site on the same physical IP. 277 00:14:16,700 --> 00:14:18,740 But assume that the DMS is there. 278 00:14:18,760 --> 00:14:20,560 The DNS will do the work of hiding that from the external users. 279 00:14:20,920 --> 00:14:23,580 And finally, you can actually just watch outbound DNS traffic. 280 00:14:23,940 --> 00:14:28,160 If you send someone an email from a domain where you control the resolver for it, so 281 00:14:28,160 --> 00:14:32,800 let's say you create a fake subdomain called mysubdomain.metasupply.com, you send them 282 00:14:32,800 --> 00:14:38,780 an email from Bob at mysubdomain.metasupply.com, or sorry, bob.anothersubdomain.thatsubdomain.metasupply.com, 283 00:14:39,320 --> 00:14:42,660 when that mail server tries to bounce it back to them, it's going to do DNS lookups for 284 00:14:42,660 --> 00:14:42,820 that. 285 00:14:43,020 --> 00:14:47,400 Through that technique, you can figure out what DNS server and what, excuse me, not only 286 00:14:47,400 --> 00:14:48,360 what type of DNS server. 287 00:14:48,760 --> 00:14:52,380 Where that DNS server is located inside their internal network by looking at those queries 288 00:14:52,380 --> 00:14:52,840 coming in. 289 00:14:53,320 --> 00:14:56,560 So, if they're using an external server for all resolution, you'll see that, because they'll 290 00:14:56,560 --> 00:14:59,260 get queries from external IP address that's not related to their NAT gateway. 291 00:14:59,700 --> 00:15:03,560 If it's using an internal DNS server, like Microsoft DNS, something like that, you'll 292 00:15:03,560 --> 00:15:06,900 be able to not only find out that they're coming through the NAT gateway, but you'll 293 00:15:06,900 --> 00:15:10,320 also be able to realize what type of server it is based on the port sequence and the XID 294 00:15:10,320 --> 00:15:10,640 sequence. 295 00:15:12,540 --> 00:15:15,740 So, here's an example of messing with RSA, because RSA is awesome. 296 00:15:15,900 --> 00:15:17,720 We all think RSA is great for security, right? 297 00:15:18,760 --> 00:15:19,440 RSA is security. 298 00:15:19,720 --> 00:15:20,860 I mean, hell, they've got security in their name. 299 00:15:21,480 --> 00:15:21,720 All right. 300 00:15:21,760 --> 00:15:26,420 So, RSA is nice because they run it in a bunch of different mail server products inside. 301 00:15:26,760 --> 00:15:31,380 And if you email just a random unknown user at their domain, it'll bounce back and it'll 302 00:15:31,380 --> 00:15:35,200 actually have the internal IP address to the mail relay, not even the headers, in the freaking 303 00:15:35,200 --> 00:15:35,580 subject. 304 00:15:36,240 --> 00:15:41,980 Like, they'll say, hey, this bounced out of 10.100 to 8.152, and great, thanks, RSA. 305 00:15:47,460 --> 00:15:47,860 Okay. 306 00:15:47,960 --> 00:15:48,180 So. 307 00:15:48,340 --> 00:15:48,740 Okay. 308 00:15:48,760 --> 00:15:51,300 So, if the network is the toast, applications are the butter. 309 00:15:51,500 --> 00:15:52,920 This is about application discovery. 310 00:15:53,980 --> 00:15:58,420 Every application that your target is running is a potential entry point, whether it's commercial 311 00:15:58,420 --> 00:16:01,400 applications they purchased, things they've written in-house. 312 00:16:01,800 --> 00:16:03,820 So, finding these applications is the trick. 313 00:16:04,020 --> 00:16:08,500 A lot of times, you're not going to get some high-profile Windows remote exploit. 314 00:16:08,620 --> 00:16:09,520 You're going to go after an application. 315 00:16:11,800 --> 00:16:15,600 So another point to this is slow and steady win-to-de-face. 316 00:16:15,600 --> 00:16:22,040 A lot of times, people will scan, you know, large blocks of IP addresses, every port, and 317 00:16:22,040 --> 00:16:22,880 that's really noisy. 318 00:16:23,820 --> 00:16:28,380 You know, we like to do stuff like, for example, that command up there is an Nmap command that 319 00:16:28,380 --> 00:16:32,900 says don't ping the target, scan for a specific port, in this case, the MSSQL port. 320 00:16:33,280 --> 00:16:36,880 This gives you a ton of information without making a ton of noise. 321 00:16:37,120 --> 00:16:38,140 What does it tell you? 322 00:16:38,240 --> 00:16:41,300 It tells you most likely what the operating system of the target is. 323 00:16:41,380 --> 00:16:44,000 If it's running MSSQL, it's probably Windows of some sort. 324 00:16:44,000 --> 00:16:47,480 It tells you that they're running MSSQL and that they're available. 325 00:16:47,880 --> 00:16:49,880 So, you know, think a little bit different. 326 00:16:50,100 --> 00:16:55,180 A lot of people will assume, oh, every attack's going to begin with a full-on Nmap port scan. 327 00:16:55,420 --> 00:16:56,620 And that's not necessarily true. 328 00:16:57,300 --> 00:17:03,440 IDSs will detect that, try to avoid it by doing slow, targeted, one-shot, one-kill type 329 00:17:03,440 --> 00:17:03,720 attacks. 330 00:17:04,880 --> 00:17:09,080 So one good example of this is one of the targets we were working on had an internal 331 00:17:09,080 --> 00:17:11,260 application for doing software licensing and distribution. 332 00:17:11,740 --> 00:17:12,940 They'd written this in-house. 333 00:17:12,940 --> 00:17:16,380 It was installed on something like 10,000 computers at this company. 334 00:17:16,840 --> 00:17:18,200 We spent a couple of hours. 335 00:17:18,260 --> 00:17:19,040 We got a copy of this. 336 00:17:19,180 --> 00:17:23,220 Spent a couple of hours with IDA, Alidebug, checking it out, and it turns out they had 337 00:17:23,220 --> 00:17:26,300 a static admin password hard-coded in this application. 338 00:17:26,660 --> 00:17:31,140 So every host on the network used the same admin password to get their software and their 339 00:17:31,140 --> 00:17:31,440 licenses. 340 00:17:32,820 --> 00:17:35,380 This means every accessible node was owned. 341 00:17:35,480 --> 00:17:36,660 We didn't use a single exploit. 342 00:17:36,860 --> 00:17:38,340 We were just targeting the application. 343 00:17:41,160 --> 00:17:42,080 Do you want to switch, please? 344 00:17:42,220 --> 00:17:42,440 Yeah. 345 00:17:42,480 --> 00:17:42,920 Yeah. 346 00:17:44,720 --> 00:17:45,200 All right. 347 00:17:45,220 --> 00:17:46,800 So who's heard of W3AF? 348 00:17:48,680 --> 00:17:49,000 Okay. 349 00:17:49,040 --> 00:17:49,440 A few folks. 350 00:17:49,600 --> 00:17:49,780 Great. 351 00:17:49,940 --> 00:17:53,300 So kind of what I'm trying to do with this talk and with some of the parts of the talk 352 00:17:53,300 --> 00:17:56,180 is talk about tools that are really great that a lot of folks don't really know about 353 00:17:56,180 --> 00:17:56,360 yet. 354 00:17:56,660 --> 00:17:58,720 And W3AF is a good example of that. 355 00:17:58,820 --> 00:18:01,000 It stands for the Web Application Attack and Audit Framework. 356 00:18:01,440 --> 00:18:05,800 It's this neat little read-line-enabled shell, and you can actually do all these cool things 357 00:18:05,800 --> 00:18:10,360 like brute-force v-hosts, brute-force directory structures, brute-force names, all these things 358 00:18:10,360 --> 00:18:11,540 you normally want to do with websites. 359 00:18:11,640 --> 00:18:12,880 So you normally have to use an external tool. 360 00:18:12,940 --> 00:18:16,560 But you can do it all from this quick little console, and it's easy to use. 361 00:18:16,840 --> 00:18:19,500 I mean, it's kind of like Metasploit, so I like it in terms of how the console works. 362 00:18:19,720 --> 00:18:21,440 So I've been calling it Metasploit for the web. 363 00:18:21,680 --> 00:18:23,000 But unfortunately, it's written in Python. 364 00:18:23,260 --> 00:18:24,140 Outside of that, I love it. 365 00:18:25,840 --> 00:18:29,600 And I'm sure he feels the same way about Metasploit being written in Ruby. 366 00:18:29,760 --> 00:18:31,200 So we get along on that. 367 00:18:32,160 --> 00:18:35,820 Finally, there's actually a whole new set of classes in Metasploit 3 for writing your 368 00:18:35,820 --> 00:18:36,920 own quick vulnerability scanners. 369 00:18:37,460 --> 00:18:42,540 If you want to write a vulnerability scanner that connects to every host on a certain port 370 00:18:42,540 --> 00:18:46,220 and sends some data to it, receives data from it, does something to it, that takes about 371 00:18:46,220 --> 00:18:47,320 five minutes in Metasploit 3. 372 00:18:47,620 --> 00:18:50,740 You can find examples of that under modules, auxiliary, scanner. 373 00:18:51,080 --> 00:18:55,900 We've got one that gets the version of every box running with SMB open, like 139.4.45. 374 00:18:56,680 --> 00:18:59,760 We've got another version that'll go through and find the web server version for every 375 00:18:59,760 --> 00:19:00,560 host in the local network. 376 00:19:01,220 --> 00:19:04,380 Another one that actually mask-defaces every host in the local network via put request. 377 00:19:04,720 --> 00:19:06,380 So it's whatever you want it to be. 378 00:19:06,780 --> 00:19:10,480 But if you're going through the same steps over and over again of writing something 379 00:19:10,480 --> 00:19:12,160 that parses CIDR mask. 380 00:19:12,540 --> 00:19:12,920 There's connections. 381 00:19:13,140 --> 00:19:13,800 There's error handling. 382 00:19:14,040 --> 00:19:16,380 And all you're really doing is connecting to a service and doing a probe. 383 00:19:16,580 --> 00:19:20,240 You can do that in about three lines of code in the Metasploit 3 mix-in modules and templates. 384 00:19:20,540 --> 00:19:22,060 So keep that in mind if you're writing your own stuff. 385 00:19:22,200 --> 00:19:26,760 It's really good if you find a custom application or an evil misconfiguration on a customer 386 00:19:26,760 --> 00:19:29,140 network and you want to find out what other system that applies to. 387 00:19:29,580 --> 00:19:31,520 So let's say a default password for a web interface. 388 00:19:31,980 --> 00:19:33,540 Say, okay, well, they've got it set to this here. 389 00:19:33,700 --> 00:19:35,920 I want to make sure it's not the same password set for every other node. 390 00:19:36,220 --> 00:19:37,260 And it has threading support. 391 00:19:37,960 --> 00:19:42,420 So you can set the number of threads to be like 1,000 or 256 and kick off that many hosts 392 00:19:42,540 --> 00:19:43,160 at the same time. 393 00:19:43,260 --> 00:19:45,860 And the whole thing is kind of done for you and reporting is all nice and whatnot. 394 00:19:46,200 --> 00:19:48,200 So just keep that in mind if you're doing your own application discovery. 395 00:19:49,560 --> 00:19:50,980 The next step is client app discovery. 396 00:19:51,300 --> 00:19:52,960 And this is a little bit trickier because you can't... 397 00:19:52,960 --> 00:19:55,220 The clients have to connect to you for you to get that information. 398 00:19:56,540 --> 00:19:59,660 However, client apps are so vulnerable that they're definitely a good target. 399 00:19:59,780 --> 00:20:02,620 And a lot of folks aren't actually trying to do profiling of client applications during 400 00:20:02,620 --> 00:20:03,060 a pen test. 401 00:20:03,540 --> 00:20:06,020 And they're really easy to fingerprint, but you have to get them to do something. 402 00:20:07,240 --> 00:20:10,580 But I mean, excuse me, client apps really are your last chance entrance. 403 00:20:10,740 --> 00:20:12,100 If you can't do anything else... 404 00:20:12,540 --> 00:20:13,900 You should be able to at least exploit a random client. 405 00:20:14,240 --> 00:20:18,160 And the reason for that is the admin can really focus his time on a couple of servers to lock 406 00:20:18,160 --> 00:20:22,740 them down, but he really can't focus his time on 10,000 users or 50,000 users or even 30 407 00:20:22,740 --> 00:20:23,080 users. 408 00:20:24,200 --> 00:20:27,220 So there's lots of different probe methods you can use to profile client applications. 409 00:20:27,860 --> 00:20:30,200 The most obvious one is use mail and email link to... 410 00:20:30,200 --> 00:20:32,280 Excuse me, mail a link to a website to every client. 411 00:20:32,900 --> 00:20:35,640 Abuse the all at and everyone at and team releases. 412 00:20:36,120 --> 00:20:39,040 So if you know the company of software, try emailing SW team at. 413 00:20:39,140 --> 00:20:40,600 Try emailing everyone at, all at. 414 00:20:41,100 --> 00:20:44,480 These folks get so much spam that even if they see a weird email come in, it's not going 415 00:20:44,480 --> 00:20:48,260 to raise that many flags, especially if you make it look like a Viagra spam, something 416 00:20:48,260 --> 00:20:48,660 like that. 417 00:20:49,580 --> 00:20:53,480 You can also do things like send a message disposition notification emails. 418 00:20:53,660 --> 00:20:56,880 There's things that when you get an email and it pops up saying, send a request that 419 00:20:56,880 --> 00:20:57,960 you notify when you receive this. 420 00:20:58,100 --> 00:21:00,660 There's really, really annoying things that just about everyone here probably ignores. 421 00:21:01,040 --> 00:21:04,640 There's actually a huge swarm of corporate clients out there that will autorespond to 422 00:21:04,640 --> 00:21:04,780 these. 423 00:21:05,040 --> 00:21:07,920 So just because you're smart enough not to enable that stuff doesn't mean they are. 424 00:21:08,120 --> 00:21:09,620 So definitely give a shot with those as well. 425 00:21:10,600 --> 00:21:14,840 And finally, once you figure out the NAT gateway of your target, try searching just via Google 426 00:21:14,840 --> 00:21:17,100 or anything else for the external IP address. 427 00:21:17,320 --> 00:21:20,500 A lot of times what you'll find is that IP address will end up in exposed web logs. 428 00:21:20,780 --> 00:21:25,680 So you can find out not only what types of browsers they use, but whether or not they 429 00:21:25,680 --> 00:21:26,300 like goat porn. 430 00:21:26,560 --> 00:21:27,360 I mean, anything. 431 00:21:27,520 --> 00:21:29,120 You can find out what sites they visit based on that. 432 00:21:31,160 --> 00:21:36,360 Finally, so this is actually a technique and kind of a process that a lot of folks really 433 00:21:36,360 --> 00:21:36,780 don't do. 434 00:21:37,120 --> 00:21:38,320 When you're focusing on... 435 00:21:38,320 --> 00:21:38,740 Excuse me. 436 00:21:38,800 --> 00:21:39,500 When you're doing a pen test. 437 00:21:39,500 --> 00:21:43,540 When you're trying to focus on specific servers, IPs, versions, software, what you don't look 438 00:21:43,540 --> 00:21:46,580 for is whether or not certain activities occur. 439 00:21:47,140 --> 00:21:50,640 Like for instance, how many times have you seen a completely locked down network, but 440 00:21:50,640 --> 00:21:54,080 then when you go into the network, you'll see they're doing an anonymous FTP transfer 441 00:21:54,080 --> 00:21:55,920 to an external host every night at a certain time. 442 00:21:56,440 --> 00:21:59,980 I mean, that kind of stuff, it's a huge weakness, but at the same time, it's not something you 443 00:21:59,980 --> 00:22:00,700 can only look for. 444 00:22:01,020 --> 00:22:04,100 So what I want to talk about are a couple of ways you can actually look for this type 445 00:22:04,100 --> 00:22:04,460 of activity. 446 00:22:04,700 --> 00:22:09,180 Actually identify the processes being used to actually attack those protocols and attack 447 00:22:09,180 --> 00:22:09,940 those types of weaknesses. 448 00:22:10,720 --> 00:22:13,980 Good examples that are looking for large IP ID increments in the middle of the night. 449 00:22:14,460 --> 00:22:16,800 So who here is familiar with IP ID scanning? 450 00:22:18,220 --> 00:22:18,580 Great. 451 00:22:19,080 --> 00:22:19,580 A lot of you guys. 452 00:22:19,960 --> 00:22:23,880 The general premise is that a lot of different hosts, each time they send a packet, they'll 453 00:22:23,880 --> 00:22:28,560 increment their IP ID counter, and that'll wrap after 64K and so on, but if you ping 454 00:22:28,560 --> 00:22:32,720 that host and see the IP ID coming back and then ping it again, if you do the delta between 455 00:22:32,720 --> 00:22:36,900 those two IP IDs on a host that supports this type of incremental IP ID, you can determine 456 00:22:36,900 --> 00:22:38,580 how many packets are sent between those two pings. 457 00:22:39,580 --> 00:22:41,060 So you can do all kinds of great things. 458 00:22:41,160 --> 00:22:44,580 You can basically do a remote traffic monitor of any host you want through this method. 459 00:22:45,920 --> 00:22:51,960 Additionally, a lot of FTP servers, and especially Microsoft FTP, they support a command called 460 00:22:51,960 --> 00:22:52,400 site stats. 461 00:22:52,860 --> 00:22:55,760 And what this will return is the number of times each command has been executed on that 462 00:22:55,760 --> 00:22:56,020 server. 463 00:22:56,320 --> 00:22:59,560 And this gives you a great amount of information because you can determine when uploads are 464 00:22:59,560 --> 00:23:01,920 being done, when deletes are being done, when people log into the server. 465 00:23:02,220 --> 00:23:06,160 You can start getting a feeling for, okay, if I want to start hijacking data ports, what's 466 00:23:06,160 --> 00:23:07,360 the time to start scanning for it? 467 00:23:07,880 --> 00:23:09,160 And finally, you can actually look for the IP ID. 468 00:23:09,160 --> 00:23:12,720 You can look for the last modified header on static content on websites to figure out 469 00:23:12,720 --> 00:23:14,460 when they do automated transfers or automated backups. 470 00:23:15,280 --> 00:23:18,540 A couple of cases I've seen, people actually delete the entire web directory before they 471 00:23:18,540 --> 00:23:19,400 sync it over each time. 472 00:23:19,680 --> 00:23:24,240 So you have about a 30-second to one-minute window where things like the .htaccess file 473 00:23:24,240 --> 00:23:27,600 aren't there, where there's a directory index listing, but they delete and index the HTML. 474 00:23:28,120 --> 00:23:32,060 So basically, by going through the web route, and this doesn't work for dynamic content, 475 00:23:32,360 --> 00:23:35,920 and doing basically a head request against each image in the directory, compare all those 476 00:23:35,920 --> 00:23:36,440 timestamps. 477 00:23:36,560 --> 00:23:38,260 See if they're all within a second or two of each other. 478 00:23:38,260 --> 00:23:40,640 Or see if they're a few seconds apart or a minute or two apart. 479 00:23:40,920 --> 00:23:43,660 Now try it again the next day, the next day, the next day, over a week-long period. 480 00:23:44,000 --> 00:23:47,800 What you may find out is they're actually doing a full backup or a full upload every 481 00:23:47,800 --> 00:23:48,640 night at a certain time. 482 00:23:48,900 --> 00:23:52,080 Now you know when you want to start W-getting that site as fast as you can, trying to find 483 00:23:52,080 --> 00:23:55,860 a window where the .htaccess isn't there or it's otherwise misconfigured. 484 00:23:57,760 --> 00:23:59,480 So are there any existing tools for this stuff? 485 00:23:59,920 --> 00:24:00,760 Not that I've seen. 486 00:24:00,900 --> 00:24:03,500 Correct me if you have seen some in the Q&A session, hopefully. 487 00:24:04,240 --> 00:24:08,100 I'd just tend to use HPing, Pipe2, a log file, basically. 488 00:24:08,100 --> 00:24:08,240 I don't know. 489 00:24:08,240 --> 00:24:10,600 Or Netcat or any other tool for the site stats stuff. 490 00:24:11,580 --> 00:24:14,840 Here's an example of the site stats command running on ftp.microsoft.com. 491 00:24:15,040 --> 00:24:17,900 And this is just one of many, many nodes inside the FTP cluster. 492 00:24:18,740 --> 00:24:22,160 Something to keep in mind is this node's only been up for 47 days and it's had over 493 00:24:22,160 --> 00:24:23,460 two billion user commands. 494 00:24:24,820 --> 00:24:26,660 So they get a lot of FTP traffic. 495 00:24:27,540 --> 00:24:31,760 However, they've had two billion users do the user command, but they've only had 3,035 496 00:24:31,760 --> 00:24:32,360 store commands. 497 00:24:32,960 --> 00:24:36,100 So if you basically profile the number of times a store command has been run over a 498 00:24:36,100 --> 00:24:38,220 period of time, you can determine when they're actually done. 499 00:24:38,220 --> 00:24:38,640 They're doing their uploads. 500 00:24:39,000 --> 00:24:41,680 And when they're doing their uploads, you now know you can actually interfere with that 501 00:24:41,680 --> 00:24:43,100 by hijacking the data port. 502 00:24:43,440 --> 00:24:46,580 And I'll talk about hijacking data ports and that stuff a little bit later on. 503 00:24:46,760 --> 00:24:50,000 The point of that is even if you can't steal their file, you can still destroy their backups. 504 00:24:50,920 --> 00:24:53,400 And you see some other commands like delete, make directory, et cetera. 505 00:24:54,240 --> 00:24:58,560 The next example is a website called hacker.com, which I picked right before Black Hat because 506 00:24:58,560 --> 00:24:58,820 it was fun. 507 00:25:00,180 --> 00:25:04,320 I started profiling this site around 8 p.m. and I stopped it around 6 a.m. or something 508 00:25:04,320 --> 00:25:04,740 like that. 509 00:25:04,880 --> 00:25:06,280 Or probably 10 p.m. is when it started. 510 00:25:06,800 --> 00:25:07,940 So this is basically... 511 00:25:08,220 --> 00:25:13,740 The delta between the IPID increments accounted for the integer wrap across about a nine-hour 512 00:25:13,740 --> 00:25:15,340 period, something like that, nine or 10 hours. 513 00:25:15,820 --> 00:25:20,000 So around 10 p.m., you can see it spikes to about 3,000, but the baseline traffic is 514 00:25:20,000 --> 00:25:20,320 pretty low. 515 00:25:20,800 --> 00:25:23,280 As I get right around midnight, you see a huge spike in traffic. 516 00:25:23,520 --> 00:25:25,640 This is actually some kind of automated backup process. 517 00:25:25,740 --> 00:25:27,980 There's somebody just debiting the crap out of that site right around midnight. 518 00:25:28,580 --> 00:25:29,920 This is the kind of thing you want to look for. 519 00:25:30,060 --> 00:25:32,760 If you're profiling a server and you want to find out when they're doing large backups, 520 00:25:32,980 --> 00:25:36,960 when they have some kind of data recovery routine running, this is how you can do so. 521 00:25:36,960 --> 00:25:41,020 You can also find other types of activity through this method and be like, hey, something 522 00:25:41,020 --> 00:25:42,280 really big happens at this time. 523 00:25:42,500 --> 00:25:43,380 Let me know what that is. 524 00:25:44,020 --> 00:25:47,580 And this little graph was actually generated with a little one-liner Ruby in five minutes. 525 00:25:47,740 --> 00:25:50,040 So if you want to know how to do it, let me know after the talk and I can show you 526 00:25:50,040 --> 00:25:50,600 the code for it. 527 00:25:51,460 --> 00:25:54,060 Then you see the traffic kind of lulls down for about six, seven hours. 528 00:25:54,320 --> 00:25:57,100 And finally, you can see everyone in the U.S. starts to wake up again and the traffic builds 529 00:25:57,100 --> 00:25:57,560 back up. 530 00:25:57,860 --> 00:26:02,560 So if you're curious how much traffic a site has and their server does sequential IPID 531 00:26:02,560 --> 00:26:04,180 increments, this is a great way to do it. 532 00:26:04,460 --> 00:26:06,940 What you may see sometimes is that you get two or three sets up. 533 00:26:06,960 --> 00:26:07,640 One of the IPIDs is back. 534 00:26:07,800 --> 00:26:09,240 In that case, you're actually hitting a load balancer. 535 00:26:09,740 --> 00:26:13,800 So one server will respond back with 1,000, 1,001, 1,002. 536 00:26:13,900 --> 00:26:15,680 Another one is 9,001, 9,002. 537 00:26:15,880 --> 00:26:17,800 And you have to kind of keep track of both of those at the same time. 538 00:26:19,380 --> 00:26:20,520 So on to the external network. 539 00:26:20,720 --> 00:26:23,200 That was kind of our discovery techniques or discovery phase. 540 00:26:23,420 --> 00:26:26,560 Just different techniques to keep in mind when doing a pen test to profile services, 541 00:26:26,980 --> 00:26:30,040 find users, find networks, find applications, just some quick tips. 542 00:26:30,480 --> 00:26:32,120 The next section is all about actually breaking in. 543 00:26:32,540 --> 00:26:35,320 The first thing we're talking about is external network and we'll work our way inside. 544 00:26:36,960 --> 00:26:40,100 The internal side, usually called the crunchy candy shell or whatever you want to call it, 545 00:26:40,980 --> 00:26:45,120 what the administrator usually thinks they're exposing are the host they specified. 546 00:26:45,300 --> 00:26:47,660 This web server, this mail server, this application server. 547 00:26:48,000 --> 00:26:51,700 What they're really exposing is all those things plus their VPN services, plus their 548 00:26:51,700 --> 00:26:54,720 proxy services, and plus all those different client-initiated sessions. 549 00:26:56,260 --> 00:27:00,100 A lot of folks don't realize that the public NTP servers, if you send a command called 550 00:27:00,100 --> 00:27:03,800 monlist to them, they'll come back with a listing of every IP address, every client 551 00:27:03,800 --> 00:27:05,740 that's actually connected to them within a certain window of time. 552 00:27:06,280 --> 00:27:08,720 There's only an infinite number of public NTP servers. 553 00:27:09,280 --> 00:27:12,260 What you can do is build code that basically goes out and pings each one of these servers 554 00:27:12,260 --> 00:27:15,600 with this monlist command every five minutes and not only do you find out when a given 555 00:27:15,600 --> 00:27:19,280 organization is querying the public NTP servers, how many different clients are querying it 556 00:27:19,280 --> 00:27:22,620 and whether or not those clients are inside or outside of the firewall. 557 00:27:22,960 --> 00:27:24,460 You can just help out by looking at the source port. 558 00:27:24,760 --> 00:27:28,500 NAT gateways will translate that from the normal source port, which is 123, to something 559 00:27:28,500 --> 00:27:32,240 else and it also gives you a window where you know if you send a spoof packet from that 560 00:27:32,240 --> 00:27:35,440 time server to that host on that source port. 561 00:27:35,440 --> 00:27:38,860 You'll get back to that time client and now you can actually start doing attacks against 562 00:27:38,860 --> 00:27:39,880 those NTP clients themselves. 563 00:27:40,400 --> 00:27:43,760 Any case where you can see the outbound UDP traffic and see those source ports, you now 564 00:27:43,760 --> 00:27:48,100 know what the NAT gateway mapping is and you can actually target those applications. 565 00:27:50,020 --> 00:27:51,160 I mentioned FTP before. 566 00:27:51,880 --> 00:27:53,440 Does everyone here know how FTP works? 567 00:27:54,760 --> 00:27:55,920 You realize there's two connections. 568 00:27:56,180 --> 00:27:59,880 There's control, there's data, the data ports allocated based on either the server or the 569 00:27:59,880 --> 00:28:00,120 client. 570 00:28:00,480 --> 00:28:04,420 Active FTP, the client opens up a listener for that and passive FTP, the server opens 571 00:28:04,420 --> 00:28:04,860 up a listener. 572 00:28:05,840 --> 00:28:06,720 That's basically it. 573 00:28:06,940 --> 00:28:09,680 Going through a NAT gateway, there's all sorts of problems with active FTP. 574 00:28:10,040 --> 00:28:13,260 I'm not going to talk about them too much, but if you see large spikes in traffic, try 575 00:28:13,260 --> 00:28:19,240 scanning for the ports used by the NAT gateway, like 32K to 45K or even 1024 to 64K, just 576 00:28:19,240 --> 00:28:20,900 repeatedly, trying to find those open ports. 577 00:28:22,340 --> 00:28:26,600 A lot of times there's different vulnerabilities with how NAT gateways handle active FTP and 578 00:28:26,600 --> 00:28:29,280 I'm not going to get into those here, but just keep those in mind when you're doing 579 00:28:29,280 --> 00:28:29,860 this kind of testing. 580 00:28:30,300 --> 00:28:32,200 Finally, passive FTP, this is much more common. 581 00:28:32,360 --> 00:28:34,660 This means the server opens up a port and the client connects to that server. 582 00:28:35,440 --> 00:28:38,560 If you can also connect to that server, log in as anonymous or you just port scan the 583 00:28:38,560 --> 00:28:41,780 crap out of it, you can actually predict the ports that are being used in a lot of cases. 584 00:28:42,840 --> 00:28:44,880 Microsoft FTP is a really good example of this. 585 00:28:45,100 --> 00:28:49,640 Their FTP server will sequentially allocate those data ports no matter what client it 586 00:28:49,640 --> 00:28:49,860 is. 587 00:28:50,000 --> 00:28:54,220 If you connect FTP to Microsoft.com and you send the passive commands, it'll come back 588 00:28:54,220 --> 00:28:55,140 saying, port 100. 589 00:28:55,600 --> 00:28:58,080 The next client who's doing it will get port 101. 590 00:28:58,440 --> 00:28:59,520 The next client will get 102. 591 00:29:00,780 --> 00:29:04,160 Microsoft FTP is smart enough that if you connect to that data port instead of being 592 00:29:04,160 --> 00:29:04,760 the real client. 593 00:29:05,780 --> 00:29:08,500 It'll kick you off, it'll say, sorry, I'm not going to send you that data, that wasn't 594 00:29:08,500 --> 00:29:09,000 your data port. 595 00:29:09,300 --> 00:29:12,040 However, you'll still break the backup, you'll still break that transfer. 596 00:29:12,480 --> 00:29:15,520 What you can do is if you profile a backup process running in the middle of the night 597 00:29:15,520 --> 00:29:18,820 and you know what endpoints are, you can find these data ports and you can steal the data 598 00:29:18,820 --> 00:29:20,220 ports before the client can get them. 599 00:29:20,780 --> 00:29:22,820 In doing so, you can break their disaster recovery system. 600 00:29:24,300 --> 00:29:26,720 There's a tool I wrote for this called PassiveAg.pl. 601 00:29:27,160 --> 00:29:29,900 It's been around for a really long time, but it still works really well for this type 602 00:29:29,900 --> 00:29:30,180 of thing. 603 00:29:31,580 --> 00:29:33,640 Finally, moving on to attacking web servers. 604 00:29:35,720 --> 00:29:40,120 Don't ever make sure when you're doing an assessment against a website, you always 605 00:29:40,120 --> 00:29:42,580 check for things like slash old, slash backup, slash admin. 606 00:29:42,980 --> 00:29:45,840 This should be old hat, but you can find all kinds of really cool things with it. 607 00:29:46,600 --> 00:29:50,700 Example, Cray.com for the last five years has had this directory called slash old. 608 00:29:51,420 --> 00:29:54,240 Until about a year and a half ago, it actually had directory indexing enabled. 609 00:29:54,600 --> 00:29:57,300 Inside the directory was a five gig file called backup.tar. 610 00:29:58,120 --> 00:29:59,440 Any guess what that was? 611 00:29:59,680 --> 00:30:00,100 All right. 612 00:30:00,980 --> 00:30:03,100 They finally made the directory for it. 613 00:30:03,200 --> 00:30:03,480 Excuse me. 614 00:30:03,640 --> 00:30:07,080 It's disabled directory indexing, but there probably still is a file called that. 615 00:30:07,140 --> 00:30:07,540 I have no idea. 616 00:30:07,640 --> 00:30:08,720 I didn't actually try to download it. 617 00:30:12,580 --> 00:30:15,880 That's an example of a server that's been misconfigured, just an old directory there. 618 00:30:16,000 --> 00:30:17,720 Some admin probably hasn't thought about it in 10 years. 619 00:30:17,980 --> 00:30:18,800 Look for that kind of stuff. 620 00:30:18,980 --> 00:30:19,940 It's really, really prevalent. 621 00:30:20,720 --> 00:30:23,600 Another example that I see a lot is source control files being left in the web route. 622 00:30:23,700 --> 00:30:26,820 Here's a contrived example that I found on the internet, just some random website that 623 00:30:26,820 --> 00:30:27,400 happened to have it. 624 00:30:27,980 --> 00:30:33,000 Basically, when you check out a subversion tree or a CVS tree, it usually brings out, 625 00:30:33,000 --> 00:30:35,500 it brings its source control directories with it. 626 00:30:35,660 --> 00:30:38,780 Those directories give away things like the root of the tree, where to log in to actually 627 00:30:38,780 --> 00:30:42,580 get that source code, the files in any given directory, things like that. 628 00:30:43,200 --> 00:30:46,600 For a long time, freshme.net had the CVS entries file exposed. 629 00:30:46,900 --> 00:30:47,320 It was awesome. 630 00:30:47,820 --> 00:30:50,240 Finally, Scoop finally removed it, so that's solved. 631 00:30:50,820 --> 00:30:52,620 Another good example of that is ebay.com. 632 00:30:52,800 --> 00:30:56,080 Almost every one of their virtual hosts had CVS slash entries exposed for a really, really 633 00:30:56,080 --> 00:30:56,540 long time. 634 00:30:57,160 --> 00:30:59,080 About a year and a half ago, they finally fixed that as well. 635 00:30:59,500 --> 00:31:02,980 That was useful because you didn't want to see what little new advertisements coming out. 636 00:31:02,980 --> 00:31:04,740 You could do that on the image server, stuff like that. 637 00:31:06,200 --> 00:31:09,400 A couple quick tricks, and then I'm going to turn it over to Val to talk about a case 638 00:31:09,400 --> 00:31:10,600 study and a quick example. 639 00:31:11,180 --> 00:31:14,400 If you see a system that's using, excuse me, if you're doing a test against a web server 640 00:31:14,400 --> 00:31:16,880 and you're trying to figure out whether or not it's behind an Apache reverse proxy, 641 00:31:17,660 --> 00:31:20,920 where you have Apache working in proxy mode and it's actually proxying it back to an internal 642 00:31:20,920 --> 00:31:26,440 server, the easiest way to do that is just do a get request with percent zero zero after 643 00:31:26,440 --> 00:31:26,720 your slash. 644 00:31:26,980 --> 00:31:27,300 You're done. 645 00:31:27,520 --> 00:31:31,820 The Apache server will actually puke back an error saying, hey, could not find this 646 00:31:31,820 --> 00:31:32,060 file. 647 00:31:32,980 --> 00:31:34,060 This version, so and so and so and so. 648 00:31:34,480 --> 00:31:38,120 If you're testing an IIS server and now all of a sudden you get an Apache error, now you 649 00:31:38,120 --> 00:31:39,540 know you're going through an Apache reverse proxy. 650 00:31:40,420 --> 00:31:43,520 Another configuration I see a lot is Apache's dynamic virtual hosting. 651 00:31:44,220 --> 00:31:47,400 What this is, instead of having to create a virtual host configuration file for every 652 00:31:47,400 --> 00:31:51,460 system you have on your large ISP server, you say, hey, just look in the sub directory 653 00:31:51,460 --> 00:31:55,200 for any file, excuse me, any directory named the host name the client sent. 654 00:31:55,640 --> 00:32:00,420 If you want to add a new vhost, you just do a make directory, www, Bob's house of hardware 655 00:32:00,420 --> 00:32:01,660 dot com, whatever you want to call it. 656 00:32:02,220 --> 00:32:06,480 Unfortunately, what I see a lot is the global configuration for Apache will have index 657 00:32:06,480 --> 00:32:12,180 directed, excuse me, indirect, index listings enabled for directories, and each individual 658 00:32:12,180 --> 00:32:16,820 sub host or vhost may be locked down, but the main configuration is not locked down. 659 00:32:17,060 --> 00:32:22,900 What you can do is if you get slash HTTP 1.1, host colon percent zero zero slash, what that 660 00:32:22,900 --> 00:32:25,600 will do is actually return you the index of every vhost on that server. 661 00:32:25,800 --> 00:32:28,240 You actually get served the directory below the vhost directory. 662 00:32:28,880 --> 00:32:30,640 It's a neat trick when you're testing ISPs. 663 00:32:30,640 --> 00:32:33,160 With that, I'm going to turn it over to Val. 664 00:32:34,280 --> 00:32:34,920 Thanks, Dan. 665 00:32:35,060 --> 00:32:35,540 Okay. 666 00:32:36,120 --> 00:32:40,700 This is just an example of things to think about when attacking web hosts, which are 667 00:32:40,700 --> 00:32:41,300 pretty good targets. 668 00:32:42,100 --> 00:32:46,160 In this particular case, we had a web host with thousands of sites that they were hosting, 669 00:32:46,240 --> 00:32:50,260 both virtual hosts like whatever dot com as well as tilde slash user. 670 00:32:50,920 --> 00:32:55,620 All these hosts had CGI scripts, applications for the customers. 671 00:32:56,580 --> 00:33:00,620 We found one particular CGI that they had put up as a demo to show people. 672 00:33:00,620 --> 00:33:04,400 People who were going to sign up with their company, what kind of CGI scripts you could 673 00:33:04,400 --> 00:33:05,000 run on their server. 674 00:33:05,660 --> 00:33:09,180 The great thing about this particular script is it had a directory traversal problem. 675 00:33:09,780 --> 00:33:11,020 This isn't a remote exploit. 676 00:33:11,240 --> 00:33:14,380 We can get a show with this, but we could gather a lot of intelligence about the server. 677 00:33:17,420 --> 00:33:22,320 In this case, we were able to basically go through the whole server into every directory 678 00:33:22,320 --> 00:33:28,780 which the web server user had access to and see what they had in there, backup files, 679 00:33:28,980 --> 00:33:29,940 other CGI scripts. 680 00:33:32,920 --> 00:33:37,800 Eventually, what we found out was they had hundreds of maybe even thousands of CGI scripts 681 00:33:37,800 --> 00:33:41,700 that were either user written or just downloaded off the internet like web hints or whatever. 682 00:33:42,780 --> 00:33:47,240 What we could do once we had identified these scripts is go download them ourselves and 683 00:33:47,240 --> 00:33:49,820 either write bugs for them or find bugs that were already well known. 684 00:33:50,040 --> 00:33:51,800 We had hundreds of ways to break into the server. 685 00:33:52,260 --> 00:33:55,060 One of the great things about this particular server was that it was Solaris. 686 00:33:57,880 --> 00:34:00,600 It turns out that Solaris treats directories. 687 00:34:00,600 --> 00:34:00,900 It uses files. 688 00:34:01,660 --> 00:34:06,720 On a Solaris box, you can do cat directory name is the same as doing an LS inside the 689 00:34:06,720 --> 00:34:06,980 directory. 690 00:34:07,400 --> 00:34:12,420 The nice thing that this lets us do is over a directory traversal bug, we can treat all 691 00:34:12,420 --> 00:34:17,660 the directories on the Solaris server as files and enumerate everything inside of them even 692 00:34:17,660 --> 00:34:20,060 if they don't have indexes available for us. 693 00:34:21,060 --> 00:34:23,940 Again, the %00 byte destroys everything. 694 00:34:24,200 --> 00:34:24,480 It's great. 695 00:34:28,360 --> 00:34:29,900 We're flying through material here. 696 00:34:29,900 --> 00:34:33,040 We just want to make sure we finish in time, but the next thing I'm going to talk about 697 00:34:33,040 --> 00:34:33,900 is DNS servers. 698 00:34:35,200 --> 00:34:39,100 When you're doing a pen test, make sure you brute force not only external host names such 699 00:34:39,100 --> 00:34:44,260 as www.domain.com, mail.domain.com, just go through the whole dictionary, but also 700 00:34:44,260 --> 00:34:45,300 brute force internal names. 701 00:34:45,400 --> 00:34:48,740 Look for sites called intranet.local.lan and things like that. 702 00:34:48,880 --> 00:34:52,600 Intranet.what are the domain names but .int or .lan is the TLD. 703 00:34:52,900 --> 00:34:54,480 A lot of folks don't split their DNS correctly. 704 00:34:55,200 --> 00:34:59,480 Something you may also notice is a lot of the transaction IDs used by these DNS servers, 705 00:34:59,580 --> 00:34:59,880 or DNS servers, are not split. 706 00:34:59,900 --> 00:35:01,100 These DNS clients are really predictable. 707 00:35:01,620 --> 00:35:06,500 For example, recently the bind 9 server had a PRNG attack demonstrated where you can actually, 708 00:35:06,680 --> 00:35:10,280 once you know one transaction ID in the source port of the server, you can then find out 709 00:35:10,280 --> 00:35:11,420 what the next transaction ID is. 710 00:35:11,680 --> 00:35:15,460 What that gives you is the ability to spoof responses to a DNS cache and inject whatever 711 00:35:15,460 --> 00:35:17,100 host name you want into their cache externally. 712 00:35:17,680 --> 00:35:18,680 These are really good attacks. 713 00:35:18,960 --> 00:35:21,980 I'll talk about some ways you exploit this stuff a little bit later on, but it's pretty 714 00:35:21,980 --> 00:35:25,000 obvious that you can replace someone's DNS entry that bad things are afoot. 715 00:35:25,720 --> 00:35:28,340 Also birthday attacks, they work against all sorts of things. 716 00:35:28,440 --> 00:35:29,880 Basically, where you basically have to split your DNS. 717 00:35:29,900 --> 00:35:33,540 You just brute force the number of responses you send back and eventually get it to hit 718 00:35:33,540 --> 00:35:37,580 because there's only 64K possible transaction IDs and the source port's usually predictable. 719 00:35:38,160 --> 00:35:42,680 You can almost guarantee you can hit a birthday attack with any server that doesn't do anything 720 00:35:42,680 --> 00:35:44,000 specifically to prevent against it. 721 00:35:44,660 --> 00:35:49,920 A lot of these new DNS servers we're seeing, I think Mara DNS is okay, but a lot of the 722 00:35:49,920 --> 00:35:53,680 newer ones that are popping up as alternatives to bind don't protect against these types 723 00:35:53,680 --> 00:35:54,820 of attacks that have been around forever. 724 00:35:55,920 --> 00:35:59,880 One more thing to keep in mind is a lot of VxWorks servers and VxWorks based upon VxWorks, 725 00:35:59,880 --> 00:36:04,260 VxWorks appliances are used for things like VPNs, proxy servers, routers, things like 726 00:36:04,260 --> 00:36:04,480 that. 727 00:36:04,720 --> 00:36:06,220 All those little embedded network devices. 728 00:36:06,500 --> 00:36:11,640 The built-in DNS client in the VxWorks product has sequential transaction IDs and sequential 729 00:36:11,640 --> 00:36:12,180 source ports. 730 00:36:12,620 --> 00:36:16,600 If you can convince any of these devices or anything running VxWorks to do a DNS query, 731 00:36:17,120 --> 00:36:20,480 you can spoof the response back in and basically forge the response to it. 732 00:36:21,060 --> 00:36:28,620 A lot of security vendors are actually basing their products on these VxWorks OS and keep 733 00:36:28,620 --> 00:36:29,080 that in mind. 734 00:36:29,080 --> 00:36:33,340 If you see that, you can probably inject random responses or spoof responses back to 735 00:36:33,340 --> 00:36:33,720 these clients. 736 00:36:34,380 --> 00:36:37,640 For the most part, these products don't do a whole lot of DNS resolution internally. 737 00:36:37,980 --> 00:36:39,140 They usually hand it off to something else. 738 00:36:39,380 --> 00:36:42,220 If anything does, host-based checking, that's one way to get around it. 739 00:36:42,820 --> 00:36:47,620 Finally, a lot of alternative DNS implementations will actually, if you send an extra response 740 00:36:47,620 --> 00:36:49,840 to the data you send back, it will also cache that response. 741 00:36:50,720 --> 00:36:56,680 You may be asking if you're a BobToast.metasupply.com, but you can return back BobToast.metasupply.com 742 00:36:56,680 --> 00:36:58,640 and www.cnn.com. 743 00:36:58,640 --> 00:37:00,340 It will cache that second entry as well. 744 00:37:00,680 --> 00:37:02,520 Just things to try when you're testing DNS servers. 745 00:37:04,720 --> 00:37:05,340 Ten minutes. 746 00:37:05,460 --> 00:37:05,700 All right. 747 00:37:05,780 --> 00:37:07,120 We're going to haul ass. 748 00:37:09,740 --> 00:37:10,540 Authentication relaying. 749 00:37:10,600 --> 00:37:13,800 One of the great things about NTLM is that no matter what authentication implementation 750 00:37:13,800 --> 00:37:16,840 you have coming inbound, you can redirect that to anything outbound. 751 00:37:17,220 --> 00:37:21,840 For example, if you have an NTLM-enabled SNTP client connecting to you as an SNTP server 752 00:37:21,840 --> 00:37:25,280 and it tries to do NTLM authentication to you, you could turn around and connect back 753 00:37:25,280 --> 00:37:27,020 to the SNTP port on a different host entirely. 754 00:37:27,020 --> 00:37:32,220 Just basically pass the authentication straight through and use their SNTP client to authenticate 755 00:37:32,220 --> 00:37:33,160 against an SNP server. 756 00:37:33,800 --> 00:37:38,840 By the same token, you can use an SNP incoming connection to authenticate an external exchange 757 00:37:38,840 --> 00:37:41,580 website or any other IS server that supports NTLM authentication. 758 00:37:42,300 --> 00:37:45,860 If you can get any sort of NTLM authentication coming inbound, you can then apply that to 759 00:37:45,860 --> 00:37:49,980 either the target itself, excuse me, the incoming connection server itself, like going directly 760 00:37:49,980 --> 00:37:53,740 back to the client, or to an external host or any other host that supports NTLM because 761 00:37:53,740 --> 00:37:56,220 it just passes through this generic block for the most part. 762 00:37:57,080 --> 00:37:58,980 We're going to go into more of this later, but keep that in mind. 763 00:37:59,180 --> 00:38:00,520 There's all kinds of great things you can do with it. 764 00:38:01,740 --> 00:38:03,260 Finally, a little bit about social engineering. 765 00:38:03,940 --> 00:38:07,540 This has been beat to death, but make sure that if you're charging $50,000 for a pen 766 00:38:07,540 --> 00:38:09,340 test, you can afford to burn a couple CDs. 767 00:38:10,880 --> 00:38:14,020 If you're charging $100,000 for a pen test, you can afford to get a whole bunch of USB 768 00:38:14,020 --> 00:38:17,040 keys and load them up with some awesome software that just happens to be a backdoor. 769 00:38:18,020 --> 00:38:20,740 If you're doing a million dollar pen test, you can go out and buy a whole bunch of Nokia 770 00:38:21,660 --> 00:38:21,940 N770s. 771 00:38:21,940 --> 00:38:23,000 You can buy a bunch of N800s. 772 00:38:23,040 --> 00:38:23,900 You can buy Sharp Zorises. 773 00:38:24,160 --> 00:38:26,940 You can send them off to each of the CEOs saying, hey, you won this new sweepstakes. 774 00:38:26,940 --> 00:38:30,120 Welcome to that conference you presented at. 775 00:38:30,240 --> 00:38:31,460 You are the winner of this new award. 776 00:38:31,800 --> 00:38:32,520 Enjoy your Nokia. 777 00:38:33,200 --> 00:38:37,360 Then you think about these Nokia devices, and I'm sure Dave Attell will attest to this 778 00:38:37,360 --> 00:38:41,620 because he has a product based around it, is they run Linux, and so they can run your 779 00:38:41,620 --> 00:38:42,120 exploit tools. 780 00:38:42,540 --> 00:38:45,920 You can put a whole set of backdoors under one of those Nokia devices, hand it to the 781 00:38:45,920 --> 00:38:48,640 CEO, and give him directions of how to sync it to his network. 782 00:38:49,140 --> 00:38:51,360 He syncs it in, your backdoor runs, and everyone's happy. 783 00:38:52,680 --> 00:38:56,420 Another example I saw that was really neat is actually embedding an open WRT core into 784 00:38:56,420 --> 00:38:56,720 an e... 785 00:38:56,720 --> 00:38:57,560 UPS battery. 786 00:38:57,960 --> 00:38:59,200 So you rip the battery out. 787 00:38:59,240 --> 00:39:00,820 You put an open WRT core into it. 788 00:39:00,880 --> 00:39:02,020 You put an Ethernet switch into it. 789 00:39:02,140 --> 00:39:04,920 You plug it in, and you just walk into a building, throw it over your shoulder, and say, hey, 790 00:39:04,940 --> 00:39:05,700 I'm here to fix the printer. 791 00:39:06,240 --> 00:39:07,260 You go into the printer area. 792 00:39:07,440 --> 00:39:11,040 You unplug their UPS, if they have one, or you just put this one in line, and now you've 793 00:39:11,040 --> 00:39:12,340 got your own little Linux server on the network. 794 00:39:12,540 --> 00:39:13,060 So it's... 795 00:39:13,060 --> 00:39:15,360 I'm not going to take credit for the idea, but I think it's really cool, and definitely 796 00:39:15,360 --> 00:39:16,780 keep it in mind when doing physical tests. 797 00:39:17,940 --> 00:39:19,140 So on to the internal network. 798 00:39:20,240 --> 00:39:22,520 First of all, some NetBios names are magic. 799 00:39:22,740 --> 00:39:23,980 There's a name called WPAD. 800 00:39:24,140 --> 00:39:24,880 Anyone know what that means? 801 00:39:25,900 --> 00:39:26,260 No. 802 00:39:26,880 --> 00:39:27,240 Okay. 803 00:39:27,340 --> 00:39:28,280 Well, a couple folks do. 804 00:39:28,900 --> 00:39:31,840 So WPAD is like the web something auto-proxy discovery. 805 00:39:32,400 --> 00:39:34,560 Actually, web proxy auto-discovery, something like that. 806 00:39:36,020 --> 00:39:39,560 That's a name that's looked at by default by Internet Explorer when it's set up in its 807 00:39:39,560 --> 00:39:41,740 default configuration to automatically detect your proxies. 808 00:39:42,160 --> 00:39:45,760 So if you say, you know, automatically detect your proxy, it'll look for a host called WPAD. 809 00:39:46,120 --> 00:39:47,620 And actually, it'll... 810 00:39:47,620 --> 00:39:48,740 There's been different bugs with it. 811 00:39:48,840 --> 00:39:49,700 We don't have time to cover it. 812 00:39:49,780 --> 00:39:54,120 But if you want to see a really funny website, go to WPAD.com, because for a long time, 813 00:39:54,120 --> 00:39:54,780 they received... 814 00:39:54,780 --> 00:39:56,900 They're actually the top-level WPAD server for the whole Internet. 815 00:39:57,440 --> 00:39:58,620 And they had fun with it. 816 00:39:59,300 --> 00:40:03,160 There's also another magic host named the CA license, which means if you have a host 817 00:40:03,160 --> 00:40:06,820 called this on the network, anybody running a CA product will try to connect you for licensing 818 00:40:06,820 --> 00:40:07,180 updates. 819 00:40:07,560 --> 00:40:09,060 And you can cause all kinds of hell. 820 00:40:10,300 --> 00:40:11,280 So the next step. 821 00:40:11,440 --> 00:40:15,340 So WPAD is magic, because you can exploit this web proxy auto-discovery technique. 822 00:40:15,600 --> 00:40:19,740 You can basically convince them to connect to your web server to figure out how to proxy 823 00:40:19,740 --> 00:40:21,140 their outbound connections, which is awesome. 824 00:40:21,500 --> 00:40:23,280 However, you can also do that via DHCP. 825 00:40:23,700 --> 00:40:24,100 If you want to do that, you can do that via DHCP. 826 00:40:24,120 --> 00:40:27,020 You can do that in the case where you've got a Microsoft DNS server running DHCP. 827 00:40:27,300 --> 00:40:31,940 You can do dhcpcd or dhclient with dash H option of WPAD, and it'll actually register 828 00:40:31,940 --> 00:40:33,700 your host name of WPAD in the local domain. 829 00:40:34,120 --> 00:40:35,360 So you can quickly back... 830 00:40:35,360 --> 00:40:35,780 Excuse me. 831 00:40:35,840 --> 00:40:39,620 You can quickly become the outbound web proxy for everybody in the local network with this 832 00:40:39,620 --> 00:40:40,020 one command. 833 00:40:40,260 --> 00:40:41,740 It's lots of fun on Microsoft networks. 834 00:40:42,860 --> 00:40:43,220 Next. 835 00:40:43,340 --> 00:40:46,340 So now we're going to talk about a practical example of hijacking NTLM to get a remote 836 00:40:46,340 --> 00:40:48,920 shell on a fully patched Windows XP Service Pack 2 system. 837 00:40:49,420 --> 00:40:50,600 And it's pretty straightforward. 838 00:40:51,440 --> 00:40:54,100 Yes, it's based on SAP Relay 2, but it's all done in Metasport. 839 00:40:54,120 --> 00:40:56,960 It's deployed in Chinese, and this is really old code, back in 99, 2001. 840 00:40:58,060 --> 00:41:00,400 But now I can do it, and I can read the code. 841 00:41:01,760 --> 00:41:03,680 So first thing you do is man in the middle of outbound traffic. 842 00:41:03,980 --> 00:41:04,940 Lots of different ways you can do it. 843 00:41:05,000 --> 00:41:05,800 We talked about WPAD. 844 00:41:05,940 --> 00:41:07,240 You can also just ARP spoof, et cetera. 845 00:41:07,800 --> 00:41:10,720 You can have a rogue access point to sit around the airport. 846 00:41:11,320 --> 00:41:12,060 What do you want to do? 847 00:41:12,200 --> 00:41:15,760 You can actually inject it into Tor connections and do this against Tor users, whatever you 848 00:41:15,760 --> 00:41:15,880 like. 849 00:41:16,720 --> 00:41:17,000 Next. 850 00:41:17,160 --> 00:41:18,900 You want to redirect them to an intranet website. 851 00:41:19,240 --> 00:41:22,280 And this is intranet in the sense that they'll still connect to you for the intranet side 852 00:41:22,280 --> 00:41:22,620 as well. 853 00:41:22,620 --> 00:41:28,160 Because you designed your proxy server to redirect all traffic, even internal traffic, 854 00:41:28,240 --> 00:41:28,660 back to yourself. 855 00:41:29,000 --> 00:41:30,560 What you do here is get around the zone bypass. 856 00:41:30,960 --> 00:41:33,640 So when they try to browse the internet site, you send them to an intranet site. 857 00:41:33,880 --> 00:41:39,720 And then from the intranet site, you go to this, which is actually a UNC link to an SMB 858 00:41:39,720 --> 00:41:40,040 share. 859 00:41:40,700 --> 00:41:44,640 So in IE 5, 6, and 7, you can just do an image source tag, backslash, backslash, IP, 860 00:41:44,820 --> 00:41:46,620 share name, something with JPEG. 861 00:41:46,760 --> 00:41:52,460 In Firefox, before 2005, you can just do mosaic on URL, colon, file, slash, slash, slash, 862 00:41:52,460 --> 00:41:52,540 slash. 863 00:41:52,880 --> 00:41:53,540 That's actually a bug. 864 00:41:53,660 --> 00:41:54,140 They fixed it. 865 00:41:54,220 --> 00:41:56,120 But they didn't fix the last case, which I'm not going to talk about. 866 00:41:56,960 --> 00:41:59,200 Finally, you can use third-party plug-ins to do the same thing. 867 00:41:59,300 --> 00:42:00,420 Force them to go to UNC URL. 868 00:42:00,700 --> 00:42:03,240 The goal here is to get them to do an SMB connection to your system. 869 00:42:03,860 --> 00:42:06,820 The reason for that is once they connect to your system, you can connect back to them. 870 00:42:08,180 --> 00:42:10,960 So when they connect to you, you connect back to them. 871 00:42:11,000 --> 00:42:11,840 You ask them for their challenge. 872 00:42:11,940 --> 00:42:13,180 Say, hey, I've got this cool challenge key. 873 00:42:13,340 --> 00:42:14,420 Why don't you authenticate against it? 874 00:42:14,500 --> 00:42:15,140 And they go and do that. 875 00:42:15,600 --> 00:42:16,440 And you pass it back. 876 00:42:16,520 --> 00:42:17,280 And now they're authenticated. 877 00:42:17,780 --> 00:42:19,080 And this actually works really well. 878 00:42:19,220 --> 00:42:20,040 Like it's not a trick. 879 00:42:20,140 --> 00:42:20,620 It's not a bug. 880 00:42:20,760 --> 00:42:21,300 It's not anything else. 881 00:42:21,300 --> 00:42:22,860 That's just how SMB authentication works. 882 00:42:23,420 --> 00:42:25,480 If you don't have sign-in enabled and a couple other caveats. 883 00:42:25,660 --> 00:42:27,440 But it works on most systems by default. 884 00:42:28,080 --> 00:42:30,640 So finally, now you've got an authenticated SMB connection on their system. 885 00:42:30,840 --> 00:42:31,900 You disconnect them. 886 00:42:32,060 --> 00:42:34,480 You keep the authenticated session and use that to connect to admin dollar. 887 00:42:34,720 --> 00:42:36,260 Upload your shellcode inside of executable. 888 00:42:36,520 --> 00:42:39,180 Then use the service control manager to start that shellcode as a service. 889 00:42:39,320 --> 00:42:40,600 And then enjoy your remote shell. 890 00:42:41,460 --> 00:42:42,580 And that's all there is to it. 891 00:42:42,620 --> 00:42:43,220 It's pretty damn simple. 892 00:42:43,360 --> 00:42:44,000 And it works. 893 00:42:44,060 --> 00:42:44,680 So I'll show you. 894 00:42:45,960 --> 00:42:48,520 So over here we've got a Windows XP Service Pack 2 system. 895 00:42:48,680 --> 00:42:50,300 It's fully patched as of this morning. 896 00:42:50,360 --> 00:42:51,200 There's nothing fancy with it. 897 00:42:51,300 --> 00:42:53,600 It even has the firewall turned on, but it does have file sharing enabled. 898 00:42:54,040 --> 00:42:55,240 It's also joined to a domain. 899 00:42:56,240 --> 00:42:58,960 So that's one of the caveats you have to do to exploit XPSP2. 900 00:42:59,240 --> 00:43:02,800 And the user has to have a password set, which is also pretty common in a domain or 901 00:43:02,800 --> 00:43:03,340 corporate environment. 902 00:43:04,240 --> 00:43:06,780 So what we're going to do back over here is... 903 00:43:07,220 --> 00:43:07,680 That's good. 904 00:43:07,820 --> 00:43:08,020 Okay. 905 00:43:08,060 --> 00:43:09,100 So here's a little shell script. 906 00:43:10,400 --> 00:43:15,580 What a shell script does is it starts up a NetBIOS named even, which basically advertises 907 00:43:15,580 --> 00:43:16,540 my name as WPAD. 908 00:43:16,640 --> 00:43:17,880 And you can do this a billion other ways too. 909 00:43:17,960 --> 00:43:18,840 This is an easy way to do it. 910 00:43:19,180 --> 00:43:20,280 Next, we're going to start up Apache. 911 00:43:20,520 --> 00:43:21,280 And Apache is going to start up. 912 00:43:21,300 --> 00:43:25,780 It's going to serve a file called WPAD.dat, and that file is going to have, let's see, 913 00:43:26,920 --> 00:43:30,140 one little JavaScript function in it that says, no matter where you try to connect to, 914 00:43:30,220 --> 00:43:31,660 go through me as your SOC server. 915 00:43:32,080 --> 00:43:33,820 So we just return SOC to this little syntax. 916 00:43:34,060 --> 00:43:38,900 You can look up a lot of stuff about WPAD, great Wikipedia article, if you want to learn 917 00:43:38,900 --> 00:43:39,080 more. 918 00:43:39,480 --> 00:43:41,940 So the next thing we'll do is run MSF console with this RC file. 919 00:43:42,660 --> 00:43:47,100 This RC file runs a fake SOC server, so we become that SOC server, which will then, 920 00:43:47,120 --> 00:43:50,940 no matter what page they request, will return the image source, you go backslash, backslash, 921 00:43:50,940 --> 00:43:52,260 UNC URL, it's my SMB server. 922 00:43:52,640 --> 00:43:54,860 And then we run our SMB relay exploit. 923 00:43:55,200 --> 00:43:58,760 And this thing will use the shell reverse TCP payload and use that as a payload if they 924 00:43:58,760 --> 00:43:59,160 connect in. 925 00:43:59,600 --> 00:44:00,920 So we're just going to go ahead and run that. 926 00:44:01,100 --> 00:44:05,160 So MSF console, dash R, the RC file, there we go. 927 00:44:05,940 --> 00:44:07,140 So this cycle will run up. 928 00:44:16,260 --> 00:44:18,960 So while that's chewing through, I'm going to go ahead and on a command shell over here, 929 00:44:19,040 --> 00:44:20,740 I'm going to show that if I type ping WPAD. 930 00:44:20,940 --> 00:44:24,160 It's going to resolve to that host, and it's doing that via NetBios. 931 00:44:25,400 --> 00:44:28,660 So if you're on the same local network as any Windows box, you can do the WPAD method, 932 00:44:28,880 --> 00:44:29,860 and I am an idiot. 933 00:44:30,680 --> 00:44:31,560 Set that up, all right. 934 00:44:32,680 --> 00:44:33,660 So here we go. 935 00:44:33,780 --> 00:44:35,000 So now the exploit's running. 936 00:44:35,120 --> 00:44:38,620 You can see we said L host, L port, normal variables, everything's going here. 937 00:44:38,720 --> 00:44:39,420 It's all running in the background. 938 00:44:40,000 --> 00:44:43,320 So now from the vulnerable XP system, what we're going to do is try to browse the internet. 939 00:44:43,800 --> 00:44:46,620 So go www.midgetsex.com. 940 00:44:48,540 --> 00:44:49,180 Who knows? 941 00:44:49,260 --> 00:44:50,000 There could be something cool there. 942 00:44:50,980 --> 00:44:52,160 Hopefully it doesn't actually exist. 943 00:44:54,880 --> 00:44:55,400 All right. 944 00:44:55,440 --> 00:44:56,640 So now you can see it says waiting for. 945 00:44:56,800 --> 00:45:00,240 What happened is it went out, connected to my Apache web server, downloaded WPAD.dat, 946 00:45:00,420 --> 00:45:02,040 then decided to connect to my SOX proxy. 947 00:45:02,140 --> 00:45:04,260 My SOX proxy said, yes, you have connected to Midgetsex. 948 00:45:04,840 --> 00:45:05,200 Welcome. 949 00:45:05,440 --> 00:45:09,480 And then it served up an HTML page that basically just had a UNC URL. 950 00:45:09,720 --> 00:45:13,200 And now in the background now, it's trying to negotiate SMB to my SMB relay agent. 951 00:45:13,380 --> 00:45:16,340 My SMB relay agent's connecting back to them and owning the crap out of it. 952 00:45:17,200 --> 00:45:19,140 So here we see all kinds of crap. 953 00:45:20,940 --> 00:45:25,140 So we see here's the authenticating in, we're saying, your authentication failed, give me 954 00:45:25,140 --> 00:45:25,660 a real password. 955 00:45:25,980 --> 00:45:27,580 It goes, okay, here's a real password. 956 00:45:28,220 --> 00:45:29,020 Thank you, drive through. 957 00:45:30,020 --> 00:45:33,420 So we authenticated, we connect to admin, share, upload our shellcode, do that, do that, 958 00:45:33,420 --> 00:45:33,680 do that. 959 00:45:34,040 --> 00:45:36,320 Here we see in our console, we actually got a shell. 960 00:45:37,160 --> 00:45:39,920 And Windows went ahead and tried to keep doing it a few other times. 961 00:45:40,060 --> 00:45:42,180 We said, nah, we already got a shell on you, we'll leave you alone for now. 962 00:45:42,980 --> 00:45:46,220 So now on your console, which you can have multiple background shells, do an entire network 963 00:45:46,220 --> 00:45:50,120 at once if you feel like, sessions-shell, you say, hey, we got a session, session-i1. 964 00:45:50,260 --> 00:45:50,540 We're going to do that. 965 00:45:50,580 --> 00:45:50,860 We're going to do that. 966 00:45:50,860 --> 00:45:51,500 There we go. 967 00:45:51,640 --> 00:45:52,000 Session. 968 00:45:52,160 --> 00:45:53,660 So pretty straightforward. 969 00:46:05,620 --> 00:46:09,240 So just to prove that it actually is the right shell, echo, we, hello.txt. 970 00:46:09,400 --> 00:46:10,320 We go over here, look at the desktop. 971 00:46:10,860 --> 00:46:12,260 We see we got a broken image link. 972 00:46:12,820 --> 00:46:16,940 And now we go look on the desktop, we got hello.txt, and it says, we. 973 00:46:17,520 --> 00:46:18,040 All right. 974 00:46:19,180 --> 00:46:20,600 So we're running short. 975 00:46:20,860 --> 00:46:21,340 We're running short on time. 976 00:46:21,380 --> 00:46:23,900 And I don't want to take up any more of Val Smith's demo time. 977 00:46:24,000 --> 00:46:24,860 So let me get through this real quick. 978 00:46:25,420 --> 00:46:26,120 Back where we were. 979 00:46:27,740 --> 00:46:31,120 We've got a good 30 minutes worth of material still, but I think our time's up. 980 00:46:31,800 --> 00:46:32,540 Our time is up? 981 00:46:33,240 --> 00:46:33,680 All right. 982 00:46:33,680 --> 00:46:35,880 We will move our entire presentation into the QA room. 983 00:46:36,100 --> 00:46:37,380 So everybody cram in there.