Thank you. Everybody hear me? Hello. Okay. Well, I got my user mode Linux window trying to come up on the other side here. Let me just launch into the presentation while that's happening. Hi, everyone. My name is Michael Rash. Okay. How's that? Okay. My name is Michael Rash. I am a security research engineer for Interisys Networks. I also release some open source software on my website, cypherdine.org, and that software will be the subject of this talk. And so, first, let me just say I like IP tables. I want to extend the functionality of IP tables. I want to write software. I do write software around IP tables that provides more functionality than IP tables has that should not necessarily be included within IP tables. And today, the talk is going to have two main parts. The first part will concentrate on a new tool that I have written and released today on my website at this conference. It's called... FWKnock. That stands for the Firewall Knock Operator. It is an implementation of a port knocking scheme, but it combines, at the same time, passive OS fingerprinting with a strategy borrowed from Poth. And the second part of the talk is going to concentrate on a patch that I wrote to the IP table string match extension, which allows the same content replacement... ...that is performed by the replace keyword in snort inline, except this happens exclusively within the kernel. And I'll display some netperf benchmarks at the end. So let me just say also that everything you will see here today is fundamentally made possible by IP tables. I don't want to have to appeal to a packet capture library like libpcap. The FWKnock implementation exclusively uses IP tables log messages. A lot of people think, oh, IP tables log, that's not very interesting. But you can get a lot of really interesting information from IP tables logs because most of the interesting fields in the network and the transport layer headers are logged for you and decoded for you by IP tables log messages. And you can even log application layer data if you're using something like the IP tables string match extension. So port knocking. I'm sure many of you have heard of it. I'm sure many of you are familiar with it. The term was coined by Martin Kreswinski. I apologize if you're in the audience and I butchered the pronunciation of your name. It is a method of encoding information within sequences of connections to closed or open ports. It doesn't really matter. It is commonly used to allow someone to modify the access controls that are implemented in a firewall... by using a sequence which allows only the person who knows the sequence to be able to connect through your firewall. They can be encrypted or they can be shared sequences. By shared we mean that both the client and the server will agree beforehand on exactly what the sequence is. If anyone saw David Worth's talk at Black Hat, the 20 minute turbo talk, he gave a really good concept about implementing a port knocking scheme. He gave a really good concept about implementing a port knocking scheme. It was around one time pads. That was really cool. FWNOP doesn't support this yet. I would like to mention that FWNOP... I'm very interested in accepting patches. Any comments or bug fix or suggestions that you have, please email me. Multiple protocols can be involved in port knock sequences. They don't just have to rely on TCP. FWNOP supports sequences that are sent over TCP, UDP and even ICMP can be thrown in there if you'd like. Even... though that's strictly a network layer protocol and doesn't have a notion of a port number. If you encrypt your port NOC sequences, you can get the third, you can have a third party IP address authenticated through the firewall, which is part of the encrypted sequence. And so even if someone were able to sniff the traffic between the client and the server, they would not be able to deduce for what IP the firewall will actually allow access through for. And probably the best thing about port NOCing is that it's ideally suited to be implemented around something like firewall log messages because the server side is completely passive. I never have to allow the TCP or IP stack that the firewall runs on to respond in any way to the client. And so if you have a firewall configured and the IP address is the most secure stance, which is a default drop stance, then you can implement very easily a port NOCing scheme around that as long as you're also logging packets, which is of course something firewalls do pretty well. So let's take a look at a couple of NOC sequences. First is a shared sequence. The sequence is agreed upon by the client and the server. The NOC client sends a series of five connection attempts with TCP send packets to ports 1001 through 1004. And the last port, TCP 22, will be agreed by the NOC server as the port that, oh, the client wants access for. So it opens up TCP port 22 after it sees the NOC sequence come across from the client. Not very complicated. Let me just say here, of course, NOC sequences suffer from the capability that if someone is privileged enough to be able to sniff the traffic between the client and the server, they can easily replay the same exact sequence. And you can see that the client is now able to scan the information through the IP tables that you sent across. And so port NOCing does not provide bulletproof security. It is simply another hurdle that someone needs to jump through to be able to connect to SSHD for example. I run FWNop on my home system. I can authenticate to it with an encrypted sequence from anywhere on the internet. But only the clients that know that sequence can then connect to SSHD. I want IP tables to provide the security for SSHD. . Because if I protect SSHD with IP tables, not only can they not talk to the daemon itself, they can't even talk to the TCP stack or even the IP stack. So let's take a look at another shared sequence. It's a little more complicated. This sequence involves multiple protocols. You can see TCP and UDP involved there, a couple of ICMP or echo requests, and we can introduce timing delays. They can be made significant. So the last port that's in is a connection to UDP port, I should say a packet to UDP port 5003, but the sequence will only be honored if that packet is seen at least 10 seconds after the previous ICMP echo request. If someone is able to sniff your traffic, they may see all the packets. They go across from the client to the server, but they may not also. realize that the timing delays can be made significant. So if they try to replay the sequence, if they don't introduce that time delay in there, the sequence will not be honored. Also, incidentally, if you're using an Ethernet sniffer or something, and if you're doing this as a manual process, then frequently people will restrict their view to, say, just the TCP protocol or just the UDP protocol. So they may see the TCP packets that are involved in the sequence, but they may not realize that those, they may not even see the ICMP, they may not even see the ICMP echo request, first of all, and even if they do, they may not realize that they're also significant. Remember that we're just trying to make things just a little bit more difficult to connect to SSHD, or whatever daemon you prefer. This particular sequence, note that at the end there, TCP port 22 and UDP port 5000, which is used by OpenVPN, these two ports are opened after the knock sequence is seen, but these two ports are not, they do not appear at any time within the sequence itself. So the sequence, both the server and the client must agree beforehand on which ports will actually be opened. Encrypted sequences. We can encrypt our port knock sequences by noticing that an IP address is essentially four 8-bit values. A port is a 16-bit value, which can be treated, as a concatenation of two 8-bit values, so a high-order byte and a low-order byte. Protocol numbers can be completely described by a single 8-bit value, so one is ICMP, six is TCP, and 17 is UDP. And we need to select an encryption algorithm, so why not Reindahl? It was selected for the AES standard, sounds like a good way to go. Its block size, being a symmetric block cipher, is 16 bytes. Notice that we've only used so far four bytes for the IP address, two bytes for the port number and one byte for the protocol, so we have a total of nine bytes left over. FWNOP makes use of those nine bytes, I'll cover that later. And so if you see the plain text line there, we are going to have the knock server allow access through to TCP port 5500, of course that's arbitrary, you can make that whatever you'd like, for IP address 174.4.3.2, which, notice, does not correspond to either the knock client address or the knock server address. And then, if you take a look at the ciphertext line here, notice that we have a sequence, it's 16 ports, but not all 16 ports. Most of the ports are displayed here, only the first few. Notice that the next to the last port is port 80. We probably aren't going to be logging TCP SYN packets to port 80 in your IP tables firewall. If you are, though, you probably will notice it after your disk fills up if you have a high traffic website. So what we need to do is to have a way to use select different ports, other than ports that can be easily confused with well-known ports you may be running legitimate servers on. So we will define a special range of ports which is 8 bits wide, 8 bits wide, a total of 256 possible values, and we'll define that range on the server side to be 60,000 through 60,255. And then, on the client, we will add 60,000 to each of those encrypted ports that we saw on the previous slide, and then we will connect in sequence, starting with the first, through all 16 port numbers, and the Knox server, which will be monitoring that range of ports, will, assuming that the decryption works, which means, of course, it's a symmetric block cipher, so you must have a shared key, assuming the decryption actually works, then it will allow access for IP 174432 to TCP port 5500. Okay, so that's port knocking in a nutshell. Now let's cover a little bit about POF. POF is a passive operating system fingerprinter. It offers three main methods for fingerprinting the TCP IP stack on a remote operating system. The first is with TCP SYN packets. This is the method that will be, that we will illustrate how to accomplish with IP tables log messages. It also offers SYNAC fingerprinting or reset fingerprinting, but since that requires generally a bidirectional communication between the client and the server, we won't be discussing that, because we would like to be able to completely characterize an operating system with only a single TCP packet. It uses libpcap to monitor traffic across the network. So how does it fingerprint an operating system? It looks at several fields within the transport layer header, the TCP header, actually. It looks for a TCP SYN flag being set, of course. It looks at the TCP window sizes, and then the remaining options there, maximum segment size through the timestamp, are included within the TCP options field and the TCP header. And it also looks for TTL values, fragment bits, and the overall packet length, which are headers in the network layer header. So if we take a look at a couple of POF signatures, the first is for FreeBSD 4.4. If you see a packet on your network that has the following characteristic, the way you read this is it's a series of values separated by colons. The first value represents the TCP signal, the TCP window size. All FreeBSD 4.4 systems hard code the TCP window size at 1024 bytes. The next field is for a TTL value. It's looking for a TTL value of 64. Of course, since every intermediate router between the client and the server is going to decrement the TTL value, you have to be prepared to have some sort of a threshold that allows you to extrapolate what the initial TTL value probably would have been. And to do that, you can rely on the idea that generally all packets, all routes between clients and servers on the internet generally will take about 15-20 hops. So that gives you a bound. The second signature is to identify a Linux 2.4 kernel. You see the S4 there for the first portion of the signature that refers to the TCP window size must be exactly four times, or a multiple of four, the maximum segment size. It doesn't care what Linux has set the window value to be, just as long as it satisfies that requirement, it is probably going to be coming from a Linux system. Of course, these signatures, if you've gone around in slash proc and you've messed around with kernel data structures that are exported to you via slash proc, so that you can change your TTL values, or I'm sorry, your initial TCP window size, etc., this will not work. This assumes that you have gone with the default values in the stack. Also, I believe Kathy Wing gave a presentation about using packet purgatory. That was pretty cool. And that can change things as you have packets traversing a system 2 or outbound packets. So you can spoof some of this information. What we're trying to do is just make more information that, more information significant in the actual port knock sequence. So how do we do this, how do we implement this around IP tables? Well, first we have an IP tables rule that instructs IP tables to log all TCP packets received on Ethernet interface ETH to 0. We put a logging prefix of drop so that the packets that are logged as a result of this rule are easily identifiable in our syslog. And we use the sort of less commonly used option log TCP options. Incidentally, that last rule there in parentheses, you cannot have IP tables both log and drop a packet within the same rule. And so if you actually want to have, if you want to be sure that your firewall is actually dropping stuff to and logging it, you have to have that additional rule there. And the next three slides are going to examine a single log message. The first slide will show you the log message up through the network layer. And then we'll continue on from there. So this first slide, excuse me, we can see that it's a syslog message. This packet was, we see our drop string there, which means that we see our logging prefix that we added in that previous slide. We see that this packet was logged on the in interface of ETH0. We see that the out interface is blank. That's because this packet was logged in the input chain. The packet was destined directly for the firewall as opposed to being destined for a machine that's through the firewall. If it were destined through the firewall, then you would see the output interface filled in. It would be logged in the forward chain. IP tables does a great job about decoding a lot of information. We see source and destination IP addresses. We see TTL values, IP IDs that don't fragment bit as set. And we see that the protocol that's one layer higher in the stack is TCP for this particular packet. So we also get information in the transport layer. In addition to all the fields we had before, we also see source and destination port numbers. We see the TCP window is very clearly delineated there, 5840. And we see that the SYN flag is set. All other flags are cleared. And finally, because of that log TCP options command line argument, it also logs the TCP options portion of the TCP header, but it doesn't decode it for us. It just says, oh, okay, log TCP options. I know where that is in my TCP header. Dump, here it is in your log. That string of hex data. IP tables does a great job about decoding information, but it says, well, you know what, I don't want to burden the kernel with having to decode TCP options, so I'll let some user land application do that for me, which is probably a good choice. So we have to decode this information. No problem. TCP options come in two formats. The first format, which is, you know, is a single type field of 8 bits wide. Examples of this, of such TCP options are NOP instructions, which are used to align TCP options on word boundaries. Not all TCP stacks will actually make use of the NOP instructions, so any TCP implementation has to be prepared to deal with TCP options that may not be aligned on word boundaries. The only remaining type with, you know, an 8-bit field is an end of options 00 code, which is used at the end of the TCP options. And then the most important type contains three fields, a type field, a length, and then the actual value, and you can see there that that 020405B4, which was included in that iptables packet, decodes to a maximum segment size of 1460. So if you take a look at that hex dump, you will see after decoding it that we have the following characteristics. Maximum segment size of 1460, selective acknowledgement is permitted by whatever operating system generated this packet. Timestamp is included. There's one NOP instruction, and then TCP window scale value of 0. So that log, the packet that we logged, if you look in summary, contains the following characteristics. In addition to the decoder TCP options, we see a length of 60, the don't fragment bit is set, TTL value is 64, etc. So, what does POF tell us? The operating system that generated that packet was most likely a Linux 2.4 kernel. It should be mentioned that we have not talked about the IP ID, which can be used in other fingerprinting strategies. Toby Miller wrote a paper, Passive OS Fingerprinting Details and Techniques, which makes use of IP IDs, which are highly variable. The method by which they are generated is highly variable, depending upon the operating system. I would like to be able to characterize an operating system with a single packet. And if I were to make use of the IP ID, then I would have to look at relative differences between successive IP IDs from the same operating system, which would allow me to deduce whether or not the algorithm that generated the IP IDs was random or followed a simple numeric plus, you know, numeric additive rule. But, I don't want to have to rely on multiple packets from the source. So, I didn't implement that. Also, XPRO, of course, should be mentioned. It's an active operating system fingerprinter, but some of the same information contained in its database could be used. Um... But I don't want to have to send packets back to the source, so, um... I don't use it. So, fwnop... It strictly uses iptables log messages to implement both port knocking and passive operating system fingerprinting, as we've seen. It supports shared and encrypted knock sequences. You can send sequences over TCP, UDP, and ICMP. Um... fwnop makes relative and absolute port timing significant. So, if you want to make it so that only someone who sends a knock sequence to the knock server, say, puts a five-second time delay between each connection, then that server will not honor the sequence unless it sees that time delay. The local username identification is used in encrypted sequences. Remember that nine bytes worth of information that we haven't used in the Rhineme and all block size? Um... You can install an fwnop client on a multi-user system, but have the knock sequence honored only for a specific username that's on that system. So, even though anybody can execute fwnop on the system, if they're not the specific user that you want to allow through, the knock sequence will not be honored. Um... And last but not least, you can either require that an exact match is made for the operating system that generated the knock sequence, or you can match based upon a regular expression. So, if I want to say, have any arbitrary version of FreeBSD able to connect to my SSH daemon, I can use a simple regex to match that, or Linux, or whatever you'd like. Just a couple notes about the implementation. It's implemented as a client server. fwnop runs in server mode, on a Linux system that's running iptables, where it has access to syslog messages. Of course, you can have iptables, or syslog logging to some of the syslog server, but we won't really get into that. Um... Sequences are encrypted via Reindahl. Um... fwnop in server mode reconfigures syslog to write to a named pipe in your operating system. The reason it does this is because I don't want to have to have fwnop worry about the possibility of an automated log rotation script or something run out of cron that will rotate my log file away and then I lose my file handle. Um... It doesn't take POP signatures directly from POP. It uses the etcpf.os file that's included within OpenBSD. And it's available now on my website if you'd like to download it. Okay. Um... Let's see if this will work. Is this on? No. It's on, Wait... Alright. Alright... Um... No, it's not. I should pretty much have enough I don't really know about this. Thank you. Okay, down at the bottom, there's a tail minus F on my iptables log, or for our log messages file. Sorry, you can't really see the whole thing here. I'll try to compensate. So the first thing we're going to do is we're going to send a simple shared sequence across. First, I'm going to display that sshd is not accessible from my user mode Linux installation, which is this top white window down here. The black window is my host. Operating system where FWNOP is running in server mode. So hold on just a second. Okay, you can see down at the bottom, the iptables log, it'll scroll up here. And FWNOP monitored a successful port knock sequence through iptables log and allowed, um, access to this particular source IP address, uh, for 10 seconds. Uh, if you have your iptables log, uh, iptables firewall configured such that, um, you're, you're accepting packets that are part of established sessions first, uh, then iptables can, can have the log that accepts the traffic removed, but your session won't die because I'm still logged in up here, even though I don't have access anymore to the ssh daemon. I'll demonstrate that. Hold on. Is that better? Okay, great. So I can't, I cannot reach the ssh daemon at this point anymore because it's been shut off. Okay. Now I'm going to send across a different knock sequence, uh, to the firewall. This involves, uh, TCP, UDP, and ICMP, um, but if you notice down here, this time, uh, so it's FWNOP supports multiple knock sequences per individual source. Uh, this particular knock sequence was not honored because the time delay, uh, was not met. Uh, if I add a time delay between each port, uh, the knock sequence this time, um, will be met. However, um, I also instructed for this particular sequence that I'm expecting it to come from a FreeBSD mis-system. And because this user mode Linux system does not correspond to FreeBSD, uh, the sequence was not honored. Uh, and finally, uh, we'll demonstrate an encrypted knock sequence. Uh, of course, I have to type in my... encryption key, which is just an 8-character password, um, and you can see the iptables messages scrolling by on the screen below. Uh, notice that I'm rotating between the TCP and the UDP protocols for this sequence. And then down here, we had a successful decrypt. It matched a regular expression design to detect Linux systems across my iptables logs. And it allowed me to connect to TCP port 22. So, uh, I'd like to take questions on FWNOP, and then move to the second part of the talk. Yes? That, that's a good question. Um, I, I could implement that. Um, it, it's not currently used. I'm sorry, let me repeat the question. Uh, why, he asked why not use, uh, make use of the IPIDs since I'm going to be sending multiple packets anyway. Good point. Um, I would like to just take the signatures as they come from PATH. So, I could make use of the IPIDs, but I'd have to combine the passive operating system fingerprinting, uh, say, in Toby's paper, with that of PATH to make, to come up with something useful. I'm probably not going to get more granular data with, by using the IPIDs. Then what I already get with PATH. So, it could be added. It's just, it seemed a little bit unnecessary, at least from what I, what I'm doing here. And, anyone else? Yes? . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . He's asking about, could I use the ulog target to implement this as well? Yes. It could be used. The ulog target will give you pretty much the entire packet as a data structure to a userland application. But, at least I think that's right. Is that right? I don't... Yeah. Okay, you could do that. I'm not sure if ulog returns exactly the same format as the normal log target. So, I mean, you'd have to reinterpret the actual, what's coming out of ulog. But, if you're running on a Linux distribution, I can probably... There's a much greater chance that the normal logging facility is made use of by iptables instead of ulog. Any other questions? Yes. Is there an adding appliance here so that it's not something you can play? Yeah. It... I have... What I have right now to emulate that is a knock limit. You can set a knock limit on a... To define how many times any particular knock will be honored. But, there... It'd be much... A much cooler implementation would be to implement something like David Wirth's one-time pad-based port knocking. Because, if you say you are able to... Say you set a knock limit of only one, right? Then, fwnop will... You have to be sure to either restart fwnop and then... Therefore, you can use the same sequence or redefine your sequence on both the server side and the client side to be able to gain access through again. So, I mean, that is an option if you want to deploy it. So, let me move on to the second part of the talk. Okay. Okay. The iptables string match extension... Is a kernel module that allows iptables to match sequences of bytes at the application layer. It uses the Boyer-Moore searching algorithm, which is used commonly by intrusion detection systems, because it's very fast. This constant BM max hlin is defined as 1024. What this means is that if you attempt to match a string in a packet that contains an application layer payload that's larger than 1024 bytes long, the string match extension will not attempt to actually match in such a packet. That's due to performance reasons. Although, we'll see later... ...that performance isn't really too much of a worry, maybe, depending upon your application. So, we're gonna look at a couple of Snort rules. This is Snort rules or SID-940. It's a rule designed to detect someone trying to access a specific DLL associated with front page. And we can write an iptables rule that will detect the same string that Snort is looking for Note that we're logging this in the forward chain, presumably because you're not running front page on your Linux box. We're looking for TCB packets with a destination port of 80. The TCB flags ACK and ACK refer to the TCB flags that we'll be examining and the ones that we expect to be set. So here we're just saying that we just expect to see the ACK flag set in the packet. It doesn't care that also the push flag or the urgent flag may also be set. The reason that we're adding this is because of the flow keyword in snort, which we can't exactly emulate directly with iptables rules, but we can sort of come close with making sure that the ACK flag is set in the packet. And then we look, use the string match extension to look for the string slash underscore VTI bin, et cetera. And we'll throw a log message saying, oh, I saw snort ID 940 on your network. Note that we're just logging it. We're not dropping it or rejecting it. Frequently, we're going to try to look for stuff that doesn't involve just nice ASCII data. So we need to be able to search for non-printable characters. They're specified by hexagons. If you look at snort rules, many, many of them look for hex data in network traffic. So with the hex string patch that I wrote and that was accepted by the iptables maintainers, you can take snort content fields directly out of snort rules and put them into iptables rules. And we can see one here. This is an old exploit for a name D, snort rule ID number 261. And again, we will just log the packet if it's seen over TPT. And we're not dropping it. The stream match extension is compatible with iptables targets, such as accept if you want to accept the packet. You can drop it if you'd like. Of course, if you're running, if you drop a TCP packet in midstream, that packet will be continually tried to be retransmitted because that's a requirement of TCP. You can return. If you, if you, if you, if you, if you, if you, if you, if you, if you, if you, if you, this, then, and this target applies to custom chain. So if you have a custom chain that's trying to do more advanced processing within iptables, you can use the return target to return out of that chain and continue on through the rest of your rule set in effort to not have it examine successive rules within that same custom chain. And of course, you can also reject the packet so that it never actually makes it through the target system. You can send a TCP reset or TCP session. You can send various ICMP messages in response. response to UDP traffic, if you'd like. So if you're curious about how many rules can be translated directly into iptables rules, you can run fwsnort. It makes use of the string match extension and the hex string patch, and it can translate about 70% of them. Notice that equivalent is in quotes. We can't actually do exactly what snort does within iptables rules. We cannot search for application layer content that starts at a certain depth or offset. We can't support multiple content strings within a single iptables rule, and we can't do things like take care of these. Standard IDS evasion techniques. We can only search for a sequence of bytes within a single packet. If you can fragment your attack or fragment that sequence of bytes across multiple packets, then it will defeat the string match extension. And any clever encoding technique that you'll use also will defeat the string match extension. But if you have certain well-defined things that you don't use, then you can take that don't want to see, or at least that you want to send logs for, you can make use of the stream match extension. So Snort inline is an IDS, it's a patch to Snort, which I think is going to be incorporated within Snort before too long, the IPS functionality, not sure about that, but it's designed to run on a Linux bridge, it makes use of the net filter libipq library to queue packets from kernel space into the user land application inline Snort, and after passing packets through the Snort's detection engine, if they are deemed to be okay to pass on into the target system, then libnet is used to send the packets down on the egress interface and out to the target system. Okay. Okay. So Snort inline implements a new Snort keyword called replace. It allows you to change application layer data. For example, if you don't want anyone to see the, a target system to see the string bensh, you can replace it with bensh, and of course that will not correspond to any legitimate path in the target system, and so presumably your attack is stopped. Okay. Let's examine what the packet has to go through if it's being processed by inline Snort. We start out in kernel space, the packet is, appears on the ingress interface, we're still in kernel space, the IP tables gets a chance to look at it, and it notes that it's in the forward chain, because it's going, we're running on a bridge, it's not directly accessible, it's not directly addressable. So any packet that is examined by Snort inline will be examined first by the IP tables forward chain. IP tables will then send the packet through libipq to user space, once the operating system scheduler gets around to running Snort inline in the context which is performed, the Snort inline will have a copy of the packet within user land, and it will get a chance to run the packet through the detection. If it's okay, it will construct the packet with libnet, and then do another context switch down to kernel space and put the packet on the egress interface. So we have, I'm not sure how many packets can be queued at one time, I don't think that it's required that every single packet requires two context switches, but I'm not sure what the exact number is. If you know the answer, just come see me after the talk. So but note that at the very minimum, we're going to be doing a lot of work on the kernel We're going to be doing a lot of context switches and copying of data between kernel and user land. So the StringMax extension runs in kernel space. If you look at this file, IPT string.c, the function prototype for the entry point into the search algorithm, you specify a character pointer to what you're searching for, and there's a character pointer which points back into the SK button. You can see the string is not going to return a pointer to the string that the packet's showing you. the string that the packet's showing you, which gives you a pointer to the application layer data, haystack, and note that it returns a character pointer. It does not return a simple return code saying 0 or 1 whether or not the string was actually found within the packet. It returns a pointer to the actual data. So it's easy at that point then to also modify that data with one exception. If you're modifying application layer data, you must also, if it's a text, you must also, TCP packet recalculate checksums, because TCP mandates that a checksum will be calculated and verified for every packet sent across the network. If the source of the packet happened to compute the UDP checksum, which is not required by the UDP RFC, then you also will have to recalculate it as well, but that's an optional step depending upon whether or not the client or the server, I should say the client, actually calculated the checksum first hand, beforehand. So the string match, this patch adds a new replace string keyword to the userland portion of iptables that allows you to say in our first snort rule, take the underscore VTI bin and replace it with, remove the underscore and replace the .dl extension with .dav. Okay. Thank you. And this time we will send the string, oh, instead of just seeing snort ID 940, I nullified snort ID 940 on your network for you. We can do a similar thing with hex data. It also adds a replace hex string option. And if we take a quick look, running out of time here, the packet goes through on the network. We're able to stay in kernel space the entire time. Packet appears in the ingress interface. The packet is matched in the forward chain. We run the string match function and the data replacement within kernel space and the packet goes out on the egress interface. So what does this mean in terms of benchmarks? I have to admit the description of the talk said that it was three times faster. I have to admit that's a mistake. I'm sorry. I'm sorry. It is not three times faster. It is significantly faster, but not three times faster. And we'll see that in a second. So this is on my home network. I set up a snort or IPTables machine. I'm using both. And there's a NetPerf client, a NetPerf server. NetPerf was released by some engineers at HP. Nice piece of network benchmarking code. However, there's a little bit of difficulty when you're trying to use NetPerf to test somebasis.web.com. Benchmark something like an IDS or IP tables because the way NetPerf is architected, you connect first to the NetPerf server with the NetPerf client, but the actual port that the actual data stream or test will be run over is not well-defined. It's a random port that the server decides to hand you after you've connected first. So I wrote a trivial little patch that hard codes that port to a specific one that we can specify so that we can easily say on port 50,000 or whatever, that's where the rule will be applied in both Snort and also IP tables. So looking at the benchmarks, the first three sets, IP tables forwarding with no IP tables filtering turned on. I should say it's just static. Standard IP forwarding, I get about 1.95 megabits per second. Snort inline, because of the context switching, which actually I think this is still pretty good, 1.72 megabits per second. Not bad. It's about 12% faster for IP tables or normal forwarding, I should say. If we turn on the IP tables replacement or the Snort inline replacement, it is about 10% faster for IP tables. But this does not log anything. This just accepts the packet on both sides, but it has done the data replacement inline, and it's about 10% faster. Note that the Snort inline hasn't slowed down at all with data replacement turned on because... Excuse me. Yeah. Are you speaking like this when you're listening? Let's go back. Let's go back. Oh. DC702 interrupted my speech and all. All they got was some lousy points. Thank you very much. And Exodus sucks. Okay. We've got four minutes. Okay. Thanks. Wow. Aaron. You suck. All of you. Exodus sucks. DC702. That was diverting. All right. So Snort inline. Note that Snort inline hasn't slowed down. It doesn't slow down at all from the first test, and that's because we already have to construct the packet with LIDNET in user land and send it down. So it's a very inexpensive operation to actually replace content in the packet as well because we've already got it in user land. And it's a little bit slower with the IP tables replacement turned on. This replacement is doing searching and replacing within, and that's why it's a little bit slower, but you can see 1.92 megabits a second versus 1.95. It's not that expensive of an operation. And then the third set is if you actually log stuff to what you probably want to do, we take a hit on Snort inline, and it makes it about 43% faster just to log and replace with IP tables. Applications. Applications. Well-defined experts. Exploits. SQL Slammer worm was a single 404-byte UDP packet. Yeah. Probably don't want that to allow that one into my network. And maybe if you want to preserve application layer responses, like, you know, translate URLs into 404 errors and have the web server do that for you, maybe so. And with that, like, take your questions. I think we have about one minute left. Yes. Yes. Yeah, absolutely. IPS that does things like this content replacement is highly hyped up. I think we're probably all aware of that. I cannot give you ‑‑ I can give you, I think, one maybe possible legitimate use for this. And that is that when you're executing an attack against a server, a system, you might not be aware that the attack is going to actually succeed. So if you're on the other ‑‑ if you executed an attack against a system and you have something like an inline IPS drop the entire session as a result of that attack, you might be ‑‑ it might tip you off that there's an IPS type device between the client and the server more easily than an inline IPS. If you selectively modify certain application layer data. But that's a stretch there. I totally admit that. I am not promoting IPS in any way, shape, or form. This is just enabling technology if you want to play around with this, essentially. So is it useful? Probably not. Other questions? Yes. If something triggers a snort rule, can I rewrite the IP headers? I'm sorry? Like redirect to a different destination IP. I currently cannot ‑‑ I don't have that implemented within the string match extension. I mean, that's maybe possible. You could potentially use the route target within IP tables to do something like that, but I'm not really ‑‑ I haven't done that yet. I'm being instructed I have to stop. So thank you very much. Thank you.