MAC Flooding with MACOF & some major countermeasures

Macof is a member of the Dsniff suit toolset and mainly used to flood the switch on a local network with MAC addresses. The reason for this is that the switch regulates the flow of data between its ports. It actively monitors (cache) the MAC address on each port, which helps it pass data only to its intended target. This is the main difference between a switch and a passive hub. A passive hub has no mapping, and thus broadcasts line data to every port on the device. The data is typically rejected by all network cards, except the one it was intended for. However, in a hubbed network, sniffing data is very easy to accomplish by placing a network card into promiscuous mode. This allows that device to simply collect all the data passing through a hubbed network. While this is nice for a hacker, most networks use switches, which inherently restrict this activity. Macof can flood a switch with random MAC addresses. This is called MAC flooding. This fills in the switch’s CAM table, thus new MAC addresses can not be saved, and the switch starts to send all packets to all ports, so it starts to act as a hub, and thus we can monitor all traffic passing through it.

Homepage

Options

Syntax: macof [-i interface] [-s src] [-d dst] [-e tha] [-x sport] [-y dport] [-n times]
-i   interface Specify the interface to send on.
-s   src Specify source IP address.
-d   dst Specify destination IP address.
-e   Specify target hardware address.
-x   sport Specify TCP source port.
-y   dport Specify TCP destination port.
-n   times Specify the number of packets to send.

LAB 1: Simple Flooding

Macof can flood a switch with random MAC addresses. This is called MAC flooding. This fills in the switch’s CAM table, thus new MAC addresses can not be saved, and the switch starts to send all packets to all ports, so it starts to act as a hub, and thus we can monitor all traffic passing through it.

command: macof -i eth1 -n 10
Random Flooding

LAB 2: Targeted Flooding

Macof can flood a switch with random MAC addresses destinated to 192.168.1.1.

command: macof -i eth1 -d 192.168.1.1
Targeted Flooding

While conducting a pentest, this tool comes in handy while sniffing. Some switches don’t allow to spoof arp packets. This tool can be used in such situations to check if the switch is overloaded. Some switches behave like hubs, transmitting all source packets to all destinations. Then sniffing would be very easy. Some switches tend to crash & reboot also. Such kind of layer 2 stress testing can be done with this handy tool.

Countermeasures

Some of the major countermeasures against MAC Flooding are:

  1. Port Security : Limits the no of MAC addresses connecting to a single port on the Switch.
  2. Implementation of 802.1X : Allows packet filtering rules issued by a centralized AAA server based on dynamic learning of clients.
  3. MAC Filtering  : Limits the no of MAC addresses to a certain extent.
Ravi Sankar

Recent Posts

Shadow-rs : Harnessing Rust’s Power For Kernel-Level Security Research

shadow-rs is a Windows kernel rootkit written in Rust, demonstrating advanced techniques for kernel manipulation…

1 week ago

ExecutePeFromPngViaLNK – Advanced Execution Of Embedded PE Files via PNG And LNK

Extract and execute a PE embedded within a PNG file using an LNK file. The…

2 weeks ago

Red Team Certification – A Comprehensive Guide To Advancing In Cybersecurity Operations

Embark on the journey of becoming a certified Red Team professional with our definitive guide.…

3 weeks ago

CVE-2024-5836 / CVE-2024-6778 : Chromium Sandbox Escape via Extension Exploits

This repository contains proof of concept exploits for CVE-2024-5836 and CVE-2024-6778, which are vulnerabilities within…

3 weeks ago

Rust BOFs – Unlocking New Potentials In Cobalt Strike

This took me like 4 days (+2 days for an update), but I got it…

3 weeks ago

MaLDAPtive – Pioneering LDAP SearchFilter Parsing And Security Framework

MaLDAPtive is a framework for LDAP SearchFilter parsing, obfuscation, deobfuscation and detection. Its foundation is…

3 weeks ago