1 00:00:01,520 --> 00:00:03,560 Welcome to the annual DEF CON convention. 2 00:00:03,960 --> 00:00:08,980 This meeting was held in exciting Las Vegas, Nevada from July 9th through the 11th, 1999. 3 00:00:11,000 --> 00:00:15,480 This is video tape number 24, Introduction to Scanning. 4 00:00:25,380 --> 00:00:26,880 How's everyone doing? 5 00:00:32,260 --> 00:00:36,260 I'm Modify. I'm a part of attrition.org staff. 6 00:00:37,820 --> 00:00:45,400 I'm going to be doing Intro to Scanners, basically showing NMAP and the flags and what shows up in the logs. 7 00:00:47,460 --> 00:00:48,840 So I'm going to start off. 8 00:00:49,200 --> 00:00:53,920 A scanner is a program that detects weakness in remote or local computer systems. 9 00:00:54,760 --> 00:00:59,200 Scanners attack TCP IP ports and servers and record the response. 10 00:00:59,480 --> 00:00:59,980 This is a program that detects weakness in remote or local computer systems. 11 00:01:00,000 --> 00:01:01,020 It records the response from the target host. 12 00:01:01,540 --> 00:01:07,900 Hosts, however, attacker must know how to interpret these scans. 13 00:01:08,300 --> 00:01:10,920 They're not going to show you what's vulnerable. 14 00:01:11,580 --> 00:01:14,220 They're not going to tell you what kind of exploit to use. 15 00:01:15,200 --> 00:01:19,740 Ports are monitor by the iNETd daemon, which is started at boot time. 16 00:01:21,320 --> 00:01:28,780 iNETd reads the ETSI iNETd comp file at boot time to determine which network services it is supposed to manage. 17 00:01:40,040 --> 00:01:47,860 These are all the services. You can comment them out and they won't be started at boot time by putting a pound sign before them. 18 00:01:52,540 --> 00:01:56,820 In simple terms, Port Scanners probe a host and attempt to establish connection. 19 00:01:56,820 --> 00:01:59,740 Whenever you develop a port, one after another. 20 00:02:00,280 --> 00:02:07,240 This provides a roadmap of available services on a certain computer and can be used to launch an attack against a system. 21 00:02:10,140 --> 00:02:15,600 We're going to be showing Nmap, which is found at www.insecure.org. 22 00:02:18,360 --> 00:02:24,920 This system is running Slackware 3.5 with kernel 2.0.34. 23 00:02:31,060 --> 00:02:40,320 As you can see, port scanning is a very popular reconnaissance tool amongst hackers. 24 00:02:41,120 --> 00:02:48,360 Some of the other scanning techniques I'd like to mention is RPC info and show mount. 25 00:02:58,560 --> 00:03:02,860 This shows the RPC services that are running on a host. 26 00:03:03,120 --> 00:03:05,960 As you can see, right off the bat, NFS. 27 00:03:09,360 --> 00:03:10,900 The other is show mount. 28 00:03:21,080 --> 00:03:23,920 This shows a list of exported file directories. 29 00:03:23,920 --> 00:03:26,860 And who can mount them. 30 00:03:27,840 --> 00:03:34,520 If we did have an export list, it would be showing what the directories and who owns, who's allowed to. 31 00:03:36,720 --> 00:03:43,620 And when it shows it, if they show like a root directory and sometimes you'll see anonymous. 32 00:03:44,820 --> 00:03:53,740 You can mount that by doing a mount-t nfs target-host colon whatever directory. 33 00:03:53,740 --> 00:03:55,940 Space slash mount. 34 00:03:56,100 --> 00:03:58,440 You cd into mount and you have controlled the system. 35 00:03:59,440 --> 00:04:04,860 From there, you can probably grab the password file and crack it or add your own entry. 36 00:04:08,820 --> 00:04:11,140 We're going to go into some of the flags of Nmap. 37 00:04:12,020 --> 00:04:22,920 You can learn more about Nmap by doing man nmap or nmap and type it to more. 38 00:04:25,620 --> 00:04:30,420 It gives you all the flags and what each one is associated to it. 39 00:04:34,380 --> 00:04:42,820 Some of the flags are nmap-st hostname is a TCP scan. 40 00:04:44,100 --> 00:04:45,820 It's not very stealthy. 41 00:04:45,860 --> 00:04:49,600 It shows up a lot in the logs. 42 00:04:50,200 --> 00:04:51,840 And I'll demo that right now. 43 00:05:02,940 --> 00:05:09,240 It gives you the port, the state, which all of them are open, the protocol, TCP, and the service. 44 00:05:14,520 --> 00:05:17,520 It gets the services just by adding those to the right. 45 00:05:19,360 --> 00:05:22,200 It gets the services by looking at Etsy services. 46 00:05:22,200 --> 00:05:26,780 But there's also an nmap file called nmap-services. 47 00:05:27,560 --> 00:05:32,240 What it does is it scans the ports and then matches those to its file. 48 00:05:32,640 --> 00:05:37,740 And all those have like a database of all the services, the ports. 49 00:05:52,500 --> 00:05:54,600 We'll run it again and take a look at the logs. 50 00:06:03,200 --> 00:06:09,720 As you can see, it's telling you what port it's connecting to, what service is running. 51 00:06:10,280 --> 00:06:16,160 And it also has the identification of who's doing the port scanning and where it's coming from. 52 00:06:18,620 --> 00:06:21,200 The next flag is an nmap. 53 00:06:21,200 --> 00:06:26,320 An nmap minus S, capital S, local host or target. 54 00:06:27,120 --> 00:06:30,820 What this is is it's a TCP SYN scan. 55 00:06:32,100 --> 00:06:38,660 This technique is often referred to as a half-open scan because you don't open a full TCP connection. 56 00:06:39,100 --> 00:06:41,800 In other words, you don't do three-way handshaking. 57 00:06:43,020 --> 00:06:45,200 It waits for SYN ACK from destination. 58 00:06:45,540 --> 00:06:48,220 If SYN ACK is received, then the port is open. 59 00:06:48,220 --> 00:06:50,880 If it's not, it's obviously closed. 60 00:06:52,680 --> 00:06:55,120 If reset is received, the port is closed. 61 00:06:56,040 --> 00:07:00,820 Rather than the ACK is established connection, it immediately resets to close the connection. 62 00:07:14,740 --> 00:07:17,220 This is scanning the same port. 63 00:07:18,220 --> 00:07:18,560 There's no ports here. 64 00:07:18,800 --> 00:07:27,540 But if we look into the logs, we get connection from unknown. 65 00:07:30,140 --> 00:07:33,220 It can't determine who's port scanning. 66 00:07:38,820 --> 00:07:41,940 The next flag is a stealth SYN. 67 00:07:42,180 --> 00:07:45,780 That's minus S, capital F. 68 00:07:48,220 --> 00:07:50,900 A SYN scan uses a bare SYN packet as the probe. 69 00:07:52,420 --> 00:07:55,040 Used when SYN scanning is not stealthy enough. 70 00:07:56,260 --> 00:08:02,780 Some programs watch for SYN packets such as SYNlogger and Courtney, just to name a few. 71 00:08:03,460 --> 00:08:04,640 We'll show that one. 72 00:08:18,280 --> 00:08:18,860 Yes, sir. 73 00:08:25,000 --> 00:08:26,300 It's been planned. 74 00:08:26,400 --> 00:08:30,040 I was going to put on some BGs, but... 75 00:08:35,240 --> 00:08:37,940 This is the stealth scan. 76 00:08:39,560 --> 00:08:40,040 Most... 77 00:08:40,760 --> 00:08:45,640 By the way, I don't have any extended logging on this machine, 78 00:08:45,760 --> 00:08:48,200 such as Abacus Sentry, or anything like that. 79 00:08:48,220 --> 00:09:00,640 But the conventional bar log messages, the scanner won't show up. 80 00:09:02,180 --> 00:09:04,320 The next one's a Christmas scan. 81 00:09:05,180 --> 00:09:09,120 Christmas scan turns on the fin, urge, and push flags. 82 00:09:11,380 --> 00:09:15,620 That's done by a minus S, capital X. 83 00:09:28,200 --> 00:09:32,300 Yes, you don't get anything coming up in your bar log messages. 84 00:09:33,660 --> 00:09:35,500 And the next one's a null scan. 85 00:09:35,840 --> 00:09:37,980 Null scan turns off all flags. 86 00:09:39,040 --> 00:09:39,980 Why Christmas? 87 00:09:41,280 --> 00:09:42,780 Uh, don't know. 88 00:09:43,540 --> 00:09:44,620 That's only Christmas. 89 00:09:45,540 --> 00:09:46,320 Oh, yeah. 90 00:09:48,220 --> 00:09:49,320 I actually wrote that. 91 00:09:49,580 --> 00:09:50,020 Oh. 92 00:09:51,320 --> 00:09:53,080 This is, uh, Fyodor. 93 00:09:53,440 --> 00:09:53,880 Fyodor. 94 00:09:54,180 --> 00:09:56,840 Uh, he wrote, uh, MNAP, actually. 95 00:09:57,440 --> 00:09:57,880 Uh... 96 00:09:57,880 --> 00:10:01,100 I just like Christmas scan because, you know, you've got almost all the flags there. 97 00:10:01,280 --> 00:10:03,460 You know, kind of a Christmas packet type of deal. 98 00:10:04,700 --> 00:10:06,480 And you don't have the, uh... 99 00:10:07,060 --> 00:10:08,880 You don't have the same packet in there. 100 00:10:09,440 --> 00:10:10,460 But, uh, there you go. 101 00:10:11,740 --> 00:10:12,620 Yeah, but... 102 00:10:13,220 --> 00:10:14,420 It's almost a Christmas packet. 103 00:10:14,640 --> 00:10:15,200 All right. 104 00:10:16,820 --> 00:10:17,260 Sorry. 105 00:10:17,260 --> 00:10:19,500 I just said it was... 106 00:10:19,500 --> 00:10:23,860 You're almost sending, you know, the Christmas packets, Christmas tree, light segment, uh, 107 00:10:23,980 --> 00:10:25,580 packets where you have all the flags enabled. 108 00:10:26,580 --> 00:10:27,300 So, uh... 109 00:10:29,740 --> 00:10:31,200 So that's just why I called it that. 110 00:10:31,440 --> 00:10:31,800 Sorry. 111 00:10:31,880 --> 00:10:32,720 This has kind of been prompt. 112 00:10:32,760 --> 00:10:35,220 I thought it was a radio scanning seminar. 113 00:10:35,460 --> 00:10:36,200 Someone just said, 114 00:10:36,260 --> 00:10:38,000 Hey, dude, do you have MNAP in that room? 115 00:10:39,040 --> 00:10:40,380 I thought I'd stop by. 116 00:10:41,380 --> 00:10:42,040 Well, come on. 117 00:10:42,140 --> 00:10:42,920 Pull up a speaker. 118 00:10:44,680 --> 00:10:45,040 Okay. 119 00:10:45,160 --> 00:10:45,460 Uh... 120 00:10:45,460 --> 00:10:48,340 The next one, uh, I'm gonna show is, uh, the ping scanning. 121 00:10:48,660 --> 00:10:52,180 Uh, ping scanning is used to determine what hosts are on the network are up. 122 00:10:52,680 --> 00:10:56,420 Sends an ICMP echo request to every machine on the network. 123 00:10:56,600 --> 00:10:58,040 Hosts that respond are up. 124 00:11:05,140 --> 00:11:10,080 I don't have a network up here, so it's only seeing my local computer here. 125 00:11:10,260 --> 00:11:10,520 It's... 126 00:11:10,520 --> 00:11:14,020 It sees my, uh, one IP address, one host up. 127 00:11:14,020 --> 00:11:15,660 Scan in zero seconds. 128 00:11:22,020 --> 00:11:27,580 Uh, the next one is, uh, minus P-T, capital P-T. 129 00:11:29,460 --> 00:11:32,900 It's, uh, TCP ping to determine what hosts are up. 130 00:11:32,920 --> 00:11:39,460 Instead of sending the ICMP echo request packets like in the previous one and waiting for a response, 131 00:11:39,540 --> 00:11:43,380 we send out a TCP act packets throughout the target network. 132 00:11:43,560 --> 00:11:44,000 Uh... 133 00:11:44,020 --> 00:11:47,380 Quitter a single machine and then wait for responses to return. 134 00:11:48,020 --> 00:11:50,400 Hosts that are up should respond with a reset. 135 00:11:51,480 --> 00:11:55,040 To set the destination port, it's, uh... 136 00:12:00,440 --> 00:12:01,040 Uh... 137 00:12:05,040 --> 00:12:11,260 Nmap minus P-T and then whatever port you want, uh, to scan. 138 00:12:11,940 --> 00:12:12,540 Uh... 139 00:12:12,540 --> 00:12:13,880 The default port is A80. 140 00:12:15,300 --> 00:12:16,860 So we'll just leave it at A80. 141 00:12:25,420 --> 00:12:26,360 Those are from... 142 00:12:26,360 --> 00:12:27,820 From Barlog messages. 143 00:12:31,800 --> 00:12:35,140 Uh, the next scan is, uh, minus S-U. 144 00:12:40,620 --> 00:12:42,840 This is a UDP scan. 145 00:12:43,140 --> 00:12:47,340 This method is used to determine which UDP ports are open to... 146 00:12:47,340 --> 00:12:47,960 On a host. 147 00:12:48,120 --> 00:12:52,420 Sends a zero byte UDP packet to each port on the target machine. 148 00:12:52,900 --> 00:12:57,580 If we receive an ICMP port unreachable message, then the port is closed. 149 00:12:58,720 --> 00:12:59,380 Um... 150 00:12:59,380 --> 00:13:04,060 The UDP scan takes considerably longer because of, uh... 151 00:13:04,060 --> 00:13:05,280 Um... 152 00:13:05,900 --> 00:13:10,760 The kernel limitations for sending out ICMP error messages. 153 00:13:11,140 --> 00:13:11,720 Um... 154 00:13:11,720 --> 00:13:18,040 This is defined in RFC 1812, section 4.3.2.8. 155 00:13:24,840 --> 00:13:25,720 Yeah, it's beautiful. 156 00:13:25,860 --> 00:13:26,820 They ignore the RFC. 157 00:13:26,900 --> 00:13:27,300 That's why. 158 00:13:28,360 --> 00:13:29,280 Another thing. 159 00:13:29,360 --> 00:13:33,440 Send back an error response for every packet you send immediately. 160 00:13:33,440 --> 00:13:35,520 There's no radiation at all. 161 00:13:35,900 --> 00:13:37,000 It's beautiful. 162 00:13:38,200 --> 00:13:42,440 On Solaris, it takes, uh, considerably longer. 163 00:13:43,100 --> 00:13:43,600 Um... 164 00:13:43,600 --> 00:13:47,640 Linux is, I think, 80 messages. 165 00:13:47,740 --> 00:13:49,780 Or 80 per 4 seconds. 166 00:13:50,480 --> 00:13:51,320 And... 167 00:13:51,320 --> 00:13:55,680 Solaris is limited to about 2 messages per second. 168 00:14:03,440 --> 00:14:03,780 Um... 169 00:14:06,060 --> 00:14:11,100 Some of the, uh, UDP services you may find are, uh... 170 00:14:11,100 --> 00:14:18,440 Call to the dead cows, back orifice, trivial FTP, NFS, SNMP... 171 00:14:21,760 --> 00:14:22,480 Um... 172 00:14:22,480 --> 00:14:22,720 Uh... 173 00:14:24,800 --> 00:14:25,520 Uh... 174 00:14:29,160 --> 00:14:29,880 Uh... 175 00:14:32,360 --> 00:14:33,080 Uh... 176 00:14:33,080 --> 00:14:33,100 Uh... 177 00:14:33,100 --> 00:14:33,420 Uh... 178 00:14:42,060 --> 00:14:43,460 Uh... 179 00:14:49,440 --> 00:14:50,840 Uh... 180 00:14:50,840 --> 00:14:52,140 Uh... 181 00:14:52,140 --> 00:14:52,160 Uh... 182 00:14:52,160 --> 00:14:53,240 Uh... 183 00:14:53,240 --> 00:14:55,940 Uh... 184 00:14:55,940 --> 00:14:57,580 Uh... 185 00:14:57,580 --> 00:14:58,520 Uh... 186 00:14:58,520 --> 00:14:59,260 Uh... 187 00:14:59,260 --> 00:14:59,920 Uh... 188 00:14:59,920 --> 00:15:00,040 Uh... 189 00:15:00,040 --> 00:15:00,300 Uh... 190 00:15:00,300 --> 00:15:01,640 Uh... 191 00:15:01,640 --> 00:15:03,040 Uh... 192 00:15:03,040 --> 00:15:03,420 Uh... 193 00:15:03,440 --> 00:15:03,620 Sorry? 194 00:15:05,540 --> 00:15:10,240 Exactly, just put class 16 at the end of the IDR. 195 00:15:11,260 --> 00:15:11,780 All right. 196 00:15:17,280 --> 00:15:17,880 Thank you. 197 00:15:21,660 --> 00:15:26,280 Yeah, by default, if you don't specify any courses, 198 00:15:26,500 --> 00:15:28,560 exactly, one through 1,024, 199 00:15:28,820 --> 00:15:32,700 plus the ones in the services file 200 00:15:32,700 --> 00:15:33,680 that comes with NMAP, 201 00:15:33,780 --> 00:15:35,980 which is basically your normal SD-SAC services, 202 00:15:36,320 --> 00:15:39,480 plus the backwards and the other ones 203 00:15:39,480 --> 00:15:41,020 that you might want to keep a watch out for. 204 00:15:45,800 --> 00:15:50,820 You can add your own services if you want. 205 00:15:51,020 --> 00:15:54,400 It was created by basically taking a shitload 206 00:15:54,400 --> 00:15:56,340 of SD-SAC services and putting them together. 207 00:15:56,780 --> 00:15:58,400 But if you find new services 208 00:15:58,400 --> 00:15:59,580 that you think should be in there, 209 00:15:59,740 --> 00:16:01,060 you don't just drop an email, 210 00:16:01,260 --> 00:16:02,680 of course, you can add it to your own. 211 00:16:02,700 --> 00:16:03,980 And that's through the file. 212 00:16:07,700 --> 00:16:11,240 By default, it only uses the one that's included. 213 00:16:12,420 --> 00:16:16,480 As you can see, it took a considerable amount of time, 214 00:16:16,540 --> 00:16:20,860 but we had the port state and protocol and service 215 00:16:20,860 --> 00:16:22,820 for the UDP to scan. 216 00:16:25,040 --> 00:16:28,000 The next one is the FTP bounce. 217 00:16:29,900 --> 00:16:32,340 In older FTP servers, 218 00:16:32,700 --> 00:16:33,800 it would allow proxy connection. 219 00:16:33,820 --> 00:16:36,600 An example, a user could connect to an FTP server 220 00:16:36,600 --> 00:16:38,660 and send a file anywhere on the internet 221 00:16:38,660 --> 00:16:40,540 from that FTP server. 222 00:16:41,900 --> 00:16:44,640 This method uses the FTP proxy 223 00:16:44,640 --> 00:16:48,140 to bounce a TCP scan off the server to the victim. 224 00:16:49,510 --> 00:16:52,220 So basically, you're scanning from another host. 225 00:16:53,220 --> 00:16:56,100 And that's, I'll put up the syntax. 226 00:17:08,060 --> 00:17:10,880 And then you put up the FTP bounce host. 227 00:17:18,440 --> 00:17:20,260 And then the target. 228 00:17:23,220 --> 00:17:24,460 And that's how it's run. 229 00:17:24,740 --> 00:17:26,720 I don't have two machines connected, 230 00:17:26,820 --> 00:17:27,940 so I can't show it to you. 231 00:17:31,120 --> 00:17:32,360 The next one is, 232 00:17:32,700 --> 00:17:37,180 the minus capital O flag. 233 00:17:38,040 --> 00:17:41,220 This option activates remote host identification 234 00:17:43,940 --> 00:17:46,860 by TCP IP fingerprinting. 235 00:17:46,920 --> 00:17:51,360 It takes advantage of nuances found in each OS's TCP IP stack 236 00:17:51,360 --> 00:17:53,780 to determine what OS is running. 237 00:17:54,600 --> 00:17:57,200 Send specifically crafted packets to a host. 238 00:17:57,540 --> 00:18:00,480 This information is used to generate a fingerprint, 239 00:18:00,480 --> 00:18:05,060 which is then used to match from a database of known OS fingerprints. 240 00:18:23,720 --> 00:18:26,900 So it shows us all the ports that are available, 241 00:18:27,040 --> 00:18:29,660 and then we have TCP sequence prediction. 242 00:18:30,540 --> 00:18:32,000 It's truly random. 243 00:18:32,160 --> 00:18:34,400 It would be very difficult to hijack. 244 00:18:37,160 --> 00:18:40,460 Hijacking using trusted relationship exploitation. 245 00:18:41,840 --> 00:18:43,900 Remote operating system guess. 246 00:18:44,120 --> 00:18:47,620 Linux 2.0.32-34. 247 00:18:48,560 --> 00:18:51,700 And I am using .34, so that is accurate. 248 00:18:53,200 --> 00:18:56,260 It shows one IP address and scan in two seconds. 249 00:18:57,880 --> 00:18:59,540 The next one is... 250 00:19:03,280 --> 00:19:06,080 Login option. 251 00:19:07,220 --> 00:19:08,620 Login. 252 00:19:12,020 --> 00:19:12,200 Login. 253 00:19:15,720 --> 00:19:16,120 Login. 254 00:19:16,120 --> 00:19:16,300 Login. 255 00:19:20,020 --> 00:19:21,420 Login. 256 00:19:24,480 --> 00:19:25,880 Login. 257 00:19:25,880 --> 00:19:26,720 Login. 258 00:19:26,900 --> 00:19:26,940 Login. 259 00:19:27,140 --> 00:19:27,720 Login. 260 00:19:35,420 --> 00:19:36,700 They certainly can. 261 00:19:37,000 --> 00:19:39,980 I mean, if you have a proxy, 262 00:19:40,260 --> 00:19:42,980 sometimes even those transparent proxies are in between. 263 00:19:43,480 --> 00:19:46,300 Anything that rewrites the packet headers 264 00:19:46,300 --> 00:19:47,380 is going to screw you up 265 00:19:47,380 --> 00:19:50,000 because we rely on a bunch of real low-level details 266 00:19:50,000 --> 00:19:53,000 like the ordering they put TCP options 267 00:19:53,560 --> 00:19:56,680 and the time-to-lives that they use. 268 00:19:58,140 --> 00:20:01,120 And, you know, just a ton of those low-level flags. 269 00:20:01,480 --> 00:20:03,820 So if you have anything in between you and them, 270 00:20:03,840 --> 00:20:05,440 like a masquerading host or whatnot, 271 00:20:06,600 --> 00:20:09,080 that rewrites the packets, you're in trouble. 272 00:20:09,420 --> 00:20:11,080 You can still sometimes figure it out, 273 00:20:12,340 --> 00:20:15,340 but, you know, it's hard for Nmap to automatically figure it out. 274 00:20:15,420 --> 00:20:17,740 You have to kind of compare the fingerprints you get 275 00:20:17,740 --> 00:20:19,780 with the Nmap fingerprints file. 276 00:20:32,900 --> 00:20:36,840 There are a few cases where, you know, it can report... 277 00:20:37,380 --> 00:20:41,660 Okay, his question is if there's a network device between you and them. 278 00:20:42,000 --> 00:20:44,960 Like, a router shouldn't cause you any trouble at all, 279 00:20:45,040 --> 00:20:48,240 but mostly it's masquerading hosts 280 00:20:48,240 --> 00:20:52,520 or, you know, those IP transparent proxying like Linux has. 281 00:20:52,780 --> 00:20:57,180 Anything that rewrites the, you know, TCP or IP headers, 282 00:20:57,880 --> 00:20:59,580 has the potential to screw you up 283 00:20:59,580 --> 00:21:01,000 because it kind of pollutes it. 284 00:21:01,060 --> 00:21:03,560 Some of the aspects will then look like 285 00:21:03,560 --> 00:21:05,080 the host in between you and them. 286 00:21:07,080 --> 00:21:11,760 But it shouldn't generally cause extra ports to be shown. 287 00:21:13,240 --> 00:21:14,120 Okay, do I do that? 288 00:21:17,760 --> 00:21:22,720 Yes, it absolutely does. 289 00:21:24,080 --> 00:21:26,620 You know, it takes a little bit more effort, you know, 290 00:21:26,620 --> 00:21:27,700 in that you have to compare the fingerprints 291 00:21:27,720 --> 00:21:29,940 but if you see something like, hey, 292 00:21:30,020 --> 00:21:33,320 the TCP window size is 0x2297, 293 00:21:33,980 --> 00:21:35,700 you know, that gives you a good clue. 294 00:21:35,780 --> 00:21:37,320 Look in the Nmap fingerprints file 295 00:21:37,320 --> 00:21:40,980 and see what machines have used that TCP initial window size 296 00:21:40,980 --> 00:21:43,400 and you can often figure out both 297 00:21:43,400 --> 00:21:44,700 who's at the very end 298 00:21:44,700 --> 00:21:46,900 and what's sitting between you and that host. 299 00:21:49,320 --> 00:21:49,840 Yes? 300 00:21:50,360 --> 00:21:52,220 Can you go back to the computer market 301 00:21:52,220 --> 00:21:55,300 and say, like, where is this 17-minute area? 302 00:21:56,200 --> 00:21:57,280 I don't know. 303 00:21:59,580 --> 00:22:01,540 Yeah, there's actually going to be a presentation 304 00:22:01,540 --> 00:22:03,940 by Craig Rowland, I believe. 305 00:22:04,380 --> 00:22:05,620 I'm not sure at what time. 306 00:22:07,960 --> 00:22:09,820 Okay, at 6 p.m. 307 00:22:11,720 --> 00:22:14,080 And he's been working on the Abacus project 308 00:22:15,180 --> 00:22:18,460 which kind of helps you detect some sorts of scans. 309 00:22:18,980 --> 00:22:20,640 Of course, Nmap has a lot of, 310 00:22:20,660 --> 00:22:22,020 I don't know what he's shown you so far, 311 00:22:22,180 --> 00:22:24,940 but it has a lot of extra features 312 00:22:24,940 --> 00:22:26,760 in order to counterattack 313 00:22:26,760 --> 00:22:27,260 those machines. 314 00:22:27,260 --> 00:22:31,440 For example, you can spoof the IP address you use 315 00:22:33,280 --> 00:22:35,780 and you can also send decoys out. 316 00:22:36,000 --> 00:22:37,140 So they'll say, hey, it looks like 317 00:22:37,140 --> 00:22:39,360 10 different IP addresses scanned me. 318 00:22:39,560 --> 00:22:42,240 You know, who was the person actually scanning? 319 00:22:42,720 --> 00:22:46,160 You can also sometimes trick Port Sentry 320 00:22:47,280 --> 00:22:49,020 into firewalling the wrong hosts, 321 00:22:49,180 --> 00:22:50,940 like if you have it on defensive mode. 322 00:22:51,880 --> 00:22:53,980 So you'll fake a port scan 323 00:22:53,980 --> 00:22:55,700 as coming from their main gateway. 324 00:22:55,900 --> 00:22:57,140 All of a sudden they say, 325 00:22:57,260 --> 00:22:58,000 oh, no, a port scan. 326 00:22:58,220 --> 00:22:59,620 You know, I'm going to drop their packets. 327 00:22:59,760 --> 00:23:01,300 But there goes their network connectivity. 328 00:23:01,760 --> 00:23:03,420 So you have to be very, very careful 329 00:23:03,980 --> 00:23:06,180 in deploying reactive capabilities 330 00:23:07,020 --> 00:23:08,140 because always remember 331 00:23:08,140 --> 00:23:09,840 the scans could be spoofed. 332 00:23:09,960 --> 00:23:11,400 Just because you logged a scan, 333 00:23:11,600 --> 00:23:12,880 it could be someone scanning you 334 00:23:12,880 --> 00:23:14,780 or it could be someone who wants you to think 335 00:23:14,780 --> 00:23:16,500 that someone's scanning you. 336 00:23:17,440 --> 00:23:19,100 So take everything in your logs 337 00:23:19,100 --> 00:23:20,380 with a grain of salt, of course. 338 00:23:22,180 --> 00:23:22,580 Yo. 339 00:23:34,020 --> 00:23:36,740 You know, there are various things 340 00:23:36,740 --> 00:23:38,520 that, you know, with the network 341 00:23:38,520 --> 00:23:39,760 that can in some cases 342 00:23:42,200 --> 00:23:46,340 cause it to fluctuate. 343 00:23:46,360 --> 00:23:47,760 You know, one of the biggest things 344 00:23:47,760 --> 00:23:49,740 is that people have, like I said, 345 00:23:49,800 --> 00:23:51,380 a masquerading gateway between them. 346 00:23:51,460 --> 00:23:52,760 So you're getting kind of pollution 347 00:23:52,760 --> 00:23:54,100 of one system in between. 348 00:23:55,860 --> 00:23:57,180 You can also have cases, 349 00:23:57,180 --> 00:23:57,840 where, hey, you know, 350 00:23:57,860 --> 00:23:59,300 if they specially configured it 351 00:23:59,300 --> 00:24:01,260 with a kernel parameter that changes, 352 00:24:01,320 --> 00:24:02,760 like Solaris has a parameter 353 00:24:02,760 --> 00:24:05,900 that'll change the TCP sequence predictability. 354 00:24:07,060 --> 00:24:08,860 We have that one covered in NMAP, 355 00:24:08,900 --> 00:24:10,160 but there are other examples 356 00:24:10,160 --> 00:24:12,260 where people can, you know, 357 00:24:12,260 --> 00:24:13,540 change their kernel parameters 358 00:24:13,540 --> 00:24:14,900 and make it look different. 359 00:24:21,600 --> 00:24:23,040 Generally, you should. 360 00:24:23,160 --> 00:24:24,320 But if you can find a host 361 00:24:24,320 --> 00:24:26,720 that doesn't always give you the same response, 362 00:24:27,440 --> 00:24:28,560 just send me mail, 363 00:24:29,320 --> 00:24:31,340 preferably with the IP address, if you can, 364 00:24:31,480 --> 00:24:34,180 and I'll, you know, see if I can address that. 365 00:24:35,160 --> 00:24:36,800 You know, sometimes some, like, 366 00:24:36,860 --> 00:24:38,960 Windows machines are really bad about this. 367 00:24:39,140 --> 00:24:40,880 You know, they're just not deterministic 368 00:24:40,880 --> 00:24:41,680 in a lot of ways. 369 00:24:42,220 --> 00:24:43,680 You know, you would think, 370 00:24:43,760 --> 00:24:45,460 if I send the same packet to them, 371 00:24:45,520 --> 00:24:47,180 I'll always get the same packet back, 372 00:24:48,140 --> 00:24:49,700 the same type of packet. 373 00:24:49,960 --> 00:24:51,180 But no, sometimes you'll get 374 00:24:51,180 --> 00:24:52,740 completely different flags set. 375 00:24:53,560 --> 00:24:55,200 You know, it's like, you know, 376 00:24:55,200 --> 00:24:56,680 maybe they have some uninitialized memory 377 00:24:56,680 --> 00:24:59,020 or whatnot, but I've seen 378 00:24:59,020 --> 00:25:00,380 some very bizarre characteristics 379 00:25:00,380 --> 00:25:01,920 where a Windows machine 380 00:25:01,920 --> 00:25:03,600 will look one way the first time, 381 00:25:03,640 --> 00:25:04,840 then you'll scan the same machine, 382 00:25:05,460 --> 00:25:07,120 you know, and it'll respond 383 00:25:07,120 --> 00:25:08,620 to the same packet differently. 384 00:25:09,520 --> 00:25:11,320 But yeah, there are some cases like that. 385 00:25:12,900 --> 00:25:13,920 I think so. 386 00:25:19,860 --> 00:25:21,240 Yeah, it definitely does. 387 00:25:21,460 --> 00:25:23,280 If it doesn't detect a host, 388 00:25:23,460 --> 00:25:25,260 like if in that example he just did, 389 00:25:25,820 --> 00:25:26,660 if it hadn't detected 390 00:25:26,680 --> 00:25:29,240 the host, it would've given a URL you can go 391 00:25:29,240 --> 00:25:31,680 and enter it in, and then I'll add it 392 00:25:31,680 --> 00:25:34,480 to the global database so that, you know, 393 00:25:34,480 --> 00:25:36,960 Nmap should be able to scan that sort of system. 394 00:25:37,280 --> 00:25:39,140 And we've already, we have hundreds of them in there, 395 00:25:39,200 --> 00:25:41,280 you know, from your normal Linux, you know, 396 00:25:41,320 --> 00:25:43,240 all the kernels, VBSD, OpenBSD, 397 00:25:43,380 --> 00:25:45,200 to really, really obscure shit, you know. 398 00:25:45,240 --> 00:25:47,960 They're special little printers, you know, 399 00:25:47,980 --> 00:25:49,800 all sorts of, you know, network cameras. 400 00:25:50,580 --> 00:25:52,860 You know, anything with an IP stack is fair game 401 00:25:52,860 --> 00:25:53,920 as far as I'm concerned. 402 00:25:54,480 --> 00:25:56,080 So send it in and I'll add it. 403 00:26:00,740 --> 00:26:01,340 . 404 00:26:04,020 --> 00:26:05,840 It's just hyping capital O. 405 00:26:19,700 --> 00:26:24,060 The last one I just did was a minus O 406 00:26:24,060 --> 00:26:25,280 and then a log file. 407 00:26:26,680 --> 00:26:38,780 to dc7.txt, and it just writes out to a file that I name. It's just like doing nmap minus 408 00:26:40,200 --> 00:26:46,300 lowercase s, uppercase s, localhost, and then direct it to a file with two greater than 409 00:26:46,300 --> 00:26:55,140 symbols. The next one's port ranges. You can actually set the port ranges you want to scan. 410 00:27:23,400 --> 00:27:26,260 And you get the listing of 411 00:27:26,260 --> 00:27:26,660 what the port ranges are. 412 00:27:26,680 --> 00:27:28,440 What services are running on those particular 413 00:27:28,440 --> 00:27:29,640 ports if they're open. 414 00:27:32,760 --> 00:27:34,540 The minus f is a 415 00:27:34,540 --> 00:27:36,460 fast scan. It only scans for 416 00:27:36,460 --> 00:27:38,340 services listed in etsy 417 00:27:38,340 --> 00:27:39,120 services file. 418 00:27:47,040 --> 00:27:48,160 I know it's not. 419 00:27:48,300 --> 00:27:50,460 I found it to be, you know, it does 420 00:27:50,460 --> 00:27:52,040 IO multiplexing through 421 00:27:52,040 --> 00:27:54,420 select and such, and I found 422 00:27:54,420 --> 00:27:56,220 that produces a significantly faster 423 00:27:56,220 --> 00:27:57,840 results because you don't have to waste 424 00:27:57,840 --> 00:27:59,760 kernel time scheduling all the threads 425 00:27:59,760 --> 00:28:01,420 when really all we need to do is 426 00:28:01,420 --> 00:28:02,480 multiplex the IO. 427 00:28:16,660 --> 00:28:17,760 They're actually automatically 428 00:28:17,760 --> 00:28:18,560 randomized. 429 00:28:34,980 --> 00:28:35,580 They're actually randomized. 430 00:28:35,580 --> 00:28:37,220 The next one is decoy scanning. 431 00:28:37,540 --> 00:28:38,560 He mentioned that. 432 00:28:39,080 --> 00:28:42,440 It causes a decoy scan to be performed which makes it appear 433 00:28:42,440 --> 00:28:48,880 the remote host, that the host you specify as decoys are scanning a target network too. 434 00:28:49,960 --> 00:28:56,000 The IDS might report five to ten port scans from unique IP addresses, but they won't know which ones are 435 00:28:56,000 --> 00:29:23,620 decoys and which one is the IP scanning them. The syntax for that is, well he's typing it 436 00:29:23,620 --> 00:29:27,480 in, let me just mention a couple quick things about decoys, a couple hints that people may 437 00:29:27,480 --> 00:29:34,680 find useful. One, a very popular and very excellent tool for detecting sin scans and 438 00:29:34,680 --> 00:29:41,080 such that I recommend is ScanLogD by Solar Designer. However, you know, you come into 439 00:29:41,080 --> 00:29:47,440 denial of service issues, you know, if you try and detect too many scans, I mean you 440 00:29:47,440 --> 00:29:52,940 don't want me to just give them, you know, 100,000 fake IPs and fill up your logs. So 441 00:29:52,940 --> 00:29:58,000 by default, and use all your memory space, so by default ScanLogD only logs the first 442 00:29:58,000 --> 00:30:06,020 five addresses that are scanned from. So I recommend always use at least five decoys 443 00:30:06,020 --> 00:30:13,140 and you can use ME as a parameter saying my IP in order, otherwise it randomizes, you 444 00:30:13,140 --> 00:30:17,120 know, which order is you and which is the decoys. You know, if you have six or seven 445 00:30:17,120 --> 00:30:22,380 of them and then you say capital M, capital E, you know, me, then ScanLogD will only 446 00:30:22,380 --> 00:30:22,740 log. 447 00:30:22,940 --> 00:30:29,260 The first five addresses and you'll generally be home free. Another quick decoy hint is, 448 00:30:29,320 --> 00:30:33,200 and this is probably obvious to most of you, but I've been amazed how many times I get 449 00:30:33,200 --> 00:30:40,420 people from, you know, Yahoo and Microsoft, you know, people don't use, you know, www.yahoo.com 450 00:30:40,420 --> 00:30:48,640 as your decoy. I mean, let's see, I got a scan from Microsoft.com, Yahoo.com, and dialup33.uu.net. 451 00:30:48,960 --> 00:30:51,180 You know, you ruined your decoy there. 452 00:30:52,940 --> 00:30:58,060 I've seen that a lot, you know. How did I get caught? I used five decoys. Well, you 453 00:30:58,060 --> 00:31:01,660 know, you got to have a clue. Same with hosts that aren't up, you know. They're just made 454 00:31:01,660 --> 00:31:06,220 up IP addresses. They don't even route and you wonder why they figured out, you know, 455 00:31:06,240 --> 00:31:09,640 who it was doing it. You know, you do have to show a little sense here. 456 00:31:16,220 --> 00:31:22,920 The last one is, that I'm going to mention, is minus G and that sets the source of the 457 00:31:22,940 --> 00:31:28,680 source port number used in the scan. Because many firewalls, you'll let through the DNS 458 00:31:28,680 --> 00:31:39,760 port or FTP data on port 20, so you can spoof a DNS packet and scan inside. That's minus 459 00:31:39,760 --> 00:31:40,040 G. 460 00:31:49,060 --> 00:31:51,380 And the target, and that's the syntax. 461 00:31:58,460 --> 00:32:03,500 Yeah, just a quick note. You know, that's more useful than it even looks. I mean, I'm 462 00:32:03,500 --> 00:32:07,700 sure none of you administrators do it, but you'd be amazed how many people just, oh, 463 00:32:07,700 --> 00:32:11,820 crap, we installed the new firewall and DNS isn't working. We got to let these DNS packets 464 00:32:11,820 --> 00:32:17,740 through. Oh, well, let's just, anything from source port 53 has got to be DNS, right? You 465 00:32:17,740 --> 00:32:21,600 know, just let it through. And, oh, shit, you know, FTP's not working because you can't 466 00:32:21,600 --> 00:32:22,920 make the FTP data connect. 467 00:32:22,940 --> 00:32:28,440 Well, a quick firewall rule. You know, so, you know, I've been completely flabbergasted 468 00:32:28,440 --> 00:32:39,080 by how often just adding hyphen G 53 for UDP scans or hyphen G 20 for TCP scans, you 469 00:32:39,080 --> 00:32:40,640 know, suddenly gets straight through. 470 00:32:41,860 --> 00:32:48,360 Right, that's a great tool. It's kind of on the lines as Firewalk. I don't know if 471 00:32:48,360 --> 00:32:52,920 any of you saw that by route. You can check that out at packet.com. 472 00:32:54,960 --> 00:33:00,000 But does anyone have any questions? 473 00:33:06,240 --> 00:33:14,940 Oh, yeah, let's kick ass. A guy, let's see, what's his name? Yeah, it comes with an X 474 00:33:14,940 --> 00:33:22,620 version for people who like GUIs. A guy wrote it. Fuck. Forgot his name right offhand. But 475 00:33:22,620 --> 00:33:22,920 anyway, it's a great tool. It's a great tool. It's a great tool. It's a great tool. It's 476 00:33:22,940 --> 00:33:28,260 called NmapFE. If you go to the web page, it has links to it. Yeah, if you're into 477 00:33:28,260 --> 00:33:33,360 that, it uses GTK, and it's a real pretty interface, and it allows you to point and 478 00:33:33,360 --> 00:33:38,200 click. Because some people bitch at me saying, hey, you know, there's like 28 options, and 479 00:33:38,200 --> 00:33:42,880 I have to read the man page every time I use it. So here you can just, you know, they're 480 00:33:42,880 --> 00:33:47,120 intuitively placed, and you can click your buttons and such. You know, to check that 481 00:33:47,120 --> 00:33:47,320 out. 482 00:33:48,380 --> 00:33:52,820 The last thing I want to mention is really try to attend Craig Rowan. 483 00:33:52,940 --> 00:34:04,920 Speak. Speech. The Abacus Sentry IDS is really nice. It'll detect port scans and dump them 484 00:34:04,920 --> 00:34:11,920 in your host.denial file, so they can't even reach you. It's really nice. But does anyone 485 00:34:11,920 --> 00:34:12,620 have any questions? 486 00:34:15,140 --> 00:34:16,380 You said 6, right? 487 00:34:17,080 --> 00:34:18,060 You said 18? 488 00:34:18,140 --> 00:34:19,860 Oh, yeah. 1800 hours, 6 o'clock. 489 00:34:22,940 --> 00:34:23,640 In the back. 490 00:34:41,520 --> 00:34:52,080 Oh, you're talking about like a time-based attack, like slow? 491 00:34:52,940 --> 00:34:53,400 So that. 492 00:35:06,640 --> 00:35:11,040 One thing that would be useful in that respect is like a really slow scan, you know, that 493 00:35:11,040 --> 00:35:15,500 take a week or two, and, you know, scan port by port, so you stay under the thresholds. 494 00:35:15,500 --> 00:35:19,420 You know, there's also distributed scans, you know, scan from six machines and coordinate 495 00:35:19,420 --> 00:35:22,920 the results. Personally, though, my technique, you know, I don't have a lot of experience 496 00:35:22,940 --> 00:35:25,860 with port scans, but I do have a lot of experience with port scans, which is distribute widely 497 00:35:25,860 --> 00:35:32,380 available, easy-to-use tools to do this, so that all the script kiddies, that way 498 00:35:32,380 --> 00:35:36,200 they don't see anything abnormal. They'll say, huh, this looks like the 20 other scans, 499 00:35:36,520 --> 00:35:41,700 you know, that are in my log from today. You know, so since these tools are so widely 500 00:35:41,700 --> 00:35:48,600 available, it allows, people are less concerned about seeing a port scan. You know, they see 501 00:35:48,600 --> 00:35:50,180 it every day. It's kind of like a trace route. 502 00:35:52,940 --> 00:35:58,360 And also, you can use the decoys. It's very difficult, you know, to trace that back if 503 00:35:58,360 --> 00:36:04,540 they see 10 or 20 different IP addresses doing the scanning, as long as you've chosen the 504 00:36:04,540 --> 00:36:10,980 decoys well, of course. So I am probably going to add the slow scan, but I haven't 505 00:36:10,980 --> 00:36:16,520 yet, just because I'm not very patient, and I don't want to wait a week for my scan results. 506 00:36:20,200 --> 00:36:22,520 I think we're going to wrap it up now. CDC. 507 00:36:22,940 --> 00:36:30,000 He's about to start with VO2K. If you need to email either one of us, modify at attrition.org 508 00:36:30,000 --> 00:36:36,780 or theodore at insecure.org or dhp.com. Thanks a lot.