1 00:00:03,520 --> 00:00:10,140 Hang on in place that's happened before so I find it amusing I actually can't use wireless giving a 2 00:00:10,140 --> 00:00:16,920 talk in a wireless talk but anyway so we're here to talk about TCP IP what we can do with it what 3 00:00:16,920 --> 00:00:22,420 interesting things we can do with it one of the big deals there is actually more you can do with 4 00:00:22,420 --> 00:00:28,000 messed up packets then crash machines go these incredibly intelligent people and all they're 5 00:00:28,000 --> 00:00:34,740 doing I broke that box I got rude on it I broke it okay networks are they can actually let people 6 00:00:34,740 --> 00:00:41,760 communicate that's kind of what I'm going to try to talk about here now where I'm coming from last 7 00:00:41,760 --> 00:00:47,580 year last EFCON I talked about open SSH high-level protocol for doing really good secure 8 00:00:47,580 --> 00:00:52,920 interconnectivity getting out through out of networks coming into networks passing through 9 00:00:52,920 --> 00:00:57,480 them I pretty much worked SSH about as hard as I could work it 10 00:00:57,480 --> 00:00:57,820 and 11 00:00:58,000 --> 00:01:01,600 realized, if I'm going to go ahead and actually do something unique, I'm going to have to 12 00:01:01,600 --> 00:01:06,340 ditch SSH and go a little lower. So this talk is actually going to be a lot about layer 13 00:01:06,340 --> 00:01:11,380 two, layer three, MAC addresses, IP addresses, dealing with the screw-ups in between them. 14 00:01:11,800 --> 00:01:16,280 These are the interesting problems that I decided, first of all, that I could work on, 15 00:01:16,320 --> 00:01:23,540 and second of all, that I wanted fixed. Problems. Instant port scanning. Is it possible to discover 16 00:01:24,420 --> 00:01:29,200 instantaneously what network services have been made available, no matter how massive the network 17 00:01:29,200 --> 00:01:36,120 is? Is it possible? Can I send one packet and no new networks, no new magic stuff in the middle of 18 00:01:36,120 --> 00:01:42,380 the net, just somehow have it get to multiple destinations? Is that possible? NATless NAT. 19 00:01:42,700 --> 00:01:48,300 I do a lot of work with NAT, and I was curious. Is it possible to share a globally addressable 20 00:01:48,300 --> 00:01:53,180 IP address, something that will actually route and get somewhere, without translating in the 21 00:01:53,180 --> 00:01:53,520 end, too? 22 00:01:54,100 --> 00:02:01,700 That NAT does. All the 10 dots, or 192, 168, all the RFC 1918 IPs. And that being said, 23 00:02:01,820 --> 00:02:07,480 is it possible to get incoming connectivity into a NAT? Everyone's really happy with NAT 24 00:02:07,480 --> 00:02:10,640 when they first get it, because they're like, dude, this is cool. I've got this really 25 00:02:10,640 --> 00:02:15,040 great firewall. It has no incoming connectivity. There's nothing that needs to be hacked in. 26 00:02:15,120 --> 00:02:17,280 It barely gets out. You're not even getting in. 27 00:02:18,780 --> 00:02:23,240 Then you realize, wait, I want incoming connectivity. I want to be able to do all these things 28 00:02:23,240 --> 00:02:27,100 that the Internet was supposed to be able to do. Now how do I do it? And this talk's 29 00:02:27,100 --> 00:02:28,180 going to try to address that. 30 00:02:28,580 --> 00:02:35,560 And finally, and most fun, NAT deadlock resolution. Is it possible to establish a TCP connection 31 00:02:35,560 --> 00:02:42,320 between two hosts that are both behind NATs? And the answer should be interesting. 32 00:02:43,620 --> 00:02:51,280 How we're doing this. Restraint-free engineering. This may not be practical. This probably isn't 33 00:02:51,280 --> 00:02:51,580 secure. 34 00:02:51,920 --> 00:02:53,220 But right now, these 10 dots are going to be able to do that. 35 00:02:53,220 --> 00:02:58,040 Techniques are quite impossible, and I want to fix that. So screw the rules. Let's have 36 00:02:58,040 --> 00:02:58,400 some fun. 37 00:03:00,840 --> 00:03:04,500 Okay, now we're going to begin by talking about theory. I know theory gets really annoying. 38 00:03:04,620 --> 00:03:07,660 Trust me, it's only going to go on for a few minutes. It's for the people out there 39 00:03:07,660 --> 00:03:13,300 who might not know everything about the vagaries of TCP IP. Now, if you ever look at a sniffer 40 00:03:13,300 --> 00:03:17,640 and you're trying to learn this stuff, it's really strange, because you start off and 41 00:03:17,640 --> 00:03:21,540 the next host it went to, and it comes where it's coming back, and what protocol it's 42 00:03:21,540 --> 00:03:23,000 using to hop to the next place. 43 00:03:23,220 --> 00:03:26,800 And what protocol it's going to use to get all the way across the network. And now we're 44 00:03:26,800 --> 00:03:29,800 going to go ahead and throw in a checksum. And then where the packet came from originally, 45 00:03:29,980 --> 00:03:32,100 we're going to go back and forth. We're going to have three checksums. They're going 46 00:03:32,100 --> 00:03:35,900 to be all over the place. There's no order, it looks like. Why not have it sorted at 47 00:03:35,900 --> 00:03:39,100 least? Why not have all the checksums together? Why not have where it came from together? 48 00:03:39,940 --> 00:03:43,780 Isn't this efficient? Isn't this redundant? Well, the first thing you should probably 49 00:03:43,780 --> 00:03:51,700 think, who cares? And that's actually the point. Layering is not about what's being said. 50 00:03:51,760 --> 00:03:52,780 It's about who gives a damn. 51 00:03:53,960 --> 00:03:59,180 You have one medium, one packet that is sent from host to host. But you have many different 52 00:03:59,180 --> 00:04:04,440 contexts in which this message is understood. Listeners reconstruct the little bit of meaning 53 00:04:04,440 --> 00:04:10,440 that they personally need, and then the rest is random blob of data. Now, Ethernet does 54 00:04:10,440 --> 00:04:14,500 this, it doesn't understand IP. IP stacks understand this, it doesn't understand the 55 00:04:14,500 --> 00:04:20,000 nature of TCP. TCP stacks understand it, they don't understand SSH. The idea is the less 56 00:04:20,000 --> 00:04:22,900 you need to understand, the less code you need to write, the less you need to worry 57 00:04:22,900 --> 00:04:26,960 about, the more likely your code is actually going to do what it's supposed to do. 58 00:04:27,580 --> 00:04:33,680 The analogy I used to describe this, the post office doesn't care what you put into your 59 00:04:33,680 --> 00:04:38,320 letter. Well, hopefully, I guess things have sort of changed. The post office doesn't 60 00:04:38,320 --> 00:04:41,780 really care. They just want to see, is there money? Is there an address? Is there a return 61 00:04:41,780 --> 00:04:45,800 address? If there's insufficient postage, it's going to get sent back to the return 62 00:04:45,800 --> 00:04:51,020 address. Now, I'm sure everyone here is familiar with the classic post office hack. You have 63 00:04:51,020 --> 00:04:52,500 someone you want to send mail to for free. 64 00:04:52,900 --> 00:04:56,840 You put their address in the return address, and when you don't have sufficient postage, 65 00:04:56,940 --> 00:05:00,320 oh, it goes back to where it came from. Oh, that was where you wanted to send it. 66 00:05:00,800 --> 00:05:04,160 Now, it turns out that there's all sorts of protections against this hack. This is 67 00:05:04,160 --> 00:05:10,620 rather obvious in terms of, well, where is this letter dropped off? I'm not returning 68 00:05:10,620 --> 00:05:15,180 something dropped off in San Francisco. I'm not returning it to Dish Booty. It's not 69 00:05:15,180 --> 00:05:21,140 going to happen. Error recovery. Error recovery is interesting. 70 00:05:22,900 --> 00:05:26,480 Layer two. Layer two is the point-to-point layer. It's where I talk to the next guy 71 00:05:26,480 --> 00:05:31,980 on the wire. Errors are really quickly recoverable on layer two because the guy's right there. 72 00:05:32,080 --> 00:05:38,020 You have a direct link to him. The problem is your error checking, your checksum, your 73 00:05:38,020 --> 00:05:41,400 little value that you see if it's correct, and if it's correct, the message got through 74 00:05:41,400 --> 00:05:46,200 okay, your checksum is calculated at the same point that's actually creating the packet 75 00:05:46,200 --> 00:05:52,720 from scratch. This is problematic. The example I use to explain this. Anyone here familiar 76 00:05:52,900 --> 00:05:58,560 with the example of corporate fertilizer? Bad news happens. Really nasty shit happens. 77 00:05:59,960 --> 00:06:03,220 Someone tells it to someone else. The first thing the guy says is, I can't say shit. I'm 78 00:06:03,220 --> 00:06:06,480 going to say manure. Then that guy tells his boss, it's not manure anymore, it's fertilizer. 79 00:06:06,940 --> 00:06:11,120 That guy tells his boss, it's not fertilizer, it's farming supplies. Then the next guy tells 80 00:06:11,120 --> 00:06:15,140 his boss, it's not farming supplies, it's the stuff that life is made out of. By the 81 00:06:15,140 --> 00:06:20,520 time it gets to the CEO, this original message, shit, becomes the stuff that life is made 82 00:06:20,520 --> 00:06:21,060 out of. 83 00:06:22,900 --> 00:06:27,440 Each individual chain had correct messaging happening from point to point, but from beginning 84 00:06:27,440 --> 00:06:34,740 to end, the message was quite lost. You can't actually really depend on error checking at 85 00:06:34,740 --> 00:06:41,100 layer two. Layer four is what cares. Layer four is the CEO wants to know what the guy 86 00:06:41,100 --> 00:06:44,640 in the field says. The guy in the field said shit, doesn't matter what happened in the 87 00:06:44,640 --> 00:06:51,460 middle. At the end, CEO needs to hear, we're screwed. Layer three is the routes. It's 88 00:06:51,460 --> 00:06:52,740 all the people in the middle. 89 00:06:52,900 --> 00:06:59,960 These are devices that just pass messages. They're passing all tons of messages from 90 00:06:59,960 --> 00:07:03,240 all sorts of people. They don't give a damn what they're seeing. 91 00:07:03,520 --> 00:07:08,180 Now, in the TCPIP stack, they actually have a checksum, but if you look at the actual 92 00:07:08,180 --> 00:07:13,320 implementation of what's going on, they say, yeah, we got a checksum. The only modification 93 00:07:13,320 --> 00:07:19,060 we're doing to this packet is one decrement on the TTL value. TTL, time to live, how many 94 00:07:19,060 --> 00:07:22,820 times is this thing allowed to hop across the network? Now, we have a TTL value, so 95 00:07:22,900 --> 00:07:25,960 we make sure we don't get a routing loop. A packet just goes around and around and 96 00:07:25,960 --> 00:07:31,260 around and never stops, and the entire network falls over and dies. This tends to suck. You 97 00:07:31,260 --> 00:07:35,040 have this TTL value. It's decremented. If it ever hits zero, the packet's dropped. 98 00:07:35,460 --> 00:07:40,220 That's the only change most routers will do to a packet en route. Since it's the only 99 00:07:40,220 --> 00:07:45,520 change, they decrement the checksum by the amount that would happen if the checksum 100 00:07:45,520 --> 00:07:49,940 was correct. If they have an incorrect checksum, they'll decrement that, too. Why? Because 101 00:07:49,940 --> 00:07:52,720 they don't care about the errors. It's not personally relevant. 102 00:07:53,440 --> 00:08:00,800 This slide intentionally left blank. Oh, I should mention questions. If you have a 103 00:08:00,800 --> 00:08:05,160 question, write it down. I want your questions. I want your challenges. If it's a good question, 104 00:08:05,360 --> 00:08:13,320 you get a corona. If it's a really good question, and I got a 12-pack, really good question, 105 00:08:13,880 --> 00:08:17,620 I wrote a book or part of it, you get one of them. This is Hackproofing Your Network. 106 00:08:17,820 --> 00:08:22,520 Thanks to Syngress, they pretty much funded a lot of this work to do this research. And 107 00:08:22,520 --> 00:08:22,880 if you see a question, write it down. If it's a good question, write it down. If it's 108 00:08:22,880 --> 00:08:22,900 a really good question, write a book or part of it, you get one of them. If it's a really 109 00:08:22,900 --> 00:08:25,420 me, I get a corona, too, because I'm thirsty. 110 00:08:27,380 --> 00:08:31,180 All right, so we've gone up a little bit of stuff about layers. Let's look at what 111 00:08:31,180 --> 00:08:35,920 actually starts a TCP connection. I know. We've got to do the damn three-way handshake. 112 00:08:35,980 --> 00:08:40,400 You can't talk about TCP-IP without doing it. Really simple. I send you SYN, that means 113 00:08:40,400 --> 00:08:44,960 I want to talk to you. I get a response hack. That's SYNACK. You want to talk to me. If 114 00:08:44,960 --> 00:08:47,120 I get a RESETACK, you don't want to talk to me. 115 00:08:47,640 --> 00:08:52,520 And finally, last phase, an ACT. Cool. You want to talk to me? Okay, let's begin. That's 116 00:08:52,520 --> 00:08:57,420 all we need to do with that. Ports. Ports are basically what app to what app. Port 80 117 00:08:57,420 --> 00:09:03,100 is web. Port 143 is IMAP. Port 443 is SSL. It says, hey, I went to this machine, and 118 00:09:03,100 --> 00:09:08,340 I want this process on that machine. IP handles where we're going. Ports handle what we want 119 00:09:08,340 --> 00:09:13,280 from them. Sequence numbers. Sequence numbers are there for two purposes. First of all, 120 00:09:13,300 --> 00:09:21,760 they're really not... What the bejesus was that? No, sequence numbers are used for two 121 00:09:21,760 --> 00:09:27,000 things. First of all, they go ahead and actually let us keep track of how the data connection's 122 00:09:27,000 --> 00:09:30,540 going, let us find out eventually if we've dropped packets where we are in the stream 123 00:09:30,540 --> 00:09:35,780 and so on. They're also really, really useful to find out, is this person who's returning 124 00:09:35,780 --> 00:09:39,480 to me, did I ever talk to him in the first place? Did he have the ability to respond 125 00:09:39,480 --> 00:09:44,820 to me? It's a security feature. It's not a great one, but it has 32 bits of entropy 126 00:09:44,820 --> 00:09:50,460 that has to be matched, so it ain't too bad. Connection summary. The flag determines the 127 00:09:50,460 --> 00:09:51,740 phase. The port determines the time. The port determines the time. The port determines 128 00:09:51,760 --> 00:09:56,540 the process. The sequence secures the session. So, with all that in mind, let's begin on 129 00:09:56,540 --> 00:10:00,360 the nice, applied, useful stuff. Thank you for your patience. Instant port scanning. 130 00:10:00,600 --> 00:10:05,700 Can I find out what the hell's going on now? Not later, now. And the answer is yes. 131 00:10:06,640 --> 00:10:11,720 Practically, even securely. Check this out. So you go ahead and you have some app. I actually 132 00:10:11,720 --> 00:10:14,700 wrote this. This exists. It's 100% done. It'll be done as soon as I actually have net 133 00:10:14,700 --> 00:10:20,420 access. You bastards are destroying my net connection. All right. There's a fork in this 134 00:10:20,420 --> 00:10:21,480 thing. First fork. 135 00:10:21,760 --> 00:10:26,280 It goes ahead, sends a bunch of packets on the same local port. That's what it does. 136 00:10:26,440 --> 00:10:30,620 Doesn't keep track, doesn't remember, doesn't store any values that say, hey, I talked 137 00:10:30,620 --> 00:10:36,100 to this guy. It just sends packets. The other thing goes ahead and it's sniffing for packets 138 00:10:36,100 --> 00:10:41,180 from that local port that the other process sent. Because it's sniffing off a single local 139 00:10:41,180 --> 00:10:47,420 port, we can use libpcap kernel acceleration of the BPF. If we get a SYNAC back, we go, 140 00:10:47,480 --> 00:10:51,720 great, I got a SYNAC. Some port was up. Here's the port. Here's the host. Yay. They got a 141 00:10:51,760 --> 00:10:58,600 reset ACK. Well, the host was down. The host was up, but the port was down. You don't need 142 00:10:58,600 --> 00:11:02,940 to know it as much, but it's useful to know. Now, the first thing that should come up with 143 00:11:02,940 --> 00:11:07,460 this stateless approach, I can spoof a response. I send a message to someone. He goes, hey, 144 00:11:07,520 --> 00:11:14,240 this asshole's doing a stateless scan. I'm going to send about 800,000 responses. He 145 00:11:14,240 --> 00:11:19,900 never sent a request to. And because he's not keeping track of who he sent requests 146 00:11:19,900 --> 00:11:21,580 to, no problem. 147 00:11:21,760 --> 00:11:26,160 He's just going to think, you know, he's got all these messages. Maybe he's putting it 148 00:11:26,160 --> 00:11:30,240 into a database. Maybe he's storing it then after he gets the responses back. Maybe I 149 00:11:30,240 --> 00:11:34,100 can overflow him then. Maybe I can just make a mess out of him. Now, there is a solution. 150 00:11:35,100 --> 00:11:39,540 Anyone here familiar with the nice little things called SYNCOOKIES? SYNCOOKIES were 151 00:11:39,540 --> 00:11:46,620 developed in 1996 by that classic DJ Bernstein when SYNFLEDs became common. Well, I go ahead 152 00:11:46,620 --> 00:11:50,520 and I flood you with a whole bunch of connection requests. You set up your kernel and say, 153 00:11:50,580 --> 00:11:51,740 okay, I got a bunch of connection requests. You set up your kernel and say, okay, I got 154 00:11:51,740 --> 00:11:55,980 a bunch of connection requests. I'm going to do a bunch of responses. And the responses 155 00:11:55,980 --> 00:12:13,700 go to nowhere. Karma, karma, karma. All right. Who shouted out beers for everyone? All right. 156 00:12:13,740 --> 00:12:21,360 You up here now. Someone? I think we need a beer opener up here. I seem to have fucked 157 00:12:21,360 --> 00:12:21,560 up. 158 00:12:21,740 --> 00:12:30,260 You got one too. Yeah. Open it up. What the hell. 159 00:12:42,980 --> 00:12:48,340 Sweet. So someone observed for all the bitching everyone does about Microsoft, you notice 160 00:12:48,340 --> 00:12:51,640 everyone's running fucking PowerPoint without exception. 161 00:12:53,640 --> 00:12:59,840 Wait, wait, wait. Who's the speaker in here who's not running PowerPoint? Okay, meet me 162 00:12:59,840 --> 00:13:06,640 after, I'll buy you beers after. All right, so send cookies. Send cookies go ahead, and 163 00:13:06,640 --> 00:13:13,000 so I send out a request, and the kernel goes ahead and says, well, I'm not going to remember 164 00:13:13,000 --> 00:13:19,300 who sent me this request. But on the syn act that goes out, I'm going to put a little cryptographic 165 00:13:19,300 --> 00:13:24,700 signature that says, I sent a syn act to this guy. When the final phase, the act comes back, 166 00:13:24,840 --> 00:13:28,680 it's going to get reflected back. And when it gets reflected back, I go, hey, wait, this 167 00:13:28,680 --> 00:13:34,240 guy got my syn act, sent me back the act, I can decrypt the sequence number in the act, 168 00:13:34,400 --> 00:13:38,600 I can figure out who talked to me, I can get the state back, I can go ahead and actually 169 00:13:38,600 --> 00:13:43,340 talk to this person, even though I forgot about him earlier. It's a very elegant, very 170 00:13:43,340 --> 00:13:49,280 beautiful system. But you know, the act reflects a value from the syn act. Ah, I'm going to 171 00:13:49,300 --> 00:13:54,260 check the sequence number. But the syn act reflects a sequence number in the syn. So 172 00:13:54,260 --> 00:13:58,880 instead of tracking syn act reflections in the act, let's track syn reflections in the 173 00:13:58,880 --> 00:14:04,340 syn act. Let's put a value in the syn when we send it out that is cryptographically matched 174 00:14:04,340 --> 00:14:09,140 to the host that we sent the request to and the port that we sent the request to. When 175 00:14:09,140 --> 00:14:13,300 we get the syn act or the reset act back, we check the sequence number. If it matches, 176 00:14:13,420 --> 00:14:19,280 we talked to this guy, we sent a request to it, it's authenticated. Now, here's a little 177 00:14:19,280 --> 00:14:24,420 bit, we got an implementation, scanrand 1.0. This is an element of what I'm calling the 178 00:14:24,420 --> 00:14:29,600 bucketo kairetsu. It is my package of really screwed up TCP IP hacks that will be growing 179 00:14:29,600 --> 00:14:34,340 over time. This thing's really, really trivial. It's like 380 lines of libnet and libpcap. 180 00:14:34,560 --> 00:14:40,840 It's like a trivial md4 include, don't worry about it. No state, sends out 53 byte packets 181 00:14:40,840 --> 00:14:47,300 at 11 to 20 megabit, and it's possibly even portable from platform to platform. This is 182 00:14:47,300 --> 00:14:48,320 a screenshot of it in action. 183 00:14:49,700 --> 00:14:55,000 I don't know if you can see the deltas there, but this is a scan of about 20,000 ports throughout 184 00:14:55,000 --> 00:15:01,340 my network. The last packet came in about five seconds. When I ran this in unnamed large 185 00:15:01,340 --> 00:15:07,060 multinational corporation, yeah, I was able to say, hey, you got a class B, nice class 186 00:15:07,060 --> 00:15:15,520 B you got there. You have 8,303 web servers. That took four seconds. This is a really nice 187 00:15:15,520 --> 00:15:16,740 thing to have. 188 00:15:19,620 --> 00:15:20,240 . 189 00:15:22,200 --> 00:15:27,700 Implications, user space is cool, packet content can be overloaded. Elegant solutions came 190 00:15:27,700 --> 00:15:28,440 be reapplied. 191 00:15:29,420 --> 00:15:37,640 Next up, gorilla multicast. Is it possible to send a single packet to multiple recipients 192 00:15:37,640 --> 00:15:44,320 using today's multicast free Internet? Hell, yes. The method is fun. You go ahead. 193 00:15:44,560 --> 00:15:49,260 You link a unicast IP to a broadcast MAC address. All responses to the IP rebars will ring the 194 00:15:49,260 --> 00:15:50,960 will be broadcast throughout the subnet. 195 00:15:51,220 --> 00:15:53,200 Now, let me explain this a little slowly. 196 00:15:54,020 --> 00:15:57,520 All right, there is redundancy in between the layers 197 00:15:57,520 --> 00:15:59,720 that are on your subnet, that are on your LAN. 198 00:15:59,960 --> 00:16:03,800 At layer 2, broadcasts, packets that are sent to every port, 199 00:16:03,900 --> 00:16:07,620 even on a switch, broadcasts are always sent to all Fs. 200 00:16:07,740 --> 00:16:09,900 If it hits all Fs, it's going to be sent everywhere. 201 00:16:10,280 --> 00:16:11,640 Now, it's not mentioned in this slide, 202 00:16:11,740 --> 00:16:15,620 but there's also an Ethernet range for multicast addresses. 203 00:16:16,220 --> 00:16:18,500 I don't know the prefix off the top of my head 204 00:16:18,500 --> 00:16:19,380 that I was supposed to get it. 205 00:16:20,020 --> 00:16:23,000 But yeah, you send a packet to this MAC address, 206 00:16:23,260 --> 00:16:26,040 it will also get broadcast out to each port. 207 00:16:26,260 --> 00:16:28,140 That's assuming IGMP snooping is not on. 208 00:16:28,220 --> 00:16:28,840 Don't worry about that. 209 00:16:33,080 --> 00:16:35,160 0105E with the next bit 0. 210 00:16:35,400 --> 00:16:36,360 Thank you much. 211 00:16:36,960 --> 00:16:37,820 See you later. 212 00:16:41,180 --> 00:16:42,600 Someone open this forum. 213 00:16:43,720 --> 00:16:44,220 All right. 214 00:16:45,040 --> 00:16:46,940 Layer 3 operates a little differently. 215 00:16:47,220 --> 00:16:48,480 Layer 2 doesn't. 216 00:16:48,500 --> 00:16:50,320 It doesn't matter your subnet, same damn broadcast, 217 00:16:50,540 --> 00:16:51,540 same damn multicast. 218 00:16:51,720 --> 00:16:53,740 Layer 3, the broadcast is actually linked 219 00:16:53,740 --> 00:16:55,500 to what subnet you happen to pick. 220 00:16:55,940 --> 00:16:58,020 It's the last IP of your subnet. 221 00:16:58,180 --> 00:17:03,200 So if your subnet is 10.0.1.0 with a 255.255.250 mask, 222 00:17:04,900 --> 00:17:07,720 your broadcast IP is 10.0.1.255. 223 00:17:08,180 --> 00:17:09,560 Now, once upon a time, 224 00:17:09,640 --> 00:17:11,560 we had this nice thing called directed broadcast. 225 00:17:11,980 --> 00:17:14,380 I could send a packet to this directed broadcast IP 226 00:17:14,380 --> 00:17:16,040 and it would get to all the machines back there. 227 00:17:16,400 --> 00:17:18,300 Then some idiots wrote this tool called, 228 00:17:18,300 --> 00:17:20,960 smurf, and that got shut down really, really quickly. 229 00:17:21,760 --> 00:17:23,900 You sent one packet to a directed broadcast. 230 00:17:24,300 --> 00:17:26,160 Source address, whoever you hate. 231 00:17:26,600 --> 00:17:28,040 You send it to the directed broadcast. 232 00:17:28,320 --> 00:17:31,620 All the machines on that subnet say, oh, hey, you pinged me. 233 00:17:31,720 --> 00:17:32,720 Oh, hey, oh, hello, hello. 234 00:17:32,980 --> 00:17:34,900 Yeah, that wasn't fun. 235 00:17:35,940 --> 00:17:39,320 Well, we're kind of bringing this back only in a different way. 236 00:17:40,180 --> 00:17:44,140 Anyone here know the legal fiction behind a corporation? 237 00:17:45,800 --> 00:17:48,280 It's basically lots and lots of things. 238 00:17:48,280 --> 00:17:50,580 Lots of people, one legal identity. 239 00:17:51,120 --> 00:17:53,260 Well, it turns out we can do something really cool 240 00:17:53,260 --> 00:17:54,680 with this concept of the corporation. 241 00:17:55,020 --> 00:17:57,020 We apply it to IP addressing. 242 00:17:57,420 --> 00:18:01,380 We go ahead, we have a cloud of machines on a given subnet. 243 00:18:01,600 --> 00:18:03,660 One of them requests an IP address. 244 00:18:04,000 --> 00:18:05,600 They do it through DHCP even. 245 00:18:06,380 --> 00:18:09,780 You know what MAC address we stick on that IP 246 00:18:09,780 --> 00:18:10,520 that we request? 247 00:18:10,860 --> 00:18:14,480 We stick broadcast or we stick multicast. 248 00:18:14,640 --> 00:18:18,260 So you have a unicast IP address, normal, 10.0.1.2.1. 249 00:18:18,260 --> 00:18:21,100 And it's hardware address on the LAN. 250 00:18:21,360 --> 00:18:22,620 Now, that's broadcast. 251 00:18:22,780 --> 00:18:26,020 So when the packet comes back, it's going to everybody. 252 00:18:27,580 --> 00:18:30,320 You end up issuing Layer 4 requests against remote hosts. 253 00:18:30,480 --> 00:18:32,960 Gets comes back, unicasted at Layer 3. 254 00:18:33,000 --> 00:18:35,820 The responses are broadcasted at Layer 2. 255 00:18:35,960 --> 00:18:39,320 Ladies and gentlemen, Elegance has left the building. 256 00:18:44,000 --> 00:18:44,840 Firewall issues? 257 00:18:45,060 --> 00:18:46,760 Look, mom, multicast through NAT. 258 00:18:48,420 --> 00:18:48,860 UDP? 259 00:18:49,220 --> 00:18:50,240 No problem. 260 00:18:50,380 --> 00:18:51,460 We don't need to do any responses. 261 00:18:51,560 --> 00:18:54,300 Once the state entries open up in the UDP state table 262 00:18:54,300 --> 00:18:57,280 on that firewall, packets can just keep on coming in 263 00:18:57,280 --> 00:18:59,060 on broadcast, no problem. 264 00:18:59,920 --> 00:19:02,040 Now, I could have just stopped at UDP. 265 00:19:02,280 --> 00:19:04,160 You know, you can get your data streams, build your protocol, 266 00:19:04,320 --> 00:19:05,880 build your out-of-band stuff all you want, 267 00:19:06,000 --> 00:19:07,220 but that's no fun. 268 00:19:07,980 --> 00:19:10,240 Let's do TCP with guerrilla multicast. 269 00:19:11,740 --> 00:19:13,500 Without any listeners, the stream dies. 270 00:19:13,780 --> 00:19:14,980 There's no one to respond. 271 00:19:15,280 --> 00:19:16,260 And that's what you'd want. 272 00:19:16,600 --> 00:19:17,820 If you got one listener, 273 00:19:17,820 --> 00:19:19,460 you want the stream to operate normally. 274 00:19:19,680 --> 00:19:22,720 You know, the one listener sends back the acknowledgments as needed. 275 00:19:23,020 --> 00:19:26,960 With many listeners, only one of these guys should actually acknowledge. 276 00:19:27,160 --> 00:19:30,580 You don't want acknowledgments from every single listener. 277 00:19:30,780 --> 00:19:33,380 It's going to flood on the way out, and you know what? 278 00:19:33,420 --> 00:19:35,680 The guy on the outside network is going to find out, 279 00:19:35,800 --> 00:19:38,020 hey, I've got multiple listeners here. 280 00:19:38,420 --> 00:19:41,900 We want to be completely normal outside our subnet. 281 00:19:41,980 --> 00:19:44,140 We just all want to cooperate like, you know, 282 00:19:44,180 --> 00:19:46,680 theoretically, a corporation cooperates. 283 00:19:46,740 --> 00:19:47,800 You only have one point of cooperation. 284 00:19:47,820 --> 00:19:48,740 You only have one point of contact, ideally. 285 00:19:51,040 --> 00:19:52,700 Solution to this is random delays. 286 00:19:52,980 --> 00:19:55,360 Now, this is elegant and has some other uses as well. 287 00:19:56,300 --> 00:19:59,420 So I sniff a packet that, theoretically, I'm supposed to respond to. 288 00:20:00,180 --> 00:20:03,320 I queue the packet that I'm supposed to go ahead and respond with, 289 00:20:03,400 --> 00:20:04,900 and I wait a random amount of time. 290 00:20:05,160 --> 00:20:07,840 And I see if someone else sends the response first. 291 00:20:08,060 --> 00:20:09,540 Someone else sends the response first, 292 00:20:09,740 --> 00:20:12,860 I go ahead and I see what response he sent in case I need any state from it. 293 00:20:13,940 --> 00:20:15,260 No one else sends a response. 294 00:20:15,560 --> 00:20:16,540 I send the response. 295 00:20:17,080 --> 00:20:21,060 You're going to have 100 people doing this random delay approach. 296 00:20:21,540 --> 00:20:23,300 One of them is going to come first. 297 00:20:23,560 --> 00:20:26,720 The other 99 are going to hear the response. 298 00:20:27,160 --> 00:20:30,640 Now it turns out that you have to go ahead and send a broadcast out separate from your 299 00:20:30,640 --> 00:20:34,360 response saying, hey, everyone, I already took care of that acknowledgment. 300 00:20:34,400 --> 00:20:35,540 You guys get the next one. 301 00:20:36,020 --> 00:20:38,000 But it ends up working out pretty good. 302 00:20:39,060 --> 00:20:41,760 So you're recontextualizing layer two and layer three. 303 00:20:43,420 --> 00:20:43,860 Question. 304 00:20:44,480 --> 00:20:46,380 You know, with this, we already have one situation. 305 00:20:46,380 --> 00:20:49,940 We have a situation where one IP is standing in for many, many hosts. 306 00:20:50,280 --> 00:20:54,240 Do we have any other situations where one IP stands in for many, many hosts? 307 00:20:56,760 --> 00:20:57,240 Nah. 308 00:20:57,940 --> 00:20:58,900 Nah, it does that. 309 00:20:59,040 --> 00:20:59,420 Exactly. 310 00:21:01,640 --> 00:21:02,700 Get your fucking beer. 311 00:21:05,580 --> 00:21:09,240 That's the cheapest beer you will ever get in your, this is your fucking second beer? 312 00:21:11,540 --> 00:21:12,460 God damn it. 313 00:21:13,980 --> 00:21:14,940 Fucking drunks. 314 00:21:16,540 --> 00:21:16,900 Next. 315 00:21:16,960 --> 00:21:18,700 Splitting IPs for fun and profit. 316 00:21:18,920 --> 00:21:22,980 NAT multiplexes several hosts onto one IP address by splitting on the local port. 317 00:21:23,300 --> 00:21:25,180 The idea is we're already munging IPs. 318 00:21:25,180 --> 00:21:26,840 We're already, you know, changing the IP value. 319 00:21:26,940 --> 00:21:27,980 The host thinks it's a 10-dot. 320 00:21:28,100 --> 00:21:29,640 That 10-dot hits the outside world. 321 00:21:29,680 --> 00:21:30,540 It ain't fucking coming back. 322 00:21:30,840 --> 00:21:33,620 So we have to go ahead and put a real address that will come back. 323 00:21:34,860 --> 00:21:36,640 And so we put on the firewall address. 324 00:21:36,780 --> 00:21:37,820 And we split on local port. 325 00:21:38,240 --> 00:21:43,240 Now it turns out when we get the packet back, it comes to a local port, we send it, hopefully, 326 00:21:43,440 --> 00:21:45,940 we send it to the machine that sent the original packet in the first place. 327 00:21:47,720 --> 00:21:49,140 There's a thing called the birthday paradox. 328 00:21:49,460 --> 00:21:51,680 I'm skipping around a little, but trust me, this will make sense. 329 00:21:52,320 --> 00:21:57,580 What happens when two machines behind your NAT send out a packet with the same local port? 330 00:21:57,840 --> 00:22:01,420 Now there's a range of 65,000 ports they could pick. 331 00:22:01,700 --> 00:22:07,540 What are the odds that two hosts are going to come up with the same local port when they hit that firewall? 332 00:22:07,860 --> 00:22:09,440 Well, the odds are pretty good, actually. 333 00:22:09,960 --> 00:22:15,740 Because every time they make a random selection, there's another possibility for a collision. 334 00:22:15,940 --> 00:22:20,320 So it turns out you have two to the 16, that's 65K, two to the 8 is 256. 335 00:22:20,980 --> 00:22:29,720 One out of every 256 randomly selected local ports is going to have the exact same local port as some other one. 336 00:22:30,140 --> 00:22:30,700 And this is... 337 00:22:31,700 --> 00:22:32,260 What? 338 00:22:34,340 --> 00:22:38,160 And they're not selected randomly because most implementations suck. 339 00:22:42,860 --> 00:22:44,600 I have to stop listening to you guys. 340 00:22:45,940 --> 00:22:49,220 You actually earned that one because you actually know a real actual trade here. 341 00:22:51,040 --> 00:22:57,060 Now, we actually would like to be able to maintain same IP and same port because it gets closer to... 342 00:22:57,060 --> 00:23:01,700 We would like to maintain port because it gets us closer to end-to-end packet integrity. 343 00:23:01,940 --> 00:23:03,800 This being the huge problem in NAT. 344 00:23:03,920 --> 00:23:05,340 You're always messing around with packets. 345 00:23:07,480 --> 00:23:11,000 There are strategies to deal with if the ports are exactly the same. 346 00:23:11,220 --> 00:23:12,600 You can check sequence numbers. 347 00:23:12,800 --> 00:23:14,000 You can check the MTU. 348 00:23:14,160 --> 00:23:15,920 And later on, I'll tell you about a new release. 349 00:23:15,940 --> 00:23:18,120 It's a really cool method that involves IP timestamps. 350 00:23:19,080 --> 00:23:20,540 But check this out. 351 00:23:21,180 --> 00:23:26,820 Is it possible to share a globally addressable IP address without translating the private IPs at all? 352 00:23:27,140 --> 00:23:29,280 I was just talking about end-to-end packet correctness. 353 00:23:29,400 --> 00:23:32,420 How the hell can I do that if I'm changing around the IP address? 354 00:23:32,820 --> 00:23:35,400 And the answer is not changing around the IP address. 355 00:23:35,640 --> 00:23:36,800 I don't need to. 356 00:23:37,120 --> 00:23:40,480 Because, you know, you look at a NAT state table. 357 00:23:40,580 --> 00:23:45,160 A NAT state table lets you, given layer 4 information, derive layer 3. 358 00:23:45,940 --> 00:23:47,960 That same machine has an ARP state table. 359 00:23:48,140 --> 00:23:50,400 The ARP state table is linking layer 3. 360 00:23:50,460 --> 00:23:53,280 Given layer 3 information, find me layer 2. 361 00:23:53,680 --> 00:23:55,540 So this is MAC address translation. 362 00:23:56,240 --> 00:24:00,700 Layer 4 information gives us the combination of layer 3 and layer 2. 363 00:24:01,140 --> 00:24:04,260 Now, it turns out you can have 100 hosts with the same IP address. 364 00:24:04,500 --> 00:24:06,380 But they'll all have different MAC addresses. 365 00:24:06,720 --> 00:24:11,420 And when the outgoing packet comes out, we don't just remember the IP that it claimed. 366 00:24:11,640 --> 00:24:14,220 We also remember the hardware address that it claimed. 367 00:24:14,220 --> 00:24:18,140 And by that, we can have tons and tons of machines share the same IP. 368 00:24:18,440 --> 00:24:22,040 Your cable modem provider could give you an IP 1.2.3.4. 369 00:24:22,140 --> 00:24:25,820 You could have every single one of your machines in your house have that same IP address. 370 00:24:26,040 --> 00:24:29,940 And assuming the local port issue is done, you'd have end-to-end packet integrity. 371 00:24:34,340 --> 00:24:36,440 So I actually have an implementation of this. 372 00:24:36,560 --> 00:24:38,260 It may work, but I can't test it. 373 00:24:38,300 --> 00:24:39,220 Thank you, network people. 374 00:24:40,340 --> 00:24:42,000 It's another part of Baketo Kairatsu. 375 00:24:42,160 --> 00:24:42,840 It's called All New. 376 00:24:43,640 --> 00:24:45,980 Translates arbitrary local IP addresses. 377 00:24:46,200 --> 00:24:46,860 I don't care. 378 00:24:46,920 --> 00:24:47,980 Maybe you're using RFC 1918. 379 00:24:48,280 --> 00:24:48,920 Maybe you're not. 380 00:24:49,000 --> 00:24:51,160 Into globally routable IP addresses. 381 00:24:51,660 --> 00:24:55,280 And it does this by instead of just storing the IP source like a normal NAT table does, 382 00:24:55,400 --> 00:24:57,840 it stores the IP source, the Ethernet source. 383 00:24:58,100 --> 00:25:02,720 And just for fun, also, what Ethernet address you thought that the gateway was. 384 00:25:03,280 --> 00:25:06,620 It goes ahead and ARPs for whatever gateway you want it to ARP for. 385 00:25:07,720 --> 00:25:12,000 If the IP source is the external IP, nothing will probably need to be changed. 386 00:25:12,000 --> 00:25:14,760 Packets are going to retain their end-to-end packet integrity. 387 00:25:15,140 --> 00:25:21,180 If the IP source is the RFC 1918 IP, this is what you have in your networks right now most likely. 388 00:25:21,640 --> 00:25:22,880 Just do the same thing. 389 00:25:23,160 --> 00:25:24,820 We're already translating on 10 dots. 390 00:25:24,900 --> 00:25:26,520 We'll continue translating on 10 dots. 391 00:25:27,300 --> 00:25:32,040 If your IP happens to match that of Microsoft or Yahoo or whoever the hell you want, 392 00:25:32,240 --> 00:25:37,500 it's just another IP that if I send it out and it ain't coming back to me, the machine will handle it. 393 00:25:37,780 --> 00:25:40,580 Now this actually has some implications for hosting providers. 394 00:25:40,580 --> 00:25:42,980 We need to move IPs around all the time. 395 00:25:43,120 --> 00:25:47,660 You can go ahead and you can say, hey, I don't care what IP your host thinks it is. 396 00:25:47,920 --> 00:25:49,780 Tell me what the gateway is that you want. 397 00:25:49,920 --> 00:25:53,180 I'll act like I'm it, and I will get you next. 398 00:25:53,760 --> 00:25:54,560 It's kind of nice. 399 00:25:57,460 --> 00:25:58,140 Incoming connectivity. 400 00:25:58,560 --> 00:25:59,920 I call this the pizza protocol. 401 00:26:00,960 --> 00:26:02,220 Pizza protocol is very simple. 402 00:26:02,360 --> 00:26:04,000 Guy shows up at your apartment. 403 00:26:04,500 --> 00:26:06,100 You got a couple people living in your apartment. 404 00:26:06,700 --> 00:26:07,720 You got one door. 405 00:26:08,260 --> 00:26:09,160 Anyone own a pizza? 406 00:26:09,160 --> 00:26:12,340 Whoever responds and says, yeah, I ordered it. 407 00:26:12,380 --> 00:26:13,000 I'll pay for it. 408 00:26:13,040 --> 00:26:15,600 It was probably that guy who ordered the damn pizza. 409 00:26:16,700 --> 00:26:19,120 So you just ask everyone behind your net. 410 00:26:19,620 --> 00:26:22,280 Really, really easy if everyone has the same IP address. 411 00:26:23,000 --> 00:26:25,540 Destination to that one IP that's shared. 412 00:26:25,980 --> 00:26:28,080 And you set it to broadcast MAC. 413 00:26:28,340 --> 00:26:33,640 So every single instantiation of that IP address gets the packet. 414 00:26:33,840 --> 00:26:34,980 One of them will respond. 415 00:26:36,260 --> 00:26:38,380 For traditional NAT with RFC 1918, 416 00:26:39,160 --> 00:26:42,080 we actually need to know all the IPs that we're serving for. 417 00:26:42,580 --> 00:26:46,940 And gee, we've got this state table that talks about all the outgoing connections that have been going on. 418 00:26:47,100 --> 00:26:50,620 Maybe we can go ahead and use that to find out what IPs we're dealing with. 419 00:26:50,840 --> 00:26:55,040 Or we had that system a few minutes ago for scanning a network really quickly. 420 00:26:55,300 --> 00:26:59,220 Maybe we'll just scan every host on that subnet and see, hey, all you guys. 421 00:26:59,500 --> 00:27:00,900 Anyone hosting this packet? 422 00:27:01,140 --> 00:27:02,800 Anyone want to listen to this? 423 00:27:04,000 --> 00:27:06,540 You drop anyone who says no because they're irrelevant. 424 00:27:06,540 --> 00:27:09,440 You pass everyone that says yes. 425 00:27:09,680 --> 00:27:11,500 That's kind of the stateless approach to it. 426 00:27:11,940 --> 00:27:15,080 There are issues when multiple hosts have a web server up. 427 00:27:15,160 --> 00:27:16,560 For example, I got a web server. 428 00:27:16,620 --> 00:27:17,200 You got a web server. 429 00:27:17,280 --> 00:27:18,260 Incoming packet comes up. 430 00:27:18,400 --> 00:27:19,540 And we both say, oh, yeah. 431 00:27:19,700 --> 00:27:20,860 We both ordered the pizza. 432 00:27:21,060 --> 00:27:22,300 We both have the web server. 433 00:27:22,580 --> 00:27:24,540 And there are various heuristics you can do. 434 00:27:24,660 --> 00:27:30,240 You can give priority to the one who actually had talked to this outgoing host first. 435 00:27:31,000 --> 00:27:33,360 You can split it on port ranges. 436 00:27:33,500 --> 00:27:35,300 Connections on 1080 will go to this host. 437 00:27:35,300 --> 00:27:36,560 2080 will go to this host. 438 00:27:36,880 --> 00:27:38,060 There's all sorts of approaches. 439 00:27:38,360 --> 00:27:39,960 I haven't built them yet, but they're coming. 440 00:27:41,000 --> 00:27:44,100 A stateful approach is sort of necessary to do this right, though. 441 00:27:44,220 --> 00:27:49,120 You actually need to keep track of who ordered the pizza the last time and continue to remember that. 442 00:27:49,640 --> 00:27:51,100 Particularly with the stream management. 443 00:27:51,420 --> 00:27:56,980 It turns out you get a lot of nasty packet screw ups if you try to do it completely statelessly. 444 00:27:57,160 --> 00:27:59,940 But you have a lot of fun if you say damn you security. 445 00:28:02,460 --> 00:28:03,260 TCP splicing. 446 00:28:03,840 --> 00:28:04,540 This is fun. 447 00:28:04,540 --> 00:28:05,740 This is just fun. 448 00:28:06,300 --> 00:28:06,900 It's possible. 449 00:28:07,700 --> 00:28:08,960 TCP NAT to NAT. 450 00:28:09,040 --> 00:28:09,880 Can it be done? 451 00:28:10,240 --> 00:28:11,560 Big question to PDP. 452 00:28:11,700 --> 00:28:16,140 It was actually done because a bunch of PDP people really, really wanted it and said it couldn't be done. 453 00:28:17,260 --> 00:28:17,840 So, hey. 454 00:28:17,900 --> 00:28:18,580 Let's have some fun. 455 00:28:19,220 --> 00:28:20,180 You can do it. 456 00:28:20,300 --> 00:28:21,260 It is possible. 457 00:28:21,960 --> 00:28:22,660 It's ugly. 458 00:28:22,840 --> 00:28:24,480 It's dear God ugly. 459 00:28:24,760 --> 00:28:25,540 Here's what you do. 460 00:28:25,700 --> 00:28:27,180 You've got to convince each firewall. 461 00:28:27,400 --> 00:28:30,220 Now, in NATs, NATs are really good for outgoing connections. 462 00:28:30,420 --> 00:28:32,260 They don't like incoming so much. 463 00:28:32,800 --> 00:28:34,520 You've got to convince each firewall if they're coming. 464 00:28:34,520 --> 00:28:36,720 You've got to make sure that the other one allowed the connection. 465 00:28:36,900 --> 00:28:39,860 The other one has no problem with incoming connections. 466 00:28:40,520 --> 00:28:43,520 You have to convince both of them of this at the same time. 467 00:28:43,680 --> 00:28:46,560 And you do this by playing the layers against one another. 468 00:28:47,020 --> 00:28:50,740 Now, this is sort of how I do this as an analogy. 469 00:28:51,140 --> 00:28:52,400 Bill Gates and Larry Ellison. 470 00:28:52,580 --> 00:28:53,320 Nice guys. 471 00:28:53,560 --> 00:28:54,900 They will probably never speak to me. 472 00:28:55,920 --> 00:28:58,760 These guys can call anyone they damn well please. 473 00:28:58,860 --> 00:29:00,400 They are quite powerful in that nature. 474 00:29:01,100 --> 00:29:02,860 Their secretaries aren't going to stop them. 475 00:29:02,860 --> 00:29:05,940 But I can't go ahead and call Bill Gates. 476 00:29:06,940 --> 00:29:08,860 The secretary is going to tell me to screw off and die. 477 00:29:09,740 --> 00:29:11,840 If Bill called me, you know what? 478 00:29:12,060 --> 00:29:16,440 He wouldn't just have a one-way connection unless he was really antisocial, which I'm sure not. 479 00:29:18,380 --> 00:29:20,140 He'd actually be able to hear my voice back. 480 00:29:20,400 --> 00:29:24,800 So once he actually called me, we'd have a bidirectional communication going on. 481 00:29:24,860 --> 00:29:28,340 Even though I couldn't call him, he could call me and we'd have a bidirectional communication. 482 00:29:28,980 --> 00:29:32,460 The only asymmetry in telephone calls is in the initiation phase. 483 00:29:32,460 --> 00:29:34,540 And it's actually the same way in TCP. 484 00:29:35,060 --> 00:29:38,660 Once you get past the handshake, it's both the same way. 485 00:29:38,860 --> 00:29:40,760 So incoming is the same as outgoing. 486 00:29:40,880 --> 00:29:42,400 There's no way to differentiate the two. 487 00:29:42,880 --> 00:29:43,900 So you do a setup. 488 00:29:44,780 --> 00:29:47,540 Alice and Bob, both behind NATting firewalls. 489 00:29:47,760 --> 00:29:50,120 Firewalls allow all outgoing sessions. 490 00:29:50,280 --> 00:29:51,720 They block anything coming in. 491 00:29:51,980 --> 00:29:53,220 Now, they block with state. 492 00:29:53,540 --> 00:29:54,720 Now, this is sort of important. 493 00:29:55,780 --> 00:29:58,560 There was a time we had stateless firewalls out there. 494 00:29:58,600 --> 00:30:01,600 And the idea was we'll just block all SINs coming in. 495 00:30:01,600 --> 00:30:04,440 That way, no one will be able to send a connection coming in. 496 00:30:04,520 --> 00:30:07,660 Because every packet that comes in that wants to be a connection has to be a SIN. 497 00:30:08,120 --> 00:30:09,740 And then people realize, well, wait. 498 00:30:10,060 --> 00:30:12,460 I'll just start sending SIN acts into a network. 499 00:30:12,680 --> 00:30:15,220 Because then it'll think it's a response to an outgoing SIN. 500 00:30:15,240 --> 00:30:15,940 It'll let it in. 501 00:30:16,000 --> 00:30:19,540 And I can talk to my nice little remote shell that I've shoved up in this machine. 502 00:30:19,640 --> 00:30:20,340 Thank you very much. 503 00:30:20,860 --> 00:30:24,500 The equivalent in the real world would be me calling up Bill Gates' secretary and saying, 504 00:30:24,680 --> 00:30:25,900 oh, yeah, Bill talked to me. 505 00:30:25,920 --> 00:30:26,620 Let me speak to him again. 506 00:30:27,500 --> 00:30:31,580 And the secretary would go, well, if you wouldn't say that, if Bill didn't actually answer, 507 00:30:31,600 --> 00:30:32,560 he'd never call you in the past. 508 00:30:32,840 --> 00:30:34,700 So I'll let you talk to him. 509 00:30:35,320 --> 00:30:36,400 So you actually have state. 510 00:30:36,560 --> 00:30:38,940 You have a secretary that remembers there was an outgoing connection. 511 00:30:39,300 --> 00:30:41,080 It keeps track of all the details. 512 00:30:41,220 --> 00:30:43,200 The ports have to be opposite to each other. 513 00:30:43,280 --> 00:30:46,940 The sequence numbers have to be appropriate with the plus one offset and so on. 514 00:30:47,160 --> 00:30:48,340 Total outgoing trust. 515 00:30:48,540 --> 00:30:49,680 Zero incoming trust. 516 00:30:50,240 --> 00:30:50,960 The attempt. 517 00:30:51,320 --> 00:30:55,480 Let's look really, really slowly at what happens when Alice tries to talk to Bob. 518 00:30:55,960 --> 00:30:58,120 First thing, Alice is not directly connected to Bob. 519 00:30:58,340 --> 00:31:01,460 Remember when I was talking about the layers with, you know, hopping and jumping and whatnot? 520 00:31:01,600 --> 00:31:02,680 The Internet's big. 521 00:31:03,220 --> 00:31:06,940 On average, it's going to take about 12 hops to get from here to wherever the heck you want. 522 00:31:08,100 --> 00:31:10,140 First thing you do, you send a packet. 523 00:31:10,220 --> 00:31:16,660 Alice sends a packet to her firewall and says, hey, I want to talk to not Bob, 524 00:31:16,700 --> 00:31:19,220 because Bob doesn't have a globally addressable IP address. 525 00:31:20,140 --> 00:31:22,900 Bob's firewall has a globally addressable IP address. 526 00:31:23,140 --> 00:31:26,940 So Alice says, hi, I want to talk to, oh, IP address of Bob's firewall. 527 00:31:27,480 --> 00:31:28,900 Now this is Alice's firewall. 528 00:31:29,040 --> 00:31:31,440 And Alice's firewall is like, well, you've got a 10 dot here. 529 00:31:31,600 --> 00:31:32,980 I send this out with a 10 dot. 530 00:31:33,020 --> 00:31:33,960 It ain't coming back to me. 531 00:31:34,020 --> 00:31:37,520 So I'll go ahead and I'll change it into my globally addressable IP address. 532 00:31:38,040 --> 00:31:39,320 Now this hops across the Internet. 533 00:31:39,440 --> 00:31:39,920 Hop, hop, hop, hop. 534 00:31:40,760 --> 00:31:41,800 Hits Bob's firewall. 535 00:31:42,100 --> 00:31:44,000 Now Bob is listening for Alice. 536 00:31:44,140 --> 00:31:45,400 Bob wants to talk to Alice. 537 00:31:45,420 --> 00:31:47,560 Alice and Bob have their little affair going on and whatnot. 538 00:31:48,080 --> 00:31:49,760 But Bob's firewall ain't involved. 539 00:31:49,960 --> 00:31:52,020 Bob's firewall is the warden in this little situation. 540 00:31:52,180 --> 00:31:54,420 And Bob's firewall says, no, I ain't talking to you. 541 00:31:54,700 --> 00:31:55,260 Reset hack. 542 00:31:55,440 --> 00:31:57,560 The reset hack, hop, hop, hops across the network. 543 00:31:57,680 --> 00:31:58,600 Hits Alice's firewall. 544 00:31:59,560 --> 00:32:00,880 And that little entry. 545 00:32:00,880 --> 00:32:04,460 That little thing that said, hey, Alice tried to talk to Bob's firewall. 546 00:32:04,680 --> 00:32:05,700 We had an entry here. 547 00:32:05,800 --> 00:32:07,040 It got shut down. 548 00:32:07,560 --> 00:32:11,840 And Alice goes ahead and gets a message that says, yeah, Bob doesn't actually want to talk to you. 549 00:32:11,860 --> 00:32:12,820 Bob doesn't like you anymore. 550 00:32:13,460 --> 00:32:17,100 And if Bob tries to talk to Alice, Alice's firewall is similarly cruel. 551 00:32:17,760 --> 00:32:18,800 Now if you look at this. 552 00:32:18,820 --> 00:32:19,940 Look at this really closely. 553 00:32:20,180 --> 00:32:20,800 What's good. 554 00:32:21,240 --> 00:32:23,600 What's good is you had an entry in the firewall state table. 555 00:32:23,940 --> 00:32:25,960 I want a response from Bob's firewall. 556 00:32:26,360 --> 00:32:28,540 Bob had an entry in his firewall. 557 00:32:28,540 --> 00:32:31,620 I want a response from Alice's firewall. 558 00:32:32,040 --> 00:32:34,580 So you have two machines that want to talk to each other. 559 00:32:35,200 --> 00:32:38,300 Until the packets cross each other, hit each other's firewall, come back dead. 560 00:32:38,900 --> 00:32:39,540 So good. 561 00:32:39,960 --> 00:32:41,820 Entry in the state table waiting on a reply. 562 00:32:42,240 --> 00:32:42,680 Bad. 563 00:32:42,780 --> 00:32:44,760 The reply is screw off and die. 564 00:32:45,020 --> 00:32:47,340 Can we get the former without the latter? 565 00:32:47,400 --> 00:32:49,300 And the answer, my friends, is yes. 566 00:32:50,480 --> 00:32:54,040 You see, Alice's firewall is a little closer on the network than Bob's firewall. 567 00:32:54,340 --> 00:32:56,320 It's a little closer in terms of hops. 568 00:32:57,060 --> 00:32:58,140 So Alice goes ahead. 569 00:32:58,600 --> 00:32:59,720 Sets her TTL. 570 00:32:59,780 --> 00:33:02,160 Time to leave in hops to about 4. 571 00:33:03,200 --> 00:33:04,120 What does this do? 572 00:33:04,580 --> 00:33:06,180 Packet gets out Alice's firewall. 573 00:33:06,840 --> 00:33:08,480 And it sets the entry in the state table. 574 00:33:08,740 --> 00:33:10,120 Gets into the middle of the internet. 575 00:33:10,280 --> 00:33:11,500 And it dies. 576 00:33:12,780 --> 00:33:13,440 And that's it. 577 00:33:13,560 --> 00:33:15,060 The state table entry is left open. 578 00:33:15,460 --> 00:33:18,700 Bob's firewall never gets the chance to send the reset hack. 579 00:33:20,720 --> 00:33:21,160 So. 580 00:33:28,900 --> 00:33:29,260 Now. 581 00:33:29,900 --> 00:33:30,820 Well, hang on. 582 00:33:30,820 --> 00:33:31,360 Wait a second. 583 00:33:31,480 --> 00:33:32,280 We'll do it after. 584 00:33:32,980 --> 00:33:35,020 Now both firewalls have a hole open for each other. 585 00:33:35,940 --> 00:33:36,860 This ain't enough. 586 00:33:37,460 --> 00:33:39,900 Because neither of them can send that sin hack to each other. 587 00:33:39,940 --> 00:33:40,680 That connection response. 588 00:33:41,540 --> 00:33:42,680 They can both send sins. 589 00:33:42,880 --> 00:33:43,960 They can both send hacks. 590 00:33:44,160 --> 00:33:45,900 Neither of them can send sin hacks. 591 00:33:46,180 --> 00:33:49,580 You've got a pretty high bar you've got to reach. 592 00:33:50,160 --> 00:33:51,440 You've got to agree on what ports. 593 00:33:51,720 --> 00:33:53,500 You've got to agree on what sequence numbers. 594 00:33:53,780 --> 00:33:55,080 You've got to time it right. 595 00:33:55,300 --> 00:33:56,900 You've got to know that this is going on. 596 00:33:56,920 --> 00:33:58,120 That the other side is trying to do this. 597 00:33:58,120 --> 00:33:58,840 At the same time. 598 00:33:58,920 --> 00:34:00,040 And the answer is. 599 00:34:00,200 --> 00:34:01,980 You have a handshake only connection broker. 600 00:34:02,300 --> 00:34:04,440 All it does is do the session set up. 601 00:34:04,500 --> 00:34:05,540 Once it's out of the way. 602 00:34:05,600 --> 00:34:05,980 It's gone. 603 00:34:07,840 --> 00:34:10,040 It basically manages the two. 604 00:34:10,840 --> 00:34:13,880 Alice and Bob conspire with the connection broker. 605 00:34:14,480 --> 00:34:14,940 Say. 606 00:34:15,080 --> 00:34:15,460 Hey. 607 00:34:15,820 --> 00:34:17,160 I sent this packet. 608 00:34:17,320 --> 00:34:18,220 With this information. 609 00:34:18,940 --> 00:34:20,100 I'm sending it to you. 610 00:34:20,240 --> 00:34:21,960 You see how the translation happens. 611 00:34:22,420 --> 00:34:22,880 Bob. 612 00:34:22,940 --> 00:34:24,280 I'm sending this to you connection broker. 613 00:34:24,640 --> 00:34:26,160 This is what I originally sent. 614 00:34:26,300 --> 00:34:27,820 Compare what I originally sent. 615 00:34:27,820 --> 00:34:29,220 With what the connection broker. 616 00:34:29,480 --> 00:34:31,480 With what my firewall sent to you. 617 00:34:32,720 --> 00:34:33,800 Between this process. 618 00:34:33,880 --> 00:34:35,260 The connection broker can go ahead. 619 00:34:35,560 --> 00:34:36,180 And learn. 620 00:34:36,300 --> 00:34:37,320 How the firewall. 621 00:34:37,560 --> 00:34:39,080 Is doing its munging. 622 00:34:39,400 --> 00:34:40,860 Maybe it's doing the best effort. 623 00:34:41,260 --> 00:34:43,060 Maybe it's incrementing from a fixed counter. 624 00:34:43,300 --> 00:34:45,180 Maybe it's using random local ports. 625 00:34:45,240 --> 00:34:45,900 And doing translation. 626 00:34:47,300 --> 00:34:49,680 There's all sorts of different approaches that can be done. 627 00:34:49,860 --> 00:34:51,520 On the packet layer munging. 628 00:34:52,660 --> 00:34:54,220 Connection broker needs to find out. 629 00:34:54,260 --> 00:34:56,500 Because the connection broker needs to synchronize. 630 00:34:56,500 --> 00:34:59,260 And cause Alice and Bob's firewalls. 631 00:34:59,280 --> 00:35:00,640 To achieve port level convergence. 632 00:35:00,960 --> 00:35:02,680 And sequence level convergence. 633 00:35:03,960 --> 00:35:05,440 This is the process to do it. 634 00:35:05,520 --> 00:35:07,020 I ain't going to explain it in detail. 635 00:35:07,260 --> 00:35:08,660 Bug me later if you want the description. 636 00:35:09,000 --> 00:35:10,840 But it ends up actually working out. 637 00:35:11,840 --> 00:35:14,280 Alice and Bob can conspire with the connection broker. 638 00:35:14,400 --> 00:35:15,920 To determine the pattern by which. 639 00:35:16,000 --> 00:35:17,740 Their individual firewalls. 640 00:35:17,740 --> 00:35:19,660 Are munging the port and sequence information. 641 00:35:20,280 --> 00:35:21,380 Once that happens. 642 00:35:21,440 --> 00:35:23,520 They can go ahead and counter the munging. 643 00:35:23,620 --> 00:35:25,880 Such that they achieve convergence in their ports. 644 00:35:25,880 --> 00:35:27,840 And in their information. 645 00:35:28,220 --> 00:35:30,000 Now I will actually accept the question now. 646 00:35:30,020 --> 00:35:30,280 Go ahead. 647 00:35:30,460 --> 00:35:31,980 Come up here and speak into the mic. 648 00:35:35,220 --> 00:35:39,320 Does this work even if it randomly selects the source port? 649 00:35:39,980 --> 00:35:40,900 Source port. 650 00:35:41,720 --> 00:35:42,240 Yes. 651 00:35:42,520 --> 00:35:43,900 It depends on. 652 00:35:45,360 --> 00:35:46,940 If one side. 653 00:35:47,160 --> 00:35:50,580 If both sides absolutely cannot be controlled for. 654 00:35:50,940 --> 00:35:51,920 It's problematic. 655 00:35:52,400 --> 00:35:55,140 Remember I was telling you about the birthday paradox. 656 00:35:55,880 --> 00:35:58,140 You have two hosts that are trying to make random selections. 657 00:35:58,760 --> 00:35:59,820 Well what you do is. 658 00:36:00,020 --> 00:36:02,460 Alice makes 256 attempts to Bob. 659 00:36:02,620 --> 00:36:04,920 Bob makes 256 attempts to Alice. 660 00:36:05,180 --> 00:36:08,040 And even though they're both doing random local ports. 661 00:36:08,240 --> 00:36:10,740 You're going to have a collision by the birthday paradox. 662 00:36:11,040 --> 00:36:13,060 And you go ahead and you embed which one. 663 00:36:13,220 --> 00:36:14,200 Had the collision. 664 00:36:14,520 --> 00:36:16,080 Because you have to know which session to continue. 665 00:36:16,320 --> 00:36:18,540 You embed that in the IP ID field. 666 00:36:18,660 --> 00:36:19,540 In the IP frame. 667 00:36:19,760 --> 00:36:21,680 Firewalls don't mess with the IP ID. 668 00:36:21,840 --> 00:36:24,580 Because they have no reason to possibly do it. 669 00:36:24,600 --> 00:36:25,260 Until now. 670 00:36:25,940 --> 00:36:26,500 Yes. 671 00:36:26,740 --> 00:36:29,480 Both sides can do random local ports. 672 00:36:29,980 --> 00:36:32,300 Randomized sequence numbers which a few firewalls do. 673 00:36:32,400 --> 00:36:34,740 Can't really be dealt with if both sides do it. 674 00:36:34,860 --> 00:36:38,360 Because now you have 32 bits of entropy instead of 16. 675 00:36:38,680 --> 00:36:40,480 And 2 to the 16 is 65K. 676 00:36:40,680 --> 00:36:44,080 You're not getting away with 65,000 packets on a regular basis. 677 00:36:44,860 --> 00:36:46,860 Now I have to say. 678 00:36:47,320 --> 00:36:48,820 This is really academic. 679 00:36:49,140 --> 00:36:51,300 There are such easier strategies to use. 680 00:36:51,940 --> 00:36:53,860 You can source route through the connection broker. 681 00:36:54,140 --> 00:36:55,860 This cleans up so, so much. 682 00:36:55,860 --> 00:36:59,480 You get absolute information on what's going on. 683 00:36:59,540 --> 00:37:00,700 On the genuine connection. 684 00:37:02,360 --> 00:37:05,780 And it turns out you don't even need to use any true packet layer stuff. 685 00:37:06,200 --> 00:37:07,400 Because you can actually. 686 00:37:07,560 --> 00:37:09,040 As soon as the connection is established. 687 00:37:09,340 --> 00:37:12,680 Both sides with normal socket options can draw the source route. 688 00:37:14,040 --> 00:37:16,520 Most of you have noticed probably games work right now. 689 00:37:16,720 --> 00:37:17,600 They're using UDP. 690 00:37:17,700 --> 00:37:19,940 Using a really simple and trivial method. 691 00:37:20,740 --> 00:37:22,620 They just use opposite ports. 692 00:37:22,960 --> 00:37:24,720 And they just fire them at each other. 693 00:37:24,720 --> 00:37:25,620 And eventually. 694 00:37:26,140 --> 00:37:28,220 The outgoing port from the other. 695 00:37:28,300 --> 00:37:31,580 Is perceived as a response to the outgoing port from the first. 696 00:37:32,940 --> 00:37:33,420 Okay. 697 00:37:33,480 --> 00:37:34,780 Let me actually explain this for a second. 698 00:37:39,740 --> 00:37:40,880 Alice and Bob. 699 00:37:41,280 --> 00:37:43,640 Imagine they get their clocks perfectly synced up. 700 00:37:43,820 --> 00:37:46,880 They both send a packet out to each other's firewalls. 701 00:37:46,900 --> 00:37:47,880 First thing it does. 702 00:37:48,000 --> 00:37:48,960 On the clock. 703 00:37:49,220 --> 00:37:51,560 Is it hits each of their local firewalls. 704 00:37:51,580 --> 00:37:52,580 Their local firewalls say. 705 00:37:52,680 --> 00:37:54,220 Hey I've got an outgoing packet on UDP. 706 00:37:54,720 --> 00:37:55,260 Port 5000. 707 00:37:55,540 --> 00:37:57,840 Waiting for a response on port 5000. 708 00:37:58,640 --> 00:38:00,320 They pass by each other on the net. 709 00:38:00,440 --> 00:38:01,040 Both sides. 710 00:38:01,420 --> 00:38:02,620 Hits each other firewall. 711 00:38:02,800 --> 00:38:03,520 The other firewall is like. 712 00:38:03,620 --> 00:38:05,860 Well I was waiting for a response on port 5000. 713 00:38:05,960 --> 00:38:06,960 From port 5000. 714 00:38:07,260 --> 00:38:07,880 Hey I got it. 715 00:38:08,060 --> 00:38:08,620 The other side. 716 00:38:08,660 --> 00:38:10,000 Hey I was waiting for a response on 5000. 717 00:38:10,120 --> 00:38:11,000 From port 5000. 718 00:38:11,360 --> 00:38:12,260 Hey I got it. 719 00:38:12,360 --> 00:38:16,540 Both sides perceive the other person's first packet as a response. 720 00:38:17,040 --> 00:38:18,200 You can do this with UDP. 721 00:38:18,300 --> 00:38:20,820 Because UDP has like no complexity to it at all. 722 00:38:21,100 --> 00:38:23,400 This is far less fun than TCP splicing though. 723 00:38:24,260 --> 00:38:24,700 All right. 724 00:38:24,700 --> 00:38:25,880 New stuff. 725 00:38:26,220 --> 00:38:29,540 This is nuisance black hat for those who are here who actually went to black hat. 726 00:38:30,140 --> 00:38:31,720 TTL based firewall analysis. 727 00:38:32,600 --> 00:38:35,320 I emit a SYN from my firewall. 728 00:38:35,760 --> 00:38:38,460 I emit this SYN and it has a TTL of 4. 729 00:38:38,880 --> 00:38:41,000 It hits my firewall and it gets translated. 730 00:38:41,280 --> 00:38:42,820 It gets its source address changed. 731 00:38:43,220 --> 00:38:44,580 Hops a little bit on the internet. 732 00:38:45,240 --> 00:38:45,720 Dies. 733 00:38:45,960 --> 00:38:47,180 Now I said it died. 734 00:38:47,340 --> 00:38:49,000 But there's actually a packet that returns. 735 00:38:49,260 --> 00:38:50,720 It's an ICMP time exceeded. 736 00:38:50,960 --> 00:38:53,740 And this thing isn't just a time exceeded. 737 00:38:53,740 --> 00:38:58,460 It contains a copy of the original packet that spawned the failure. 738 00:38:58,760 --> 00:39:03,400 Now the firewall, when it sends the packet back to you, it's going to contain the information 739 00:39:03,400 --> 00:39:04,320 that you had. 740 00:39:04,440 --> 00:39:07,680 You know, I'm 10 dot and here's my information. 741 00:39:08,080 --> 00:39:11,500 So the ICMP error is going to come back to the 10 dot. 742 00:39:11,680 --> 00:39:16,860 Ah, but the ICMP data, the ICMP data is not going to be translated because who's looking 743 00:39:16,860 --> 00:39:17,660 at ICMP data? 744 00:39:18,500 --> 00:39:21,700 So you can actually discover how your firewall is munching your data stream. 745 00:39:21,820 --> 00:39:23,220 You can discover your internal IP. 746 00:39:23,220 --> 00:39:24,120 And come up here. 747 00:39:32,240 --> 00:39:33,620 And I love the fur. 748 00:39:34,340 --> 00:39:35,020 Thank you. 749 00:39:35,260 --> 00:39:42,860 I don't believe that OpenBSD firewalls can be probed with this because it rewrites the ICMP data. 750 00:39:43,980 --> 00:39:46,080 This is because Theo is a paranoid motherfucker. 751 00:40:00,020 --> 00:40:01,300 All right. 752 00:40:02,240 --> 00:40:03,520 God damn it, Theo. 753 00:40:05,880 --> 00:40:07,580 Check this out. 754 00:40:07,780 --> 00:40:09,420 So I hate stateful programming. 755 00:40:09,740 --> 00:40:10,840 Stateful programming sucks. 756 00:40:11,960 --> 00:40:13,320 Buffers, you've got to search them. 757 00:40:13,400 --> 00:40:14,560 You've got to allocate them. 758 00:40:14,820 --> 00:40:17,040 You've got to overflow them if your name is Gobbles. 759 00:40:17,980 --> 00:40:18,620 Gobbles rules. 760 00:40:18,920 --> 00:40:19,600 Gobbles rules. 761 00:40:19,800 --> 00:40:20,300 God damn. 762 00:40:21,560 --> 00:40:23,500 NAT normally needs to be stateful. 763 00:40:23,640 --> 00:40:27,320 You've got to remember when you get the packet back, who the hell am I supposed to return 764 00:40:27,320 --> 00:40:28,080 this packet to? 765 00:40:30,800 --> 00:40:35,060 In NAT, not only do you need to know who the IP is you're returning it to, you also 766 00:40:35,060 --> 00:40:37,260 need to know the hardware address you're returning it to. 767 00:40:37,500 --> 00:40:40,340 So you actually need to know something about 10 bytes. 768 00:40:42,300 --> 00:40:42,960 Stateless NAT. 769 00:40:43,140 --> 00:40:43,960 Is this possible? 770 00:40:46,460 --> 00:40:47,300 Jason Spence. 771 00:40:47,860 --> 00:40:48,420 He's here. 772 00:40:48,520 --> 00:40:49,560 He's the guy in the red hat. 773 00:40:49,560 --> 00:40:53,860 He actually proved to me that one of my random theories was right. 774 00:40:54,100 --> 00:40:54,460 Yeah. 775 00:40:54,960 --> 00:40:56,740 It's called IP timestamps. 776 00:40:56,960 --> 00:40:59,540 Is there anyone in this room who actually knows what IP timestamps are? 777 00:41:00,280 --> 00:41:00,720 Okay. 778 00:41:00,980 --> 00:41:01,420 Cool. 779 00:41:01,580 --> 00:41:02,020 You're awesome. 780 00:41:02,600 --> 00:41:03,600 Check this out. 781 00:41:04,220 --> 00:41:06,880 In mode three, I create an IP option. 782 00:41:07,060 --> 00:41:08,820 And yeah, I know some firewalls block them. 783 00:41:09,220 --> 00:41:09,840 Screw you. 784 00:41:10,160 --> 00:41:10,720 All right. 785 00:41:10,800 --> 00:41:12,260 So I create an IP option. 786 00:41:12,420 --> 00:41:17,820 The IP option has a 32-byte header that describes what it is. 787 00:41:18,720 --> 00:41:24,520 Now you can go ahead, specify an IP, specify a space for a timestamp, specify another 788 00:41:24,520 --> 00:41:27,000 IP, specify another space for a timestamp. 789 00:41:27,080 --> 00:41:30,160 You can do this up to four times for up to 32 bytes of data. 790 00:41:30,720 --> 00:41:38,700 Now, in normal usage, if any router along the path has this IP address, it'll rewrite 791 00:41:38,700 --> 00:41:43,440 the value in the timestamp place with its actual timestamp. 792 00:41:43,620 --> 00:41:47,020 And if it's not, it'll just forward it on to the next host unmolested. 793 00:41:47,720 --> 00:41:50,100 Assuming, you know, maybe someone else already did its rewrite. 794 00:41:50,940 --> 00:41:53,540 This passes all the way through to the final destination. 795 00:41:54,000 --> 00:41:55,700 The final destination gets this packet. 796 00:41:55,860 --> 00:41:59,060 Well, my IP doesn't match any of this stuff in the IP options. 797 00:41:59,280 --> 00:42:01,540 I'm just going to send the entire batch on back. 798 00:42:01,920 --> 00:42:10,160 Now, if you look here, I can go ahead and specify arbitrary data in my IP option timestamp 799 00:42:10,160 --> 00:42:16,720 field up to 32 bytes worth per packet that will be returned with every single packet 800 00:42:17,020 --> 00:42:17,880 that comes back to me. 801 00:42:18,460 --> 00:42:21,400 And when you look at that, I have 32 bytes. 802 00:42:21,460 --> 00:42:22,100 I only needed 10. 803 00:42:22,420 --> 00:42:28,020 So every single packet can contain the route back through my NAT into the actual hardware 804 00:42:28,580 --> 00:42:30,240 machine that it needs to be on. 805 00:42:30,400 --> 00:42:31,980 I have no lookups. 806 00:42:32,220 --> 00:42:33,660 I can build gigabit NAT now. 807 00:42:33,980 --> 00:42:35,640 No state, nothing to overflow. 808 00:42:35,880 --> 00:42:36,700 Screw you, gobbles. 809 00:42:43,020 --> 00:42:46,480 Finally, it wouldn't be a talk at DEF CON if I didn't have at least some attack. 810 00:42:46,480 --> 00:42:49,340 All this stuff's been useful, things you can do to build connectivity. 811 00:42:50,060 --> 00:42:53,940 You can actually do something sort of nasty with the TCP splicing stuff. 812 00:42:54,720 --> 00:43:00,880 You can forge arbitrary data streams into your network that appear to come from any 813 00:43:00,880 --> 00:43:01,780 IP that you want. 814 00:43:02,120 --> 00:43:03,340 Now, here's how you do it. 815 00:43:03,700 --> 00:43:10,100 You have Alice make a TCP connection, make a TTL limited connection to quote unquote 816 00:43:10,100 --> 00:43:10,500 Yahoo. 817 00:43:11,260 --> 00:43:14,000 Not actually going to reach Yahoo because it's TTL limited. 818 00:43:14,180 --> 00:43:15,940 But Alice is going to set the TTL low. 819 00:43:16,480 --> 00:43:17,440 There's an outgoing connection. 820 00:43:17,780 --> 00:43:22,880 Any IDS in the way, intrusion detection system or logger or whatnot, it's going to see this 821 00:43:22,880 --> 00:43:25,880 and it's going to say, hey, Alice here is trying to talk to Yahoo there. 822 00:43:26,380 --> 00:43:31,160 And most likely isn't going to go ahead and use the ICMP to say that connection died 823 00:43:31,160 --> 00:43:33,200 because that packet never actually got there. 824 00:43:34,720 --> 00:43:39,160 In normal TCP splicing, we stop the TTLing after the initial packet. 825 00:43:39,400 --> 00:43:40,640 In this case, we don't. 826 00:43:40,900 --> 00:43:45,640 Every single packet between Alice and quote unquote Yahoo is going to be TTL limited. 827 00:43:45,640 --> 00:43:50,500 But Alice is going to give Charlie, the connection broker from the early example, Alice is 828 00:43:50,500 --> 00:43:56,780 going to give Charlie all sorts of information about exactly how she's talking to Yahoo. 829 00:43:57,100 --> 00:44:02,020 And Charlie is going to reply with a spoofed packet as if he was Yahoo. 830 00:44:02,420 --> 00:44:10,340 So Charlie can just throw in a stream of data on a stateful connection that looks indistinguishable 831 00:44:10,340 --> 00:44:12,740 from a genuine connection from Yahoo. 832 00:44:12,900 --> 00:44:14,500 And it can be any amount of data. 833 00:44:14,500 --> 00:44:18,460 Because every single time Alice responds with an ACK, it's TTL limited. 834 00:44:19,820 --> 00:44:23,320 And Charlie's kept in sync because there's a side channel over to Charlie. 835 00:44:23,660 --> 00:44:24,780 It's really messy. 836 00:44:25,040 --> 00:44:31,940 But if your logging system and your firewall is not logging ICMP, there's no evidence. 837 00:44:32,920 --> 00:44:40,040 So bottom line, really interesting things are possible with ICMP, with TCP, with IP, with Ethernet, 802.3. 838 00:44:40,140 --> 00:44:42,980 And oh, by the way, 802.11 is coming soon. 839 00:44:44,800 --> 00:44:46,300 Yeah, there's fun things to do. 840 00:44:46,540 --> 00:44:48,480 Everyone, get up here and get some beer. 841 00:44:48,840 --> 00:44:53,220 Well, first thing, you've got to impress me if you want the beer. 842 00:44:53,440 --> 00:44:56,800 Second thing, if you really impress me, you get a book, Hackproofing Your Network. 843 00:44:56,960 --> 00:44:58,200 Plug, plug, plug, plug, plug. 844 00:44:58,880 --> 00:44:59,580 Who's up first? 845 00:44:59,880 --> 00:45:00,680 Start walking up. 846 00:45:00,740 --> 00:45:02,180 Set up a line right there and right there. 847 00:45:03,320 --> 00:45:05,580 Because I'd like everyone to actually hear what's going on. 848 00:45:16,520 --> 00:45:17,500 This guy's first. 849 00:45:18,140 --> 00:45:19,060 Talk to the crowd. 850 00:45:23,640 --> 00:45:24,540 Testing, testing. 851 00:45:24,720 --> 00:45:25,060 All right. 852 00:45:28,860 --> 00:45:29,580 You're next. 853 00:45:30,220 --> 00:45:42,600 With your multiplexed address translation, you said that you had to basically split up connections on incoming ports like 20-22, 30-22, so on and so forth, from multiple incoming connections to multiple hosts on the inside. 854 00:45:42,980 --> 00:45:44,480 However, how do you do that? 855 00:45:44,480 --> 00:45:52,120 How do you get around the fact that SSH is constantly keeping certificates of hosts and constantly telling you that you've got a man-in-the-middle attack? 856 00:45:52,380 --> 00:45:53,080 Ah, yes. 857 00:45:53,300 --> 00:45:57,260 The whole problem about the fact that SSH actually cares about hosts and not ports. 858 00:45:57,720 --> 00:46:00,180 I can actually answer this because I know SSH quite well. 859 00:46:00,520 --> 00:46:01,640 I'm using a host alias. 860 00:46:01,960 --> 00:46:05,020 You say what you never connect, you never want to attach. 861 00:46:05,280 --> 00:46:10,480 If you have multiple hosts at the same IP, the IP address is no longer an analog to the host. 862 00:46:10,700 --> 00:46:13,480 So when you make your SSH connection, you say .0. 863 00:46:14,360 --> 00:46:14,460 .0. 864 00:46:14,480 --> 00:46:14,660 .0. 865 00:46:14,660 --> 00:46:16,220 host alias whatever you're looking for. 866 00:46:16,420 --> 00:46:21,220 And that will go ahead and say, in this case, I'm expecting the key for this back end host. 867 00:46:21,320 --> 00:46:23,280 And I'm expecting the key for that back end host. 868 00:46:23,440 --> 00:46:24,220 So that will work. 869 00:46:25,120 --> 00:46:25,720 All right. 870 00:46:25,860 --> 00:46:26,440 You're up. 871 00:46:28,280 --> 00:46:35,500 With OpenBSD, I believe you can turn off the option for rewriting all the AACNP stuff with sysctl. 872 00:46:35,700 --> 00:46:39,020 As far as I remember, there is a sysctl option for that. 873 00:46:39,500 --> 00:46:42,400 If you can e-mail it to me, I would most appreciate it. 874 00:46:42,800 --> 00:46:43,580 Thank you much. 875 00:46:43,580 --> 00:46:44,220 I'd rather a book. 876 00:46:44,580 --> 00:46:45,040 Huh? 877 00:46:45,220 --> 00:46:46,020 I'd rather a book. 878 00:46:46,660 --> 00:46:47,920 I'll tell you maybe later. 879 00:46:49,560 --> 00:46:50,160 Go ahead. 880 00:46:50,880 --> 00:46:57,500 When you have your virtual NAT with basically batting on layer 2, 881 00:46:57,680 --> 00:47:02,060 so all of your hosts are sharing a globally addressable IP, 882 00:47:04,660 --> 00:47:08,180 how do you communicate between hosts inside of that? 883 00:47:08,260 --> 00:47:10,020 It seems like you're going to need a layer 2 DNS. 884 00:47:10,420 --> 00:47:10,760 No, no, no. 885 00:47:10,800 --> 00:47:11,560 This gets evil. 886 00:47:11,560 --> 00:47:16,920 You can actually have them all have 10-dot addresses, 887 00:47:18,280 --> 00:47:20,900 but the NAT all-loot would do it. 888 00:47:21,160 --> 00:47:23,280 So in other words, it would go ahead and say, 889 00:47:24,080 --> 00:47:26,800 this 64 host also has an address of 10-dot. 890 00:47:26,960 --> 00:47:28,480 10-dot's outside the subnet, 891 00:47:28,580 --> 00:47:30,520 so it's going to go ahead and hit the machine in the middle. 892 00:47:30,700 --> 00:47:32,020 The machine in the middle is going to say, 893 00:47:32,160 --> 00:47:34,880 well, 10-dot goes ahead and maps to this 64-dot. 894 00:47:35,080 --> 00:47:38,200 So the answer is they can bounce off the guy 895 00:47:38,200 --> 00:47:39,740 that would normally get them to the outside world. 896 00:47:40,240 --> 00:47:41,540 And it actually can work. 897 00:47:41,560 --> 00:47:49,560 Could you also instead just under Linux, say, alias them? 898 00:47:49,800 --> 00:47:52,360 Assign multiple IPs to the same Ethernet adapter? 899 00:47:52,520 --> 00:47:56,120 It depends on whether or not you want to mess with the hosts. 900 00:47:56,440 --> 00:48:00,240 See, there's a lot of situations where you are allowed to modify this machine, 901 00:48:00,300 --> 00:48:00,940 but not that one. 902 00:48:01,000 --> 00:48:03,200 You are allowed to modify this network, but not that one. 903 00:48:03,700 --> 00:48:06,640 Yes, an IP alias would work perfectly as well. 904 00:48:06,980 --> 00:48:09,420 But if you can't modify it on that level, 905 00:48:09,540 --> 00:48:11,460 you can go ahead and modify it at the, 906 00:48:11,460 --> 00:48:12,340 at the perspective of the gateway. 907 00:48:13,140 --> 00:48:14,020 But good thinking. 908 00:48:15,500 --> 00:48:16,220 Okay, why not? 909 00:48:16,520 --> 00:48:17,200 Thank you. 910 00:48:17,300 --> 00:48:17,920 And a beer. 911 00:48:19,020 --> 00:48:19,500 Sweet! 912 00:48:21,820 --> 00:48:23,600 For the connection brokering, 913 00:48:26,280 --> 00:48:29,820 couldn't you have both Alice and Bob spoof as if they were the connection broker? 914 00:48:32,160 --> 00:48:36,400 The problem is that the connection broker is never supposed to actually be part of the session. 915 00:48:36,660 --> 00:48:39,320 Right, he isn't after he tells both Alice and Bob, 916 00:48:39,420 --> 00:48:40,760 your next sequence number is. 917 00:48:42,160 --> 00:48:45,580 And then both Alice and Bob take over spoofing as if they're the connection broker. 918 00:48:45,720 --> 00:48:48,120 So, you're saying, no, no, no, no, Alice and Bob can't spoof packets. 919 00:48:48,320 --> 00:48:49,940 They're behind stateful firewalls. 920 00:48:49,940 --> 00:48:51,800 They're behind things that are really checking. 921 00:48:52,000 --> 00:48:55,260 Alice and Bob have to have entirely legitimate traffic. 922 00:48:55,680 --> 00:48:59,420 It's just, they have two entirely legitimate streams of traffic. 923 00:48:59,700 --> 00:49:04,480 One of them's going to, um, one of them's going to the connection broker. 924 00:49:04,700 --> 00:49:08,100 The other one's going to Bob's firewall and, you know, maybe not getting there. 925 00:49:08,280 --> 00:49:11,380 And low TTLs are legitimate traffic because of, 926 00:49:11,460 --> 00:49:12,020 they have trace routes. 927 00:49:12,360 --> 00:49:13,380 But good thinking, though. 928 00:49:13,620 --> 00:49:13,860 Thank you. 929 00:49:14,960 --> 00:49:16,320 All right, you go ahead. 930 00:49:16,700 --> 00:49:17,760 We just didn't hear. 931 00:49:18,220 --> 00:49:19,340 Oh, my apologies. 932 00:49:21,580 --> 00:49:26,320 With IP address defense ARPs boot up with multiple addresses the same. 933 00:49:26,660 --> 00:49:27,840 Do you have a solution for that? 934 00:49:29,580 --> 00:49:30,480 Windows will bitch. 935 00:49:30,660 --> 00:49:33,780 And I think there's a registry hack that gets rid of that bitching. 936 00:49:33,920 --> 00:49:36,260 If not, oh well, you can't do this with Windows. 937 00:49:36,520 --> 00:49:37,260 There's another option. 938 00:49:38,460 --> 00:49:41,320 You do the same thing you do when doing layer four load balance. 939 00:49:42,160 --> 00:49:46,900 Put a loopback, I forget the exact syntax, 940 00:49:47,000 --> 00:49:50,260 but you essentially put a loopback address in place mapping to that IP. 941 00:49:50,480 --> 00:49:54,440 That disables ARP responses to anybody making ARP requests on that IP. 942 00:49:55,340 --> 00:49:56,460 And just do that on. 943 00:49:57,760 --> 00:49:59,580 Fucking A. Talk to me after. 944 00:49:59,980 --> 00:50:01,500 Fucking A. Yeah. 945 00:50:01,720 --> 00:50:05,180 Now you definitely would have to have your 10 dot address for inter-host communication 946 00:50:05,180 --> 00:50:08,040 because you wouldn't be able to communicate with anyone else on that IP. 947 00:50:08,060 --> 00:50:08,300 All right. 948 00:50:08,420 --> 00:50:10,820 But the host would actually think it has the external IP? 949 00:50:11,480 --> 00:50:12,300 Is what you're saying? 950 00:50:12,480 --> 00:50:12,600 Yeah. 951 00:50:12,680 --> 00:50:14,100 It just won't ARP response to it. 952 00:50:14,600 --> 00:50:15,100 Thank you. 953 00:50:16,760 --> 00:50:17,300 Thank you. 954 00:50:17,300 --> 00:50:17,600 Drive through. 955 00:50:19,060 --> 00:50:19,600 All right. 956 00:50:19,920 --> 00:50:20,460 I'm sorry. 957 00:50:20,540 --> 00:50:22,040 I think I have two questions. 958 00:50:22,320 --> 00:50:23,380 Oh, hell yeah. 959 00:50:23,400 --> 00:50:24,920 Now, this is the man that comes prepared. 960 00:50:25,280 --> 00:50:26,000 One of them is a recommendation. 961 00:50:26,480 --> 00:50:26,800 All right. 962 00:50:26,880 --> 00:50:27,420 I don't know. 963 00:50:28,220 --> 00:50:33,640 Instead of doing a TTL die, instead of doing a TTL time to live that's going to time out. 964 00:50:33,740 --> 00:50:34,100 All right. 965 00:50:34,100 --> 00:50:39,440 Could you do an invalid TCP checksum to have the same packet die and get removed from the stream? 966 00:50:39,960 --> 00:50:41,440 Well, TCP is really only going to get removed from the stream. 967 00:50:41,440 --> 00:50:41,940 Well, here's the deal. 968 00:50:41,960 --> 00:50:43,480 The routers don't care about the checksums. 969 00:50:43,520 --> 00:50:43,900 Remember? 970 00:50:44,280 --> 00:50:45,480 We wanted to... 971 00:50:46,460 --> 00:50:46,900 Okay. 972 00:50:47,620 --> 00:50:54,400 So, you're saying that Bob's firewall would get the invalid TCP checksum, and once it 973 00:50:54,400 --> 00:50:58,000 got the invalid checksum, it would send back a TCP error instead of the reset ACK? 974 00:50:58,400 --> 00:51:01,500 And it would still drop the packet out of the session. 975 00:51:01,840 --> 00:51:02,160 Yeah. 976 00:51:02,220 --> 00:51:02,660 Yeah. 977 00:51:02,740 --> 00:51:03,680 That would suppress it. 978 00:51:03,760 --> 00:51:04,300 All right. 979 00:51:05,400 --> 00:51:05,840 And... 980 00:51:05,840 --> 00:51:06,820 That's actually... 981 00:51:07,280 --> 00:51:11,200 That's a really good thing to do if they're actually blocking low TTLs on SYNs, which 982 00:51:11,200 --> 00:51:11,420 will probably... 983 00:51:11,440 --> 00:51:11,460 That's a really good thing to do if they're actually blocking low TTLs on SYNs, which will 984 00:51:11,460 --> 00:51:12,640 probably be a feature in a short while. 985 00:51:15,840 --> 00:51:16,280 No... 986 00:51:16,280 --> 00:51:17,060 Oh, you're right. 987 00:51:17,180 --> 00:51:17,540 If... 988 00:51:18,280 --> 00:51:18,720 Okay. 989 00:51:18,940 --> 00:51:21,500 So, Alice's firewall and Bob's firewall both participate... 990 00:51:22,340 --> 00:51:23,000 I don't need... 991 00:51:23,000 --> 00:51:23,460 I don't need... 992 00:51:23,460 --> 00:51:24,540 I have one beer left. 993 00:51:24,580 --> 00:51:25,140 I already had two. 994 00:51:25,320 --> 00:51:26,060 This guy got two. 995 00:51:26,460 --> 00:51:28,880 This guy gets the last fucking beer. 996 00:51:29,040 --> 00:51:29,660 You won't make a stadium free. 997 00:51:30,580 --> 00:51:33,640 You would have to check the TCP checksum, and it's invalid. 998 00:51:33,960 --> 00:51:35,160 It will not make a stadium free. 999 00:51:37,080 --> 00:51:41,340 It's another one of those situations where you have two firewalls with slightly different 1000 00:51:41,340 --> 00:51:41,580 circumstances. 1001 00:51:42,320 --> 00:51:47,040 If you have a local firewall that doesn't care, and a remote firewall that does care, 1002 00:51:47,220 --> 00:51:47,720 it works. 1003 00:51:48,120 --> 00:51:50,480 But the TTL solution is going to be more general. 1004 00:51:50,680 --> 00:51:51,780 But it's still good thinking. 1005 00:51:52,760 --> 00:51:55,540 And I forgot the second question, because I'm cocked. 1006 00:51:58,500 --> 00:51:59,140 All right. 1007 00:51:59,240 --> 00:52:00,220 I brought you a beer. 1008 00:52:01,400 --> 00:52:01,840 Sweet. 1009 00:52:02,000 --> 00:52:03,020 I have refills. 1010 00:52:03,620 --> 00:52:04,320 All right. 1011 00:52:04,320 --> 00:52:05,320 Do we have any other questions? 1012 00:52:05,580 --> 00:52:05,760 Chat... 1013 00:52:05,760 --> 00:52:06,240 I have a comment. 1014 00:52:06,400 --> 00:52:06,720 Sweet. 1015 00:52:06,800 --> 00:52:06,880 Give me. 1016 00:52:06,880 --> 00:52:09,520 My first comment is Theo is obviously not paranoid, because he's right. 1017 00:52:10,580 --> 00:52:11,320 I didn't say... 1018 00:52:11,940 --> 00:52:12,740 Paranoid is right. 1019 00:52:12,920 --> 00:52:13,780 He works in security. 1020 00:52:13,920 --> 00:52:14,680 He's supposed to be paranoid. 1021 00:52:15,120 --> 00:52:17,700 This is a great little thing, an exchange I had with this guy. 1022 00:52:17,860 --> 00:52:21,860 It's like, security is the only industry where paranoia is a compliment. 1023 00:52:22,280 --> 00:52:25,740 The response I got back, I was afraid somebody would say that. 1024 00:52:26,760 --> 00:52:30,380 And I personally have never set up a firewall that's allowed IP options in or out. 1025 00:52:30,480 --> 00:52:32,200 So I think that you're going to run into some trouble with that. 1026 00:52:32,400 --> 00:52:32,540 Okay. 1027 00:52:32,760 --> 00:52:36,300 And specific things of that, Rachel, are you in the crowd? 1028 00:52:37,560 --> 00:52:38,180 Where are you? 1029 00:52:38,200 --> 00:52:38,600 Right there. 1030 00:52:38,660 --> 00:52:38,860 Yeah. 1031 00:52:39,200 --> 00:52:40,380 Rachel knows about this. 1032 00:52:40,540 --> 00:52:41,200 There's TCP. 1033 00:52:41,320 --> 00:52:46,200 There's TCP options, which don't get molested, and TCP options actually will... 1034 00:52:46,200 --> 00:52:50,960 You have a TCP timestamp that has a reply field inside of it that match... 1035 00:52:50,960 --> 00:52:53,980 It's supposed to contain the time of your own machine. 1036 00:52:54,340 --> 00:52:58,260 Now, it's 32 bits, so you can only put in an IP address, but it's enough for you to 1037 00:52:58,260 --> 00:53:00,840 get the local IP, ARP for it, and do what you need. 1038 00:53:01,300 --> 00:53:01,700 All right. 1039 00:53:01,700 --> 00:53:05,120 So how much do you want to bet by the time we all get home next week that Theo will 1040 00:53:05,120 --> 00:53:08,340 have patched OpenBSD to scrub all outbound TTLs through PF? 1041 00:53:08,740 --> 00:53:09,960 Well, but then he's going to break... 1042 00:53:12,560 --> 00:53:13,280 Here's the deal. 1043 00:53:13,860 --> 00:53:16,060 You've got the legitimate and the illegitimate. 1044 00:53:16,340 --> 00:53:20,400 You have legitimate TCP trace routing that should not be messed with. 1045 00:53:20,900 --> 00:53:23,260 And you've got kind of some other stuff. 1046 00:53:23,720 --> 00:53:25,860 The legitimate is protecting the illegitimate. 1047 00:53:26,040 --> 00:53:30,420 I would be really pissed if it wasn't at least an option to allow the timestamping. 1048 00:53:30,600 --> 00:53:31,440 But you'll need that for... 1049 00:53:31,440 --> 00:53:31,700 Mic it. 1050 00:53:31,800 --> 00:53:32,560 I have it right here. 1051 00:53:33,320 --> 00:53:34,980 You'll need that for ICMP. 1052 00:53:35,200 --> 00:53:39,860 So you could scrub TTLs on everything but ICMP and still effectiveness break the stack 1053 00:53:39,860 --> 00:53:39,940 tomorrow. 1054 00:53:39,940 --> 00:53:43,060 Well, I mean, there's ICMP to ETL timestamp. 1055 00:53:43,640 --> 00:53:50,080 You can trace route and do trace route on TCP, on UDP, and on ICMP. 1056 00:53:50,280 --> 00:53:54,520 There's different implementations that do all three, because all three elicit a time-exceeded message. 1057 00:53:55,460 --> 00:53:55,960 Thanks. 1058 00:53:56,220 --> 00:53:56,560 All right. 1059 00:53:57,140 --> 00:53:57,760 What's up? 1060 00:53:58,920 --> 00:53:59,660 Two things. 1061 00:54:00,060 --> 00:54:06,080 First, you can close the dynamic hole when you get a TTL a time-exceeded. 1062 00:54:06,080 --> 00:54:12,400 So one thing that OpenBSD could do is when it gets the ICMP TTL, it could close the open port. 1063 00:54:12,400 --> 00:54:16,380 Oh, yeah, and the information's sitting there in the ICMP data, and it's sitting everywhere. 1064 00:54:16,700 --> 00:54:22,180 It's really trivial, but to be blunt, there's been no reason to do so until now. 1065 00:54:22,320 --> 00:54:22,880 And no, no, no. 1066 00:54:22,920 --> 00:54:26,520 Let's talk about it from a purely theoretical security point of view. 1067 00:54:27,600 --> 00:54:33,680 OpenBSD already trusts machines behind the firewall to determine what outgoing connections they're going to make. 1068 00:54:33,860 --> 00:54:35,920 Whether or not some remote host... 1069 00:54:36,080 --> 00:54:41,460 ...is able to do incoming or not is not something that is within the security domain of OpenBSD. 1070 00:54:41,620 --> 00:54:49,780 It can't know, because if it was a security issue, OpenBSD would be vulnerable every time some other guy opened up a hole in his firewall. 1071 00:54:50,440 --> 00:54:54,600 We're using a trait of the network to basically limit the statement. 1072 00:54:54,680 --> 00:54:56,460 I want to talk to this guy. 1073 00:54:56,620 --> 00:54:58,260 Limit it to my local side. 1074 00:54:58,660 --> 00:55:05,900 The remote side is so far too dumb to know, oh, how do we resolve the NAT to NAT issue? 1075 00:55:06,080 --> 00:55:08,500 There's no knowledge to know how to do that resolution yet. 1076 00:55:08,620 --> 00:55:12,740 So we're telling only our local side, I want to talk to the other guy. 1077 00:55:12,880 --> 00:55:15,120 And this is already a trusted message. 1078 00:55:15,500 --> 00:55:25,000 The other comment was your stateless NAT, which suffer from people using that state in the package and overriding the state. 1079 00:55:25,240 --> 00:55:26,100 Yeah, you encrypt. 1080 00:55:26,220 --> 00:55:27,480 You encrypt against the key. 1081 00:55:27,560 --> 00:55:30,020 You certainly have enough space to do all that kind of stuff. 1082 00:55:30,200 --> 00:55:31,320 You encrypt against the key. 1083 00:55:31,420 --> 00:55:32,180 People have a choice. 1084 00:55:32,240 --> 00:55:35,420 Either they drop the IP option and it doesn't get anywhere. 1085 00:55:36,080 --> 00:55:37,620 It gets to the one host it was supposed to. 1086 00:55:37,900 --> 00:55:39,240 That's how you use the crypto for that. 1087 00:55:39,380 --> 00:55:39,600 Very good. 1088 00:55:39,700 --> 00:55:42,640 And, of course, the code is there because we're using that with our SIN scanner. 1089 00:55:43,900 --> 00:55:44,600 And we got next. 1090 00:55:44,980 --> 00:55:49,660 If you're going to use a connection broker, why don't you just use a proxy? 1091 00:55:50,660 --> 00:55:52,000 Oh, because the, okay. 1092 00:55:52,300 --> 00:55:56,140 Now, last year I talked about using SSH for an end-to-end secure proxy. 1093 00:55:56,380 --> 00:55:58,580 So the proxy would just pass a crypto package. 1094 00:55:58,640 --> 00:55:59,720 I have no idea what it's doing. 1095 00:56:00,180 --> 00:56:01,420 It's really expensive. 1096 00:56:01,920 --> 00:56:05,740 Now, there's this, like, old story about, used to be that it was illegal. 1097 00:56:06,080 --> 00:56:07,840 For phone calls to go between Jordan and Israel. 1098 00:56:08,340 --> 00:56:11,420 So the guy in Jordan would call some apartment in the United States. 1099 00:56:11,500 --> 00:56:14,120 And the guy in Israel would call some apartment in the United States. 1100 00:56:14,280 --> 00:56:16,340 And their connections would be linked against each other. 1101 00:56:16,660 --> 00:56:20,820 Now, the problem was, for this to work, the people who were running this had to rent apartments. 1102 00:56:21,060 --> 00:56:22,180 They had to get phone lines. 1103 00:56:22,340 --> 00:56:23,220 They had to buy phones. 1104 00:56:23,400 --> 00:56:24,340 They had to buy hardware. 1105 00:56:24,760 --> 00:56:26,780 And you know how they got caught, by the way? 1106 00:56:27,140 --> 00:56:28,620 They didn't actually pay for anything. 1107 00:56:28,760 --> 00:56:31,720 They just shipped it all to the next place every time their rent was due. 1108 00:56:33,520 --> 00:56:35,380 But, yeah, I mean, the handshake. 1109 00:56:35,380 --> 00:56:36,960 The connection broker's handshake only. 1110 00:56:37,180 --> 00:56:42,200 All it does is facilitate the connection between Alice and Bob at the asymmetric phase. 1111 00:56:42,340 --> 00:56:43,640 At the point of the handshake. 1112 00:56:43,800 --> 00:56:48,460 Once the handshake's done, you have two sides that think they're talking directly to each other. 1113 00:56:48,520 --> 00:56:50,380 Are routing directly to each other. 1114 00:56:50,500 --> 00:56:52,680 And therefore, get a direct link. 1115 00:56:52,840 --> 00:56:54,160 The broker is out. 1116 00:56:54,280 --> 00:56:58,740 The broker exchanges a total of between 5 and 15 packets, depending on the convergence algorithm. 1117 00:56:59,060 --> 00:57:03,200 And can, past that, has facilitated an arbitrary amount of data. 1118 00:57:03,420 --> 00:57:05,280 So the broker just does the very... 1119 00:57:05,380 --> 00:57:06,100 And then he's out. 1120 00:57:06,280 --> 00:57:06,820 Ding, ding. 1121 00:57:06,900 --> 00:57:07,600 Man got it. 1122 00:57:08,340 --> 00:57:08,860 Go ahead. 1123 00:57:10,740 --> 00:57:13,380 Would a connection broker work in a situation like this? 1124 00:57:13,440 --> 00:57:15,060 You have two firewalls running net. 1125 00:57:15,300 --> 00:57:15,700 Okay. 1126 00:57:16,460 --> 00:57:19,940 There's a server behind one of the firewalls, and it's forwarding ports to that server. 1127 00:57:20,160 --> 00:57:20,560 Okay. 1128 00:57:20,660 --> 00:57:22,520 This connection behind a firewall has no... 1129 00:57:22,520 --> 00:57:23,680 You know, there's no ports being forwarded. 1130 00:57:23,760 --> 00:57:29,240 The user wants to connect to the server using the public IP address, but the server responds on a different port. 1131 00:57:29,380 --> 00:57:32,540 Like, they want to come in on 149, and it comes back on 400. 1132 00:57:32,660 --> 00:57:33,020 No, no. 1133 00:57:33,080 --> 00:57:35,060 You need to stay within the same TCP sessions. 1134 00:57:35,060 --> 00:57:35,820 It's going on. 1135 00:57:35,960 --> 00:57:44,100 Just because the user makes an outgoing connection to the server, the only thing the server can do is make a response on that individual TCP session. 1136 00:57:44,460 --> 00:57:44,640 Got it. 1137 00:57:44,700 --> 00:57:49,800 Now, it is conceivable that this outgoing connection could be to an SSH server on the server. 1138 00:57:50,260 --> 00:57:59,500 And then, using that, it can do a remote port forward of its own SSH server or its own web server, and effectively, the server can tunnel in back through that SSH system. 1139 00:57:59,700 --> 00:58:01,020 Now, that works well. 1140 00:58:01,220 --> 00:58:02,240 I'll show you how to do it later. 1141 00:58:02,400 --> 00:58:02,640 Nice. 1142 00:58:02,660 --> 00:58:03,000 Thank you. 1143 00:58:03,340 --> 00:58:03,960 All right. 1144 00:58:03,960 --> 00:58:04,080 All right. 1145 00:58:04,280 --> 00:58:05,400 We got anyone else? 1146 00:58:06,160 --> 00:58:06,740 You up? 1147 00:58:08,780 --> 00:58:09,440 All right. 1148 00:58:10,160 --> 00:58:24,140 With what he was saying, could you set something up so that you could have one guy on one side, one guy on the other, and allow somebody on this other side could open up so that he can get to his server in his own domain by using a packet? 1149 00:58:24,160 --> 00:58:26,960 Say that it's from this IP address, but it's not. 1150 00:58:27,340 --> 00:58:33,940 You got to operate within a really restrictive domain where the only entries you're able to open up on the firewall... 1151 00:58:33,960 --> 00:58:35,440 ...are those from outgoing connections. 1152 00:58:35,860 --> 00:58:38,320 This is, so far, the only method I've found to do it. 1153 00:58:39,140 --> 00:58:43,240 Well, if this guy sends a packet out from source port 80... 1154 00:58:44,840 --> 00:58:48,060 If it's a SYN, if it's not part of an established... 1155 00:58:48,060 --> 00:58:48,320 Okay. 1156 00:58:48,420 --> 00:58:52,800 The only type of TCP packet that you can send out that will actually... 1157 00:58:52,800 --> 00:58:57,620 ...out of a stateful firewall that will actually reach the Internet is a SYN. 1158 00:58:57,720 --> 00:58:59,360 A SYN ACK is a response. 1159 00:58:59,680 --> 00:59:01,680 An ACK is a response after a SYN. 1160 00:59:01,820 --> 00:59:03,660 And the raw data flagless... 1161 00:59:03,960 --> 00:59:05,840 ...has to have started from a handshake. 1162 00:59:06,020 --> 00:59:08,180 So the only thing you can get out is the SYN. 1163 00:59:08,280 --> 00:59:09,240 That's your restriction. 1164 00:59:10,180 --> 00:59:13,080 So this system theoretically works. 1165 00:59:13,220 --> 00:59:14,880 Again, you'd use UDP. 1166 00:59:15,100 --> 00:59:16,240 This is what the game guys do. 1167 00:59:16,400 --> 00:59:17,360 It works quite well. 1168 00:59:18,980 --> 00:59:20,220 We got anything else? 1169 00:59:21,440 --> 00:59:22,920 Hang on, hang on. Who said that? 1170 00:59:25,060 --> 00:59:26,760 Ah, yes. I know this question. 1171 00:59:27,080 --> 00:59:29,820 What if you don't have a default gateway pointing to your firewall? 1172 00:59:30,140 --> 00:59:31,460 Ah, now this is beautiful. 1173 00:59:32,560 --> 00:59:33,000 The... 1174 00:59:33,000 --> 00:59:33,820 ...only thing... 1175 00:59:33,820 --> 00:59:35,280 ...the default gateway does... 1176 00:59:35,630 --> 00:59:37,960 ...your system ARPs to the default gateway... 1177 00:59:37,960 --> 00:59:44,740 ...sends the packet with the final destination to that gateway MAC address. 1178 00:59:45,080 --> 00:59:49,940 The gateway never actually needs to know what IP the... 1179 00:59:50,460 --> 00:59:51,300 ...oh, okay. 1180 00:59:51,420 --> 00:59:55,420 Long story short, the gateway responds to the ARP request for the default gateway. 1181 00:59:55,640 --> 00:59:57,480 And says, yeah, send them to my MAC. 1182 00:59:58,520 --> 01:00:00,460 Oh, you're shaking your head. Why can't you do that? 1183 01:00:01,080 --> 01:00:02,020 Not on my network. 1184 01:00:02,320 --> 01:00:03,360 Not on your network? 1185 01:00:04,020 --> 01:00:05,540 No, no, no, no, no, no, no, no. 1186 01:00:05,560 --> 01:00:07,280 Come back here. I sense a little challenge here. 1187 01:00:07,440 --> 01:00:08,400 Why can I not... 1188 01:00:08,400 --> 01:00:09,400 ...ah, ah, ah, ah, ah, ah. 1189 01:00:09,640 --> 01:00:12,020 Why can I not ARP for your gateway? 1190 01:00:13,680 --> 01:00:14,120 Because... 1191 01:00:15,540 --> 01:00:18,280 ...because the IP address of the firewall is not in my routing table. 1192 01:00:19,260 --> 01:00:22,060 The IP address of the firewall is not in the routing table. 1193 01:00:22,200 --> 01:00:24,780 I am talking about replacing your firewall, you know. 1194 01:00:24,980 --> 01:00:26,140 It's a bridge or a sink? 1195 01:00:26,380 --> 01:00:27,160 It's a... 1196 01:00:28,820 --> 01:00:30,720 Actually, no, it sits before your firewall. 1197 01:00:30,820 --> 01:00:33,340 It's basically replacing the NAT implementation on your firewall. 1198 01:00:33,360 --> 01:00:34,440 I use a proxy server. 1199 01:00:35,220 --> 01:00:35,360 Hmm? 1200 01:00:35,940 --> 01:00:36,640 Talking to Mike. 1201 01:00:36,680 --> 01:00:40,240 Nobody can go out and y'all use a proxy server. 1202 01:00:41,500 --> 01:00:43,340 Nobody thinks a proxy server... 1203 01:00:43,340 --> 01:00:44,620 Well, it's... 1204 01:00:46,980 --> 01:00:47,900 You have a... 1205 01:00:47,900 --> 01:00:48,920 Remember it this way. 1206 01:00:49,000 --> 01:00:50,380 You have a network specifically... 1207 01:00:50,380 --> 01:00:54,180 If you were to install my stuff, you'd be changing the architecture of your network. 1208 01:00:54,340 --> 01:00:58,000 It doesn't really make sense for me to talk about how this would work in your network 1209 01:00:58,000 --> 01:01:01,960 as is because, you know, first of all, I presume direct connectivity. 1210 01:01:02,900 --> 01:01:03,340 And... 1211 01:01:03,360 --> 01:01:05,180 This is not what... 1212 01:01:05,180 --> 01:01:06,100 You have to... 1213 01:01:06,100 --> 01:01:08,120 That's really the only comment I was making when I was sitting down. 1214 01:01:08,200 --> 01:01:09,580 You're assuming direct connectivity. 1215 01:01:09,900 --> 01:01:10,000 Oh. 1216 01:01:10,000 --> 01:01:10,400 All righty then. 1217 01:01:10,460 --> 01:01:11,120 Then we both agree. 1218 01:01:11,720 --> 01:01:12,060 Okay. 1219 01:01:12,100 --> 01:01:13,700 And there is actually a proxy system. 1220 01:01:14,220 --> 01:01:15,200 Ask me about it later. 1221 01:01:15,700 --> 01:01:16,040 Okay. 1222 01:01:16,040 --> 01:01:17,980 Because I don't know if it's off the top of my head, but I have it written down somewhere. 1223 01:01:18,020 --> 01:01:20,380 I wouldn't talk about what I do on this microphone anyway. 1224 01:01:22,960 --> 01:01:23,300 Spot. 1225 01:01:23,680 --> 01:01:24,160 But anyway. 1226 01:01:25,940 --> 01:01:27,060 We got anything else? 1227 01:01:27,080 --> 01:01:27,880 Any other challenges? 1228 01:01:28,160 --> 01:01:29,260 That was actually a good question. 1229 01:01:29,340 --> 01:01:30,240 He's got a point there. 1230 01:01:31,100 --> 01:01:31,440 Okay. 1231 01:01:31,700 --> 01:01:31,740 Okay. 1232 01:01:32,560 --> 01:01:32,900 Okay. 1233 01:01:33,220 --> 01:01:33,340 Okay. 1234 01:01:35,220 --> 01:01:36,840 I'm going to give you a book for the balls. 1235 01:01:38,140 --> 01:01:38,920 Give me the beer. 1236 01:01:40,580 --> 01:01:42,020 If you want the beer to be... 1237 01:01:42,820 --> 01:01:43,680 I want a beer. 1238 01:01:43,760 --> 01:01:44,220 Where's my beer? 1239 01:01:45,580 --> 01:01:46,520 You have a beer. 1240 01:01:46,760 --> 01:01:47,160 Sweet. 1241 01:01:47,400 --> 01:01:48,380 All righty, everyone. 1242 01:01:48,760 --> 01:01:49,940 Thanks for sticking it out. 1243 01:01:50,000 --> 01:01:50,680 Thanks for coming. 1244 01:01:50,880 --> 01:01:51,980 Welcome to DEF CON. 1245 01:01:52,120 --> 01:01:53,660 Have a fucking party, people.