Thank you. So, a machine being up for four minutes and already transferred four gigabytes of traffic. What could that be? Something screwed the network stack? Something strange with that machine? If you are on this machine, and it perhaps is not your own machine, you really, really should get suspicious at this point. That might be a honeypot. We show you how you find out and what to do about that. So, who of you knows what a honeypot is? Just for... Okay, so nearly everybody knows what a honeypot is, so I can do a very quick introduction. On this page, you see the typical setup of a generation two honeypot. A honeypot is, according to the definition by the HoneyNet org, a concept to monitor the tools, tactics, and motives of the placard community. So, basically, they want to see what you do once you've rooted one of their boxes, what tools you use, what commands you use, where do you connect, and what are your actions. As you can see, in the orange box, the HoneyNet typically consists of two main components. In the upper part, you see the HoneyWall. That's a transparent bridge. That means it has no upload. It doesn't decrypt the TTL over a bypassing packet. And, basically, you only do data capture and data control on this device. Data capture means that you run TCP dump on this box. So, you can log every packet, what's going inside and outside of your network. You also collect all data that your honeypots are producing on this box. On the other hand, the HoneyWall does data control. That means you install SnortInline, an intrusion prevention system on this system. SnortInline is a modification of Snort. So, basically, what it does, it filters all the outgoing traffic. It searches for exploits and can block them or it can modify them so that you, as you've owned one of these boxes, can't do any harm to an outgoing box. It's mainly used for... for legal actions so that you don't have to feel that someone who hoots one of those honeypots can do some damage to another side. The other data control that's done by the HoneyWall is something like a traffic limitation. So, for example, they do traffic shaping so that you've got only perhaps 10 kilobytes per second of output. Or they do some kind of traffic restriction. Basically, only 25 TCP connections per day, for example. So, apart from the HoneyWall, on the downside you see the honeypots. The honeypots are the main interesting part of the honeypot... of the main honeynet. A honeypot is basically a tool that should be probed, attacked, or compromised. So, you just install a normal system, for example, a Linux box, a Windows box, a Solaris, a BSD, whatever comes to mind. You do... You do not very much change things on this box. Basically, you just add some logging capabilities, and then you install normal services. You connect those honeypots through the HoneyWall to the internet, and then you just watch what happens. In order to learn the tools, tactics, and motives of the packet community, you have to do something so that you can watch their actions. For example, the TCP dump is completely useless if the intruder uses something like... SSH connection. You only see, then, the encrypted traffic, and without the appropriate key, you can't decrypt anything. So, basically, you have to do other things to watch the attackers who own your honeypots. The main tool used nowadays is ZEBAC. Oops. ZEBAC has the capabilities to monitor all activities on the honeypot. So, basically, it claims that. It can lock everything. We'll show later in this talk that this claim isn't true. With the help of ZEBAC, the operator of the honeypot is able to control everything that you do on one of those boxes. If you do an SSH connection to the honeypot, he'll see everything you type. If you do something like a secure copy, he will notice everything. If you decrypt your burnt-out protected binary, he'll notice the password and can also decrypt your burnt-eye-included binary. How does he do it? Basically, ZEBAC is a kernel module. There are variants of ZEBAC for Linux. It's the main all-out-of-account implementation only for 2.4 kernels. Then there's also an implementation for OpenBSD. For Windows, it's only a Ruby 1.0 implementation. We've got also for Solaris or some other operating systems implementations of ZEBAC. In this talk, we'll mainly cover ZEBAC for Linux because Linux is the main honeypot used nowadays. So, how does ZEBAC work? In the first version, ZEBAC was based on a DAW. A DAW is, perhaps, everyone here knows what a DAW is. It's one of the most known rootkits nowadays. In the current version, version 2.1.2, everything is re-implemented and ZEBAC is a complete new system. What it basically does is it hijacks the system call sysread. So, every time one of your programs or any program calls read, then ZEBAC does the following. It passes the data to the original system call. The result is copied into another buffer. To the buffer is added something like a ZEBAC header. Then everything is copied into an SKBuffer structure. The structure is copied or handled to the driver. And the driver sends everything to the outside. The sending is done in a covered way. Because you use the SKBuffer structure, all the PK-based firewall rules won't notice that anything is going wrong. So, if ZEBAC is running on the box, and you fire up TCP dump, none of these ZEBAC packets will e-notice one of them. It basically modifies prognet death in order to hide its presence. It fidgets with the counters. And so, you can't see that ZEBAC is sending anything to another box. The packages that are hidden are identified by a magic number. That's a 30-bit value. They are identified by being UDP-tagged. And a special port number for UDP, basically. In order to hide ZEBAC, or the presence of ZEBAC on the host, there are some things that are currently done. For example, ZEBAC loads as a kernel module. And in the basic installation, it has just got one random name consisting only of some numerical values. After once, the second module is loaded. It's Cleaner.o. That's also part of the Adore rootkit. Cleaner.o has basically only one function. It unlocks the next module in the module structure list. And then unloads itself. So, basically, after Cleaner.o is loaded, ZEBAC is unloaded from the module list. And so, something like lsmod won't see that there's any other package showing up. Whoops. So, now we are going to demonstrate our toolkit to give you a first impression on what we did. And then, after a step-by-step, we will install and we will show you how everything works. So, we have the honeypot run by an evil entity. In this case, Thorsten is running it on his notebook. We have a logging server run by an evil entity, too, which, in this case, I'm on my notebook. And we have the attacker's machine, which is run by a good hero. In this case, me, my notebook. I'm now logged in on the honeypot. And for demonstration purposes, I'll start a web server there, which is badly vulnerable. So, this web server, basically, you can upload a binary and it executes it if you use the secret post parameter exploit. This is in simple vulnerability. You could go for more difficult ones, but for the demonstration purposes, we have this very vulnerable web server. . . . Now, I work on my own machine. First, because this machine has to act as the logging server, I have the window getting the logging packets sent by the honeypot. This is this one. Thorsten will now type something on the honeypot. And, as you can see, we have basically keystroke logging here. Okay, now I'll start an attack on the honeypot by uploading a binary to the vulnerable server. This binary is built on demand and basically contains our attack tool, which was uploaded via a call to the server now. And now we are connected already to our attack server. As you might have seen, there did some logging taking place because the uploaded tool was basically a SHA archive extracting itself and executing the attack server, which is written in Python. Basically, if you're willing to code C or do something else dirty, you could get around that. I'm now connected with the server, with our attack server called Keebess, and can execute arbitrary commands, for example, listing the root directory of the honeypot. And as you see in the lower window, there's no further logging taking place. I can get information on the machine. You might notice that now I'm still running with the UID of the server. I can get information on the web server, nobody, 65534. I can read files on the server, as long as nobody can read them, for example, etcpassvd, without any logging still taking place. I can upload files. And I can execute files without any further logging. In this case, I'll execute a vulnerable suid script replaced on the server for demonstration purposes. And then again, we get a log. We get a little bit logging, because this, again, is written in Python, and we are too lazy to convert it to C. And now, wonder, we used the vulnerable suid already to execute a second Keebess server, now running as root. I'll demonstrate by connecting with a second client to the server, now running on a different port. And I, again, can execute all kinds of commands. There, without further logging. You might notice that now the effective user ID is zero, so this Keebess server is running as root. We can read files, now only readable by root, like shadow. It is a shadow without any logging. And we can send special commands, like the nosquare command, with just some logging, but basically we'll get warning messages because Keebess, because the ZBAC toolkit is completely out of his mind and gets too much data and can't log anything. And now we have the nice information of a cleanup routine, and we can jump there with a tool we uploaded before. And now we get some warnings because the GNU people are bigots, and there's no honeypot anymore. As you can see, I'm now, again, on the honeypot, and there's no logging taking place, no keys stroke logging. And if Thorsten works on the honeypot, no keystroke logging still. We have removed the ZBAC toolkit from the kernel with nearly no logging data. Okay, so much for the teaser, now for the background. Who are we and why do we do that? We are both from the Laboratory for Dependable Distributed Systems at Aachen University. We have been here for a long time. Thorsten is a research student, and I'm a research assistant. And this laboratory is running a honeynet. And we wanted to see if this is really a good thing, and if we can trust the data on there, and for the heck of it, if we can bring it down. The authors of ZBAC, just for information, this is not a picture of the author of ZBAC, which is a really nice guy, and a smart one, too. But that's ZBAC himself. This is a picture of ZBAC. At least the ancient Egyptians saw them, because it's an ancient Egyptian name, claiming that even if ZBAC is being disabled, one would be able to log how it is being disabled. And we had our issues with that assumption, and tried if we can attack it, and we were able to. Okay. Thank you. I think we did this demo already, with the vulnerable server. So now we come to detecting ZBAC. So, as you've seen in our demonstration, we are basically able to detect the presence of ZBAC on the hosts. We can avoid the complete logging, and we are also able to disable ZBAC once we are rooted on our box. So, basically, we are able to compromise the honeypot completely. We don't know how long this is going to take. So, now I'll give a step-by-step introduction to how we did it. And at first, we want to talk several ways to detect ZBAC. If you think about ZBAC, ZBAC is basically a rootkit. So, our results can also be extended to some kind of rootkit detection. If you think about this whole task, then there come several ways into mind. At first, as I've explained, there's the honey wall. And there's the honeypot. The honey wall is running in front of the complete honey net. And it does some kind of data logging and data restriction. So, basically, you could find some ways to detect the honey wall. And if you detect the honey wall, then this is a strong sign that there's also a host which is ZBAC running. Detecting the honey wall is left as an exercise for you. If you need some information on this, just look at one of the two FAQ issues. The first one is the honey net. I think four or five months ago, there are some hints. So, it's basically just a few tall scripts that you have to write. As I said before, the logging takes place by putting all data that's logged by the suite into a buffer and then sending this over the line to the logging host. So, basically, if we do much reading, then we should be able to fill up the complete line and see some latency effects. Also, ZBAC has to fiddle with the network counters because it communicates directly with the driver. You have to adjust the drivers so that the output of fconfig and any other tools is consistent with the system. So, if we take a closer look at the network traffic counters, we will also probably find some signs of ZBAC. A very obvious way is the modification of the syscall table. Basically, there are some pointers which are changed. And, perhaps, we can detect it. With the help of Cleaner.o, ZBAC also unloads itself and tries to hide itself, so we should be able to find a hidden module in memory. And perhaps we can do some other things in memory in order to detect ZBAC. I'm going to step-to-step on these five points and explain what we've done. At first, we take a look at the latency. Perhaps you all know the dd command. It's a very easy tool. And, with the help of this command, we can detect the latency. And, with the help of the dd command, we can, within perhaps 10 seconds, detect that ZBAC is running on a host, and we'll just show you this. The command is something like dd. As input file, we take dev0 and output file defnall. So basically, we copy just inside the system some from dev0 to defnall with a block size of 1. And then we should see some effects. So basically, Maximilian will now do this demonstration. So we booted the HoneyNet because we just removed the Honeypot software for demonstration. We installed the HoneyNet, and we started SSHD. We are doing that now. Okay. Okay. Okay. All right. Basically, I shut it down, SSH, for purposes. So we are on DEF CON network, and probably it's not secure. So... Yeah. Okay. Now, ZBAC is running on the host. And at first, you should ping. So at first, we just do a ping. So at first, we just do a ping. machine to this machine. We've got connected through a direct connection, just a cross cable. And as you see, we've got a latency of about 0.3 milliseconds. So now we start DD in the background and do this kind of ping again. As you see on the output, there's some latency. We can't type anything. It should take a few seconds. And a factor of 10 or something like this, we've got more than 2 milliseconds now. So we've got a latency effect. And basically within 10 seconds, we were able to detect that there's something going on. So at the next step to detect the presence of ZVEC as another approach, we take a look at the network traffic counters. As I said before, ZVEC just fiddles with ProcNet. It basically changes the output of the TX packets inside ProcNet dev. And then if we compare this output to the output of fconfig, then we should see also some differences. For the purpose of this, we wrote some kernel module. The kernel module is basically a modification of ZVEC. I just removed a lot of lines and basically changed only two lines. And now, as you can see, we have the TX bytes counter. We've got about 20.6 kilobytes. We are connected to the box via an SSH connection, so basically we have about two kilobytes or so per second on additional TX bytes output. Now we insert into the kernel this dev checker. Dev checker basically changes the output of ProcNet dev back to its original values. And if we now start something like the DDE command in the background, we see that we've basically now 70.4 megabytes. And if we now, we've got 22. So within a few seconds, we've got more than five megabytes of data. If we now unload the module, we see those latency effects again because DDE is running in the background. So if we now RLMOD the module from the kernel, then we should see that the network counter goes back again. So I think the latency now went up to infinity. And now it works. And you see the transmit counter is now 22 megabytes. And if we unload our module, it went back down to 42 kilobytes. So that's something fishy with the transmit counter, obviously. Okay. And the third approach to detect the TX bytes. To detect the presence of Zilbeck is based on the syscall table. As you already perhaps know, the syscall table is just a table with every syscall. And each syscall points to somewhere in the memory. It's something like a function pointer, nothing more. As you see on the left side, we've got sysexit, sysread, syswrite, sysopen. So syswrite is the one that's hijacked via Zilbeck. If Zilbeck loads now into memory, it's going to be the same thing. Yeah. Depicted as this mod.12345.0. It just changes the pointer from the sysread to the other module. And so we should see that the pointers from the sysread, syswrite, and sysopen are not in the neighborhood. We just wrote in a small kernel module. Before the loading of Zilbeck, the counters of sysread, the memory locations of sysread and syswrite were very close together. And after reading, you see that sys... Oh, I think that's wrong. The upper part should be syswrite. The other is sysread. That's now in another memory location. And so that there's something fishy going on. So... So, Zilbeck currently is... It's implemented as a loadable module because seemingly setting up a honeypot has to be idiot-proof and patching your kernel isn't acceptable. A kernel module, probably we can find it, even if it's hidden. And if we can find it, we can start to extract the variables inside the kernel module, and probably we might be even able to disable it. Every module in Linux starts with a module header, which is defined in includeLinuxModuleH. And this module header starts with the struct, with the size of the struct of the module header, which is 96 in current Linux implementations, with pointers to the name of the module and to the next module. So, these are two pointers into kernel space, and the one even has to point to another valid module structure, and the name pointer has to point to something like some ASCII string, and some other pointers further down, which should point into kernel space, too. Then function pointers to the startup function and the shutdown function of the module, which should point into the module space. And some integers have only a very small, reasonable space of values of usually one, two, or three. And with all these values, we can probably fingerprint memory locations which look like a module header. That's not that hard, because the module header and the whole module is allocated by the kernel's vMalloc function, and this function aligns all memory allocated via two page boundaries, so every 4K is the only position where a module header can start. This means we only have to check every 4K or every page for a module header, and vMalloc only starts allocating malloc at vMalloc start, which is a kernel constant, and only reserves memory for vMalloc-reserved bytes. So, a very simple loop, about 128 megabytes of kernel memory in 4K steps, helps us to do this. Next, we have to check out the possible locations of a module header, and we'll now shortly demonstrate that. Thorsten now says we don't. But at least I can show you. The lsmod outputs five modules. But if we start ModuleHunter, which was published in a recent FRAC article, we see another module, which is SMPCMCIA, which is our kernel module in this case. So, if we are able to find this module, we have the techniques in ModuleHunter, we should be able to extract the variables. ZBAG is very sophisticated, or at least a little bit sophisticated, in hiding its variables and its variables. Whenever ZBAG is recompiled, this Perl program, or the fragment of a Perl program, changes the location of the variables used by ZBAG in a block of allocated memory. Basically, ZBAG has a huge block zeroed out. It's about between 512 bytes and, I think, 1K. That's random, the size of this block. And the variables used by ZBAG are randomly placed in this block at every compilation. So, if we start looking into this block, we can use heuristics to decide, or to at least guess, do an educated guess, which value might be which variable. For example, this might be an IP address. But if it would be an IP address, it is in moving order. So, it's a very, very simple multicast address, which is quite unlikely that a multicast address is the address of the logging server. So, perhaps it's the magic value used by ZBAG to hide its packets. And a full code might be a magic value. Another number like this, this is a valued IP address. So, it might be the address of the ZBAG logging server. This might be a port number, the port number using for the logging server. And these short values might be parts of a MAC address, just byte-sized, which looks very much like a MAC address. So, by searching for the kernel module, and then using the heuristics, we can get quite good results in guessing if ZBAG is there, and what are the kernel variables. So, we have written a Python tool, which passes the kernel structures at one time. The most difficult part is finding the syscall table, because the Linux people have removed in their wisdom the kernel symbol for the system call table. Because nobody needs the address of the system call table. And we locate them by looking for other kernel symbols, and from there tracing the address of the system call table. Then here, the system call table is finally found. This message has a typo. It's not this white, which is probably hijacked, but this red, which is hijacked. We showed, Torsten showed you when the values are far apart, there's something probably wrong. And then our heuristics guessing that there is a module which should be ZBAG, named sound PCMCIA. And we guess. At MAC fragments, for example, probably all these ones are not MAC fragments. But I assure you that 3D, 3F, 5E, and I think 7B, some of them are fragments of the MAC address of this computer acting as a . And that computer is the Honeywell, the Senders MAC address. And this FFFFFFF is actually the MAC address we use for sending out ZBAG logging data. So while we can't get the exact variables of the ZBAG kernel module, we can reduce the space you have to try to a very small one. And we have a lot of possible port addresses. And in fact, we used 1111 as a source port address and 2222 as a destination port address. address. In most instances, we get a lot less variables, a lot less possible guesses, but you know there's a demonstration effect of Murphy's Law. If you do a demonstration, the heuristics will draw a bad day. The possible IP addresses, they're again in this list of about two dozen addresses. This is the address of our logging server, and after that is the address of the honeypot, so we already again guessed the right IP address. And the magic value we actually used is in this list of possible magic value. At least it should be there. Yeah, there. Deadbeat. Okay. Oh, messed that up. So, how to disable ZBAG? There's a very nice and easy way. The authors of ZBAG thought, oh, it should be disableable, and so they placed, being good designers of kernel modules, a nice little cleanup function in there, which does everything we would need. It de-hijacks the read pointer, cleans nicely up. It runs everything, and exits the module. And if we are able to get the address of the cleanup function, we just call that cleanup function and ZBAG cleans up after itself, and it is away. And as you might remember that we were able to locate the module header, and the module header is a pointer to the cleanup function. So, basically getting rid of ZBAG is more or less trivial. Find the module header, get the address of the cleanup function, jump in the cleanup that was a kernel jumper module we uploaded in our demonstration, which does nothing more than jump to an address in the kernel, and you are all set and done. The obvious way, if you don't think about the cleanup function, is reconstruct this read pointer and let it point again back to the original kernel function for doing so, but the tricky part is getting the address of the original kernel function. There are ways to reconstruct that from the kernel binary itself, but they are tricky. Or you could find, you can poke into the ZBAG module itself because it still has a pointer to the original read function, but why do that if you can't clean up? If you are really crazy, or if somebody decided to use ZBAG not as a kernel module, but to compile it into the kernel, you just look to the actual, this read function, which is in there, probably Torrent by ZBAG, and overwrite it at one time with a clean. Read function. That's not that trivial, because you have to get all the pointers and the jumps right, leading from your new read function, which is untainted, to the rest of the kernel, but it should be possible. So, after we've seen some ways to detect ZBAG, and now we take a look at how to avoid logging at all. So, basically, we have some problems. There are some data, that the operator of the honeypot is always logging. For example, the network traffic. We have to connect remote to the honeypot, because it's not under our physical control, so we have to use some kind of network, and all network traffic has to flow through the honey wall, so basically, the operator can catch all traffic there, so we can't do anything against this. Also, ZBAG is loaded on the box, so before we can unload it, the operator will see all calls to read. Everything we've done via read, he is able to log, and he can analyze this later. And there are some other data, that the operator can obtain. For example, if we use some of our tools, and then write them on disk, then the operator can, after he has seen that we've compromised this box, then he can do something. He can do some kind of forensic, and reconstruct all data that we left on the disk. So basically, we want to find a way that we can, as far as we want, to keep everything in memory, and not write anything to disk at all. There are some syslog data that we can't control, because the services are perhaps logging something, and the operator will also get these values, and he can analyze them. So, what can we do? What can we do against logging? For logging off the network traffic, there's an obvious way. We simply use encryption whenever possible. Because when there's encrypted network traffic, the operator can log everything, but without the appropriate key, he can't decrypt anything. So we have to encrypt everything, and the only problem with this approach is how to deliver our initial exploit. At the initial exploit, if we don't use any kind of connection, any kind of, any kind of encryption, then the operator will see this exploit, and we've got, we lost our zero day. So, perhaps we use, should use something like an HTTPS connection, or something secure, so that this connection is also encrypted, and the operator can't see anything. For this purpose, we used in our demonstration an HTTPS server, so basically, no one can see something with the help of TCP. TCP dump, or similar tools. Another possible way to disable the logging off network traffic would be if we could compromise the Honeywall. If we have got root on the Honeywall, we could erase everything, all logging data, but usually, the Honeywall is extremely secured, often with GAR security and similar patches, and it has no IP address, so it's basically a hard task to find it, and to get root on this box. So, probably, you have to find other ways. With, and then, with the help of ZBIG, the operator can see everything what we do via read. So, what programs do use read? Nearly every program that uses some kind of interaction. Most programs, you'll see, use read to, to read some kind of configuration files, or user input, so we have to avoid read at all. A nice example for avoiding read, would be network programs. Network programs use receive to read from a socket, so, basically, if we can use receive instead of read, there's some way to avoid everything. The problem is why is every program using read? And why doesn't encryption help? If you have a connection from the internet to SSH daemon, sure, the SSH daemon is reading from a socket, but the whole communication from the internet is encrypted and so is the communication over the socket it's decrypted inside the SSH daemon so even if SSH is reading from the socket that shouldn't help the operator of the honey net because he's just seeing the encrypted data the problem is that SSH can't do anything at all it starts all the time external programs, even for copying files and usually it has a bash or another shell behind that and SSH has to communicate with that shell and that is done by using a Unix pipe and this Unix pipe has two file descriptors at its end, the SSH, the end, and the bash end and the bash is reading the keystrokes via that file descriptor and these are unencrypted so basically if we could merge SSH, the end, and bash into a single program and get rid of that pipe no logging would take place so before taking a look at how we can avoid the users of reach we just take a short look at what is actually logged by ZEBEC on the right you can see ZEBEC.ha and this isn't just the structure that basically consists of the ZEBEC header there are some values that are logged for example the magic number the version number type number there is some information about the count time the PID the UID the file descriptor and then the 12 first bytes of the program that's calling read and the length of the total ZEBEC packet so the operator gets quite a few information about everything for example the PID and UID so he knows who is just calling read and what PID and UID it has so what he has to do but also it sees the file descriptor but perhaps we can fit it with the file descriptor for example we can yeah they're free standard file operators a zero one and two perhaps we can fiddle them so just use the one for one of our standards out or something like this and yeah we can just play with these and it also locks the 12 bytes of the program that's calling read perhaps we can also also fiddle with this. For example, if we rename the binary, if you just copy to another location or something like this, if you use a name that starts with, at first, 12 space characters, and then the real program name or something similar. So, if we want to avoid read, the first thought is that we should make read unreliable. As we've seen in our demonstration, in our second demonstration, I think, if we start dd in the background, then we generate lots of packets, then we've got some kind of denial of service against the Honeywall. It doesn't react to something like this. So, basically, if we just put enough data through the read system calls, we make it unreliable. As we've seen at the demonstration, there were some error messages about lost packets. These were basically error messages made by Zyvec, because Zyvec was unable to send some packets. So, we made the read by Zyvec unreliable. But, basically, we can't control which information are lost. So, basically, if we start dd in the background, we are sure that some packets are lost, but we don't know which packets are lost. So, this is an unreliable approach. A better approach is that we just quit using read. So, we can use mmap to directly map some files into memory. We just map them into memory and can then work with them as normal. So, basically, we can nearly live without read. There are some problems. For example, we can't use devices. We can't map devices into memory. We can't use Unix pipes or similar things. We are just stuck with files. But, perhaps, we can exploit this and avoid reading and avoid the read system for a while. So, it's very hard to monitor mmap because with mmap I will just map two gigabytes of contents into my memory and no one wants to transfer two gigabytes or such a small link just to log something. So, how can I live without read? The first thing I have to say goodbye to my shell. The shell is designed to read anything from its standard in, so I can't use it. I need something like mentioned before with directly talked to the network, encrypted, and executes directly your commands. The nice thing is that the command used in Unix to execute actually a program exec does not call read, at least in Linux, so it doesn't use the internal kernel read call. But if you execute a program, it might import libraries, and some of those libraries are read. Some are mapped into the memory. I wasn't able to find out the system behind that, but probably there is a system behind that. So people might guess which program you have been started by exec by seeing the libraries being imported, and if the program you are executing is reading config files by seeing the config files being read. We can mess with the process name. We just can copy and rename the binary. For example, if we rename cat to sudo and then cat something which looks like a sudoers file, probably the forensic expert looking at the log file will think we were successfully executing the sudo program. I think sudo is executed by everybody, by world on usual Linux systems. On parallel Linux systems, it's just executable by the... I'm not so much into Linux, I'm more into VBSD. So the results. We can read files unnoticed by mapping them into memory. We can possibly execute programs unnoticed by calling exec if they don't pull into any libraries we have read into memory. Since file names are not locked, there's a file descriptor locked, but not the name associated with the file descriptor. So we can give the impression, of reading certain files. If we have to create a file in TMP, which looks like a password file, and cat that, the forensic analyst will see something which looks like a password file and probably guess that it was just the password file, and it will take him some time to find out it wasn't. And we can give the impression that we are executing programs which we can't execute because they are only executable by us. They are only executable by higher-privileged users. So we implemented all of this into the KBase tool, which is proof of concept code. And the nifty thing about it, it's a network attack tool which is entirely written in a very high-level language in Python. So it's very, very portable. You don't have to compile it for an architecture or so, as long as there's a Python interpreter on the target machine at once. And if there's no Python interpreter and you are willing to move a lot of data around the network, you just can bundle the program with the Python interpreter itself and push the interpreter on the target machine like you would do with a C program where you put the C coin to the target machine. It can do everything you can expect from a shell, not Bash, but perhaps Azure, something, a basic shell, and it's very highly dynamic. It's noteworthy that the GUAC recently published, a tool which had some of the same ideas in the latest FRAC. It's, I think, it's Keeping Your Zero Days Safe Part Two or something is the name of it. And he has a tool which is able to transfer binary to a target machine and execute it there without ever writing it to disk. Basically, that's what KBase is doing too, but on a very different level because we were able to do different things with our high-level language. KBase use TCP sockets for networking, but it could use anything else because it's modular designed. For example, if you deliver, you exploit and still have an open socket or something like that, you could use that. On top of that TCP, we implement a crypto layer. The crypto layer is generating the key pair by Diffie-Hellman, and that's enough in our case. Diffie-Hellman is, would be fall to a man-in-the-middle attack. But the Honeywall up to now, or the Honeywalls we know are only passive devices and Diffie-Hellman is safe against passive devices. And later we used an AES for providing the crypto and the crypto layer also contains compression and random length padding to make it difficult for a forensic analyst seeing the network traffic to guess at the commands we were sending by the length of them. The main problem is to get entropy for Diffie-Hellman because we can't read from diff random on the honeypot. That would be locked by Zeybek and the forensic analyst would be able to reconstruct our whole Diffie-Hellman key exchange if he had that random numbers. We solved this problem today by using other techniques like ThreadRaces and hashing the whole content of TMP and Vaar. on, and that is no really high security crypto entropy, but it should be enough to frustrate a forensic analyst. On top of the crypto layer, we have a Python-specific KBase layer, which basically communicates by sending objects across the network. The KBase layer can send multiple commands at once, and the commands can work on multiple objects. So, for example, you can send wide these two dozen files, read this one file, and delete that ten files, all in one KBase command, or in one KBase data packet. And the asynchronous commands at the moment are not implemented, but the protocol supports them because asynchronous communication, implementing them, is really basically a pain in the ass. The nice thing about the KBase layer is that it's very easy to use. The nice thing is the KBase server, when you inject it on the target machine, it knows only a single command, or a single Python object you can use, at command. So if this server falls into the hands of a forensic analyst, he will learn very little. Because of Diffie-Hellman, there are no keys in the server, and there's only this very simple command, at command. And the code for all additional and interesting commands for exploiting the KBase layer is the honeypot, are pushed into the server at runtime. The client is basically having the code for the advanced commands, compiles them to Python bytecode, and pushes this bytecode object over the line into the server, but they only exist in RAM. And if you are very unlucky, they might exist on swap space, you have to keep that in mind. That is a very nice thing of developing a server, actually. Because you never have to restart the server, because on every connect, when you use the client, just all the code is pushed into the server, so basically the server is reloaded. The commands we have implemented are reading and writing using memory mapping, so without this read and this write, secure deletion, so overwriting a file, truncating it to zero bytes, renaming it, and then deleting it. Direct execution via exec. Exec listing directories, getting system info. It would be nice to implement the execution without any help of the server. That would be the user-lent exec library, but implementing it in poor Python would be very difficult. Yeah, more information on the design of CBAG and KBase can be found in an academic paper, which should be on your CD-ROM. Also on your CD-ROM should be the Nosebreak program. Which is able to find ZBAG in memory. The KBase toolkit itself, when the CD-ROM was created, it was in a shape we were very afraid to give it away, like this code you write in the early morning hours. But under this URL, you can download the KBase toolkit, and you can download videos of our demonstrations showing how we use ZBAG and KBase, and get rid of ZBAG and so on. So are there any questions? Okay. Yeah? The question was that we said that hijacking NMAP would be very difficult, but ZBAG could hijack XSEC and that stuff. Yeah, you're right. So we have to avoid using XSEC. We have to avoid using XSEC as much as possible. One solution would be to use userland XSEC, which is by the Gwag, and it's a library with executors and binary without ever using this kernel's XSEC function. That would be very hard to hijack. The problem is that this is C code, and we basically have to push then a binary object to the honeypot machine, which works as long as it's the right Linux version. Actually, the... Yeah. The current development version of ZBAG uses also the suite, the XSEC, and the receives those calls, so it monitors more of those calls, but it's not yet publicly released. It's in better status. Okay. So no more questions? So just download it and check for honeypots. Thanks everyone.