1 00:00:14,260 --> 00:00:20,880 So, my name is Matt, and my handle is spelled S-Y-K-E, and I'm a member of NewHackCity, 2 00:00:20,980 --> 00:00:28,460 which is a hacker collective in San Francisco, and Jeru, which is, he's right here, he's 3 00:00:28,460 --> 00:00:33,940 also going to attempt to speak, hopefully with a video projector in place of some kind. 4 00:00:36,720 --> 00:00:37,820 What else can I say? 5 00:00:38,600 --> 00:00:46,960 So I worked for two years for a commercial vendor of security software, it doesn't really 6 00:00:46,960 --> 00:00:50,420 matter which one, and I prefer not to say because I'd hate to think that people think 7 00:00:50,420 --> 00:00:53,860 their products are better because of my knowledge, in any way. 8 00:00:56,200 --> 00:00:58,440 We have t-shirts for sale out there. 9 00:00:58,440 --> 00:01:00,620 And I'm going to be giving out t-shirts. 10 00:01:01,580 --> 00:01:05,300 NewHack has already sold out before anyone even knew who they really were. 11 00:01:06,020 --> 00:01:10,680 Before we just jumped the gun, I think the inspiration was AdStake selling out so fast, 12 00:01:10,860 --> 00:01:12,680 or Loft selling out to AdStake so fast. 13 00:01:14,320 --> 00:01:20,120 So here's the basic deal, is that there's four major areas I'm going to cover. 14 00:01:20,560 --> 00:01:26,100 And I posted an outline to, or Jeff posted my outline to the DEF CON webpage, and I've 15 00:01:26,100 --> 00:01:27,020 changed it a little bit since then. 16 00:01:28,440 --> 00:01:31,440 This ought to be a little bit more interesting to look at things a bit from a bit more holistic 17 00:01:31,440 --> 00:01:31,920 perspective. 18 00:01:32,320 --> 00:01:37,160 So I'm going to cover four areas, and those four areas are what user expectations of 19 00:01:37,160 --> 00:01:40,500 IDSs and firewalls are, like why do people buy these things in the first place? 20 00:01:40,940 --> 00:01:45,520 And then the second thing is how to test for those expectations to make sure that people 21 00:01:45,520 --> 00:01:47,280 are getting what they want, hypothetically. 22 00:01:47,760 --> 00:01:54,320 And then the third section is common coding problems that sort of come up, that sort 23 00:01:54,320 --> 00:01:57,440 of bubble to the surface when you actually start doing this kind of testing. 24 00:01:57,440 --> 00:02:03,580 And then the fourth thing is what designers and people who are writing these things, 25 00:02:03,660 --> 00:02:10,460 like right now, like from scratch, can do to avoid a lot of the mistakes that I have 26 00:02:10,460 --> 00:02:15,040 seen in the last couple of years, code-wise and design-wise. 27 00:02:15,360 --> 00:02:16,820 So the first thing is users. 28 00:02:18,500 --> 00:02:22,440 Why do people buy IDSs and firewalls? 29 00:02:22,500 --> 00:02:24,940 And why is that such a popular market right now? 30 00:02:25,360 --> 00:02:25,840 Okay. 31 00:02:26,680 --> 00:02:31,040 In like the last year, it's up to a couple billion dollars or something. 32 00:02:31,420 --> 00:02:34,840 It's like crazy that people are actually paying money for this stuff. 33 00:02:39,160 --> 00:02:45,420 Well, I think that the, I think the main reason is is people basically don't care. 34 00:02:45,640 --> 00:02:50,220 People, users really don't care if a proxy firewall or a packet filtering based firewall 35 00:02:50,220 --> 00:02:55,460 or a hybrid firewall is going to make them more safe, or if a network based IDS or a 36 00:02:55,460 --> 00:02:57,520 host based IDS is going to make them more safe. 37 00:02:57,940 --> 00:03:02,540 All that they care about is they have a topology and an infrastructure they don't want to change 38 00:03:02,540 --> 00:03:07,220 and they will put in whatever is going to fit in what they have right now. 39 00:03:07,480 --> 00:03:10,560 Whatever is the easiest thing to implement is what they're going to end up implementing. 40 00:03:10,980 --> 00:03:12,640 And that's basically what it comes down to. 41 00:03:12,900 --> 00:03:17,540 So this talk has nothing to do with arguing over which is better or any of this complete 42 00:03:17,940 --> 00:03:18,160 nonsense. 43 00:03:20,080 --> 00:03:24,880 So because you have to make both, because people want both or need both or have been 44 00:03:24,880 --> 00:03:25,320 convinced. 45 00:03:25,460 --> 00:03:30,980 Sometimes that they want or need both, both kinds in either the firewall or the IDS space. 46 00:03:36,440 --> 00:03:40,500 So yeah, people just want to deploy and not have to deal with anything. 47 00:03:41,520 --> 00:03:45,660 I think most people actually are aware that IDSs don't make you safe. 48 00:03:46,120 --> 00:03:47,740 I'm pretty confident of this. 49 00:03:48,500 --> 00:03:54,700 I don't, a lot of people think a lot of, I don't know, hack stores and like security 50 00:03:54,700 --> 00:03:59,280 consultants over, think that like general, I don't know if you call them consumers or 51 00:03:59,280 --> 00:04:01,500 not, think that IDSs make you more safe somehow. 52 00:04:02,220 --> 00:04:05,740 IDSs just give you time to react and that's all that they do. 53 00:04:05,980 --> 00:04:07,420 And I think that most people are aware of this. 54 00:04:07,520 --> 00:04:10,320 I think that most people don't think that IDSs are going to magically stop you from 55 00:04:10,320 --> 00:04:10,720 being attacked. 56 00:04:12,180 --> 00:04:14,160 So I don't think that there's a misperception there. 57 00:04:18,400 --> 00:04:23,360 Firewalls, this is kind of weird because real purists will say, you know, firewalls and IDSs 58 00:04:23,360 --> 00:04:24,260 are fluff and crap. 59 00:04:24,700 --> 00:04:27,900 And they're used to them to fix the real problems and like make the code in the OSs 60 00:04:27,900 --> 00:04:31,760 better and in the FTP daemons and whatever, but that's not really practical. 61 00:04:32,060 --> 00:04:40,460 So from a certain standpoint, firewalls do help you reduce and manage risk, right? 62 00:04:40,720 --> 00:04:45,620 If the firewalls are implemented properly in both code and topology, right? 63 00:04:45,740 --> 00:04:50,380 If the coding is solid, like they've done everything properly and you've deployed it 64 00:04:50,380 --> 00:04:54,400 properly in your infrastructure and you've configured it properly and everything. 65 00:04:55,380 --> 00:05:03,500 Hypothetically speaking, it will reduce like the ways people can get in, hypothetically. 66 00:05:03,720 --> 00:05:08,120 Although we've all seen like the hacking exposed things that Ernst and Young and those 67 00:05:08,120 --> 00:05:12,500 guys did, where like they don't need, all they need is port 80 and then they bounce 68 00:05:12,500 --> 00:05:17,480 in and do a port 139 redirect and using netcat and like all kinds of crazy shit. 69 00:05:17,920 --> 00:05:22,440 So but hypothetically, from a certain perspective, it does reduce risk. 70 00:05:22,580 --> 00:05:24,680 And so vendors have convinced me. 71 00:05:24,700 --> 00:05:28,420 They've convinced people, of course, that since some bullshit percent number, let's 72 00:05:28,420 --> 00:05:33,860 say 80% of all intrusions are come internally and your firewall isn't going to protect you 73 00:05:33,860 --> 00:05:37,620 from those, you need to have an IDS anyway, so you need to have your IDS to protect you 74 00:05:37,620 --> 00:05:46,460 from the outside problems and you need an IDS to protect you from the problems that 75 00:05:46,460 --> 00:05:49,000 the firewall can't block or you just can't deal with or whatever. 76 00:05:53,720 --> 00:05:54,160 Okay. 77 00:05:54,220 --> 00:05:54,620 Okay. 78 00:05:54,700 --> 00:06:02,000 So people expect firewalls to keep packets out and people expect IDSs to tell them when 79 00:06:02,000 --> 00:06:04,020 they're being attacked with whatever signatures. 80 00:06:06,500 --> 00:06:08,140 Oh my God, is that a video projector? 81 00:06:10,100 --> 00:06:11,200 Be still my heart. 82 00:06:14,860 --> 00:06:16,720 So this is what people are expecting. 83 00:06:16,960 --> 00:06:20,780 So section two, how do you test for these expectations? 84 00:06:21,200 --> 00:06:21,500 Okay. 85 00:06:22,180 --> 00:06:22,700 Okay. 86 00:06:23,400 --> 00:06:23,920 Okay. 87 00:06:24,700 --> 00:06:31,100 So the key favorite tools, basically, they are Nmap, Whiskr, and iSick. 88 00:06:31,300 --> 00:06:32,860 And iSick is a suite of utilities. 89 00:06:33,120 --> 00:06:35,680 And I think Mike Franson, who iSick is here, he's right there. 90 00:06:36,300 --> 00:06:38,520 This guy is the bomb shit right here. 91 00:06:38,940 --> 00:06:42,620 This guy's tools have helped me find so many bugs. 92 00:06:43,240 --> 00:06:48,420 We released, NewHack released a NetBSD advisory about two months ago or something. 93 00:06:49,120 --> 00:06:49,640 Well. 94 00:06:50,200 --> 00:06:51,660 Yes, you do have a t-shirt. 95 00:06:51,880 --> 00:06:53,000 I promise. 96 00:06:55,760 --> 00:06:56,560 Here's a t-shirt. 97 00:06:56,820 --> 00:06:58,180 Oh, by the way, here's what they look like. 98 00:07:01,140 --> 00:07:01,780 ASCII art. 99 00:07:03,120 --> 00:07:07,640 Let me see if I can throw it that far right. 100 00:07:09,680 --> 00:07:10,740 Oh, pretty close. 101 00:07:12,080 --> 00:07:12,720 There you go. 102 00:07:14,360 --> 00:07:16,900 Yeah, so Nmap, Whiskr, and iSick. 103 00:07:19,360 --> 00:07:20,680 Basically, here's the deal. 104 00:07:20,800 --> 00:07:22,980 You can't just download these tools and start using them and then use them. 105 00:07:22,980 --> 00:07:27,760 and think you're going to find shit, please understand what these tools are doing. 106 00:07:27,980 --> 00:07:32,160 Even if you can't read code, read the docs and figure it out. 107 00:07:34,360 --> 00:07:39,540 I don't think I'm that smart, and yet I can know how this stuff works. 108 00:07:41,920 --> 00:07:44,580 If you actually read the docs and understand how it works, you'll understand that when 109 00:07:44,580 --> 00:07:50,060 you're using iSIC or eSIC that you should disconnect yourself from public networks so 110 00:07:50,060 --> 00:07:57,020 that you don't DOS every box on the subnet plus, which people still do. 111 00:07:58,260 --> 00:07:58,700 Yes? 112 00:08:00,520 --> 00:08:00,960 iSIC. 113 00:08:01,200 --> 00:08:01,740 Oh, I'm sorry. 114 00:08:01,840 --> 00:08:05,240 It's IP Stack Integrity Checker, and it's actually a suite of utilities. 115 00:08:05,920 --> 00:08:10,820 I'm going to go through each of them individually and how they should be used, and I'll say 116 00:08:10,820 --> 00:08:11,680 the URLs at the end. 117 00:08:11,760 --> 00:08:12,260 It's really pathetic. 118 00:08:12,440 --> 00:08:13,480 I have all these URLs memorized. 119 00:08:17,660 --> 00:08:19,240 So, why is it in the app? 120 00:08:19,600 --> 00:08:20,040 I don't know. 121 00:08:20,060 --> 00:08:20,620 I don't understand the tools. 122 00:08:24,580 --> 00:08:24,980 OK. 123 00:08:26,420 --> 00:08:27,500 What the fuck is that? 124 00:08:30,240 --> 00:08:30,780 That's odd. 125 00:08:30,960 --> 00:08:31,220 OK. 126 00:08:32,540 --> 00:08:33,600 What do the tools do? 127 00:08:33,820 --> 00:08:35,060 I'm glad you asked. 128 00:08:35,940 --> 00:08:38,100 I think everyone knows what Nmap is. 129 00:08:38,280 --> 00:08:41,860 I think it's pretty ridiculous how popular Nmap is and how much everyone uses it for 130 00:08:41,860 --> 00:08:45,160 everything and how every time you go on an iSIC channel, someone says, you're running 131 00:08:45,160 --> 00:08:47,080 NetBSD, and it's like, well, that's great. 132 00:08:48,800 --> 00:08:50,040 Thanks for telling me something I don't know. 133 00:08:50,040 --> 00:08:50,320 I didn't know. 134 00:08:53,040 --> 00:08:57,440 So, Nmap is really good, not as a port scan or anything like that. 135 00:08:57,540 --> 00:09:02,920 Nmap is really cool for testing a couple of things in firewalls and IDSs. 136 00:09:03,120 --> 00:09:08,520 In state-based packet filtering firewalls and NAT implementations, and even IPSec tunnel 137 00:09:08,520 --> 00:09:13,400 implementations, Nmap is really, it's so simple. 138 00:09:13,520 --> 00:09:14,300 It's really elegant. 139 00:09:14,500 --> 00:09:19,520 Just like doing a port scan through a trusted tunnel, like a FinScan or something. 140 00:09:20,040 --> 00:09:24,640 And then watch the IPSec implementation and then take a shit. 141 00:09:25,360 --> 00:09:30,680 All these tools, by the way, are, the focus is firewalls and IDSs, but testing IPSec tunnels, 142 00:09:30,840 --> 00:09:36,660 if you go to your VPN bake-offs in your area or whatever, take these tools with you. 143 00:09:36,740 --> 00:09:40,720 WSCR, not so much, but iSIC especially, holy shit. 144 00:09:41,140 --> 00:09:46,560 iSIC found so many things, so many bugs in IPSec implementations, it's not even funny. 145 00:09:48,400 --> 00:09:49,440 So, anyway. 146 00:09:49,560 --> 00:09:50,020 Thank you. 147 00:09:50,040 --> 00:09:50,740 Nmap. 148 00:09:53,240 --> 00:09:56,620 Just doing a simple port scan with Nmap will usually suffice. 149 00:09:56,980 --> 00:10:01,080 Because I don't have my slides and my pretty pictures, I'm going to use my hands. 150 00:10:02,280 --> 00:10:05,480 I have an untrusted network, the big bad internet over here. 151 00:10:05,720 --> 00:10:13,540 I have my firewall IDS, whatever the fuck, and then I have my trusted machines that 152 00:10:13,540 --> 00:10:15,180 are protected by the firewall and whatever else. 153 00:10:16,420 --> 00:10:19,120 The interesting thing to do is to... 154 00:10:20,040 --> 00:10:24,880 Run an Nmap scan through all 65,535 ports. 155 00:10:26,140 --> 00:10:33,400 Just to really give the state table, should I explain this? 156 00:10:34,060 --> 00:10:40,060 So in an IDS, when you make a connection, when you send a SIM, there's a state table 157 00:10:40,060 --> 00:10:40,740 structure generally. 158 00:10:41,120 --> 00:10:44,200 I don't know if everyone's implemented this the same way, but I don't know how else you 159 00:10:44,200 --> 00:10:44,480 do it. 160 00:10:44,900 --> 00:10:49,140 There's a state table structure, then it adds your source and the destination like this. 161 00:10:49,320 --> 00:10:49,720 Yes? 162 00:10:52,440 --> 00:10:53,460 Oh my goodness. 163 00:10:54,120 --> 00:10:54,880 All right. 164 00:10:55,980 --> 00:10:56,980 Where is that at? 165 00:10:57,380 --> 00:10:58,060 Right here? 166 00:10:59,180 --> 00:10:59,740 Awesome. 167 00:11:05,420 --> 00:11:05,980 Oh. 168 00:11:09,000 --> 00:11:09,560 What? 169 00:11:12,580 --> 00:11:14,740 Do you actually expect me to use Star Office? 170 00:11:15,520 --> 00:11:16,080 Yeah. 171 00:11:16,580 --> 00:11:17,140 Yeah. 172 00:11:17,360 --> 00:11:17,740 I'm pretty sure. 173 00:11:18,720 --> 00:11:19,280 Whatever. 174 00:11:19,500 --> 00:11:20,020 Okay. 175 00:11:50,040 --> 00:11:55,600 I'm going to go ahead and do this. 176 00:11:55,700 --> 00:11:55,800 Okay. 177 00:12:00,960 --> 00:12:01,720 Okay. 178 00:12:04,240 --> 00:12:04,460 Okay. 179 00:12:09,640 --> 00:12:10,400 Okay. 180 00:12:10,400 --> 00:12:10,760 Okay. 181 00:12:10,760 --> 00:12:11,360 Yep. 182 00:12:11,860 --> 00:12:12,280 Awesome. 183 00:12:15,160 --> 00:12:16,520 That's for me. 184 00:12:17,660 --> 00:12:18,080 Okay. 185 00:12:18,080 --> 00:12:18,520 I'm sorry. 186 00:12:22,380 --> 00:12:23,520 Here's your item. 187 00:12:23,520 --> 00:12:24,980 Where are you? 188 00:12:24,980 --> 00:12:31,380 Are you in Houston? 189 00:12:32,700 --> 00:12:33,260 Sure. 190 00:12:33,260 --> 00:12:34,480 or what have you. 191 00:12:35,820 --> 00:12:37,640 So if you're really interested 192 00:12:37,640 --> 00:12:39,220 in finding problems and stuff, 193 00:12:39,440 --> 00:12:40,580 just be really diligent 194 00:12:41,400 --> 00:12:43,840 if you have the time and the resources and whatever. 195 00:12:46,860 --> 00:12:50,440 Oh yeah, so here's the network idea. 196 00:12:52,520 --> 00:12:53,700 Untrusted, you have your target machine, 197 00:12:53,840 --> 00:12:54,600 which is your firewall, 198 00:12:55,180 --> 00:12:56,260 and then you have your trusted network. 199 00:12:57,020 --> 00:12:58,720 And so usually my examples I say 200 00:12:58,720 --> 00:12:59,840 go from untrusted to trusted 201 00:12:59,840 --> 00:13:01,120 because that's usually what people do 202 00:13:01,120 --> 00:13:02,440 when they're doing penetration testing. 203 00:13:03,260 --> 00:13:04,160 But if you're looking for crashes 204 00:13:04,160 --> 00:13:05,340 or packet leakage or whatever, 205 00:13:05,540 --> 00:13:07,020 you can find it the other way as well. 206 00:13:07,220 --> 00:13:08,440 And people usually miss this. 207 00:13:10,340 --> 00:13:12,660 I found a couple of bugs in the software I was testing 208 00:13:13,380 --> 00:13:14,960 by just going the other way around, 209 00:13:15,140 --> 00:13:16,180 especially with NAT. 210 00:13:16,600 --> 00:13:17,840 If you have a NATed firewall 211 00:13:17,840 --> 00:13:20,420 or IP masqueraded or whatever links people call it, 212 00:13:21,780 --> 00:13:25,540 and you send from trusted to untrusted 213 00:13:25,540 --> 00:13:26,480 instead of the other way around, 214 00:13:27,380 --> 00:13:31,620 that gives the code that maintains the state tables for NAT 215 00:13:31,620 --> 00:13:32,820 a really good workout. 216 00:13:33,260 --> 00:13:36,380 I'll give you an example of a bug that I found 217 00:13:37,500 --> 00:13:38,700 that worked like that. 218 00:13:39,220 --> 00:13:41,960 When you sent FIN packets through NAT 219 00:13:41,960 --> 00:13:43,720 from trusted to untrusted, 220 00:13:44,080 --> 00:13:48,760 the firewall made an entry in the state table 221 00:13:48,760 --> 00:13:49,980 for that FIN 222 00:13:49,980 --> 00:13:52,460 and then never removed it, ever. 223 00:13:52,760 --> 00:13:54,440 So if you did a FIN scan 224 00:13:54,440 --> 00:13:56,500 or flooded it with FINs or what have you 225 00:13:56,500 --> 00:13:57,740 from random source addresses, 226 00:13:59,100 --> 00:14:00,520 basically you're testing to see 227 00:14:00,520 --> 00:14:02,220 if there's any unchecked mallocs. 228 00:14:02,260 --> 00:14:03,240 And if there's an unchecked, 229 00:14:03,240 --> 00:14:04,860 and these are the stuff that's in ring zero, 230 00:14:05,140 --> 00:14:07,300 you've got a blue screen or an oops 231 00:14:07,300 --> 00:14:08,900 or whatever Linux calls it 232 00:14:08,900 --> 00:14:10,940 or a kernel panic or what have you. 233 00:14:11,500 --> 00:14:12,700 Who's firewall is that? 234 00:14:12,920 --> 00:14:13,180 Huh? 235 00:14:13,520 --> 00:14:14,560 Who's firewall is that? 236 00:14:14,800 --> 00:14:15,700 Who's firewall is what? 237 00:14:15,980 --> 00:14:17,060 Who's firewall is that? 238 00:14:17,060 --> 00:14:17,840 It doesn't matter. 239 00:14:17,900 --> 00:14:18,360 It's been fixed. 240 00:14:19,680 --> 00:14:20,220 Next. 241 00:14:20,580 --> 00:14:21,120 Right. 242 00:14:23,280 --> 00:14:24,780 Okay, so NMAP. 243 00:14:25,400 --> 00:14:28,140 Yeah, state table code and packet filter 244 00:14:28,140 --> 00:14:29,220 and NAT implementations 245 00:14:31,160 --> 00:14:32,240 from untrusted, 246 00:14:32,240 --> 00:14:33,560 from an untrusted machine, 247 00:14:33,720 --> 00:14:35,140 NMAP, NMAP, 248 00:14:35,620 --> 00:14:37,780 SYNSCAN ports one through 65, 535. 249 00:14:38,060 --> 00:14:39,280 A really cool thing to do, by the way, 250 00:14:39,300 --> 00:14:40,280 that NMAP won't let you do 251 00:14:40,740 --> 00:14:42,800 is send stuff from port zero through a firewall. 252 00:14:43,060 --> 00:14:45,340 That gets interesting results sometimes. 253 00:14:45,580 --> 00:14:47,080 Same way with an IPSec tunnel, 254 00:14:47,920 --> 00:14:48,740 et cetera, et cetera. 255 00:14:51,120 --> 00:14:53,320 And so what you can see when you do this, 256 00:14:53,440 --> 00:14:54,420 if you know how to look, 257 00:14:54,480 --> 00:14:56,840 by the way, if anyone knows how to see 258 00:14:57,400 --> 00:14:59,220 non-paged kernel memory usage in Linux, 259 00:14:59,480 --> 00:15:00,880 could you please tell me? 260 00:15:01,520 --> 00:15:01,920 Yeah. 261 00:15:01,920 --> 00:15:03,080 Either programmatically or otherwise, 262 00:15:03,320 --> 00:15:05,920 because I couldn't find any information on the net 263 00:15:05,920 --> 00:15:07,560 at all on how to do it. 264 00:15:08,560 --> 00:15:10,220 But if you were able to do that, 265 00:15:10,280 --> 00:15:12,100 like you are on NT in about one second, 266 00:15:13,300 --> 00:15:15,560 what you'd see is that when you do that, 267 00:15:15,600 --> 00:15:17,020 you see non-paged kernel memory increase 268 00:15:17,020 --> 00:15:19,820 because what's happening is the state table is growing 269 00:15:21,040 --> 00:15:23,660 because you're doing like a lot of connections. 270 00:15:24,380 --> 00:15:26,140 And so, like I said, what this tests for 271 00:15:26,140 --> 00:15:27,260 is one unchecked malloc. 272 00:15:27,440 --> 00:15:29,980 Like most operating systems impose a hard limit 273 00:15:29,980 --> 00:15:31,040 on non-paged kernel memory. 274 00:15:31,920 --> 00:15:34,320 Like 16 meg or 20 meg or however much it is. 275 00:15:34,400 --> 00:15:36,000 I mean, it depends on how much physical RAM you have. 276 00:15:37,340 --> 00:15:40,260 And for you non-OS architecture people, 277 00:15:40,500 --> 00:15:41,920 a non-paged kernel memory is... 278 00:15:47,460 --> 00:15:50,800 Non-paged kernel memory is memory only accessible 279 00:15:50,800 --> 00:15:53,740 to the kernel that never gets paged out, ever. 280 00:15:54,100 --> 00:15:55,940 Because for whatever reason, 281 00:15:55,980 --> 00:15:57,220 the data structure that's holding it 282 00:15:57,220 --> 00:15:59,240 couldn't handle like a virtual memory fault 283 00:15:59,560 --> 00:16:01,180 or a page fault of any kind. 284 00:16:01,980 --> 00:16:05,680 And state tables happen to fall into this sort of category. 285 00:16:06,000 --> 00:16:10,300 And so, if you make the state table grow large enough, 286 00:16:10,760 --> 00:16:12,940 eventually it's going to hit that hard limit 287 00:16:13,420 --> 00:16:14,760 of non-paged kernel memory. 288 00:16:14,900 --> 00:16:17,100 The OS is going to say, sorry, right? 289 00:16:17,220 --> 00:16:20,420 And I've seen it time and time and time again, 290 00:16:23,300 --> 00:16:25,600 where I don't know why, 291 00:16:25,880 --> 00:16:28,240 but people don't check the return values of syscalls. 292 00:16:28,540 --> 00:16:31,260 Not just malloc, although malloc is like the most common, 293 00:16:31,920 --> 00:16:33,640 or all the other malloc calls as well. 294 00:16:34,320 --> 00:16:36,240 There's been a couple of vulnerabilities now, 295 00:16:36,360 --> 00:16:40,720 like people weren't checking the return of setGID. 296 00:16:41,080 --> 00:16:43,460 Like if that failed and like defaulted to zero or something, 297 00:16:43,640 --> 00:16:45,260 I think it was in Wii or something. 298 00:16:48,220 --> 00:16:49,300 It's the EchoPix show. 299 00:16:52,280 --> 00:16:53,820 So, that's basically what you're testing. 300 00:16:54,300 --> 00:16:56,260 And if you're looking for stuff like that, 301 00:16:56,360 --> 00:16:57,700 like you're like looking for DOSs 302 00:16:57,700 --> 00:16:59,400 where they run out of memory and then they fuck up 303 00:16:59,400 --> 00:17:00,920 because they didn't check a malloc somewhere. 304 00:17:02,340 --> 00:17:05,940 Both in Linux and in NT, and probably VBSD as well, 305 00:17:06,020 --> 00:17:08,120 you can limit the amount of physical memory the OS will use. 306 00:17:08,240 --> 00:17:11,360 That will help you greatly in finding these bugs faster. 307 00:17:11,520 --> 00:17:13,160 Because if you're doing this on a 128 meg machine, 308 00:17:13,360 --> 00:17:15,240 you really have to beat the living fuck out of it 309 00:17:16,020 --> 00:17:17,860 in order to like get it to crash 310 00:17:17,860 --> 00:17:19,840 or do whatever you're trying to get it to do. 311 00:17:20,060 --> 00:17:23,180 And so if you just kind of lower it just a little bit, 312 00:17:23,240 --> 00:17:24,560 you'll hit these conditions a lot easier. 313 00:17:25,780 --> 00:17:27,080 Wait, I don't want to go whisker. 314 00:17:27,260 --> 00:17:27,940 What the fuck? 315 00:17:28,760 --> 00:17:29,420 Go back there. 316 00:17:30,400 --> 00:17:30,960 There we go. 317 00:17:31,920 --> 00:17:33,500 Different scan types, like I said, 318 00:17:33,680 --> 00:17:35,860 fin packet and a certain implementation 319 00:17:36,440 --> 00:17:39,240 of a stateful packet filter firewall. 320 00:17:40,540 --> 00:17:42,420 Didn't remove fins if you just sent a fin. 321 00:17:42,620 --> 00:17:43,700 It was really odd. 322 00:17:44,680 --> 00:17:46,340 I don't know how the thing ever worked. 323 00:17:46,480 --> 00:17:48,120 You know, it probably did never work for me. 324 00:17:49,140 --> 00:17:50,260 Axe scans, et cetera, et cetera. 325 00:17:50,380 --> 00:17:51,320 So tiny IP frags. 326 00:17:51,360 --> 00:17:53,000 This used to be an interesting way 327 00:17:53,900 --> 00:17:56,000 to leak packets through firewalls 328 00:17:56,000 --> 00:17:57,140 and to make firewalls crash 329 00:17:57,140 --> 00:18:01,720 because for a stateful packet filter-based firewall, 330 00:18:01,920 --> 00:18:02,780 God damn it, it's hard. 331 00:18:04,540 --> 00:18:04,980 Wow! 332 00:18:06,860 --> 00:18:09,440 For a stateful packet filter to do its job properly, 333 00:18:09,520 --> 00:18:10,580 if I've blocked port AD. 334 00:18:12,380 --> 00:18:13,100 I'm assuming, 335 00:18:13,320 --> 00:18:14,680 I'm going to assume surmonology TCP 336 00:18:14,680 --> 00:18:16,180 If I block port 80 337 00:18:17,460 --> 00:18:19,660 and the TCP header is split up 338 00:18:19,660 --> 00:18:22,040 across multiple IP packets, right? 339 00:18:22,160 --> 00:18:24,580 So, when I get my first IP packet on the firewall 340 00:18:24,580 --> 00:18:25,580 and I'm analyzing it 341 00:18:25,580 --> 00:18:26,260 and I'm looking at it 342 00:18:26,260 --> 00:18:27,180 and I say, okay, 343 00:18:27,280 --> 00:18:28,600 is this allowed on the ports 344 00:18:28,600 --> 00:18:30,180 that I'm allowing to pass through me? 345 00:18:30,320 --> 00:18:31,600 Well, I can't sue the port 346 00:18:31,600 --> 00:18:34,200 because the port information in the TCP header 347 00:18:34,200 --> 00:18:35,580 is in the next IP fragment. 348 00:18:36,260 --> 00:18:39,380 You can do one of two things if you're an implementer. 349 00:18:39,480 --> 00:18:42,200 You can either reassemble it to get the full TCP header, 350 00:18:42,320 --> 00:18:44,620 in which case you're opening yourself to DOSes with memory usage 351 00:18:44,620 --> 00:18:46,360 with people sending a whole lot of frags 352 00:18:46,360 --> 00:18:47,040 and you're holding them, 353 00:18:47,080 --> 00:18:49,260 waiting for the next fragment to come 354 00:18:49,260 --> 00:18:50,420 so you can get the full header. 355 00:18:50,740 --> 00:18:51,940 Or you can just drop them. 356 00:18:52,680 --> 00:18:53,840 I'd recommend dropping them 357 00:18:53,840 --> 00:18:58,160 because the likelihood that an MTU is that small, 358 00:18:58,720 --> 00:19:01,400 that a TCP header would be split across IP packets, 359 00:19:01,600 --> 00:19:04,520 is very, very, very, very, very unlikely. 360 00:19:04,940 --> 00:19:06,860 In fact, if anyone can tell me a configuration 361 00:19:06,860 --> 00:19:07,920 in which that would really happen, 362 00:19:08,140 --> 00:19:09,240 I'd really like to hear it. 363 00:19:09,280 --> 00:19:11,760 So if you're an implementer, drop tiny IP frags. 364 00:19:11,960 --> 00:19:13,020 Don't even fuck with them. 365 00:19:13,180 --> 00:19:15,780 It's not even worth any trouble 366 00:19:15,780 --> 00:19:18,980 because it doesn't happen in real life. 367 00:19:19,060 --> 00:19:20,400 If someone sends you tiny IP frags, 368 00:19:20,420 --> 00:19:21,780 they're fucking with you, period. 369 00:19:23,600 --> 00:19:25,840 So the new thing tiny IP frags does now 370 00:19:25,840 --> 00:19:27,560 is that state-based IDSs, 371 00:19:27,660 --> 00:19:29,760 they keep track of connections and whatever else. 372 00:19:30,540 --> 00:19:31,520 If you're IDS, 373 00:19:31,600 --> 00:19:32,300 it's like a logic tree. 374 00:19:32,740 --> 00:19:35,420 They're not just doing flat packet grepping. 375 00:19:35,720 --> 00:19:36,900 And they actually check to see that, 376 00:19:36,960 --> 00:19:37,940 okay, there's a SYN. 377 00:19:38,540 --> 00:19:39,300 There's an ACK. 378 00:19:39,440 --> 00:19:41,900 And then I look for my getPHF. 379 00:19:46,060 --> 00:19:48,700 IDSs that do stuff like that are actually, 380 00:19:49,640 --> 00:19:50,980 this sort of stuff kind of works 381 00:19:50,980 --> 00:19:54,460 because for IDSs that don't do 382 00:19:55,000 --> 00:19:56,480 IP fragmentation reassembly, 383 00:19:59,920 --> 00:20:01,480 it has the same problem that, 384 00:20:01,600 --> 00:20:03,320 the state-based packet filtering firewalls do 385 00:20:03,320 --> 00:20:05,280 in that they can't get the full state with the first packet. 386 00:20:05,480 --> 00:20:07,080 So it's like, what do I do? 387 00:20:07,240 --> 00:20:08,640 I can't do reassembly either. 388 00:20:08,840 --> 00:20:11,640 So I guess I'm just not going to pay attention to this stream 389 00:20:11,640 --> 00:20:13,800 unless it matches like my packet grepping. 390 00:20:14,700 --> 00:20:16,660 And because you're fragmenting that small anyway, 391 00:20:17,200 --> 00:20:18,080 it doesn't really matter. 392 00:20:19,060 --> 00:20:21,180 And you can do tiny IP frags with another tool 393 00:20:21,180 --> 00:20:24,200 that I almost mentioned called FragRouter. 394 00:20:24,400 --> 00:20:26,120 And FragRouter is a fine tool. 395 00:20:26,280 --> 00:20:27,560 I think it was written by Doug Song. 396 00:20:28,100 --> 00:20:28,940 Maybe he's here. 397 00:20:29,680 --> 00:20:30,360 I don't know. 398 00:20:30,840 --> 00:20:31,440 I don't know. 399 00:20:31,500 --> 00:20:31,580 I don't know. 400 00:20:33,240 --> 00:20:35,300 And that can send tiny IP frags 401 00:20:35,300 --> 00:20:36,240 with just regular traffic. 402 00:20:36,480 --> 00:20:38,440 It works just like it sounds. 403 00:20:38,640 --> 00:20:40,560 It's a router that fragments packets 404 00:20:40,560 --> 00:20:44,260 to whatever interesting configuration you want. 405 00:20:45,500 --> 00:20:45,840 So, 406 00:20:47,300 --> 00:20:48,120 SYNSCAN put one, 407 00:20:48,720 --> 00:20:49,800 like all the ports basically, 408 00:20:49,860 --> 00:20:50,780 doing a full port sweep, 409 00:20:52,680 --> 00:20:55,160 like expands and contracts state tables 410 00:20:55,160 --> 00:20:56,380 if they're implemented properly. 411 00:20:57,280 --> 00:20:57,760 So, 412 00:20:58,560 --> 00:20:59,700 this is pretty evil 413 00:21:00,380 --> 00:21:00,860 because, 414 00:21:01,680 --> 00:21:03,100 this next example here, 415 00:21:03,840 --> 00:21:04,280 Nmap, 416 00:21:04,800 --> 00:21:05,240 SYNSCAN, 417 00:21:05,420 --> 00:21:06,000 all the ports, 418 00:21:06,580 --> 00:21:07,020 DECOYSCAN. 419 00:21:07,280 --> 00:21:08,880 I love DECOYSCAN. 420 00:21:09,080 --> 00:21:10,780 Let me tell you why I love DECOYSCAN. 421 00:21:11,080 --> 00:21:12,300 And with DECOYSCAN, 422 00:21:12,400 --> 00:21:15,240 you can fill up state tables faster than anything. 423 00:21:16,820 --> 00:21:19,480 And I really like using really fucked up addresses 424 00:21:19,480 --> 00:21:20,560 for the DECOYSCAN, 425 00:21:21,600 --> 00:21:23,120 which if you're one or two hops away, 426 00:21:23,200 --> 00:21:24,420 you could probably get away with, 427 00:21:24,640 --> 00:21:25,880 but it might not be practical. 428 00:21:27,840 --> 00:21:28,280 So, 429 00:21:29,280 --> 00:21:30,600 can I go back one? 430 00:21:32,380 --> 00:21:33,240 So, let's see here. 431 00:21:33,400 --> 00:21:35,880 This network here is 192.168.2, 432 00:21:36,000 --> 00:21:38,080 and the one I'm sending from is 10.0.0. 433 00:21:38,200 --> 00:21:39,140 Can you go back again? 434 00:21:39,760 --> 00:21:40,620 The forward one? 435 00:21:41,520 --> 00:21:42,000 Huh? 436 00:21:42,940 --> 00:21:43,780 Oh, thanks. 437 00:21:44,420 --> 00:21:45,100 Does it work? 438 00:21:45,260 --> 00:21:45,500 No? 439 00:21:46,320 --> 00:21:47,100 This thing here? 440 00:21:47,280 --> 00:21:47,640 Yeah. 441 00:21:47,980 --> 00:21:50,680 So, I'm using the loopback address 442 00:21:50,680 --> 00:21:51,880 of the destination network, 443 00:21:52,140 --> 00:21:54,380 the broadcast address of the destination network, 444 00:21:54,640 --> 00:21:56,860 and then the loopback and the broadcast of my network, 445 00:21:57,120 --> 00:21:59,680 and then just crazy shit like, you know, 446 00:21:59,760 --> 00:22:01,580 255.255.255, 447 00:22:01,600 --> 00:22:03,440 and 0.0.0.0. 448 00:22:04,580 --> 00:22:06,980 I found interesting packet leakage problems 449 00:22:06,980 --> 00:22:08,260 doing stuff like this. 450 00:22:09,060 --> 00:22:11,000 Whether or not these packs can be routed 451 00:22:11,000 --> 00:22:12,100 through the actual internet 452 00:22:12,100 --> 00:22:13,400 is a whole other question, 453 00:22:14,460 --> 00:22:16,840 but, I mean, if someone owns your ISP 454 00:22:16,840 --> 00:22:17,520 and you're one hop away, 455 00:22:18,740 --> 00:22:21,000 it's a completely feasible scenario. 456 00:22:23,500 --> 00:22:24,020 Yeah. 457 00:22:24,180 --> 00:22:26,580 So, DECOYSCANs are actually pretty neat, 458 00:22:26,700 --> 00:22:28,620 and actually, I don't think that they're really useful 459 00:22:28,620 --> 00:22:31,400 for evading IES detection at all. 460 00:22:31,600 --> 00:22:33,240 Because that's what the original purpose was, 461 00:22:33,300 --> 00:22:35,120 was that you do so many parallel scans 462 00:22:35,120 --> 00:22:36,400 that the IDS logs flood, 463 00:22:36,600 --> 00:22:38,780 and they can't tell what's going on 464 00:22:38,780 --> 00:22:40,080 because they see so many source addresses 465 00:22:40,080 --> 00:22:41,560 for the port scans, 466 00:22:41,680 --> 00:22:42,800 and they can't tell which one's the real one. 467 00:22:44,540 --> 00:22:46,560 And so, NMAP can be gotten from 468 00:22:49,940 --> 00:22:50,780 http://insecure.org 469 00:22:50,780 --> 00:22:51,500 slash NMAP 470 00:22:51,500 --> 00:22:53,620 I-N-S-E-C-U-R-E 471 00:22:53,620 --> 00:22:55,280 dot org slash NMAP. 472 00:22:55,340 --> 00:22:56,580 I think everyone knows that. 473 00:22:56,720 --> 00:22:58,460 Whoever doesn't know that shouldn't be here. 474 00:22:59,020 --> 00:22:59,440 Next. 475 00:23:00,420 --> 00:23:00,840 Please. 476 00:23:00,840 --> 00:23:01,980 Next, please. 477 00:23:02,440 --> 00:23:03,060 Thank you. 478 00:23:05,240 --> 00:23:05,680 Whisker. 479 00:23:06,540 --> 00:23:07,420 Whisker is really cool. 480 00:23:08,680 --> 00:23:09,580 It's written in Perl, 481 00:23:09,640 --> 00:23:12,400 so you can just run it on Win32 482 00:23:12,400 --> 00:23:15,160 or Linux or BSD 483 00:23:15,160 --> 00:23:16,500 or whatever the fuck runs Perl. 484 00:23:16,600 --> 00:23:18,620 Probably your Palm Pilot can run Whisker 485 00:23:18,620 --> 00:23:19,720 if it runs Perl. 486 00:23:19,820 --> 00:23:20,240 Yes, sir? 487 00:23:22,520 --> 00:23:23,180 I'm sorry. 488 00:23:23,540 --> 00:23:24,140 All right. 489 00:23:27,580 --> 00:23:28,540 That would be nice. 490 00:23:32,320 --> 00:23:33,060 Do what? 491 00:23:35,180 --> 00:23:36,240 Turn up the volume? 492 00:23:36,600 --> 00:23:37,460 Like this? 493 00:23:38,320 --> 00:23:39,080 All right. 494 00:23:41,460 --> 00:23:44,280 So, I think everyone knows what Whisker is. 495 00:23:44,280 --> 00:23:45,740 Whisker is basically made to 496 00:23:45,740 --> 00:23:47,100 it's an HTTP scanner, 497 00:23:47,300 --> 00:23:50,560 but Rainforest Puppy, bless his heart, 498 00:23:50,700 --> 00:23:53,340 had a whole bunch of IDS evasion functionality, 499 00:23:53,940 --> 00:23:55,220 which is really cool. 500 00:23:55,520 --> 00:23:58,300 If you see him, give him a big hug and a smooch 501 00:23:58,300 --> 00:23:59,860 because he really deserves it. 502 00:24:00,140 --> 00:24:00,820 Because, you know, 503 00:24:00,820 --> 00:24:01,720 this gets passed. 504 00:24:01,940 --> 00:24:03,740 These things, I think, 505 00:24:03,860 --> 00:24:05,080 I have not seen a firewall, 506 00:24:05,440 --> 00:24:07,920 or I haven't seen an IDS, 507 00:24:08,000 --> 00:24:09,820 that one of those evasion techniques 508 00:24:09,820 --> 00:24:10,760 does not get passed. 509 00:24:11,200 --> 00:24:12,400 If you can show me one, 510 00:24:12,540 --> 00:24:14,380 I'll blow you or something. 511 00:24:16,620 --> 00:24:18,560 So, Whisker basically, what? 512 00:24:19,280 --> 00:24:20,060 Oh, thank you. 513 00:24:21,060 --> 00:24:22,500 Let me take a look real quick. 514 00:24:32,960 --> 00:24:34,580 So, Whisker works like this. 515 00:24:38,020 --> 00:24:39,480 You have Perl installed. 516 00:24:40,140 --> 00:24:41,260 Oh, you have Perl installed. 517 00:24:41,560 --> 00:24:41,880 I'm sorry. 518 00:24:42,060 --> 00:24:43,000 You have Perl installed. 519 00:24:43,640 --> 00:24:46,580 It's just Whisker, dash H, your target host, 520 00:24:46,800 --> 00:24:48,540 and then dash I goes through 521 00:24:48,540 --> 00:24:51,140 all of the various IDS evasion techniques. 522 00:24:52,820 --> 00:24:54,540 Dash I1 is your own coding, 523 00:24:55,220 --> 00:24:56,960 which is a very popular one to do. 524 00:24:58,080 --> 00:24:59,360 Which, what's his face? 525 00:24:59,400 --> 00:25:00,560 Robert Graham from Network Eyes. 526 00:25:00,820 --> 00:25:02,840 Blasted Network Associates' cyber cop monitor 527 00:25:02,840 --> 00:25:04,440 for not doing when it really does. 528 00:25:08,000 --> 00:25:09,660 So, I think everyone knows 529 00:25:09,660 --> 00:25:11,380 like, Whisker is good for doing this stuff, 530 00:25:11,600 --> 00:25:13,000 but here's the interesting point 531 00:25:13,000 --> 00:25:14,400 that I don't think anybody's thought of is 532 00:25:14,400 --> 00:25:16,500 HTTP proxies are blocked by URL. 533 00:25:17,240 --> 00:25:18,960 Like, they block, you know, 534 00:25:19,480 --> 00:25:21,460 like anything where fuck is in the URL or something. 535 00:25:22,180 --> 00:25:23,260 How much do you want to bet 536 00:25:23,260 --> 00:25:26,560 that they're all susceptible to URL encoding? 537 00:25:27,860 --> 00:25:29,440 I bet you that they all are. 538 00:25:29,540 --> 00:25:29,940 So, 539 00:25:29,940 --> 00:25:32,560 a lot of people think proxies are just deployed 540 00:25:32,560 --> 00:25:34,760 so that users on the inside can browse 541 00:25:34,760 --> 00:25:35,460 and work through this proxy. 542 00:25:35,580 --> 00:25:36,760 Actually, sometimes it works the other way around. 543 00:25:36,800 --> 00:25:37,500 Well, they'll have a proxy 544 00:25:37,500 --> 00:25:39,380 so that people coming in from the outside 545 00:25:40,180 --> 00:25:43,240 like, are limited access to certain URLs 546 00:25:43,240 --> 00:25:45,420 unless they belong to a certain IP range 547 00:25:45,420 --> 00:25:47,240 or something like that, or they authenticate first. 548 00:25:48,660 --> 00:25:49,560 This gets past that. 549 00:25:50,520 --> 00:25:52,720 Something else to test for in HTTP proxies. 550 00:25:54,280 --> 00:25:55,520 I'm not gonna talk too much about this 551 00:25:55,520 --> 00:25:56,760 because Whisker has great docs. 552 00:25:56,980 --> 00:25:58,040 Everyone knows what the hell it is 553 00:25:58,040 --> 00:25:58,680 and knows what it does 554 00:25:58,680 --> 00:25:59,920 and knows what its capabilities are. 555 00:26:01,380 --> 00:26:07,780 So, the URL is http://www.wiredtrip.net/.rfp. 556 00:26:08,080 --> 00:26:09,940 You can go in there and choose your theme 557 00:26:11,060 --> 00:26:12,920 and then find the Whisker docs. 558 00:26:13,240 --> 00:26:20,760 That's www.wiredtrip.net/.rfp for Rainforest Puppy. 559 00:26:25,240 --> 00:26:27,260 ISIC, okay, I'm sorry. 560 00:26:27,340 --> 00:26:28,340 I can't get over it. 561 00:26:28,740 --> 00:26:29,920 These are my favorite things to test. 562 00:26:29,920 --> 00:26:30,700 These are my favorite tools ever 563 00:26:31,320 --> 00:26:32,640 for testing this kind of stuff. 564 00:26:34,180 --> 00:26:36,100 It's not necessarily a new idea. 565 00:26:36,280 --> 00:26:37,720 It's just something that finally did it. 566 00:26:38,600 --> 00:26:40,060 ISIC is a suite of utilities. 567 00:26:41,680 --> 00:26:45,640 There's ISIC, which is IP Stack Integrity Checker. 568 00:26:45,760 --> 00:26:48,280 TCP-SIC is TCP Stack Integrity Checker. 569 00:26:48,460 --> 00:26:51,100 UDP is UDP and ICMP is ICP. 570 00:26:51,280 --> 00:26:54,360 And ESIC is Ethernet, which is actually really cool. 571 00:26:55,600 --> 00:26:58,100 We've found some interesting problems with that 572 00:26:58,480 --> 00:26:59,700 that we'll probably release. 573 00:27:00,540 --> 00:27:03,100 Sometime in the next millennia, hopefully. 574 00:27:05,700 --> 00:27:07,580 Great for testing protocol implementations 575 00:27:07,580 --> 00:27:09,060 on all of these, all of these. 576 00:27:09,180 --> 00:27:10,640 Like I said, we found the NetBSD bug, 577 00:27:10,940 --> 00:27:14,760 the remote crash with an ICMP packet using, 578 00:27:15,000 --> 00:27:16,080 I'm sorry, it wasn't an ICMP packet. 579 00:27:16,180 --> 00:27:17,620 It was unaligned IP options 580 00:27:18,340 --> 00:27:21,180 causing unaligned memory access using, 581 00:27:21,420 --> 00:27:22,220 ah, it stopped working. 582 00:27:22,620 --> 00:27:23,280 There it goes. 583 00:27:23,440 --> 00:27:27,200 Using ICMP-SIC and the steps we have to reproduce 584 00:27:27,200 --> 00:27:27,740 from the advisory. 585 00:27:28,360 --> 00:27:29,480 ICP-SIC, or I'm sorry. 586 00:27:29,480 --> 00:27:30,000 ISIC. 587 00:27:30,060 --> 00:27:31,000 All the utilities are used. 588 00:27:31,100 --> 00:27:34,500 Libnet by route, which is also a great library. 589 00:27:34,940 --> 00:27:37,700 Beautiful code to read if you're into that kind of thing. 590 00:27:40,020 --> 00:27:41,800 State-based IDS and packet filters. 591 00:27:45,480 --> 00:27:45,960 Wow. 592 00:27:47,480 --> 00:27:48,700 Basically what these, I'm sorry, 593 00:27:48,760 --> 00:27:49,640 what these tools do is, 594 00:27:49,880 --> 00:27:53,900 they send sort of controlled random packets. 595 00:27:54,820 --> 00:27:56,080 It's kind of interesting. 596 00:27:56,260 --> 00:27:57,800 So basically you see with a random seed, 597 00:27:57,840 --> 00:27:59,060 remembering all your basic stuff, 598 00:27:59,480 --> 00:28:01,140 We would use RAND and you have to seed it 599 00:28:01,140 --> 00:28:03,480 with like 32K to negative 32K. 600 00:28:03,900 --> 00:28:04,980 Works kind of like that. 601 00:28:06,340 --> 00:28:08,380 And so basically if you enter the same random seed, 602 00:28:08,500 --> 00:28:10,320 you'll get the same random results. 603 00:28:13,140 --> 00:28:16,900 And it, you know, does IP options, 604 00:28:17,000 --> 00:28:18,080 it changes all the IP options, 605 00:28:18,240 --> 00:28:21,180 it changes the length, changes the header length, 606 00:28:21,560 --> 00:28:23,900 lies about the header length, all kinds of crazy shit. 607 00:28:24,620 --> 00:28:25,880 Basically it throws a lot, 608 00:28:25,980 --> 00:28:28,640 it just pukes all over the protocol stack. 609 00:28:29,480 --> 00:28:31,600 And sees if the protocol stack can take it. 610 00:28:33,380 --> 00:28:36,840 Because state-based IDS and packet folders 611 00:28:36,840 --> 00:28:41,160 are sort of kind of implementations of TCP IP to an extent. 612 00:28:46,550 --> 00:28:47,200 God, it's hot. 613 00:28:49,300 --> 00:28:51,920 Our implementation of TCP IP to an extent, 614 00:28:52,620 --> 00:28:54,880 this sort of vomiting works as well. 615 00:28:55,160 --> 00:28:58,780 And it's just like Nmap with the state-based IDS 616 00:28:58,780 --> 00:29:03,720 where from a certain IP I go, a state-based IDS, 617 00:29:03,740 --> 00:29:06,640 I go sin and then wait a minute, I don't get a knack, 618 00:29:06,640 --> 00:29:08,560 I get a fin immediately and oh God, I'm screwed and I puke. 619 00:29:10,100 --> 00:29:13,140 Same way with state-based firewalls, 620 00:29:14,000 --> 00:29:17,180 small IP packets, tiny, not necessarily tiny IP facts, 621 00:29:17,300 --> 00:29:18,760 certain fragment offsets. 622 00:29:18,760 --> 00:29:20,160 That's what else this is good at finding 623 00:29:20,160 --> 00:29:24,000 is some things are sensitive to just certain fragment offsets. 624 00:29:24,320 --> 00:29:26,220 And if you run these tools for long enough, 625 00:29:26,240 --> 00:29:27,880 eventually you'll hit all of them. 626 00:29:31,840 --> 00:29:33,280 So, IPsec tunnels, same thing. 627 00:29:33,400 --> 00:29:35,960 In fact, I would, if someone would take these to, 628 00:29:36,600 --> 00:29:39,020 Hugh Daniel and I talked about this a couple months ago. 629 00:29:39,080 --> 00:29:39,900 I don't know if he's done it yet, 630 00:29:40,040 --> 00:29:43,080 but he used to take HPing, some utility called HPing, 631 00:29:43,120 --> 00:29:46,020 to VPN bake-offs and try and get other people's 632 00:29:46,800 --> 00:29:49,120 IPsec implementations to crash at the bake-offs. 633 00:29:50,260 --> 00:29:52,180 And I pointed it at Isaac, 634 00:29:52,320 --> 00:29:53,580 and I don't know if he's actually used it yet. 635 00:29:53,780 --> 00:29:54,980 I really hope he does, 636 00:29:55,140 --> 00:29:56,820 because I'm sure that it'll just make a whole lot 637 00:29:56,820 --> 00:29:58,460 of people's IPsec implementations just, 638 00:29:58,460 --> 00:29:59,340 just puke. 639 00:30:00,300 --> 00:30:02,220 And NAT as well, NAT once again. 640 00:30:03,520 --> 00:30:05,840 Testing from both, routing from both, 641 00:30:06,700 --> 00:30:08,060 the trusted network to untrusted, 642 00:30:08,080 --> 00:30:10,160 and untrusted to trusted, and everything in between. 643 00:30:10,400 --> 00:30:12,820 Also firing directly at the untrusted interface 644 00:30:12,820 --> 00:30:14,820 of the firewall, and at the trusted interface 645 00:30:14,820 --> 00:30:16,960 of the firewall as well can yield some different results. 646 00:30:17,460 --> 00:30:18,900 And also before, like I said, 647 00:30:18,960 --> 00:30:20,240 try all kinds of different configurations, 648 00:30:20,440 --> 00:30:21,580 one with a denial, one with an allow, 649 00:30:21,900 --> 00:30:23,840 two denials, two allows, and absorb, whatever. 650 00:30:25,080 --> 00:30:27,980 So here's the example, TCPsec-S, 651 00:30:28,600 --> 00:30:31,340 which is the, specifies the source IP. 652 00:30:31,800 --> 00:30:35,380 RAND, if you specify RAND, it will pick a random IP 653 00:30:35,380 --> 00:30:37,260 for every single packet it sends out. 654 00:30:37,420 --> 00:30:38,600 It's pretty cool. 655 00:30:40,200 --> 00:30:42,140 Sometimes though, you don't want to do that 656 00:30:42,140 --> 00:30:44,880 because the firewall will just drop things that, 657 00:30:44,980 --> 00:30:47,180 like if you're testing, if you're testing 658 00:30:47,180 --> 00:30:49,320 from the trusted network to an untrusted network, 659 00:30:49,420 --> 00:30:52,620 for instance, I'll do questions at the end. 660 00:30:54,480 --> 00:30:56,700 If, if you're testing from the trusted network 661 00:30:56,700 --> 00:30:58,580 to an untrusted network, and you aren't sending from the 662 00:30:58,580 --> 00:31:00,480 subnet of the untrusted network, the 663 00:31:00,480 --> 00:31:02,480 firewall will be smart enough to just drop your packet 664 00:31:02,480 --> 00:31:04,460 and you won't go all the way through the code paths that you need to 665 00:31:04,460 --> 00:31:05,220 to test them properly. 666 00:31:06,500 --> 00:31:07,940 Dash SRAND is a good way to do things. 667 00:31:08,120 --> 00:31:10,120 When you use dash SRAND, 668 00:31:10,200 --> 00:31:12,100 unplug yourself from 669 00:31:12,100 --> 00:31:13,640 the public internet. 670 00:31:14,920 --> 00:31:16,460 When you send packets 671 00:31:16,880 --> 00:31:17,740 at a host, 672 00:31:18,440 --> 00:31:20,460 it's going to reply back to the source address, 673 00:31:20,820 --> 00:31:22,660 and if you hit some dot mil 674 00:31:22,660 --> 00:31:24,460 by accident or something 675 00:31:24,460 --> 00:31:26,400 and people come knocking 676 00:31:26,400 --> 00:31:27,600 on your door, that's why. 677 00:31:27,920 --> 00:31:30,140 Especially when you're using ESIC, 678 00:31:30,180 --> 00:31:32,540 because ESIC by default sends to the broadcast 679 00:31:32,540 --> 00:31:33,680 ethernet address. 680 00:31:33,960 --> 00:31:35,420 It kills networks. 681 00:31:36,000 --> 00:31:37,080 If you can 682 00:31:38,600 --> 00:31:40,080 hide a laptop server 683 00:31:40,080 --> 00:31:41,600 in an ESIC that's broadcasting, 684 00:31:41,960 --> 00:31:44,200 that's sending ethernet frames 685 00:31:44,200 --> 00:31:46,040 to the broadcast address, 686 00:31:46,300 --> 00:31:47,640 you will kill a network. 687 00:31:48,180 --> 00:31:49,820 That's not a legitimate testing rule. 688 00:31:50,000 --> 00:31:50,760 That's just an aside. 689 00:31:52,880 --> 00:31:54,180 And then dash D 690 00:31:54,180 --> 00:31:55,320 is the destination. 691 00:31:57,000 --> 00:31:58,520 Trusted, so if we're going from 692 00:31:58,520 --> 00:32:00,020 untrusted, and set, 693 00:32:00,180 --> 00:32:01,620 be sure to set your random seed. 694 00:32:01,840 --> 00:32:03,980 If you don't set it, it uses the process ID 695 00:32:03,980 --> 00:32:06,480 of what it's running 696 00:32:06,480 --> 00:32:08,000 as right now, and so 697 00:32:08,000 --> 00:32:09,740 when you don't use dash R, 698 00:32:09,940 --> 00:32:11,960 like your PID is incremental or random 699 00:32:11,960 --> 00:32:13,080 and open BSD or whatever, 700 00:32:13,920 --> 00:32:15,280 you won't get consistent results. 701 00:32:18,520 --> 00:32:20,020 I've seen this mistake happen with people 702 00:32:20,020 --> 00:32:21,320 who didn't understand the tool, basically. 703 00:32:21,800 --> 00:32:24,060 They just, you know, they did dash SRAND, 704 00:32:24,180 --> 00:32:26,040 dash D, trusted, and then they just went to town. 705 00:32:26,300 --> 00:32:28,000 And then, like, they got something to crash. 706 00:32:28,280 --> 00:32:29,860 And then they couldn't ever get it to crash again. 707 00:32:30,060 --> 00:32:31,120 And they're like, well, what was your random seed? 708 00:32:31,500 --> 00:32:32,920 I don't know. Well. 709 00:32:34,020 --> 00:32:34,640 Oh, well. 710 00:32:36,020 --> 00:32:37,800 So I usually use 31337 711 00:32:37,800 --> 00:32:40,160 or 666. Something that's really dumb and easy to remember. 712 00:32:40,700 --> 00:32:42,060 If you can't get, like, anything 713 00:32:42,060 --> 00:32:43,880 to happen in, like, the first 5 million packets 714 00:32:43,880 --> 00:32:45,940 or so, try changing the random seed 715 00:32:46,460 --> 00:32:47,500 to something else. 716 00:32:48,900 --> 00:32:49,700 Dash M700 717 00:32:49,700 --> 00:32:51,540 limits, it's like the maximum 718 00:32:51,540 --> 00:32:54,100 maximum amount of packets you can pump out. 719 00:32:54,180 --> 00:32:54,620 On the network. 720 00:32:55,700 --> 00:32:56,860 Kilobytes per second-wise. 721 00:32:58,900 --> 00:33:00,540 Now, like the next point says, 722 00:33:00,760 --> 00:33:01,740 Linux sends packets 723 00:33:01,740 --> 00:33:02,940 fucking fast. 724 00:33:03,320 --> 00:33:06,140 Like, 4 meg per second, really fast. 725 00:33:07,140 --> 00:33:07,580 But, 726 00:33:08,600 --> 00:33:10,440 as we mentioned in our NetBSD advisory, 727 00:33:10,700 --> 00:33:11,620 Linux mangles packets 728 00:33:12,080 --> 00:33:13,160 and doesn't tell you. 729 00:33:13,560 --> 00:33:16,340 And so, when we were doing some last-minute 730 00:33:16,340 --> 00:33:17,960 like tests, we would make sure this was completely 731 00:33:17,960 --> 00:33:19,960 reproducible, or if we were releasing the 732 00:33:19,960 --> 00:33:21,340 we couldn't reproduce it on Linux. 733 00:33:21,440 --> 00:33:23,280 And we were like, what the fuck is going on? 734 00:33:23,600 --> 00:33:24,160 And so, 735 00:33:24,180 --> 00:33:26,020 when we tested it from BSD, it worked. 736 00:33:27,180 --> 00:33:28,820 Problem with BSD is that, 737 00:33:30,440 --> 00:33:32,600 because, for whatever architectural reason, 738 00:33:32,800 --> 00:33:34,360 it's a lot slower at sending packets. 739 00:33:34,700 --> 00:33:36,300 It has these things called NMB clusters 740 00:33:36,930 --> 00:33:39,720 that fill up very fast, for whatever reason. 741 00:33:40,340 --> 00:33:42,620 So, you can't send them as fast. 742 00:33:42,700 --> 00:33:44,520 If you send them as fast, it will drop packets. 743 00:33:44,900 --> 00:33:47,080 So, instead of sending mangled packets, 744 00:33:47,220 --> 00:33:48,220 you still send the packets at all. 745 00:33:48,480 --> 00:33:49,580 And this can be a problem. 746 00:33:49,760 --> 00:33:53,260 So, Dash M700, when we were sending from 747 00:33:54,180 --> 00:33:56,180 some ARM32 boxes running NetBSD, 748 00:33:56,740 --> 00:33:58,980 and also from OpenBSD on like, 749 00:33:59,060 --> 00:34:00,100 some Pentium 2s or something, 750 00:34:00,320 --> 00:34:01,520 that seemed to be about right. 751 00:34:01,860 --> 00:34:03,540 And I don't think it has anything to do with 752 00:34:03,540 --> 00:34:04,580 how fast the machine is. 753 00:34:04,680 --> 00:34:05,660 I think it has to do with the drivers 754 00:34:05,660 --> 00:34:06,400 and how they're written. 755 00:34:07,000 --> 00:34:09,120 And if you run into that, if your machine's slow, 756 00:34:09,180 --> 00:34:11,020 or whatever, you can increase NMB clusters. 757 00:34:11,460 --> 00:34:12,380 Don't ask me how. 758 00:34:12,560 --> 00:34:13,660 I don't know anything about Unix. 759 00:34:18,340 --> 00:34:23,740 So, the URL for ISIC, the suite of utilities, 760 00:34:23,740 --> 00:34:28,540 is http://expert.cc.purdue.edu 761 00:34:29,140 --> 00:34:31,960 slash tilde F-R-A-N-T-Z-E-N. 762 00:34:32,300 --> 00:34:33,800 That man's last name right there. 763 00:34:35,400 --> 00:34:39,200 So, E-X-P-U-R-T dot C-C dot P-U-R-D-U-E dot E-D-U 764 00:34:39,660 --> 00:34:40,980 slash tilde F-R-A-N-T-Z-E-N. 765 00:34:40,980 --> 00:34:42,300 So, that's slide eight. 766 00:34:43,180 --> 00:34:43,820 Next, please. 767 00:34:46,160 --> 00:34:47,840 I was gonna have a code example, by the way, 768 00:34:47,920 --> 00:34:53,720 but it got lost in the ether, so I can't do that. 769 00:34:53,740 --> 00:34:53,920 Let me do it. 770 00:34:55,420 --> 00:35:01,040 Okay, so, this is only loosely related, 771 00:35:01,400 --> 00:35:06,160 but as far as like, the point of this is like, 772 00:35:06,240 --> 00:35:08,360 this kind of testing brings about certain problems, 773 00:35:08,420 --> 00:35:10,120 certain problems with memory allocation, 774 00:35:10,460 --> 00:35:13,280 not checking syscalls, not checking the return values 775 00:35:13,280 --> 00:35:20,640 of syscalls, various other problems. 776 00:35:21,410 --> 00:35:23,040 So, just some suggestions. 777 00:35:23,840 --> 00:35:27,240 For dev managers, for whatever else, 778 00:35:29,320 --> 00:35:32,120 for the love of Christ, don't just start coding 779 00:35:32,120 --> 00:35:33,400 if you're gonna do something serious. 780 00:35:33,880 --> 00:35:35,740 All right, if you're gonna write like a 200 line program, 781 00:35:36,100 --> 00:35:39,140 fine, like, get stoned drunk and like, 782 00:35:39,200 --> 00:35:40,760 code until your fingers bleed. 783 00:35:40,980 --> 00:35:42,420 But if you're gonna do something serious, 784 00:35:42,640 --> 00:35:45,380 define your interfaces first, plan first, 785 00:35:46,200 --> 00:35:48,160 try and maintain consistency in the interfaces. 786 00:35:50,060 --> 00:35:51,100 God, it drives me crazy. 787 00:35:51,220 --> 00:35:53,720 I really, really hate, I hate it. 788 00:35:53,720 --> 00:35:53,880 It's like this, not just a code, 789 00:35:54,120 --> 00:35:55,640 that's just a total rat's nest. 790 00:35:56,000 --> 00:35:57,740 There's no consistency at all. 791 00:36:00,280 --> 00:36:01,940 So, this is always a good idea. 792 00:36:02,140 --> 00:36:03,200 And if you're in a professional environment, 793 00:36:03,580 --> 00:36:04,920 modeling tools, like you 794 00:36:04,920 --> 00:36:07,080 What else? 795 00:36:07,260 --> 00:36:11,220 These national rouse, whatever, 796 00:36:11,440 --> 00:36:13,440 can maybe help you into that kind of thing. 797 00:36:15,080 --> 00:36:17,800 Writing well, writing clean, well-documented code, 798 00:36:17,860 --> 00:36:19,700 I mean like, well-formatted, like, you can read it, 799 00:36:19,760 --> 00:36:22,080 good comments, stuff like that. 800 00:36:22,180 --> 00:36:23,500 Will save you time. 801 00:36:23,520 --> 00:36:23,700 I feel so bad so often. 802 00:36:23,700 --> 00:36:25,700 and aneurysms later. A lot of people think it's a waste 803 00:36:25,700 --> 00:36:27,640 of time. A lot of men are saying, no, we don't have time 804 00:36:27,640 --> 00:36:29,600 to clean it up, whatever. It will always bite 805 00:36:29,600 --> 00:36:31,700 you in the ass. Every single time. When you think 806 00:36:31,700 --> 00:36:33,720 the code is going to be used for three months and you're going to rewrite 807 00:36:33,720 --> 00:36:35,460 it, it's going to last three years. 808 00:36:36,860 --> 00:36:37,720 Every single time. 809 00:36:38,040 --> 00:36:39,500 Have never seen it not happen. 810 00:36:42,940 --> 00:36:43,660 And, alright, 811 00:36:43,780 --> 00:36:44,920 this is a real pet peeve. 812 00:36:46,060 --> 00:36:47,280 Alright, anybody try to compile 813 00:36:47,280 --> 00:36:49,500 Nmap like 2.08, or like 814 00:36:49,500 --> 00:36:51,620 Nmap anything pre-2.5, and 815 00:36:51,620 --> 00:36:53,480 there's a zillion warnings 816 00:36:53,480 --> 00:36:55,240 complaining about all kinds of crazy 817 00:36:55,240 --> 00:36:57,360 shit, and most of it ended up being bugs. 818 00:36:59,240 --> 00:36:59,680 Linux, 819 00:37:00,680 --> 00:37:01,120 GNU, 820 00:37:01,140 --> 00:37:03,200 not so much BSD, like GNU 821 00:37:03,200 --> 00:37:05,520 programs just all the time, were like, the compiler 822 00:37:05,520 --> 00:37:07,340 gives you warnings for a reason. 823 00:37:07,660 --> 00:37:09,380 Okay? It's not telling 824 00:37:09,380 --> 00:37:11,140 you just for like, you know, to fill up your screen 825 00:37:11,140 --> 00:37:12,920 with crap. Please 826 00:37:12,920 --> 00:37:14,920 fix warnings if you see them. 827 00:37:15,240 --> 00:37:17,280 It's like the most 828 00:37:17,280 --> 00:37:18,980 simple thing that's overlooked every single time. 829 00:37:19,280 --> 00:37:21,120 The other thing is source and runtime analysis tools. 830 00:37:21,400 --> 00:37:23,180 If you have loads and loads of 831 00:37:23,180 --> 00:37:24,500 cash to spend on Purify, 832 00:37:25,060 --> 00:37:26,800 and, like, Intra++, and 833 00:37:27,520 --> 00:37:28,580 Flexcellent, and stuff like that. 834 00:37:29,500 --> 00:37:31,120 If anyone wants to talk to me further about this 835 00:37:31,120 --> 00:37:33,140 stuff, I can talk about it at great length, 836 00:37:33,280 --> 00:37:34,840 but it's nothing to do with... 837 00:37:36,460 --> 00:37:37,180 Who was supposed 838 00:37:37,180 --> 00:37:37,660 to be here? 839 00:37:39,420 --> 00:37:40,220 No, go back. 840 00:37:40,780 --> 00:37:42,380 I'm going to embellish and name this for a minute. 841 00:37:44,320 --> 00:37:45,340 Who was supposed to be here, 842 00:37:45,420 --> 00:37:47,120 and I was going to, like, ask the crowd 843 00:37:47,700 --> 00:37:48,420 for, like, 844 00:37:49,720 --> 00:37:50,440 for, like, 845 00:37:50,840 --> 00:37:53,060 to tell me what was wrong with it, and so I'll put 846 00:37:53,060 --> 00:37:55,000 it up on the NewHack page, or off my 847 00:37:55,000 --> 00:37:56,640 page off of NewHack, and 848 00:37:58,080 --> 00:37:59,280 along with these slides, 849 00:37:59,700 --> 00:38:01,180 and hopefully recording the talk, 850 00:38:01,420 --> 00:38:02,340 and you all can 851 00:38:03,360 --> 00:38:04,980 send me an email saying, like, what you see, 852 00:38:05,040 --> 00:38:06,280 and be like, where's Waldo 853 00:38:06,720 --> 00:38:08,780 of Loom coding. So what I was going to do was, 854 00:38:08,860 --> 00:38:10,840 for every guess and got right of what was wrong, 855 00:38:10,920 --> 00:38:13,220 I was going to hand out a shirt. So I'm going to hand out a shirt during the Q&A 856 00:38:13,220 --> 00:38:14,760 instead for people who have really good questions. 857 00:38:15,500 --> 00:38:15,820 Next. 858 00:38:19,740 --> 00:38:20,380 For designers, 859 00:38:23,600 --> 00:38:24,760 designers and coders, 860 00:38:25,360 --> 00:38:26,760 if you're implementing on NT, 861 00:38:27,320 --> 00:38:29,100 and you're interested in application 862 00:38:29,100 --> 00:38:31,320 level stuff, use TDI. 863 00:38:34,620 --> 00:38:35,140 Transport 864 00:38:35,140 --> 00:38:37,040 something interface. I can't remember what it is. 865 00:38:37,180 --> 00:38:37,860 Transport data? 866 00:38:38,680 --> 00:38:40,200 Transport driver interface. Thank you. 867 00:38:41,640 --> 00:38:43,120 You get stuff pre-IP 868 00:38:43,120 --> 00:38:45,120 assembled, so you don't have to 869 00:38:45,120 --> 00:38:47,100 duplicate work of the IP stack and further 870 00:38:47,100 --> 00:38:48,280 slow your IDS down. 871 00:38:49,400 --> 00:38:49,920 However, 872 00:38:50,380 --> 00:38:52,680 this only works on host-based 873 00:38:54,240 --> 00:38:55,120 IDSs, which 874 00:38:55,120 --> 00:38:56,860 could be argued with the IDSs that really work. 875 00:39:00,200 --> 00:39:01,080 And it 876 00:39:01,080 --> 00:39:01,920 works on Windows 877 00:39:01,920 --> 00:39:04,280 95, 98, whatever, 878 00:39:04,500 --> 00:39:07,040 NT and Win2K, so if you write code 879 00:39:07,040 --> 00:39:08,360 it's going to be portable for the most part. 880 00:39:09,000 --> 00:39:11,020 Another thing you can use, I didn't mention here on 881 00:39:11,020 --> 00:39:12,920 the slide, is IP helper functionality 882 00:39:12,920 --> 00:39:14,760 is kind of interesting, instead of like 883 00:39:14,760 --> 00:39:16,900 maintaining your own state table. 884 00:39:18,380 --> 00:39:19,260 Just use 885 00:39:19,260 --> 00:39:19,880 the OSs. 886 00:39:20,580 --> 00:39:25,460 In Windows 98 and NT4.0 starting with Service Pack 4, 887 00:39:26,040 --> 00:39:29,020 which is IP helper functions, you can actually get the connection table. 888 00:39:29,240 --> 00:39:33,440 You can see who's connected and not have to deal with maintaining your own state and duplicating 889 00:39:33,440 --> 00:39:33,740 your work. 890 00:39:34,040 --> 00:39:38,320 And if you do this, yours can be faster, and yours is not duplicating work, so because 891 00:39:38,320 --> 00:39:41,580 you're not duplicating code, you're not going to implement mistakes all over again, etc. 892 00:39:42,680 --> 00:39:48,580 And in Linux 2.4, you can use net filter interfaces, like the Linux kernel actually has proper 893 00:39:48,580 --> 00:39:49,580 interfaces for something. 894 00:39:49,580 --> 00:39:50,920 If you can fathom such a thing. 895 00:39:52,360 --> 00:39:54,260 You can use the net filter interfaces to 896 00:39:54,260 --> 00:39:56,800 write yourself at whatever point in the stack you want to get data. 897 00:39:57,640 --> 00:40:01,500 Much like TDI slash and this on Windows. 898 00:40:02,200 --> 00:40:03,920 And this is what I would highly recommend. 899 00:40:04,380 --> 00:40:10,800 I wouldn't bother re-implementing IP flag reassembly, TCP servers reassembly. 900 00:40:10,840 --> 00:40:12,100 It's just dumb, ok? 901 00:40:12,520 --> 00:40:13,000 Seriously. 902 00:40:13,740 --> 00:40:14,560 Seriously, ok? 903 00:40:16,440 --> 00:40:16,920 Because 904 00:40:18,220 --> 00:40:19,480 when you re-implement the 905 00:40:19,580 --> 00:40:20,280 that says the other thing. 906 00:40:20,360 --> 00:40:21,760 Don't re-implement things, okay? 907 00:40:21,820 --> 00:40:23,900 Don't rewrite the libc calls. 908 00:40:24,060 --> 00:40:26,260 It's stupid, all right? 909 00:40:26,300 --> 00:40:27,820 When you write code, 910 00:40:28,000 --> 00:40:29,600 you're going to make mistakes. 911 00:40:29,840 --> 00:40:31,540 When you rewrite code that's existed 912 00:40:31,540 --> 00:40:34,580 for 10 to 15 plus years, right? 913 00:40:34,760 --> 00:40:36,180 It's been around for that long. 914 00:40:36,380 --> 00:40:39,080 People have probably found a lot of the bugs, right? 915 00:40:39,220 --> 00:40:40,500 People aren't going to find the bugs 916 00:40:40,500 --> 00:40:41,780 that are in your shitty code. 917 00:40:43,320 --> 00:40:45,240 Don't rewrite libc calls. 918 00:40:46,160 --> 00:40:47,980 If someone can argue with me later 919 00:40:47,980 --> 00:40:49,020 and prove me wrong, 920 00:40:49,580 --> 00:40:50,600 on this, great. 921 00:40:51,000 --> 00:40:52,440 I'd really like to be proven wrong. 922 00:40:52,600 --> 00:40:54,600 Right now, it just annoys the shit out of me 923 00:40:54,600 --> 00:40:56,240 that things take three times as long 924 00:40:56,240 --> 00:40:58,460 just because someone has to rewrite smprintf. 925 00:41:02,180 --> 00:41:03,840 Oh, and also, when you're doing NAT 926 00:41:03,840 --> 00:41:04,940 and IPSec stuff, 927 00:41:05,120 --> 00:41:06,420 use the free stuff. 928 00:41:06,760 --> 00:41:08,060 There's no reason not to. 929 00:41:08,640 --> 00:41:09,980 Try and find someone else 930 00:41:09,980 --> 00:41:11,400 who has a NAT implementation like Cisco. 931 00:41:12,300 --> 00:41:13,820 Everyone in the world 932 00:41:13,820 --> 00:41:15,660 used Cisco's first 933 00:41:15,660 --> 00:41:18,400 reference implementation of IPSec. 934 00:41:18,680 --> 00:41:19,160 And, 935 00:41:19,580 --> 00:41:20,080 it's a camp. 936 00:41:20,180 --> 00:41:22,140 And that's why they're all vulnerable 937 00:41:22,140 --> 00:41:24,380 to UDP garbage appendage bugs. 938 00:41:24,560 --> 00:41:24,740 But, 939 00:41:25,340 --> 00:41:26,500 if it's a mature code 940 00:41:26,500 --> 00:41:27,560 and you're reusing it, 941 00:41:27,640 --> 00:41:28,400 that's a good thing. 942 00:41:28,600 --> 00:41:29,580 You aren't wasting time. 943 00:41:29,720 --> 00:41:30,620 It's a really good thing. 944 00:41:30,780 --> 00:41:32,100 I can't stress this enough. 945 00:41:32,400 --> 00:41:34,100 If you have to argue with your manager about it, 946 00:41:34,380 --> 00:41:34,780 tell them, 947 00:41:34,780 --> 00:41:35,740 tell them to send me mail. 948 00:41:35,880 --> 00:41:36,820 I'll gladly argue. 949 00:41:37,020 --> 00:41:38,320 This is something I love arguing about. 950 00:41:41,880 --> 00:41:43,400 So, there's a NewHackCD webpage, 951 00:41:43,660 --> 00:41:44,980 www.newhackcd.net. 952 00:41:46,380 --> 00:41:49,380 There is not a whole heck of a lot there right now. 953 00:41:49,820 --> 00:41:51,160 But, I'm sure there will be in the future. 954 00:41:51,240 --> 00:41:53,740 We'll be able to buy various memorabilia, 955 00:41:54,440 --> 00:41:55,060 thongs, etc. 956 00:41:55,620 --> 00:41:56,960 And, that's my email address, 957 00:41:57,160 --> 00:41:59,120 syke at newhackcd.net. 958 00:41:59,600 --> 00:42:05,460 N-e-w-h-a-c-k-s-c-y-t-y dot net. 959 00:42:06,800 --> 00:42:07,660 And, that's it. 960 00:42:07,900 --> 00:42:08,700 So, Q and A. 961 00:42:19,580 --> 00:42:21,460 If you're running Isaac, 962 00:42:21,660 --> 00:42:24,820 and it sends like five million packets at your IDS, 963 00:42:24,820 --> 00:42:25,760 and one of them crashes it, 964 00:42:25,880 --> 00:42:27,940 how do you narrow down which one did it? 965 00:42:28,480 --> 00:42:29,440 Excellent question. 966 00:42:30,620 --> 00:42:31,500 Excellent question. 967 00:42:31,820 --> 00:42:33,140 It wasn't in Overlook, 968 00:42:33,160 --> 00:42:33,940 and I forgot to add in. 969 00:42:35,980 --> 00:42:38,080 Isaac has two options. 970 00:42:38,360 --> 00:42:38,920 Dash P, 971 00:42:39,240 --> 00:42:41,100 which says to send this many packets, 972 00:42:41,240 --> 00:42:42,240 and Dash K, 973 00:42:42,400 --> 00:42:43,900 which says skip this many packets. 974 00:42:44,160 --> 00:42:47,080 Mike should really be doing a talk on Isaac at this con. 975 00:42:49,580 --> 00:42:51,260 And, so what you do is, 976 00:42:52,560 --> 00:42:53,720 don't let it run overnight. 977 00:42:54,060 --> 00:42:55,100 Try and pay attention, 978 00:42:55,260 --> 00:42:57,240 like look every 500,000 packets or something, 979 00:42:57,400 --> 00:42:58,100 and see if it crashes. 980 00:42:59,560 --> 00:43:02,460 Jeru actually wrote a patch that pinged 981 00:43:02,460 --> 00:43:04,180 after every so many packets. 982 00:43:05,200 --> 00:43:06,040 And, I think, 983 00:43:07,420 --> 00:43:09,020 maybe it was Mike who told me 984 00:43:09,020 --> 00:43:10,660 someone wrote a shell script or something 985 00:43:10,660 --> 00:43:12,640 that would send X number of packets, 986 00:43:12,940 --> 00:43:13,660 ping the host, 987 00:43:13,780 --> 00:43:15,560 and then incrementally go. 988 00:43:17,680 --> 00:43:18,120 Okay. 989 00:43:19,620 --> 00:43:21,360 He says there's one included in the tarball. 990 00:43:21,560 --> 00:43:22,240 So, if you get the, 991 00:43:22,860 --> 00:43:23,940 if you go to the web page, 992 00:43:24,040 --> 00:43:25,600 export.cc.purdue.edu 993 00:43:25,600 --> 00:43:26,300 slash tilde 994 00:43:26,300 --> 00:43:28,620 F-R-A-N-T-Z-E-N, 995 00:43:29,720 --> 00:43:30,500 it's in the tarball. 996 00:43:31,080 --> 00:43:31,480 But, 997 00:43:32,080 --> 00:43:33,480 to answer your question 998 00:43:33,480 --> 00:43:34,560 so that you understand what's going on. 999 00:43:34,680 --> 00:43:35,560 So, what you do is like, 1000 00:43:35,620 --> 00:43:36,240 you know it crashed 1001 00:43:36,240 --> 00:43:38,080 sometime between packets 1002 00:43:39,760 --> 00:43:40,820 two and a half million 1003 00:43:40,820 --> 00:43:42,160 and three million, 1004 00:43:42,380 --> 00:43:43,320 sake of argument. 1005 00:43:43,920 --> 00:43:45,380 So, what you do is you 1006 00:43:45,380 --> 00:43:46,160 do 1007 00:43:46,820 --> 00:43:48,200 Isaac dash S whatever, 1008 00:43:48,380 --> 00:43:49,120 dash D whatever, 1009 00:43:49,580 --> 00:43:49,920 dash R whatever, 1010 00:43:50,340 --> 00:43:51,220 and then you do 1011 00:43:51,220 --> 00:43:52,080 dash P 1012 00:43:53,160 --> 00:43:53,880 for sending, 1013 00:43:54,040 --> 00:43:54,940 and you say dash P 1014 00:43:54,940 --> 00:43:55,760 send three million packets 1015 00:43:55,760 --> 00:43:56,740 and you say dash K 1016 00:43:57,100 --> 00:43:57,960 skip the first 1017 00:43:58,440 --> 00:43:59,440 2.5 million. 1018 00:43:59,680 --> 00:44:00,460 When it skips packets 1019 00:44:00,460 --> 00:44:01,720 it takes a really long time 1020 00:44:01,720 --> 00:44:02,880 because it has to go through 1021 00:44:02,880 --> 00:44:03,040 the, 1022 00:44:03,120 --> 00:44:04,240 with the random things 1023 00:44:04,240 --> 00:44:05,120 so you get the same results 1024 00:44:05,120 --> 00:44:06,200 if you use the same random seed. 1025 00:44:07,260 --> 00:44:08,020 And then from there 1026 00:44:08,020 --> 00:44:08,840 you just do binary search. 1027 00:44:08,960 --> 00:44:09,520 If it crashes again 1028 00:44:09,520 --> 00:44:10,700 you say fucking A is reproducible. 1029 00:44:10,960 --> 00:44:11,800 Otherwise, you know, 1030 00:44:11,800 --> 00:44:12,840 you expand your search a bit. 1031 00:44:13,060 --> 00:44:14,240 And so, once you have the range, 1032 00:44:14,280 --> 00:44:14,740 you know the range, 1033 00:44:14,860 --> 00:44:15,980 just start doing the binary search. 1034 00:44:16,220 --> 00:44:16,960 And you say okay, 1035 00:44:17,060 --> 00:44:17,980 so it's between 1036 00:44:19,140 --> 00:44:20,140 2.5 million 1037 00:44:20,480 --> 00:44:20,780 and 1038 00:44:21,360 --> 00:44:22,340 three million, right? 1039 00:44:22,420 --> 00:44:22,920 If that doesn't do it 1040 00:44:22,920 --> 00:44:23,640 then you know it's the other half 1041 00:44:23,640 --> 00:44:24,280 and then you just like 1042 00:44:24,280 --> 00:44:24,720 narrow it down, 1043 00:44:24,780 --> 00:44:25,080 narrow it down, 1044 00:44:25,100 --> 00:44:25,360 narrow it down. 1045 00:44:25,640 --> 00:44:26,480 And it took me 1046 00:44:26,480 --> 00:44:27,860 an hour and a half 1047 00:44:27,860 --> 00:44:28,640 to two hours to do that 1048 00:44:28,640 --> 00:44:29,660 with a NetBeast DX Blight. 1049 00:44:31,380 --> 00:44:32,520 Except I was lucky there 1050 00:44:32,520 --> 00:44:33,040 where it didn't happen 1051 00:44:33,040 --> 00:44:33,800 at three million packets. 1052 00:44:33,960 --> 00:44:34,780 It happened at like 1053 00:44:34,780 --> 00:44:36,000 30,000 something. 1054 00:44:36,640 --> 00:44:37,620 So, that's how you do that. 1055 00:44:38,000 --> 00:44:39,200 That's an excellent question. 1056 00:44:39,300 --> 00:44:39,840 You get a T-shirt. 1057 00:44:44,000 --> 00:44:44,600 Anybody else? 1058 00:44:45,880 --> 00:44:46,740 Mr. Balkan, 1059 00:44:46,860 --> 00:44:47,700 would you like to come up 1060 00:44:47,980 --> 00:44:48,800 here? 1061 00:44:48,800 --> 00:44:49,680 How many intrusion detection 1062 00:44:49,680 --> 00:44:51,000 systems did you test? 1063 00:44:51,020 --> 00:44:51,860 How many? 1064 00:44:54,160 --> 00:44:55,880 He said how many intrusion 1065 00:44:55,880 --> 00:44:56,620 detection systems 1066 00:44:56,620 --> 00:44:57,480 did you test? 1067 00:44:57,580 --> 00:44:58,460 With Whisker? 1068 00:44:58,840 --> 00:45:00,360 With all these tools? 1069 00:45:00,440 --> 00:45:01,280 With all these tools? 1070 00:45:01,900 --> 00:45:02,640 With all these tools? 1071 00:45:02,640 --> 00:45:02,960 What are you testing? 1072 00:45:07,760 --> 00:45:08,360 Five? 1073 00:45:09,120 --> 00:45:10,320 Five professionally 1074 00:45:10,320 --> 00:45:11,300 or in my spare time? 1075 00:45:13,580 --> 00:45:14,180 Huh? 1076 00:45:15,120 --> 00:45:15,720 Huh? 1077 00:45:16,400 --> 00:45:17,000 Together? 1078 00:45:19,160 --> 00:45:19,600 Seven. 1079 00:45:22,780 --> 00:45:23,220 Huh? 1080 00:45:24,220 --> 00:45:25,540 I really don't want to... 1081 00:45:26,040 --> 00:45:27,540 I would rather not 1082 00:45:27,540 --> 00:45:28,200 advocate anything. 1083 00:45:28,380 --> 00:45:29,260 I don't work for a vendor 1084 00:45:29,260 --> 00:45:30,040 anymore, by the way. 1085 00:45:31,040 --> 00:45:32,300 As I'm sure you all 1086 00:45:32,300 --> 00:45:33,060 will find out, 1087 00:45:33,140 --> 00:45:33,920 you get burnt out 1088 00:45:33,920 --> 00:45:34,500 on this crap 1089 00:45:34,500 --> 00:45:35,160 after a while 1090 00:45:35,160 --> 00:45:36,240 and you just don't want 1091 00:45:36,240 --> 00:45:36,800 to deal with it anymore. 1092 00:45:39,720 --> 00:45:40,440 You should... 1093 00:45:40,440 --> 00:45:41,580 That's why I'm doing this 1094 00:45:41,580 --> 00:45:42,460 is so people can test 1095 00:45:42,460 --> 00:45:43,020 this stuff themselves 1096 00:45:43,020 --> 00:45:43,920 so admins can go. 1097 00:45:44,200 --> 00:45:45,440 If a vendor says, 1098 00:45:45,560 --> 00:45:46,520 it detects everything 1099 00:45:46,520 --> 00:45:46,980 under this thing, 1100 00:45:46,980 --> 00:45:47,300 they're the planet, 1101 00:45:47,500 --> 00:45:47,780 you know? 1102 00:45:48,100 --> 00:45:49,160 And then you can just... 1103 00:45:49,160 --> 00:45:50,020 You can test for yourself 1104 00:45:50,020 --> 00:45:51,680 and if you really feel like it, 1105 00:45:51,720 --> 00:45:52,500 you can post a bug track 1106 00:45:52,500 --> 00:45:54,900 and get your 255 TTLs of fame. 1107 00:45:59,920 --> 00:46:00,900 So that's part of the reason 1108 00:46:00,900 --> 00:46:01,340 for this talk 1109 00:46:01,340 --> 00:46:01,960 I wanted to do this 1110 00:46:01,960 --> 00:46:02,640 is so people... 1111 00:46:02,640 --> 00:46:03,180 To enable people 1112 00:46:03,180 --> 00:46:03,800 to do this themselves. 1113 00:46:06,320 --> 00:46:06,680 Yes? 1114 00:46:07,580 --> 00:46:07,940 . 1115 00:46:11,580 --> 00:46:11,940 Yes. 1116 00:46:12,040 --> 00:46:12,320 . 1117 00:46:12,320 --> 00:46:12,660 . 1118 00:46:14,520 --> 00:46:14,880 . 1119 00:46:15,900 --> 00:46:16,260 . 1120 00:46:16,260 --> 00:46:16,280 . 1121 00:46:18,660 --> 00:46:18,700 . 1122 00:46:27,820 --> 00:46:27,860 . 1123 00:46:27,860 --> 00:46:27,880 . 1124 00:46:27,880 --> 00:46:27,900 . 1125 00:46:27,900 --> 00:46:27,920 . 1126 00:46:27,920 --> 00:46:27,960 . 1127 00:46:27,960 --> 00:46:27,980 . 1128 00:46:27,980 --> 00:46:28,040 . 1129 00:46:28,040 --> 00:46:28,060 . 1130 00:46:28,060 --> 00:46:28,080 . 1131 00:46:28,080 --> 00:46:28,100 . 1132 00:46:28,100 --> 00:46:28,120 . 1133 00:46:28,120 --> 00:46:28,140 . 1134 00:46:28,140 --> 00:46:28,160 . 1135 00:46:28,160 --> 00:46:28,180 . 1136 00:46:28,180 --> 00:46:28,200 . 1137 00:46:28,200 --> 00:46:28,220 . 1138 00:46:28,220 --> 00:46:28,240 . 1139 00:46:28,240 --> 00:46:28,260 . 1140 00:46:28,260 --> 00:46:28,280 . 1141 00:46:33,060 --> 00:46:33,100 . 1142 00:46:35,020 --> 00:46:35,060 . 1143 00:46:35,360 --> 00:46:35,400 . 1144 00:46:35,400 --> 00:46:35,420 . 1145 00:46:40,460 --> 00:46:40,500 . 1146 00:47:15,080 --> 00:47:16,480 Thank you. 1147 00:47:45,560 --> 00:47:46,960 Thank you. 1148 00:48:15,080 --> 00:48:16,480 Thank you. 1149 00:48:45,080 --> 00:48:46,480 Thank you. 1150 00:49:00,440 --> 00:49:00,500 Thank you. 1151 00:49:45,080 --> 00:49:46,480 Thank you. 1152 00:50:15,080 --> 00:50:16,480 Thank you. 1153 00:50:45,560 --> 00:50:46,960 Thank you. 1154 00:51:15,560 --> 00:51:16,960 Thank you. 1155 00:51:45,080 --> 00:51:46,480 Thank you. 1156 00:52:15,560 --> 00:52:16,960 Thank you. 1157 00:52:45,080 --> 00:52:46,480 Thank you. 1158 00:53:15,080 --> 00:53:16,480 Thank you. 1159 00:53:45,560 --> 00:53:46,960 Thank you. 1160 00:54:15,080 --> 00:54:16,480 Thank you. 1161 00:54:45,560 --> 00:54:46,960 Thank you. 1162 00:55:15,560 --> 00:55:16,960 Thank you. 1163 00:55:45,560 --> 00:55:46,960 Thank you. 1164 00:55:59,900 --> 00:55:59,960 Thank you. 1165 00:56:17,480 --> 00:56:18,740 Thank you. 1166 00:56:18,740 --> 00:56:18,760 Thank you. 1167 00:56:24,240 --> 00:56:26,720 Thank you.