VLAN Hopping Attack: EVE-NG Lab
VLAN Hopping attack. How to escape your VLAN and get into any other VLAN in the network.
There are a lot of network attacks, but here’s a fun one.
What is VLAN hopping?
In brief, it’s the act of escaping from your VLAN to access another VLAN that you shouldn’t be allowed into.
Does it always work?
No, because it depends on the switch model and vendor. But it’s a good attack for every network engineer to simulate, to learn how it works.
I used the following image:
i86bi_linux_l2-ipbasek9-ms.may8-2013-team_track.bin
What you should know about this attack
For the attacker to escape from their VLAN to another VLAN, the attacker MUST be in the native VLAN.
The attack is very simple:
- The attacker prepares a frame with two 802.1Q (dot1q) tags. The first (outer) tag is the attacker’s own VLAN, which also needs to be the native VLAN on the trunk link.
- The second (inner) tag is the VLAN our target belongs to. The order is important.
- The attacker sends the frame.
Here’s what happens next.
The first switch, the one the attacker is connected to, receives the frame and removes the first tag, because it matches the native VLAN. And as we all know, native VLAN traffic is sent untagged.
Not all switches behave like this, but most do. They “play it smart” and remove the tag since it’s just the native VLAN, but they don’t check whether there’s another tag underneath. That’s why the order of the tags matters.
The second switch receives the frame with only one 802.1Q tag left, the inner tag the first switch never looked at, so it simply forwards the frame into the VLAN in that tag.
And that’s the VLAN hopping attack: very simple and fun.
Here’s the command I used:
sendp(Ether(dst='50:00:00:11:00:00', src='50:00:00:0e:00:00')/Dot1Q(vlan=1)/Dot1Q(vlan=10)/IP(dst='10.10.10.1', src='10.10.0.1')/ICMP(), iface='eth0')You must have Scapy installed.