double tagging

term

networkingsecurity

Kept in this browser · My desk

A VLAN hopping technique in which a host in a trunk's native VLAN sends a frame with two 802.1Q tags, so that the first switch strips the outer tag on the untagged native VLAN and the next switch delivers the frame into the VLAN named by the inner one.

It works because a bridge classifies a frame by its first tag and, as the IEEE 802.1Q revision editor's 2022 note puts it, can remove a tag but does not double tag and does not look beyond the tag it reads. Cisco's 2008 campus design guide calls it a remote possibility that needs the native VLAN ID and carries traffic in a single direction only; Convery's 2002 slides add that it works even when trunk negotiation is off.

What it is. Double tagging is a VLAN (virtual local area network) hopping technique in which a host in a trunk's native VLAN sends a frame carrying two 802.1Q tags, so that the first switch strips the outer tag when it sends the frame across the trunk untagged in the native VLAN, and the next switch, reading the inner tag as the frame's only tag, delivers it into the VLAN the attacker chose. It needs no negotiation and no misbehaving protocol, only a native VLAN shared by the attacker's access port and the trunk.

Worked by hand. A frame with an outer tag 81 00 00 01 (VLAN 1) and an inner tag 81 00 00 14 (VLAN 20) enters an access port in VLAN 1; the trunk sends VLAN 1 untagged, so what crosses it carries only 81 00 00 14, and the far switch puts it in VLAN 20. Byte by byte the frame leaves the attacker as destination address, source address, 81 00 00 01, 81 00 00 14, 08 00 and an IPv4 packet. Each tag is the Tag Protocol Identifier 0x8100, which IANA (Internet Assigned Numbers Authority) registers as the Customer VLAN Tag Type, followed by 16 bits: 3 of priority, 1 drop eligible indicator and 12 of VLAN identifier; 0x0014 is priority 0, VLAN 20, and 0x0001 is VLAN 1. Wireshark decodes both headers and shows two vlan.id values in one frame, which is the signature to look for on an access port.

Why it works. It works because a bridge classifies a frame by its first tag and, as the IEEE (Institute of Electrical and Electronics Engineers) 802.1Q revision editor's 2022 note puts it, can remove a tag but does not double tag and does not look beyond the tag it reads. The first switch sees a frame tagged VLAN 1 arriving on a port in VLAN 1, removes the tag because VLAN 1 is the trunk's untagged VLAN, and forwards; it never examines the second tag. The second switch sees one tag and obeys it. Neither switch is faulty by the standard; the native VLAN is the weak link.

Why one way. The frame reaches the victim, but any reply is addressed within VLAN 20 and stays there; it never returns to VLAN 1. Cisco's 2008 campus design guide calls the technique a remote possibility that needs the native VLAN ID and carries traffic in a single direction only; Convery's 2002 slides, from Cisco and @stake testing, add that it works even when trunk negotiation is off, because it uses ordinary forwarding rather than DTP (Dynamic Trunking Protocol). One-way delivery limits it to packets that need no answer, a spoofed datagram or a trigger, but that is enough to reach a host that a router or firewall was meant to protect.

The record. The National Vulnerability Database (NVD) entry CVE-2005-4440, published on 21 December 2005, describes it as the double-tagging VLAN jumping attack, demonstrated by Yersinia: a message with two 802.1Q tags, the second acted on by a downstream switch after the first has been stripped. Yersinia's authors, David Barroso and Alfredo Andrés of S21sec, presented it at Black Hat Europe that year among attacks on DTP, STP (Spanning Tree Protocol) and VTP (VLAN Trunking Protocol).

Legitimate double tags. Two tags are not always an attack. Provider bridging (often called Q-in-Q) carries a customer's tagged frames inside a service tag, which IANA registers as 0x88A8, the S-Tag, distinct from the customer's 0x8100; the IEEE editor's note mentions the related case of a customer bridge sending S-tagged priority-tagged frames to a provider bridge. The attack is a pair of customer tags arriving where only untagged frames belong.

The fixes. Moving the trunk's native VLAN to an unused ID, tagging the native VLAN on trunks, or making access ports admit only untagged and priority-tagged frames each stops the example; the STIG (Security Technical Implementation Guide) finding V-220646 of the Defense Information Systems Agency (DISA) and the 2022 guidance of the National Security Agency (NSA) require the first, and accept the second as an alternative. The IEEE bridge model names the third option admit-only-untagged-and-priority-tagged, while its default is admit-all-frames, so an access port that has never been configured accepts the attacker's tagged frame. Removing access ports from VLAN 1 altogether, as the NSA advises, removes the common case where the attacker's VLAN and the default native VLAN coincide.

Misreadings. Double tagging is not switch spoofing: it needs no trunk on the attacker's port and survives DTP being off. It is not VLAN 0 abuse either: a priority tag carries VLAN 0 and moves nothing between VLANs, though it can hide traffic from filters. Neighbours: VLAN hopping, native VLAN, 802.1Q, trunk port, VLAN and priority tag.

Also known as: double tagging, double-tagged frame, double encapsulation, 802.1q double tagging, double 802.1q encapsulation

Sources

← Back to D Back to the glossary