1 00:00:05,800 --> 00:00:13,920 Hi. Good afternoon. It's noon, right? No, afternoon. My name is Mick Bauer, and before 2 00:00:13,920 --> 00:00:21,160 anybody asks, I am not on my way to a Scottish funeral, thank you. I'm here to talk about 3 00:00:21,160 --> 00:00:31,440 self-abuse for smarter log monitoring. It's really a fairly simple technique, but I thought 4 00:00:31,440 --> 00:00:37,060 it would be a fun context in which to talk about log monitoring and to talk about self-scanning 5 00:00:37,060 --> 00:00:45,240 and about self-abuse, if you want, later on. The talk that I'm about to give is reasonably 6 00:00:45,240 --> 00:00:49,900 well-structured, and I just wanted to show you that I am working off of an outline, despite 7 00:00:49,900 --> 00:00:51,140 what it might appear to be. 8 00:00:51,160 --> 00:00:56,380 Later on, because I do want to keep things fairly loose, I want you guys to have as much 9 00:00:56,380 --> 00:01:00,960 impact on the flow of this as you want to have. So comments, questions, observations 10 00:01:00,960 --> 00:01:08,560 are welcome at all times. Later on, I'm even going to open up the floor for people to beat 11 00:01:08,560 --> 00:01:13,060 up on my victim system here, and I'll give the IP address of that when the time comes, 12 00:01:13,160 --> 00:01:20,300 although some of you may deduce it way before then. And whoever causes interesting log messages 13 00:01:20,300 --> 00:01:21,140 to show up. 14 00:01:21,160 --> 00:01:28,100 We'll get a prize. Okay, so let's just dive into it here. What is the point of scanning 15 00:01:28,100 --> 00:01:36,420 yourself, you might ask? Well, security people like me tell you, monitor your logs. When 16 00:01:36,420 --> 00:01:41,560 you harden your web server and you configure everything into a production state and it's 17 00:01:41,560 --> 00:01:45,260 working, you should not abandon it, right? You shouldn't just leave it chugging off in 18 00:01:45,260 --> 00:01:50,580 the corner. Among other things, you should be monitoring its logs regularly. Maybe you 19 00:01:50,580 --> 00:01:56,800 even want an IDS system running on it, a host-based IDS system. Maybe you want a simple log 20 00:01:56,800 --> 00:02:05,600 watcher like Swatch or LogWatcher or LogDigest. But in all of these cases, you as a sys admin 21 00:02:05,600 --> 00:02:12,220 need to know something about what constitutes evil activity. Would you know an attack-induced 22 00:02:12,220 --> 00:02:17,940 log message if you saw one? Maybe you would, maybe you wouldn't. This technique can help. 23 00:02:20,580 --> 00:02:29,460 Okay, so, if I'm talking about running, let's say, nessus or nicto against a system, and 24 00:02:29,460 --> 00:02:34,840 you're going to be logged on to that system and tailing the logs, there's a couple of 25 00:02:34,840 --> 00:02:40,240 assumptions at play here that I wanted to spell out. The first is that one of these 26 00:02:40,240 --> 00:02:44,180 scanners, the scanner that you're using, whether it's nicto, whether it's nessus or whether 27 00:02:44,180 --> 00:02:50,340 it's just telnet, you know, telnet 80, et cetera, the assumption is that that's going 28 00:02:50,340 --> 00:02:56,500 going to look in the logs pretty much the same as live exploits the kiddies in the field 29 00:02:56,500 --> 00:03:01,180 would be running on you. I think this is a fairly reasonable assumption. What a security 30 00:03:01,180 --> 00:03:07,000 scanner like Nessus does is it actually does the early stages of actual exploits. That 31 00:03:07,000 --> 00:03:12,700 is to say it does the sort of very targeted reconnaissance and initiates the types of 32 00:03:12,700 --> 00:03:19,020 packet sequences that a full blown actually trying to root your box attack would do. But 33 00:03:19,020 --> 00:03:24,820 that may or may not be a leap for you. When in doubt, there's no substitute for running 34 00:03:24,820 --> 00:03:31,720 actual exploit code against yourself if you want ultra-realism in this. In my opinion, 35 00:03:32,060 --> 00:03:42,400 you know, using a generalized scanner like Nessus or Nycto is perfectly okay. And then 36 00:03:42,400 --> 00:03:47,720 so there's value in that in seeing what kiddie behavior looks like. 37 00:03:47,940 --> 00:03:49,000 Another thing that I want to talk about is that there's a lot of trouble with the 38 00:03:49,000 --> 00:03:53,900 that's probably equally, maybe even more important is, what if you run your all the stops pulled 39 00:03:53,900 --> 00:03:59,420 Nessus scan against your host and it logs like nothing? That's telling you something really 40 00:03:59,420 --> 00:04:06,080 important, isn't it? It's telling you, okay, time to go in and fine tune syslogd. Time to go in and 41 00:04:06,080 --> 00:04:11,640 maybe tweak the logging settings on Apache or whatever so that I'm seeing the information that 42 00:04:11,640 --> 00:04:18,700 I expect or want to be seeing when the bad guys come knocking. And then finally, it's just good 43 00:04:18,700 --> 00:04:28,120 clean fun to scan yourself. Okay. Now there are a few limitations, not only with this little 44 00:04:28,120 --> 00:04:34,780 technique, but also with log monitoring in general and even I would extend that to IDS and that is, 45 00:04:36,400 --> 00:04:42,320 I'm not proposing that if only you stay logged in long enough and frequently enough and watch the 46 00:04:42,320 --> 00:04:47,360 logs obsessively, you're going to catch bad guys in the act and lock them out of your systems. 47 00:04:47,720 --> 00:04:48,680 I mean that's okay. 48 00:04:48,680 --> 00:04:53,260 obviously not realistic. I think that it's not realistic a lot of the time with IDS as 49 00:04:53,260 --> 00:05:01,360 well. Logs are first and foremost a forensics tool. They let you know what happened. By 50 00:05:01,360 --> 00:05:09,900 definition, nothing is logged until after it occurs, right? So if you really want, if 51 00:05:09,900 --> 00:05:14,880 you're really worried about proactive security, the plain old unglamorous techniques of staying 52 00:05:14,880 --> 00:05:21,640 patched, disabling and uninstalling unnecessary stuff, being aware of current trends in 53 00:05:21,640 --> 00:05:25,840 infosec, you know, what is the latest worm making their rounds and that sort of thing. And 54 00:05:25,840 --> 00:05:29,900 finally, knowing and understanding the security features in your software and in your 55 00:05:29,900 --> 00:05:38,840 operating system, these are the ways that you keep attackers out. This is log monitoring, IDS, 56 00:05:38,860 --> 00:05:43,860 the rest of it, these are tools for knowing how good of a job you're doing with that other 57 00:05:43,860 --> 00:05:44,180 stuff. 58 00:05:44,880 --> 00:05:44,920 So it's all about knowing how good of a job you're doing and how good of a job an attacker will be, 59 00:05:44,920 --> 00:05:49,560 uh, in my opinion. Now there are things that you can do. Snort, for example, has got an add-on 60 00:05:49,560 --> 00:05:54,300 called, that would be called Hogwash that can be used to dynamically reconfigure your firewall 61 00:05:54,300 --> 00:06:01,720 rules. Now it says right in the Snort FAQ, and I agree wholeheartedly with it, that, um, this is a 62 00:06:01,720 --> 00:06:09,140 beautiful opportunity for denial of service attacks. Um, if you know that somebody is, somebody is 63 00:06:09,140 --> 00:06:10,340 using something like this. 64 00:06:15,340 --> 00:06:16,700 that'll look like an attack. 65 00:06:17,020 --> 00:06:20,040 In other words, spoof an attack from victim A 66 00:06:20,040 --> 00:06:23,820 against a hogwash or otherwise dynamic firewall 67 00:06:23,820 --> 00:06:27,000 modified type host over here, 68 00:06:27,810 --> 00:06:30,420 you can effectively prevent this host 69 00:06:30,420 --> 00:06:33,160 from receiving legitimate traffic from the victim host. 70 00:06:34,160 --> 00:06:36,540 This is really the fly 71 00:06:36,540 --> 00:06:40,360 in the so-called intrusion prevention ointment. 72 00:06:40,520 --> 00:06:42,320 And there's various ways around that, 73 00:06:42,320 --> 00:06:44,820 and I'm really not prepared to get in big debate about it 74 00:06:44,820 --> 00:06:49,020 or anything, but other than tools like hogwash, 75 00:06:50,000 --> 00:06:52,280 IDSs are mostly for forensics, I think. 76 00:06:54,040 --> 00:06:55,940 Okay, does anyone want to pick 77 00:06:55,940 --> 00:06:57,780 that particular religious fight with me now, 78 00:06:57,920 --> 00:06:58,900 or should I move on? 79 00:07:00,120 --> 00:07:02,260 I don't think it's really that controversial anymore. 80 00:07:04,840 --> 00:07:07,040 Okay, well then let's dive right into a demonstration. 81 00:07:09,140 --> 00:07:11,900 I'm going to run a Nikto scan against this box, 82 00:07:11,900 --> 00:07:12,680 which is running Apache, 83 00:07:14,200 --> 00:07:19,140 and give me a second here while I turn on a log tail. 84 00:07:31,200 --> 00:07:31,640 Okay. 85 00:07:32,960 --> 00:07:36,000 What I'm going to do on my main laptop over here, 86 00:07:36,540 --> 00:07:39,480 I've got a Nikto scan all fired up and ready to go, 87 00:07:40,480 --> 00:07:40,920 and... 88 00:07:41,840 --> 00:07:43,680 Nikto, if you're unfamiliar with it, 89 00:07:43,720 --> 00:07:46,100 is the successor to Whisker. 90 00:07:47,100 --> 00:07:50,640 Rainforest Puppy stopped active development on Whisker. 91 00:07:50,780 --> 00:07:52,540 He's still maintaining LibWhisker, 92 00:07:53,240 --> 00:07:56,740 and if you're interested in what Whisker used to do, 93 00:07:56,880 --> 00:07:58,340 you're redirected to... 94 00:07:58,340 --> 00:08:00,860 not redirected, but encouraged to go to cert.net 95 00:08:00,860 --> 00:08:02,600 and get your hands on Nikto, 96 00:08:02,740 --> 00:08:04,400 which in fact uses LibWhisker. 97 00:08:04,540 --> 00:08:07,100 It is a web server scanner, 98 00:08:07,460 --> 00:08:09,180 and what it does, 99 00:08:09,180 --> 00:08:11,360 among other things, 100 00:08:11,460 --> 00:08:13,580 is it checks for known bad CGI scripts, 101 00:08:13,800 --> 00:08:18,140 known bad sample scripts of various kinds, 102 00:08:18,340 --> 00:08:19,760 and a whole lot more. 103 00:08:20,520 --> 00:08:23,140 And if you're interested in command line flags, 104 00:08:23,420 --> 00:08:25,280 I'm starting it with a general scan. 105 00:08:25,620 --> 00:08:27,120 That's what the dash G is for. 106 00:08:27,280 --> 00:08:29,600 Dash N means no DNS resolution. 107 00:08:30,940 --> 00:08:34,600 And then dash H tells it the target host to scan. 108 00:08:35,000 --> 00:08:37,860 So, I fire that up, 109 00:08:37,860 --> 00:08:40,060 and at this point, 110 00:08:40,180 --> 00:08:45,000 I can skip to my victim. 111 00:08:45,660 --> 00:08:48,940 And let me see if I can't expand that a little bit. 112 00:08:56,640 --> 00:08:57,160 Okay. 113 00:08:58,300 --> 00:08:59,260 And ta-da! 114 00:08:59,560 --> 00:09:02,700 That's what log output looks like 115 00:09:02,700 --> 00:09:04,340 on a machine that's being Nikto scanned. 116 00:09:07,080 --> 00:09:07,600 Fascinating. 117 00:09:07,600 --> 00:09:07,840 Isn't it? 118 00:09:07,860 --> 00:09:09,200 I could watch this for hours. 119 00:09:11,760 --> 00:09:12,440 Actually, you know, 120 00:09:12,960 --> 00:09:13,900 well, that isn't the point. 121 00:09:14,380 --> 00:09:15,140 Notice, though, 122 00:09:15,180 --> 00:09:17,100 what I'm seeing is a lot of repetitions 123 00:09:17,100 --> 00:09:18,300 of really similar messages. 124 00:09:20,140 --> 00:09:22,440 If I'm setting up something like swatch, 125 00:09:22,780 --> 00:09:24,700 if I'm setting up something like log digest, 126 00:09:25,780 --> 00:09:28,660 I'm going to make sure that the string file does not exist 127 00:09:28,660 --> 00:09:31,080 is one of the things that I'm checking for, right? 128 00:09:31,140 --> 00:09:33,620 If I'm concerned about being Nikto scanned, 129 00:09:33,720 --> 00:09:37,420 if I'm concerned about people probing this web server for stuff. 130 00:09:38,500 --> 00:09:43,180 Now, if I'm only interested in a specific type of scan, 131 00:09:43,380 --> 00:09:44,980 I can say, you know, 132 00:09:45,020 --> 00:09:47,000 grep for more than file does not exist, 133 00:09:47,120 --> 00:09:47,760 but you get the idea. 134 00:09:50,540 --> 00:09:51,220 Any questions? 135 00:09:51,740 --> 00:09:53,180 I know that's really deep and all. 136 00:09:55,840 --> 00:09:56,200 Okay. 137 00:09:58,980 --> 00:09:59,600 Wait, oops. 138 00:10:00,140 --> 00:10:00,940 Okay, there we go. 139 00:10:01,720 --> 00:10:02,660 Now, as you can see, 140 00:10:02,740 --> 00:10:04,140 this is back to, oh, nuts. 141 00:10:04,300 --> 00:10:05,060 Look over here. 142 00:10:06,740 --> 00:10:07,740 Oh, I wonder if the problem, 143 00:10:07,740 --> 00:10:08,280 the problem is the switch. 144 00:10:11,240 --> 00:10:12,120 Eh, well. 145 00:10:15,480 --> 00:10:16,940 Oh, yeah, it must be the switch. 146 00:10:17,480 --> 00:10:17,960 Okay. 147 00:10:20,240 --> 00:10:21,600 So, as we can see, 148 00:10:21,640 --> 00:10:23,080 Nikto is finding some things wrong. 149 00:10:24,420 --> 00:10:27,020 And, oh, one of the things that it has found 150 00:10:27,020 --> 00:10:31,500 is that there is the Apache manual installed on here, 151 00:10:31,580 --> 00:10:33,160 which is default for SUSE Linux. 152 00:10:33,300 --> 00:10:34,880 When you install Apache on SUSE Linux, 153 00:10:35,100 --> 00:10:37,640 it very conveniently gives you the Apache, 154 00:10:37,640 --> 00:10:37,920 the Apache manual. 155 00:10:38,240 --> 00:10:39,600 Now, that's probably harmless. 156 00:10:40,300 --> 00:10:42,180 I mean, it's just a manual, right? 157 00:10:42,300 --> 00:10:43,840 But it has a little search engine in there. 158 00:10:44,180 --> 00:10:47,320 And the fact is that, as a matter of practice, 159 00:10:47,440 --> 00:10:49,220 you don't want anything unnecessary installed 160 00:10:49,220 --> 00:10:50,600 on a production web server, right? 161 00:10:50,940 --> 00:10:54,460 So, even something as innocuous as the Apache manual being there 162 00:10:54,460 --> 00:10:55,860 is still a significant finding. 163 00:10:55,980 --> 00:10:58,480 And this, of course, is the other benefit of this technique, 164 00:10:58,600 --> 00:11:00,320 is when you scan yourself, 165 00:11:01,220 --> 00:11:03,860 you will find out if there's more hardening 166 00:11:03,860 --> 00:11:05,720 that you've still got to do on the hosting question. 167 00:11:07,640 --> 00:11:09,220 I would like, if I could, 168 00:11:10,740 --> 00:11:13,280 to insert another demo here 169 00:11:13,280 --> 00:11:16,540 that I hadn't really included on the slides. 170 00:11:16,900 --> 00:11:19,540 But before I do that, 171 00:11:19,600 --> 00:11:21,360 are there any questions up to this point? 172 00:11:22,780 --> 00:11:23,640 Any at all? 173 00:11:24,800 --> 00:11:25,280 Okay. 174 00:11:26,680 --> 00:11:27,160 Okay. 175 00:11:30,940 --> 00:11:32,040 What I'm going to do 176 00:11:32,040 --> 00:11:35,000 is I'm going to 177 00:11:36,680 --> 00:11:37,620 pull up that manual, 178 00:11:37,620 --> 00:11:37,820 and I'm going to pull up that manual. 179 00:11:46,060 --> 00:11:46,540 Here. 180 00:11:46,600 --> 00:11:47,380 Bear with me. 181 00:11:58,680 --> 00:12:00,000 And what do we got here? 182 00:12:02,540 --> 00:12:03,800 Ah, yep, sure enough. 183 00:12:04,000 --> 00:12:05,380 Nikto was not delusional. 184 00:12:06,360 --> 00:12:07,600 The Apache manual, 185 00:12:07,620 --> 00:12:09,040 the Apache manual is running on this host. 186 00:12:10,240 --> 00:12:10,840 Now, 187 00:12:13,320 --> 00:12:14,640 there is a thing 188 00:12:15,600 --> 00:12:16,800 called Peros. 189 00:12:17,260 --> 00:12:19,580 The loft has an equivalent of this, 190 00:12:19,640 --> 00:12:20,420 a commercial product. 191 00:12:20,620 --> 00:12:21,160 I think it's called, 192 00:12:21,340 --> 00:12:22,320 or excuse me, 193 00:12:22,340 --> 00:12:22,820 AtStake. 194 00:12:22,940 --> 00:12:23,700 My bad. 195 00:12:24,280 --> 00:12:26,600 The AtStake web security proxy. 196 00:12:27,340 --> 00:12:29,720 And what a web security proxy is for 197 00:12:29,720 --> 00:12:33,320 is for testing various types of web vulnerabilities 198 00:12:34,600 --> 00:12:36,900 pretty much at the application layer. 199 00:12:37,080 --> 00:12:37,600 And, 200 00:12:37,600 --> 00:12:38,620 in other words, 201 00:12:39,940 --> 00:12:43,080 I can trap requests from my, 202 00:12:43,140 --> 00:12:45,260 outbound requests from my attacking machine, 203 00:12:45,660 --> 00:12:47,000 monkey with them, 204 00:12:47,160 --> 00:12:49,400 and then send them back on their way 205 00:12:49,400 --> 00:12:50,640 towards the victim machine. 206 00:12:50,960 --> 00:12:55,240 So, let's say I click trap request on here, 207 00:12:55,380 --> 00:12:58,220 and incidentally, Peros is available, 208 00:12:58,600 --> 00:12:59,600 oh brother, 209 00:12:59,780 --> 00:13:01,440 I forgot to include a URL on this. 210 00:13:01,540 --> 00:13:06,200 If you do a Google search for Peros web proxy, 211 00:13:06,700 --> 00:13:07,580 you'll find it. 212 00:13:07,600 --> 00:13:08,060 Really easily. 213 00:13:08,420 --> 00:13:09,660 Oh wait, I know what I can do. 214 00:13:13,480 --> 00:13:14,400 Proofsecure.com. 215 00:13:14,480 --> 00:13:15,620 That's where you get Peros. 216 00:13:15,900 --> 00:13:17,500 Or Paros, if you're European. 217 00:13:19,600 --> 00:13:20,540 Proofsecure.com. 218 00:13:20,960 --> 00:13:21,440 Okay. 219 00:13:21,500 --> 00:13:23,980 I have told Peros to trap the next request 220 00:13:23,980 --> 00:13:25,080 that passes through it. 221 00:13:25,160 --> 00:13:27,540 Oh, and incidentally, behind the scenes in my hotel room, 222 00:13:27,660 --> 00:13:30,340 I set up my web browser so that it's using, 223 00:13:31,240 --> 00:13:35,000 it's using localhost colon 8080 as its web proxy. 224 00:13:35,240 --> 00:13:37,100 And that's what Peros is listening on. 225 00:13:37,600 --> 00:13:39,340 I go back to my web page here. 226 00:13:40,960 --> 00:13:42,440 I type in some kind of, 227 00:13:42,440 --> 00:13:44,220 wait, let's do something that I'll see. 228 00:13:46,540 --> 00:13:49,960 I type in a search string, click the button. 229 00:13:50,660 --> 00:13:52,400 Now, the Netscape icon, 230 00:13:52,780 --> 00:13:53,680 oh, I'm pointing at my screen. 231 00:13:53,760 --> 00:13:54,740 That does you no good at all. 232 00:13:55,300 --> 00:13:56,580 In the upper right hand corner, 233 00:13:56,720 --> 00:13:59,440 that Netscape icon is spinning and spinning. 234 00:13:59,560 --> 00:14:00,320 That's because, 235 00:14:02,780 --> 00:14:07,020 that's because Peros has grabbed that outbound HTTP request, 236 00:14:07,020 --> 00:14:08,980 so that I can monkey with it. 237 00:14:09,540 --> 00:14:11,320 And we see down here in the bottom, 238 00:14:11,380 --> 00:14:14,560 in the body, I mean, here's my search string. 239 00:14:15,760 --> 00:14:18,000 Now, this is sort of a lame example, 240 00:14:18,260 --> 00:14:22,800 but what I could do here is type perhaps a much, 241 00:14:22,820 --> 00:14:25,180 much longer string than the web page itself 242 00:14:25,180 --> 00:14:27,460 will let me type in, in that field. 243 00:14:28,840 --> 00:14:30,960 So I lay in a whole bunch of Fs. 244 00:14:34,460 --> 00:14:36,080 And then I hit continue. 245 00:14:37,020 --> 00:14:38,920 Now, if I flip back to my web server, 246 00:14:39,080 --> 00:14:41,280 okay, I got an error message. 247 00:14:41,400 --> 00:14:41,940 That's good. 248 00:14:42,560 --> 00:14:44,100 That little search engine apparently 249 00:14:44,100 --> 00:14:45,540 has some kind of error handling. 250 00:14:45,780 --> 00:14:47,100 But if it didn't, 251 00:14:48,060 --> 00:14:51,060 if the web server froze up or something, 252 00:14:51,200 --> 00:14:54,220 that would tell me something about the security involved 253 00:14:54,220 --> 00:14:56,180 in that little search thing. 254 00:14:56,440 --> 00:14:57,580 So anyhow, that's Peros. 255 00:14:57,660 --> 00:14:59,180 If you're interested in web security, 256 00:14:59,400 --> 00:15:00,900 and if you're running a web server, 257 00:15:01,000 --> 00:15:02,740 you really ought to be. 258 00:15:03,060 --> 00:15:06,920 I highly recommend this tool for testing web forms, 259 00:15:07,020 --> 00:15:07,860 and web applications. 260 00:15:08,920 --> 00:15:12,660 Anything that could be vulnerable to fuzzing, 261 00:15:12,760 --> 00:15:14,040 which is what we just did, by the way. 262 00:15:14,380 --> 00:15:18,000 Fuzzing, cross-scripting type attacks, you name it. 263 00:15:19,020 --> 00:15:21,020 Okay, back to the regularly-scheduled program. 264 00:15:25,580 --> 00:15:26,020 Okay. 265 00:15:27,180 --> 00:15:28,840 So we saw Nikto versus Apache. 266 00:15:30,460 --> 00:15:32,500 Let's dive right into a third demonstration. 267 00:15:33,220 --> 00:15:34,280 Can you believe it? 268 00:15:34,360 --> 00:15:36,940 So many demonstrations in such a short period of time. 269 00:15:41,500 --> 00:15:46,360 Oh, no. Why is this still logging? Oh, is NICTO still running? It must be. Oh, yeah, 270 00:15:46,380 --> 00:15:56,500 it is. Okay, I'm going to kill NICTO. And the site for NICTO, by the way, it's in the 271 00:15:56,500 --> 00:16:04,280 slides in your program, but it's cert.net. That's C-I-R-T.net. You know, www.cert.net. 272 00:16:05,300 --> 00:16:20,200 Okay, good. Now, okay. Now, Nessus. Now, Nessus, available at www.nessus.org. Outstanding 273 00:16:20,200 --> 00:16:26,000 general network security scanner from Raynaud Derizon. He gave a presentation at, I think, 274 00:16:26,000 --> 00:16:31,400 Black Hat a couple years ago. Heck of a guy. And Nessus is, if you are a security auditor 275 00:16:31,400 --> 00:16:33,880 or, well, anybody, it is just the coolest thing. 276 00:16:33,880 --> 00:16:40,040 Because it does what commercial, expensive commercial security scanners do, but for 277 00:16:40,040 --> 00:16:47,620 free and 100% user customizable. So, in other words, you know of or have written some zero-day 278 00:16:47,620 --> 00:16:53,920 exploit, right? You're not beholden to some vendor to provide you with a plug-in script. 279 00:16:54,120 --> 00:16:59,980 You can write your own if you need or want to. It's got a super easy-to-use language 280 00:16:59,980 --> 00:17:01,500 for that, its own scripting language. 281 00:17:02,740 --> 00:17:03,860 Q&A Q&A Q&A 282 00:17:03,860 --> 00:17:05,540 Q&A 283 00:17:15,140 --> 00:17:16,140 Q&A 284 00:17:16,140 --> 00:17:16,220 Q&A 285 00:17:16,220 --> 00:17:18,400 Q&A 286 00:17:18,400 --> 00:17:18,960 Q&A 287 00:17:18,960 --> 00:17:19,600 Q&A 288 00:17:19,600 --> 00:17:21,140 Q&A 289 00:17:21,140 --> 00:17:23,620 Q&A 290 00:17:25,460 --> 00:17:27,140 Q&A 291 00:17:27,140 --> 00:17:32,680 Q&A 292 00:17:32,680 --> 00:17:33,720 Q&A 293 00:17:33,720 --> 00:17:33,740 Q&A 294 00:17:33,740 --> 00:17:33,780 Q&A 295 00:17:33,780 --> 00:17:33,840 Q&A 296 00:17:33,840 --> 00:17:39,520 In Chapter 3, I think, I talk about using Nessus as a sanity check after you harden the system. 297 00:17:39,760 --> 00:17:44,240 So you want detailed information on Nessus, buy the book, flip to Chapter 3. 298 00:17:44,480 --> 00:17:44,760 Okay. 299 00:17:45,620 --> 00:17:46,740 So what have I got here? 300 00:17:47,040 --> 00:17:50,320 I set up a scan that's pretty selective. 301 00:17:50,320 --> 00:17:54,260 I disabled a bunch of the plug-ins that I know are completely irrelevant to this system, 302 00:17:55,260 --> 00:17:57,540 strictly for the sake of expediency here. 303 00:17:57,540 --> 00:18:04,620 Another thing that's cool about Nessus is step one in a Nessus scan is a big old hairy port scan. 304 00:18:04,860 --> 00:18:07,220 Usually, I mean, by default it uses NMAP. 305 00:18:08,400 --> 00:18:10,420 But that's really pretty time-consuming. 306 00:18:10,820 --> 00:18:15,420 And there's nothing to stop you from running your own NMAP scan, 307 00:18:15,700 --> 00:18:20,200 saving the output to a file, and then telling Nessus, 308 00:18:20,260 --> 00:18:23,100 hey, I've already got scan output, use that. 309 00:18:25,820 --> 00:18:27,420 And what else have I got here? 310 00:18:27,540 --> 00:18:28,580 Okay, target selection. 311 00:18:30,180 --> 00:18:37,160 My target host is 10.25.25.2. 312 00:18:43,300 --> 00:18:48,180 And, oh, in the interest of full disclosure, you know what? 313 00:18:48,240 --> 00:18:51,440 I misinterpreted that error message I got from my web server before. 314 00:18:51,660 --> 00:18:56,380 According to my log dump, the reason I got an empty page was because 315 00:18:56,980 --> 00:18:57,520 I was trying to get an empty page. 316 00:18:57,540 --> 00:18:59,320 I've got a broken manual installed here. 317 00:18:59,460 --> 00:19:00,460 File does not exist. 318 00:19:00,680 --> 00:19:04,800 Serve.htdoc.cgi.local.guestbook.cgi. 319 00:19:05,300 --> 00:19:06,160 That's pretty cool. 320 00:19:07,100 --> 00:19:10,660 If there are any invulnerabilities in that guest book, they don't apply. 321 00:19:11,100 --> 00:19:11,900 It's not there. 322 00:19:12,780 --> 00:19:13,440 I'm sorry. 323 00:19:14,140 --> 00:19:15,680 That just kind of caught my eye there. 324 00:19:16,900 --> 00:19:18,540 Oh, good, the screen came back up. 325 00:19:20,540 --> 00:19:22,380 Nessus is really good about tracking sessions. 326 00:19:22,640 --> 00:19:25,200 So if you've already scanned a host, 327 00:19:25,200 --> 00:19:28,580 and you had clicked Save This Session, 328 00:19:29,440 --> 00:19:32,840 then later on, you can click on that session, 329 00:19:33,120 --> 00:19:35,160 and you know it's got a date and a time stamp and an IP address, 330 00:19:35,320 --> 00:19:39,780 and whammo, it will pick up where that scan left off if you interrupted it, 331 00:19:40,580 --> 00:19:42,820 or rerun it, whatever you want to do. 332 00:19:42,880 --> 00:19:46,940 I'm putting it in manually because I want to pretend that I haven't already scanned this box sideways. 333 00:19:49,200 --> 00:19:51,860 And, oh, wait, let me show you the knowledge base page, too. 334 00:19:51,960 --> 00:19:52,960 That's actually pretty cool. 335 00:19:54,440 --> 00:19:54,840 Nessus. 336 00:19:56,440 --> 00:20:00,740 You can keep track of everything that it scans in a database. 337 00:20:00,960 --> 00:20:01,840 It's called the knowledge base. 338 00:20:02,520 --> 00:20:07,800 And so when you do subsequent tests, I mean, say you've got this, you know, web server farm, 339 00:20:07,880 --> 00:20:12,520 and you're going to scan it periodically to make sure that as you add web applications, 340 00:20:12,820 --> 00:20:18,300 as you add software, as you apply system patches or what have you, that, you know, 341 00:20:18,320 --> 00:20:21,940 that you're still not exposing yourself to anything obvious. 342 00:20:22,300 --> 00:20:24,600 You can maintain a knowledge base on that host. 343 00:20:25,200 --> 00:20:28,680 So that basically what you do is a full scan and then incremental scans. 344 00:20:30,100 --> 00:20:34,720 That saves you the time and tedium of running the same scripts over and over 345 00:20:34,720 --> 00:20:36,360 and getting the same results over and over. 346 00:20:37,100 --> 00:20:37,500 Okay. 347 00:20:38,440 --> 00:20:40,420 I'm just going to fire up the scan here now, though. 348 00:20:42,980 --> 00:20:46,300 And now at this point, I'll flip back to our little web server. 349 00:20:48,560 --> 00:20:52,720 And since I'm now doing a general scan, I'm going to tail var log messages. 350 00:20:53,660 --> 00:20:55,040 And if you see some. 351 00:20:55,200 --> 00:20:59,680 Really wacky animation, it's because I've got a bad, bad checkpoint driver on this system. 352 00:20:59,940 --> 00:21:00,620 Hold on a sec. 353 00:21:17,740 --> 00:21:18,180 Okay. 354 00:21:19,620 --> 00:21:21,680 And now we start to see some nasty grams. 355 00:21:25,440 --> 00:21:28,000 Oh, and some of them are even coming for me. 356 00:21:28,220 --> 00:21:28,880 Better still. 357 00:21:33,240 --> 00:21:34,800 Oh, it looks like it's doing a port scan. 358 00:21:35,020 --> 00:21:36,160 Well, I'll be darned. 359 00:21:37,760 --> 00:21:38,620 Well, isn't that annoying? 360 00:21:38,740 --> 00:21:39,720 Well, that's going to take all day. 361 00:21:41,240 --> 00:21:43,280 Nessus is not without its quirks. 362 00:21:47,880 --> 00:21:48,700 Well, that's funny. 363 00:21:48,800 --> 00:21:51,880 I said do not execute scanners that have already been executed. 364 00:21:52,820 --> 00:21:53,680 What the heck? 365 00:21:56,780 --> 00:21:57,580 Oh, well. 366 00:22:07,440 --> 00:22:08,760 Maybe it'll go real fast. 367 00:22:10,420 --> 00:22:10,940 Hmm. 368 00:22:12,660 --> 00:22:16,800 Now, it's worth mentioning that on my victim host here, 369 00:22:17,440 --> 00:22:19,700 these messages that you're seeing, the drop by default, 370 00:22:19,920 --> 00:22:23,680 that's not stock SUSE 8.1 behavior. 371 00:22:24,420 --> 00:22:27,600 I'm running a custom IP table script on here. 372 00:22:27,960 --> 00:22:31,320 And at the bottom of the script, I've got default drop rules. 373 00:22:31,520 --> 00:22:36,300 And preceding each default drop rule, you know, for each of the three chains, input, forward, and output, 374 00:22:36,480 --> 00:22:43,940 I've got a log rule that says log everything that's made it this far and then drop it. 375 00:22:46,200 --> 00:22:50,780 So you're not going to see these messages, the packet level, dropped by default messages, 376 00:22:50,960 --> 00:22:53,080 unless you have done the same on your system. 377 00:22:54,300 --> 00:22:55,900 A note about IP tables. 378 00:22:56,240 --> 00:23:00,720 Most of the major distros now have their own scripts for generating firewall rules. 379 00:23:01,580 --> 00:23:03,860 I've really got a love-hate relationship with those. 380 00:23:04,120 --> 00:23:10,960 Sometimes they can be helpful if your needs match those that the distro developer had in mind. 381 00:23:11,820 --> 00:23:15,500 I tend to do pretty zany stuff with my machines, and so that's seldom the case. 382 00:23:15,640 --> 00:23:17,560 I tend to prefer to roll my own. 383 00:23:18,320 --> 00:23:23,420 Chapter 10 of my book, which again, is on your DEF CON CD-ROM, so that statement is not in itself a pitch. 384 00:23:24,720 --> 00:23:25,160 Has... 385 00:23:25,160 --> 00:23:26,720 Oh, wait a minute, no, it doesn't. 386 00:23:26,840 --> 00:23:28,000 Chapter 2 does. 387 00:23:28,240 --> 00:23:29,420 Okay, I am pitching my book. 388 00:23:29,960 --> 00:23:36,480 Chapter 2 of my book describes how to write IP table scripts for the specific purpose of protecting a bastion host. 389 00:23:36,720 --> 00:23:40,840 I think that running firewall rules on a non-firewall machine is a really groovy thing to do. 390 00:23:41,000 --> 00:23:41,680 I mean, why not? 391 00:23:42,060 --> 00:23:46,200 Maybe you as a web administrator are more clueful than your local firewall admins. 392 00:23:46,500 --> 00:23:47,540 I've seen it happen. 393 00:23:47,980 --> 00:23:50,380 It's not quite as common as the reverse, but hey. 394 00:23:51,280 --> 00:23:52,600 The point is that... 395 00:23:53,420 --> 00:24:02,880 Any system that is internet accessible should have some ability to defend itself, regardless of what the firewall that it's on the inside of, you know, does or does not do for it. 396 00:24:03,380 --> 00:24:12,740 So I've got some really simple rules that I'll inbound HTTP, inbound secure shell, inbound SMTP, just so that people would see something, something if they scanned it. 397 00:24:13,440 --> 00:24:14,560 And nothing else. 398 00:24:15,520 --> 00:24:23,200 Another thing that's worth noting is naturally I have set my default IP tables policies on input, forward, and output. 399 00:24:23,420 --> 00:24:24,760 To drop, right? 400 00:24:24,880 --> 00:24:30,100 So I don't really need my drop rules at the bottom, but they're there anyhow so that I can have the logging. 401 00:24:31,260 --> 00:24:36,580 Because your default policy that you assign to an IP tables chain doesn't log. 402 00:24:36,820 --> 00:24:37,580 Go figure. 403 00:24:38,240 --> 00:24:38,720 Okay. 404 00:24:40,660 --> 00:24:43,060 Okay, it's beginning actual attacks. 405 00:24:43,300 --> 00:24:46,280 I did wind up with a much, much shorter port scan. 406 00:24:46,800 --> 00:24:48,740 So the knowledge base did kick in there. 407 00:24:48,860 --> 00:24:49,420 Okay, cool. 408 00:24:49,740 --> 00:24:52,940 It's beginning to question my grip on reality. I never do that. 409 00:24:54,800 --> 00:24:55,580 All right. 410 00:24:55,660 --> 00:25:06,220 And now at this point, at this point, the web log starts to get interesting and we start to see Ness's specific Apache errors. 411 00:25:07,120 --> 00:25:10,160 We're seeing a lot of the same stuff that we saw from Nikto, aren't we? 412 00:25:10,200 --> 00:25:11,600 We're seeing file does not exist. 413 00:25:11,840 --> 00:25:15,260 But then we're also seeing some somewhat more exotic stuff. 414 00:25:15,360 --> 00:25:17,800 Attempt to invoke directory something. 415 00:25:17,980 --> 00:25:19,640 It zipped by a little too fast. 416 00:25:23,420 --> 00:25:24,360 But there you have it. 417 00:25:24,620 --> 00:25:26,720 Ness has scanned tailed logs. 418 00:25:27,160 --> 00:25:34,220 I now have some idea of what script kitty behavior should look like. 419 00:25:35,040 --> 00:25:40,500 And it's been on my terms on my own spare time at my own pace instead of when the fur is flying. 420 00:25:40,940 --> 00:25:44,140 A lot harder to get up to speed on this stuff when the fur is flying. 421 00:25:44,640 --> 00:25:46,060 Any questions up to this point? 422 00:25:48,900 --> 00:25:49,380 Comments? 423 00:25:49,440 --> 00:25:49,920 Jokes? 424 00:25:52,520 --> 00:25:53,000 Coughs? 425 00:25:53,000 --> 00:25:54,040 No one's even coughing. 426 00:25:54,140 --> 00:25:55,080 It's creeping me out. 427 00:25:56,260 --> 00:25:57,060 Oh, God. 428 00:25:57,140 --> 00:25:57,480 They're alive. 429 00:25:57,680 --> 00:25:57,860 Good. 430 00:25:58,060 --> 00:25:58,460 All right. 431 00:25:58,660 --> 00:25:59,200 Thank you. 432 00:26:00,580 --> 00:26:01,980 Oh, and by the way, can everyone hear okay? 433 00:26:05,380 --> 00:26:05,980 Dumb question. 434 00:26:06,200 --> 00:26:06,860 Never mind. 435 00:26:10,360 --> 00:26:10,760 Okay. 436 00:26:10,900 --> 00:26:14,200 I killed the scan because I'm sure that you get the idea. 437 00:26:14,740 --> 00:26:15,960 Oh, I guess here. 438 00:26:16,440 --> 00:26:21,320 In case you've never seen Ness's output before, here's some Ness's output for us. 439 00:26:21,360 --> 00:26:22,460 Now, I didn't even finish the scan. 440 00:26:22,540 --> 00:26:22,980 But I already did. 441 00:26:23,000 --> 00:26:24,140 I already found some stuff. 442 00:26:24,360 --> 00:26:24,840 What did it find? 443 00:26:24,980 --> 00:26:25,680 Oh, this is entertaining. 444 00:26:26,040 --> 00:26:26,860 I've seen this one before. 445 00:26:27,960 --> 00:26:28,580 Oh, sorry. 446 00:26:28,700 --> 00:26:28,880 Sorry. 447 00:26:30,260 --> 00:26:30,780 Thank you. 448 00:26:33,440 --> 00:26:35,560 And to think I doubted that you guys were awake. 449 00:26:37,220 --> 00:26:37,580 Okay. 450 00:26:37,920 --> 00:26:38,860 Remote OS guess. 451 00:26:40,060 --> 00:26:43,520 This is a Panasonic IP technology broadband networking gateway. 452 00:26:44,480 --> 00:26:45,520 I had no idea. 453 00:26:45,660 --> 00:26:48,400 When I bought this thing, I thought I was getting a plain ordinary think pad. 454 00:26:52,240 --> 00:26:53,140 Actual VOMS, though. 455 00:26:53,220 --> 00:26:57,060 It did correctly identify an HTTP problem. 456 00:26:57,480 --> 00:26:59,880 And that is that it supports the trace method. 457 00:27:00,160 --> 00:27:04,060 Now, if I go back here, and I'm not going to do it right now. 458 00:27:04,160 --> 00:27:09,200 But if I go back in the logs, the log messages that correspond to that attack, I will see 459 00:27:09,200 --> 00:27:11,160 that this is, in fact, sort of a false positive. 460 00:27:13,640 --> 00:27:14,660 But there it is. 461 00:27:14,660 --> 00:27:22,540 Something that's worth pointing out is that if I let the Nessus scan go to its logical 462 00:27:22,540 --> 00:27:27,780 conclusion, I will see some different stuff than I saw in the Nikto scan. 463 00:27:28,400 --> 00:27:35,820 So while it might be tempting to assume that there is a really well-known finite list of 464 00:27:36,520 --> 00:27:41,040 attacks that people think are noteworthy against Apache, there are, in fact, differences of 465 00:27:41,040 --> 00:27:44,320 opinion between the guys who do Nikto and the guys who do Nessus. 466 00:27:44,320 --> 00:27:50,460 It truly is worthwhile doing more than one type of scan against a production host. 467 00:27:50,700 --> 00:27:58,060 If you're serious about checking your hardening work, knowing what types of attacks to look 468 00:27:58,060 --> 00:27:59,000 for, and that sort of thing. 469 00:27:59,120 --> 00:28:03,280 So I found that interesting, that I got different results each way. 470 00:28:03,620 --> 00:28:05,720 Okay, I'm going to close the report. 471 00:28:07,640 --> 00:28:08,120 Oops. 472 00:28:08,740 --> 00:28:09,620 Not canceled. 473 00:28:10,440 --> 00:28:11,680 Don't need to save that. 474 00:28:11,800 --> 00:28:13,000 Back to the slides. 475 00:28:15,160 --> 00:28:17,980 Now I've got screenshots in the slideshow on your CD-ROM. 476 00:28:18,840 --> 00:28:24,040 It would be a lot more fun for you to reproduce these on your own, but if you're not inclined 477 00:28:24,040 --> 00:28:29,760 to, I've got, I show Nessus in action and I show the log output. 478 00:28:33,220 --> 00:28:34,960 So now let's talk about loggers. 479 00:28:37,500 --> 00:28:38,640 I've done these scans. 480 00:28:39,220 --> 00:28:44,300 I've gotten a feel for what scan activity looks like for some pretty good ones. 481 00:28:44,300 --> 00:28:49,140 Some pretty granular, some pretty deep security probing, you know, way beyond just simple 482 00:28:49,140 --> 00:28:50,600 port scanning, actually. 483 00:28:52,520 --> 00:28:56,880 And suppose that I have not seen as much as I expected or wanted to see. 484 00:28:57,040 --> 00:28:57,960 What do I do about that? 485 00:28:58,260 --> 00:29:03,780 Well, on most systems you edit etsy, syslog.com, on most Unix systems. 486 00:29:04,080 --> 00:29:09,480 What I've got here are the relevant lines, that is to say I've stripped away most of 487 00:29:09,480 --> 00:29:14,280 the commentary, from a Red Hat 7.3 syslog.com file. 488 00:29:14,280 --> 00:29:20,320 And as with Nessus, I'm not going to deliver a dissertation on configuring syslog. 489 00:29:20,500 --> 00:29:23,920 It's all in the syslog.com command page. 490 00:29:24,760 --> 00:29:31,300 But just at a high level, what you've got on the left-hand side of the screen are log 491 00:29:31,300 --> 00:29:34,820 facility and log severity pairs. 492 00:29:35,120 --> 00:29:38,060 So you've got facility.severity, right? 493 00:29:38,160 --> 00:29:39,900 And you can use the star wildcard. 494 00:29:40,120 --> 00:29:43,540 That tells syslogd, in any given case, 495 00:29:43,540 --> 00:29:46,320 what sort of messages to look for. 496 00:29:46,600 --> 00:29:50,360 And then on the right-hand side, it tells syslogd what to do with them. 497 00:29:50,660 --> 00:29:50,900 Okay? 498 00:29:51,060 --> 00:29:52,540 I can write them to a file. 499 00:29:52,720 --> 00:29:55,860 So var log messages, I'm going to write a lot of stuff to. 500 00:29:57,820 --> 00:30:02,640 I can, if I put a star on the right-hand side, I keep pointing to the screen. 501 00:30:02,840 --> 00:30:03,960 You can't see this. 502 00:30:05,140 --> 00:30:08,060 Oh, use the mouse. 503 00:30:08,200 --> 00:30:08,780 Good idea. 504 00:30:09,660 --> 00:30:11,600 If I put a star over here, 505 00:30:13,660 --> 00:30:16,920 that says write the log message to all consoles. 506 00:30:17,940 --> 00:30:18,380 Okay? 507 00:30:18,440 --> 00:30:25,620 Now that's only useful, of course, if some sysadministrative type person is actually logged on. 508 00:30:25,860 --> 00:30:28,380 So that's one that you generally don't want to do. 509 00:30:29,880 --> 00:30:34,060 That's not the only destination that you want to use for any given class of log messages. 510 00:30:34,160 --> 00:30:38,960 You want to make sure that that entry is redundant with other entries that write to files. 511 00:30:39,100 --> 00:30:42,940 And indeed, by default, you know, the redhead73 syslog.com file is. 512 00:30:42,940 --> 00:30:47,740 But you can also send messages to a remote host. 513 00:30:47,920 --> 00:30:52,220 And the way that you do that is by doing at sign and then host name or IP. 514 00:30:53,160 --> 00:30:58,440 And that will send it to UDP514 on your central log server. 515 00:30:59,360 --> 00:31:05,560 My talk at DEF CON last year was about setting up a centralized stealth logger and using it in just that fashion. 516 00:31:06,740 --> 00:31:12,240 It's real important that you have good logs and you have logs that you can trust. 517 00:31:12,240 --> 00:31:17,380 Which is to say, if you get owned, you want to make sure that later on, 518 00:31:17,440 --> 00:31:22,160 when you go to analyze the logs from that, that you don't have to worry about them having been altered. 519 00:31:22,440 --> 00:31:28,900 Well, the logs, you know, the local logs on the machine, you have to assume that they've been tampered with. 520 00:31:30,240 --> 00:31:38,840 Your best hope at log integrity is having a copy of those log messages having been sent to some centralized logger. 521 00:31:39,040 --> 00:31:42,220 So that you can use those for the serious forensic analysis like this. 522 00:31:42,240 --> 00:31:42,560 I'll talk about that later on. 523 00:31:45,440 --> 00:31:45,920 Okay. 524 00:31:47,780 --> 00:31:49,160 So, here's a bonus. 525 00:31:50,700 --> 00:31:53,780 This is a chart that was not included in my book. 526 00:31:53,960 --> 00:31:56,200 My editor felt that it was kind of confusing. 527 00:31:56,800 --> 00:32:02,180 But the thing is, it won't be confusing to you because I'll explain it right here in real time. 528 00:32:02,440 --> 00:32:05,560 This is actually like three or four charts glommed into one. 529 00:32:05,720 --> 00:32:08,320 The double lines, you know, separate the different parts. 530 00:32:08,460 --> 00:32:12,220 But I've got a list of the facilities that I've used. 531 00:32:12,240 --> 00:32:16,140 That Syslog uses with their corresponding numeric equivalents. 532 00:32:17,800 --> 00:32:19,720 I've got a list of priorities. 533 00:32:20,020 --> 00:32:21,300 You know, log levels. 534 00:32:21,540 --> 00:32:23,800 And their corresponding numeric values. 535 00:32:24,440 --> 00:32:28,760 If you've ever tried to dig up this information in other places, it can be a little tricky. 536 00:32:28,920 --> 00:32:32,280 I don't think that the numeric codes are in the man page, at least on Linux. 537 00:32:33,600 --> 00:32:36,980 And then I've got a synopsis of the different actions that you can use. 538 00:32:37,860 --> 00:32:41,360 And the usage of different operators like bang and equal sign. 539 00:32:41,360 --> 00:32:49,180 So I encourage you, if you've got Syslog daemons to configure, to print this out and tack it up on your cube. 540 00:32:49,400 --> 00:32:52,540 It will save you a bunch of man page and info page lookups. 541 00:32:52,680 --> 00:32:54,100 At least that's what I hope. 542 00:32:55,620 --> 00:32:59,980 But I won't read every line on it to you right now if that's okay. 543 00:33:01,980 --> 00:33:02,460 Okay. 544 00:33:02,500 --> 00:33:07,020 Now for you Debian fans out there, here's a Syslog NG configuration. 545 00:33:09,200 --> 00:33:10,400 If you run Debian. 546 00:33:10,540 --> 00:33:11,340 I believe Syslog NG. 547 00:33:11,340 --> 00:33:13,460 Syslog NG is the default logger, isn't it? 548 00:33:15,200 --> 00:33:16,200 Or is it optional? 549 00:33:17,700 --> 00:33:18,620 Oh, it is optional. 550 00:33:18,760 --> 00:33:19,480 Oh, my mistake. 551 00:33:19,660 --> 00:33:20,220 But it's there. 552 00:33:20,380 --> 00:33:25,040 I recommend that you use it because it's a lot more powerful than regular old Syslog. 553 00:33:25,760 --> 00:33:29,000 Syslog NG is also available on SUSE Linux as an optional package. 554 00:33:29,380 --> 00:33:31,640 Probably on other Linux distros too by now. 555 00:33:31,820 --> 00:33:32,720 It will run on anything. 556 00:33:33,060 --> 00:33:39,340 I mean, you can get the source code from, let's see, www.balabit. 557 00:33:39,920 --> 00:33:41,240 B-A-L-A-B-I-T. 558 00:33:42,220 --> 00:33:43,180 H-U. 559 00:33:43,880 --> 00:33:48,160 And the home page is in Hungarian, but there's a little button that says English. 560 00:33:48,500 --> 00:33:51,880 You probably want to click that and then follow the links to Syslog NG. 561 00:33:53,100 --> 00:33:58,440 Syslog NG is covered in depth in the sample chapter from my book that's on your CD-ROM. 562 00:33:58,840 --> 00:34:02,580 And so I will let that do the talking about Syslog NG. 563 00:34:05,980 --> 00:34:07,280 Pardon the jet plane. 564 00:34:08,580 --> 00:34:09,060 . 565 00:34:10,860 --> 00:34:11,580 Oh, yeah. 566 00:34:11,960 --> 00:34:12,400 . 567 00:34:16,520 --> 00:34:19,140 I just said that in a really Minnesotan way, didn't I? 568 00:34:20,240 --> 00:34:20,680 . 569 00:34:21,440 --> 00:34:22,140 Yeah, sure. 570 00:34:23,520 --> 00:34:23,960 . 571 00:34:27,680 --> 00:34:30,040 You can gaze upon that a little longer if you like. 572 00:34:30,740 --> 00:34:31,180 . 573 00:34:32,660 --> 00:34:33,100 Yes. 574 00:34:33,960 --> 00:34:34,400 . 575 00:34:34,400 --> 00:34:34,880 . 576 00:34:34,880 --> 00:34:34,940 . 577 00:34:34,940 --> 00:34:35,180 . 578 00:34:42,600 --> 00:34:42,780 . 579 00:34:45,220 --> 00:34:45,400 . 580 00:34:45,400 --> 00:34:45,560 . 581 00:34:49,260 --> 00:34:49,440 . 582 00:34:49,440 --> 00:34:49,460 . 583 00:34:49,460 --> 00:34:49,480 . 584 00:34:49,480 --> 00:34:49,560 . 585 00:34:49,560 --> 00:34:49,600 . 586 00:34:49,600 --> 00:34:49,700 . 587 00:35:07,360 --> 00:35:07,540 . 588 00:35:08,420 --> 00:35:08,600 . 589 00:35:08,600 --> 00:35:08,640 . 590 00:35:08,640 --> 00:35:08,680 . 591 00:35:08,680 --> 00:35:08,920 . 592 00:35:08,920 --> 00:35:09,000 . 593 00:35:09,000 --> 00:35:09,040 . 594 00:35:09,040 --> 00:35:13,940 may have said happiness is a warm sport. If he didn't, he should have. Yeah, I wanted 595 00:35:13,940 --> 00:35:24,220 to get the furry one, but that would be just too distracting. Okay. Are we done transcribing 596 00:35:24,220 --> 00:35:31,460 my syslog conf chart? I'm glad you like it. I worked so hard on that, and then they didn't 597 00:35:31,460 --> 00:35:38,540 include it in the book. I was miffed. I'm still bitter. Okay. So syslog ng, what I will 598 00:35:38,540 --> 00:35:43,860 say about syslog ng, about how it works is, you may look at this and say, God, that's 599 00:35:43,860 --> 00:35:51,220 a lot more confusing than syslog.conf. And it is more verbiage. But it's highly module. 600 00:35:51,480 --> 00:35:55,100 You've got your option statements that are global options for the daemon's behavior. 601 00:35:55,600 --> 00:36:02,120 You've got source statements that tell syslog ng where to get its log information from. 602 00:36:02,400 --> 00:36:07,820 This one on my site is actually kind of, oh, fancy. 603 00:36:07,940 --> 00:36:08,200 Okay. 604 00:36:08,540 --> 00:36:13,780 And I'm piping off a proc k message. What I'm doing is I'm doing an end run around k 605 00:36:13,780 --> 00:36:19,120 log d, which you really don't have to do. I mean, syslog ng and k log d work just fine 606 00:36:19,120 --> 00:36:23,400 together. But if you want to kill k log d because it's an extra process and it offends 607 00:36:23,400 --> 00:36:29,360 you, you can do so with a statement just like that. You set up your sources. You set up 608 00:36:29,360 --> 00:36:36,480 filters. And that's where you specify your log facility and severity pairs and attach 609 00:36:36,480 --> 00:36:38,120 arbitrary text labels to them. 610 00:36:38,540 --> 00:36:44,700 F underscore weirdness, F underscore messages, whatever. Destinations, places to write the logs, 611 00:36:44,880 --> 00:36:52,740 terminal consoles, files, programs. I really should have put a UDP statement in there because 612 00:36:52,740 --> 00:36:58,220 you can set up a remote host as a log destination. And then the payoff, the log 613 00:36:58,220 --> 00:37:04,780 statements, that's where you combine the other elements. And so you can reference sources that 614 00:37:04,780 --> 00:37:07,900 you set up above, filters that you set up above, and destinations. 615 00:37:08,540 --> 00:37:14,120 In whatever combinations trip your trigger. So that's syslog ng. Flexible. Marvelous. 616 00:37:14,540 --> 00:37:20,820 Another cool thing about syslog ng, by the way, syslog ng supports logging over tcp514. 617 00:37:22,680 --> 00:37:32,140 By default, syslog, plain old BSD syslog only uses UDP 514. That means that it's not as 618 00:37:32,140 --> 00:37:35,520 reliable. And it means that it's not so easy to tunnel. 619 00:37:36,920 --> 00:37:38,080 So you could try that out if you have some answers that you feel are good to me. Or just 620 00:37:38,080 --> 00:37:38,160 Bye bye. 621 00:37:38,800 --> 00:37:41,720 that's a that's a feature worth mentioning what's the other thing I was 622 00:37:41,720 --> 00:37:46,660 gonna say about it oh I believe there's also a Nicholas what was that thing you 623 00:37:46,660 --> 00:37:54,100 were telling me before a friend of mine was telling me about some kind of 624 00:37:54,100 --> 00:37:56,920 throttling is there some kind of throttling in syslog NG now 625 00:38:04,760 --> 00:38:07,740 I was too lazy to write this down so 626 00:38:10,860 --> 00:38:20,060 you can have target every x minutes to tell your how many back at it lost and to I felt 627 00:38:20,060 --> 00:38:21,140 you that it's still alive 628 00:38:24,120 --> 00:38:26,400 thanks a lot okay not actually throttling 629 00:38:26,400 --> 00:38:26,900 but you don't need to do it at all for me so we can use talk and input right ma Gracie. Thanks again! 630 00:38:26,900 --> 00:38:30,880 you can have it tell you statistics about how many packets it drops, if in fact it does 631 00:38:30,880 --> 00:38:35,240 wind up having to drop packets. That's something that syslog won't do. If syslog drops packets, 632 00:38:35,500 --> 00:38:39,020 you know, remote log packets, you never even know about it. 633 00:38:41,180 --> 00:38:47,060 Okay. I could go on and on about syslog-ng. It's really groovy, and Bashi is such a sweet 634 00:38:47,060 --> 00:38:51,900 guy. But I'm going to go on and talk about automated log watchers. 635 00:38:53,400 --> 00:38:58,800 The payoff as it were of the technique. Once you've figured out what to look for, you can 636 00:38:58,800 --> 00:39:04,580 configure some other application to look for it for you. The one that I cover in the log 637 00:39:04,580 --> 00:39:11,020 chapter in my book is Swatch or Swatch, the simple watcher. I don't know if I like Swatch 638 00:39:11,020 --> 00:39:16,280 as much as I used to. For one thing, it hasn't been updated since like 2000. For another, 639 00:39:17,120 --> 00:39:21,880 being a Perl script, it's got a certain amount of overhead associated with it. Thank you 640 00:39:22,960 --> 00:39:26,980 And I was running it on this machine this morning. 641 00:39:27,120 --> 00:39:29,220 This thing is, I think, a Pentium 266. 642 00:39:29,500 --> 00:39:34,880 And I was really shocked by the CPU hit that I took from running Swatch. 643 00:39:37,360 --> 00:39:40,880 I'm not trying to dissuade anyone from examining Swatch 644 00:39:40,880 --> 00:39:48,120 because it's one of a fairly small number of tools that will watch a log file in real time, 645 00:39:48,120 --> 00:39:52,980 that will basically tail a log file and watch it for specific strings. 646 00:39:53,840 --> 00:39:58,240 But what I do want you to know is that your mileage may vary. 647 00:39:58,700 --> 00:40:02,440 Don't throw Swatch on a production system, configure it, 648 00:40:02,560 --> 00:40:04,800 and leave it running overnight and hope for the best. 649 00:40:05,280 --> 00:40:10,780 Bench test it first and make sure that it doesn't have any deleterious effects on your system. 650 00:40:10,960 --> 00:40:15,440 I mean, you want to do that anyhow because it's got a really fussy configuration syntax. 651 00:40:15,780 --> 00:40:17,080 And, I mean, if you just... 652 00:40:18,120 --> 00:40:21,600 type some stuff and fire it up, it may or may not work the way you intend it to. 653 00:40:23,720 --> 00:40:31,240 The good news is that the Linux distros each come with their own log watchers of various types. 654 00:40:31,740 --> 00:40:33,600 Red Hat now has got one called LogWatch. 655 00:40:33,740 --> 00:40:38,680 I'm told that there's a different tool by the same name that's older. 656 00:40:39,660 --> 00:40:40,800 That one I don't know. 657 00:40:41,300 --> 00:40:45,460 I have some familiarity with Red Hat's LogWatch. 658 00:40:45,800 --> 00:40:47,860 LogWatch is cool because unlike Swatch, 659 00:40:48,120 --> 00:40:54,860 it has its own brains, it has its own rules for things that constitute log weirdness. 660 00:40:55,100 --> 00:40:57,580 And you can... and it's customizable, of course, as well. 661 00:41:00,140 --> 00:41:02,660 LogDigest is SUSE's equivalent of that. 662 00:41:04,020 --> 00:41:07,200 And it does not tail an active log file. 663 00:41:07,360 --> 00:41:08,340 It runs as a cron job. 664 00:41:08,520 --> 00:41:11,620 In other words, it's a script that you run once in a while to parse your logs 665 00:41:11,620 --> 00:41:13,740 and report on any weirdness that it finds. 666 00:41:15,620 --> 00:41:17,100 It's not very well documented, 667 00:41:17,240 --> 00:41:17,940 but it's a really... 668 00:41:17,940 --> 00:41:20,780 it's a really easy script to reverse engineer even if you don't know Perl. 669 00:41:20,860 --> 00:41:24,100 Or, I mean, even if... well, it's not in Perl, never mind. 670 00:41:24,280 --> 00:41:25,520 It's easy to reverse engineer. 671 00:41:26,580 --> 00:41:30,540 Every... all of the configuration information is kept in Etsy LogDigest. 672 00:41:31,240 --> 00:41:34,340 The interesting files there are Ignore, 673 00:41:34,480 --> 00:41:38,080 which is where you can specify strings that it should ignore if it sees. 674 00:41:38,360 --> 00:41:40,620 And then the other one is... 675 00:41:40,620 --> 00:41:42,060 Oh, let's see. 676 00:41:42,500 --> 00:41:44,040 I'm spacing out what it's called. 677 00:41:45,320 --> 00:41:46,400 Oh, wait, I wrote it down. 678 00:41:49,440 --> 00:41:50,880 And I misplaced the notepad. 679 00:42:02,560 --> 00:42:02,960 Alarming. 680 00:42:04,000 --> 00:42:04,400 Alarming. 681 00:42:04,600 --> 00:42:05,700 That's the name of the file. 682 00:42:05,860 --> 00:42:07,620 That's where you look for stuff that is alarming. 683 00:42:08,820 --> 00:42:10,940 So if I cat that file... 684 00:42:15,880 --> 00:42:16,680 Oh, shoot. 685 00:42:16,680 --> 00:42:17,900 Bear with me here. 686 00:42:29,460 --> 00:42:29,860 Okay. 687 00:42:31,060 --> 00:42:34,820 This is where you can specify strings that you want LogDigest to look for. 688 00:42:37,760 --> 00:42:38,480 Oh, cool. 689 00:42:38,620 --> 00:42:39,280 Okay, thanks. 690 00:42:39,480 --> 00:42:40,660 Yes, move all out this way. 691 00:42:42,320 --> 00:42:42,720 Okay. 692 00:42:43,280 --> 00:42:43,680 So... 693 00:42:46,680 --> 00:42:51,360 Now it's time to open the floor to beating up on this box. 694 00:42:52,540 --> 00:42:53,460 I've got... 695 00:42:53,460 --> 00:42:53,940 Oh, wow. 696 00:42:54,300 --> 00:42:57,200 There's some strange stuff in my log right now. 697 00:42:59,520 --> 00:43:00,440 Holy cow. 698 00:43:02,260 --> 00:43:06,100 That's the most juicy invalid method request I've ever, ever seen. 699 00:43:06,360 --> 00:43:07,740 Can you see that on the bottom? 700 00:43:08,440 --> 00:43:10,540 Did anybody here perpetrate that? 701 00:43:11,340 --> 00:43:13,100 Because if they did, that's worth a prize. 702 00:43:18,140 --> 00:43:18,980 Thank you. 703 00:43:26,400 --> 00:43:27,300 Oh, really? 704 00:43:30,860 --> 00:43:31,500 Huh? 705 00:43:33,100 --> 00:43:35,460 I'm not entirely parsing you. 706 00:43:35,520 --> 00:43:37,440 Something about the second layer? 707 00:43:37,720 --> 00:43:38,300 Are you getting me? 708 00:43:38,380 --> 00:43:38,960 Are you doing... 709 00:43:40,620 --> 00:43:43,080 I'm basically trying to flood your... 710 00:43:43,080 --> 00:43:48,480 I'm trying to flood you with misconfigured, with malformed Layer 2 frames. 711 00:43:48,700 --> 00:43:50,920 In this case, using FataJack AirJack. 712 00:43:51,240 --> 00:43:53,320 So, I wonder if that can produce anything. 713 00:43:53,520 --> 00:43:58,720 And I also wondered if I can sneak under the login in your case. 714 00:43:58,880 --> 00:43:59,580 So, I don't know. 715 00:43:59,640 --> 00:44:00,380 Maybe just noise. 716 00:44:00,480 --> 00:44:02,380 Maybe it's a ref noise which does it. 717 00:44:03,160 --> 00:44:03,880 Yes, yes. 718 00:44:03,980 --> 00:44:04,820 Layer 2 attacks. 719 00:44:05,080 --> 00:44:09,980 Well, the gentleman said that what he's doing is he's sending me malformed packets. 720 00:44:09,980 --> 00:44:12,820 And so, he's wondering if it's maybe... 721 00:44:12,820 --> 00:44:14,780 Maybe if it caused that message. 722 00:44:14,960 --> 00:44:17,240 Maybe if it's sneaking under my radar. 723 00:44:17,400 --> 00:44:23,400 And the answer to that is malformed packets and Layer 2 attacks constitute denial of service. 724 00:44:23,580 --> 00:44:25,200 And I'm not going to give any prizes for that. 725 00:44:30,380 --> 00:44:32,040 Well, okay. 726 00:44:32,180 --> 00:44:32,940 Consolation prize. 727 00:44:33,080 --> 00:44:33,280 Fine. 728 00:44:33,540 --> 00:44:39,400 The consolation prize is an SBUS SCSI interface with... 729 00:44:40,180 --> 00:44:41,160 A black and... 730 00:44:41,160 --> 00:44:41,600 Oh, no. 731 00:44:41,680 --> 00:44:42,800 A GX frame buffer. 732 00:44:43,160 --> 00:44:43,840 Hot damn. 733 00:44:45,440 --> 00:44:45,860 There. 734 00:44:46,120 --> 00:44:47,120 Are you happy now? 735 00:44:47,260 --> 00:44:48,040 Are you happy, kids? 736 00:44:49,960 --> 00:44:52,840 That's the only DOS attempt that I'm going to give prizes for, though. 737 00:44:52,900 --> 00:44:54,260 I've got my morals. 738 00:44:57,240 --> 00:44:57,660 Huh? 739 00:45:01,820 --> 00:45:02,640 Oh, yeah. 740 00:45:02,680 --> 00:45:03,260 You could give them out. 741 00:45:03,300 --> 00:45:03,740 Sure, sure. 742 00:45:04,820 --> 00:45:06,020 What else we got here? 743 00:45:09,420 --> 00:45:12,040 I've got some undersized frames received. 744 00:45:12,380 --> 00:45:13,480 I think that was the same thing. 745 00:45:15,020 --> 00:45:17,000 192.168.77.4. 746 00:45:17,320 --> 00:45:18,220 Oh, that's a broadcast. 747 00:45:18,540 --> 00:45:18,740 Okay. 748 00:45:18,800 --> 00:45:19,420 Never mind that. 749 00:45:26,320 --> 00:45:35,320 And in case you missed it, my victim host is located at 10.25.25.2 with a Class C subnet mask. 750 00:45:35,320 --> 00:45:37,940 And an ESS ID of Wuzzala. 751 00:45:40,030 --> 00:45:42,600 W-U-Z-Z-A-L-A. 752 00:46:01,080 --> 00:46:03,160 Oh, oh, I see. 753 00:46:06,740 --> 00:46:07,640 You're right. 754 00:46:09,500 --> 00:46:11,140 My terminal got corrupted somehow. 755 00:46:18,140 --> 00:46:18,700 Oh, okay. 756 00:46:18,720 --> 00:46:18,760 There we go. 757 00:46:18,760 --> 00:46:19,260 Okay. 758 00:46:31,640 --> 00:46:32,160 All right. 759 00:46:32,160 --> 00:46:32,580 Oh, okay. 760 00:46:32,580 --> 00:46:39,800 Okay there we go. Thank you. That hasn't happened to me like in three years. I totally missed that. 761 00:46:42,800 --> 00:46:43,320 Okay. 762 00:46:47,880 --> 00:46:56,740 Ooh. Thank you. Okay who said that? Who's 25.69? Someone gets a prize for complimenting the kilt. 763 00:46:57,520 --> 00:47:03,400 All right. Oh yes. I know him. A prize over there. Raise your hand again please so the 764 00:47:03,400 --> 00:47:08,100 goon can spot you. Right over here. Yeah. Yeah. 765 00:47:20,580 --> 00:47:26,100 How could you tell? How could you tell if it were broken? I'm not even sure what that is. 766 00:47:27,000 --> 00:47:36,320 Is that a repeater of some kind? Hmm? Ooh. Cool. Prizes by the way were donated by Uncle Ira 767 00:47:36,320 --> 00:47:43,480 from Miko. So buy stuff from Uncle Ira. Very cool guy. Okay. So what else here? 768 00:47:43,620 --> 00:47:46,160 These are all from 25.69. Is that all you Tony? 769 00:47:54,120 --> 00:47:56,720 Oh wait. There was something fairly involved. Oh yeah. That was Tony. 770 00:47:56,740 --> 00:48:00,220 That was Tony also. Man, you were really going to town, man. Did you root me? 771 00:48:03,520 --> 00:48:07,200 I've only got two minutes. You've got two minutes left to gain a prize. Come on. Have at it. 772 00:48:07,260 --> 00:48:13,500 I've got junk to give away here. Okay. Be that way. 773 00:48:17,760 --> 00:48:24,100 So then. Maybe I'll ask a trivia question. Okay. What is the list price of my book? 774 00:48:25,320 --> 00:48:26,180 No. That's lame. 775 00:48:26,740 --> 00:48:30,540 Never mind. I retracted. Oh wait. Yes, sir. 776 00:48:34,000 --> 00:48:41,580 44.95. Yes. Jay Beal gets a prize for answering the lamest trivia question at DEF CON ever. 777 00:48:42,140 --> 00:48:48,200 I don't know. What the hell is this? What the fuck is this? 778 00:48:50,320 --> 00:48:52,520 It was close. You didn't identify what it was. 779 00:48:52,720 --> 00:48:53,000 I don't understand. 780 00:48:53,980 --> 00:48:54,500 It. 781 00:48:54,860 --> 00:48:55,380 Jay. 782 00:48:55,760 --> 00:48:56,580 It does. 783 00:48:56,740 --> 00:48:59,860 It does whatever you're elite enough to figure out it does. That's what it does. 784 00:49:05,620 --> 00:49:11,060 Oh. Okay. 785 00:49:13,260 --> 00:49:14,360 Okay. Who's 25. 786 00:49:14,660 --> 00:49:16,320 Who's got 25.79? 787 00:49:19,000 --> 00:49:20,420 Who's 25.79? 788 00:49:20,820 --> 00:49:22,380 Yes. We've got a lucky winner. 789 00:49:22,960 --> 00:49:23,780 All right. 790 00:49:26,740 --> 00:49:31,300 And I'm quite delighted to end my talk on that note. Thank you very much.