What is a MAC Flooding attack?
MAC Flooding is a layer-2 attack against network switches. The attacker floods the switch with thousands of Ethernet frames using fake source MAC addresses until its CAM table (which maps MACs to ports) fills up. When the table saturates, many switches enter failopen mode and start forwarding all traffic to every port, like a hub.
Why is it dangerous?
In failopen mode, an attacker plugged into the switch can sniff traffic meant for other machines on the same network: credentials, sessions, sensitive data. It's a stepping stone to man-in-the-middle attacks inside poorly protected local networks.
How to prevent it?
The main defense is Port Security on the switch: limit how many MACs are learned per port and block or shut the port on excess. 802.1X device authentication, VLAN segmentation, and CAM-table monitoring complement it.
What exactly happens inside the switch
A switch learns which MAC address sits on each port and stores that mapping in a limited memory table, the CAM. The attack overflows it by sending frames with thousands of fake source addresses until no more fit. When that happens the switch cannot decide which port to send a frame to and falls back on its default behaviour: forwarding it out of all of them. It stops being a switch and behaves like a hub.
Why that is a confidentiality problem
Because from that moment any machine on the same segment receives traffic meant for the others. What was encrypted stays encrypted, but everything unencrypted is exposed and, above all, the metadata: who each machine talks to, which services it uses, which internal protocols circulate. On flat networks where servers and workstations coexist, that is a map of the organization handed over on a plate.
How it is prevented
With port security on the switch: limiting how many MAC addresses each port may learn and deciding what to do when the limit is exceeded — block, restrict, or shut the port down. It pairs with VLAN segmentation so that, even if it happens, the blast radius stays bounded; with network access control requiring authentication before granting connectivity; and with monitoring of ports that learn an abnormal number of addresses in a short time, which is the attack's signature.



