VLAN hopping
VLAN hopping is a computer security exploit, a method of attacking networked resources on a virtual LAN. The basic concept behind all VLAN hopping attacks is for an attacking host on a VLAN to gain access to traffic on other VLANs that would normally not be accessible. There are two primary methods of VLAN hopping: switch spoofing and double tagging. Both attack vectors can be mitigated with proper switch port configuration.
Switch spoofing
In a switch spoofing attack, an attacking host imitates a trunking switch by speaking the tagging and trunking protocols used in maintaining a VLAN. Traffic for multiple VLANs is then accessible to the attacking host.Mitigation
Switch spoofing can only be exploited when interfaces are set to negotiate a trunk. To prevent this attack on Cisco IOS, use one of the following methods:1. Ensure that ports are not set to negotiate trunks automatically by disabling DTP:
Switch # switchport nonegotiate
2. Ensure that ports that are not meant to be trunks are explicitly configured as access ports
Switch # switchport mode access
Double tagging
In a double tagging attack, an attacker connected to an 802.1Q-enabled port prepends two VLAN tags to a frame that it transmits. The frame is forwarded without the first tag because it is the native VLAN of a trunk interface. The second tag is then visible to the second switch that the frame encounters. This second VLAN tag indicates that the frame is destined for a target host on a second switch. The frame is then sent to the target host as though it originated on the target VLAN, effectively bypassing the network mechanisms that logically isolate VLANs from one another.However, possible replies are not forwarded to the attacking host.
Mitigation
Double tagging can only be exploited on switch ports configured to use native VLANs. Trunk ports configured with a native VLAN don't apply a VLAN tag when sending these frames. This allows an attacker's fake VLAN tag to be read by the next switch.Double tagging can be mitigated by any of the following actions :
- Simply do not put any hosts on VLAN 1. i.e., assign an access VLAN other than VLAN 1 to every access port
- :
Switch # switchport access vlan 2
- Change the native VLAN on all trunk ports to an unused VLAN ID.
- :
Switch # switchport trunk native vlan 999
- Explicit tagging of the native VLAN on all trunk ports. Must be configured on all switches in network autonomy.
- :
Switch# vlan dot1q tag native