|
|
Wright State University Dayton, Ohio 45435-0001 |
Abstract: This lecture explains a few of the past exploits at the "IP level." These include spoofing, smurfing, and tunneling.
This article is part of Internet Security Lectures
The IP Datagram is as follows. In this article, we are focused on the (mis-) use of the 4-byte source address, and the 3-bit flags and the 13-bit fragment offset fields.
0 1 2 3
0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|Version| IHL |Type of Service| Total Length |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
| Identification |Flags| Fragment Offset |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
| Time to Live | Protocol | Header Checksum |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
| Source Address |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
| Destination Address |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
| Options | Padding |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
| data |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
| data |
\ \
\ \
| data |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
| data |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
On the Internet, "to spoof" can mean one or more of the following:
Be aware that in the exploits literature, there are a number of articles with the words "IP spoofing" in their titles, but which deal with TCP.
IP spoofing replaces the IP address of (usually) the sender or (in rare cases) the destination with a different address. Because the IP layer of the OS normally adds these IP addresses to a data packet, a spoofer has to circumvent the IP layer and talk directly to the raw network device. IP spoofing is normally used to deposit another exploit on the target machine.
Any services that authenticate based on the IP addresses or host
names are vulnerable. These include RPC, NFS, r-commands
(rlogin, rsh, rcp, etc.), anything wrapped by the TCP
daemon wrappers, X windows, and other applications that use source IP
addresses for authentication.
The attacking host machine A wishes to take over the identity of a trusted host T in order to subvert the security of a targeted victim host U. The trusted host T is either discovered to be down (temporarily for a few seconds, say) or is disabled using a variety of methods. In the so-called blind attack, A is unable to see the replies, if any, that U gives T. In the non-blind attack, all conversation between U and T is seen by A. Depending on how carefully the intervening routers are configured, it is not necessary that A reside on the same subnet as T.
Note that simply reassigning the IP address of T to the host A using
ifconfig will not be good enough. Other hosts, as
well as T, will discover (through ARP, e.g.) that there are two machines
with the same IP address.
[using Dunnigan and Nofi's classification scheme]
Another way to view this issue is in terms of the net effect on information in information systems.
The attacker A notices an ongoing TCP connection between a targeted victim host U and a trusted host T. A sends packets to U with source IP address equal to that of T. As far as U knows, it is carrying on a conversation with T. The intervening routers route the response packets of U to T. But T's TCP layer will discard them because the packets are "replies" to packets it never sent. The reply datagrams U sends back (destined for T) may never reach A, and hence the name of this attack. So the attacker must know what was sent, and predict what response the server T will send.
Non-blind spoofing is related to session hijacking, and will be described in the lecture on TCP Exploits.
There are three main mechanisms by which an attacker can spoof routing information. Route spoofing is not based on IP spoofing. It is discussed here because it is a form of spoofing.
/etc/services). In both of the above
cases, the redirection can be made to any host chosen by the
attacker.Detection of IP spoofing requires the coordinated effort of many hosts, and security hardened OS kernels, and even then it is not guaranteed. E.g., we can expect to have a dynamically updated database of machines that are not on-line at any given moment. We can also expect a kernel to keep a record of a request to substitute a spoofed IP address, and even inform of this request to trust keepers.
A datagram on an external NIC that has both its source and destination IP addresses in the local domain is an indication of IP spoofing. Another way to detect IP spoofing is to compare the process accounting logs between systems. If the IP spoofing attack has succeeded, there should be a log entry on the victim machine showing a remote access, and on the apparent source machine, there will be no corresponding entry for initiating that remote access.
IP spoofing can be prevented by hardened OS kernels. Such a kernel can refuse to place an ethernet frame on an NIC when the source IP address does not match the address assigned to that NIC. This brings up the question of how does a receiving host know that the sending host is running a trustworthy OS. Even though, TCP officially does not require verification of the host requesting connection, this action can be added.
All routers must employ proper IP filtering rules. They should only route packets from sources that could legitimately come from the network interface the packet arrives on. Most routers now have options to turn off the ability to spoof IP source addresses by checking the source address of a packet against the routing table to ensure the return path of the packet is through the interface it was received on. We will be discussing IP filtering techniques and tools in a later lecture.
It is worth recalling that the Internet Protocol (IP) defines a datagram that can be routed through the Internet, and it permits a means for fragmenting datagrams into packets and reassembling packets into the original datagrams. When packets are too large to be sent in a single IP packet, due to interface hardware limitations for example, they can be split up by an intermediate router unless prohibited by the Don't Fragment flag. IP fragmentation occurs when a router receives a packet larger than the MTU (Maximum Transmission Unit) of the next network segment. All such fragments will have the same Identification field value, and the fragment offset gives the position of the current fragment in the context of the pre-split up packet. Intermediate routers are not expected to re-assemble the fragments. The final destination will reassemble all the fragments of an IP packet and pass it to higher protocol layers (like TCP or UDP). Note that fragmented IP datagrams may not arrive in the "right" order, and obviously a reassembly is not possible until all fragments are received.
In the IP layer implementations of nearly all OS, the reassembly code has bugs, and/or not so carefully coded algorithms. An attacker can create and send a pair of carefully crafted but malformed IP packets, with the use of illegal fragment offsets, which in the process of reassembly cause a server to (i) panic and crash, or (ii) reassemble the datagram in a surprising way.
Suppose the first fragment was 24 bytes long, but the second fragment claims an offset of 20. Upon reassembly, the data in the second fragment overwrites the last four bytes of the data from the first fragment. If the unfragmented packet was TCP, the first fragment would have been the TCP header, and the second fragment overwrote the destination port number.
Attackers create artificially fragmented packets in order to circumvent firewalls that do not perform packet reassembly. These only consider the properties of each individual fragment, and let the fragments through to final destination.
One such attack is known as the tiny fragment attack. Two TCP fragments are created. The first fragment is so small that it does not even include the full TCP header, particularly the destination port number. The second fragment contains the remainder of the TCP header, including the port number.
The receiving host in reassembling a malformed packet
calculates the length for the second fragment, and it can turn
out to be negative because of the clever crafting [Exercise:
Do it!]. This value is passed to a function (such
as memcpy()) which does a copy from/ to memory,
takes the negative number to be an enormous unsigned
(positive) number and a segmentation fault happens.
Fragments can be so crafted that when reassembled the resul will be an abnormally large packet, larger than the maximum permissible length for an IP packet. The attacker hopes that the receiving host will crash while attempting to reassemble the packet. The Ping of Death used this attack. It creates an ICMP echo request packet which is larger than the maximum packet size of 65,535 bytes.
"Smurf" is the name of an automated program that attacks a network by exploiting IP broadcast addressing. Smurf and similar programs can cause the attacked part of a network to become "inoperable." A smurf program builds a network packet with a spoofed victim source address. The packet contains an ICMP ping message addressed to an IP broadcast address, meaning all IP addresses in a given network. If the routing device delivering traffic to those broadcast addresses performs the IP broadcast to layer 2 broadcast function, most hosts on that IP network will reply to it with an ICMP echo reply each. The echo responses to the ping message are sent back to the victim address. Enough pings and resultant echoes can flood the victim host and even the network making it unusable for real traffic.
One way to defeat smurfing is to disable IP broadcast addressing at each network router since it is seldom used. The CERT Coordination Center's Advisory on "smurf" IP Denial-of-Service Attacks provides further suggestions.
A related attack is called "fraggle", simple re-write of smurf, uses UDP echo packets in the same fashion as the ICMP echo packets. The intermediary (broadcast) devices, and the spoofed victim are both hurt by this attack. The attackers rely on the ability to source spoofed packets to the "amplifiers" in order to generate the traffic which causes the denial of service. In order to stop this, packet filtering must be done at the edge of the network.
None.
| 04/24/08 |
| Copyright © 2008 pmateti@wright.edu |