fbpx
What is a VLAN?
 
A virtual local area network (VLAN) is used to share the physical network while creating virtual segmentations to divide specific groups. For example, a host on VLAN 1 is separated from any host on VLAN 2. Any packets sent between VLANs must go through a router or other layer 3 devices.
 
 
 
 
Security is one of the many reasons network administrators configure VLANs. However, with an exploit known as 'VLAN Hopping', an attacker is able to bypass these security implementations.
 
-
 
What is VLAN Hopping?
 
It is a type of exploit that allows an attacker to bypass any layer 2 restrictions built to divide hosts. With proper switch port configuration, an attacker would have to go through a router and any other layer 3 devices, to access their target.
 
Since many networks either have poor VLAN implementation or have misconfigurations which will allow for attackers to perform above-mentioned exploit. There are two primary methods of VLAN hopping, known as 'Switched Spoofing', and 'Double Tagging'.
 
-
 
It is important to understand how switches operate if we would like to find and exploit their vulnerabilities. We are not necessarily exploiting the device itself, but rather the protocols and configurations which are instructing how they operate.
 
On a switch, a port is either configured as an access port or a trunking port.
 
An access port is typically used when connecting a host to a switch. With the implementation of VLANs, each access port is assigned to only one VLAN. A trunking port is used when connecting two switches or a switch and a router together. Trunking ports allow for traffic from multiple VLANs. A trunk port can be configured manually or created dynamically using Dynamic Trunking Protocol (DTP).
 
DTP is a Cisco proprietary protocol where one use is to dynamically establish a trunk link between two switches.
 
-
 
👉 1. Switched Spoofing VLAN Attack
 
An attacker acts as a switch in order to trick a legitimate switch into creating a trunking link between them. As mentioned before, packets from any VLAN are allowed to pass through a trunking link. Once the trunk link is established, the attacker then has access to traffic from any VLAN.
 
This exploit is only successful when the legitimate switch is configured to negotiate a trunk. This occurs when an interface is configured with either "dynamic desirable", "dynamic auto" or "trunk" mode. If the target switch has one of those modes configured, the attacker then can generate a DTP message from their computer and a trunk link can be formed.
 
-
 
👉 2. Double Tagging Attack
 
Double tagging occurs when an attacker adds and modifies tags on an Ethernet frame to allow the sending of packets through any VLAN. This attack takes advantage of how many switches process tags. Most switches will only remove the outer tag and forward the frame to all native VLAN ports.
 
With that said, this exploit is only successful if the attacker belongs to the native VLAN of the trunk link. Another important point is, this attack is strictly one way as it is impossible to encapsulate the return packet.
 
-
 
(Only for reference)
 
An attacker can use the program Yersinia to craft and send a DTP message. Yersinia is a penetration testing framework built to attack many protocols that reside on layer 2. It comes pre-installed with kali Linux and has an easy to use graphical user interface (GUI).
 
An attacker can use the program Scapy, to create the specially crafted frames needed for processing this attack. Scapy is a Python program created to manipulate packets.
 
-
 
👉 How Can You Mitigate VLAN Hopping attacks?
 
PART-1
To prevent a Switched Spoofing attack, there are a few steps you should take:
 
Do not configure any access points with either of the following modes: "dynamic desirable", "dynamic auto", or "trunk".
Manually configure access ports and disable DTP on all access ports.
• switchport mode access
• switchport mode nonegotiate
Manually configure all trunk ports and disable DTP on all trunk ports.
• switchport mode trunk
• switchport mode nonegotiate
Shutdown all interfaces that are not currently in use.
 
PART-2
To prevent a Double Tagging attack, there is only one step you need to take:
 
keep the native VLAN of all trunk ports different from user VLANs.
 
The best approach to mitigating double-tagging attacks is to ensure that the native VLAN of the trunk ports is different from the VLAN of any user ports. In fact, it is considered a security best practice to use a fixed VLAN that is distinct from all user VLANs in the switched network as the native VLAN for all 802.1Q trunks.
 
In case of Cisco Switches, you can ponder on the following also:
 
Some applications require that no traffic be forwarded at Layer 2 between ports on the same switch so that one neighbor does not see the traffic generated by another neighbor. In such an environment, the use of the Private VLAN (PVLAN) Edge feature, also known as protected ports, ensures that there is no exchange of unicast, broadcast, or multicast traffic between these ports on the switch.
 
The PVLAN Edge feature has the following characteristics:
 
1. A protected port does not forward any traffic (unicast, multicast, or broadcast) to any other port that is also a protected port, except for control traffic. Data traffic cannot be forwarded between protected ports at Layer 2.
2. Forwarding behavior between a protected port and a nonprotected port proceeds as usual.
3. Protected ports must be manually configured.
 
-
 
REMEMBER:
 
Switches were not built for security. However, it is important to utilize security measures at every level. If you are to take the time to segment your network, make sure it is done properly and securely. Be diligent when configuring your network.
 
Please let me know of what do you think about this in the comment section. You can also share with all if the information shared here helps you in some manner.
 
👉 Kindly write your comment on the posts or topics, because when you do that you help me greatly in designing new quality article/post on cybersecurity.
 
 

This Article Was Written & published by Meena R,  Senior Manager - IT, at Luminis Consulting Services Pvt. Ltd, India. 

Over the past 16 years, Meena has built a following of IT professionals, particularly in Cybersecurity, Cisco Technologies, and Networking...

She is so obsessed with Cybersecurity domain that she is going out of her way and sharing hugely valuable posts and writings about Cybersecurity on website, and social media platforms. 

30,000+ professionals are following her on Facebook and  mesmerized by the quality of content of her posts on Facebook. 

If you haven't yet been touched by her enthusiastic work of sharing quality info about Cybersecurity, then you can follow her on Facebook:

Click Here to follow her: Cybersecurity PRISM