ARP
The Address Resolution Protocol (ARP) is used to map 32-bit IPv4 addresses to the address scheme used by the data-link layer. The data-link layer, sometimes referred to as the network link layer, consists of the operating system device driver and corresponding network interface card. This layer is responsible for dealing with the physical transport media. Sun network devices use a system-wide hardware address, sometimes referred to as the Media Access Control (MAC) address. This means that a Sun system with multiple Ethernet interfaces will, by default, have the same hardware address for each interface.
A Sun Quad FastEthernet_ card has a unique hardware address assigned to each of its four interfaces. It is also possible to configure the card to use the hardware address from the cards programmable read only memory (PROM). Refer to the Sun Quad FastEthernet card documentation for more information.
It should be noted that many operating systems, including the Solaris OE, allow the hardware or MAC address, of a network interface, to be defined through software. By explicitly setting the hardware address of a network interface in software, the vendor-defined hardware address will be overridden.
ARP is often referred to as a dynamic protocol. This is due to the fact that its operation occurs automatically. The protocol works in the background, without concern to the application user or even the network administrator. It is this dynamic nature of ARP that causes security issues.
For the purposes of this discussion, we use Ethernet (IEEE 802.3). Token ring and Fiber Distributed Data Interface (FDDI) have similar schemes.
ARP operates by broadcasting an address request and collecting the response to create its map of addresses. The hardware addresses are only needed for hosts on the local network. At the lowest level, the Ethernet driver needs the hardware address of the remote system, to send it a packet. When it does not have that address, it broadcasts a request for the missing address. This request, called an ARP request, contains the IP address of the host in question and is sent to all systems on the local network. A system might respond with a reply, called an ARP reply, which contains the host IP address and hardware address. The received response is used to build a table of IP addresses and the corresponding hardware addresses.
In the Solaris OE kernel, there are two tables that maintain the addresses. One table, maintained by the ARP layer, is called the ARP cache. It provides a layer of efficiency to the protocol. For instance, when a hardware address is requested by the IP layer, the ARP cache is checked first. If the address information does not exist in the local cache, an ARP request is sent, and the corresponding reply is processed. The Solaris OE also adds unsolicited address information to the ARP cache. These unsolicited address entries are special because they were not directly requested. These unsolicited entries are kept in case the IP layer requests them. After a period of time, all unsolicited entries are deleted from the cache. The default timeout value for unsolicited entries is five minutes and can be adjusted.
The other table for host address mappings is maintained by the IP layer. It contains information supplied by requests to the ARP layer. By default, an entry will expire 20 minutes after it was added to the table.
Another feature of the protocol is called gratuitous ARP. This occurs when a host broadcasts an ARP request for its own hardware address. A Solaris OE system does this at boot time. It is used to detect if another system is using its IP address, indicating a misconfigured system. The other use of gratuitous ARP is to send updated hardware address information. Systems that receive gratuitous ARP information will automatically update the hardware address information.
ARP Attacks
Several ARP problems can affect a system's expected operation. The TCP/IP network protocol suite requires correct hardware address information to ensure proper delivery of data. An Ethernet frame with an incorrect hardware address will not be processed by the intended system. All hardware address information is collected by the ARP layer. It gathers this information as it is needed and accepts information sent to it. The protocol is also stateless. The problems lie in the fact that the protocol allows any host to provide its own address information (correct or not). One system can provide information on the behalf of another system. Address information received by the ARP layer is processed whether it was directly requested or not. Additionally and more importantly, all address information received by a system is believed to be accurate.
There are two basic types of attacks possible with ARP: denial of service and spoofing. These attacks can prevent normal operations and can be used to compromise other systems on the local network. A denial of service attack can prevent one system from exchanging packets with another. This makes the system appear to be off the network. During a spoofing attack, one system masquerades as another.
These attacks take advantage of the dynamic nature of the protocol. The simplest attack is denial of service. There are two forms to this attack: local and remote. On the local system, an attacker who has administrative control of the system can insert bogus address information into the ARP cache. Packets destined for systems with bogus hardware addresses will not be received by the intended system. An attacker can feed a remote system incorrect address information as well. This is known as cache poisoning. Since the ARP layer always trusts the information it receives, wrong information can be inserted and current ARP entries can be corrupted. An attacker might use the publish feature of the ARP layer to broadcast incorrect information about other systems. If two ARP replies are received, the last one will be used. It might be the correct one, or it may not. This situation can spread discord throughout systems on the local network and be difficult to diagnose.
ARP spoofing attacks are more serious because they are used to compromise remote systems on the local network. By masquerading as another system, it is possible for an attacker to exploit a trust relationship and gain entry to other systems. This attack involves sending false hardware address information to a target system that the system will use to update its ARP tables. Once the false information is implanted, the attacking system changes its IP address and attempts a connection to the target.
For example, host A trusts host B. An attacker on host C wants to log into host A. First, the attacker must disable host B to prevent it from responding to ARP requests. The attacker then configures host C's IP address on a logical network interface and sends an ARP reply to host A containing host B's IP address and host C's hardware address. As discussed previously, host A will update the address information from the ARP reply. Host C now acts as host B, and the attacker can now log into host A.
ARP Defenses
Defending against ARP attacks is difficult. Changing the protocol in significant ways would break compatibility with all TCP/IP based systems on a network. Attempting to eliminate the dynamic nature of the protocol makes network administration a nightmare. However, there are some things that can be done to improve security on the network.
If false entries are inserted into the ARP and IP routing tables, there are two ways they can be deleted:
-
Entries can be deleted manually using the arp -d host_entry command.
- Entries will timeout and be deleted by the system.
RFC 826, which defines ARP, specifies that ARP cache entries should be deleted automatically after a reasonable period of time. The default timeout values for unsolicited ARP cache entries are five minutes for all releases of the Solaris OE. IP routing table entries timeout after 20 minutes.
In Solaris OE versions 8 and newer, the following timeout intervals can be altered.
# ndd -set /dev/arp arp_cleanup_interval 60000 # ndd -set /dev/ip ip_ire_arp_interval
In Solaris OE versions 2.5.1 through 7, the ip_ire_arp_interval parameter is named ip_ire_flush_interval.
The timeout interval is specified in milliseconds. One minute equals 60000 milliseconds. Both these commands reduce the timeout period for the ARP cache and IP routing table. Entries will be deleted at a faster rate. This might slow down an ARP attack since bogus entries do not remain as long. These commands are available in the system init script provided in "Sample System nddconfig init Script" on page 26." The major side effect of this change is a greater number of ARP requests and replies will be sent. It might not be prudent to use on congested networks.
Another alternative is to manually create hardware address entries in the ARP cache. This solution can protect against some ARP attacks but breaks the dynamic nature of ARP, can increase maintenance costs, and may not be effective in most environments. A static entry in the ARP cache is a mapping of an IP address to hardware address. These entries can be loaded at system boot time. Create a file containing IP addresses and the corresponding hardware addresses, similar to the following:
gort.eng.sun.com 08:00:20:ba:a3:c5 olympics.eng.sun.com 08:00:20:4d:6d:30 switchblade.eng.sun.com 08:00:20:b3:48:57
Load the contents of this using the arp -f <file> command where file contains a table of hostnames and hardware addresses. These entries are now marked as permanent entries in the cache and will not be deleted by timeout. They can, however, be overridden by unsolicited information. In addition, they can still be deleted by using the arp -d <host_entry> command where host_entry is the host name to delete. This solution might not be appropriate in environments that frequently change equipment.
NOTE
Permanent ARP entries are only permanent in that they will not be timed-out. They can be overwritten by ARP information received over the network.
It is also possible to disable ARP completely for an interface. This means that the network interface will no longer send ARP requests nor process ARP replies. To disable ARP processing, use the ifconfig <interface> -arp command. Every system that disables ARP must have static ARP entries. Also, any system that might need to communicate with systems without ARP will need static ARP entries (such as routers). This solution is not recommended for most environments because of the high administrative costs. It might be effective with a small number of machines that need to communicate with each other and do not interact with other systems on the local network.