Layer 2 Attacks

Layer 2 attacks, also known as data link layer attacks, target the second layer of the OSI (Open Systems Interconnection) model, which is responsible for data framing and medium access control. These attacks exploit vulnerabilities in network devices or protocols at the data link layer to compromise network security, disrupt network operations, or gain unauthorized access to network resources.

The following are common types of Layer 2 attacks:

  1. MAC Spoofing: In a MAC spoofing attack, an attacker impersonates the MAC address of a trusted device on the network. By spoofing a valid MAC address, the attacker can bypass MAC address filtering or gain unauthorized access to the network.
  2. ARP Spoofing/ARP Poisoning: In an ARP spoofing attack, the attacker manipulates the ARP (Address Resolution Protocol) tables on a network to associate their own MAC address with the IP address of another legitimate device. This allows the attacker to intercept or redirect network traffic, perform Man-in-the-Middle attacks, or launch other malicious activities.
  3. VLAN Hopping: VLAN hopping attacks exploit weaknesses in the implementation of VLAN (Virtual Local Area Network) configurations. By manipulating VLAN tags, an attacker can gain unauthorized access to restricted VLANs or bypass network segmentation, potentially compromising network security.
  4. Spanning Tree Protocol (STP) Attacks: STP is a protocol used to prevent loops in Ethernet networks. Attackers can exploit vulnerabilities in STP implementations to disrupt network operations, cause network instability, or facilitate Man-in-the-Middle attacks.
  5. MAC Flooding: In a MAC flooding attack, the attacker floods a switch with a large number of fake MAC addresses, overwhelming the switch's CAM (Content Addressable Memory) table. This can cause the switch to enter a "fail-open" mode, where it acts as a hub and broadcasts all incoming traffic to all ports, compromising network security and potentially facilitating eavesdropping.

To mitigate Layer 2 attacks and enhance network security, the following preventive measures can be implemented: