This article is part of Internet Security Lectures
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.
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. The IP Datagram is as follows.
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 |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
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 attacker A takes over the identity of a trusted host T in order to subvert the security of the target 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 connection between a 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 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.
A datagram on an external interface 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.
All routers must employ proper IP filtering rules. They should only route packets from sources that could legitimately come from the 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.
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).
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 involving fragments 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.
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.
E.g., if the first fragment was 24 bytes long, the second fragment may claim 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.
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. 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.
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." ICMP is used by network nodes and their administrators to exchange information about the state of the network. 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 network making it unusable for real traffic.
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 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, all networks should perform filtering either at the edge of the network where customers connect (access layer) or at the edge of the network with connections to the upstream providers, in order to defeat the possibility of source address spoofed packets from entering from downstream networks, or leaving for upstream networks.
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.
None.
| 04/24/08 04:25:20 PM |
| Copyright © 2008 pmateti@wright.edu |