So, my name is Matt, and my handle is spelled S-Y-K-E, and I'm a member of NewHackCity, which is a hacker collective in San Francisco, and Jeru, which is, he's right here, he's also going to attempt to speak, hopefully with a video projector in place of some kind. What else can I say? So I worked for two years for a commercial vendor of security software, it doesn't really matter which one, and I prefer not to say because I'd hate to think that people think their products are better because of my knowledge, in any way. We have t-shirts for sale out there. And I'm going to be giving out t-shirts. NewHack has already sold out before anyone even knew who they really were. Before we just jumped the gun, I think the inspiration was AdStake selling out so fast, or Loft selling out to AdStake so fast. So here's the basic deal, is that there's four major areas I'm going to cover. And I posted an outline to, or Jeff posted my outline to the DEF CON webpage, and I've changed it a little bit since then. This ought to be a little bit more interesting to look at things a bit from a bit more holistic perspective. So I'm going to cover four areas, and those four areas are what user expectations of IDSs and firewalls are, like why do people buy these things in the first place? And then the second thing is how to test for those expectations to make sure that people are getting what they want, hypothetically. And then the third section is common coding problems that sort of come up, that sort of bubble to the surface when you actually start doing this kind of testing. And then the fourth thing is what designers and people who are writing these things, like right now, like from scratch, can do to avoid a lot of the mistakes that I have seen in the last couple of years, code-wise and design-wise. So the first thing is users. Why do people buy IDSs and firewalls? And why is that such a popular market right now? Okay. In like the last year, it's up to a couple billion dollars or something. It's like crazy that people are actually paying money for this stuff. Well, I think that the, I think the main reason is is people basically don't care. People, users really don't care if a proxy firewall or a packet filtering based firewall or a hybrid firewall is going to make them more safe, or if a network based IDS or a host based IDS is going to make them more safe. All that they care about is they have a topology and an infrastructure they don't want to change and they will put in whatever is going to fit in what they have right now. Whatever is the easiest thing to implement is what they're going to end up implementing. And that's basically what it comes down to. So this talk has nothing to do with arguing over which is better or any of this complete nonsense. So because you have to make both, because people want both or need both or have been convinced. Sometimes that they want or need both, both kinds in either the firewall or the IDS space. So yeah, people just want to deploy and not have to deal with anything. I think most people actually are aware that IDSs don't make you safe. I'm pretty confident of this. I don't, a lot of people think a lot of, I don't know, hack stores and like security consultants over, think that like general, I don't know if you call them consumers or not, think that IDSs make you more safe somehow. IDSs just give you time to react and that's all that they do. And I think that most people are aware of this. I think that most people don't think that IDSs are going to magically stop you from being attacked. So I don't think that there's a misperception there. Firewalls, this is kind of weird because real purists will say, you know, firewalls and IDSs are fluff and crap. And they're used to them to fix the real problems and like make the code in the OSs better and in the FTP daemons and whatever, but that's not really practical. So from a certain standpoint, firewalls do help you reduce and manage risk, right? If the firewalls are implemented properly in both code and topology, right? If the coding is solid, like they've done everything properly and you've deployed it properly in your infrastructure and you've configured it properly and everything. Hypothetically speaking, it will reduce like the ways people can get in, hypothetically. Although we've all seen like the hacking exposed things that Ernst and Young and those guys did, where like they don't need, all they need is port 80 and then they bounce in and do a port 139 redirect and using netcat and like all kinds of crazy shit. So but hypothetically, from a certain perspective, it does reduce risk. And so vendors have convinced me. They've convinced people, of course, that since some bullshit percent number, let's say 80% of all intrusions are come internally and your firewall isn't going to protect you from those, you need to have an IDS anyway, so you need to have your IDS to protect you from the outside problems and you need an IDS to protect you from the problems that the firewall can't block or you just can't deal with or whatever. Okay. Okay. So people expect firewalls to keep packets out and people expect IDSs to tell them when they're being attacked with whatever signatures. Oh my God, is that a video projector? Be still my heart. So this is what people are expecting. So section two, how do you test for these expectations? Okay. Okay. Okay. So the key favorite tools, basically, they are Nmap, Whiskr, and iSick. And iSick is a suite of utilities. And I think Mike Franson, who iSick is here, he's right there. This guy is the bomb shit right here. This guy's tools have helped me find so many bugs. We released, NewHack released a NetBSD advisory about two months ago or something. Well. Yes, you do have a t-shirt. I promise. Here's a t-shirt. Oh, by the way, here's what they look like. ASCII art. Let me see if I can throw it that far right. Oh, pretty close. There you go. Yeah, so Nmap, Whiskr, and iSick. Basically, here's the deal. You can't just download these tools and start using them and then use them. and think you're going to find shit, please understand what these tools are doing. Even if you can't read code, read the docs and figure it out. I don't think I'm that smart, and yet I can know how this stuff works. If you actually read the docs and understand how it works, you'll understand that when you're using iSIC or eSIC that you should disconnect yourself from public networks so that you don't DOS every box on the subnet plus, which people still do. Yes? iSIC. Oh, I'm sorry. It's IP Stack Integrity Checker, and it's actually a suite of utilities. I'm going to go through each of them individually and how they should be used, and I'll say the URLs at the end. It's really pathetic. I have all these URLs memorized. So, why is it in the app? I don't know. I don't understand the tools. OK. What the fuck is that? That's odd. OK. What do the tools do? I'm glad you asked. I think everyone knows what Nmap is. I think it's pretty ridiculous how popular Nmap is and how much everyone uses it for everything and how every time you go on an iSIC channel, someone says, you're running NetBSD, and it's like, well, that's great. Thanks for telling me something I don't know. I didn't know. So, Nmap is really good, not as a port scan or anything like that. Nmap is really cool for testing a couple of things in firewalls and IDSs. In state-based packet filtering firewalls and NAT implementations, and even IPSec tunnel implementations, Nmap is really, it's so simple. It's really elegant. Just like doing a port scan through a trusted tunnel, like a FinScan or something. And then watch the IPSec implementation and then take a shit. All these tools, by the way, are, the focus is firewalls and IDSs, but testing IPSec tunnels, if you go to your VPN bake-offs in your area or whatever, take these tools with you. WSCR, not so much, but iSIC especially, holy shit. iSIC found so many things, so many bugs in IPSec implementations, it's not even funny. So, anyway. Thank you. Nmap. Just doing a simple port scan with Nmap will usually suffice. Because I don't have my slides and my pretty pictures, I'm going to use my hands. I have an untrusted network, the big bad internet over here. I have my firewall IDS, whatever the fuck, and then I have my trusted machines that are protected by the firewall and whatever else. The interesting thing to do is to... Run an Nmap scan through all 65,535 ports. Just to really give the state table, should I explain this? So in an IDS, when you make a connection, when you send a SIM, there's a state table structure generally. I don't know if everyone's implemented this the same way, but I don't know how else you do it. There's a state table structure, then it adds your source and the destination like this. Yes? Oh my goodness. All right. Where is that at? Right here? Awesome. Oh. What? Do you actually expect me to use Star Office? Yeah. Yeah. I'm pretty sure. Whatever. Okay. I'm going to go ahead and do this. Okay. Okay. Okay. Okay. Okay. Yep. Awesome. That's for me. Okay. I'm sorry. Here's your item. Where are you? Are you in Houston? Sure. or what have you. So if you're really interested in finding problems and stuff, just be really diligent if you have the time and the resources and whatever. Oh yeah, so here's the network idea. Untrusted, you have your target machine, which is your firewall, and then you have your trusted network. And so usually my examples I say go from untrusted to trusted because that's usually what people do when they're doing penetration testing. But if you're looking for crashes or packet leakage or whatever, you can find it the other way as well. And people usually miss this. I found a couple of bugs in the software I was testing by just going the other way around, especially with NAT. If you have a NATed firewall or IP masqueraded or whatever links people call it, and you send from trusted to untrusted instead of the other way around, that gives the code that maintains the state tables for NAT a really good workout. I'll give you an example of a bug that I found that worked like that. When you sent FIN packets through NAT from trusted to untrusted, the firewall made an entry in the state table for that FIN and then never removed it, ever. So if you did a FIN scan or flooded it with FINs or what have you from random source addresses, basically you're testing to see if there's any unchecked mallocs. And if there's an unchecked, and these are the stuff that's in ring zero, you've got a blue screen or an oops or whatever Linux calls it or a kernel panic or what have you. Who's firewall is that? Huh? Who's firewall is that? Who's firewall is what? Who's firewall is that? It doesn't matter. It's been fixed. Next. Right. Okay, so NMAP. Yeah, state table code and packet filter and NAT implementations from untrusted, from an untrusted machine, NMAP, NMAP, SYNSCAN ports one through 65, 535. A really cool thing to do, by the way, that NMAP won't let you do is send stuff from port zero through a firewall. That gets interesting results sometimes. Same way with an IPSec tunnel, et cetera, et cetera. And so what you can see when you do this, if you know how to look, by the way, if anyone knows how to see non-paged kernel memory usage in Linux, could you please tell me? Yeah. Either programmatically or otherwise, because I couldn't find any information on the net at all on how to do it. But if you were able to do that, like you are on NT in about one second, what you'd see is that when you do that, you see non-paged kernel memory increase because what's happening is the state table is growing because you're doing like a lot of connections. And so, like I said, what this tests for is one unchecked malloc. Like most operating systems impose a hard limit on non-paged kernel memory. Like 16 meg or 20 meg or however much it is. I mean, it depends on how much physical RAM you have. And for you non-OS architecture people, a non-paged kernel memory is... Non-paged kernel memory is memory only accessible to the kernel that never gets paged out, ever. Because for whatever reason, the data structure that's holding it couldn't handle like a virtual memory fault or a page fault of any kind. And state tables happen to fall into this sort of category. And so, if you make the state table grow large enough, eventually it's going to hit that hard limit of non-paged kernel memory. The OS is going to say, sorry, right? And I've seen it time and time and time again, where I don't know why, but people don't check the return values of syscalls. Not just malloc, although malloc is like the most common, or all the other malloc calls as well. There's been a couple of vulnerabilities now, like people weren't checking the return of setGID. Like if that failed and like defaulted to zero or something, I think it was in Wii or something. It's the EchoPix show. So, that's basically what you're testing. And if you're looking for stuff like that, like you're like looking for DOSs where they run out of memory and then they fuck up because they didn't check a malloc somewhere. Both in Linux and in NT, and probably VBSD as well, you can limit the amount of physical memory the OS will use. That will help you greatly in finding these bugs faster. Because if you're doing this on a 128 meg machine, you really have to beat the living fuck out of it in order to like get it to crash or do whatever you're trying to get it to do. And so if you just kind of lower it just a little bit, you'll hit these conditions a lot easier. Wait, I don't want to go whisker. What the fuck? Go back there. There we go. Different scan types, like I said, fin packet and a certain implementation of a stateful packet filter firewall. Didn't remove fins if you just sent a fin. It was really odd. I don't know how the thing ever worked. You know, it probably did never work for me. Axe scans, et cetera, et cetera. So tiny IP frags. This used to be an interesting way to leak packets through firewalls and to make firewalls crash because for a stateful packet filter-based firewall, God damn it, it's hard. Wow! For a stateful packet filter to do its job properly, if I've blocked port AD. I'm assuming, I'm going to assume surmonology TCP If I block port 80 and the TCP header is split up across multiple IP packets, right? So, when I get my first IP packet on the firewall and I'm analyzing it and I'm looking at it and I say, okay, is this allowed on the ports that I'm allowing to pass through me? Well, I can't sue the port because the port information in the TCP header is in the next IP fragment. You can do one of two things if you're an implementer. You can either reassemble it to get the full TCP header, in which case you're opening yourself to DOSes with memory usage with people sending a whole lot of frags and you're holding them, waiting for the next fragment to come so you can get the full header. Or you can just drop them. I'd recommend dropping them because the likelihood that an MTU is that small, that a TCP header would be split across IP packets, is very, very, very, very, very unlikely. In fact, if anyone can tell me a configuration in which that would really happen, I'd really like to hear it. So if you're an implementer, drop tiny IP frags. Don't even fuck with them. It's not even worth any trouble because it doesn't happen in real life. If someone sends you tiny IP frags, they're fucking with you, period. So the new thing tiny IP frags does now is that state-based IDSs, they keep track of connections and whatever else. If you're IDS, it's like a logic tree. They're not just doing flat packet grepping. And they actually check to see that, okay, there's a SYN. There's an ACK. And then I look for my getPHF. IDSs that do stuff like that are actually, this sort of stuff kind of works because for IDSs that don't do IP fragmentation reassembly, it has the same problem that, the state-based packet filtering firewalls do in that they can't get the full state with the first packet. So it's like, what do I do? I can't do reassembly either. So I guess I'm just not going to pay attention to this stream unless it matches like my packet grepping. And because you're fragmenting that small anyway, it doesn't really matter. And you can do tiny IP frags with another tool that I almost mentioned called FragRouter. And FragRouter is a fine tool. I think it was written by Doug Song. Maybe he's here. I don't know. I don't know. I don't know. And that can send tiny IP frags with just regular traffic. It works just like it sounds. It's a router that fragments packets to whatever interesting configuration you want. So, SYNSCAN put one, like all the ports basically, doing a full port sweep, like expands and contracts state tables if they're implemented properly. So, this is pretty evil because, this next example here, Nmap, SYNSCAN, all the ports, DECOYSCAN. I love DECOYSCAN. Let me tell you why I love DECOYSCAN. And with DECOYSCAN, you can fill up state tables faster than anything. And I really like using really fucked up addresses for the DECOYSCAN, which if you're one or two hops away, you could probably get away with, but it might not be practical. So, can I go back one? So, let's see here. This network here is 192.168.2, and the one I'm sending from is 10.0.0. Can you go back again? The forward one? Huh? Oh, thanks. Does it work? No? This thing here? Yeah. So, I'm using the loopback address of the destination network, the broadcast address of the destination network, and then the loopback and the broadcast of my network, and then just crazy shit like, you know, 255.255.255, and 0.0.0.0. I found interesting packet leakage problems doing stuff like this. Whether or not these packs can be routed through the actual internet is a whole other question, but, I mean, if someone owns your ISP and you're one hop away, it's a completely feasible scenario. Yeah. So, DECOYSCANs are actually pretty neat, and actually, I don't think that they're really useful for evading IES detection at all. Because that's what the original purpose was, was that you do so many parallel scans that the IDS logs flood, and they can't tell what's going on because they see so many source addresses for the port scans, and they can't tell which one's the real one. And so, NMAP can be gotten from http://insecure.org slash NMAP I-N-S-E-C-U-R-E dot org slash NMAP. I think everyone knows that. Whoever doesn't know that shouldn't be here. Next. Please. Next, please. Thank you. Whisker. Whisker is really cool. It's written in Perl, so you can just run it on Win32 or Linux or BSD or whatever the fuck runs Perl. Probably your Palm Pilot can run Whisker if it runs Perl. Yes, sir? I'm sorry. All right. That would be nice. Do what? Turn up the volume? Like this? All right. So, I think everyone knows what Whisker is. Whisker is basically made to it's an HTTP scanner, but Rainforest Puppy, bless his heart, had a whole bunch of IDS evasion functionality, which is really cool. If you see him, give him a big hug and a smooch because he really deserves it. Because, you know, this gets passed. These things, I think, I have not seen a firewall, or I haven't seen an IDS, that one of those evasion techniques does not get passed. If you can show me one, I'll blow you or something. So, Whisker basically, what? Oh, thank you. Let me take a look real quick. So, Whisker works like this. You have Perl installed. Oh, you have Perl installed. I'm sorry. You have Perl installed. It's just Whisker, dash H, your target host, and then dash I goes through all of the various IDS evasion techniques. Dash I1 is your own coding, which is a very popular one to do. Which, what's his face? Robert Graham from Network Eyes. Blasted Network Associates' cyber cop monitor for not doing when it really does. So, I think everyone knows like, Whisker is good for doing this stuff, but here's the interesting point that I don't think anybody's thought of is HTTP proxies are blocked by URL. Like, they block, you know, like anything where fuck is in the URL or something. How much do you want to bet that they're all susceptible to URL encoding? I bet you that they all are. So, a lot of people think proxies are just deployed so that users on the inside can browse and work through this proxy. Actually, sometimes it works the other way around. Well, they'll have a proxy so that people coming in from the outside like, are limited access to certain URLs unless they belong to a certain IP range or something like that, or they authenticate first. This gets past that. Something else to test for in HTTP proxies. I'm not gonna talk too much about this because Whisker has great docs. Everyone knows what the hell it is and knows what it does and knows what its capabilities are. So, the URL is http://www.wiredtrip.net/.rfp. You can go in there and choose your theme and then find the Whisker docs. That's www.wiredtrip.net/.rfp for Rainforest Puppy. ISIC, okay, I'm sorry. I can't get over it. These are my favorite things to test. These are my favorite tools ever for testing this kind of stuff. It's not necessarily a new idea. It's just something that finally did it. ISIC is a suite of utilities. There's ISIC, which is IP Stack Integrity Checker. TCP-SIC is TCP Stack Integrity Checker. UDP is UDP and ICMP is ICP. And ESIC is Ethernet, which is actually really cool. We've found some interesting problems with that that we'll probably release. Sometime in the next millennia, hopefully. Great for testing protocol implementations on all of these, all of these. Like I said, we found the NetBSD bug, the remote crash with an ICMP packet using, I'm sorry, it wasn't an ICMP packet. It was unaligned IP options causing unaligned memory access using, ah, it stopped working. There it goes. Using ICMP-SIC and the steps we have to reproduce from the advisory. ICP-SIC, or I'm sorry. ISIC. All the utilities are used. Libnet by route, which is also a great library. Beautiful code to read if you're into that kind of thing. State-based IDS and packet filters. Wow. Basically what these, I'm sorry, what these tools do is, they send sort of controlled random packets. It's kind of interesting. So basically you see with a random seed, remembering all your basic stuff, We would use RAND and you have to seed it with like 32K to negative 32K. Works kind of like that. And so basically if you enter the same random seed, you'll get the same random results. And it, you know, does IP options, it changes all the IP options, it changes the length, changes the header length, lies about the header length, all kinds of crazy shit. Basically it throws a lot, it just pukes all over the protocol stack. And sees if the protocol stack can take it. Because state-based IDS and packet folders are sort of kind of implementations of TCP IP to an extent. God, it's hot. Our implementation of TCP IP to an extent, this sort of vomiting works as well. And it's just like Nmap with the state-based IDS where from a certain IP I go, a state-based IDS, I go sin and then wait a minute, I don't get a knack, I get a fin immediately and oh God, I'm screwed and I puke. Same way with state-based firewalls, small IP packets, tiny, not necessarily tiny IP facts, certain fragment offsets. That's what else this is good at finding is some things are sensitive to just certain fragment offsets. And if you run these tools for long enough, eventually you'll hit all of them. So, IPsec tunnels, same thing. In fact, I would, if someone would take these to, Hugh Daniel and I talked about this a couple months ago. I don't know if he's done it yet, but he used to take HPing, some utility called HPing, to VPN bake-offs and try and get other people's IPsec implementations to crash at the bake-offs. And I pointed it at Isaac, and I don't know if he's actually used it yet. I really hope he does, because I'm sure that it'll just make a whole lot of people's IPsec implementations just, just puke. And NAT as well, NAT once again. Testing from both, routing from both, the trusted network to untrusted, and untrusted to trusted, and everything in between. Also firing directly at the untrusted interface of the firewall, and at the trusted interface of the firewall as well can yield some different results. And also before, like I said, try all kinds of different configurations, one with a denial, one with an allow, two denials, two allows, and absorb, whatever. So here's the example, TCPsec-S, which is the, specifies the source IP. RAND, if you specify RAND, it will pick a random IP for every single packet it sends out. It's pretty cool. Sometimes though, you don't want to do that because the firewall will just drop things that, like if you're testing, if you're testing from the trusted network to an untrusted network, for instance, I'll do questions at the end. If, if you're testing from the trusted network to an untrusted network, and you aren't sending from the subnet of the untrusted network, the firewall will be smart enough to just drop your packet and you won't go all the way through the code paths that you need to to test them properly. Dash SRAND is a good way to do things. When you use dash SRAND, unplug yourself from the public internet. When you send packets at a host, it's going to reply back to the source address, and if you hit some dot mil by accident or something and people come knocking on your door, that's why. Especially when you're using ESIC, because ESIC by default sends to the broadcast ethernet address. It kills networks. If you can hide a laptop server in an ESIC that's broadcasting, that's sending ethernet frames to the broadcast address, you will kill a network. That's not a legitimate testing rule. That's just an aside. And then dash D is the destination. Trusted, so if we're going from untrusted, and set, be sure to set your random seed. If you don't set it, it uses the process ID of what it's running as right now, and so when you don't use dash R, like your PID is incremental or random and open BSD or whatever, you won't get consistent results. I've seen this mistake happen with people who didn't understand the tool, basically. They just, you know, they did dash SRAND, dash D, trusted, and then they just went to town. And then, like, they got something to crash. And then they couldn't ever get it to crash again. And they're like, well, what was your random seed? I don't know. Well. Oh, well. So I usually use 31337 or 666. Something that's really dumb and easy to remember. If you can't get, like, anything to happen in, like, the first 5 million packets or so, try changing the random seed to something else. Dash M700 limits, it's like the maximum maximum amount of packets you can pump out. On the network. Kilobytes per second-wise. Now, like the next point says, Linux sends packets fucking fast. Like, 4 meg per second, really fast. But, as we mentioned in our NetBSD advisory, Linux mangles packets and doesn't tell you. And so, when we were doing some last-minute like tests, we would make sure this was completely reproducible, or if we were releasing the we couldn't reproduce it on Linux. And we were like, what the fuck is going on? And so, when we tested it from BSD, it worked. Problem with BSD is that, because, for whatever architectural reason, it's a lot slower at sending packets. It has these things called NMB clusters that fill up very fast, for whatever reason. So, you can't send them as fast. If you send them as fast, it will drop packets. So, instead of sending mangled packets, you still send the packets at all. And this can be a problem. So, Dash M700, when we were sending from some ARM32 boxes running NetBSD, and also from OpenBSD on like, some Pentium 2s or something, that seemed to be about right. And I don't think it has anything to do with how fast the machine is. I think it has to do with the drivers and how they're written. And if you run into that, if your machine's slow, or whatever, you can increase NMB clusters. Don't ask me how. I don't know anything about Unix. So, the URL for ISIC, the suite of utilities, is http://expert.cc.purdue.edu slash tilde F-R-A-N-T-Z-E-N. That man's last name right there. So, E-X-P-U-R-T dot C-C dot P-U-R-D-U-E dot E-D-U slash tilde F-R-A-N-T-Z-E-N. So, that's slide eight. Next, please. I was gonna have a code example, by the way, but it got lost in the ether, so I can't do that. Let me do it. Okay, so, this is only loosely related, but as far as like, the point of this is like, this kind of testing brings about certain problems, certain problems with memory allocation, not checking syscalls, not checking the return values of syscalls, various other problems. So, just some suggestions. For dev managers, for whatever else, for the love of Christ, don't just start coding if you're gonna do something serious. All right, if you're gonna write like a 200 line program, fine, like, get stoned drunk and like, code until your fingers bleed. But if you're gonna do something serious, define your interfaces first, plan first, try and maintain consistency in the interfaces. God, it drives me crazy. I really, really hate, I hate it. It's like this, not just a code, that's just a total rat's nest. There's no consistency at all. So, this is always a good idea. And if you're in a professional environment, modeling tools, like you What else? These national rouse, whatever, can maybe help you into that kind of thing. Writing well, writing clean, well-documented code, I mean like, well-formatted, like, you can read it, good comments, stuff like that. Will save you time. I feel so bad so often. and aneurysms later. A lot of people think it's a waste of time. A lot of men are saying, no, we don't have time to clean it up, whatever. It will always bite you in the ass. Every single time. When you think the code is going to be used for three months and you're going to rewrite it, it's going to last three years. Every single time. Have never seen it not happen. And, alright, this is a real pet peeve. Alright, anybody try to compile Nmap like 2.08, or like Nmap anything pre-2.5, and there's a zillion warnings complaining about all kinds of crazy shit, and most of it ended up being bugs. Linux, GNU, not so much BSD, like GNU programs just all the time, were like, the compiler gives you warnings for a reason. Okay? It's not telling you just for like, you know, to fill up your screen with crap. Please fix warnings if you see them. It's like the most simple thing that's overlooked every single time. The other thing is source and runtime analysis tools. If you have loads and loads of cash to spend on Purify, and, like, Intra++, and Flexcellent, and stuff like that. If anyone wants to talk to me further about this stuff, I can talk about it at great length, but it's nothing to do with... Who was supposed to be here? No, go back. I'm going to embellish and name this for a minute. Who was supposed to be here, and I was going to, like, ask the crowd for, like, for, like, to tell me what was wrong with it, and so I'll put it up on the NewHack page, or off my page off of NewHack, and along with these slides, and hopefully recording the talk, and you all can send me an email saying, like, what you see, and be like, where's Waldo of Loom coding. So what I was going to do was, for every guess and got right of what was wrong, I was going to hand out a shirt. So I'm going to hand out a shirt during the Q&A instead for people who have really good questions. Next. For designers, designers and coders, if you're implementing on NT, and you're interested in application level stuff, use TDI. Transport something interface. I can't remember what it is. Transport data? Transport driver interface. Thank you. You get stuff pre-IP assembled, so you don't have to duplicate work of the IP stack and further slow your IDS down. However, this only works on host-based IDSs, which could be argued with the IDSs that really work. And it works on Windows 95, 98, whatever, NT and Win2K, so if you write code it's going to be portable for the most part. Another thing you can use, I didn't mention here on the slide, is IP helper functionality is kind of interesting, instead of like maintaining your own state table. Just use the OSs. In Windows 98 and NT4.0 starting with Service Pack 4, which is IP helper functions, you can actually get the connection table. You can see who's connected and not have to deal with maintaining your own state and duplicating your work. And if you do this, yours can be faster, and yours is not duplicating work, so because you're not duplicating code, you're not going to implement mistakes all over again, etc. And in Linux 2.4, you can use net filter interfaces, like the Linux kernel actually has proper interfaces for something. If you can fathom such a thing. You can use the net filter interfaces to write yourself at whatever point in the stack you want to get data. Much like TDI slash and this on Windows. And this is what I would highly recommend. I wouldn't bother re-implementing IP flag reassembly, TCP servers reassembly. It's just dumb, ok? Seriously. Seriously, ok? Because when you re-implement the that says the other thing. Don't re-implement things, okay? Don't rewrite the libc calls. It's stupid, all right? When you write code, you're going to make mistakes. When you rewrite code that's existed for 10 to 15 plus years, right? It's been around for that long. People have probably found a lot of the bugs, right? People aren't going to find the bugs that are in your shitty code. Don't rewrite libc calls. If someone can argue with me later and prove me wrong, on this, great. I'd really like to be proven wrong. Right now, it just annoys the shit out of me that things take three times as long just because someone has to rewrite smprintf. Oh, and also, when you're doing NAT and IPSec stuff, use the free stuff. There's no reason not to. Try and find someone else who has a NAT implementation like Cisco. Everyone in the world used Cisco's first reference implementation of IPSec. And, it's a camp. And that's why they're all vulnerable to UDP garbage appendage bugs. But, if it's a mature code and you're reusing it, that's a good thing. You aren't wasting time. It's a really good thing. I can't stress this enough. If you have to argue with your manager about it, tell them, tell them to send me mail. I'll gladly argue. This is something I love arguing about. So, there's a NewHackCD webpage, www.newhackcd.net. There is not a whole heck of a lot there right now. But, I'm sure there will be in the future. We'll be able to buy various memorabilia, thongs, etc. And, that's my email address, syke at newhackcd.net. N-e-w-h-a-c-k-s-c-y-t-y dot net. And, that's it. So, Q and A. If you're running Isaac, and it sends like five million packets at your IDS, and one of them crashes it, how do you narrow down which one did it? Excellent question. Excellent question. It wasn't in Overlook, and I forgot to add in. Isaac has two options. Dash P, which says to send this many packets, and Dash K, which says skip this many packets. Mike should really be doing a talk on Isaac at this con. And, so what you do is, don't let it run overnight. Try and pay attention, like look every 500,000 packets or something, and see if it crashes. Jeru actually wrote a patch that pinged after every so many packets. And, I think, maybe it was Mike who told me someone wrote a shell script or something that would send X number of packets, ping the host, and then incrementally go. Okay. He says there's one included in the tarball. So, if you get the, if you go to the web page, export.cc.purdue.edu slash tilde F-R-A-N-T-Z-E-N, it's in the tarball. But, to answer your question so that you understand what's going on. So, what you do is like, you know it crashed sometime between packets two and a half million and three million, sake of argument. So, what you do is you do Isaac dash S whatever, dash D whatever, dash R whatever, and then you do dash P for sending, and you say dash P send three million packets and you say dash K skip the first 2.5 million. When it skips packets it takes a really long time because it has to go through the, with the random things so you get the same results if you use the same random seed. And then from there you just do binary search. If it crashes again you say fucking A is reproducible. Otherwise, you know, you expand your search a bit. And so, once you have the range, you know the range, just start doing the binary search. And you say okay, so it's between 2.5 million and three million, right? If that doesn't do it then you know it's the other half and then you just like narrow it down, narrow it down, narrow it down. And it took me an hour and a half to two hours to do that with a NetBeast DX Blight. Except I was lucky there where it didn't happen at three million packets. It happened at like 30,000 something. So, that's how you do that. That's an excellent question. You get a T-shirt. Anybody else? Mr. Balkan, would you like to come up here? How many intrusion detection systems did you test? How many? He said how many intrusion detection systems did you test? With Whisker? With all these tools? With all these tools? With all these tools? What are you testing? Five? Five professionally or in my spare time? Huh? Huh? Together? Seven. Huh? I really don't want to... I would rather not advocate anything. I don't work for a vendor anymore, by the way. As I'm sure you all will find out, you get burnt out on this crap after a while and you just don't want to deal with it anymore. You should... That's why I'm doing this is so people can test this stuff themselves so admins can go. If a vendor says, it detects everything under this thing, they're the planet, you know? And then you can just... You can test for yourself and if you really feel like it, you can post a bug track and get your 255 TTLs of fame. So that's part of the reason for this talk I wanted to do this is so people... To enable people to do this themselves. Yes? . Yes. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Thank you. Thank you. Thank you. Thank you. Thank you. Thank you. Thank you. Thank you. Thank you. Thank you. Thank you. Thank you. Thank you. Thank you. Thank you. Thank you. Thank you. Thank you. Thank you. Thank you. Thank you. Thank you.