A virtual local area network () is the boundary most networks rely on to keep offices, phones, cameras, guests and servers apart on the same switches. The third part of the series on traffic diversion and the man in the middle is about crossing that boundary without a router: . The previous part, MAC flooding and STP root takeover, attacked the switch's table of media access control (MAC) addresses and its () elections; this one attacks its VLAN bookkeeping. The basics, access and trunk ports, the 802.1Q tag, the and the voice VLAN, are in VLANs and 802.1Q trunking, whose short section on hopping this part expands. After reading, you can compute an 802.1Q tag by hand, predict whether a given frame crosses a VLAN boundary at each switch it meets, explain why one form of hopping is two-way and the other only one-way, and audit a trunk and an access port for the handful of settings that close both.

What a VLAN boundary rests on

The standard that defines VLANs, 802.1Q (the Institute of Electrical and Electronics Engineers' standard for bridges and bridged networks, now in its 2022 edition, IEEE SA, 802.1Q-2022), makes a VLAN a matter of classification: a bridge decides which VLAN each received frame belongs to, and forwards it only among ports of that VLAN. Mick Seaman, the editor of the 802.1Q revision, summarized the rules in a note for the working group in January 2022. A bridge "associates a VID (vlan identifier) with each and every received frame"; a frame that arrives untagged, or with a tag carrying VID 0 (a "priority-tagged" frame), gets the port's own default, the PVID (port VLAN identifier), and "the VID value 0 is reserved and not a valid value for the PVID"; on transmission "a frame is either VLAN tagged with the non-zero VID value or untagged" (Seaman, IEEE 802.1, 19 January 2022). Two more consequences in the same note explain double tagging before anyone has sent a frame: a bridge "can remove a C-VLAN Tag encoded in the initial octets of the data, but will not double tag", and it "does not look beyond a C-VLAN Tag encoded in the initial data octets to search for other encoded protocol identifiers or tags" (C-VLAN is the customer VLAN, the ordinary kind).

The IEEE's management model, the data model that 802.1 publishes for bridges, shows the per-port settings that decide what a port accepts, with their defaults (IEEE 802.1, ieee802-dot1q-bridge YANG module, revision 2023-10-26):

SettingValuesDefault in the modelWhat it decides
PVIDa VLAN identifier1the VLAN of untagged and priority-tagged frames arriving on the port
Acceptable frame typesadmit-only-VLAN-tagged-frames, admit-only-untagged-and-priority-tagged, admit-all-framesadmit-all-frameswhether the port accepts tags from whatever is attached
Ingress filteringon or offoff"the discarding of any frame received on a Port whose VLAN classification does not include that Port in its member set"

Read together, the rules say that a VLAN boundary rests on three decisions: which ports will believe a tag that a host wrote, which VLAN a trunk carries without a tag, and who may turn a port into a trunk. VLAN hopping is the family of attacks on those three decisions. The model's defaults are the permissive ones; what a given switch ships with is its 's choice, which is why the settings in this article are worth checking port by port rather than assuming.

The tag, written out

An 802.1Q tag is four bytes inserted after the source address: a two-byte tag protocol identifier (TPID), 0x8100, which the Internet Assigned Numbers Authority () lists as the "Customer VLAN Tag Type (C-Tag, formerly called the Q-Tag)", and two bytes of tag control information (TCI) (IANA, IEEE 802 numbers). The TCI holds a three-bit priority code point (PCP), "a 3-bit field that refers to the class of service", one bit that marks the frame as drop eligible (DEI, the drop eligible indicator), and "the 12-bit VLAN-ID used in the VLAN Tag header", whose usable range is 1 to 4094, with 0 and 4095 "not permitted" as VLAN indices (IEEE 802.1, ieee802-dot1q-types YANG module; Wireshark, display filter reference: VLAN). Computing a TCI is shifting bits:

VLANPriorityBits (PCP, DEI, VID)TCI
10000 0 0000 0000 000100 01
200000 0 0000 0001 010000 14
9990000 0 0011 1110 011103 E7
1005 (voice, the Cisco phone default quoted in the VLAN article)101 0 0000 0110 0100A0 64
05101 0 0000 0000 0000A0 00, a priority tag with no VLAN

The 802.1Q tag decoder and trunk VLAN calculator does the same arithmetic in both directions. The last row matters at the end of this article: a tag whose VID is 0 carries a priority and no VLAN, and a bridge treats the frame as untagged for classification.

Switch spoofing: talking a port into a trunk

The negotiation

Cisco switches can agree to form a trunk with the Dynamic Trunking Protocol (), a Cisco protocol. The Catalyst 9300 guide defines the four port modes (Cisco, Catalyst 9300 IOS XE 17.12, configuring VLAN trunks, 28 July 2023):

  • access: "Puts the interface (access port) into permanent nontrunking mode and negotiates to convert the link into a nontrunk link."
  • trunk: "Puts the interface into permanent trunking mode and negotiates to convert the neighboring link into a trunk link."
  • dynamic auto: "Makes the interface able to convert the link to a trunk link. The interface becomes a trunk interface if the neighboring interface is set to trunk or desirable mode."
  • dynamic desirable: "Makes the interface actively attempt to convert the link to a trunk link. The interface becomes a trunk interface if the neighboring interface is set to trunk, desirable, or auto mode."

And the default, in the same guide: "The default mode for Layer 2 interfaces is switchport mode dynamic auto." Put the definitions in a table and the attack appears in the bottom row:

This portNeighbour: accessNeighbour: trunkNeighbour: dynamic autoNeighbour: dynamic desirable
accessno trunkno trunkno trunkno trunk
trunkno trunk (the two ends disagree)trunktrunktrunk
dynamic auto (the default)no trunktrunkno trunk: neither side askstrunk
dynamic desirableno trunktrunktrunktrunk

A desk port left at its default waits to be asked. Anything that sends the right DTP frames, announcing itself as desirable, gets a trunk. Sean Convery of Cisco described it at USA in 2002, from the tests Cisco ran with @stake: "A station can spoof as a switch with ISL or 802.1Q signaling (DTP signaling is usually required as well, or a rogue DTP speaking switch)", "The station is then member of all VLANs", and the condition: it "Requires a trunking favorable setting on the port" (Convery, 2002). (ISL, Inter-Switch Link, is Cisco's older trunk encapsulation.) His slides also identify the frames: DTP travels in frames with an 802.2 logical link control and subnetwork access protocol (LLC/SNAP) header carrying Cisco's organizationally unique identifier, to "DST MAC 0100.0ccc.cccc" with "SNAP Proto 0x2004" (same slides). Wireshark's dissector names the fields a capture shows: the trunk administrative and operating status and type, the domain, and the sender's address (Wireshark, display filter reference: DTP).

Why a trunk is the prize: "By default, a trunk port sends traffic to and receives traffic from all VLANs", and "All VLAN IDs, 1 to 4094, are allowed on each trunk" (Cisco, as above). A host that becomes the far end of a trunk can tag frames into any VLAN and receive the traffic of every VLAN the trunk carries. Unlike the double tagging below, this hop is two-way.

What a trunk also lets in

A trunk carries the switches' own control protocols as well as user traffic. Convery's 2002 slides showed one consequence for networks using Cisco's VLAN Trunking Protocol (VTP), which distributes the VLAN list from a server switch: "After becoming a trunk port, an attacker could send VTP messages as a server with no VLANs configured. All VLANs would be deleted across the entire VTP domain", and the remedy was transparent mode or a password (Convery, 2002). Cisco's campus design guide of 2008 recommends VTP "in transparent mode to reduce the potential for operational error" and, where a central VLAN database is wanted, VTP version 3, which "contains many enhancements for security and reliability" (Cisco, Campus Network for High Availability Design Guide, 21 May 2008).

Closing it

Every source in the record gives the same answer, which is to take negotiation away from ports that face hosts. The campus guide: "Disable Trunking/VLAN tagging on host ports" and, for trunks, "Hard set the trunk mode to on and the encapsulation to off" (Cisco, 2008, as above); switchport nonegotiate "Prevents the interface from generating DTP frames" (Cisco, 2023, as above). The National Security Agency's (NSA) network infrastructure guidance of March 2022 recommends "disabling dynamic trunking as it is not necessary for an interface port to dynamically configure itself", because "An adversary that is connected to a dynamic port could instruct it to become a trunk port and potentially gain access to network traffic without regard to VLAN separation" (NSA, PP-22-0266, March 2022, section 9.1). The Yersinia framework's authors put it as an exclamation in 2005: "Set all ports to DTP off (no more auto!!)" (Barroso and Andrés, Black Hat Europe 2005). With every desk port fixed as access, the bottom-right cell of the table is empty.

Double tagging: one tag for each switch

The frame, written out

Double tagging needs no negotiation at all. It uses the native VLAN, the one VLAN a trunk carries untagged, which on Cisco switches "is VLAN 1 by default" (Cisco, 2023, as above) and in the IEEE model is simply the PVID, default 1.

The network: two switches, SW1 and SW2, joined by a trunk that carries every VLAN with VLAN 1 native. On SW1, port 3 is an access port left in VLAN 1, the default, and a host M is plugged into it. On SW2, port 5 is an access port in VLAN 20, where a server S lives. The addresses are from the ranges reserved for documentation (RFC 9542; RFC 5737): S is 00-00-5E-00-53-20 at 198.51.100.20, M is 00-00-5E-00-53-66 at 192.0.2.102. M sends one frame with two tags:

BytesFieldValueMeaning
0 to 5Destination00 00 5E 00 53 20S
6 to 11Source00 00 5E 00 53 66M
12 to 13TPID, outer tag81 00802.1Q
14 to 15TCI, outer tag00 01VLAN 1, the trunk's native VLAN
16 to 17TPID, inner tag81 00802.1Q again
18 to 19TCI, inner tag00 14VLAN 20, where S lives
20 to 2108 00IPv4
22 onwardsIPv4 packetto 198.51.100.20whatever M wants S to receive

At SW1, port 3. The port accepts tagged frames (admit-all, the model's default) and classifies the frame by its first tag: VLAN 1. Port 3 is a member of VLAN 1, so even ingress filtering lets it in. The destination address is not in VLAN 1's table, because S lives in VLAN 20, so SW1 floods the frame in VLAN 1, including out of the trunk.

On the trunk. VLAN 1 is the native VLAN, transmitted untagged, so SW1 removes the tag it classified the frame by, the outer one, and does not look further, exactly as Seaman's note describes. What crosses the trunk:

BytesFieldValue
0 to 5Destination00 00 5E 00 53 20
6 to 11Source00 00 5E 00 53 66
12 to 13TPID81 00
14 to 15TCI00 14: VLAN 20
16 to 17EtherType08 00

At SW2. A tagged frame on a trunk port, VID 20: VLAN 20. S's address is in VLAN 20's table on port 5, an untagged member, so SW2 removes the tag and delivers the IPv4 packet to S, from a host that has no business in VLAN 20.

Cisco's campus guide describes the same path in prose: "If the attacker has specific knowledge of the 802.1Q native VLAN, a packet could be crafted that when processed, the first or outermost tag is removed when the packet is switched onto the untagged native VLAN. When the packet reaches the target switch, the inner or second tag is then processed and the potentially malicious packet is switched to the target VLAN" (Cisco, 2008, as above). And the Defense Information Systems Agency's (DISA) security technical implementation guide (STIG) for Cisco switches describes it from the trunk's side: "Because the frame will ingress the switch from a port belonging to its native VLAN, the trunk port connecting to the victim's switch will remove the outer tag because native VLAN traffic is to be untagged" (DISA, Cisco IOS Switch L2S STIG, finding V-220646).

Why it only goes one way

S's answer is an ordinary frame in VLAN 20. No switch will ever add M's VLAN 1 to it; nothing in it leads back to port 3 at layer 2. The campus guide says so: "the traffic in this attack scenario is in a single direction and no return traffic can be switched by this mechanism", and "this attack cannot work unless the attacker knows the native VLAN ID" (Cisco, 2008, as above). Convery's slides list the same properties: "Unidirectional traffic only", "Only Works if Trunk Has the Same Native VLAN as the Attacker", and, the uncomfortable one, "Works even if trunk ports are set to off": negotiation does not matter, only the native VLAN does (Convery, 2002). One-way is still enough for a lot: a single packet that triggers something, a broadcast into a VLAN that should be closed, or a flood of traffic that denies service.

Three settings, three ways the example fails

Change one thing at a time and run the frame again.

SettingWhat happens to M's frameSource of the setting
The trunk's native VLAN moved to an unused VLAN, say 999, with no access port in itThe trunk now sends VLAN 1 tagged; SW1 keeps the outer tag 00 01, SW2 classifies the frame as VLAN 1, and the inner tag is just bytes behind it. No hopCampus guide: "set the native VLAN to an obscure ID that is not used for any real traffic"; NSA: a "unique native trunking VLAN that is only assigned to trunk ports"; DISA V-220646: native VLAN "other than the default VLAN"
All VLANs tagged on trunks, the native one includedSame result: "there will always be an outer tag for native traffic as it traverses an 802.1q trunk"DISA V-220646; on Cisco, the global vlan dot1q tag native quoted in the VLAN article
Port 3 accepts only untagged and priority-tagged framesThe frame is discarded at port 3IEEE 802.1Q acceptable frame types, in the bridge YANG model

A fourth setting removes the precondition rather than the mechanism: leave nothing in VLAN 1. The NSA recommends that the default VLAN "be logically disallowed on all trunks and access ports that don't require it (including disconnected and shutdown ports)", that unused ports be parked in an unused, disabled VLAN, and gives the trunk example with "switchport trunk allowed vlan 2-4094", adding that "If all configured VLANs are known, NSA recommends allowing only those specific VLANs" (NSA, PP-22-0266, section 9.3). Its stated purpose is exactly this attack: the configuration "will prevent an adversary from jumping between active VLANs by intentionally tagging traffic that would otherwise be untagged" (same section).

Ingress filtering, the last row of the first table, does not stop double tagging, because M's port really is in VLAN 1. It stops the simplest hop of all, a host on an access port in one VLAN sending a frame with a single tag for another: with filtering on, "any frame received on a Port whose VLAN classification does not include that Port in its member set" is discarded. Both it and the acceptable frame types are worth checking on every access port.

Through the phone: the voice VLAN

A desk with an IP phone is usually an access port with a second, tagged VLAN for voice, and the phone learns which VLAN to tag from the switch, through Cisco's discovery protocol or the Media Endpoint Discovery extension of the Link Layer Discovery Protocol (-); the mechanism is described in VLANs and 802.1Q trunking. The port therefore accepts tags in one VLAN from whatever is plugged in, and the announcement that tells the phone which one is unauthenticated. Bhaiji's Cisco slides of SANOG 7, the South Asian Network Operators Group meeting in Mumbai in January 2006 (dated 2005), note for DTP that "Cisco IP phone is a switch" (Bhaiji, SANOG 7).

The tool that made this a routine test is VoIP Hopper, by Jason Ostrom, which its page describes as "a GPLv3 licensed security tool, written in C, that rapidly runs a VLAN Hop security test" and "a VoIP infrastructure security testing tool but also a tool that can be used to test the (in)security of VLANs"; version 2.0 was demonstrated at the 19 conference in August 2011, and version 2.04 of April 2012 added "Avaya, Alcatel, and LLDP-MED spoofing support" (VoIP Hopper). (VoIP is voice over IP; GPLv3 is version 3 of the General Public License.) The principle needs no command line: whatever the switch tells a phone, it tells anything that asks like a phone.

The defences are the ones for every desk port, applied to both VLANs: authenticate the phone and the computer separately with 802.1X or MAC authentication bypass, limit the port to the two or three addresses a phone and a computer need, and treat what a device says about itself over LLDP-MED as inventory, not identity. They are set out in keeping rogue devices off the network.

When the filter looks past the tag: VLAN 0 and LLC/SNAP

The last form of the problem is newer and subtler. A switch's first-hop security features, ( is the Address Resolution Protocol), snooping of the Dynamic Host Configuration Protocol () and the IPv6 router advertisement guard, inspect frames of particular types. A host stack may accept the same packet in more than one encapsulation. When the two disagree, a frame can be ignored by the filter and accepted by the host.

Etienne Champetier found the first case in 2020. A tag with VID 0 is a priority tag, and "if VID == 0x000, Linux ignores/removes the VLAN header and handles it on the untagged interface"; Linux "will remove any number of VLAN 0 headers", while firewall rules applied to the full frame see an 802.1Q frame rather than the IPv6 packet inside it. His conclusion: "As usual when you try to filter anything, you MUST use an allow list approach, else you risk letting some unwanted traffic go through." The products he tested and reported included OpenStack's Linux bridge driver, LXD, which "fixed the next day" by allowing ARP, IPv4 and IPv6 "and drop everything else" (released in LXD 4.3 on 1 July 2020), and Microsoft Hyper-V, fixed as -2020-17040 on 10 November 2020 (Champetier, Bridge firewalling "bypass" using VLAN 0). A follow-up added 802.2 LLC/SNAP encapsulation and 802.3 length fields with invalid values, and a hardware case: an inexpensive Cisco switch with IPv6 first-hop security, whose router advertisement guard he bypassed (Champetier, VLAN 0, LLC/SNAP headers and invalid length).

The CERT Coordination Center published the coordinated note on 27 September 2022 as VU#855201, written by Timur Snoke: "Layer-2 (L2) network security controls provided by various devices, such as switches, routers, and operating systems, can be bypassed by stacking Ethernet protocol headers", by "a combination of one or more VLAN 0 (priority tag) headers and 802.2 LLC/SNAP headers", with "Dynamic ARP inspection, IPv6 Neighbor Discovery (ND) protection, and IPv6 RA Guard" among the examples, four Common Vulnerabilities and Exposures (CVE) identifiers (CVE-2021-27853, 27854, 27861 and 27862), and an impact of denial of service or a man in the middle. Its solution, besides updates, was an allow-list at the access port: "only allow needed protocol on access ports (ARP//IPv4/IPv6)", ICMP being the Internet Control Message Protocol (CERT/CC, VU#855201). The standards side responded in the IEEE's own revision work: Seaman's January 2022 note, written for a ballot comment on the 802.1Q revision, set out that "Bridges do not transmit priority-tagged frames" and how priority tags and VLAN tags are meant to be handled (Seaman, IEEE 802.1, 19 January 2022).

The connection to hopping is the same as in double tagging: a device that classifies or filters by the first header it recognizes, and a device further on that reads a different one. The defence is also the same: decide what an access port may carry and drop the rest. The ARP side of this, what such a bypass does to inspection, is in ARP poisoning on a switched LAN.

The record

YearEventSource
2002Cisco and @stake test switch spoofing and double encapsulation; Convery presents both at Black Hat USA, with "Be paranoid: Do not use VLAN 1 for anything" among the best practicesConvery, 2002
2005Yersinia, by David Barroso and Alfredo Andrés of S21sec, implements DTP, 802.1Q and VTP attacks, including "a RAW 802.1Q double encapsulated packet"Barroso and Andrés, 2005
2006Bhaiji's SANOG 7 slides recommend "Use all tagged mode for the Native VLAN on trunks" and "Disable auto-trunking on user facing ports (DTP off)"Bhaiji, SANOG 7
2008Cisco's campus design guide calls double tagging "a remote possibility" and gives the native VLAN and trunking settingsCisco, 2008
2011 to 2012VoIP Hopper 2.0 at DEF CON 19, then 2.04 with LLDP-MED spoofingVoIP Hopper
2020 to 2022Champetier's VLAN 0 and LLC/SNAP bypasses; CERT/CC VU#855201 on 27 September 2022CERT/CC, VU#855201
2022NSA guidance: no dynamic trunking, no default VLAN, unique native VLAN on trunksNSA, PP-22-0266
currentDISA's Cisco switch STIG finding V-220646, in the guide dated 1 May 2026: native VLAN other than the default on every trunkDISA, V-220646

As with the previous part, this research found tools, tests, vulnerability notes and hardening guides, and no public incident report in which an intruder's VLAN hop is documented in the owner's own words. The tests are clear about the conditions, and the conditions are defaults: dynamic ports, VLAN 1 everywhere, a native VLAN shared with users.

The Brazilian angle

The Brazilian Internet exchange shows VLAN tags used on purpose at scale, under rules strict enough to leave no room for these tricks. .br, run by (Núcleo de Informação e Coordenação do Ponto BR), connects many participants through intermediate interconnection points, known as CIX, that aggregate them onto one exchange port. Its Technical Requirements Policy, version 1.0 of 30 June 2017, defines each participant's place on such a port by tags: a type 1 CIX "operates with at most 20 VLANs (IEEE 802.1Q)" (our translation, as for the policy's other quotations here), typically two per participant, "one for the IPv4 and another for the IPv6 ATM" (ATM is the Acordo de Troca de Tráfego Multilateral, the multilateral peering agreement, IX.br, 2018); a type 2 with at most 100; and a type 3 "operates with Metro TAGs, tags used for the implementation of Q-in-Q (IEEE 802.1ad)", assigned "in blocks of 100" with "up to 10 VLANs" per participant's virtual port, and a maximum transmission unit () of 1,523 bytes so that the participant keeps 1,500 (IX.br, Technical Requirements Policy (in Portuguese), V1.0, 30 June 2017).

The same policy then closes the doors this article has been opening. Participants' frames must be Ethernet II, "not allowing the use of LLC/SNAP (802.2) encapsulation"; only frames whose EtherType is IPv4, ARP or IPv6 "may pass through the infrastructure" (the CIX operators may add link aggregation's 0x8809); discovery protocols "are not allowed on the interface of the network equipment connected to IX.br"; and IPv6 router advertisements must be off (same source; the document prints IPv4's EtherType as 0x8000, where IANA's registry has 0x0800). That is the allow-list CERT/CC recommended for access ports in September 2022, in force at the Brazilian exchange since June 2017: no DTP or other discovery frames to negotiate with, no LLC/SNAP to hide a payload behind, and a fixed set of VLANs per port decided by the exchange rather than by whatever the participant's router sends.

What defenders can do

  • Fix every host port as access, with negotiation off; fix every trunk as trunk, with negotiation off and the allowed VLANs listed rather than left at "all".
  • Give each trunk a native VLAN that nothing else uses, or tag the native VLAN, and keep VLAN 1 out of user traffic, trunks and unused ports.
  • Park unused ports shut down in an unused, disabled VLAN.
  • Check the acceptable frame types and ingress filtering on access ports; a port that faces a host should not believe the host's tags, except in the voice VLAN you gave it.
  • Run VTP in transparent mode or version 3, or not at all.
  • Authenticate both devices on a phone port, and limit the addresses it may present.
  • Allow only what an access port needs, and keep switch software current: VU#855201 showed that filters can be walked around by encapsulations nobody expected.

What to remember

  • A bridge classifies a frame by its first tag, or by the port's PVID if there is none, and does not look beyond the tag it reads; the IEEE model's defaults accept tags on any port.
  • Switch spoofing turns a port left at "dynamic auto" into a trunk by speaking DTP; the result is two-way access to every VLAN the trunk carries.
  • Double tagging needs only an access port in the trunk's native VLAN: the first switch strips the outer tag, the second reads the inner one. It is one-way.
  • The fixes are configuration: access mode and no negotiation on host ports, an unused or tagged native VLAN, no VLAN 1 for users, explicit allowed lists on trunks.
  • Voice VLANs and priority tags are legitimate tags on access ports, which is why phones and VLAN 0 keep reappearing in this story.
  • An allow-list of frame types at the port, which the Brazilian exchange has had since 2017, closes the encapsulation tricks that filters miss.

Sources