What is packet fragmentation?

Every packet-based network has an MTU (Maximum Transmission Unit) size. The MTU is the size of the largest packet which that network can transmit.

Packets larger than the allowable MTU must be divided into multiple smaller packets, or fragments, to enable them to traverse the network.

NetworkStandard MTU
Ethernet1500
Token Ring4096

Packet Headers

Every IP packet has an IP (Internet Protocol) header which stores information about the packet, including:

Note: For more information on the IP header, see RFC 791 - Internet Protocol.

Three of these fields are involved in packet fragmentation.

Identification: 16 bits

An identifying value assigned by the sender to aid in assembling the fragments of a datagram.

Flags: 3 bits

Various Control Flags.

Bit 0: reserved, must be zero
Bit 1: (DF) 0 = May Fragment, 1 = Don't Fragment.
Bit 2: (MF) 0 = Last Fragment, 1 = More Fragments.
  0   1   2
+---+---+---+
|   | D | M |
| 0 | F | F |
+---+---+---+

Fragment Offset: 13 bits

This field indicates where in the datagram this fragment belongs.

The fragment offset is measured in units of 8 octets (64 bits). The first fragment has offset zero.

Much like the IP header, the TCP (Transmission Control Protocol) header stores information about the packet:

Note: For more information on the TCP header, see RFC 793 - Transmission Control Protocol.

A Packet Fragmentation Example

If a 2,366 byte packet enters an Ethernet network with a default MTU size, it must be fragmented into two packets.

The first packet will:

The second packet will:

The Packet Fragmentation Attack

Packet fragmentation can be utilized to get around blocking rules on some firewalls.

This is done by cheating with the value of the Fragment Offset. The trick is to set the value of the Fragment Offset on the second packet so low that instead of appending the second packet to the first packet, it actually overwrites the data and part of the TCP header of the first packet.

Let's say you want to `telnet` into a network where TCP port 23 is blocked by a packet filtering firewall. However, SMTP port 25 is allowed into that network.

What you would do is to send two packets:

The first packet would:

The second packet would:

The packet filtering firewall will see that the Fragment Offset is greater than zero on the second packet. From this data, it will deduce that the second packet is a fragment of another packet and it will not check the second packet against the rule set.

When the two packets arrive at the target host, they will be reassembled. The second packet will overwrite most of the first packet and the contents of the combined packet will go to port 23.




Bookmark What is packet fragmentation?

Latest Blog Posts


Copyright 2008 Tech-FAQ. All rights reserved.