With the University of Southern Mississippi an anti-child porn organization now incorporated at this point I'll probably have to say that University of Southern Mississippi has the greatest IT department computer science program I have to say that now can you hear me all righty again my name is Tim Lawless with the University of Southern Mississippi and anti-child porn organization I'm here to talk about a little project I've been working on St. Jude where we're trying to detect improper root transitions of course the computer thinks it's a Monday's do actually no star office really really happy with this person this is my email address and we'll be dropping this presentation plus other information out on this URL a little bit later on today St. Jude really came about because in our institution we have to allow clear text passwords on a lot of systems which as you know is the most evil thing that one can do and once you get in they pretty much it's just a matter of time so we started looking for a way to save ourselves a lot of time from sleeping on the floor one thing led to another Guy put forth an idea back in October I believe of ninety seven and a system in magazine about actually trying connect the transitions into the root user by monitoring audit trails and the solaris that's really where we were we got the beginning of this rock has come forward the reason why we had to go and start looking at things like this is because is our firewalls really will not protect us. We also, with clear text passwords coming in, our users themselves will expose our systems. They're sometimes our best friends and our worst enemies. As they would, the misuse detection scanners like Snort and the like really would not pick up everything. We've already seen how they can be bypassed, how the systems that we're putting out on our host really themselves can be defeated and you will see this continually through the day. And of course, we've come to love our Unix vendors, the ones who give us new root exploits in every update that they send out. And we also, the problem also with our detection is that you may go one, two days without finding it. Unfortunately, the system ends real good on vacation. And the longer that that is, the more damage will be done to the system. But any time that they're on the system, we can't trust anything really on the system itself. So that's where we began. When we began the project, we wanted to produce ultimately a kernel level IDS implementation. Our target was Solaris, but we went over to Linux because it was easier to do development. There was a little bit more information just to get the wheels going. Pardon. I can't... We also wanted to try to minimize the number of false positives that we would be getting and of course the negatives. That was a problem with the original implementation put forth in sysadmin is heap load of false negatives before we would be able to really respond to anything we we want to reduce those uh false negative false positives uh to a point where we won't shoot our users plus we'll be able to catch enough of what's really going on so what we were doing we used to reference monitor implementation i believe you'll probably hear a little bit more about this later on this evening um when we talk when uh gentleman talks about uh penetrating uh b1 systems um we also went to a rule-based anomaly detection um in just a moment i'll go in a little bit more about that and uh modeled behavior for execution after uh reviewing um copious bsm outputs now before we get into this i'll go into a little bit of a talk about um subjects and objects uh how many here have dealt with uh maybe trusted operating systems yes no good excellent so you'll follow what i'm saying the subjects are are the things that do things onto other things well the objects are those which are being done too a little bit better definition is up there we'll also sometimes see that our subjects will be the objects themselves um the reference monitor was it will be enforcing our um policy by forcing all actions performed by the subject to actually um go through it it will act sort of as a stop gap to prevent things from occurring which we really do not want to occur um the uh rule-based anomaly ids as opposed to our statistical anomaly ids systems given given a rule set if looking at a chain of events we'll start off with the beginning where we'll enter the rule set and we'll move forward if at some point one of the options at that point is not actually what is occurring we have an anomaly going on that's really uh what this what this guy's about it was implemented um at lol now and the um wisdom in sense and also the tim's project uh with digital corporation um what we're going to be doing is uh looking at we take every subject out or process in our case um we would classify it as being a privileged or unprivileged process um the privileges we'll be root but it also would be a set of root plus somebody else this would allow us to detect transitions into say oracle users or other uh damage that we're running within the system unprivileged subjects just normal user processes will transition up like we know through execution of the set uid binaries in doing so we then have to catch them and determine how they're beginning where they're beginning in the in the chain of events that may then occur um the privileged subjects the processes will drop their privileges through one of uh and when it's one of uh these three calls i believe under slurge we'll be dealing with uh force fourth one um given the subject with privilege um and this is really where the decision is made they may execute any other uh following system to exceed only if the subject first drops its privileges through one of the means we just uh talked about before and the um object is within the subject or the objects is within the uh restriction list uh within the um rule base a subject without privilege may execute any object just a normal user may go about his daily life as long as they do not transition up into a privileged state we're gonna be perfectly okay and allow them to do what they want now upon execution we're going to have to do some stuff and juggle around change our states uh where once upon execution the new subjects restriction list will be updated based upon the subject's prior state and the optics executed i'll show you in a moment where we go through and um have to say we're running a binary um he He calls another function and he's okay to execute. We've already passed it on. The binary will then find the best rule and we have to ensure that the next rule for what the next guy that's about to run can do is a subset of the current processes rule. Otherwise, we could gain privileges just merely by executing a certain path of applications. And finally, a subject's outdated restriction must be subject of the subject's prior restriction that somebody is submitting to. This is currently where we're standing right now. We've got a SLURS Perl implementation. It'll run currently under SLURS 251 through eight. Eight has some problems with its arguments where it will not give those out to us in the BSM. It's not yet been fixed by us in Microsystems. And the BSM is not yet fixed by us in Microsystems. The current Linux implementation is running at this time not in multiprocessor system. We do not use argvs for context in the Perl module at this point. But under SLURS, I mean under the Linux kernel, we are using the arguments to decide our context. The reason this being is some applications will make a call to system, for example, which goes out there and will run slash bin slash sh with the dash minus c. And then the argument passed the system as the third argv. Argv of two, you know, third argument. Without being able to look at our argvs for the context of what we wanted to do, we would then just have to allow these programs that are executing a system call to then just go merrily out and run in the shell, which is something bad. We're hoping to have an internal SLURS implementation out by around Christmas of this year, maybe early 2001 at worst. Probably in the 27, 7.7 kernel, 8.0 at worst. And just to show you, I'll switch the slides, I'm sorry. Externally, internal versus external. Inside or outside the kernel. When we implement, when we would do this, to be able to really stop the things before they occur, we would have to do it within the kernel to preempt them. However, when we go into the kernel, some things change. Externally, when we get them out through our audit trails, each event is a discrete instance. One line is one event. We have all the information about what's going on. While inside the kernel, we're watching it as it's actually going on. Sometimes we have to wait until another event occurs before we can just really determine what happened with the prior event. For example, with the execution of a set UID binary, the execution code down in the file system objects in the Linux kernel will actually set the UID and the effective user ID to zero during the execution. The execution phase, however, since exec never returns, we never really know that a set UID binary has, in fact, been executed until another event occurs and we can really see, we can infer from what has changed in the state of the system that it was, in fact, a set UID binary that went forth, and then we build our trees from there. Externally, the detection is delayed. Externally, the detection is delayed. Solaris implementation, we're seeing about two, three seconds on a single processor system, a little bit less on a multiple processor system, but at that point, we begin racing to see who can kill whom first. Also, externally, it is easy within those two seconds, two, three seconds, to strip a kill of the external monitor. Within the kernel, it's a little bit harder. You would have to do it before actually doing an exec, which would require you to have the code within the module itself. For example, this little application will execute a bash shell. Give us, if it's set UID root, would give us root normally. Let me just go over here for a second. Let's see if it thinks. Normally, we're running this. We've dropped out to a root shell upon execution of the binary. However, going through the syncing model. The font? Yes, sir. Just a second, please. OK. It was I subscribe please. That would be fine, but ... OK, go ahead. Do you want it anymore? Maybe that'll work. Whoa. It did get big. Well. Okay. Let's try this one again. Normally. It would be dropped out to a rich shell. Possibly. Normally at this point. Your friendly administrator will spend the next evening. Instead of with his wife and kids. Rebuilding a system. What we want to do. What we want to do. I'm sorry. Let me just. Okay. I'm going to go in here. Light up the module. And then. It catches the exec. Just as it begins. It kills it at the exec process. And. We just drop out a message. Oops. Well. We're doing it. To K log. There are some. This one. Catch. The buffer overflows. We tried it. With several buffer. Pretty much all of them. Overflows. We could. I try not to keep many buffer overflow. Vulnerabilities on my laptop. I apologize. I'm nervous. Yeah. Let's see if I can just minimize this guy. Right now there's no other tracing. We were playing into kernel. Well we're not outputting any tracing. There's some extra tracing in there depending on the compile time defines you do, but right now the minimal ones will just make your hard drive rattle for several hours for just running an LS. It is feasible to add in additional tracing into the system, just modifying the source code of the main app. I'll get into the source code in just a minute, let me find my window. I'm going to have to fast forward through these again probably. Unfortunately some things in Unix are not quite as good as they are in Windows yet. Oh! Pay attention to. I feel like I'm doing patches right now. Unfortunately right now there is no silver bullet. Not even this guy can really stop everything. He would be just another layer in there. For example with the buffer overflow, the buffer overflow actually does occur. The shellcode does get executed. However. Just at that execute is where it's caught and it's stopped. That's why it's referred to as the last ditch effort right before hellfire and brimstone falls down upon us. Also, the restriction rules must be written. There are some applications, for example, I discovered when I came here, I have been spoiled all my life and have not used PPP yet, that the Usernet CTL script causes that module to go really wild. So you have to go through and write out the rules in the script before it will not catch those and actually let them pass. Also, there's the additional overhead. As we're playing around within the kernel, just doing the extra stuff and munging the data, it costs a little bit. Just executing user processes without going through, having to do any of the checks. We're seeing less than a 1% slowdown. However, let's say we're root and we're compiling a kernel, see almost a 5% slowdown at that point. And it's really spending it in system time now because we're having to update all of our checklists. There's really no optimizations in at this time. We do have some inline functions, but that's it. Now, the rule sets that I spoke of, that's the end of the slide presentation, I'm sorry. No network connection right now. Sorry. Oh, yeah. Well, let me just hit that right here. Well, unfortunately, it's not. It's not PowerPoint, but religious reasons prevent me from using that. That's the contact information once again. Probably by 1 or 2 o'clock this afternoon, we'll probably have this PowerPoint out there along with the source code. The source code is available on PacketStorm at this time. I sent out an update last night. You got it? Good? Okay. Okay. Now, that will... Let's try to get this a little bit smaller. Much better. Can you hear me? Good. All right. Thanks. I'm going to go ahead and run this. I'm going to go ahead and take a look at the data. Whoa. For example, right down here are the general rules that we've, the rule sets. And unfortunately, we're having to compile them in by hand right now, not reading them at load time. We do want to be able to go to root sometimes, and so we're going to have some guys that really have to be granted a pardon. SU and sudo, by the way, sudo is bad, you should never use it, are in there. Gene mixer was one that just had to go in there because it will execute mod probe through system. As root. Otherwise, sound gets really loud and you can't, or you can't turn it off. Are there any questions? Yes? I'm not using it to be able to block the sqid, but would it be a part? Pardon? Or a default process sqid? No. A setuid process may execute. However, it may not execute other processes by default. The default rule down here. Is actually rule zero, which is none. You can really go through and execute nothing else, but that setuid process itself may execute by granting all privileges. It may, it has carte blanche in your system, SU and sudo, of course, would be application where we'd want to do that. I don't think there would be anything else we'd want to do that for some of the testing that we did just with a couple of things gets really long, unfortunately. But that's the nature of the beast right now for this guy. We're wanting to add in later support for just loading it in from a configuration file. Yes, right now I can. There is the option in there commented out for debugging purposes to prevent the loading of the unloading options. We just replaced the load and the clear module syscalls in there. Now it is still possible to attack it through KMM. However, personally using lids to prevent that may be something put in this guy later on in the future. We're going to go into policies, but what kind of issues do we have with the policies? Policies such as what we're looking at, what we were just looking at. Initially, what we would have to go do is go through a learning phase where we just run through the system normally. In a safe environment, not plugged into the network, we just hope we know what we're going to run on the system beforehand. After determining from the output of the learning process, which does everything but still permits it to actually execute. It just gives us the error message and from those we then would be able to write these rules. Once these rules are populated and you've recompiled without the learning option enabled, you'd load that in and go from there. When you make changes to the system, which may require these root execute features, you'd have to modify and reload from there. How about external ways? When you have something disappearing, how about externalizing it? Is it different than someone else? Now you have the process that you wanted. Can you just get a little demo of the memory for that process? Not through this guy. He's really... He wraps himself around the kernel. At this point. In fact, let me just go into... Also, since we can't link when we build a module to make it manageable, we've done includes. My C professor shit when he saw this. I think I committed a sin. Loading the module. This is just handling the execs since... I point you to the stuff by Pragmatic of THC for how to handle execs. We're going down here. What we do is we... We're saving the original syscall to a pointer. We're placing it with our wrapper. And within that wrapper, we're going to make a call to that original syscall. So we just wrap ourselves around the kernel. We're not actually being invasive. And that's why we can actually pull ourselves out without much problem. . That would be possible. Would not be part of the module itself. Because it's such... It would be such an expensive process to do. Probably through a proc file system interface. With a monitoring daemon running. That you would then be able to do that. I'm sorry. It was asked whether we would be able to, at some later point, modify this so that it would communicate or... And be able to attack the offending processes. Offending users' processes. And pretty much retaliate against the login instance. That may be perpetrating this. Would I be correct in saying that? Basically be able to take the information for project citing. And then do further gathering of what processes are running. Dump of memory and just... Whatever you wanted to take from that. That would be something we'd be doing in an external monitoring application. The dumping of memory and gathering of further information about the offending processes. Part of it being expensive. That will only be executed while... In a kind of condition, right? Yeah. During the execs, forks, and to a much lesser extent, the set UIDs and exits. So maybe you could really accelerate this. It's not over everything. It's not like this is something that ideally would happen. If this happens all the time, is that something really wrong? Yeah. Yeah. I could see how it would be much easier to do it in user space. Versus kernel space. Since a lot of the fun with viewing it in kernel space is you've got this... You're set right here. And you're limited in what you can do. A lot of just... String calls. You're going to have to write them yourself since you cannot call external libraries while in kernel space. Plus... If you core dump in kernel space, that's a bad thing. Yes. We lost exec many times. Everything keeps running. Nothing else will. What was that? But after we load the functions and wrap ourselves, it just goes on. Right now, we're allowed to clean up our module. We free our memory and go on. What normally we do to prevent you from cleaning up or loading in other modules is we just replace those with an error message of either for loading no memory or for clean up module, module not found. It just errors out and blocks any attempts to add or remove. Because those syscalls can be called from within, for example, buffer overflow. Okay. All right. Apache runs as nobody, so really you'd be hitting just running in user space at that point. Hmm? Yeah. If you're just in user... If you're just... Without privileges, not root, we branch out just into the wrapper and go straight to the syscall itself. So that's... It's practically no expense if you're just doing user stuff. NameD. Let's say you're not running nameD as root. Just a moment on that. But let's say you're running nameD as root. And that guy was... And that guy was cracked. You had no... He could not really execute anything else after that. Maybe nameDex for it would be the only thing he would be allowed to run. It would catch that. With one caveat, we still have a lot of stuff that starts up at the beginning. We're still generating rules for that. And we're working on handling login because login will sometimes transition over. You log in root on console or login user. We're playing with how we would handle that guy right now. That would be one thing that would come out within the next two, three versions. The question... Sorry. The question was, what would be the load with running this with an Apache web server? Other web servers, I have run this with Roxen without any problems. Just running regular CGI's. Unless I shoot myself in the foot by making an error in my logic. Yeah. We can go with all with a set of privileges, which root will always be the superset. Easier for just development. Right now it's been root. Because that's been the parts where my headache personally came from which caused me to really want to do this. I don't like sleeping on machine room floors. I asked, why are we just limiting this to root transitions? Also transitioning just from user to user. Until you transition into that root user, you can have your other IDS utilities running out there as root with more privilege than that user, monitoring them, T2I snoop, other applications, watching logs. But once they actually acquire that root privilege and they're in the system, you can no longer trust that stuff. So the only thing that has more privilege than root is kernel. Anything? Sorry. Yes sir. . Pardon? . SU, well right now, because of root. The question is, if you're using SU, is there anything to help? I'm not quite sure if I fully understand what you're. . Unfortunately right now, the SU is a trusted binary. To keep it more secure. If SU is, if you can root SU, especially on Linux box, congratulations man, don't let anyone find out about it. . You could own the world. Literally. . But yeah, sudo, I do it for convenience. But really, SU would be the only one you really should have in there. I hope SU is secure. I hope people have been hacking on it trying to get it not to be secure enough. Yes sir, back in the back. . I'm sorry, the argument itself, not the inode. So moving around files on the file system would not affect it. . It's a little bit, and I think you were probably going towards the lids project in that question. We're really not doing ACLs at any point in time. . If could be replaced, yes. However, with the file system set up properly, it should not be easily replaced without already having the privilege which you're trying to acquire. . And then again, if they have physical access to your machine, you might as well just pack it up and go home. . . . Pardon, sir. . Copy a set UID binary. . . No, because we're actually looking at the file name as it's coming in through the exec, which is the fully qualified path name. name. Not the argvia0. The guy, we were asking if, for example, you created a user bin under your home directory and would run su under that, would that be it? Which I think you were trying to get at. If we were checking slash argvia0, you'd have relative path issues. I see it's root. Actually, I don't know. I'd have to try that back in the hotel room. That would be correct. You would not be able to give it UID root privileges. You'd have to have a collaborating administrator. Or a negligent one. Right now, pretty much within a group, just the guys have been beating on it, a few other people. I'd like to see what people could do to it. Yes, sir, right in the back. I'd like to know if the machine is going to issue a... The question was if NARC was loaded prior to this module actually being loaded onto this system, would it be able to detect the root transitions? If you tried to execute something, like let's say an LS or just a command through the system, it would catch that. Just any Trojan binary, just say anything, not even that guy. If he did not have to call exec up to that point, it would not go through the reference monitor to be stopped or permitted through. Yes, ma'am. If NARC is excluded, what happens to the SMP? Yeah, right now, well, the question is why, as a symmetrical multiprocessor box has been excluded at this point. At this point, we are not handling spin locks within the code, so race conditions probably would occur. That is something else to be going into. First, we need to get a good SMP box. Yes, ma'am. Yes, sir. Could you repeat that a little bit louder? Yes, sir. Yes, sir. Yes, sir. We're not using Let me just go into that and I'll show you Where is that? He's questioning if you modified argv of 0 to point to a legitimate file, would it be able to bypass it? And no that was one that actually came up earlier on in the testing What is it? Try s calls We're not using the file name that actually comes in through the exec statement which is really what is executed That's what we're using for it to figure what you're going to run out Yes sir It happened to be a basic issue If it is a buffer overflow That is That is This guy Is there a Sean Hedges in this room? Sean Hedges? Okay Sorry Could you repeat for me? Let's use the example of a a a a a a a a a a a a a a a a a a a the memory that's been overwritten is on the stack at that point in time You're not in the kernel memory at that point You're still actually in user space We're trying to terminate the process at that point called exit the process So we're literally just destroying the fending application because after that buffer overflow and we deny the exec it's nondeterministic what will happen So with some of that it's actually bringing it to the stack space but then it does execute or it doesn't execute? The shellcode will execute on the buffer overflow It stops it at the exec itself Okay so I'm trying to say something In that case, wouldn't it be possible to replace the normal shellcode with something that would just download this module and then run the same exploit with You call the syscalls Yes In normal production you would not have the unloading of the module We would be overriding actually replacing the syscalls for loading and unloading the module or you would have to go through an attack KMAM at that point which Yes sir So then you've got to face the right model of a shell into a that shell will keep up with that module and then you have to run the actual shell to run the actual shell not the exec calls to run the actual shell If you've got enough space in the buffer that you can write the limit shell that you can write the limit shell as opposed to the time The question is if you could actually just write a shell in the buffer That was actually not the attack that we have recently been actually looking at such as not so much writing a shell but writing what you want to occur within the attack within it through say just to give you an example one that we're trying to work on now is handling you call open open etc password in write mode write out a new line close the file probably even take up less space than what you're probably shooting at which point that's where you bring in other applications not a silver bullet things like lids where you actually be watching and protecting these files Yes sir That would be something that we would be doing actually in an external application I'm sorry Pardon I actually would have to copy you would copy the binary over Yes Yes but that's you would be wanting to you'd be using applications like lids where you would be protecting the files themselves your read file systems Yes And with it is 1046 so if there are any other questions I thank you for coming