Take the 2-minute tour ×
Information Security Stack Exchange is a question and answer site for Information security professionals. It's 100% free, no registration required.

I recently did a man in the middle attack on my college LAN (for purely educational purposes:)). I simply wrote a raw socket application that pumped ARP reply packets advertising my MAC address with the IP of the gateway. For the destination address I chose the broadcast address. Soon I was receiving packets from lot of hosts on the subnet. Now I was wondering:

  1. Why did it work with broadcast address?
  2. How can I prevent myself from such attacks? (I found a way by adding a static entry of the gateway's actual MAC address in my computer's ARP table)
  3. If I am a network admin, how can I ensure that doing a MITM is not as easy as it was in my case?
share|improve this question

migrated from stackoverflow.com Dec 9 '11 at 15:37

This question came from our site for professional and enthusiast programmers.

    
Also keep in mind that certain network appliances rely on this ARP cache poisoning to perform their work. Network Access Control devices are one example which ensure that endpoints accessing the network must first (or periodically) visit a compliance server to ensure they adhere to the network's policies. –  logicalscope Dec 9 '11 at 16:03

2 Answers 2

up vote 12 down vote accepted

A broadcast packet is, at the ethernet level, a packet with a specific bit set in the address which tells: "if you see this frame, have a look at it". Normally, a network interface will disregard frames unless the destination address is its own MAC address (an interface can be put into "promiscuous mode" to pick up all frames); but the "broadcast" bit makes the frame "interesting" for all network interfaces.

When the frame is not filtered out by the network interface, the frame contents are processed by the host system regardless of its ethernet source and destination addresses: the frame was received, and that's enough. If the frame contains an ARP reply, then the information contained in this reply ("the host with this IP address uses that ethernet address") is duly processed. It depends a bit on the operating system, though: Linux is known to disregard ARP replies which do not correspond to an ARP request which it sent not long before.

There is no authentication whatsoever in the ARP protocol; it is built on trust. Hence, it is vulnerable to active attacks such as yours.

Setting a static ARP table entry gives you some protection, but removes a bit of flexibility (if the gateway hardware is replaced, the ethernet address will change, and since the static entry takes precedence, your machine will refuse to talk to the replacement) and it is not a complete protection either: your packets may still be observed by the attacker, and he can still spoof fake packets, which can be enough to do a lot of harm.

As a network administrator, the best you can do is a combination of static routes (tedious, does not scale well) and watch/logging/reporting (maintain a table of IP / ethernet pairs, report every ARP reply which tries to change that). See this page for a list of possible defenses.

share|improve this answer

if you have cisco switch irons just use L2 security features, DAI , IPSG , DHCP Snooping etc :)

share|improve this answer
4  
this would be a much better answer if you listed what each of these features does and how it prevents the issue in the question. –  Rory Alsop Dec 9 '11 at 22:35

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.