The Address Resolution Protocol uses a simple message format containing one address resolution request or response. The size of the ARP message depends on the upper layer and lower layer address sizes, which are given by the type of networking protocol (usually IPv4) in use and the type of hardware or virtual link layer that the upper layer protocol is running on. The message header specifies these types, as well as the size of addresses of each. The message header is completed with the operation code for request (1) and reply (2). The payload of the packet consists of four addresses, the hardware and protocol address of the sender and receiver hosts.
The principal packet structure of ARP packets is shown in the following table which illustrates the case of IPv4 networks running on Ethernet. In this scenario, the packet has 48-bit fields for the sender hardware address (SHA) and target hardware address (THA), and 32-bit fields for the corresponding sender and target protocol addresses (SPA and TPA). Thus, the ARP packet size in this case is 28 bytes. The EtherType for ARP is 0x0806. (This appears in the Ethernet frame header when the payload is an ARP packet. Not to be confused with PTYPE below, which appears within this encapsulated ARP packet.)
If you have a device that is on the same network but not responding to any requests such as ping, HTTP, HTTPS etc. This is done intentionally, for example a Check Point Firewall doesn’t respond to anything by design. Similarly a Cisco ASA, Router or BIG-IP F5 might not respond to any requests as they are designed to be silent. In those cases, using arp-scan to scan MAC address is a quick way to find those devices.
arp-scan
The ARP Scan Tool (also called ARP Sweep or MAC Scanner) is a very fast ARP packet scanner that shows every active IPv4 device on your Subnet. Since ARP is non-routable, this type of scanner only works on the local LAN (local subnet or network segment).
The ARP Scan Tool shows all active devices even if they have firewalls. Devices cannot hide from ARP packets like they can hide from Ping. To find active IP addresses outside your subnet, use the Ping Scan Tool (a Ping Sweep tool AKA NetScanner).
Install arp-scan
Binary packages are available for the following operating systems:
- Debian Linux: is part of the standard Debian distribution on Lenny and later.
- Ubuntu Linux: is available from gutsy (7.10) in universe.
- Fedora: is available for Fedora 6 and later
- RedHat Enterprise Linux: is available for RedHat EL 5 and later
- Gentoo Linux
- FreeBSD: is available from the FreeBSD ports collection
- OpenBSD: is available as an OpenBSD package
Installation is usually as simple as shown below for Debian or Ubuntu like distributions:
Kali Linux being the awesome pentest distro it is, has it pre-installed.
Use arp-scan to find hidden devices
can be used to discover IP hosts on the local network. It can discover all hosts, including those that block all IP traffic such as firewalls and systems with ingress filters.
works on Ethernet and 802.11 wireless networks. It may also work with token ring and FDDI, but they have not been tested. It does not support serial links such as PPP or SLIP, because ARP is not supported on them. You will need to be root, or must be SUID root, in order to run , because the functions that it uses to read and write Ethernet packets require root privilege.
Discovering all hosts on the local network
If the system you are testing from has an address on the network you wish to scan, the simplest way to scan it is with a command similar to:
Here, represents the interface to use for scanning, and makes scan all possible IP addresses on the network connected to this interface, as defined by the interface IP address and netmask. You can omit the option, in which case will search the system interface list for the lowest numbered, configured up interface (excluding ).
The network interface name depends on the operating system you are using, the network type (Ethernet, Wireless Etc), and for some operating systems on the interface card type as well. In this document, the interface name is used for examples except where a different network type is being discussed.
All options have both a long form like and a corresponding short form like .
I’ve used the long form in this document for clarity. I’ve also used in the following example and I am on a Wireless network.
So in the above example was used to scan the network of the device , and it discovered 29 alive nodes apart from localhost machine. The option makes scan the local network.
Here is an example showing being run against the network 10.0.1.0/24:
Now I’ve found 31 hosts that responded to this new sweep, so those two are my hidden servers.
Using an interface without an IP address
You can still use even if the interface does not have an IP address. If you use in this way, it will use the IP address of 0.0.0.0 for the field in the ARP packet unless you specify the IP address to use with the – option.
Some operating systems will only respond to ARP requests if the IP address specified in the field is plausible. The exact rules vary between operating systems, but the most common is that the address in must be within the IP network of the interface that the ARP request is received on. This is explored further in the fingerprinting section.
ARP spoofing and Proxy ARP
Because ARP does not provide methods for authenticating ARP replies on a network, ARP replies can come from systems other than the one with the required Layer 2 address. An ARP proxy is a system which answers the ARP request on behalf of another system for which it will forward traffic, normally as a part of the network’s design, such as for a dialup internet service. By contrast, in ARP spoofing the answering system, or spoofer, replies to a request for another system’s address with the aim of intercepting data bound for that system. A malicious user may use ARP spoofing to perform a man-in-the-middle or denial-of-service attack on other users on the network. Various software exists to both detect and perform ARP spoofing attacks, though ARP itself does not provide any methods of protection from such attacks.
arp-scan scan help menu - Click to expand
Conclusion
is a simple tool yet very powerful. Those of you who are familiar with Cisco Routers and switches, CheckPoint Firewall and Big-IP F5, you know it too well that sometimes the only way to find a device is by using a arp response. Once you’ve found the MAC address, you can find more info about that device by matching that MAC address to it’s vendor. It is importing to understand ARP/MAC responses for penetration tester and it is used heavily for arpspoof and Man-In-The-Middle Attack. It also helps in cases when someone is spoofing IP address and DoS-ing your server. You can however spoof MAC address easily to evade trace.
All in all, it’s a useful tool and you should try the commands shown above. It will help someday when you are scratching you head in the middle of a service outage!
Thanks for reading, do share.
No comments:
Post a Comment