Stopping IP Address Spoofing Attack Computer Science Essay

Published: Last Edited:

This essay has been submitted by a student. This is not an example of the work written by our professional essay writers.

IP address spoofing is the creation of IP packets using somebody else's IP source addresses. This technique is used for obvious reasons and is employed in several of the attacks discussed later. Examining the IP header, we can see that the first 12 bytes contain various information about the packet. The next 8 bytes, however, contains the source and destination IP addresses. Using one of several tools, an attacker can easily modify these addresses - specifically the "source address" field.

A common misconception is that "IP spoofing" can be used to hide our IP address while surfing the Internet, chatting on-line, sending e-mail, and so forth. This is generally not true. Forging the source IP address causes the responses to be misdirected, meaning you cannot create a normal network connection.

Figure 1 is valid source IP address, illustrates a typical communication among a workstation with a right source IP address requesting web pages and the web server running the requests. workstation requests a page from the web server the request contains both the address of the web server running the request (i.e. destination IP address and the workstation's IP address (i.e. source IP address The web server precedes the web page by the source IP address specified in the request as the destination IP address, and its own IP address as the source IP address,

Figure 1

Figure 1: Valid source IP address

Figure 2 is Spoofed source IP address, illustrates the interaction among a workstation requesting web pages using a spoofed source IP address and the web server running the requests. If a spoofed source IP address (i.e. is used by the workstation, the web server executing the web page request will attempt to run the request by sending information to the IP address of what it believes to be the originating system (i.e. the workstation at The system at the spoofed IP address will receive unsolicited connection attempts from the web server that it will simply remove.

Figuere 2

Figure 2: Spoofed source IP address

2 IP routing mechanism and problems

Figure 3

Figure 3: IP Routing mechanism

IP routing is hop by hop. Every IP packet is routed separately. The route of a IP packet is decided by all the routers the packet goes through.

IP address spoofing is possible because routers only require inspection of the destination IP address in the packet to make routing decisions. The source IP address is not required by routers and an invalid source IP address will not affect the delivery of packets.

That address is only used by the destination machine when it responds back to the source.

3 IP address spoofing and Applications

3.1 Asymmetric routing (Splitting routing)

Asymmetric routing means traffic goes over different interfaces for directions in and out. In other words, asymmetric routing is when the response to a packet follows a different path from one host to another than the original packet did. The more correct and more general answer is, for any source IP address 'A' and destination 'B', the path followed by any packet (request or response) from 'A' to 'B' is different than the path taken by a packet from 'B' to 'A'.

Figure 4

Figure 4: Asymmetric routing

3.2 Implementation of asymmetric routing

Modern O.S. allows us to receive packets from an input interface, different from the output interface.

In Linux, we can implement asymmetric routing using iptables (linux 2.4):

iptables -A POSTROUTING -t nat -j SNAT -to -o eth0

This means, for all the packets going out via eth0, their source IP address will be changed to

We also have to "disable" reverse path filtering

Echo "0" > /proc/sys/net/ipv4/conf/all/rp_filter


Satellite DSL (SAT DSL) makes use of asymmetric routing.


Figure 5. Satellite DSL

The advantage of a satellite network is to provide high bandwidth services independent of the users location over a wide geographical area. A satellite network consists of two types of stations: feeds and receivers. Every receiver has a satellite dish connected to a user station. The user station has an extra interface, DSL modem connected to the ISP, this is called return channel. All requests to Internet are sent via DSL connection, and responses from Internet should be routed by a feed on the satellite network. After the information is sent from the feed to a satellite, it will be broadcast to all the receivers that belong to the satellite coverage. Installing feeds in strategic positions over the Internet will create shorter paths and higher bandwidth provided by the satellite network. The user host has therefore two IP addresses, one for the satellite subnetwork and the other for the regular connection subnetwork (return channel).

The traffic path of satellite dsl is:


Figure 6: Traffic Path of Satellite DSL

First we make the request (1) (using our Internet connection) to the Sat-Server, after it retrieves out info from Internet (2) it will send it to Satellite (3); in the end we would receive data from the satellite(4) to our home using a parabolic antenna and a Sat Card.

3.4 Probable problem with AOLs DSL connection setup

AOL DSL service implements a certain connection setup procedure in order to apply VPN (Virtual Private Network) for its users. When a user dials in to the AOL DSL ISP, these procedures are taken place:

1. User is connected to the ISP using a public account and so a network connection between user and the ISP is established. But user can only receive data using this connection, thus is not able to send any internet request.

2. On top of this connection, A VPN is established using user's private account. After the authentication succeeds, a user can send and receive data through this VPN connection.

This certain procedures are AOL's attempt to create secure internet traffic over DNS connection. But as it usually is, one solution to a security problem may lead to another problem. And this applies also to AOL's DSL connection setup. With certain setup and an IP address spoofing technique, a user can connect to AOL DSL ISP, and download as much data as he wants using this connection without paying any cent. This picture depicts such setup and how the attack works.


Figure 7: Problem in AOL DSL

1. On first network interface, the user dials for a DSL connection to T-Online or other ISPs using his account. The user can send and receive data with this connection.

2. On second network interface, the user dials to AOL DSL ISP using a free public account to establish a DSL connection that goes one way from ISP to user.

3. Before the user sends packet through T-Online connection, he spoofs the source IP address of the packet into the IP address of the second network interface (which is connected to AOL DSL)

4. And so he sends requests through T-Online connection, and receives response through AOL DSL connection. This way the user only needs to pay for every bits he sends to T-Online, and get for free every bits he receives from AOL DSL, which would have cost a lot more than the cost for sending bits, because people usually spend more time downloading from the internet instead of sending data to the internet.

3.5 NAT

NAT means to network address translation.

In computer networking, network address translation (NAT) is the process of translate the IP address information in IP packet headers while in transit across a traffic routing device.

If one of these links were to do network address translation, then they would modify the destinations or source of the packet as it passes through. the link doing network address translation will remember how it mangled a packet, and when a reply packet passes through the other way, it will do the reverse mangling on that respond packet, so everything works.

NAT have several applications:

• Modem Connections To The Internet

Most ISPs give you a single IP address when you dial up to them. You can send out packets with any source address you want, but only replies to packets with this source IP address will return to you. If you want to use multiple different machines (such as a home network) to connect to the Internet through this one link, you'll need NAT.

• Multiple Servers

Sometimes you want to change where packets heading into your network will go. Frequentlythis is because (as above) you have only one IP address, but you want people to be able to get into the boxes behind the one with the `real' IP address. If you rewrite the destination of incoming packets, you can manage this. This type of NAT was called port-forwarding.A common variation of this is load-sharing, where the mapping ranges over a set of machines, fanning packets out to them.

• Transparent Proxying

Sometimes you want to pretend that each packet which passes through your Linux box is destined for a program on the Linux box itself. This is used to make transparent proxies: a proxy is a program which stands between your network and the outside world, shuffling communication between the two. The transparent part is because your network won't even know it's talking to a proxy, unless of course, the proxy doesn't work.

NAT has two different types: Source NAT (SNAT) and Destination NAT (DNAT).

Source NAT is when you alter the source address of the first packet: i.e. you are changing where the connection is coming from. Source NAT is always done post-routing, just before the packet goes out onto the wire. Masquerading is a specialized form of SNAT.

Destination NAT is when you alter the destination address of the first packet: i.e. you are changing where the connection is going to. Destination NAT is always done before routing, when the packet first comes off the wire. Port forwarding, load sharing, and transparent proxying are all forms of DNAT.


Figure 8: NAT

3.6 IP masquerade:

IP Masquerade, is a specific form of Network Address Translation (NAT) which allows internally connected computers that do not have registered Internet IP addresses to communicate to the Internet via the Linux server's Internet IP address. IP masquerading lets you use a single Internet-connected computer running Linux with a real IP address as a gateway for non-connected machines with "fake" IP addresses. The Linux box with a real address handles mapping packets from your intranet out to the Internet, and when responses come back, it maps them back to your intranet. This lets you browse the web and use other Internet functions from multiple machines without having a special network setup from your ISP.

IP Masquerade is a networking function in Linux similar to the one-to-many (1:Many) NAT (Network Address Translation) servers found in many commercial firewalls and network routers. For example, if a Linux host is connected to the Internet via PPP, Ethernet, etc., the IP Masquerade feature allows other "internal" computers connected to this Linux box (via PPP, Ethernet, etc.) to also reach the Internet as well. Linux IP Masquerading allows for this functionality even though these internal machines don't have an officially assigned IP address.

IP masquerading is different from NAT. While IP masquerading implements a specific many-to-one NAT, IP NAT allows complex many-to-many translations. For static real IP address we use NAT, while for dynamic real IP address (via PPP) we use IP masquerading.


Figure 9: IP Masquerading

4 IP address spoofing attack

4.1 Blind IP spoofing

Usually the attacker does not have access to the reply, abuse trust relationship between hosts.

For example:

Host C sends an IP datagram with the address of some other host (Host A) as the source address to

Host B. Attacked host (B) replies to the legitimate host (A)


Figure 10: Blind IP Spoofing

4.2 Man-in-the-middle attacks

If an attacker controls a gateway that is in the delivery route, he can

• sniff the traffic

• intercept / block / delay traffic

• modify traffic


Figure 11: Man-in-the-middle attacks

This is not easy in the Internet because of hop-by-hop routing, unless you control one of the backbone hosts or source routing is used.

This can also be done combined with IP source routing option. IP source routing is used to specify the route in the delivery of a packet, which is independent of the normal delivery mechanisms. If the traffic can be forced through specific routes (=specific hosts), and if the reverse route is used to reply traffic, a host on the route can easily impersonate another host. The attack procedure could be:


Figure 12: Source Routing attacks

4.3 Attacks concerning the routing protocols

A host can send spoofed RIP packets in order to "inject" routes into a host. This is easy to implement, it only requires IP/UDP spoofing. On a LAN with RIPv2 passwords have to be used for updating routes, but plaintext passwords are used. The plaintext passwords can be sniffed.


Figure 13: Link state before RIP attack

Attacker sends a forged RIP packet router 2 and says it has the shortest path to the network that router1 connects. Then all the packets to that network will be routed to attacker. The attacker can sniff the traffic.


Figure 14: Link State after RIP attack

4.4 IP address spoofing attack with ICMP

4.4.1 ICMP Echo attacks

• Map the hosts of a network

The attack sends ICMP echo datagram to all the hosts in a subnet, then he collects the replies and determines which hosts are alive.

• Denial of service attack (SMURF attack)

The attack sends spoofed (with victim's IP address) ICMP Echo Requests to subnets, the victim will get ICMP Echo Replies from every machine.


Figure 15: Smurf attack

4.4.2 ICMP Redirect attacks

ICMP redirect messages can be used to re-route traffic on specific routes or to a specific host that is not a router at all.

The ICMP redirect attack is very simple: just send a spoofed ICMP redirect message that appears to come from the host's default gateway.

For example: Host sends a forged ICMP packet to host, saying the route through is a better way to internet. The source IP address of this forged ICMP packet is the gateway's IP address Then all the traffic from to internet will go through


Figure 16: Before ICMP redirect attack


Figure 17: After ICMP redirect attack

4.4.3 ICMP destination unreachable attacks

ICMP destination unreachable message is used by gateways to state that the datagram cannot be delivered. It can be used to "cut" out nodes from the network. It is a denial of service attack (DOS)


An attacker injects many forged destination unreachable messages stating that is unreachable) into a subnet (e.g. 128.100.100.*). If someone from the 128.100.100.* net tries to contact, he will immediately get an ICMP Time Exceeded from the attacker's host. For 128.100.100.* this means that there is no way to contact, and therefore communication fails.


Figure 18: ICMP destination unreachable attacks

4.5 UDP attacks

UDP is an unreliable transport layer protocol. It relies on IP, it is connectionless, and its checksum is optional. Therefore, the delivery, integrity, non-duplication and ordering are not guaranteed. It is easy to send a forged packet to the target. Compared with this, TCP is connection oriented and the TCP connection setup sequence number is hard to predicated, so it is hard to insert forged packet into the TCP connection. Therefore UDP traffic is more vulnerable for IP spoofing than TCP.


Figure 19: UDP spoofing


Figure 20: UDP hijacking

4.6 TCP attacks

Although it is hard to do IP spoofing on TCP, it is still can be realized on the specific OS. The attack aims at impersonating another host mostly during the TCP connection establishment phase.

For example:

Node A trusts node B (e.g. login with no password)

Node C wants to impersonate B with respect to A in opening a TCP connection

C kills B (flooding, redirecting or crashing) firstly

C sends A an TCP segment in a spoofed IP packet with B's address as the source IP and 11000 as the sequence number.

A replies with a TCP SYN/ACK segment to B with 54002 as the sequence number

C does not receive the segment from A to B, but in order to finish the handshake it has to send an ACK segment with 54002+1 as the acknowledge number to A. C has to guess or predicate the value of 54002.


Figure 21: TCP spoofing

5 Stopping IP address spoofing attack

5.1 Packet filtering

The router that connects a network to another network is known as a border router. One way to mitigate the threat of IP spoofing is by inspecting packets when they the leave and enter a network looking for invalid source IP addresses. If this type of filtering were performed on all border routers, IP address spoofing would be greatly reduced.

Egress filtering checks the source IP address of packets to ensure they come from a valid IP address range within the internal network. When the router receives a packet that contains an invalid source address, the packet is simply discarded and does not leave the network boundary.

Ingress filtering checks the source IP address of packets that enter the network to ensure they do not come from sources that are not permitted to access the network. At a minimum, all private, reserved, and internal IP addresses should be discarded by the router and not allowed to enter the network.

In Linux, packet filtering can be enabled using:

echo 2 > /proc/sys/net/ipv4/conf/*/rp_filter

5.2 Limits of packet filtering

Packet filtering normally may not prevent a system from participating in an attack if the spoofed IP address used could fall within the valid internal address range. However it will simplify the process of tracing the packets, since the systems will have to use a source IP address within the valid IP range of the network.

We take the campus network as example:


Figure 22: Campus network

The network number is The packet filtering of the router is enabled. For IP packet 1, host forges a packet from, the source IP address is in the valid IP range, the router thinks it is valid packet and sends it out to internet.

For IP packet 2, host forges a packet from, the source IP address is not in the valid IP range, the router thinks it is invalid and discards it.

Packet filtering can pose problems if you use splitting routing (packets from you to a host take a different path than packets from that host to you). If splitting routing is in use, enabling packet filtering facility will block all packets with spoofed source addresses. To turn rp_filter off, use:

echo 0 > /proc/sys/net/ipv4/conf/<device>/rp_filter


echo 0 > /proc/sys/net/ipv4/conf/all/rp_filter

Instances where you might need to disable packet filtering include:

• If you want to do asymmetric routing (accepting returning packets inbound an interface other than the outbound interface).

• If the box has multiple interfaces up on the same network.

• If you are using special VPN interfaces to tunnel traffic (e.g. FreeS/WAN)

Another problem is that many ISPs do not have the technical ability to arrange packet filtering to block packets with spoofed source addresses. Also, packet filtering reduces equipment performance.

6 Experiments

Goal: Implement an example environment for splitting routing, IP spoofing scenario.

6.1 Scenario description


Figure 23: experiment scenario

6.2 Configuration

We do the experiment under Linux Suse 8.0. The tools needed are:

• Iptables

• Ethereal

The configuration is:


ifconfig eth0

ifconfig eth1

iptables -A POSTROUTING -t nat -j SNAT -to -o eth0

echo "0" > /proc/sys/net/ipv4/conf/all/rp_filter


ifconfig eth0

ifconfig eth1

iptables -A POSTROUTING -t nat -j SNAT -to -o eth0

echo "0" > /proc/sys/net/ipv4/conf/all/rp_filter

6.3 Experiment procedure

Packet 1: Rui!Leila:


The request packet is sent from interface eth0/Rui, using the IP address of interface

eth1/Rui, i.e.

Packet 2: Leila!Rui:


The request packet is sent from interface eth0/Leila, using the IP address of interface

eth1/Leila, i.e.

6.4 Experiment result

Eth0: ICMP ping quest packet from Rui to Leila

Eth1: ICMP reply packet from Leila to Rui

Eth0: ICMP ping request packet from Leila to Rui

Eth1: ICMP reply packet from Rui to Leila