Welcome to the annual DEF CON convention. This meeting was held in exciting Las Vegas, Nevada from July 9th through the 11th, 1999. This is video tape number 35. How to be aware of security problems on your network. Again, I'm wearing a cameraman. Sometimes I move around a lot. I am kind of hyper. My name is Craig Roland. I do run a website called Sinex Software. It's basically my own homepage. It's really not a company. The website address is up there. That's my email address. If you need to contact me for any question, recipes, whatever, just write me there. I'll be happy to get back to you. I'm generally pretty responsive. Sometimes things fall through, like my filter. Somehow it throws you in the dead knoll, but that doesn't happen too often. So give it a shot. Today, I'm going to talk about basic ways to detect an intruder. From my experience, I've done a lot of system auditing work as well as intrusion detection system. Actively right now, I do work on security auditing tool exploit development. The easiest way to detect an intruder is awareness. It's just there three times because you need to really be aware of what your computer is telling you. In almost every case, there's going to be an indication of what that person is doing on your network, and there's always going to be some way that you can detect it. Specifically, you need to be aware, and it matters so much, because computers almost always tell you when there's a problem. As stealthy as you want to be, if someone's coming in and causing bizarre application errors, like, for instance, you're running bind 495. It's been working great. One morning, 2 a.m., it cordons. No reason whatsoever. It's never done that. You've had it up for over a year. What's the problem? Maybe you need to look into it if we're trying to remote root overflow exploit. It's certainly going to tell you what's going on. System errors, too. When someone's banging on your system, it's very hard to be quiet. Even though a data may not specifically say, oh, wow, I'm being hacked, they may indicate other error messages that certainly show that there's going to be a problem. For instance, if you do a standard port scan against RSH, it's going to say illegal connect or connect on an illegal port. Basically, what that means. If someone connected to your RSH data from a high ephemeral port number, and yeah, it may not necessarily be a hack, but it certainly points to the fact that they're probably doing some type of port scan on you. Other things, too. Users may notice an application isn't working right, or they're corrupted or missing files, or somehow that some type of data that they thought they had entered is missing, or it's been corrupted, or it's returning incorrect values. These are surely indicators that something's going on there. A lot of problems you find on systems aren't caused by the computer system itself. There's almost always some type of human behind it. And it may not be deliberate. It could just be a user fouling up somewhere, but a lot of times it can also indicate that there's an intruder hanging around there. The second point there is that every interaction with the computer system causes a change in its state. I don't care how subtle it is. If you log into a box, you would change multiple items on that system that can be logged, audited, traced, and accounted on. This doesn't include just the basic stuff such as log files itself, but you have the process accounting records, the login accounting records. You have changes in maybe the swipes. You have changes in the log file. You have changes in how much CPU is being used. And all these things can be looked at and monitored, and you can detect whether or not a problem is actually happening before it's become a really big issue. And the last thing here, and this is the thing that as an attacker, this is what they focus on. Attackers really are counting on you not to notice their presence. This is why there's so much stealth and sneaking around involved when you're hacking a system itself. Even the time of day that a hacker attacks a box is typically related for two things. One can be the insomnia, which is always present. But the second thing, too, is at 3 AM, people really aren't watching the boxes too close. So really, they're counting on the fact that you're not going to be aware that they're there. So the basic thing, what I call a primary director of computer security, is that under no circumstances would you ever allow an intruder on the target host system you control. This is for a variety of reasons. The basic one is that once an intruder gets on your box, you are quickly losing how many options you have left to prevent their spread throughout the entire network. In fact, I spent a lot of money this weekend contacting an animation and design house, and I made three special slides just for DEF CON. It's very important because we're going to illustrate the exact thing that's going to happen if an intruder gets a single toehold on one of your systems. The first thing they're going to do, whoa, and I go all the way to the end, and that's really bad. I've been hacked! They're going to start doing that evil hack. And the first thing he's going to do, he's going to start crawling through your network, and he's just going to start breaking machines. He's got sniffers loaded up, he's got Trojan horses fired, and he's going to have Binance replaced, he's going to be social engineering users, he's been grabbing passwords, he's been going through your network, and he's going to be pulling out no password accounts, he's going to be cracking the passwords once he pulls the passwords back to his system, and he's just going to go on and on and on. Once he takes control of your network, and this is going to happen once they get on a single host, we've seen it lots of times. Once they take control of your network, there's only one possible thing left for them to do, and Hollywood has shown us this time and time again, and that is in fact the hacking of a Whopper supercomputer. And at this point, they're going to take over the military industrial complex of the United States, which includes the jets, the helicopters, the tanks, the Viking slave ships, and they will eventually take over a fleet of hot air balloons, and they will take your tired, sleepless, ragged out sysadmin, and they're going to fly them up to the highest altitude they can attain, and they're going to throw his pathetic, security-ridden ass over. And as he's falling to the ground, he's going to realize something, that because he allowed that person onto the one network, he has in fact led the total world domination of the hackers. They spread from continent to continent, and they're going to attack and attack and attack until finally the entire planet is overrun, and there's nothing he can do about this. Now, there are two basic reasons. There are two reasons, and that's the end of my presentation, thank you. There are, now there are two reasons I'm showing you this. Number one is to prove that Microsoft provides way too much clip art for a person like me to effectively use in a presentation. And point two is to illustrate the fact that once a person gets on your host, the amount of damage they can do by concealing their activities, by spreading from host to host, and taking control of your network, begins to approach infinity. And the amount of options you have left to control the network and clean up the situation rapidly approaches zero. So basically, I have what I call four tiers of network security. The tier one, you can see over by the brick wall there on the right-hand side, these are your classical security measures. These mean your filters, your firewalls, centralized dial-ins, and also good network design and administration. This is really important. A bad network design from the beginning damages security so badly it's hard to put into words. If you're going in for a network redesign, you make sure security is designed from the beginning. These are effective because they prevent the attacks from even beginning, and that's really the best way to keep something from happening. It's like, you know, you have a house with an alarm system. Sure, you have motion detectors, but it sure would be nice to have bars on the windows they can't get in to begin with. And this is really, this is really, you need to make sure this is a very strong part of your network security architecture, although there are certain things that you can do. There are certain changes in the internet that are kind of destroying the whole concept of a hard perimeter, and this is because new services are emerging that don't necessarily mesh well with this. But in any event, you should make sure that this is a key component of anything you do. Tier two are tools that promote network-wide awareness and protection. Network-based IDS, internal packet filters. So you have something, you have a packet filter that splits up sales and R&D. There's no reason they should have absolute direct communication with each other. Centralized log file auditing. These are effective at detecting attacks. But maybe they can't necessarily do anything about it. A little IDS maybe could spot an attack and stop it, but a log file auditing is maybe going to tell you that there's something going on, but maybe that you need to look into it. It might not be able to take action directly of itself. Tier three, this is basically saying that someone is actively attacking your host. And this is really the last phase where someone can mount an effective defense. This is your network-based IDS again. Host-based IDS, your log file auditing on a per-host basis, wrappers, filters, and other very centralized or distributed host-based security mechanisms that you may have deployed throughout your network. And again, this is the last variable defense before your host is potentially compromised. Excuse me? Intrusion detection systems. Now, the fourth tier is what I call the coffee tier, because this is where you're going to be awake a lot. Pretty much your security has failed. And I'm not saying that checksums and the like are bad. I'm just saying that a checksum is telling you that someone has broken into your host and they changed something. And now you're at the point where you're going to really need to start looking at your backups and maybe start seeing if someone has gotten onto your network, how bad the intrusion has been, and then try to start cleaning up the process. You really don't want to get to this point. My tools that I've written are basically designed to work like the tier level three or maybe tier level four a little bit. But basically, my core premise is to keep people off the host to begin with under all circumstances. I really don't want to handle if a person gets on. There's very little you can do. I have a tool in mind that may help a little bit with the tier four side of things. But again, it's kind of a little too late at that point. And here I am. I'm going to misapply Occam's Razor. And I'm going to talk a little bit about Occam's Razor and the art of computer security. Occam's Razor is, I guess, a philosophy or technique used in the scientific method. And basically what it says is very simple. When faced with two hypotheses that explain data equally well, choose the simpler. And you can use this for a variety of things. But for computer security, it applies very nicely. So for instance, you have a system hacked. The first thing you need to think of is how is it done? And you should think, well, is it an elite exploit that isn't out on the web yet? Or is it a common hole that perhaps I overlooked? And the answer almost always is, it's probably a common hole you overlooked. So you need to look into that first. And if you can't find an answer at that point, then you really need to move on and say, maybe this is something unknown. And then escalate from there. The basis of my tools is to use them. You can use generic and simple detection methods first and always. And the same thing should be done, too, when you're securing your network. You should really watch for and fix common problems first. When you're looking through your network, like let's say you just spent 10K, you buy a brand new security scanner, and you've run it. Well, you want to look at the easy things first, because those are going to be the ones that other people are going to find. So you have your exotic exploits, which maybe involve some type of very unique situation and sequence numbers or some type of exact buffer offset with a particular CPU type to have it execute. Or you look at the fact that you're exploiting everything via NFS. They have unpassworded accounts. Or you have transitive trust all over the place. Someone could just crawl through your network using an RSH. You want to always fix the simpler things first. And likewise with security tools, I'm kind of the same way, that people are going to try the easier things first. And so that's really what I'm going to watch for. And then I'll escalate if I have to. Now, the tools basically are pretty simple. LogCheck has been around for about five years, just as log file auditing. It's pretty basic. In some ways, it's kind of getting a little behind, because I haven't updated some of the keyword databases in a year or two. PortSentry does port scan detection, and HostSentry does log and anomaly detection, and that's my most recent release of a tool. LogCheck itself just watches log files. It's really simple. It's amazing how much information is gathered in your log files when someone's attacking you. And the thing is you need to be able to look at the log files and determine what is and isn't a problem. And if you don't know what is or isn't a problem, then at least you have the information around to show someone else who may be able to pull that information out. And LogCheck basically is a clone of a TI's Gauntlet script called FrequentCheck.sh. This is probably from the older version of Gauntlet. I saw it run a couple of times. I liked how it operated. It was pretty nice. LogCheck has three basic phases. The first phase is it's going to report known hacking attempts. So it's actually going to look through when I have keyword files set out, like someone's verified root or expanding something or they're trying to pass something that you need to decode, et cetera, et cetera. And I know these are hacking attempts. I'm going to flag them like that. The list is very long now because I really want to avoid false alarms there. Now, the second thing it looks for is reporting possible security problems. And this is done through a variety of mechanisms. Number one, I went through a whole bunch of daemons, and I pulled out error messages that they dropped to syslog that are probably security problems of some type. The second thing I did was I thought about how an author writing a security tool would represent something that's bad, which basically means I'd pull out words that are negative, such as denied or illegal or prohibited. And I dropped all these words in the keyword list at all. The last part here is something I really like from the original script from Gauntlet. Basically, anything it didn't recognize as something to ignore, it reports. So if there's something going on that I haven't seen before in a daemon, you're going to hear about it because I haven't told it to ignore it. And this is really nice, especially a couple weeks ago I had a hard drive start flitzing out on me where I didn't know the driver was going to report a whole bunch of read errors, and I might not have seen those in the logs, but because it showed up as something not to ignore, it immediately came up and I could look into the problem itself. Now, here's some examples I have here. This is very basic. Active system attack would just come up as that. I have a lot of custom daemons that report information to me. In one case here, right after the... I guess it was named the overflow, I forgot which, but someone's doing a bind version request all over the place. That just would come up and it would just tell you that. It's pretty simple. The second one too, security violations. This is keyed on that word security alert. That's something Firewall Toolkit did. I kind of like that. I'd make all my daemons do that as well. The big problem with Unix in general is that the auditing pretty much stinks. If you get into the trusted versions of the OS, it's a lot better, but the problem with the... Linux and the BSD versions of that, there's no real standard for an author to write to if there's a security problem. How do they represent a security problem in your log? Really, they make something up and they throw it in there and they hope that someone sees it. Sometimes it's a good message, sometimes it's not. It's one advantage that, for instance, NT has, because out of the box, you have different sets of logging for security system or application errors, and that really helps go into your log files. I'm hoping one day that becomes more widespread under Unix. Here's another example. Here's actually a full thing here. Someone did a heavy scan. I don't have the full thing because we're going for pages. They did a heavy scan against a host I controlled. Here they tried the expanding route. Generally not a good thing. I frowned upon it. They went down here, unusual system events. Here they're hitting the packet filter, and they're having a fun time there trying to hit telnet, imap, and pop3. Oh, they did something else too that was interesting. Here you can see they're coming from the telnet port, going to the telnet port. That's called source porting. They tried a source porting attack. They tried source porting from FTP data port 20, and they also tried regular scans using high ephemeral ports. What they're doing there is they're trying to hop my packet filter. If you've ever tried to do packet filter rules, it's complicated, especially if you have a lot of services going on. Sometimes admins get things a little confused on how to let ports through. If you perform a port scan and you try to come from the same port as you're going to, if they screwed up the packet filter rule, you could sometimes punch through it because they set the connection up two ways. If you're doing port scanning, you should probably try that. If you're trying to protect against port scanning, you make sure you don't do that. There are some dangers with log check. One is log flooding. If you run an ancient version of syslog and you have port 514 open, that's a UDP port. A UDP port means that I can send whatever information I want and make it appear to come from anyone, including your own host. If I just store random information in your log files, I could fill up the log files or I could make your reports come out very long. There's an additional danger, too. I don't think log check has this problem, but there are other log file auditors that take action based on what's in that information. If I were to file something in to your log file in some properly placed semicolons, for instance, and you pipe that out to something, like a pager script you hacked up, I can start running commands in your host. You need to remember that log files are completely untrusted data source. You don't ever want to trust that data in the log files. You certainly don't want to pull that data out and do anything with it unattended unless you have thoroughly gone through and had something cleaned it up. People can really insert some stuff in there. I haven't heard of anyone doing this yet, but it's certainly within the realm of possibilities. If you're using log check, don't modify it and make it run stuff based on that because you may get bitten really bad. False alarms are another problem, too. Sometimes the way log check is, I can't accommodate every system. You're going to have to go through and tune it. There's no other way to put it. All the log file auditing tools are the same way, pretty much. Port century. This is a tool I wrote in October of 97. I think after an evening, I got frustrated because someone kept port skating a box. I couldn't firewall, and it was an older OS that patches weren't readily available for, so I decided just to give them something to port skate. The way I used to do this is I'd set up tripwire ports using TCP wrappers out of iNetD, but that got me a little bit nervous because I wasn't using a tool specifically designed for that. I just went ahead and I wrote something really fast that would bind to a bunch of ports, and when they hit it, it would just drop the route or it would drop them into a filter. Basically, do all of you know what a port scan is? I may have to say, well, I'll explain anyway because someone doesn't want to admit it. Basically, a port scan is a person's, attempting to contact your host and see if you have a port open for a hole they could potentially exploit, such as IMAP or PortMap or MountD, et cetera, et cetera, et cetera. They do this as a recon mechanism. What you want to do is if you can detect this early enough, you can actually stop it from gaining that reconnaissance information and an alert at the same time that someone's doing this, and maybe it's a host you need to watch. Now, there are lots of other tools out there that do this, but port century really has something kind of, I guess, controversial is the only way to say it. I do real-time blocking. If you hit a port, and it's trip-wired, you're going to nearly get dropped into a bad route or a packet filter or TCP wrappers, and your host is going to be actually denied access to the host itself. Now, here I have the benefit of surprise. If someone's scanning your host, and all of a sudden it just dies, it really isn't a good feeling. And then sometimes what you'll see them do is they'll actually go to a different host, thinking that there's a bad route, and they'll try coming from that host, and they get dropped there. Well, now they've revealed two hosts that are probably hacked, and they're trying to get to that host. They're trying to get into your system on. And at that point, they may wise up and decide to move on, but sometimes they may go to a third host and try there, too. And then usually by then they get the clue. That's kind of a nice thing to have. And when you're in warfare, especially if you read, like, The Art of War by Sun Tzu, surprise is a very big factor in winning any battle. If you look back through history, surprise has really been a key factor. Here, they're really not expecting anything to happen. They're expecting to get a banner back. Well, you know, don't give them a banner. The third one here, is it doesn't play games with people. This is mainly referring to the concept of like a honeypot, where you set up a system and kind of find out what they're trying to do. It has its application. I think for most people it doesn't, because you're keeping a person around. I want to spot the problem, and get rid of them. Go on to the neighbor. I don't want to play with you. I think this is generally a good idea for most people. Sometimes a honeypot can be interesting if you want to see what people are running. Or what you can download yourself. And it usually isn't a good idea to egg them on. You start playing games with people, and they know it. Like they find out, man, this is a honeypot the whole time. I just wasted three hours trying to crack this box. Maybe they just decided to download a smurf program. A 14-year-old kid with a smurf program can cause a bunch of problems for you. It doesn't take much skill to do that. So usually you just want to get rid of them. Theory of operations is pretty straightforward. The first mode, you go to a list of ports, it binds to them, it waits for a full connection, and then it drops the host. It's really kind of straightforward. People started writing to me and saying, wow, it really would be nice if it did UDP. It really would be nice if it did stealth scans. And I kept saying, well, if you do that, someone could forge a scan and then drop your host. But enough people started writing, and I figured to put the option in, give adequate warning, and let them make up their own mind. And that's kind of still my basis today. It's some type of great vulnerability, and I know that, but at the same time, I think if people want to rate a risk, it may not be a tremendous vulnerability for certain hosts. And I think I could provide enough information in the documents that people can make up their own mind of what they want to do. I don't want to make a decision for them. As I said here, TCP is really simple and effective. It binds to a bunch of ports, but it may miss some scans, such as a port scan. When I originally released the tool, I actually mentioned the fact that a port scan, was a big deal. And the reason for this is because, from my experience, a lot of stealth port scanning is a precursor to an actual attack. And when people are coming in and doing a stealth port scan, they're usually collecting data on a wide variety of hosts, and then they're going to come back later and kind of find out whether or not that host is going to cough up any information. So in this case here, they're going to get a bunch of ports that are going to come back, and then when they eventually come back and try an attack, maybe by hand or maybe by some other automated script, at that point they're probably going to get dropped. And that might be a little bit worse. What is UDP? UDP is a, is a, basically, it's a, I'm trying to think of a, it's a connectionless protocol, but it's completely unauthenticated. It's connectionless meaning that I can send a packet to the host, it doesn't attempt a handshake of any type. So at that point I can make the packet to be whatever I want, and the host is just going to accept it, and it really has no way of verifying it's coming from the host. So UDP makes you have a three-way handshake that's going to happen, the full sequence known as to protect the whole session as it's occurring. And yes, while in the past it has been possible to forge this, with modern kernels it's extremely difficult to do. The wall socket binding mode basically works, this is a stealth scan detection mode, it only works on a Linux right now. This is, for the first cut is for expediency, I have to admit. Linux has this feature where I can open a wall socket and just start reading packets in off the wire. I don't need libpcap or any of the libraries on top of that. It is more complex, but it does catch most scans. It certainly catches most of the Nmap scans. But it does have a higher false alarm possibility. In fact, the latest version of Nmap they put in a feature called a decoy feature, and I'm not sure what causes it to be put in, although I highly suspect there was a release of this tool. But basically a decoy feature, you give it some decoy, some decoy host, and as it's scanning you it also hits you with these fake hosts. It's a trip sentry to block all these hosts at the same time. It's kind of, I haven't had any complaints of people using that directed towards me. If you've been hit by it, I'd love to hear about it, but I haven't heard one person yet. It's not on other platforms yet, because it's going to require a lot more code, a lot more investigation, and certainly it's going to be a lot more complicated, as I've said. I think it's going to use more CPU power on the other systems. It's probably going to have to do promiscuous mode or some type of kernel level interface, and it's just going to require a lot more time, but it's going to be a lot more complicated. Now blocks host in three ways. Dropping them out, TCP wrappers, or with packet filters. Packet filters are your best bet. They're designed for the task, and they work really well. All the modern Unix kernels out there have some type of packet filtering capability built in. You should really use that. TCP wrappers work, but they don't protect all services. If you have HTTP, for instance, and it's not linked against libwrap, you're not going to get any protection from the default route. The default route is 333-444-555-666. That's not a valid IPv4 address. So you need to change that. Some people in news groups are saying just leave it alone. That's incorrect. You want to change that. The problem with dropping a route is that you cause something called an asynchronous route, meaning the packets come in, but they don't go out. That sounds like an advertising slogan. Basically, what this means for TCP, it's okay, because that way the handshake doesn't complete. The SYNAC doesn't go back out and gets the host. UDP, this is not okay. If they're trying to port scan your host or they have a particular service they want to attack, you can do blind spoofing with UDP. You don't need to get the packets back. If you already know how the protocol's going to behave, you can still abuse it. So this is really not the optimal way to do this. It does work, but it's just warning you that it's not optimal. If they're attacking a UDP-based service, they can do it blind and not have any real issues. Well, if they're doing a port scan, they're expecting an ICMP port unreachable or some other indicator. But let's say that they do a port scan and they don't get anything back, but they decide to run their UDP attack script anyway. And the UDP attack script doesn't really care if it gets anything back, it just wants to do a blind spoof. And if it's doing a blind spoof, then you're going to get hammered. This drop in the route is not going to get you anything back. It's an asynchronous route. The packets still do hit your kernel, they're just not making it back out, so you need to be really careful. Deployment steps are pretty simple. Compile, configure, start one of the options for TCP and one of the options for UDP if you want to do that. The only one I endorse, and I say this multiple times on the doc, is dash TCP. This doesn't bind all the ports. It requires a full connect for it to detect a port scan. This is going to be very hard for someone to spoof against. That's the only one I endorse. If you want to do the other ones, you need to weigh the risks. Most of the time the risks probably won't affect you, but if you're running a high visibility server or you're egging people on, it's probably going to bite you sooner or later. And then you automate it in your init scripts and then you kind of leave it alone. And that's another premise of my tools. I like to have them be simple to set up and you kind of leave them alone and at that point you just don't need to touch them anymore. You just kind of let them do their job. Here are some examples here. Someone's coming in. Example.com, they hit port 143. The port sentry just tells you, okay, I'm going to put them in TCP wrappers with that. I'm going to block them. And then it's going to drop them here using a packet filtering command. At that point later on, you're going to see here here's what happened. It started 1906 and then they went down here and they just kept trying. And you know, sometimes people will sit there for hours. And it's probably your scripts aren't timing out correctly. In fact, I'm sure that there's one out there I know of. I don't want to say it because I don't want the bug fix. It doesn't time out. It just keeps sitting there and sitting there. And it'll come back days later and try to connect again. So I leave them in there for a while. I call it the penalty box. So they'll sit in there for a while and they will come back actually and retry again. And like I said, sometimes they'll come from multiple hosts. And this is really advantageous because now they're exposing themselves on multiple sides. And sometimes those hosts may be the one you control. It's kind of nice to know that. Dangers, again, I hit on. Denial of service. If someone is forging packets, they can cause a stealthy UUP mode to activate. It's not hard to do. A second point here is over-reliance. Sometimes you figure you have these tools installed. Well, I'll just wait a bit if I update. Don't do that. It's not a substitute. It's supposed to augment security. It doesn't replace basic administrative tasks. And lastly, it may be an unnecessary application. If you have a firewall that's already secure, don't want another app on it if you don't have to. Even if it is a security app. Like I said, there is a possibility. I could screw up somewhere. There could be some type of backup available. You just don't want to expose yourself in that way. If your host doesn't absolutely need it, you may not just say, well, I don't care if they port-scan me. I have a firewall. I don't want it on it. I just say, okay, port-scan me. I don't care. Sometimes that's the choice. Sometimes it's not. You're going to have to weigh it on a case-by-case basis. HostSensory is something released. Definitely not as popular as a port-sensory tool is. It does something called login anomaly detection. What login anomaly detection does is it's going to watch user login activity. This came out of a situation about three or four years ago. I was helping out with security in ISP. One morning, one of the admins noticed a very high CPU on a host out on the West Coast. At this point, he logged in and found out that it had a sniffer and crack running out at the same time. We went in there to figure out what was going on. Basically, what happened was a user had a password sniffer It happens all the time. In fact, it's really quite pathetic. A colleague of mine went on a rant before about the fact that when protocols are presented as a form of an RFC, they really need to go through a security audit. If they can't pass it, they really shouldn't be approved. There's no reason why some of the more modern protocols like POP and IMAP pass unencrypted passwords over the wire. It's kind of ridiculous. In this case, this user had his password sniffed by using POP coming out of a university that had people all over it. The person logged in from a European country and kind of went to town on the server. This is very common. Some of you may have had the exact same thing happen to you. It's very hard to defend against. If this person hadn't fired up a sniffer and a crack program, we may not have spotted them just because they were logging in as a normal user. It's important, I think, to watch some of this. It is kind of Big Brother-esque, but sometimes you need that for a sysadmin if you want to maintain security. What HostSentry does is it basically monitors WTemp and UTemp. Or similar auditing data format. Right now, though, this is alpha-grade software. It's only monitoring the WTemp, UTemp files. It maintains two databases. One is a TTY state database. This keeps track of the current logins and logouts occurring on the host. This is for a variety of reasons. One is so LogSentry knows who's logging in and logging out, of course. The other is to help track it between reboots and whatnot to make sure its own internal records are being cleaned up correctly. The second one is a user database. And a user database, as soon as you log in, you're immediately going to get a user record. That user record is going to have your username. It's going to have when you were created. It's going to have your first login, which included not only the time you logged in, but where you logged in from and what TTY. And it's also going to have a large field called track logins. And what this does is it keeps track of all your logins, including where you logged in from, again, your TTY, your login and your logout times. It's also going to have whether or not you allowed to log in at that hour, whether or not you allowed to log in at that day, whether it's been disabled by the admin or it's been disabled by the HostSentry program itself. And as you're logging in and logging out, HostSentry looks at this information and it runs modular signatures as required. Now, there's several indicators that HostSentry actually attempts to spot. The one with the asterisks are not fully implemented yet. Again, this is experimental development software. The basic one are login and logouts. Not too high tech, except that, again, across Unix platforms, the way these are logged is not consistent. Sometimes if you're trying to track this stuff, it can be a real big pain. Second one, odd login times. After you've logged in a certain number of times, the tool has the ability to look at your past logins and develop a profile of what's going on. In this case, for this signature, it will look at your past logins and develop an average time window. So if you only log in between 8 and 5, there's no reason you should be logging in at 2 a.m. So that's what it's going to look for. First time logins. That's a really big deal. If you run a Unix host and people don't need a shell account or shell access, please don't give it to them. Shell access is the biggest security problem with Unix by far. The fact that it allows you that interactive access. For a first time login, if you have a person who's only doing POP and that's all they need to do is see the secretary, join the account, whoever it is, and then you see that they log in for the first time and they don't even know how to type, let alone know how to use Unix, you really need to look into that because it's a very suspicious activity. Foreign domains are put in quotes. Basically, this is a domain that you don't control. So if you're running example.com and someone's coming in from Haxor.com, you probably want to find out why they are. At the same time, if you're a domain in Germany and someone's logging in from Malaysia, again, another very suspicious activity you need to look for. Username inserted is another one too. This is kind of a strange one where basically I know what usernames are supposed to be and if another one person logs in with a username I'm not familiar with, I flag it as an attack. And the reason for this is a recent exploit like I think it was a StatD overflow. A lot of them insert a line at the bottom of a password file like root or hacked or whatever. And at this point, they will tell that in and it has a null password on it or some password they already know about. So they log in and they drop into a shell and they have root access immediately. Well, with this type of signature in there, when they log in, if there's a new database I'm familiar with, I'm going to boot them off the system. So that's another way to maybe do a little bit of CYA. Strange file modifications plus an R host or other oddball things you'd be able to look for with it too. Strange directories when they log out. Hosts don't truly look through their directory. They have dot dot dot, dot dot space. They have other oddball names that people use to hide things in. Things to look for. History file tampering when you're logging out. It's going to make sure your history file is there. It's going to look you up in the password list. If you have and knows what history files go with what shell, it's going to see if that history file is truncated, deleted, or linked to dead null. All very suspicious activities. Multiple concurrent logins is probably not what you think. Basically, if someone's logged in and they have 5x terms open from a single host, not a big deal. But if that same person's logged in five times and they're logged in from Sweden, Malaysia, China, Jamaica, and Haiti, you really need to look at that because they're probably not in all those places at the same time. Very, very suspicious activity. Invalid UTEMP entry. When you log out, host entry will look through and see if you have a matching UTEMP login record. Maybe you've been zapped out. Suspicious history commands. Running network daemon. Egg drop running when you log out. Yeah, a lot of you probably want to know that. I don't like that program running on systems I control. I think that's suspicious activity too if your policy prevents network daemons that use your zone from running. Some people do allow it. File exists. You can put in a name of a file you want to look for. If it's in the directory, it'll flag you. Inactive account used. A lot of times people will create accounts like a corporation and maybe they get logged into once just to test, right? But then they're not used again. But they have to stay there for various policy reasons or maybe email access or whatever. Well, if that account is used for a login six months later, we should know about that. A feature to be put in, host entry. The asterisks, I apologize, aren't done yet. They will be soon. It will flag that. It'll say, you know, this is an inactive account. It's suddenly become active again. Maybe you want to look at this. Some examples here. Sorry for the verbosity. Security alert, here I am. I'm logging in. Here's my TTY. Here's some host. And here it goes. First time logging. I didn't have a database entry. I'm logging in from somehost, or somehost.com as the case may be. At that point, it will then go through and do what it needs. And here you go, I have a logout. I'm just saying that I'm logging out. I come back and log in again. Let's say I modified the foreign domain to say allow somehost to come in. The next time I log in, it just says log in and log out. It's pretty basic. No signatures fired. Let's say we have a test user. Test user logged in here. Nothing really happened. Everything was kosher. And then they log out. Well, in our host, they dropped a plus plus in. So it takes some action against that. Furthermore, they have an odd domain here. They have dot dot dot. Not a good directory to have in your user space unless they really like having confusing directory names. If someone's naming a directory like that, it's pretty suspicious, I think. Further down here, history truncated. And it says here that it's a symbolic link to bash history. Again, not a good thing. If someone's linking to dev null, they're hiding their activity. A lot of history files only write their data for the current session after they log out. So if you just remove a file, a lot of people think they're slick. They remove a file, they think their history's clean, and they log out. But the last thing the shell does is it writes out the history file. So the smarter people generally try to link it to dev null, so when it writes out, it just goes to dev null. One thing someone does that's kind of interesting are history files for users. I forgot his name, I'm sorry, but he does an append-only mode on all his user's history files using the secure level flags. And that could be something useful for you. Database record here. I'm going to dump the database here. And here's what's in the user database. Created the first time login. You can see what's going on. These stamps here are Unix Epoch. Your login days and hours aren't implemented yet. Whether it's disabled, these are just flags and the total number of logins. This database will track all the users on your system. And eventually I'm going to have tools written up that can actually crawl through this entire thing and design pretty little web pages so you can actually track all this stuff and what users are doing when and where. Again, dangers. Wtemp and Etemp, again, Unix, they're not, I mean, they've been around for decades but they're really just not very good. There's a possibility people can tamper with it. I'm assuming that root is not compromised on the host when these tools are running. It's obvious that if root is compromised that people can really do whatever they want to anything, including my own tools. So it's possible that they could somehow tamper with the ability to write out that they're even logging in and I may miss it. Additionally, if it's a service that's allowing you to log in but it doesn't write to utemp or wtemp, I may miss that too. So that's another possibility. The utemp records are all different from BSD, Linux, and Solaris. Linux and Solaris are okay because their host record size is large enough. It's 255 bytes. That means if your host name is 255 bytes or below, I'm going to see the entire thing. Linux goes a step further because it also includes the IP address. And really, any auditing record, you always need to include the IP address because DNS entries are so easy to screw around with if you trust it. The problem with BSD is the UT host size and the utemp struct is either 16 or 32 bytes long. So if you come in from a host and really, really, really, really, really, really, really, really long hosting.com, it's going to truncate it down to 16 or 32 bytes and the records themselves may not be as complete as you'd like. In the case of HostSentry, since I'm relying on that information to be able to make certain comparisons with foreign domains and whatnot, you make inaccurate results back. If we use compromise. And the last thing is, I consider it like a last line of defense. It does not replace good security measures such as protecting your passwords. If you're using services like POP and IMAP, you just need to make sure you take other measures too that are a little bit more robust. Closing thoughts are pretty straightforward. I'm real big on paying attention to your systems. They're almost always going to tell you when there's a problem. I can't exaggerate that enough. You need to be aware of other activity on your network too, such as increased network traffic at certain hours of the day. Maybe network devices aren't functioning as they should. Maybe a password all of a sudden doesn't work the way it used to and nobody on your team has changed it. All these things are just little subtle indicators that there's a problem. The last thing, using bug track and other security forms is a very great way to stay informed of the latest problems. And Q&A links, I only put two there. One is for my webpage. It has the papers and tools there. There's a lot of free tools and security papers really well organized. I would put up, I normally put up packet storm security, but there's a certain individual on the net who likes causing problems for people and I'm not sure of the state of the site right now. It's unfortunate. It's a very nice site. Questions? Comments? Yes? Yes, I'm sorry. Presentations I do, I always put them up on the web. This will be up on the web when I get back. Yeah, I agree. I like to make tools that kind of can last for a long time between updates for that reason. It does take a lot of work to write software. It's all in my spare time. I try to do at least a few hours a week. Sometimes I'll do four to eight hours a day if I can, but of late it's actually been less than a couple hours a week and that's just for a variety of circumstances related to work. My real work. Well, ideally they hit the first port. What I'll do, if you're doing the basic TCP binding, I always have it bind like a few of the ports first. If they're doing like a sequential scan, they hit those first and by the time they get up to a higher port, they've already been dropped. If you're on like a fast internet with Nmap, it may be able to hit quite a few ports before they get dropped because the machines aren't reacting fast enough and they just sprayed a bunch of packets, but if they're coming in over the internet where the links are a lot slower, they may hit one port and then one, maybe two ports and then by that time they're dropped and you just kind of vanish. I'm sorry. . I'm sorry. . . . . . . . Well, if someone is forging packets to complete their port scan, are you asking are they forging packets to cause a denial of service? . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . and you may not catch it. And there was, like I said, there were some other tools that I think the SNI people were playing with that would do timing, check the timing against it. The really only thing you could do is go to each host and you could check for promiscuous is on, then they can hack that so it looks like it's off if they've rootkitted your ifconfig. But there are other utilities available that you can compile on a secure box and bring onto that system and run them and they can look at the network card directly and maybe tell you whether or not that thing's in promiscuous mode. Another indicator, too, is just very high CPE utilization or an odd process name. Again, they could've went in, rootkitted PS command or anything else, but if you bring in a secure set of tools, you can sometimes spot it that way. High CPE's a pretty good indicator. Did the Loft release your tool yet? Okay, yeah, I haven't seen it yet. I really am interested in looking at it. It sounds what I need. The Loft is releasing a tool called, I think, anti-SNF, which may be able to help some of what you're talking about. I'm sorry I don't have more information. I like to look at it myself. It sounds very useful. I think CERT had one. CERT had one or two at their website that can detect promiscuous mode. Of course, you can use ifconfig on the box. That'll tell you if it's promiscuous, but again, if they've gone in there and changed that or if they've done something, some kind of loadable kernel module or something, obscure that fact, you might have a real problem. Yes? Yeah. Well, Stanford, if someone did it wrong, there is no way to tell whether the business is backing the wire or if it fucking does something. Yeah, but that gets in there religiously. Sure. There's a lot of unusual ways of doing it. If someone was entirely used to it and never really, you know, they just set up a device and set it up. Yeah, I agree. I mean, if someone puts up a promiscuous mode card that has no addresses or network protocols bound to it, it could probably be a real problem, but. It's got a oscilloscope, you know. Yeah. Anyone else? Yeah.