1 00:00:07,540 --> 00:00:14,280 started. My name's Fyodor from insecure.org. Thanks for showing up. I think I have one 2 00:00:14,280 --> 00:00:18,540 of the more hardcore of DEF CON crowds here today. You know, so many people come on the 3 00:00:18,540 --> 00:00:22,580 weekends, but you guys managed to convince your bosses to let you skip a day at work, 4 00:00:22,720 --> 00:00:28,700 fly to Las Vegas, and attend this great hacker party. So congratulations on that. I was going 5 00:00:28,700 --> 00:00:34,000 to just come here and party as well, and not even speak. But then I saw this network 6 00:00:34,000 --> 00:00:39,180 reconnaissance track, and that got my attention, as it's a subject that is very near and dear 7 00:00:39,640 --> 00:00:45,380 to my heart, as I'm the author and maintainer of a security scanner called NMAP that you 8 00:00:45,380 --> 00:00:56,700 can use for these sorts of techniques. I'm also going to discuss... Sorry? I don't know 9 00:00:56,700 --> 00:00:58,620 if I can make it much louder, but I'll try my best. 10 00:01:02,740 --> 00:01:08,020 All right. I'm also going to discuss other great open source network security tools, 11 00:01:08,260 --> 00:01:14,720 such as the venerable HPing 2. Just so I can get an idea of the audience and how much introductory 12 00:01:14,720 --> 00:01:19,240 NMAP material I have to cover, could I get a show of hands for anyone here who has ever 13 00:01:19,240 --> 00:01:27,500 used NMAP? Okay, that's pretty much all of you, which is great, because I wrote far too 14 00:01:27,500 --> 00:01:27,880 much. 15 00:01:28,700 --> 00:01:33,500 I don't have time to fit in 50 minutes, but I'm going to do my best. So if I look rushed, 16 00:01:33,560 --> 00:01:33,940 that's why. 17 00:01:35,600 --> 00:01:44,040 We'll start with the disclaimers, of course. First of all, you'll notice, as opposed to 18 00:01:44,040 --> 00:01:49,840 many other presentations, we're using real host names and IP addresses here. Frankly, 19 00:01:49,960 --> 00:01:54,720 I sometimes get sick of seeing slide after slide of example.org, and this is a mock-up 20 00:01:54,720 --> 00:01:57,300 of a 192.168 network and so forth. 21 00:01:58,700 --> 00:02:04,540 I trust all you guys. You're not going to abuse the information. But more importantly, 22 00:02:04,720 --> 00:02:09,360 even if I didn't, this is really just public information scanning we're doing. You know, 23 00:02:09,380 --> 00:02:12,960 it's called network reconnaissance, and that's all we're doing. We're not going to be exploiting 24 00:02:12,960 --> 00:02:16,400 any hosts. We're not going to be getting root. We're just going to be rattling some 25 00:02:16,400 --> 00:02:22,140 doorknobs, maybe peeking in a window or two, you know. Also, I'm going to start with the 26 00:02:22,140 --> 00:02:27,180 basics as a foundation for kind of some of the more advanced stuff. So if five minutes 27 00:02:27,180 --> 00:02:28,680 from now you're saying, oh, man, I'm going to be using NMAP, I'm going to be using NMAP, 28 00:02:28,680 --> 00:02:33,020 man, I was doing this stuff back in eighth grade, well, you know, hopefully it'll get 29 00:02:33,020 --> 00:02:40,300 better. So let's just start from the beginning here. Our first step is going to be taking 30 00:02:40,300 --> 00:02:48,060 our target company or whatever. I don't remember if I mentioned that this talk is gained mostly 31 00:02:48,060 --> 00:02:54,020 to pen testers and such. So if you've got your client, the first thing you want to do 32 00:02:54,020 --> 00:02:58,080 is you might want to try DNS. You know, that's pretty obvious, right? Its whole point is to 33 00:02:58,680 --> 00:03:00,880 just try to get them to work and get their names changed to IP numbers. So first we'll 34 00:03:00,880 --> 00:03:05,340 grab just the low-hanging fruit, just the information that companies have to give us 35 00:03:05,340 --> 00:03:08,500 in order for, you know, their mail and such to work. 36 00:03:08,880 --> 00:03:15,900 So we use the dig command to grab kind of basic information from at stake, and you see 37 00:03:15,900 --> 00:03:20,880 name server records, MX records and the corresponding A records. They also have this bonus text 38 00:03:20,880 --> 00:03:26,080 record where security and business intersect. I think they're one of the few companies 39 00:03:26,080 --> 00:03:28,660 where they get so many probes that it makes them a little bit difficult to see where they 40 00:03:28,680 --> 00:03:31,220 sense to put advertisements in their DNS zone information. 41 00:03:33,560 --> 00:03:38,260 So what do we do next? Well, you know, let's try a zone transfer. Why not? You know, it 42 00:03:38,260 --> 00:03:42,620 may not always work, but when it does, you get a huge list of host names, IP address. 43 00:03:43,200 --> 00:03:47,500 You can get ideas of the functions of the hosts from their names, from their CNames. 44 00:03:48,340 --> 00:03:52,760 Poorly configured servers will give you vanity names that their sysadmin uses, far flung. 45 00:03:53,200 --> 00:03:57,720 Sometimes you even get internal network names, which is really bad, but that certainly doesn't 46 00:03:57,720 --> 00:04:04,160 mean it doesn't happen. And popular name servers such as Bind make this information 47 00:04:04,760 --> 00:04:09,800 available by default. So yes, a lot of people turn it off, but when it's on by default, 48 00:04:09,980 --> 00:04:12,820 we all know that at least half of them leave it as it is. 49 00:04:13,380 --> 00:04:19,120 So here's just an example where we grabbed a security focus zone, and you see a bunch 50 00:04:19,120 --> 00:04:26,220 of hosts here, which I've cut off due to space. To their credit, they didn't have those 51 00:04:26,220 --> 00:04:27,700 problems like, you know, internal network names, IP address, IP address, IP address, 52 00:04:27,700 --> 00:04:32,700 internal DNS, or far flung vanity names. But it still gives you a lot of IPs to start 53 00:04:32,700 --> 00:04:33,860 with in your reconnaissance. 54 00:04:35,220 --> 00:04:40,300 Another thing you want to try, of course, is the version number. And that's for one 55 00:04:40,300 --> 00:04:45,660 basic reason. As you all know, Bind has a long and sordid history of remotely exploitable 56 00:04:45,660 --> 00:04:50,320 security holes. So if they're running an insecure version, you can skip the rest of this reconnaissance 57 00:04:50,320 --> 00:04:56,240 stuff and go straight to owning their name server. The Bind people also have a useful 58 00:04:56,240 --> 00:04:56,580 page. 59 00:04:57,700 --> 00:05:01,520 It's a really easy scene that lists all the different security holes and the different 60 00:05:01,520 --> 00:05:04,120 versions of Bind that you can cross-reference to. 61 00:05:04,840 --> 00:05:09,620 When I tried a lot of popular companies, I got some interesting, flippant responses 62 00:05:09,620 --> 00:05:15,420 for a few. Playboy's version number is, move on, I'm already patched. K, thanks, bye. 63 00:05:17,460 --> 00:05:23,580 Philip Morris' parent, Altria, you are not cleared for that information. And Sans informed 64 00:05:23,580 --> 00:05:26,000 me that all accesses are logged. Damn. 65 00:05:27,780 --> 00:05:31,640 So I actually thought that these might be some good companies to take a further look 66 00:05:31,640 --> 00:05:38,820 at because A, they're large companies. They can afford security staff. B, they've obviously 67 00:05:38,820 --> 00:05:43,620 made at least some attempts at securing in that they rejected the zone transfers. They 68 00:05:43,620 --> 00:05:48,520 put flippant remarks in their version numbers and so forth. So I thought that would be more 69 00:05:48,520 --> 00:05:55,500 interesting than if we scan a totally open network. Well, duh. That's easy. So let's 70 00:05:55,500 --> 00:05:56,640 go ahead at other ways. 71 00:05:56,840 --> 00:05:57,680 I'm not going to talk about security. I'm not going to talk about security. I'm going 72 00:05:57,700 --> 00:06:01,100 to talk much about NetCraft. But just to mention that that's sometimes underutilized 73 00:06:01,100 --> 00:06:06,260 in gathering more information on the company. You can find domain names that are similar 74 00:06:06,260 --> 00:06:13,080 to the company names. They took away that? Bastards. 75 00:06:14,080 --> 00:06:19,460 But there's still plenty of great features that you can use, such as you can detail down 76 00:06:19,460 --> 00:06:26,940 on each one. And I'll talk to NetCraft. Narrow down on each one to get the uptime graphs. 77 00:06:27,700 --> 00:06:33,020 To get the hosting history and all sorts of goodies. And the great thing is that here 78 00:06:33,020 --> 00:06:37,380 you're totally anonymous since it's the NetCraft server you're querying and most of these are 79 00:06:37,380 --> 00:06:37,900 in their cache. 80 00:06:39,560 --> 00:06:45,020 The geographical IP registries are another place to start. Err and Ripe. AppNIC. Find 81 00:06:45,020 --> 00:06:51,440 the contact information, emails, phone numbers, etc. etc. And you can basically take the seed 82 00:06:51,440 --> 00:06:55,920 numbers that you got from the previous stuff, look up what networks they belong to, who 83 00:06:55,920 --> 00:07:01,940 administers them, what else that person administers, and keep cycling in this loop as you gain 84 00:07:01,940 --> 00:07:08,800 more and more IP addresses. Here's an example. We do a whois on Erin with the string at Microsoft.com. 85 00:07:09,240 --> 00:07:16,460 And again we see pages and pages. This only goes up to H of contacts there who we can 86 00:07:16,460 --> 00:07:20,880 not only find out what networks they run to find IPs, but we can save that information 87 00:07:20,880 --> 00:07:25,900 for further social engineering. Drill down on each one for their address and so forth. 88 00:07:27,160 --> 00:07:32,340 Here's another example. We're going to do Erin. And here we give the query n, look 89 00:07:32,340 --> 00:07:37,780 for net blocks, with the name Playboy in it. And indeed we get a whole bunch of responses. 90 00:07:38,480 --> 00:07:41,680 Now obviously companies can have similar names, so you want to go through and make 91 00:07:41,680 --> 00:07:46,940 sure, look up each record, check the address, make sure it corresponds. In this case it 92 00:07:46,940 --> 00:07:47,240 does. 93 00:07:48,660 --> 00:07:55,620 So obviously this part can't be comprehensive because there's any number of ways that you 94 00:07:55,920 --> 00:08:00,100 can find such things. One of the more fun ones though are the public route servers 95 00:08:00,560 --> 00:08:07,560 I've been looking at lately, such as traceroute.org gives you a list of Cisco boxes that have 96 00:08:07,560 --> 00:08:13,340 you're publicly able to connect to them and get full PGP routing information. So you can 97 00:08:13,340 --> 00:08:19,180 look up the AS numbers and so forth of the companies that you're interested in. And many 98 00:08:19,180 --> 00:08:20,420 more techniques that I won't cover. 99 00:08:20,580 --> 00:08:24,480 But the point of that was just so that we can get the IP addresses that we're interested 100 00:08:24,480 --> 00:08:25,020 in doing. 101 00:08:25,020 --> 00:08:26,640 For the reconnaissance on. 102 00:08:27,220 --> 00:08:32,560 So using some of those techniques, I called a bunch of networks from Playboy to use them 103 00:08:32,560 --> 00:08:38,620 as an example. Now I did exclude certain net blocks such as some of the gaming sites. 104 00:08:39,020 --> 00:08:43,000 Because if a key at CINO was to catch you scanning them, they're liable to break your 105 00:08:43,000 --> 00:08:43,440 kneecaps. 106 00:08:44,480 --> 00:08:46,120 So be careful with that. 107 00:08:47,220 --> 00:08:52,700 You can see here that these are in kind of CIDR notation. So you have a slash 20 here, 108 00:08:52,780 --> 00:08:54,700 that's 4,000 hosts. A slash 24. 109 00:08:55,140 --> 00:09:01,160 All the way down to here is just a .101 through 105. So that's only what, six hosts, or five. 110 00:09:04,340 --> 00:09:08,860 But Nmap takes it in this convenient format, so we can feed that in directly. 111 00:09:09,980 --> 00:09:13,820 So what are we going to start out with? Well, we don't want to start out with ringing all 112 00:09:13,820 --> 00:09:18,000 the bells and whistles and IDSs and so forth. So we're going to start simple with the cautious 113 00:09:18,000 --> 00:09:24,360 approach, which in Nmap I call the list scan. So we're going to say hyphen SL, do a list scan, 114 00:09:25,080 --> 00:09:28,560 output to a file, and I give it all these addresses that we just looked at. 115 00:09:28,840 --> 00:09:33,600 And here basically all it's doing is going through each one and doing a reverse DNS lookup 116 00:09:33,600 --> 00:09:35,880 on it. So we can kind of see what we're after. 117 00:09:36,120 --> 00:09:40,240 And this is important for a lot of reasons. For example, verification. You know, just 118 00:09:40,240 --> 00:09:44,240 because they own the IP blocks doesn't for sure mean that they're using them. They could 119 00:09:44,240 --> 00:09:49,040 be subletting to some other company some of the IPs. They could be sharing with some other 120 00:09:49,040 --> 00:09:54,140 company in the basement. And so this, at least, we can look up the names and make sure that 121 00:09:54,140 --> 00:09:55,000 there's nothing too out there. 122 00:09:55,020 --> 00:09:59,940 Also, sometimes from the names you can figure out what specific machines you might want 123 00:09:59,940 --> 00:10:05,080 to dig into for more information if you don't want to go after all of them for reasons of 124 00:10:05,080 --> 00:10:05,560 subtlety. 125 00:10:06,900 --> 00:10:11,500 So the next step, once we've done that, is the ping scan. We want to know which of these 126 00:10:11,500 --> 00:10:16,620 hosts are up and available. And so here I did the same thing. And a lot of people don't 127 00:10:16,620 --> 00:10:20,960 recognize how much more powerful the ping scanning techniques of Nmap have gotten recently. 128 00:10:21,600 --> 00:10:25,000 You know, there was a day on the internet where you could just send an ICMP, you know, 129 00:10:26,520 --> 00:10:31,240 echo request ping packet, and pretty much most of the machines that were up would respond 130 00:10:31,240 --> 00:10:36,680 happily. Nowadays, with so many filters and paranoia and such, you have to sometimes go 131 00:10:36,680 --> 00:10:41,620 a little bit further in probing the machines looking for any sort of response. So here 132 00:10:41,620 --> 00:10:54,940 we're saying do a ping scan, SP. Use SYN probes against port 22, 25, 53, 80, 113, and 31, 338. I just picked a big one because sometimes 133 00:10:55,020 --> 00:11:01,180 firewalls only deal with the lower ports. And that'll send a SYN request to each of those 134 00:11:01,180 --> 00:11:09,100 and expect a response back. Similarly, we do an ACK scan to a number of ports, expecting 135 00:11:09,100 --> 00:11:16,920 a reset back. And a relatively new feature is hyphen PU, which sends a UDP packet to 136 00:11:16,920 --> 00:11:24,040 the ports that we specify and expects an ICMP port unreachable back. If it gets that, then 137 00:11:24,040 --> 00:11:24,800 it knows that they're up. 138 00:11:25,020 --> 00:11:29,360 So you can specify pretty much an arbitrary combination of all these different ways to 139 00:11:29,360 --> 00:11:34,120 try and elicit some sort of response from the hosts so that we can narrow it down from 140 00:11:34,120 --> 00:11:40,220 the more than 4,000 that we had listed before. It also has PE, which is the traditional ping 141 00:11:40,220 --> 00:11:43,580 packet, and PM, which is an ICMP netmask request. 142 00:11:43,960 --> 00:11:49,780 And just for kicks, we set the source address on all the TCP and UDP probes to 53, because 143 00:11:49,780 --> 00:11:54,500 we've all seen once in a while some firewall admin will set up his new firewall, inexperienced 144 00:11:54,500 --> 00:11:54,840 firewall. 145 00:11:54,840 --> 00:12:01,000 And say, uh-oh, nothing's working. DNS responses aren't coming back. Well, there are right 146 00:12:01,000 --> 00:12:05,440 ways to fix it, and then there are easy ways to fix it. And a lot of people have picked 147 00:12:05,440 --> 00:12:11,120 the, well, we'll just allow source port 53. No one's going to notice that. What are the 148 00:12:11,120 --> 00:12:16,460 chances the probes will come from there? So we put it there just in case it might work. 149 00:12:16,600 --> 00:12:23,620 Other popular choices would be TCP port 20, because you have the same case with FTP connections 150 00:12:23,620 --> 00:12:24,240 coming back. 151 00:12:26,300 --> 00:12:32,720 And so we run that command, and it completes, and it said that of those 4,393 IP addresses, 152 00:12:33,460 --> 00:12:36,860 there are 950 of them up. I just showed a few examples here. 153 00:12:37,600 --> 00:12:43,180 But with any tool, even Nmap, you want to make sure that you verify your results. Go 154 00:12:43,180 --> 00:12:47,800 through and look at the output file, and make sure that everything makes sense. So here, 155 00:12:47,960 --> 00:12:54,200 I look at the machine-readable output, which is what we see in front of us, and I see hundreds 156 00:12:54,200 --> 00:12:54,700 of machines. 157 00:12:54,840 --> 00:12:58,700 And I see a bunch of machines, consecutive, that all look like they're up. And you know, 158 00:12:58,720 --> 00:13:01,580 that's a little bit suspicious, because you would think if they were real machines, you 159 00:13:01,580 --> 00:13:05,740 would see a gap in somewhere. I mean, yeah, it could, and they don't even have reverse 160 00:13:05,740 --> 00:13:12,040 DNS. So yeah, it could be a cluster of machines that's very thick, but you kind of want to 161 00:13:12,040 --> 00:13:15,920 look into it more to make sure you don't waste too much time on machines that aren't really 162 00:13:15,920 --> 00:13:22,040 reachable. So one way to figure that out is say, well, which of these ping probes were 163 00:13:22,040 --> 00:13:24,120 those alleged up hosts responding to? 164 00:13:24,840 --> 00:13:32,760 And so Nmap is a feature, not added too long ago, hyphen hyphen packet trace, which will 165 00:13:32,760 --> 00:13:37,280 show you all the packets Nmap sends and receives. So we do a command just like the one before, 166 00:13:37,440 --> 00:13:42,720 but instead we just pick one of those possibly phantom hosts to look at and see what it's 167 00:13:42,720 --> 00:13:47,520 really responding to. So we see the ping request, the UDP request, the TCP SYNS, TCP 168 00:13:47,520 --> 00:13:53,600 AXE, and then down at the bottom here, you see this receive line saying that it's receiving 169 00:13:53,600 --> 00:13:54,540 a TCP reset. 170 00:13:54,840 --> 00:14:00,960 That's the TCP reset from port 113 from the host. Now, those of you, again, who do firewalls 171 00:14:00,960 --> 00:14:06,340 know that 113 or the IDENTD port is also an annoying one. You set up your firewall 172 00:14:06,340 --> 00:14:10,800 to block incoming connections, and then one of your users connects to a mail server or 173 00:14:10,800 --> 00:14:17,580 an IRC server, and it tries to connect right back to 113 to figure out what user is owning 174 00:14:17,580 --> 00:14:23,020 that connection. And if your firewall is blocking it, that can take a long time to time out 175 00:14:23,020 --> 00:14:24,240 and frustrate your users. 176 00:14:24,840 --> 00:14:29,360 And again, that leaves the admin with several possible options, and they don't always choose 177 00:14:29,360 --> 00:14:34,600 the right one. Sometimes they say, well, you know, we'll allow 113. It's only IDENTD. You 178 00:14:34,600 --> 00:14:38,840 know, what harm can it be? And that way it'll actually work. With newer firewalls, most 179 00:14:38,840 --> 00:14:43,640 of the modern ones, you can say spoof reset so that it looks like the machine is there 180 00:14:43,640 --> 00:14:50,200 and listening and just stopping the port 113 without having a long time out. And so that 181 00:14:50,200 --> 00:14:54,280 leaves us in a quandary. We don't really know. You know, is the firewall here blocking 182 00:14:54,840 --> 00:15:02,420 the port and spoofing this packet allegedly from 140.226, or did we find a hole that allows 183 00:15:02,420 --> 00:15:03,980 us to reach the machine behind it? 184 00:15:04,700 --> 00:15:09,220 And so you might want to think a little bit about, if you were doing this scan, you know, 185 00:15:09,220 --> 00:15:14,080 what methods would you use to determine what's really going on there? And I'll demonstrate 186 00:15:14,080 --> 00:15:18,620 a couple ideas, and then maybe you'll have some of your own ideas afterward. 187 00:15:19,900 --> 00:15:24,820 So one thing we could try is the IP ID. As most of you know, every IP ID is an IP ID. 188 00:15:24,820 --> 00:15:30,240 Every IP packet in the header has an ID flag that's used for fragmentation reassembly, 189 00:15:30,320 --> 00:15:37,260 so it can figure out what IP packet a fragment belongs to. And so one thing with IP ID, 190 00:15:37,420 --> 00:15:41,960 though, is that implementers have a lot of leeway in how they implement it. So they generally 191 00:15:41,960 --> 00:15:48,480 do the easy approach of just using a counter that goes from zero to 65, 5, 35, and then 192 00:15:48,480 --> 00:15:54,460 back to zero again. With each packet they send, they increment it by one. Other, a 193 00:15:54,820 --> 00:15:58,260 lot of other hosts use different techniques. So we're going to use the great HPing utility, 194 00:15:58,600 --> 00:16:04,240 which you probably all have, and if not, I stuck it on the DEF CON CD, to do a probe 195 00:16:04,920 --> 00:16:10,480 to port 113, a SYN probe on that machine. And we look at the responses with a particular 196 00:16:10,480 --> 00:16:17,600 emphasis on the IP ID that's in red. So for this first host, we see it's 4,700, 57,900, 197 00:16:18,680 --> 00:16:24,800 9,400. It's a pretty random-looking distribution. And then we try another one of these, and 198 00:16:24,820 --> 00:16:29,820 we look again, and shucks, it is another random-looking distribution. 199 00:16:30,400 --> 00:16:38,860 If we had seen that this one was incrementing from 47,93 to 47,94 to 47,95, and this one 200 00:16:38,860 --> 00:16:44,800 was like 53,009, 53,010, you know, we would know that they were probably different machines, 201 00:16:45,100 --> 00:16:50,360 because they're both incrementing, but they're on a totally different phase there. In the 202 00:16:50,360 --> 00:16:54,800 same way, you could send a bunch of packets to one, and see if it increments the IP address, 203 00:16:54,820 --> 00:16:56,780 idea of the other. Or if this one 204 00:16:56,780 --> 00:16:58,660 was random and this one was sequential, again 205 00:16:58,660 --> 00:16:59,960 we'd see that it was something different. 206 00:17:00,360 --> 00:17:02,580 But unfortunately this hasn't fully worked for us 207 00:17:02,580 --> 00:17:04,420 because they're both random. 208 00:17:04,620 --> 00:17:06,720 And that tells us that it's probably a 209 00:17:06,720 --> 00:17:08,720 firewall since they're the ones that usually do that. 210 00:17:08,980 --> 00:17:10,760 But systems like OpenBSD 211 00:17:10,760 --> 00:17:11,560 will do it too. 212 00:17:12,180 --> 00:17:14,740 So this leads credence to the idea that the firewall 213 00:17:14,740 --> 00:17:15,840 is sending the packet back. 214 00:17:16,120 --> 00:17:18,460 But it could be a cluster of OpenBSD 215 00:17:19,000 --> 00:17:20,260 machines behind there. 216 00:17:20,380 --> 00:17:21,040 You never know. 217 00:17:21,500 --> 00:17:23,320 So let's try something else then. 218 00:17:23,320 --> 00:17:25,420 And maybe traceroute will help us. 219 00:17:28,180 --> 00:17:29,620 So we do a traceroute 220 00:17:30,340 --> 00:17:31,780 to their mail server 221 00:17:31,780 --> 00:17:34,240 mx.shy.playboy.com 222 00:17:34,240 --> 00:17:36,160 and I'm using the normal 223 00:17:36,160 --> 00:17:36,880 traceroute command. 224 00:17:37,160 --> 00:17:39,780 And we see that it goes from San Jose to Chicago 225 00:17:39,780 --> 00:17:41,520 to the Playboy network 226 00:17:41,520 --> 00:17:44,160 and then it stops at this f0-0 227 00:17:44,160 --> 00:17:45,300 and it's filtered 228 00:17:45,300 --> 00:17:47,200 and so we're not able to see 229 00:17:47,670 --> 00:17:49,440 the destination host at all. 230 00:17:50,060 --> 00:17:50,440 So 231 00:17:51,300 --> 00:17:53,120 10 hops really isn't a lot. 232 00:17:53,120 --> 00:17:55,000 We would like to get all the way to the destination host. 233 00:17:55,360 --> 00:17:57,100 So instead we're going to do a more custom 234 00:17:57,100 --> 00:17:58,840 traceroute against the machine. 235 00:18:00,200 --> 00:18:01,400 Using HP2 again 236 00:18:01,400 --> 00:18:02,340 it's traceroute mode. 237 00:18:02,780 --> 00:18:04,880 We do a traceroute to port 25 238 00:18:04,880 --> 00:18:06,080 because this is a mail server. 239 00:18:06,420 --> 00:18:08,940 So that instead of using the default UDP probe 240 00:18:08,940 --> 00:18:11,140 that gets filtered, hopefully the SYN packet 241 00:18:11,140 --> 00:18:13,280 to port 25 will make it 242 00:18:13,280 --> 00:18:14,100 all the way to the server 243 00:18:14,100 --> 00:18:16,200 so that mailers can make connections. 244 00:18:16,800 --> 00:18:18,360 And here we see it gets to 10. 245 00:18:18,820 --> 00:18:19,940 11 no response. 246 00:18:20,500 --> 00:18:22,880 But 12 all of a sudden we get a TTL. 247 00:18:23,120 --> 00:18:26,160 From this fw.chi.playboy.com 248 00:18:26,160 --> 00:18:27,420 I have to 249 00:18:27,420 --> 00:18:29,120 yeah, I have to thank them for the great naming. 250 00:18:29,280 --> 00:18:29,780 It's really helpful. 251 00:18:29,980 --> 00:18:32,300 Their firewall is fw, it's in Chicago. 252 00:18:32,640 --> 00:18:34,220 Their mail server is mx.chi. 253 00:18:35,480 --> 00:18:36,680 You know, that's real convenient 254 00:18:36,680 --> 00:18:37,800 and I do appreciate it. 255 00:18:41,120 --> 00:18:42,640 And then we get a response 256 00:18:42,640 --> 00:18:44,860 from the actual host, 13 hops away. 257 00:18:45,460 --> 00:18:46,880 So that tells us that 258 00:18:47,920 --> 00:18:49,420 we know that the end host 259 00:18:49,420 --> 00:18:50,800 is apparently 13 hosts away 260 00:18:50,800 --> 00:18:52,960 and we can get the response by going 261 00:18:52,960 --> 00:18:53,600 to port 25. 262 00:18:55,100 --> 00:18:57,700 So now we'll try port 113 263 00:18:58,220 --> 00:18:59,880 which is the port that was giving us trouble 264 00:18:59,880 --> 00:19:00,900 against the same host. 265 00:19:01,080 --> 00:19:03,000 And here we get to 10 like usual. 266 00:19:03,240 --> 00:19:04,420 11 gives us nothing. 267 00:19:04,740 --> 00:19:06,500 But this time we're getting the response 268 00:19:06,500 --> 00:19:08,540 from the host at hop number 12. 269 00:19:09,740 --> 00:19:10,940 Whereas last time 270 00:19:10,940 --> 00:19:11,980 that's where the firewall was. 271 00:19:12,320 --> 00:19:13,940 And the real host was on 13. 272 00:19:14,820 --> 00:19:16,920 So this pretty here gives us enough 273 00:19:16,920 --> 00:19:18,660 evidence to close the deal 274 00:19:19,760 --> 00:19:21,080 that it's really the firewall 275 00:19:21,080 --> 00:19:22,360 that's at hop 12. 276 00:19:22,360 --> 00:19:24,080 But it's just spoofing the packet 277 00:19:24,080 --> 00:19:26,720 to make it look like it's coming from 143.2 278 00:19:27,460 --> 00:19:29,000 and it's sending a reset. 279 00:19:29,300 --> 00:19:30,400 And so that means we probably 280 00:19:30,400 --> 00:19:31,920 can't reach the machines at all. 281 00:19:34,160 --> 00:19:35,800 Does anyone have other ideas? 282 00:19:35,880 --> 00:19:37,200 Suppose this hadn't worked 283 00:19:37,200 --> 00:19:39,160 and the IPID failed as it did 284 00:19:39,160 --> 00:19:40,740 and the trace route had failed too. 285 00:19:41,120 --> 00:19:42,280 What other techniques do you think 286 00:19:42,280 --> 00:19:43,640 we could have used to try and determine 287 00:19:44,840 --> 00:19:46,640 whether the host is spoofing 288 00:19:46,640 --> 00:19:47,700 the packet is alive 289 00:19:47,700 --> 00:19:49,320 or whether it's a firewall spoofing? 290 00:19:50,420 --> 00:19:51,320 ISM rollback? 291 00:19:52,360 --> 00:19:52,920 ISN prober? 292 00:20:02,060 --> 00:20:03,300 Okay, that's great. 293 00:20:03,360 --> 00:20:05,460 He's suggesting a good tool called ISN prober 294 00:20:05,460 --> 00:20:06,720 which I haven't personally used. 295 00:20:06,960 --> 00:20:09,280 But instead of checking the IPID sequences 296 00:20:09,860 --> 00:20:12,380 they would have checked the TCP ISN sequences. 297 00:20:12,840 --> 00:20:13,980 And so if it was like 298 00:20:13,980 --> 00:20:16,420 a 64K rule or Windows time dependent 299 00:20:16,420 --> 00:20:17,160 or such 300 00:20:18,040 --> 00:20:20,160 we could see that they're on 301 00:20:20,160 --> 00:20:22,340 totally different phases or use different algorithms. 302 00:20:22,360 --> 00:20:24,240 What other techniques do you think 303 00:20:24,240 --> 00:20:24,720 you could use? 304 00:20:26,320 --> 00:20:26,760 Sure. 305 00:20:27,220 --> 00:20:27,900 Time to lift? 306 00:20:28,860 --> 00:20:30,040 Time to lift, yeah. 307 00:20:30,520 --> 00:20:32,120 You mean like we were doing here? 308 00:20:38,100 --> 00:20:38,540 Right. 309 00:20:39,640 --> 00:20:41,200 Yeah, I think that's what we're doing here 310 00:20:41,200 --> 00:20:42,660 where we see that since it's 12 311 00:20:42,660 --> 00:20:44,760 we know that it's spoofing it on the TTL 312 00:20:44,760 --> 00:20:46,440 and since it's 13 313 00:20:47,240 --> 00:20:48,600 we know that it's not. 314 00:20:49,580 --> 00:20:50,740 Anyone have other ideas? 315 00:20:54,660 --> 00:20:55,400 NBT stat? 316 00:20:57,900 --> 00:20:58,600 Okay, yeah. 317 00:20:58,660 --> 00:20:59,920 So if it's like a Windows host 318 00:20:59,920 --> 00:21:01,620 and it had those ports open 319 00:21:01,620 --> 00:21:02,940 you could try that. 320 00:21:03,360 --> 00:21:05,260 Hopefully they wouldn't put their mail server on there 321 00:21:05,260 --> 00:21:06,600 but some people do. 322 00:21:20,180 --> 00:21:21,880 Okay, that's another great idea. 323 00:21:22,060 --> 00:21:23,160 See, there are a lot of ways to do it. 324 00:21:23,200 --> 00:21:24,820 His suggestion for people who didn't hear 325 00:21:24,820 --> 00:21:27,380 was to do an OS fingerprint such as nmap-o 326 00:21:27,380 --> 00:21:30,000 and see if they match. 327 00:21:30,420 --> 00:21:32,280 Another technique for anyone who's read 328 00:21:32,280 --> 00:21:34,140 Frac 60, someone wrote 329 00:21:34,140 --> 00:21:35,540 a real good paper on 330 00:21:36,280 --> 00:21:37,240 bad checksums. 331 00:21:37,600 --> 00:21:39,560 They found that many firewalls 332 00:21:39,560 --> 00:21:41,780 configured this way to respond to packets 333 00:21:41,780 --> 00:21:43,360 wouldn't even look at the checksum 334 00:21:43,360 --> 00:21:46,020 and would respond regardless of whether 335 00:21:46,020 --> 00:21:47,000 the checksum is valid. 336 00:21:48,600 --> 00:21:50,360 A decent end host, even a Windows host 337 00:21:50,360 --> 00:21:52,260 is going to just drop that packet on the floor. 338 00:21:52,540 --> 00:21:54,420 So if we had sent our sin packets 339 00:21:54,420 --> 00:21:55,140 from a 340 00:21:55,140 --> 00:21:58,260 if we had sent it with a bad checksum 341 00:21:58,260 --> 00:21:59,360 and didn't get a response 342 00:22:00,380 --> 00:22:02,680 there's a good chance that the host was receiving it. 343 00:22:02,780 --> 00:22:04,620 Whereas if we got a response to a bad 344 00:22:04,620 --> 00:22:06,380 checksum, we'd be pretty certain 345 00:22:06,380 --> 00:22:08,440 that it's the firewall since no 346 00:22:08,440 --> 00:22:09,860 host would do that. 347 00:22:10,940 --> 00:22:12,620 So that's just an example of how 348 00:22:12,620 --> 00:22:14,800 there are a lot of means in your pen testing 349 00:22:14,800 --> 00:22:16,720 to achieve the same ends 350 00:22:16,720 --> 00:22:18,300 and sometimes you'll get frustrated 351 00:22:18,600 --> 00:22:19,420 by the first couple tries. 352 00:22:20,560 --> 00:22:22,120 But if you think about it 353 00:22:22,120 --> 00:22:23,640 you can often find ways to get around 354 00:22:23,640 --> 00:22:24,760 these problems. 355 00:22:25,720 --> 00:22:27,800 A side note on host names real quick. 356 00:22:27,980 --> 00:22:30,300 We noticed that mx.chai 357 00:22:30,300 --> 00:22:31,940 and fwchai were well named. 358 00:22:32,760 --> 00:22:34,620 Security focus wasn't quite as kind. 359 00:22:34,900 --> 00:22:36,640 I was looking through the zone transfer 360 00:22:36,640 --> 00:22:38,340 and saw bugzilla and I thought 361 00:22:38,340 --> 00:22:39,780 hey I know that bug tracking system. 362 00:22:39,980 --> 00:22:41,760 I know an exploit for that. 363 00:22:42,200 --> 00:22:44,140 And so I tell it in and instead 364 00:22:44,140 --> 00:22:46,140 I get this Raptor secure firewall gateway 365 00:22:46,140 --> 00:22:46,940 and so forth. 366 00:22:48,600 --> 00:22:49,680 It does assume that it's going to be 367 00:22:50,520 --> 00:22:52,600 exactly as they say. 368 00:22:53,080 --> 00:22:54,540 Host names go out of date 369 00:22:54,540 --> 00:22:55,880 they may be trying to trick you 370 00:22:56,500 --> 00:22:57,700 or for whatever other reason. 371 00:22:59,040 --> 00:23:00,520 So now the whole point 372 00:23:00,520 --> 00:23:02,660 of that exercise of finding out the 1.1.3 373 00:23:02,660 --> 00:23:04,420 thing is that now we can redo 374 00:23:04,420 --> 00:23:06,080 our ping scan and this time 375 00:23:06,080 --> 00:23:07,520 1.1.3 is out of the picture 376 00:23:07,520 --> 00:23:10,240 because we know that it's giving us unreliable results. 377 00:23:10,740 --> 00:23:12,180 And this time we only see 378 00:23:12,180 --> 00:23:13,340 71 hosts up 379 00:23:13,940 --> 00:23:16,300 as opposed to the 950 that we got 380 00:23:16,300 --> 00:23:16,640 before. 381 00:23:18,600 --> 00:23:20,820 And so that's a much more manageable number 382 00:23:20,820 --> 00:23:22,080 for us to deal with. 383 00:23:22,680 --> 00:23:24,600 So I just use a quick easy command 384 00:23:24,600 --> 00:23:26,120 to grab all the IP addresses 385 00:23:26,600 --> 00:23:27,800 from our nmap log 386 00:23:27,800 --> 00:23:29,160 and put them in a file. 387 00:23:29,480 --> 00:23:31,860 And I also added that fw.chai 388 00:23:31,860 --> 00:23:33,960 because the filtering on that was good enough 389 00:23:33,960 --> 00:23:36,540 that it didn't respond to any of our ping probes. 390 00:23:37,380 --> 00:23:38,680 However thanks to the little 391 00:23:38,680 --> 00:23:39,660 expedition we did 392 00:23:39,660 --> 00:23:41,340 we found it via the 393 00:23:42,120 --> 00:23:44,320 custom trace route and so of course 394 00:23:44,320 --> 00:23:45,240 we want to scan it too. 395 00:23:46,700 --> 00:23:48,160 So now I'm going to move to 396 00:23:48,600 --> 00:23:50,180 a slightly different tangent. 397 00:23:50,280 --> 00:23:51,840 We'll go back to those later. 398 00:23:53,640 --> 00:23:54,660 Sometimes what you 399 00:23:54,660 --> 00:23:56,440 really want to do is do a fast 400 00:23:56,440 --> 00:23:57,480 single service sweep. 401 00:23:57,840 --> 00:24:00,240 So hypothetically suppose there was a huge 402 00:24:00,240 --> 00:24:02,360 Windows RPC decom exploit 403 00:24:02,360 --> 00:24:03,300 on the loose 404 00:24:03,300 --> 00:24:06,380 and you wanted to scan all your 405 00:24:06,380 --> 00:24:08,560 systems really fast before the attackers 406 00:24:08,560 --> 00:24:10,780 do for port 1.1.3.5 407 00:24:10,780 --> 00:24:12,480 of course it can potentially 408 00:24:12,480 --> 00:24:14,680 be exploited on other ports but that's the main one. 409 00:24:16,100 --> 00:24:16,860 And so 410 00:24:16,860 --> 00:24:18,780 nmap has what I call a turbo mode 411 00:24:18,780 --> 00:24:20,840 that supports that to make it really fast. 412 00:24:21,140 --> 00:24:22,220 Now for Playboy 413 00:24:22,220 --> 00:24:24,000 I'm not going to scan 1.3.5. 414 00:24:24,280 --> 00:24:26,280 Given the nature of their sites I decided 415 00:24:26,280 --> 00:24:27,660 I wanted to find web servers. 416 00:24:29,900 --> 00:24:30,680 And so 417 00:24:30,680 --> 00:24:31,360 here we're 418 00:24:31,980 --> 00:24:34,380 say do a sin probe to port 80 419 00:24:34,380 --> 00:24:36,020 do a sin scan 420 00:24:36,020 --> 00:24:38,240 and we want to scan for port 80. 421 00:24:38,500 --> 00:24:40,720 And nmap will be smart enough to say 422 00:24:40,720 --> 00:24:42,500 hey you know 423 00:24:42,500 --> 00:24:44,620 the ping probe is already sending a sin packet 424 00:24:44,620 --> 00:24:46,320 and getting a reset or a sin ack. 425 00:24:46,860 --> 00:24:47,740 So I skip the whole port scan 426 00:24:47,740 --> 00:24:49,560 and just use the ping probe results 427 00:24:50,020 --> 00:24:51,300 to give you what you need. 428 00:24:51,760 --> 00:24:53,560 And so this was able to scan those 429 00:24:54,760 --> 00:24:55,580 4397 hosts 430 00:24:56,040 --> 00:24:58,560 in just a little under a minute. 431 00:24:59,480 --> 00:25:00,720 Which can be handy. 432 00:25:01,200 --> 00:25:02,560 Sometimes I get emails 433 00:25:02,560 --> 00:25:03,780 from people saying dude 434 00:25:03,780 --> 00:25:06,200 nmap is so slow I wrote my own scanner 435 00:25:06,200 --> 00:25:08,400 and it can scan a class B 436 00:25:08,400 --> 00:25:09,500 in 10 seconds 437 00:25:09,500 --> 00:25:11,820 and it's only 20 lines of code. 438 00:25:12,300 --> 00:25:14,540 It's just a for loop that goes 439 00:25:14,540 --> 00:25:16,300 through and send, send, send, send, send. 440 00:25:16,860 --> 00:25:18,240 But the problem of course is 441 00:25:18,240 --> 00:25:19,800 it can scan really fast 442 00:25:19,800 --> 00:25:21,580 but the results aren't going to be accurate 443 00:25:21,580 --> 00:25:22,100 at all. 444 00:25:23,720 --> 00:25:25,280 nmap has to be very careful 445 00:25:25,280 --> 00:25:28,120 about remembering all the probes it has sent 446 00:25:28,940 --> 00:25:30,580 retransmitting if it doesn't get a response 447 00:25:30,580 --> 00:25:32,040 detecting dropped packets 448 00:25:32,040 --> 00:25:33,160 looking at latency 449 00:25:33,980 --> 00:25:35,700 adjusting the parallelism accordingly 450 00:25:36,820 --> 00:25:38,760 whereas if you just have a for loop 451 00:25:38,760 --> 00:25:39,840 that just scans real quick 452 00:25:39,840 --> 00:25:42,200 it's liable to be all dropped 453 00:25:42,200 --> 00:25:43,460 90% of your packets 454 00:25:43,460 --> 00:25:45,060 at the first bottleneck router 455 00:25:46,860 --> 00:25:47,080 are machines. 456 00:25:49,160 --> 00:25:50,800 One thing that just slightly 457 00:25:50,800 --> 00:25:51,880 modifies from that 458 00:25:51,880 --> 00:25:54,800 is if you want to do an internet wide 459 00:25:54,800 --> 00:25:55,800 ping sweep 460 00:25:57,680 --> 00:25:59,140 so here we're using 461 00:25:59,140 --> 00:26:00,340 a feature of nmap 462 00:26:00,860 --> 00:26:01,500 called IR 463 00:26:01,500 --> 00:26:02,900 input from random 464 00:26:04,080 --> 00:26:05,980 and it now takes an argument 465 00:26:05,980 --> 00:26:07,360 it used to just go forever 466 00:26:08,120 --> 00:26:09,980 however sometimes that makes it easy 467 00:26:09,980 --> 00:26:12,040 to start it up going and then forget about it 468 00:26:12,040 --> 00:26:13,300 and then it'll scan for good 469 00:26:13,300 --> 00:26:16,640 and you'll get up the next morning with angry messages from your ISP 470 00:26:17,140 --> 00:26:18,120 or so I hear 471 00:26:19,740 --> 00:26:20,180 so 472 00:26:20,180 --> 00:26:21,780 after that happened 473 00:26:21,780 --> 00:26:24,300 I added a feature that lets you limit it to 474 00:26:24,300 --> 00:26:25,760 in this case 10,000 hosts 475 00:26:25,760 --> 00:26:28,020 so here we're saying pick hosts at random 476 00:26:28,660 --> 00:26:30,380 do this fast sin sweep 477 00:26:30,380 --> 00:26:31,660 for web servers 478 00:26:32,380 --> 00:26:34,460 so you can use this as an alternative 479 00:26:34,940 --> 00:26:35,780 browsing approach 480 00:26:35,780 --> 00:26:37,880 instead of search engines 481 00:26:37,880 --> 00:26:39,900 you can just find your web servers randomly 482 00:26:39,900 --> 00:26:41,580 and see what you get 483 00:26:41,580 --> 00:26:43,620 they just pop up one after another 484 00:26:43,620 --> 00:26:46,100 of course you'd have to be pretty bored to do that 485 00:26:47,540 --> 00:26:48,780 if you wanted to 486 00:26:48,780 --> 00:26:49,200 it's there 487 00:26:49,200 --> 00:26:52,240 and it kind of looks like sort of a script kitty feature 488 00:26:52,860 --> 00:26:54,960 but actually I can find it quite useful 489 00:26:54,960 --> 00:26:55,800 in a number of cases 490 00:26:55,800 --> 00:26:57,820 if you want to do surveys of certain ports 491 00:26:57,820 --> 00:26:59,360 see how many people are running whatever 492 00:26:59,820 --> 00:27:01,320 you can get a lot of good information 493 00:27:01,320 --> 00:27:03,300 just by doing a random scan 494 00:27:04,540 --> 00:27:06,240 ok so now we're going to get more intense 495 00:27:06,240 --> 00:27:08,380 with these Playboy IPs that we've found 496 00:27:09,740 --> 00:27:11,080 so here we're going to say 497 00:27:11,520 --> 00:27:11,960 nmap 498 00:27:11,960 --> 00:27:14,460 don't bother pinging it because we already know that they're up 499 00:27:14,960 --> 00:27:16,000 do a sin scan 500 00:27:16,860 --> 00:27:17,080 do an OS scan 501 00:27:17,080 --> 00:27:20,120 we give it this OS scan underscore guess 502 00:27:20,120 --> 00:27:21,900 which wasn't documented until recently 503 00:27:21,900 --> 00:27:24,200 and basically 504 00:27:24,200 --> 00:27:27,080 the problem we encounter when I did normal OS detection 505 00:27:27,080 --> 00:27:29,380 is that those 113 ports 506 00:27:29,380 --> 00:27:30,280 that were coming back 507 00:27:30,280 --> 00:27:30,960 the resets 508 00:27:30,960 --> 00:27:33,240 those weren't from the machines at all 509 00:27:33,240 --> 00:27:36,640 those were from the firewall forging them 510 00:27:36,640 --> 00:27:38,520 and so nmap got a little bit confused 511 00:27:38,520 --> 00:27:41,100 because those resets didn't match 512 00:27:41,100 --> 00:27:42,020 what it would have expected 513 00:27:42,020 --> 00:27:43,920 from the true destination host 514 00:27:44,660 --> 00:27:46,660 however this OS scan guess will say 515 00:27:46,860 --> 00:27:48,540 hey even if you don't have a perfect match 516 00:27:49,180 --> 00:27:50,740 just give the closest match 517 00:27:50,740 --> 00:27:52,360 and that's usually pretty effective 518 00:27:53,220 --> 00:27:54,500 t4 is the timing option 519 00:27:54,500 --> 00:27:55,340 we'll talk about later 520 00:27:55,340 --> 00:27:57,280 we want to scan all of the ports 521 00:27:57,280 --> 00:27:58,220 and I mean all of them 522 00:27:58,220 --> 00:28:01,180 nmap used to just do 1 through 65, 5, 35 523 00:28:02,600 --> 00:28:05,060 but this year I added the port 0 support 524 00:28:05,060 --> 00:28:06,680 which is a pretty bogus port 525 00:28:06,680 --> 00:28:09,080 but some people wanted to scan it 526 00:28:09,080 --> 00:28:09,820 so why not 527 00:28:11,340 --> 00:28:13,200 we give it the list of IPs 528 00:28:13,200 --> 00:28:14,500 tell it to log to a file 529 00:28:14,500 --> 00:28:15,300 and we're off 530 00:28:16,860 --> 00:28:17,020 so let's take a look 531 00:28:17,020 --> 00:28:18,560 and try and analyze some of the results 532 00:28:21,460 --> 00:28:22,380 let's take a look 533 00:28:22,380 --> 00:28:24,580 one thing we have this router here 534 00:28:24,580 --> 00:28:26,400 it looks like it's a cisco 535 00:28:27,000 --> 00:28:28,520 it's got all the ports 536 00:28:28,520 --> 00:28:30,020 and this is a line that a lot of people 537 00:28:30,020 --> 00:28:31,340 don't pay enough attention to 538 00:28:31,340 --> 00:28:33,720 here we see that the ports that were scanned 539 00:28:33,720 --> 00:28:35,260 but not shown are in state closed 540 00:28:35,700 --> 00:28:37,620 meaning there's not really much of a firewall 541 00:28:37,620 --> 00:28:38,640 protecting them 542 00:28:38,640 --> 00:28:39,880 so if the ports were open 543 00:28:40,640 --> 00:28:42,620 they would be available to users 544 00:28:42,620 --> 00:28:45,540 as opposed to a more proper default deny stance 545 00:28:46,860 --> 00:28:47,640 where I can only allow the ports 546 00:28:47,640 --> 00:28:49,800 that I specifically want to be allowed 547 00:28:49,800 --> 00:28:51,340 so for example 548 00:28:51,340 --> 00:28:54,020 they probably didn't have a real great reason 549 00:28:54,020 --> 00:28:55,120 for having finger open 550 00:28:55,120 --> 00:28:57,580 it's probably not necessary on the router 551 00:28:57,580 --> 00:28:59,340 for external internet users 552 00:28:59,340 --> 00:29:02,080 but because they have this default allow policy 553 00:29:02,640 --> 00:29:03,740 it was up and available 554 00:29:03,740 --> 00:29:05,300 whereas at this host 555 00:29:05,300 --> 00:29:08,020 we see that the default is filtered 556 00:29:09,040 --> 00:29:10,240 and so hopefully 557 00:29:10,240 --> 00:29:11,400 they only have ports open 558 00:29:11,400 --> 00:29:12,760 that they have a good reason for 559 00:29:14,700 --> 00:29:16,160 let's take a look at another one 560 00:29:17,660 --> 00:29:18,620 this one's 561 00:29:19,640 --> 00:29:21,060 bigip2chai.playboy.com 562 00:29:21,060 --> 00:29:23,180 and one thing I found really interesting 563 00:29:23,180 --> 00:29:23,800 on this guy 564 00:29:23,800 --> 00:29:26,660 is that the OS guest said 565 00:29:26,660 --> 00:29:29,120 that it's an F5 lab's big IP load balancer 566 00:29:29,120 --> 00:29:30,360 which is probably true 567 00:29:30,360 --> 00:29:31,340 given the name of the host 568 00:29:31,940 --> 00:29:33,500 and what's interesting is that 569 00:29:33,500 --> 00:29:35,560 I certainly don't have one of those in my lab 570 00:29:35,560 --> 00:29:37,000 to add that fingerprint 571 00:29:37,000 --> 00:29:39,820 and so a feature that has turned out 572 00:29:39,820 --> 00:29:40,760 really useful in Nmap 573 00:29:40,760 --> 00:29:42,580 is that if it doesn't detect an OS 574 00:29:42,580 --> 00:29:44,820 it gives you a fingerprint and a web page 575 00:29:46,860 --> 00:29:47,840 and a lot of really helpful users 576 00:29:47,840 --> 00:29:49,760 have submitted thousands of these fingerprints 577 00:29:49,760 --> 00:29:52,000 and so that the database now includes 578 00:29:52,000 --> 00:29:54,020 everything from Xboxes running Linux 579 00:29:54,020 --> 00:29:56,020 to Amigas to VoIP phones 580 00:29:56,700 --> 00:29:58,240 PBXs and F5 labs 581 00:29:58,240 --> 00:29:59,640 big IP load balancers 582 00:29:59,640 --> 00:30:02,040 has anyone here ever submitted a fingerprint? 583 00:30:03,540 --> 00:30:05,240 ok mad props to you guys 584 00:30:05,240 --> 00:30:07,080 because that's what's helped it 585 00:30:07,080 --> 00:30:08,260 to be so up to date 586 00:30:08,260 --> 00:30:09,380 when people submit one 587 00:30:09,380 --> 00:30:11,680 then everyone can benefit if they ever do see 588 00:30:11,680 --> 00:30:13,720 that weird type of machine somewhere 589 00:30:15,420 --> 00:30:16,740 let's look at a couple more 590 00:30:16,860 --> 00:30:17,020 examples 591 00:30:18,120 --> 00:30:19,960 here's one it looks like it's an ad server 592 00:30:19,960 --> 00:30:20,700 in Chicago 593 00:30:20,700 --> 00:30:23,580 and their default state is filtered 594 00:30:23,580 --> 00:30:25,000 good not many ports open 595 00:30:25,000 --> 00:30:27,760 the fact that they have Oracle open 596 00:30:27,760 --> 00:30:28,960 is kind of questionable 597 00:30:29,780 --> 00:30:32,720 just because Larry Ellison says it's unbreakable 598 00:30:32,720 --> 00:30:34,460 doesn't necessarily mean 599 00:30:34,460 --> 00:30:36,620 that it's a good idea to leave it open 600 00:30:36,620 --> 00:30:37,660 flapping in the wind 601 00:30:37,660 --> 00:30:39,380 but at least you can see 602 00:30:39,380 --> 00:30:41,220 they made some efforts here 603 00:30:41,220 --> 00:30:42,760 in terms of the default filtered 604 00:30:42,760 --> 00:30:45,640 and you can see the OS guess says that it's 605 00:30:46,860 --> 00:30:48,580 7 and that they've specifically changed 606 00:30:48,580 --> 00:30:50,580 the TCP strong ISS variable 607 00:30:50,580 --> 00:30:52,420 to give them stronger 608 00:30:52,420 --> 00:30:54,120 initial sequence number generation 609 00:30:54,840 --> 00:30:56,880 to make it hard to do TCP spoofing 610 00:30:56,880 --> 00:30:57,020 attacks 611 00:30:58,520 --> 00:31:00,520 here's another machine that's on 612 00:31:00,520 --> 00:31:01,720 kind of the same class C 613 00:31:02,360 --> 00:31:04,260 where they haven't taken as much care 614 00:31:04,860 --> 00:31:06,260 the default state is closed 615 00:31:06,260 --> 00:31:07,580 it's got more hosts open 616 00:31:07,580 --> 00:31:10,280 and it has MySQL which is 617 00:31:10,280 --> 00:31:11,340 just as bad 618 00:31:13,060 --> 00:31:14,720 so now we're going to move 619 00:31:14,720 --> 00:31:16,340 to a few 620 00:31:16,860 --> 00:31:18,640 other tricks that can be handy 621 00:31:21,000 --> 00:31:23,420 first let's look at IPv6 scanning 622 00:31:23,920 --> 00:31:25,120 which Nmap now supports 623 00:31:25,700 --> 00:31:26,920 so I take a machine 624 00:31:26,920 --> 00:31:29,160 I use www.cam.net 625 00:31:29,160 --> 00:31:31,160 just because they have some good IPv6 networks 626 00:31:31,160 --> 00:31:32,320 so I knew they supported it 627 00:31:32,660 --> 00:31:33,940 and I do a scan of them 628 00:31:33,940 --> 00:31:35,860 and we see a number of open ports 629 00:31:35,860 --> 00:31:38,560 but we also see all these filtered ports here 630 00:31:38,560 --> 00:31:39,960 that we're not able to get to 631 00:31:39,960 --> 00:31:41,260 because of some filtering system 632 00:31:41,260 --> 00:31:43,500 well let's take exactly the same command 633 00:31:43,500 --> 00:31:46,840 but add hyphen 6 so that it scans the IPv6 634 00:31:46,860 --> 00:31:47,720 version instead 635 00:31:47,720 --> 00:31:49,520 here you see that 636 00:31:51,460 --> 00:31:52,880 suddenly there are no 637 00:31:52,880 --> 00:31:54,360 open, no filtered ports 638 00:31:54,860 --> 00:31:56,900 and this port 113 that was filtered 639 00:31:56,900 --> 00:31:57,840 in the previous one 640 00:31:57,840 --> 00:31:59,420 is now open 641 00:31:59,420 --> 00:32:02,340 so you can take your IPv6 enabled RPC info 642 00:32:02,780 --> 00:32:04,240 and interrogate the ports further 643 00:32:04,860 --> 00:32:06,740 so that's something that can sometimes be useful 644 00:32:06,740 --> 00:32:08,760 to try and it's going to become more 645 00:32:08,760 --> 00:32:10,260 useful if and when 646 00:32:10,860 --> 00:32:12,320 IPv6 starts seeing more 647 00:32:12,860 --> 00:32:13,240 usage 648 00:32:14,000 --> 00:32:16,600 another thing that people are often interested in is 649 00:32:16,860 --> 00:32:17,680 how to get the timing right 650 00:32:17,680 --> 00:32:19,740 you know mmap offers a lot of options 651 00:32:19,740 --> 00:32:22,240 max parallelism, min parallelism 652 00:32:22,240 --> 00:32:24,900 min RTT timeout, max RTT timeout 653 00:32:24,900 --> 00:32:26,240 initial RTT timeout 654 00:32:26,240 --> 00:32:28,160 a host timeout, a scan delay 655 00:32:28,880 --> 00:32:30,620 so if you want to get your scans faster 656 00:32:30,620 --> 00:32:32,700 all you really have to do is pick the exact 657 00:32:32,700 --> 00:32:34,600 right values for each of these variables 658 00:32:34,600 --> 00:32:36,240 and everything will be set 659 00:32:37,580 --> 00:32:39,120 fortunately there's a better way 660 00:32:39,120 --> 00:32:40,500 and that are these 661 00:32:40,500 --> 00:32:42,440 canned timing levels I added 662 00:32:42,440 --> 00:32:44,720 which tries to do the smart things 663 00:32:45,580 --> 00:32:46,800 but lets you configure 664 00:32:46,860 --> 00:32:48,780 kind of how aggressive it wants to be 665 00:32:48,780 --> 00:32:50,620 it can be everything from paranoid 666 00:32:50,620 --> 00:32:53,100 which does only one probe every five minutes 667 00:32:53,100 --> 00:32:54,980 so yes you're going to stay under 668 00:32:54,980 --> 00:32:56,860 the IDS port scan detection thresholds 669 00:32:57,440 --> 00:32:58,860 but you're going to be old and gray 670 00:32:58,860 --> 00:33:01,140 by the time any scan actually finishes 671 00:33:02,020 --> 00:33:03,560 unless it's a real small 672 00:33:03,560 --> 00:33:05,100 very limited scan 673 00:33:06,220 --> 00:33:07,760 sneaky is kind of the same 674 00:33:07,760 --> 00:33:09,040 except it's 15 seconds 675 00:33:09,040 --> 00:33:10,500 and you can use numbers here 676 00:33:10,500 --> 00:33:11,440 from zero to five 677 00:33:11,440 --> 00:33:13,520 instead of the names if you want 678 00:33:13,520 --> 00:33:15,880 polite, normal mode 679 00:33:16,860 --> 00:33:17,000 which is the default 680 00:33:17,000 --> 00:33:18,740 and then there's aggressive mode 681 00:33:18,740 --> 00:33:20,320 which is something I've worked a bit on 682 00:33:20,320 --> 00:33:23,160 by default I think NMAT needs to err 683 00:33:23,160 --> 00:33:25,440 on the side of being conservative 684 00:33:25,440 --> 00:33:27,900 with how fast it does its scan 685 00:33:27,900 --> 00:33:29,360 because it doesn't really know for sure 686 00:33:29,360 --> 00:33:31,420 about all the network infrastructure in between 687 00:33:32,020 --> 00:33:33,860 for all it knows you could be on a 688 00:33:33,860 --> 00:33:36,280 300 baud slip link to Pakistan 689 00:33:36,280 --> 00:33:36,940 or something 690 00:33:37,760 --> 00:33:39,480 and so it has to be safe 691 00:33:39,480 --> 00:33:41,860 I would rather have it be slower 692 00:33:41,860 --> 00:33:44,040 in the case where you're on a faster network 693 00:33:44,040 --> 00:33:46,020 than if you're on a slow network 694 00:33:46,860 --> 00:33:48,260 and get wrong results 695 00:33:48,840 --> 00:33:50,580 however with this aggressive mode 696 00:33:50,580 --> 00:33:52,420 I've tried to make it so that if you're on at least 697 00:33:52,420 --> 00:33:53,620 a somewhat reasonable network 698 00:33:53,620 --> 00:33:55,780 if you're on an ethernet or even a broadband 699 00:33:56,860 --> 00:33:59,360 connection or possibly even a modem 700 00:33:59,360 --> 00:33:59,920 although I don't know 701 00:33:59,920 --> 00:34:02,740 this will be much more aggressive in its timing 702 00:34:02,740 --> 00:34:05,020 while still providing accurate results 703 00:34:05,020 --> 00:34:06,560 assuming the 704 00:34:07,540 --> 00:34:08,500 latency and such 705 00:34:08,500 --> 00:34:10,560 and packet loss aren't horrible 706 00:34:10,560 --> 00:34:11,960 on that network 707 00:34:13,420 --> 00:34:14,820 so let's look at ways 708 00:34:14,820 --> 00:34:15,940 that you can speed your scan 709 00:34:16,860 --> 00:34:18,120 and some of the things that I've been adding lately 710 00:34:19,160 --> 00:34:20,520 here we do a scan 711 00:34:20,520 --> 00:34:22,960 with an older version 3.15 beta 3 712 00:34:22,960 --> 00:34:24,620 against insecure.org 713 00:34:24,620 --> 00:34:26,840 see I actually scan my own system 714 00:34:26,840 --> 00:34:27,560 sometimes too 715 00:34:27,560 --> 00:34:29,400 it's not only other people 716 00:34:30,580 --> 00:34:33,500 and here it scans the 1600 default ports 717 00:34:33,500 --> 00:34:35,100 in a little less than 10 minutes 718 00:34:35,100 --> 00:34:36,480 which isn't a disaster 719 00:34:37,100 --> 00:34:39,000 but it still will take a long time 720 00:34:39,000 --> 00:34:40,300 if you have a lot of hosts 721 00:34:40,300 --> 00:34:42,000 which are firewalled in this sort of way 722 00:34:42,600 --> 00:34:44,740 so I made a bunch of changes to the timing algorithm 723 00:34:44,740 --> 00:34:46,640 which in the next version of Nmap 724 00:34:46,860 --> 00:34:49,080 was able to do the same thing in 2.28 seconds 725 00:34:49,080 --> 00:34:51,280 which, hey, you saved half your time 726 00:34:51,780 --> 00:34:52,780 but even better 727 00:34:52,780 --> 00:34:54,340 is if you add the T4 option 728 00:34:54,820 --> 00:34:56,620 all of a sudden it only takes 41 seconds 729 00:34:57,160 --> 00:34:58,840 and so if you're doing big scans 730 00:34:58,840 --> 00:35:00,180 if you're doing scans against 731 00:35:00,180 --> 00:35:01,820 heavily firewalled hosts 732 00:35:01,820 --> 00:35:03,060 and you're on a decent network 733 00:35:03,620 --> 00:35:05,600 that's something you might want to consider using 734 00:35:05,600 --> 00:35:07,200 on a more regular basis 735 00:35:09,020 --> 00:35:10,740 now let's look on a different track 736 00:35:10,740 --> 00:35:12,340 avoiding the IDSs 737 00:35:13,040 --> 00:35:14,360 there are a few different ways 738 00:35:14,920 --> 00:35:16,020 that you can do this 739 00:35:17,780 --> 00:35:19,000 one of them 740 00:35:19,000 --> 00:35:20,700 is the scan flags option 741 00:35:20,700 --> 00:35:22,380 which lets you specify 742 00:35:23,280 --> 00:35:24,120 different flags 743 00:35:24,120 --> 00:35:25,880 for a certain scan you want to do 744 00:35:25,880 --> 00:35:28,780 for example one fact that seems to be little known 745 00:35:28,780 --> 00:35:29,940 by certain IDS vendors 746 00:35:29,940 --> 00:35:31,900 is that you can do a SIN scan 747 00:35:31,900 --> 00:35:33,860 it doesn't have to be just SIN 748 00:35:33,860 --> 00:35:35,440 a SINFIN for example 749 00:35:35,440 --> 00:35:37,400 will often do the same thing 750 00:35:37,400 --> 00:35:38,980 and so with scan flags 751 00:35:38,980 --> 00:35:40,380 you can say do a SIN scan 752 00:35:40,380 --> 00:35:42,340 but instead of using the default flags 753 00:35:42,340 --> 00:35:44,120 use these TCP flags instead 754 00:35:46,860 --> 00:35:48,260 same thing with the FIN scan 755 00:35:49,340 --> 00:35:50,980 a lot of other combinations 756 00:35:50,980 --> 00:35:52,500 will work such as push urge 757 00:35:54,820 --> 00:35:56,080 and another approach 758 00:35:56,080 --> 00:35:57,920 instead of avoiding the IDS entirely 759 00:35:58,400 --> 00:35:59,740 is you can try and avoid 760 00:35:59,740 --> 00:36:02,720 overload the IDS using decoy scanning 761 00:36:02,720 --> 00:36:04,240 so here we're going to say 762 00:36:04,240 --> 00:36:05,660 for every packet Nmap sends 763 00:36:05,660 --> 00:36:07,760 and this is a feature it has had for a long time 764 00:36:08,280 --> 00:36:10,420 for every packet Nmap sends 765 00:36:11,380 --> 00:36:12,200 spoof a packet 766 00:36:12,200 --> 00:36:14,020 from all these IP addresses 767 00:36:14,020 --> 00:36:15,240 that we've specified 768 00:36:16,860 --> 00:36:17,080 and if someone gets it 769 00:36:17,080 --> 00:36:18,760 their IDS report will look like that 770 00:36:19,600 --> 00:36:21,380 and they'll see the intruder 771 00:36:21,380 --> 00:36:22,860 as being all these IP addresses 772 00:36:22,860 --> 00:36:24,640 and they won't really know 773 00:36:25,180 --> 00:36:27,260 where to go after 774 00:36:27,260 --> 00:36:29,580 a couple of caveats with this technique 775 00:36:29,580 --> 00:36:31,440 because I see people use it wrongly sometimes 776 00:36:31,440 --> 00:36:33,960 and think they're more anonymous than they are 777 00:36:33,960 --> 00:36:36,440 for one thing more and more ISPs 778 00:36:36,440 --> 00:36:38,140 are starting to implement egress filtering 779 00:36:38,720 --> 00:36:41,040 and so if your ISP is implementing that 780 00:36:41,040 --> 00:36:42,120 you might want to check 781 00:36:42,120 --> 00:36:44,300 because otherwise it might block 782 00:36:44,300 --> 00:36:46,740 at your ISP's router all the spoof sources 783 00:36:46,860 --> 00:36:46,940 and the host addresses 784 00:36:46,940 --> 00:36:49,220 and so the attacker will just see you 785 00:36:49,220 --> 00:36:50,900 and you won't feel quite so clever 786 00:36:52,640 --> 00:36:54,720 another thing that very inexperienced 787 00:36:54,720 --> 00:36:56,140 Nmap users tend to do 788 00:36:56,700 --> 00:36:57,320 on occasion 789 00:36:58,240 --> 00:36:59,440 is they'll say well 790 00:36:59,440 --> 00:37:01,280 what host should I use for the decoys 791 00:37:01,280 --> 00:37:02,800 well what host do I know 792 00:37:02,800 --> 00:37:04,700 and so they'll put down some popular hosts 793 00:37:04,700 --> 00:37:06,120 they think of off the top of their head 794 00:37:06,120 --> 00:37:08,120 and then the admin on the other side 795 00:37:08,120 --> 00:37:10,840 says ok we've been scanned by yahoo.com 796 00:37:10,840 --> 00:37:13,040 whitehouse.gov, AOL 797 00:37:13,040 --> 00:37:16,420 and ppp478.earthlink.net 798 00:37:16,860 --> 00:37:18,580 you know I wonder who's really behind this 799 00:37:21,220 --> 00:37:23,320 and so you have to be careful with that 800 00:37:24,920 --> 00:37:26,760 now if you want to get the ultimate 801 00:37:26,760 --> 00:37:27,400 stealth scan 802 00:37:27,400 --> 00:37:30,380 I think you want to look at the idle scan 803 00:37:30,980 --> 00:37:31,460 technique 804 00:37:32,860 --> 00:37:33,960 due to time limitations 805 00:37:33,960 --> 00:37:35,700 I can't discuss it all in depth 806 00:37:35,700 --> 00:37:38,300 but it's a really neat technique 807 00:37:38,860 --> 00:37:40,880 that allows you to scan a machine 808 00:37:40,880 --> 00:37:42,920 without sending any packets at all 809 00:37:42,920 --> 00:37:43,840 to that target machine 810 00:37:43,840 --> 00:37:45,080 from your own IP address 811 00:37:46,860 --> 00:37:47,720 using a zombie machine 812 00:37:47,720 --> 00:37:49,500 that you pick from the internet 813 00:37:49,500 --> 00:37:51,620 to sort of proxy that scan 814 00:37:52,220 --> 00:37:53,320 using an interesting 815 00:37:55,080 --> 00:37:56,820 usage of the IP ID field 816 00:37:56,820 --> 00:37:58,640 and I put a paper about that 817 00:37:58,640 --> 00:37:59,040 I wrote 818 00:37:59,040 --> 00:38:01,840 I have it at this URL and I also stuck it 819 00:38:01,840 --> 00:38:02,780 on the Defcon CD 820 00:38:04,800 --> 00:38:06,300 and so another thing 821 00:38:06,300 --> 00:38:07,820 that users ask me a lot 822 00:38:07,820 --> 00:38:10,380 is what's Nmap going to look like 823 00:38:10,380 --> 00:38:11,960 in three to five years from now 824 00:38:11,960 --> 00:38:14,440 and that I don't have a good answer 825 00:38:14,440 --> 00:38:16,460 because I try and follow the evolution 826 00:38:16,860 --> 00:38:18,060 of networks and the way they're used 827 00:38:18,060 --> 00:38:19,820 and you never really know 828 00:38:19,820 --> 00:38:22,800 for sure you can't predict where that's going to go 829 00:38:22,800 --> 00:38:24,800 however what I often do know 830 00:38:24,800 --> 00:38:26,740 is what's the next big feature 831 00:38:26,740 --> 00:38:27,560 that I think is cool 832 00:38:28,180 --> 00:38:29,460 that's going to be coming next 833 00:38:29,460 --> 00:38:32,280 and in this case I think that's going to be 834 00:38:32,280 --> 00:38:33,460 service inversion detection 835 00:38:37,340 --> 00:38:38,460 there are a few reasons 836 00:38:38,460 --> 00:38:40,880 that I think this can be particularly useful 837 00:38:40,880 --> 00:38:42,560 and is becoming more and more useful 838 00:38:42,560 --> 00:38:44,120 as time goes on 839 00:38:44,120 --> 00:38:46,260 one are the unknown ports you see 840 00:38:46,860 --> 00:38:48,500 you might have saw some of those examples 841 00:38:48,500 --> 00:38:50,380 in the Playboy host we looked at 842 00:38:50,380 --> 00:38:54,120 where they would have port 21,147 open 843 00:38:54,780 --> 00:38:56,520 well that doesn't tell you a lot 844 00:38:56,520 --> 00:38:57,680 you immediately want to know 845 00:38:57,680 --> 00:38:59,420 what's listening on that port 846 00:38:59,420 --> 00:39:00,820 what is it, can I exploit it 847 00:39:01,340 --> 00:39:03,660 and so with the probing 848 00:39:03,660 --> 00:39:06,560 Nmap will interrogate all the open and closed ports 849 00:39:07,720 --> 00:39:08,800 UDP and TCP 850 00:39:08,800 --> 00:39:10,320 to try and determine 851 00:39:10,760 --> 00:39:12,840 what type of service it is that's listening there 852 00:39:12,840 --> 00:39:14,940 and ideally what's the application name 853 00:39:14,940 --> 00:39:15,740 and version number 854 00:39:16,860 --> 00:39:17,280 that it's running 855 00:39:17,280 --> 00:39:20,700 this is also helpful for coping with 856 00:39:20,700 --> 00:39:22,520 we've seen more firewall evasion 857 00:39:22,520 --> 00:39:23,520 port selection now 858 00:39:23,520 --> 00:39:26,360 instead of saying I'm going to run it on the normal port 859 00:39:26,360 --> 00:39:27,460 the well known port 860 00:39:27,460 --> 00:39:29,660 they say well I need to run it on this port 861 00:39:29,660 --> 00:39:31,320 because that's the one allowed by the firewall 862 00:39:31,320 --> 00:39:35,220 I had a friend, a not particularly security conscious friend 863 00:39:35,220 --> 00:39:36,780 who said dang it 864 00:39:36,780 --> 00:39:38,620 my ISP blocked port 23 865 00:39:38,620 --> 00:39:40,160 because telnet's so insecure 866 00:39:40,820 --> 00:39:42,260 so of course he moves telnet 867 00:39:42,260 --> 00:39:43,340 to port 22 868 00:39:43,340 --> 00:39:45,860 and telnet's to the SSH port 869 00:39:46,860 --> 00:39:48,540 which shows the kind of level of effort 870 00:39:48,540 --> 00:39:50,100 people will go to to avoid 871 00:39:50,660 --> 00:39:53,240 even very sensible security mechanisms 872 00:39:54,460 --> 00:39:55,420 and also 873 00:39:55,420 --> 00:39:57,600 a lot of times people will put stuff on port 80 874 00:39:57,600 --> 00:39:58,480 they'll say hey 875 00:39:58,480 --> 00:40:00,360 the only thing that gets through is port 80 876 00:40:00,360 --> 00:40:02,400 so we'll just put whatever application 877 00:40:02,400 --> 00:40:05,380 on there so that people will be able to get to it 878 00:40:05,380 --> 00:40:06,640 and kind of defeat the point 879 00:40:06,640 --> 00:40:08,300 of whatever the firewalling was 880 00:40:09,220 --> 00:40:11,300 and so when Nmap by default right now 881 00:40:11,300 --> 00:40:11,980 scans them 882 00:40:11,980 --> 00:40:14,700 it'll say port 80 and it'll put HTTP 883 00:40:14,700 --> 00:40:16,260 because that's what the table says 884 00:40:16,860 --> 00:40:17,720 but it would be much better 885 00:40:17,720 --> 00:40:19,420 and less misleading 886 00:40:19,420 --> 00:40:21,660 if it would actually look and determine 887 00:40:21,660 --> 00:40:22,820 what's really listening 888 00:40:22,820 --> 00:40:26,080 and a third reason is to counter UDP filtering 889 00:40:27,100 --> 00:40:28,820 back many years ago 890 00:40:29,380 --> 00:40:30,880 when I wrote the initial 891 00:40:30,880 --> 00:40:31,640 UDP scanner 892 00:40:31,640 --> 00:40:34,120 there was a lot less of the UDP filtering 893 00:40:34,120 --> 00:40:35,220 so you could kind of 894 00:40:35,220 --> 00:40:37,460 when you would send a UDP packet to a wrong port 895 00:40:37,460 --> 00:40:40,000 you had a much higher chance of getting an actual 896 00:40:40,000 --> 00:40:41,640 ICMP port unreachable back 897 00:40:41,640 --> 00:40:43,800 now this filtering is so pervasive 898 00:40:43,800 --> 00:40:45,680 that those of you who scan big networks 899 00:40:47,040 --> 00:40:48,840 often find that you see lots of 900 00:40:48,840 --> 00:40:49,880 allegedly open ports 901 00:40:49,880 --> 00:40:51,200 because they're not really open 902 00:40:51,200 --> 00:40:53,260 but they're being filtered 903 00:40:53,260 --> 00:40:55,240 and so it looks to Nmap like they're open 904 00:40:56,040 --> 00:40:58,160 and that makes it very hard to figure out 905 00:40:58,160 --> 00:40:59,120 which ones are really there 906 00:40:59,120 --> 00:41:01,740 and would it be a waste of time to brute force 907 00:41:01,740 --> 00:41:03,500 the SNMP community strings 908 00:41:03,500 --> 00:41:05,760 if it's really probably just filtered 909 00:41:05,760 --> 00:41:07,460 and so with the version detection 910 00:41:07,460 --> 00:41:09,360 that offers a way to somewhat counter that 911 00:41:09,360 --> 00:41:11,980 because if we send a DNS server status probe 912 00:41:11,980 --> 00:41:15,260 and get a response back 913 00:41:15,260 --> 00:41:16,800 we know that ASDNS 914 00:41:16,860 --> 00:41:17,680 and B 915 00:41:17,680 --> 00:41:19,480 that it actually is open 916 00:41:19,480 --> 00:41:20,740 and for the other ports 917 00:41:20,740 --> 00:41:24,620 I can put some sort of open 918 00:41:24,620 --> 00:41:26,000 slash filtered state for that 919 00:41:26,000 --> 00:41:28,080 now this isn't entirely vaporware 920 00:41:28,080 --> 00:41:30,600 in fact I spent a lot of July 921 00:41:30,600 --> 00:41:32,900 working on an implementation of that 922 00:41:33,560 --> 00:41:34,960 this service and version detection 923 00:41:34,960 --> 00:41:37,060 and so let me just give a quick demonstration 924 00:41:37,700 --> 00:41:39,000 we want to do an Nmap 925 00:41:39,000 --> 00:41:40,620 and we want to do 926 00:41:40,620 --> 00:41:41,600 let's do a SIN scan 927 00:41:41,600 --> 00:41:43,100 we'll do a UDP scan 928 00:41:43,100 --> 00:41:44,920 we want it to be verbose about it 929 00:41:46,860 --> 00:41:47,180 for fun 930 00:41:47,180 --> 00:41:50,160 and we'll do this about localhost 931 00:41:50,840 --> 00:41:52,220 and so here it goes 932 00:41:52,220 --> 00:41:54,780 it's scanning the default 1600 TCP ports 933 00:41:54,780 --> 00:41:57,560 now it's scanning the default 1400 UDP ports 934 00:41:57,560 --> 00:41:59,700 now it's starting the new service scan 935 00:41:59,700 --> 00:42:01,520 against the services that it's located 936 00:42:01,520 --> 00:42:03,380 now it's doing RPC grinding 937 00:42:03,380 --> 00:42:04,820 to find the RPC numbers 938 00:42:04,820 --> 00:42:07,040 by brute force of the RPC services 939 00:42:07,040 --> 00:42:08,120 then it did OS detection 940 00:42:08,680 --> 00:42:10,120 and now here it gave us the results 941 00:42:11,460 --> 00:42:12,900 and for those of you 942 00:42:12,900 --> 00:42:14,340 who are used to seeing Nmap output 943 00:42:14,860 --> 00:42:16,240 you see the difference here 944 00:42:16,860 --> 00:42:17,460 one is in this section 945 00:42:17,460 --> 00:42:19,360 first of all these services here 946 00:42:19,940 --> 00:42:21,860 instead of just coming from a table 947 00:42:22,640 --> 00:42:23,960 these were detected through 948 00:42:23,960 --> 00:42:25,240 the interrogation techniques 949 00:42:26,280 --> 00:42:28,480 and if it hadn't been able to find them 950 00:42:28,480 --> 00:42:30,180 it would have put a question mark 951 00:42:30,180 --> 00:42:31,240 after the service name 952 00:42:31,240 --> 00:42:33,720 and also there's this brand new version table 953 00:42:33,720 --> 00:42:35,760 which tells us not only that it's SSH 954 00:42:35,760 --> 00:42:38,300 but it's open SSH 351 patch 1 955 00:42:38,300 --> 00:42:39,220 protocol 199 956 00:42:40,080 --> 00:42:42,220 the RPC bind is version 2 957 00:42:42,220 --> 00:42:43,860 and here's the RPC program number 958 00:42:43,860 --> 00:42:46,420 the internet printing protocol server 959 00:42:46,860 --> 00:42:47,580 is CEPs 1.1 960 00:42:47,580 --> 00:42:49,920 and X11 is X386 961 00:42:49,920 --> 00:42:50,640 and then it's open 962 00:42:50,640 --> 00:42:54,160 only open to 127.0.0.1 mind you 963 00:42:54,160 --> 00:42:55,240 so don't get any ideas 964 00:42:57,060 --> 00:42:58,580 and so that's basically 965 00:42:58,580 --> 00:42:59,840 how that's going to work 966 00:42:59,840 --> 00:43:01,260 and I think the implementation 967 00:43:02,220 --> 00:43:03,880 hopefully will be a relatively good one 968 00:43:03,880 --> 00:43:05,440 it's doing this all in parallel 969 00:43:05,440 --> 00:43:08,420 multiple ports at the same time 970 00:43:08,420 --> 00:43:09,940 as well as being able to do multiple 971 00:43:09,940 --> 00:43:11,640 machines at the same time 972 00:43:11,640 --> 00:43:13,780 TCP, UDP, IPv6 973 00:43:13,780 --> 00:43:16,120 the TCP and UDP work now 974 00:43:16,860 --> 00:43:18,060 and the IPv6 I'm still adding 975 00:43:18,060 --> 00:43:20,240 one thing I'm excited about 976 00:43:20,240 --> 00:43:22,900 is just like with OS detection 977 00:43:22,900 --> 00:43:24,720 when it detects a service 978 00:43:24,720 --> 00:43:25,380 it doesn't know 979 00:43:25,380 --> 00:43:27,700 but it gets some responses to any of its probes 980 00:43:27,700 --> 00:43:29,000 it gives you a nice fingerprint 981 00:43:29,000 --> 00:43:30,280 that you can submit 982 00:43:30,280 --> 00:43:32,100 and so hopefully that will help me 983 00:43:32,100 --> 00:43:34,440 build a very large comprehensive database 984 00:43:35,280 --> 00:43:37,720 that will give us good results 985 00:43:37,720 --> 00:43:39,180 against most of the machines we scan 986 00:43:40,400 --> 00:43:42,340 so far the database isn't so big 987 00:43:42,860 --> 00:43:44,140 but I just last week 988 00:43:44,140 --> 00:43:46,340 did scans against hundreds of thousands of machines 989 00:43:46,860 --> 00:43:48,260 to get all these service numbers 990 00:43:48,740 --> 00:43:50,860 I had to stop because of ISP complaints 991 00:43:51,660 --> 00:43:53,340 but I did get a lot 992 00:43:53,340 --> 00:43:54,340 of stuff there 993 00:43:54,860 --> 00:43:57,180 and so I wish I could give you this 994 00:43:57,180 --> 00:43:58,340 release this 995 00:43:58,860 --> 00:44:00,080 today right now with an URL 996 00:44:00,080 --> 00:44:02,220 but it's not quite polished enough 997 00:44:02,220 --> 00:44:03,120 for the final release 998 00:44:03,660 --> 00:44:05,700 but I'm hoping to have it in the next two weeks 999 00:44:05,700 --> 00:44:08,080 I figure I'll take next week recovering from DEF CON 1000 00:44:08,080 --> 00:44:10,480 and then work hard the week after that 1001 00:44:10,480 --> 00:44:11,780 and then release it 1002 00:44:11,780 --> 00:44:13,820 but for those of you who are 1003 00:44:14,620 --> 00:44:16,500 kind of real good testers 1004 00:44:16,860 --> 00:44:17,740 and are saying good test reports 1005 00:44:17,740 --> 00:44:19,980 and are really interested in trying the bleeding edge 1006 00:44:19,980 --> 00:44:21,920 if you catch me around the CON sometime 1007 00:44:21,920 --> 00:44:24,540 I can give you an URL for this version 1008 00:44:24,540 --> 00:44:25,980 if you want to try it out 1009 00:44:26,860 --> 00:44:28,180 and so that's basically 1010 00:44:28,180 --> 00:44:30,240 the material that I had 1011 00:44:30,680 --> 00:44:32,340 is there anybody who has questions 1012 00:44:32,340 --> 00:44:34,020 about network reconnaissance 1013 00:44:34,660 --> 00:44:36,620 NMAP or anything else security related 1014 00:44:37,840 --> 00:44:38,500 go ahead 1015 00:44:39,160 --> 00:44:40,820 Is there such a thing as an 1016 00:44:40,820 --> 00:44:42,220 idle node on the Windows network 1017 00:44:42,660 --> 00:44:44,180 where there's netball and garbage 1018 00:44:44,180 --> 00:44:45,580 and other types of broadcast traffic? 1019 00:44:46,860 --> 00:44:48,500 Windows don't make the best idle host 1020 00:44:48,500 --> 00:44:50,640 zombies because they're always 1021 00:44:50,640 --> 00:44:52,800 spewing that crap all over the network 1022 00:44:55,080 --> 00:44:56,880 but fortunately there's plenty of machines 1023 00:44:56,880 --> 00:44:57,980 on the internet, printers 1024 00:44:57,980 --> 00:44:59,800 hosts that aren't doing much 1025 00:45:00,340 --> 00:45:02,180 that it's usually not hard to find them 1026 00:45:02,720 --> 00:45:04,720 and you can use any of the idle 1027 00:45:04,720 --> 00:45:06,680 hosts you have to scan any of the other 1028 00:45:06,680 --> 00:45:08,720 machines and so find a good one 1029 00:45:08,720 --> 00:45:09,540 and stick with that 1030 00:45:09,540 --> 00:45:12,680 in my example paper I used a host 1031 00:45:12,680 --> 00:45:14,480 on the Adobe because I was kind of mad 1032 00:45:14,480 --> 00:45:16,080 about the Dimitri thing at the time 1033 00:45:16,860 --> 00:45:19,020 it was kiosk.adobe.com 1034 00:45:19,020 --> 00:45:20,180 and within like a day 1035 00:45:20,180 --> 00:45:21,640 I noticed kiosk 1036 00:45:21,640 --> 00:45:23,180 the name had been removed 1037 00:45:23,180 --> 00:45:25,380 but all they did was remove the DNS name 1038 00:45:25,380 --> 00:45:27,640 whereas the IP address was still there 1039 00:45:27,640 --> 00:45:30,040 so that's kind of an example of what I was talking about 1040 00:45:30,040 --> 00:45:32,100 where the admins sometimes take the easy approach 1041 00:45:32,580 --> 00:45:34,520 and say well we'll just remove the name 1042 00:45:34,520 --> 00:45:35,560 and no one will find it 1043 00:45:35,560 --> 00:45:37,920 as opposed to fixing the actual problem 1044 00:45:37,920 --> 00:45:38,980 any other questions? 1045 00:45:40,020 --> 00:45:40,800 back there 1046 00:45:44,080 --> 00:45:45,520 I can't hear you at all 1047 00:45:46,860 --> 00:45:48,540 do you have a packet of Kuretsu? 1048 00:45:57,440 --> 00:45:59,280 I've looked at packet Kuretsu 1049 00:45:59,280 --> 00:46:00,860 a little but I may not have looked 1050 00:46:00,860 --> 00:46:01,620 at his newest stuff 1051 00:46:03,420 --> 00:46:04,200 any others? 1052 00:46:04,380 --> 00:46:05,540 way back there 1053 00:46:06,260 --> 00:46:08,200 sorry that's just my warning 1054 00:46:08,200 --> 00:46:10,320 five minutes I have to get the hell out of here 1055 00:46:11,160 --> 00:46:12,360 for a while 1056 00:46:12,360 --> 00:46:15,040 there is a related project called nmap plus b 1057 00:46:15,040 --> 00:46:16,640 which also does banner crafting 1058 00:46:16,860 --> 00:46:17,960 so I wonder if 1059 00:46:18,640 --> 00:46:20,580 the banner crafting and version crafting 1060 00:46:20,580 --> 00:46:22,500 is a new version of the map 1061 00:46:22,500 --> 00:46:24,140 or a similar version of the map 1062 00:46:24,140 --> 00:46:25,580 ok yeah he mentioned 1063 00:46:25,580 --> 00:46:28,460 Jay Freeman, Sorak 1064 00:46:28,460 --> 00:46:29,680 who may be here today 1065 00:46:29,680 --> 00:46:32,740 also has a version and service detection 1066 00:46:32,740 --> 00:46:34,560 patch for nmap that's been around 1067 00:46:34,560 --> 00:46:35,380 for a few years 1068 00:46:35,380 --> 00:46:38,500 and he's one of the people that I've been talking to 1069 00:46:38,500 --> 00:46:40,380 I looked at a lot of the other 1070 00:46:41,000 --> 00:46:43,140 version service detection things out there 1071 00:46:43,140 --> 00:46:43,900 amap 1072 00:46:43,900 --> 00:46:45,800 nessus has a very simple one 1073 00:46:45,800 --> 00:46:47,960 implemented in nmap plus b 1074 00:46:47,960 --> 00:46:50,060 and I got a group of about 30 1075 00:46:50,060 --> 00:46:52,040 of kind of the top nmap contributors 1076 00:46:52,040 --> 00:46:53,900 together and so we've been doing these 1077 00:46:53,900 --> 00:46:56,020 private releases and Jay Sorak 1078 00:46:56,020 --> 00:46:57,960 is one of the ones who's provided valuable insight 1079 00:46:57,960 --> 00:46:59,080 into 1080 00:46:59,860 --> 00:47:01,780 improving this implementation here 1081 00:47:01,780 --> 00:47:03,580 although it's a completely different implementation 1082 00:47:04,900 --> 00:47:05,980 one last question 1083 00:47:05,980 --> 00:47:06,420 go ahead 1084 00:47:11,920 --> 00:47:13,040 yes um 1085 00:47:13,900 --> 00:47:15,460 I don't think you can fake the root dance 1086 00:47:16,300 --> 00:47:17,880 you can only do it when you get root 1087 00:47:17,880 --> 00:47:19,500 or if a hot babe in the movies 1088 00:47:19,980 --> 00:47:21,060 uses your product 1089 00:47:24,280 --> 00:47:25,320 but thanks a lot 1090 00:47:25,320 --> 00:47:26,220 you've been a great audience