1 00:00:00,860 --> 00:00:08,160 Welcome to the annual DEF CON convention. This meeting was held in exciting Las Vegas, Nevada from July 9th through the 11th, 1999. 2 00:00:09,460 --> 00:00:14,220 This is Radio Ticket No. 18, Introduction to TCP IP. 3 00:00:20,920 --> 00:00:23,580 Unfortunately, I wasn't able to make copies of these slides. 4 00:00:24,260 --> 00:00:28,780 This is going to be kind of a slide-intensive presentation, so if anybody does want a copy of the slides, 5 00:00:28,780 --> 00:00:34,820 just grab me any time during the CON. I'll throw them in a floppy for you, or send me an email, and I'll get them to you. 6 00:00:41,640 --> 00:00:46,180 And for those of you who don't know, I will be doing a brief introduction to TCP IP this morning. 7 00:00:50,740 --> 00:00:54,080 What this lecture is going to cover, this lecture is going to be a low-level, 8 00:00:54,900 --> 00:00:57,560 basically it's a low-level overview of TCP IP. 9 00:00:58,240 --> 00:00:58,760 This lecture is going to be a low-level overview of TCP IP. 10 00:00:58,780 --> 00:01:03,340 This lecture is geared towards novices. This obviously is the newbie track, so it's not going to be a real high-tech presentation. 11 00:01:04,120 --> 00:01:11,780 If you do want a high-level overview of TCP IP, this is the book to get. 12 00:01:11,940 --> 00:01:17,560 TCP IP Illustrated, W. Richard Stevens. Buy this book, read it from cover to cover. 13 00:01:17,760 --> 00:01:21,240 After you read this one, there's two more volumes after this. Excellent book. 14 00:01:27,420 --> 00:01:28,760 First off, I want to cover this book. 15 00:01:28,760 --> 00:01:31,220 It covers a little bit of the history of TCP IP, where it all began. 16 00:01:37,000 --> 00:01:43,740 Essentially, TCP IP started in 1969, when the Advanced Research Project Agency, also known as ARPA, 17 00:01:44,660 --> 00:01:49,080 decided to fund some research and development into making basically not really a global network, 18 00:01:49,260 --> 00:01:51,600 but they just wanted to start putting all their resources together, 19 00:01:52,200 --> 00:01:56,780 and make a network that they could put all these resources together, and network the computers together. 20 00:01:56,780 --> 00:02:00,820 And essentially make all their computers work a little better together. 21 00:02:01,520 --> 00:02:05,600 ARPA's goal was, and originally, the internet, as we know it today, that was not their original goal. 22 00:02:05,720 --> 00:02:06,940 It was more of a research project. 23 00:02:07,800 --> 00:02:12,240 ARPA's goal was to study techniques for providing robust, vendor-independent data communications. 24 00:02:12,900 --> 00:02:18,460 So basically, they could put all these different machines together, regardless of operating system, regardless of vendor, 25 00:02:18,560 --> 00:02:20,820 and have these machines be able to talk to each other on a network. 26 00:02:26,920 --> 00:02:31,240 ARPANET was so successful that many organizations attached to it began to use it on a daily basis. 27 00:02:31,960 --> 00:02:39,020 Obviously, it has proved to be a very important resource people are using on a daily basis, so it did grow rather rapidly. 28 00:02:40,040 --> 00:02:45,800 In 1975, ARPANET converted from an experimental network to an operational network, 29 00:02:46,000 --> 00:02:50,240 when the Defense Communication Agency, also known as DCA, took control of it. 30 00:02:50,340 --> 00:02:52,760 They took full control of it and released it from ARPANET. 31 00:02:58,020 --> 00:03:01,200 In 1983, a couple of different things happened with TCPIP. 32 00:03:01,700 --> 00:03:05,080 The TCPIP protocols were developed as military standards. 33 00:03:05,280 --> 00:03:06,940 They were then enforced as military standards. 34 00:03:07,480 --> 00:03:12,820 All hosts on the network were then required to be able to use this communication suite to talk to each other. 35 00:03:14,320 --> 00:03:20,420 Also in 1983, DARPA funded the implementation of TCPIP in Berkeley or BSD Unix. 36 00:03:21,080 --> 00:03:25,120 And also in 1983, the term that we know today as internet came into common use. 37 00:03:25,440 --> 00:03:25,900 . 38 00:03:26,500 --> 00:03:26,760 . 39 00:03:28,120 --> 00:03:28,760 . 40 00:03:35,300 --> 00:03:44,060 Also in 1983, ARPANET split into both the MILNET and also its newer, smaller ARPANETs was controlled by two bodies at this time. 41 00:03:44,560 --> 00:03:51,180 In 1985, the National Science Foundation, or the NSF, created NSFNET and connects it to the internet. 42 00:03:52,040 --> 00:03:55,580 In 1987, NSF created a faster new backbone. 43 00:03:57,420 --> 00:04:02,160 нологies which includes both backbone, regional networks and a three-tiered topology 44 00:04:02,160 --> 00:04:02,540 local networks. 45 00:04:02,860 --> 00:04:03,940 Today, it's under Belgrado's name. 46 00:04:03,940 --> 00:04:04,800 In the civil history of cultural history, we have recognized NSFНет series of networks 47 00:04:04,800 --> 00:04:06,400 as a whole backbone for the internet. 48 00:04:11,360 --> 00:04:16,980 In 1990, ARPANET passed out of existence to propel and maintain the entire τουςelbe 49 00:04:16,980 --> 00:04:17,200 article to be used by the USCC token program. 50 00:04:17,200 --> 00:04:17,520 This existed for a long time. 51 00:04:18,080 --> 00:04:22,960 Also before us, in 1995, NSFNET saw its role as a primary backbone for the internet. 52 00:04:23,600 --> 00:04:24,840 The international news organization, carriers of alternative métals and internet machines. 53 00:04:24,840 --> 00:04:25,380 Provides the US government with linkage with Shierra. 54 00:04:25,380 --> 00:04:32,560 known as what we know as today is the internet in 1995 so basically this all 55 00:04:32,560 --> 00:04:36,520 can be wrapped up in a nutshell what has come to be known as the internet was 56 00:04:36,520 --> 00:04:40,500 originally designed and experimented it was originally designed as an 57 00:04:40,500 --> 00:04:44,260 experimental network they really had no intentions of a growing into the network 58 00:04:44,260 --> 00:04:48,780 that has come as that has come to be known as today the internet has grown 59 00:04:48,780 --> 00:04:53,100 much larger than it was originally intended for obviously and also the 60 00:04:53,100 --> 00:04:56,540 original networks and agency involved in the creation in the creation of the 61 00:04:56,540 --> 00:05:00,300 internet are no longer involved in that process today they no longer play in a 62 00:05:00,300 --> 00:05:00,920 role in that 63 00:05:06,380 --> 00:05:13,560 a couple of myths of TCP IP contrary to money think Al Gore did not create the 64 00:05:13,560 --> 00:05:17,420 Internet he did not invent the Internet when you know that was internet was 65 00:05:17,420 --> 00:05:21,180 funded Al Gore was only 21 years old he was a college student I don't think he 66 00:05:21,180 --> 00:05:22,280 had anything to do with it 67 00:05:27,300 --> 00:05:28,740 and I would have gone to some of the 68 00:05:28,740 --> 00:05:33,960 definitions we're using TCP IP defined the transmission control protocol 69 00:05:33,960 --> 00:05:40,360 Internet Portal essentially this is the suite of networking protocols that have 70 00:05:40,360 --> 00:05:45,340 been used construct the global internet also referred to as DOD or open a 71 00:05:45,340 --> 00:05:49,880 protocol sweet yellow here a refer to these these days sometimes you still may 72 00:05:49,880 --> 00:05:53,080 because they were they were involved in the early development of the system in the böyleo realise ses engueatories le days sometimes you still may be would cover this recruit or i'm giving field will be referred to as an opening c версions for the aiming protocol sometimes you still make because you say okay put me in the bottom thinks and a long time we in the bottom 73 00:05:53,080 --> 00:06:04,540 suite. So TCP defined in nutshell is the series of protocols that allows 74 00:06:04,540 --> 00:06:08,940 computers to communicate on a network regardless of operating system and 75 00:06:08,940 --> 00:06:12,860 regardless of vendor. It doesn't matter what operating system you're running, it doesn't 76 00:06:12,860 --> 00:06:15,580 matter what type of computer you're running, as long as you're running a TCP 77 00:06:15,580 --> 00:06:19,020 IP stack you can still communicate with other computers on that network. 78 00:06:25,760 --> 00:06:29,340 I really hate the OSI model, we're not going to go into that at all with this talk. 79 00:06:29,620 --> 00:06:33,480 The thing we are going to talk about is the four layers of TCP IP. This is what's really 80 00:06:33,480 --> 00:06:37,860 important. I think when it comes to TCP IP the OSI model is not really that 81 00:06:37,860 --> 00:06:42,940 important. There's a lot of layers that are not even used in TCP IP. So let's 82 00:06:42,940 --> 00:06:47,520 talk about the four layers of TCP IP. Starting from the bottom you have the 83 00:06:47,520 --> 00:06:51,140 link layer, which is the device driver and interface card. If you're a network 84 00:06:51,140 --> 00:06:52,780 interface card it's as simple as that. 85 00:06:53,440 --> 00:06:57,900 Moving on up the stack, we have the network layer, which is typically 86 00:06:58,540 --> 00:07:06,760 comprised of IP, ICMP, and IGMP. Moving on up the stack, we have the 87 00:07:06,760 --> 00:07:13,020 transport layer, which consists of the other TCP or UDP. And at the very top of 88 00:07:13,020 --> 00:07:16,360 this stack is our application level. These are the actual applications that 89 00:07:16,360 --> 00:07:20,540 the users interact with, such as Telnet, FTP, mail, what have you. 90 00:07:25,060 --> 00:07:29,780 A little description of what each layer is comprised of and what it does. The data 91 00:07:29,780 --> 00:07:36,500 link layer, this is the very bottom of the stack. This layer includes the device 92 00:07:36,500 --> 00:07:39,960 driver in the OS and the corresponding network interface card in the computer. 93 00:07:40,280 --> 00:07:44,400 This is both your network interface card and whatever drivers are required to 94 00:07:44,400 --> 00:07:48,980 interface that NIC with your machine. This handles both the hardware details 95 00:07:48,980 --> 00:07:50,520 that physically interfaces the network. 96 00:07:56,240 --> 00:08:00,160 Moving on up to the network layer, this is also sometimes known as the 97 00:08:00,160 --> 00:08:04,040 Internet layer. This handles the movement and routing of packets around the 98 00:08:04,040 --> 00:08:04,320 network. 99 00:08:10,780 --> 00:08:15,140 Moving on up the third layer, which is the transport layer. This provides a flow of 100 00:08:15,140 --> 00:08:19,500 data between two hosts for the application layer above. Two different transport 101 00:08:19,500 --> 00:08:23,060 protocols are used at this level. I'll give you a brief description of the 102 00:08:23,060 --> 00:08:25,460 protocol. Right now, we're going to go a little bit further in depth into those in 103 00:08:25,460 --> 00:08:31,780 a few minutes. It uses both TCP and UDP, as I mentioned a few minutes ago. TCP is an 104 00:08:31,780 --> 00:08:37,180 extremely reliable protocol. It breaks data passed from the application layer above into 105 00:08:37,180 --> 00:08:43,500 chunks for the network layer below. It acknowledges every packet that it receives, sets timeouts 106 00:08:43,500 --> 00:08:47,080 and a couple more things, which I'll go into in a few more minutes. It's considered to 107 00:08:47,080 --> 00:08:50,520 be very reliable to actually establishing a connection with the machine on the other 108 00:08:50,520 --> 00:08:51,100 end of the network. 109 00:08:52,420 --> 00:08:53,040 The other end of the network is the TCP and UDP protocol. The TCP and UDP protocol 110 00:08:53,040 --> 00:08:57,700 is a protocol used at this level as UDP. This is considered to be very unreliable. 111 00:08:57,900 --> 00:09:03,280 It sends it's packets of data, also known as datagrams, from one host to another. The 112 00:09:03,280 --> 00:09:06,100 problem with this is there's no guarantee that those packets that you're sending to 113 00:09:06,100 --> 00:09:09,120 the remote host are actually being received by that remote host. 114 00:09:13,980 --> 00:09:19,420 At the very top, we have the application layer. This layer handles the details of a particular 115 00:09:19,420 --> 00:09:20,820 application being used. 116 00:09:23,040 --> 00:09:30,140 The applications include TELNET, FTP, SMTP, and also SNMP. 117 00:09:36,700 --> 00:09:39,380 Okay, another definition, encapsulation. 118 00:09:40,030 --> 00:09:47,200 What encapsulation is, when an application sends data using TCPIP, it's sent through each layer in the protocol stack. 119 00:09:48,260 --> 00:09:55,960 As it passes through each layer, each layer adds its own information to that data by adding its own header and sometimes a footer to that information. 120 00:09:56,900 --> 00:10:00,300 The data is then sent as a stream of bits across the network. 121 00:10:03,940 --> 00:10:07,720 This is a little graphical representation of exactly how encapsulation works. 122 00:10:08,700 --> 00:10:10,320 We start off with our user data. 123 00:10:13,300 --> 00:10:15,040 First, it's run through the application layer. 124 00:10:15,100 --> 00:10:17,020 Remember, it has to work its way through the top of the stack. 125 00:10:17,200 --> 00:10:18,340 It has to go down to the bottom of the stack. 126 00:10:21,640 --> 00:10:26,280 Once it runs through the application layer, the application layer adds on its own application header. 127 00:10:33,540 --> 00:10:37,800 The next layer on down is the TCP layer, so obviously that's going to add on its own information. 128 00:10:40,600 --> 00:10:42,860 As we can see, it does add on a TCP header. 129 00:10:48,620 --> 00:10:53,340 Now, this piece of data, or this chunk, this segment is what's known as the TCP segment. 130 00:10:53,660 --> 00:10:57,980 Both your application data and TCP header comprise a TCP segment. 131 00:11:03,740 --> 00:11:06,360 Moving on down, the next layer we have is our IP layer. 132 00:11:10,500 --> 00:11:13,600 And as you can see, the IP layer adds on its own IP header. 133 00:11:17,860 --> 00:11:21,660 And this piece of data is what's known as an IP datagram. 134 00:11:21,900 --> 00:11:26,580 It's comprised of your application data, your TCP header, and your IP data. 135 00:11:26,840 --> 00:11:28,180 I'm sorry, your IP header. 136 00:11:32,160 --> 00:11:36,940 And obviously, the very bottom of the list, or the bottom of our stack, is the link layer, our Ethernet card. 137 00:11:42,600 --> 00:11:47,180 And the link layer, if you notice, adds both an Ethernet trailer and an Ethernet terminal. 138 00:11:47,180 --> 00:11:47,660 This is the Ethernet header. 139 00:11:52,720 --> 00:11:55,480 And this piece of data is what's known as an Ethernet frame. 140 00:11:55,640 --> 00:11:57,860 This is going to be what's sent across the Ethernet. 141 00:12:04,480 --> 00:12:08,640 And that data would now go across the Ethernet, and once it's handled by the other machine, 142 00:12:11,700 --> 00:12:16,480 once that piece of data is sent across the wire, what happens is demultiplexing. 143 00:12:16,480 --> 00:12:18,880 It's the exact opposite of what happened just a minute ago. 144 00:12:19,500 --> 00:12:23,640 When an Ethernet frame is received by a host, it starts its way back up the protocol stack. 145 00:12:24,640 --> 00:12:28,900 Each layer then will look at its respective header and its footer if there was a footer for that layer, 146 00:12:29,100 --> 00:12:33,280 and it decides what to do with that data next before it passes it on to the next layer up. 147 00:12:33,880 --> 00:12:37,900 So when you're sending data from a host, it moves its way down the stack, goes to the host, 148 00:12:38,040 --> 00:12:42,220 moves its way back up the stack, and strips all the headers and footers off that are required for that layer, 149 00:12:42,380 --> 00:12:45,760 then passes off the application layer and decides what to do with it from there. 150 00:12:51,840 --> 00:12:56,360 Okay, now I'm going to talk a little bit about some of the TCP IP networking protocols that are in use today. 151 00:13:01,520 --> 00:13:05,440 First, I'm going to talk about IP, some of the features of IP or the Internet Protocol. 152 00:13:07,500 --> 00:13:12,620 IP is the dominant network layer protocol used by the TCP IP suite of protocols. 153 00:13:13,740 --> 00:13:16,460 IP defines the rules for packaging network traffic. 154 00:13:16,480 --> 00:13:21,360 It also defines the rules for moving these datagrams across the network. 155 00:13:21,980 --> 00:13:25,220 So you can see IP is a very important layer, a very important protocol. 156 00:13:26,820 --> 00:13:33,460 IP is also responsible for fragmenting the data whenever necessary and to properly reassemble datagrams at the other end. 157 00:13:33,760 --> 00:13:35,540 This will make a little more sense in a few more minutes. 158 00:13:39,900 --> 00:13:42,000 This is actually what an IP header looks like. 159 00:13:42,180 --> 00:13:44,040 It might be a little bit hard to read because of the lights up here. 160 00:13:44,100 --> 00:13:45,920 We couldn't get these lights shut off up here. 161 00:13:46,480 --> 00:13:51,060 But I'm going to go ahead and describe what each piece of this IP header actually means. 162 00:13:53,640 --> 00:13:57,440 Upper left-hand corner, the very first item on there is the version number. 163 00:13:57,880 --> 00:14:03,060 This indicates which version of IP is being used, which is typically version 4. 164 00:14:03,560 --> 00:14:06,580 Obviously, we're very slowly converging into version 6. 165 00:14:06,760 --> 00:14:08,920 There's probably going to be a very slow convergence with that. 166 00:14:10,100 --> 00:14:12,720 The next item is the 4-bit header length. 167 00:14:13,240 --> 00:14:16,460 This indicates how many 4-by-words are in the actual header. 168 00:14:17,780 --> 00:14:20,360 The next item is the 8-bit type of service. 169 00:14:20,820 --> 00:14:22,960 I'm not going to go into real big detail on this. 170 00:14:23,560 --> 00:14:28,680 TCPI at PLS Trader really breaks this down really well and exactly what the different types of service are. 171 00:14:29,180 --> 00:14:33,560 But essentially, this indicates the level of service the IP datagram should be assigned. 172 00:14:35,440 --> 00:14:38,560 The next item is the 16-bit total length in bytes. 173 00:14:39,520 --> 00:14:41,480 This is the actual datagram length. 174 00:14:41,680 --> 00:14:44,280 This is the length of the entire datagram, including the header. 175 00:14:44,780 --> 00:14:48,860 The max size of this is 65,535 bytes. 176 00:14:50,200 --> 00:14:52,500 The next item is the 16-bit identification. 177 00:14:58,640 --> 00:15:00,740 This is the actual datagram identification. 178 00:15:01,440 --> 00:15:04,880 This uniquely identifies each datagram being sent by a host. 179 00:15:05,220 --> 00:15:08,960 You want to have your IP datagrams each have an individual identification, 180 00:15:09,520 --> 00:15:12,360 so once they're received by their host, the host knows how to handle that. 181 00:15:15,320 --> 00:15:18,100 The next item, we have a couple different flags. 182 00:15:18,260 --> 00:15:19,600 There's three flag positions there. 183 00:15:19,660 --> 00:15:20,960 The first one's not being used. 184 00:15:21,020 --> 00:15:22,180 It's represented by the zero. 185 00:15:23,420 --> 00:15:26,640 The next flag, DF, is don't fragment. 186 00:15:27,160 --> 00:15:28,940 And the next flag is more fragment. 187 00:15:29,120 --> 00:15:33,460 This controls how the actual IP datagram is being fragmented as it's being sent across the wire. 188 00:15:33,820 --> 00:15:38,060 If you're sending a lot of information across the wire, obviously it's going to have to fragment this information. 189 00:15:38,460 --> 00:15:40,380 It can't send it all in one giant chunk. 190 00:15:40,680 --> 00:15:44,080 Remember, we have that limitation on how big the actual package can be. 191 00:15:44,280 --> 00:15:44,500 We can't do anything with this. 192 00:15:47,180 --> 00:15:51,680 The next item we're looking at is the fragment offset, or the 13-bit fragment offset. 193 00:15:52,520 --> 00:15:56,880 This indicates how many units from the start of the original datagram the current datagram is. 194 00:15:57,460 --> 00:16:00,980 Now, this would be used when you're sending quite a bit of data across the wire. 195 00:16:01,220 --> 00:16:07,040 That number is going to increase with every packet of data that's being sent across the wire. 196 00:16:07,520 --> 00:16:11,740 If you're sending just a very small packet across the wire, your fragment offset's going to be zero. 197 00:16:12,180 --> 00:16:14,020 If it's being broken down into, say, three packets, 198 00:16:14,280 --> 00:16:16,460 it's going to increase with every packet, one, two, three. 199 00:16:16,900 --> 00:16:20,360 That way, once it was received at the host, it's going to know how to interpret that data, 200 00:16:20,520 --> 00:16:22,000 how to put that data back together, 201 00:16:22,440 --> 00:16:25,640 and it's also going to know when it's done receiving data, basically, 202 00:16:25,660 --> 00:16:27,000 when it's received the end of that data. 203 00:16:29,160 --> 00:16:31,640 The next field is the time-to-live, or TTL. 204 00:16:31,760 --> 00:16:32,820 This is an 8-bit number. 205 00:16:33,440 --> 00:16:37,780 This indicates how many routers the datagram may traverse before being dropped, 206 00:16:38,160 --> 00:16:40,280 the max TTL being 255. 207 00:16:40,920 --> 00:16:42,780 If you don't set a time-to-live on a packet, 208 00:16:42,780 --> 00:16:44,260 and you send it out across the wire, 209 00:16:44,620 --> 00:16:47,120 let's say at a particular time it can't find its host, 210 00:16:47,220 --> 00:16:50,260 it's going to bounce across the internet forever until that host comes up. 211 00:16:50,620 --> 00:16:53,800 You can't have that happening on the internet. 212 00:16:54,060 --> 00:16:55,560 It could probably cause a lot of problems. 213 00:16:57,180 --> 00:16:59,560 The next field is the 8-bit protocol field. 214 00:17:01,360 --> 00:17:09,380 This identifies which protocol has handed the IP to data. 215 00:17:10,660 --> 00:17:12,240 The next fields are pretty obvious. 216 00:17:12,240 --> 00:17:14,460 The 32-bit source IP address, 217 00:17:14,740 --> 00:17:17,460 the 32-bit destination IP address. 218 00:17:19,460 --> 00:17:24,300 Obviously, it's the IP address which is sourcing this information, 219 00:17:24,620 --> 00:17:27,500 and the IP address which is the destination of this information. 220 00:17:28,520 --> 00:17:30,460 The next field is the options. 221 00:17:30,600 --> 00:17:32,780 This field is not always used. 222 00:17:33,760 --> 00:17:36,580 Currently defined options are security and handling restrictions, 223 00:17:37,520 --> 00:17:40,440 record route, timestamp, 224 00:17:41,040 --> 00:17:42,320 loose source routing, 225 00:17:42,580 --> 00:17:44,160 and strict source routing. 226 00:17:44,720 --> 00:17:46,420 These options are rarely used. 227 00:17:46,600 --> 00:17:48,620 There's a lot of routers out there on the internet 228 00:17:49,140 --> 00:17:51,100 that do not know how to handle these options, 229 00:17:51,320 --> 00:17:52,960 so it's very rare that they are used. 230 00:17:54,140 --> 00:17:57,340 Obviously, your last field's data is very obvious what that's going to be. 231 00:17:57,420 --> 00:17:59,080 That's your data that you're sending to the application, 232 00:17:59,640 --> 00:18:01,160 sending to your remote host. 233 00:18:11,880 --> 00:18:14,780 Now, this is an actual TCP dump on the IP headers 234 00:18:14,780 --> 00:18:16,520 to give you an example of what it might look like. 235 00:18:17,000 --> 00:18:19,920 As you can see at the very top, our version is version 4. 236 00:18:20,280 --> 00:18:23,500 That's what's most widely, most commonly used on the internet these days. 237 00:18:24,160 --> 00:18:26,420 The header length, 20 bytes, that's obvious. 238 00:18:27,120 --> 00:18:30,000 The service type, as I said, I'm not really going to go into that today, 239 00:18:30,420 --> 00:18:35,120 but that hexadecimal representation represents the level of service 240 00:18:35,120 --> 00:18:36,180 that this datagram will be. 241 00:18:37,940 --> 00:18:39,620 The next item, datagram length. 242 00:18:40,440 --> 00:18:42,540 That's the length of the entire datagram, including the header. 243 00:18:42,780 --> 00:18:43,760 It's 40 bytes. 244 00:18:45,080 --> 00:18:46,780 Next, we have our unique identification, 245 00:18:46,840 --> 00:18:49,120 which we would have for every packet going across the wire. 246 00:18:50,580 --> 00:18:54,500 Next, we have our two flags, the must fragment and don't fragment. 247 00:18:54,980 --> 00:18:58,840 As you can see in this case, must fragment is off, don't fragment is on. 248 00:18:59,020 --> 00:19:01,300 That means we're sending a very small packet across the wire. 249 00:19:01,500 --> 00:19:03,700 It's only going to be one packet going across the wire. 250 00:19:04,900 --> 00:19:06,340 Next, fragmentation offset. 251 00:19:06,800 --> 00:19:08,940 As I mentioned, this will increase exponentially 252 00:19:09,400 --> 00:19:10,420 when you're sending a lot of data 253 00:19:10,440 --> 00:19:11,760 and large amounts of data across the wire. 254 00:19:12,080 --> 00:19:13,200 In this case, it's zero. 255 00:19:13,300 --> 00:19:15,020 It's a very small piece of data we're sending. 256 00:19:16,640 --> 00:19:18,500 The next item, time to live, 32. 257 00:19:19,300 --> 00:19:22,800 This packet can only traverse 32 routers or 32 hops 258 00:19:22,800 --> 00:19:25,220 before its destination, before it's actually dropped. 259 00:19:26,460 --> 00:19:30,060 The next item is the encapsulated protocol that's being used in this instance, 260 00:19:30,160 --> 00:19:30,720 which is TCP. 261 00:19:32,260 --> 00:19:34,160 The next item is the header checksum. 262 00:19:34,380 --> 00:19:37,860 This is basically just a bounds checking that the remote host will use 263 00:19:37,860 --> 00:19:39,980 to make sure that the data being received 264 00:19:39,980 --> 00:19:41,460 is not corrupted in any way. 265 00:19:42,280 --> 00:19:45,800 Then we have our source IP address and destination IP address. 266 00:19:46,080 --> 00:19:46,860 Those are both obvious. 267 00:19:52,440 --> 00:19:55,760 I just wanted to mention a little bit about the trace route program. 268 00:19:56,020 --> 00:19:57,900 This can be a very useful diagnostic program, 269 00:19:59,020 --> 00:20:03,300 especially since there is no guarantee that two connective IP datagrams 270 00:20:03,300 --> 00:20:06,180 from the same port, same source, to the same destination 271 00:20:06,180 --> 00:20:07,480 will take the same route. 272 00:20:07,700 --> 00:20:08,520 They usually will. 273 00:20:08,520 --> 00:20:11,320 But let's say you're sending data across the wire, 274 00:20:11,420 --> 00:20:13,300 a large amount of data going across the wire. 275 00:20:13,540 --> 00:20:16,020 If one of those routes should drop automatically, 276 00:20:16,520 --> 00:20:18,420 they will be rerouted to that host. 277 00:20:18,560 --> 00:20:20,400 That host should still receive all that data. 278 00:20:21,260 --> 00:20:22,680 Trace route is a good program. 279 00:20:22,780 --> 00:20:26,760 It's a good tool that can be used to trace the flow of IP datagrams 280 00:20:26,760 --> 00:20:27,580 from one host to another. 281 00:20:32,400 --> 00:20:34,780 An explanation of how a trace route works. 282 00:20:37,040 --> 00:20:39,660 Trace route sends an IP datagram with a time to live 283 00:20:39,660 --> 00:20:41,080 of one to the destination host. 284 00:20:41,460 --> 00:20:43,740 If you remember a minute ago, I mentioned the time to live 285 00:20:43,740 --> 00:20:46,760 is essentially how many routers that packet can traverse 286 00:20:46,760 --> 00:20:48,040 before it's going to be dropped. 287 00:20:48,760 --> 00:20:52,080 Obviously, once it gets to the first router and is passed to the host, 288 00:20:52,240 --> 00:20:55,620 that packet is going to be decremented to zero. 289 00:20:56,000 --> 00:20:58,260 That packet is going to be dropped by that router. 290 00:20:58,740 --> 00:21:03,140 That router is then going to be sent an ICMP time exceeded 291 00:21:03,140 --> 00:21:04,020 back to the host. 292 00:21:04,840 --> 00:21:05,960 What happens next? 293 00:21:06,120 --> 00:21:09,180 Trace route then sends another datagram with a time to live of two. 294 00:21:09,980 --> 00:21:12,440 We then find the next IP address of the second router. 295 00:21:13,480 --> 00:21:15,820 They'll decrement to zero once again, be dropped. 296 00:21:16,080 --> 00:21:18,980 They'll send back the ICMP time exceeded back to the host. 297 00:21:19,120 --> 00:21:20,400 So on and so forth. 298 00:21:20,500 --> 00:21:23,620 We'll keep doing this until it eventually does reach the host. 299 00:21:29,700 --> 00:21:33,020 And here we just have a real simple sample trace route output. 300 00:21:33,440 --> 00:21:34,740 We're trace routing to victory. 301 00:21:34,780 --> 00:21:35,480 Trace route to victim.com. 302 00:21:35,980 --> 00:21:37,360 Trace route to victim.com. 303 00:21:37,420 --> 00:21:38,660 It gives us our IP address. 304 00:21:39,340 --> 00:21:43,260 It's going to be a maximum of 30 hops, which is a time to live of 30. 305 00:21:43,600 --> 00:21:45,300 And it's saying 40 byte packets. 306 00:21:45,720 --> 00:21:48,440 The size of the entire packet, including the header, 307 00:21:48,480 --> 00:21:49,900 is going to be 40 bytes in this case. 308 00:21:50,520 --> 00:21:52,660 You can see the first hop is Satan. 309 00:21:53,960 --> 00:21:56,040 It's actually saying three packets every time, 310 00:21:56,080 --> 00:21:57,420 so we have our average for every packet. 311 00:21:57,900 --> 00:22:00,740 20 milliseconds, 10 milliseconds, and 10 milliseconds. 312 00:22:01,340 --> 00:22:04,700 The next hop, which is our actual destination host, is victim. 313 00:22:05,240 --> 00:22:08,760 So we can see we have 120 milliseconds for all three of those. 314 00:22:09,420 --> 00:22:12,780 So for each TTL, three datagrams are actually being sent. 315 00:22:13,000 --> 00:22:15,060 These values are then recorded in your output. 316 00:22:23,620 --> 00:22:26,340 Moving on to TCP, some of the features of TCP. 317 00:22:27,400 --> 00:22:29,380 TCP is a transport layer protocol. 318 00:22:29,780 --> 00:22:31,060 I mentioned that a little bit earlier. 319 00:22:31,560 --> 00:22:34,360 This provides a way to connect hosts across a network 320 00:22:34,780 --> 00:22:35,000 reliably. 321 00:22:35,340 --> 00:22:38,820 As I mentioned before, TCP is considered to be a very reliable protocol. 322 00:22:40,200 --> 00:22:44,040 Actually, TCP provides a virtual circuit between two hosts. 323 00:22:44,320 --> 00:22:47,760 These hosts are actually connected from one endpoint to another. 324 00:22:47,920 --> 00:22:50,040 It's basically a virtual connection between the two machines. 325 00:22:51,420 --> 00:22:54,620 Communicating hosts are required to acknowledge receipt of network traffic. 326 00:22:55,000 --> 00:22:57,780 That way, you're guaranteed that that information you're being sent 327 00:22:57,780 --> 00:23:00,360 to that host is actually being received by that host. 328 00:23:00,620 --> 00:23:03,600 If for some reason that host drops in the middle of a transmission, 329 00:23:03,720 --> 00:23:04,360 you'd be notified. 330 00:23:04,780 --> 00:23:07,740 All the information you were sending to that host was not received. 331 00:23:13,280 --> 00:23:14,820 Some more features of TCP. 332 00:23:15,800 --> 00:23:20,820 TCP packages its data into segments, which contain both data and session control information. 333 00:23:22,840 --> 00:23:26,100 Since segments traversing a network may arrive out of order, 334 00:23:26,380 --> 00:23:29,280 TCP provides proper reassembly of these segments. 335 00:23:29,760 --> 00:23:33,400 As I mentioned before, all your packets may not necessarily take the same path. 336 00:23:33,400 --> 00:23:35,640 Some of these packets may arrive out of order, 337 00:23:35,840 --> 00:23:39,240 so we have to have a means for assembling these packets in the proper order 338 00:23:39,240 --> 00:23:41,220 once they arrive at their destination host. 339 00:23:41,960 --> 00:23:43,740 This is where sequence numbers come in. 340 00:23:44,600 --> 00:23:47,500 Sequence numbers are used to properly reassemble all these packets 341 00:23:47,500 --> 00:23:48,840 that are being sent to your host. 342 00:23:49,720 --> 00:23:53,540 You can think of the sequence number basically as a 32-bit counter. 343 00:23:54,120 --> 00:24:02,320 It can range anywhere from 0 to 4,294,967,295. 344 00:24:03,100 --> 00:24:05,880 It's a pretty broad range that the sequence number can fall into. 345 00:24:10,780 --> 00:24:15,480 This is just an example of how the FTP transfer TCP dump out foot. 346 00:24:16,260 --> 00:24:18,760 As we can see on our first line, we have TCP. 347 00:24:21,160 --> 00:24:23,440 It's obviously using FTP, it's telling us. 348 00:24:24,500 --> 00:24:27,460 The sequence number, we're just going to look at the last four digits of this. 349 00:24:27,500 --> 00:24:28,280 It's 1397. 350 00:24:29,200 --> 00:24:31,420 As you can see, the data payload is 1,494. 351 00:24:31,420 --> 00:24:33,040 It's 1,460 bytes. 352 00:24:34,160 --> 00:24:37,040 Next, we increment up 1,460. 353 00:24:37,160 --> 00:24:42,820 The sequence number is going to increase by 1,460 for packet 50. 354 00:24:43,060 --> 00:24:44,660 It's going to jump up to 2857. 355 00:24:46,260 --> 00:24:49,060 Once again, it's 1,460 bytes in this packet. 356 00:24:49,520 --> 00:24:53,060 Our next packet, obviously, is going to increase by that same amount of number 357 00:24:53,060 --> 00:24:54,000 for the sequence number. 358 00:24:54,180 --> 00:24:55,980 It increases to 4317. 359 00:24:56,640 --> 00:24:58,340 The same thing for packet 52. 360 00:24:59,580 --> 00:25:01,400 Essentially, if these packets arrive out of order, 361 00:25:01,420 --> 00:25:05,260 the receiving host can still put these packets back into the proper order 362 00:25:06,380 --> 00:25:09,460 and acknowledge what this data being sent across the wire is. 363 00:25:15,380 --> 00:25:17,140 One of the other features of TCP, 364 00:25:18,960 --> 00:25:22,720 it maximizes performance of a connection by ensuring TCP segments 365 00:25:22,720 --> 00:25:24,580 are neither too large or too small. 366 00:25:24,920 --> 00:25:27,940 There's a lot of balance checking to make sure it's not sending too much data. 367 00:25:28,100 --> 00:25:30,740 You don't want to send too much data because if that receiving host 368 00:25:30,740 --> 00:25:33,060 can't handle that much data, you're going to lose data, 369 00:25:33,260 --> 00:25:35,900 and you're going to have probably corrupted data being sent across the wire. 370 00:25:40,000 --> 00:25:44,180 Everything I've said about TCP can pretty much be wrapped up in a nutshell. 371 00:25:44,860 --> 00:25:46,540 It provides a virtual circuit. 372 00:25:46,940 --> 00:25:50,620 TCP connections behave like a live two-way connection. 373 00:25:52,360 --> 00:25:55,460 You can basically think about it as a telephone conversation. 374 00:25:55,520 --> 00:25:58,140 You're connected from one endpoint to another endpoint. 375 00:25:58,140 --> 00:26:00,740 It provides reliable connections. 376 00:26:01,420 --> 00:26:04,340 TCP segments are guaranteed to reach their destination, 377 00:26:04,680 --> 00:26:07,360 and if for some reason they are not receiving their destination, 378 00:26:07,700 --> 00:26:09,160 the user is notified about this. 379 00:26:09,960 --> 00:26:16,060 There's also a lot of stuff put into TCP that provides performance optimization. 380 00:26:17,080 --> 00:26:21,020 TCP can modify transmission variables depending on network conditions. 381 00:26:21,480 --> 00:26:23,500 For some reason, if a route seems to drop, 382 00:26:23,620 --> 00:26:25,000 a route seems to really be lagging, 383 00:26:25,140 --> 00:26:27,560 that information will reroute across the network, 384 00:26:27,560 --> 00:26:30,580 and it essentially will still reach the host, 385 00:26:30,680 --> 00:26:31,820 even if a route does drop. 386 00:26:36,960 --> 00:26:39,860 And now we're going to go ahead and take a look at the TCP header 387 00:26:39,860 --> 00:26:42,300 and all the fields that are included in the TCP header. 388 00:26:44,080 --> 00:26:45,640 The first two items we have, 389 00:26:45,780 --> 00:26:47,240 the 16-bit source port number, 390 00:26:47,460 --> 00:26:50,680 the 16-bit destination port number. 391 00:26:51,080 --> 00:26:54,140 Obviously, this is the IP address of your originating host 392 00:26:54,140 --> 00:26:55,620 and your destination host. 393 00:26:55,620 --> 00:26:59,240 The next field is your 32-bit sequence number. 394 00:26:59,720 --> 00:27:03,540 As I mentioned, the sequence number is a four-byte number assigned by TCP, 395 00:27:04,340 --> 00:27:06,340 starting with a randomly chosen number. 396 00:27:07,200 --> 00:27:10,700 Actually, the older operating systems, it wasn't really very random. 397 00:27:10,800 --> 00:27:11,940 I'll talk about that in a few minutes. 398 00:27:12,180 --> 00:27:15,120 I think Pete's actually going to elaborate on this in the next speech 399 00:27:15,440 --> 00:27:17,280 on TCP IP sequence prediction. 400 00:27:18,140 --> 00:27:22,700 This number is used to determine how many bytes have been transmitted across the network 401 00:27:22,700 --> 00:27:25,000 so it can properly assemble those packets 402 00:27:25,000 --> 00:27:26,000 once they're received. 403 00:27:27,880 --> 00:27:31,460 The next field is the 32-bit acknowledgement number. 404 00:27:32,540 --> 00:27:36,000 This acknowledgement number acknowledges the last segment sent by the host. 405 00:27:36,380 --> 00:27:38,780 We can't have all these packets traversing the network 406 00:27:38,780 --> 00:27:42,240 and hitting the host and the host not acknowledging that they're being received. 407 00:27:42,720 --> 00:27:44,560 Otherwise, there's no way we're going to have a good connection. 408 00:27:44,880 --> 00:27:47,540 There's no way we're going to have a reliable connection going across the wire. 409 00:27:49,480 --> 00:27:51,880 The next item is the four-bit header length. 410 00:27:52,540 --> 00:27:54,920 This measures the header length in four-byte order. 411 00:27:57,620 --> 00:27:59,000 The next field is reserve. 412 00:27:59,120 --> 00:28:00,320 I'm not going to discuss that. 413 00:28:00,720 --> 00:28:03,400 In the next field, we have six different flags. 414 00:28:03,680 --> 00:28:06,120 I'll give you a brief description of what each of those flags mean. 415 00:28:06,500 --> 00:28:09,280 These flags may either be turned on or turned off. 416 00:28:09,940 --> 00:28:12,860 These flags are used when negotiating and managing a connection. 417 00:28:13,680 --> 00:28:15,500 The first flag, which is URG, 418 00:28:16,860 --> 00:28:19,400 this indicates the segment being sent is urgent. 419 00:28:19,620 --> 00:28:23,640 So you can prioritize the urgency of segments being sent across the wire. 420 00:28:25,000 --> 00:28:27,480 The next flag is ACK, or acknowledge, 421 00:28:27,880 --> 00:28:31,220 indicates the ACK number and the segment header is valid. 422 00:28:32,640 --> 00:28:34,920 The next field is BUSH, P-S-H. 423 00:28:35,840 --> 00:28:40,220 This automatically tells that to pass the data to the application as soon as possible. 424 00:28:40,380 --> 00:28:44,780 It puts a precedence on this information to be passed to the application layer ASAP. 425 00:28:46,520 --> 00:28:48,760 The next field is RST, or reset. 426 00:28:48,860 --> 00:28:50,800 This flag is used to reset a connection. 427 00:28:52,200 --> 00:28:54,220 The next flag, which is SIN, 428 00:28:55,240 --> 00:28:58,580 synchronizes the numbers used to initiate a connection. 429 00:28:58,900 --> 00:29:01,280 I'll talk about initiating a connection in a few minutes. 430 00:29:02,300 --> 00:29:03,940 And the last field is FIN. 431 00:29:04,180 --> 00:29:06,880 This indicates that the sender has finished sending data. 432 00:29:07,140 --> 00:29:11,540 A FIN would be finished obviously at the very end of your flow of data, 433 00:29:11,740 --> 00:29:13,800 indicating they are no longer sending data. 434 00:29:14,020 --> 00:29:17,460 Your receiving host is going to know that it has received all this data at that time. 435 00:29:18,960 --> 00:29:21,460 The next field is the 16-bit window size. 436 00:29:22,120 --> 00:29:24,260 This is the number of bytes the receiving host 437 00:29:24,260 --> 00:29:25,240 is willing to accept. 438 00:29:25,660 --> 00:29:27,400 This is what's called a sliding window, 439 00:29:27,580 --> 00:29:30,880 and this can actually scale depending on what kind of traffic the host is receiving, 440 00:29:31,140 --> 00:29:34,640 the max being 65,535 bytes. 441 00:29:36,760 --> 00:29:40,100 The next field, the 16-bit TCP checksum. 442 00:29:40,680 --> 00:29:43,200 This is a checksum of the TCP header and data. 443 00:29:43,480 --> 00:29:45,880 Once again, this is used by the receiving host 444 00:29:45,880 --> 00:29:49,340 to ensure that that data being sent across the wire is not corrupted. 445 00:29:51,040 --> 00:29:53,840 The next field is the 16-bit urgent pointer. 446 00:29:54,500 --> 00:29:56,960 This is used only if the urgent flag is set, 447 00:29:57,140 --> 00:30:00,060 so a sense of precedence on your information going across the wire. 448 00:30:02,640 --> 00:30:04,200 The last field are options. 449 00:30:04,560 --> 00:30:08,020 The most commonly used options in TCP headers 450 00:30:09,160 --> 00:30:12,120 are both MSS, which is maximum segment size. 451 00:30:13,220 --> 00:30:17,740 This determines the maximum size segment the sender is willing to receive. 452 00:30:17,900 --> 00:30:22,380 So this basically coincides with the 16-bit window size I just discussed a minute ago. 453 00:30:23,080 --> 00:30:25,360 And then obviously at the bottom we have our data. 454 00:30:25,700 --> 00:30:27,860 Data is not always going to be sent across the wire, 455 00:30:27,980 --> 00:30:29,120 as you're going to see in a few minutes. 456 00:30:29,320 --> 00:30:31,980 When you're establishing a connection, no data is being sent. 457 00:30:32,240 --> 00:30:34,300 You must first establish that virtual connection 458 00:30:34,300 --> 00:30:36,800 before any data can be sent across the wire. 459 00:30:38,420 --> 00:30:43,880 So essentially this portion of the TCP segment is optional. 460 00:30:48,960 --> 00:30:51,740 And also jumping back to the synchronized numbers, 461 00:30:51,740 --> 00:30:54,200 I was talking about how the hosts synchronize, 462 00:30:54,200 --> 00:30:58,300 they use these numbers to determine how much data is being sent across the wire, 463 00:30:58,540 --> 00:31:01,320 and it's also used to properly reassemble these packets. 464 00:31:02,080 --> 00:31:06,060 On older systems, this number, when you first bootstrap the system, 465 00:31:06,120 --> 00:31:07,060 this number is set at 1. 466 00:31:07,520 --> 00:31:11,400 Every second it increases by 128,000, 467 00:31:11,540 --> 00:31:14,180 and every connection it would increase by 64,000. 468 00:31:14,460 --> 00:31:17,740 That's why in a lot of older systems it was a lot easier 469 00:31:17,740 --> 00:31:20,680 for people to try and predict TCP sequence numbers. 470 00:31:20,680 --> 00:31:23,300 These days, on current TCP IP stacks, 471 00:31:23,580 --> 00:31:24,840 this number is generated randomly, 472 00:31:25,080 --> 00:31:28,240 so it's not quite so easy to try and hijack a connection with that. 473 00:31:28,680 --> 00:31:32,220 I think Pete's going to be elaborating on that a little bit more in the next segment. 474 00:31:47,040 --> 00:31:49,980 And this is an actual TCP dump of a TCP header, 475 00:31:49,980 --> 00:31:51,500 to give you an idea of what it looks like. 476 00:31:51,740 --> 00:31:53,500 Our source port is 22. 477 00:31:53,640 --> 00:31:55,440 It's a well-known port, SSH. 478 00:31:56,360 --> 00:31:58,900 Destination port is 1714. 479 00:31:59,380 --> 00:32:00,620 It's an unknown port. 480 00:32:00,740 --> 00:32:02,240 It's an FRMO port. 481 00:32:03,060 --> 00:32:06,260 The sequence number, our acknowledgment number, 482 00:32:06,920 --> 00:32:08,960 the header length, which is 20 bytes, 483 00:32:09,180 --> 00:32:10,960 is telling us there's no data in this payload. 484 00:32:11,760 --> 00:32:14,400 Our flags, the origin flag is turned off. 485 00:32:14,620 --> 00:32:16,560 The acknowledge flag is turned on. 486 00:32:17,100 --> 00:32:18,820 The push flag is turned off. 487 00:32:19,520 --> 00:32:20,840 Reset flag is turned off. 488 00:32:21,180 --> 00:32:23,160 The synchronized flag is turned off, 489 00:32:23,200 --> 00:32:24,620 because we're not establishing a connection. 490 00:32:24,800 --> 00:32:26,020 We're already connected to this host. 491 00:32:26,320 --> 00:32:28,000 And the fin flag is turned off. 492 00:32:29,240 --> 00:32:33,940 The window advertisement is 32,736 bytes. 493 00:32:34,620 --> 00:32:38,380 This is how many bytes of data our remote host is willing to accept 494 00:32:38,380 --> 00:32:39,460 at that particular time. 495 00:32:40,320 --> 00:32:44,140 We also have our checksum that is used by the receiving host 496 00:32:44,140 --> 00:32:47,340 to ensure this data being sent across the web is not being corrupted. 497 00:32:47,340 --> 00:32:50,180 And our origin pointer is being set to zero 498 00:32:50,640 --> 00:32:52,860 because of the fact that the origin flag is off. 499 00:32:56,900 --> 00:32:58,800 This is just a little graphical representation 500 00:32:58,800 --> 00:33:01,800 of what actually happens when you establish a three-way connection 501 00:33:02,320 --> 00:33:04,240 or a TCP connection to a remote host. 502 00:33:04,580 --> 00:33:06,560 It's what's known as a three-way handshake. 503 00:33:10,520 --> 00:33:13,580 Initially, the client will send a SYN packet to the server 504 00:33:13,580 --> 00:33:15,060 with an ISN of X. 505 00:33:15,200 --> 00:33:16,260 We'll say it's X right now. 506 00:33:16,280 --> 00:33:17,080 It's not really important. 507 00:33:17,340 --> 00:33:18,020 It's just what number that is. 508 00:33:21,480 --> 00:33:23,780 The server is then going to apply with a SYN. 509 00:33:23,900 --> 00:33:25,760 It's going to set its own ISN as Y. 510 00:33:26,420 --> 00:33:31,620 And it's also going to acknowledge the client's ISN by adding 1 to it. 511 00:33:31,680 --> 00:33:33,580 So it would be X plus 1 in that case. 512 00:33:37,140 --> 00:33:40,820 The client then sends back another acknowledge with the server's ISN, 513 00:33:40,960 --> 00:33:42,120 which would be Y plus 1. 514 00:33:45,160 --> 00:33:48,060 Once this happens, we have a full connection established. 515 00:33:48,500 --> 00:33:50,960 Data connection will be sent across the wire at this time. 516 00:33:55,860 --> 00:33:59,060 And this is a packet dump showing exactly what it looks like 517 00:33:59,060 --> 00:34:01,540 when this three-way handshake is being established. 518 00:34:02,740 --> 00:34:09,040 As you can see, we're connecting from TCP port 24616 to an FTP port. 519 00:34:09,420 --> 00:34:10,740 We have our sequence number. 520 00:34:10,740 --> 00:34:12,220 I'll scope it off the last four. 521 00:34:12,280 --> 00:34:14,120 That's 1453. 522 00:34:15,080 --> 00:34:18,260 The requesting client sends a SYN or a synchronized segment, 523 00:34:19,580 --> 00:34:22,060 specifying the port number of the server it wishes to connect to 524 00:34:22,060 --> 00:34:24,920 and the client's ISN or initial sequence number. 525 00:34:29,500 --> 00:34:30,940 Part two of the handshake. 526 00:34:31,480 --> 00:34:35,660 The server responds with a SYN segment, including the server's own ISN, 527 00:34:35,700 --> 00:34:38,760 which is in blue, the last four being 5737. 528 00:34:40,400 --> 00:34:43,280 Acknowledgement is also sent with the client's ISN plus 1. 529 00:34:43,820 --> 00:34:45,860 So as you can see, that did increase by one. 530 00:34:45,900 --> 00:34:47,340 It's at 1454 now. 531 00:34:47,600 --> 00:34:50,860 It was originally at 1453 when we first initiated this connection. 532 00:34:54,940 --> 00:34:57,080 And the last part of the three-way handshake. 533 00:34:57,240 --> 00:35:00,780 The client acknowledges the server's SYN and sends an ACK segment 534 00:35:00,780 --> 00:35:04,180 with the server's ISN plus 1, which is the number in the blue. 535 00:35:04,700 --> 00:35:06,680 As you can see, that did increase by one. 536 00:35:06,700 --> 00:35:07,960 It's now at 5738. 537 00:35:07,960 --> 00:35:11,440 Whereas before with the last packet, it was 5737. 538 00:35:17,920 --> 00:35:20,640 If there's any questions, you can feel free to ask them anytime 539 00:35:20,640 --> 00:35:21,700 or save them until the end. 540 00:35:25,600 --> 00:35:28,340 Moving on to UDP, User Datagram Protocol. 541 00:35:29,020 --> 00:35:32,780 I mentioned before, UDP is also another transport layer protocol, 542 00:35:32,940 --> 00:35:33,640 such as TCP. 543 00:35:35,000 --> 00:35:37,520 UDP does not use the benefits of error detection. 544 00:35:38,380 --> 00:35:43,160 Error correction, handshaking, or verification of delivery like TCP. 545 00:35:43,900 --> 00:35:47,500 It provides a connectionless delivery system between two hosts. 546 00:35:47,920 --> 00:35:50,760 And because of the fact that there's no error checking, error correction, 547 00:35:50,980 --> 00:35:53,640 it doesn't ensure that your packets are receiving the host. 548 00:35:54,000 --> 00:35:56,360 UDP does have very low overhead. 549 00:35:56,700 --> 00:36:00,480 It's typically only used for very simple applications such as TFTP. 550 00:36:01,120 --> 00:36:05,500 If you have a real intensive application, you're not going to want to use UDP 551 00:36:05,500 --> 00:36:07,880 because there's no guarantee that this information 552 00:36:07,960 --> 00:36:11,060 or being sent across the wire is actually receiving its host. 553 00:36:11,500 --> 00:36:13,640 With an intensive application, you want to guarantee 554 00:36:13,640 --> 00:36:15,840 that the information is properly going across the wire. 555 00:36:20,920 --> 00:36:23,420 Now we'll take a look at all the fields in the UDP header. 556 00:36:23,840 --> 00:36:26,280 As you can see, it's a very small header because of the fact 557 00:36:26,280 --> 00:36:28,880 that it doesn't have a lot of these error correction bounce checking 558 00:36:28,880 --> 00:36:30,440 like the other information did. 559 00:36:31,560 --> 00:36:35,120 At the very top, the first two areas of the UDP header, 560 00:36:35,320 --> 00:36:37,360 the 16-bit source port number, 561 00:36:37,960 --> 00:36:39,620 16-bit destination port number. 562 00:36:39,760 --> 00:36:40,900 Those are both pretty obvious. 563 00:36:42,060 --> 00:36:44,020 The 16-bit UDP length. 564 00:36:44,800 --> 00:36:49,060 This indicates the length of the entire UDP datagram including the header. 565 00:36:50,580 --> 00:36:53,380 Next, we have the 16-bit UDP checksum. 566 00:36:54,020 --> 00:36:56,800 This is a checksum of the entire UDP datagram. 567 00:36:57,220 --> 00:37:00,080 Once again, this is used by the receiving host 568 00:37:00,080 --> 00:37:04,260 to ensure that data being sent across the wire is not being corrupted. 569 00:37:05,380 --> 00:37:07,220 And the last field is our data. 570 00:37:07,220 --> 00:37:08,500 It's obvious what that's going to be. 571 00:37:08,560 --> 00:37:10,760 It's our data we're sending to the application on the remote machine. 572 00:37:12,700 --> 00:37:13,100 Yes? 573 00:37:20,880 --> 00:37:24,300 He was asking, he said UDP does not do error detection. 574 00:37:25,460 --> 00:37:26,900 It's not actually doing error detection. 575 00:37:26,920 --> 00:37:30,660 It's just ensuring that that packet is properly formed once it's received the host. 576 00:37:31,040 --> 00:37:34,140 Let's say that packet does hit the host and it says there's something wrong with this packet. 577 00:37:34,340 --> 00:37:36,520 It's not going to let you know that there was something wrong with it. 578 00:37:40,580 --> 00:37:41,140 Right. 579 00:37:51,960 --> 00:37:55,940 And next, we'll take this natural TCP dump of a UDP header. 580 00:37:56,140 --> 00:37:57,580 See what it actually looks like. 581 00:37:57,780 --> 00:37:59,780 Our source port is 2167. 582 00:38:00,300 --> 00:38:04,500 This, once again, is an ephemeral port that the user is interacting with. 583 00:38:04,780 --> 00:38:06,540 The destination port is 53. 584 00:38:07,220 --> 00:38:08,860 It's a domain service, domain name service port. 585 00:38:08,980 --> 00:38:09,760 It's a DNS request. 586 00:38:10,740 --> 00:38:17,760 Datagram length is 37 bytes, 8 of which is the header and 29 of which is the actual data being sent. 587 00:38:18,080 --> 00:38:19,420 And then we have our checksum. 588 00:38:27,160 --> 00:38:29,440 That actually pretty much wraps up my speech. 589 00:38:30,000 --> 00:38:32,000 There's a couple of references I have in my slides. 590 00:38:32,320 --> 00:38:35,500 As I mentioned before, TCPIP Illustrator Volume 1. 591 00:38:35,960 --> 00:38:36,980 Excellent resource. 592 00:38:36,980 --> 00:38:43,120 It's kind of difficult to get into at first, but the more you read up on it, the easier it does seem to get. 593 00:38:44,400 --> 00:38:49,500 Also, TCPIP Network Administration is one of O'Reilly's books, written by Craig Hunt. 594 00:38:49,880 --> 00:38:51,560 It's a pretty decent book also. 595 00:38:57,660 --> 00:39:01,320 Like I said before, if anyone does want a copy of these slides, you can drop me an email. 596 00:39:01,560 --> 00:39:03,440 It's punkus at attrition.org. 597 00:39:03,680 --> 00:39:05,660 I'll be glad to send you a copy of these. 598 00:39:06,600 --> 00:39:07,300 Let's see. 599 00:39:10,000 --> 00:39:14,000 I also have in the references the TCPIP FAQ, the Frequently Asked Questions. 600 00:39:14,100 --> 00:39:15,440 It's broken down into two parts. 601 00:39:15,800 --> 00:39:18,340 There's a URL for that I could give to you. 602 00:39:21,100 --> 00:39:22,460 I'm not going to read it. 603 00:39:23,020 --> 00:39:24,380 And also TCP Show. 604 00:39:24,620 --> 00:39:26,800 TCP Show is a really good program. 605 00:39:26,900 --> 00:39:30,780 If you're trying to learn about TCPIP, I really recommend this program. 606 00:39:31,160 --> 00:39:34,340 It's a program that's used in conjunction with TCP Dump. 607 00:39:35,160 --> 00:39:41,200 TCP Show essentially reads a TCP dump save file, provides a reasonably complete decode 608 00:39:41,200 --> 00:39:51,060 of Ethernet, ALP, RARP, IP, ICMP, UDP, and TCP headers and packets that match the Boolean 609 00:39:51,060 --> 00:39:51,420 expression. 610 00:39:52,420 --> 00:39:57,200 All the dumps that I showed on the screen in this presentation were done using the program 611 00:39:57,200 --> 00:39:58,080 TCP Show. 612 00:39:58,560 --> 00:40:02,660 I don't know how familiar people in here are with TCP Dump, but it doesn't really provide 613 00:40:02,660 --> 00:40:07,180 an output that's real easy to determine what's going on with that information. 614 00:40:07,880 --> 00:40:14,160 So both TCP Show and TCP Dump use in conjunction with each other are excellent tools to examine 615 00:40:14,160 --> 00:40:16,080 exactly what's going on with TCP IP. 616 00:40:24,620 --> 00:40:30,580 Email address on the screen is punkis, P-U-N-K-I-S, at attrition.org. 617 00:40:32,020 --> 00:40:32,640 All right. 618 00:40:32,660 --> 00:40:36,200 For those of you who weren't in here before, who in here is familiar with attrition just 619 00:40:36,200 --> 00:40:36,620 out of curiosity? 620 00:40:37,680 --> 00:40:38,480 A couple people. 621 00:40:38,680 --> 00:40:42,880 Just so everyone gets a heads up, we are going to be changing the focus on attrition. 622 00:40:43,360 --> 00:40:47,080 There are going to be a lot of changes coming up in the near future on that, so keep your 623 00:40:47,080 --> 00:40:47,640 eyes on that. 624 00:40:47,920 --> 00:40:51,720 We are going toward a more technical content with that. 625 00:40:52,060 --> 00:40:53,920 So we are changing our focus a little bit on that. 626 00:40:58,000 --> 00:40:59,140 We're not dumping anything. 627 00:40:59,400 --> 00:41:00,680 We are ending a couple things. 628 00:41:00,820 --> 00:41:02,160 We're going to finish on a couple things. 629 00:41:02,160 --> 00:41:05,740 There's a couple things that we feel we don't need to pursue anymore. 630 00:41:05,900 --> 00:41:09,400 We think we've proven our point on a couple of the issues that we've been making. 631 00:41:10,500 --> 00:41:12,200 A lot of section will not go away. 632 00:41:12,520 --> 00:41:13,640 So reporters? 633 00:41:14,240 --> 00:41:14,720 Okay. 634 00:41:19,680 --> 00:41:20,880 Is there any other questions? 635 00:41:22,480 --> 00:41:22,960 Yes. 636 00:41:24,580 --> 00:41:25,060 Yes. 637 00:41:29,060 --> 00:41:29,640 What's that? 638 00:41:31,660 --> 00:41:35,660 He was asking if TCP show will do both Ethernet and token rings. 639 00:41:35,760 --> 00:41:36,040 Is that correct? 640 00:41:36,340 --> 00:41:38,140 To my knowledge, it does Ethernet only. 641 00:41:41,060 --> 00:41:42,400 I don't myself, no. 642 00:41:46,780 --> 00:41:50,140 Why doesn't it increase by one? 643 00:41:50,800 --> 00:41:53,480 Pete's going to be talking about this with the TCPIP vulnerabilities. 644 00:41:53,680 --> 00:41:57,860 If it increases by one, it's going to be very easily for an attacker to send basically 645 00:41:57,860 --> 00:41:59,560 a fake packet coming from wherever he wants. 646 00:41:59,560 --> 00:42:04,080 When they're receiving host and send back an acknowledgement number, you're going to 647 00:42:04,080 --> 00:42:05,740 know what the next number should be in that sequence. 648 00:42:05,940 --> 00:42:07,840 So it would be very easy to hijack a connection with that. 649 00:42:11,180 --> 00:42:15,700 The older TCPIP stacks every second, they increase 128,000. 650 00:42:16,060 --> 00:42:18,860 Every connection that's made, it increased by 64,000. 651 00:42:19,220 --> 00:42:22,700 So with a little bit of luck on other systems, it was a little bit easier to actually hijack 652 00:42:23,080 --> 00:42:24,320 a TCP session. 653 00:42:27,440 --> 00:42:27,840 Yes. 654 00:42:34,060 --> 00:42:35,480 UDP rarely is used anymore. 655 00:42:37,460 --> 00:42:43,820 TFTP is one of the really only stock applications that come with most systems that uses UDP anymore. 656 00:42:44,600 --> 00:42:51,080 Like I said before, it's just used for if you have a very non-crucial application, I 657 00:42:51,080 --> 00:42:55,020 guess I could say, where it's not really totally important that the data being sent across 658 00:42:55,020 --> 00:42:56,100 the wire is being acknowledged. 659 00:42:56,400 --> 00:42:57,820 If you're just using a system where you're using a TCP system, it's just not that important. 660 00:42:57,840 --> 00:43:00,600 So if you want a very low overhead, UDP would be a good time to use that. 661 00:43:05,160 --> 00:43:05,540 . 662 00:43:10,120 --> 00:43:10,500 . 663 00:43:13,460 --> 00:43:13,840 . 664 00:43:13,840 --> 00:43:14,100 . 665 00:43:19,260 --> 00:43:19,640 . 666 00:43:19,640 --> 00:43:19,660 . 667 00:43:19,660 --> 00:43:19,740 . 668 00:43:19,740 --> 00:43:20,380 . 669 00:43:20,380 --> 00:43:20,400 . 670 00:43:20,400 --> 00:43:20,460 . 671 00:43:21,920 --> 00:43:22,300 . 672 00:43:22,300 --> 00:43:22,400 . 673 00:43:22,400 --> 00:43:22,420 . 674 00:43:22,420 --> 00:43:22,500 . 675 00:43:27,940 --> 00:43:29,240 . 676 00:43:29,240 --> 00:43:29,890 . 677 00:43:33,000 --> 00:43:34,300 . 678 00:43:34,300 --> 00:43:34,440 . 679 00:43:34,440 --> 00:43:34,460 . 680 00:43:34,460 --> 00:43:36,140 . 681 00:43:36,140 --> 00:43:36,280 . 682 00:43:36,280 --> 00:43:36,800 . 683 00:43:36,800 --> 00:43:36,820 . 684 00:43:36,820 --> 00:43:37,600 . 685 00:43:37,600 --> 00:43:45,220 lot of frames not actually knowing it. Typically, video applications being sent across the internet 686 00:43:45,220 --> 00:43:48,280 are pretty intensive and you'll want to use something like TCP to send information. 687 00:43:53,760 --> 00:44:02,780 It would be obvious, but for instance, if you have some kind of service where people 688 00:44:02,780 --> 00:44:07,200 are paying for this information and you're dropping frames and obviously your video output 689 00:44:07,200 --> 00:44:12,420 is not going to look very good, then it would be up to the user to push that information 690 00:44:12,420 --> 00:44:13,220 across the wire. 691 00:44:27,620 --> 00:44:31,580 The checksum, I'm not going to go into that. That's a little more high level. It's 692 00:44:31,580 --> 00:44:35,340 actually a little bit above what I'm working on right now. I can't answer that. It's 693 00:44:35,340 --> 00:44:36,700 a hexadecimal number that's generated. 694 00:44:36,900 --> 00:44:37,180 Okay. 695 00:44:37,200 --> 00:44:42,500 By examining the contents of the payload. The same thing is done once it's received 696 00:44:42,500 --> 00:44:45,780 by its receiving host and to ensure that the data is being received properly. 697 00:44:50,620 --> 00:44:54,460 Any other questions? Comments? Death threats? 698 00:45:03,940 --> 00:45:05,180 I can't hear you. 699 00:45:07,980 --> 00:45:08,780 What about it? 700 00:45:12,080 --> 00:45:13,280 There's not a time to live? 701 00:45:14,540 --> 00:45:19,020 Okay. He was asking what could be a potential problem with sending information across the 702 00:45:19,020 --> 00:45:23,180 wire without a time to live. Obviously, if I'm sending information to a host on the internet 703 00:45:23,180 --> 00:45:26,920 that's not actually up at that time, this information's going to be bouncing across 704 00:45:26,920 --> 00:45:31,020 the internet forever. Let's say that host never comes back up. This internet's always 705 00:45:31,020 --> 00:45:34,320 going to be bouncing across the internet. So you're going to cause a lot of overhead 706 00:45:34,320 --> 00:45:36,540 problems, obviously. Hosts are dropping every day. 707 00:45:42,640 --> 00:45:45,700 Using the TTL, they will. Without the TTL, they will not. 708 00:45:52,320 --> 00:45:58,180 Well, the TTL cannot be set above 255, so there is an upper limit on that. 709 00:46:01,560 --> 00:46:02,180 And back. 710 00:46:03,420 --> 00:46:03,820 . 711 00:46:04,260 --> 00:46:04,660 . 712 00:46:04,660 --> 00:46:06,520 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 713 00:46:18,580 --> 00:46:36,100 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 714 00:46:36,100 --> 00:46:39,320 If you traceroute a host, even if you're tracerouting it to the other side of the world, 715 00:46:39,420 --> 00:46:41,360 you're probably not going to have more than 20 or 30 hops. 716 00:46:42,040 --> 00:46:45,000 I've never done a traceroute where I've had probably more than 40 hops. 717 00:46:45,240 --> 00:46:48,020 So I think actually 255 is very reasonable. 718 00:46:48,460 --> 00:46:50,720 By average, about 860, right? 719 00:46:52,060 --> 00:46:52,420 Yes. 720 00:46:53,680 --> 00:46:54,040 Yes. 721 00:46:57,920 --> 00:46:58,220 Correct. 722 00:47:02,180 --> 00:47:04,020 It's being done automatically by traceroute. 723 00:47:04,020 --> 00:47:07,040 Through our modifications, I think actually Route has written one 724 00:47:07,040 --> 00:47:09,400 where you can increase the blur, that can be changed. 725 00:47:10,580 --> 00:47:13,160 But that's the default that it sets it as, is 30. 726 00:47:15,300 --> 00:47:17,360 That's why sometimes if you're doing a traceroute 727 00:47:17,360 --> 00:47:19,040 and you'll get your first three lines of information, 728 00:47:19,460 --> 00:47:21,240 then you'll get a couple rows of asterisks, 729 00:47:21,280 --> 00:47:23,760 it's succeeding, it's time to live, that those packets are being dropped. 730 00:47:28,040 --> 00:47:28,960 Any other questions? 731 00:47:34,620 --> 00:47:37,880 Actually, it depends on who you ask about it. 732 00:47:37,980 --> 00:47:40,440 Some people say it's one, some people say it's the other. 733 00:47:40,480 --> 00:47:41,940 Typically, it's just how many hops. 734 00:47:47,540 --> 00:47:48,060 Yes. 735 00:47:48,400 --> 00:47:51,340 If the urgency set automatically, is it right? 736 00:47:51,880 --> 00:47:55,000 The urgency set automatically unless you actually build a program 737 00:47:55,000 --> 00:47:56,300 where you're constructing your own packets. 738 00:47:56,520 --> 00:47:57,420 It's set automatically. 739 00:47:58,640 --> 00:47:59,160 Okay. 740 00:48:12,720 --> 00:48:15,820 Read TCPIP Volumes 1 through 3 and learn how to program in C. 741 00:48:28,460 --> 00:48:30,840 While it does make a program called LibNet, 742 00:48:32,240 --> 00:48:34,000 I'm not sure what his site even is these days. 743 00:48:34,020 --> 00:48:35,160 I don't even know if it's up. 744 00:48:35,320 --> 00:48:36,740 It's L-I-B-N-E-T. 745 00:48:37,260 --> 00:48:38,800 And I know... 746 00:48:39,880 --> 00:48:42,220 It's a C function library that does all the... 747 00:48:46,320 --> 00:48:49,160 Okay, packetfactory.com, I believe, is the new URL for that. 748 00:48:49,360 --> 00:48:53,560 And actually, they're supposed to be releasing a newer and bigger version of that 749 00:48:53,560 --> 00:48:55,600 in the real near future, I believe. 750 00:49:01,120 --> 00:49:02,120 Any other questions? 751 00:49:05,040 --> 00:49:06,700 Okay, guys. 752 00:49:06,940 --> 00:49:08,380 Thank you.