Layer-2 Network Attacks are security threats that target the Data Link Layer of the OSI Model. These attacks mainly exploit weaknesses in Ethernet switching, MAC address learning, ARP communication, VLAN configuration, and DHCP services. Attackers use these techniques to gain unauthorized network access, intercept data, disrupt communication, or affect network performance.
1. MAC Spoofing Attack
MAC Spoofing is an attack in which an attacker changes the MAC address of their network device to impersonate an authorized device. Since Layer-2 switches use MAC addresses to forward Ethernet frames, an attacker may attempt to gain access by copying the MAC address of a trusted computer.
Example: Suppose an office computer has MAC address AA:BB:CC:11:22:33 and is authorized to access the company network. An attacker connects a laptop and changes its MAC address to the same value. The attacker attempts to impersonate the authorized computer and bypass basic MAC-based access restrictions.
Prevention: Use Port Security, 802.1X Authentication, and proper network access control.
2. MAC Flooding Attack
MAC Flooding is an attack in which an attacker sends a large number of Ethernet frames with fake source MAC addresses to a switch. This can overwhelm the switch’s MAC address table. When the table becomes full, the switch may flood certain unknown unicast frames out of multiple ports within the VLAN, potentially exposing traffic to unauthorized devices.
Example: Suppose a managed switch has a limited MAC address table. An attacker connects a laptop to the switch and generates thousands of frames using different fake source MAC addresses. The switch’s MAC table may become full, affecting normal frame forwarding and potentially exposing traffic.
Prevention: Enable Port Security, limit the number of MAC addresses per access port, and monitor unusual MAC address activity.
3. ARP Spoofing / ARP Poisoning Attack
ARP Spoofing is an attack in which an attacker sends fake Address Resolution Protocol (ARP) messages to associate their MAC address with another device’s IP address, such as the default gateway. This can redirect network traffic through the attacker’s device and enable Man-in-the-Middle (MITM) attacks.
Example: Suppose a company network has a gateway IP address 192.168.1.1 and an employee computer with IP address 192.168.1.10. An attacker sends fake ARP messages claiming that the gateway IP belongs to the attacker’s MAC address. The employee’s computer may send traffic to the attacker’s device instead of the actual gateway.
Prevention: Enable Dynamic ARP Inspection (DAI), DHCP Snooping, and appropriate network security monitoring.
4. Rogue DHCP Server Attack
A Rogue DHCP Server attack occurs when an unauthorized DHCP server is connected to a network and starts providing incorrect IP configuration to client devices. It may assign a malicious default gateway or DNS server to redirect users’ network traffic.
Example: An office network uses an authorized DHCP server to assign IP addresses to employee computers. An attacker connects a personal Wi-Fi router to an unused switch port with its DHCP service enabled. Employee computers may receive IP addresses and gateway information from this unauthorized router instead of the official DHCP server.
Prevention: Enable DHCP Snooping and configure only authorized DHCP server-facing ports as trusted.
5. Broadcast Storm Attack
A Broadcast Storm occurs when an excessive number of broadcast frames circulate within a network, consuming bandwidth and switch processing resources. It may result from malicious traffic generation, faulty network devices, or switching loops.
Example: An attacker connects a device to the office network and continuously generates thousands of broadcast packets. Other computers receive excessive broadcast traffic, resulting in slow network performance, packet loss, and communication problems.
Prevention: Configure Storm Control, implement proper VLAN segmentation, and use STP to prevent switching loops.
6. VLAN Hopping Attack
VLAN Hopping is an attack in which an attacker attempts to access traffic belonging to another VLAN without proper authorization. Common techniques include Switch Spoofing and Double Tagging.
Example: An office network uses VLAN 10 for employees and VLAN 20 for servers. An attacker connected to an access port in VLAN 10 attempts to send specially crafted Ethernet frames to reach VLAN 20. If the switch configuration is vulnerable, the attacker may gain unauthorized access to another VLAN.
Prevention: Configure access ports manually, disable Dynamic Trunking Protocol (DTP) where appropriate, use unused VLANs for trunks, and restrict allowed VLANs on trunk ports.
7. STP Manipulation Attack
An STP Manipulation Attack occurs when an attacker connects an unauthorized switch and sends superior Bridge Protocol Data Units (BPDUs) to influence the Spanning Tree Protocol topology. The attacker may attempt to become the Root Bridge and change the network’s forwarding paths.
Example: An enterprise network has a Core Switch configured as the Root Bridge. An attacker connects another switch to an access port and sends BPDUs with a better bridge priority. If the network is not protected, the unauthorized switch may become the Root Bridge, changing traffic paths and potentially disrupting communication.
Prevention: Configure BPDU Guard on edge ports, Root Guard on appropriate designated ports, and maintain a secure STP design.
8. DHCP Starvation Attack
DHCP Starvation is an attack in which an attacker sends a large number of DHCP requests using different fake MAC addresses. The goal is to consume all available IP addresses in the DHCP address pool, preventing legitimate devices from obtaining IP addresses.
Example: A company DHCP server has an available pool of 100 IP addresses. An attacker generates thousands of DHCP requests using different spoofed MAC addresses. The DHCP server may allocate most or all available addresses, leaving genuine employee computers unable to obtain an IP address.
Prevention: Configure DHCP Snooping rate limiting, Port Security, and appropriate DHCP server protections.
9. Man-in-the-Middle (MITM) Attack
A Man-in-the-Middle attack occurs when an attacker secretly positions themselves between two communicating devices to intercept or potentially modify network traffic. At Layer 2, this may be achieved through techniques such as ARP Spoofing.
Example: An employee accesses an internal company application through the LAN. An attacker performs ARP Poisoning to redirect traffic through their laptop. The attacker may observe or manipulate unencrypted communication between the employee and the gateway.
Prevention: Use Dynamic ARP Inspection, encrypted protocols such as HTTPS and SSH, proper authentication, and network monitoring.