802.1x VLAN User Distribution (VLAN Group)

In this blog post, I will be going over 802.1x VLAN User Distribution (sometimes referred to as “VLAN Groups”) in Cisco IOS and a use case scenario that involves Cisco ISE (Identity Services Engine).

First, some background around VLAN Groups. Based on my research it seems there are two major types of VLAN Groups: The Firewall Service Module (FWSM) on the 6500 and on Cisco IOS & IOS XE Switches. It appears to possibly have other functionality within the Wireless Space for user assignment, but I did not do extensive research on that aspect to find an inclusive answer. In the world of IOS a VLAN group is simply a group that has a name assigned to it that can contain one or more VLANs assigned to that group.

The main purpose of 802.1x VLAN User Distribution is to dynamically provide VLAN load balancing by having the RADIUS server dictate the VLAN Group name within attribute 81 (Tunnel-Private-Group-ID) in the RADIUS response instead of a regular VLAN ID/Name. When the switch receives the VLAN Group name, it will assign the endpoint to the least populated configured VLAN for that group. Prior to IOS release 12.2(33)SXI1, this was accomplished by having multiple VLAN names specified under attribute 81.

A use case I have found outside of VLAN distribution load balancing (and the reason I know about VLAN Groups) is to provide a way to dynamically assign a preconfigured VLAN that does not have a uniform number across the enterprise from ISE. This case in particular was to have a predefined VLAN, that would span multiple different VLAN numbers, specific for Cisco IP Phones not tied to a Cisco CM dynamically assigned once the appropriate device profile in ISE was determined. This allows for the ability to have a different option 80 fields in the DHCP response to direct the phones to their non-Cisco based Call Manager.

To take advantage of this configuration, the VLAN group assigned with your desired VLAN(s) must be configured on the switch and the authorization profile that will be applied from ISE must be configured with RADIUS attribute 81 set to the VLAN group name.

To configure a VLAN group in IOS perform the following task:
SW1(config)# vlan group group-name vlan-list vlan-list

To note:

  • A VLAN Group name can be up to 32 characters
  • A VLAN Group name must start with a letter
  • Group members can be specified as a single VLAN ID, a list of VLAN IDs, or a VLAN ID range. Multiple entries are separated by a hyphen (-) or a comma (,) similar to the interface range command.
  • To remove a VLAN from the VLAN group, use the no version (no vlan group group-name vlan-list vlan-ID).
  • The VLAN Group will be removed once the last VLAN ID is removed from the group.

Configuring a VLAN Group on a Cisco Switch:rh3cn9l
vlan group TEST_VG vlan-list 410

Configuring VLAN Group assignment in ISE:
image002
Navigate to Policy Elements > Results > Authorization > Authorization Profiles > Profile
Select VLAN and Enter VLAN Group Name

Once a endpoint is authenticated against the switch via 802.1X and the appropriate authorization profile is assigned, the VLAN configured on the switch for the VLAN group is assigned:Verfication

Some bonus verification information:

When a VLAN is statically assigned via 802.1X, the VLAN assignment can be seen across multiple switchport / VLAN status commands.

The first command is show vlan.

Before dynamic VLAN assignment (port configuration):verification1

After dynamic VLAN assignment (via 802.1X with VLAN Group):verification2

The second command is show interface interface-name switchport:

Before dynamic VLAN assignment (port configuration):verification3

After dynamic VLAN assignment (via 802.1X with VLAN Group):verification4

Lets just go ahead and use DTP & VLAN 1… Part 1: Attacking DTP – getting those server files

In my previous post, I discussed the vulnerabilities introduced from using the defaults of DTP and VLAN1 along with ways to mitigate the vulnerabilities. In this post a basic example of attacking DTP will be reviewed.

To make things easier to follow the following diagram will be used throughout the series:VH

Before the attack, for demonstration purposes, we verify that the attacker’s switchport (fa 0/14) is not a trunk:

Untitled2

We will also verify the inability of the attacker to access the target server (due to the router’s ACL):a1

Now that we have verified the inability for the attacker to gain access to the server we can begin the attack.

The first phase of the attack will be to trick the switch into thinking its connected to another switch and negotiate a trunk link. This will be completed through spoofing DTP packets, which can be seen below:at1

We can see the switch port flap as it resets, and then its verified that the attacker’s port is now a trunk:Untitled3

Now that the switch believes its connected to another switch via a trunk connection its now possible to create virtual interfaces for any VLAN allowed across the trunk (all by default):at2

As can be imagined, with the attacker able to successfully trick the connected switch into thinking s/he is also a switch almost anything is possible. For today, we will simply pull a file off of the server which is supposed to be protected by an ACL on the router:
at3

passwords

With DTP enabled on a port it takes a matter of seconds to trick a switch into thinking its connected to another switch, this is why its very important to configure any port that is not a trunk port in use as an access port with other appropriate security configurations.

Lets just go ahead and use DTP & VLAN 1… Part 0: What using DTP & VLAN 1 means

By default, DTP auto negation is enabled on Cisco switches on all layer 2 ports and they are placed in VLAN 1. These two defaults allow for an easy way to just deploy a switch, or attach another switch to gain more port density, without needing any configuration knowledge. While this is very helpful, the use of VLAN 1 and leaving DTP auto negation on has been widely accepted as standard use for data ports and in turn has left the ability for someone with physical access to gain access to other VLANs and the devices in them.

In part 0 of this series we are going to go over the theory of why the use of DTP and VLAN 1 could be used to allow for an attacker to execute a VLAN hopping attack.

DTP:

Dynamic Trunking Protocol (DTP) is a Cisco proprietary protocol used to allow for trunks to automatically form between switches without requiring any configuration knowledge when they are plugged into each other. DTP sends updates every 60 seconds over links with DTP enabled and includes the switch’s DTP type, interface status, and VTP domain.

Attacking DTP:

While there really isn’t much to say about DTP (even at a technical level) having DTP on allows for a security hole that can easily be exploited to allow full access to any VLANs the switch has access to. There are two different ways to take advantage of DTP both of which are pretty straight forward.

The first method involves simply plugging in another Cisco switch, that the attacker has control over, with DTP enabled. Once the two switches form a trunk, the attacker can then configure the switch they control and put a device in any VLAN that’s allowed across the trunk (which is all by default). SS

Figure 1 – Adding a third switch

The second method involves forging DTP frames to trick the victim switch into forming a trunk with the attackers computer. Once the trunk is formed, the attacker can forge other frames and packets that will allow them deeper access into the network similar to having their own switch but without the hassle of having a switch on-site for the attack. ST

Figure 2 – Switch Spoofing

Mitigating DTP attacks:

Just as DTP and the attacks associated with the protocol are simple, so are the steps for mitigating the attacks.

1. Set any port not used as a trunk explicitly as an access port
SW-1 (config)# interface fa 1/0/1
SW-1 (config-if)# description Access Port
SW-1 (config-if)# switchport mode access

2. On ports that are trunks, disable DTP negotiation
SW-1 (config)# interface gig 1/0/1
SW-1 (config-if)# description Trunk to SW-2
SW-1 (config-if)# switchport trunk encapsulation dot1q
SW-1 (config-if)# switchport mode trunk
SW-1 (config-if)# switchport nonegotiate

SW-2 (config)# interface gig 1/0/1
SW-2 (config-if)# description Trunk to SW-1
SW-2 (config-if)# switchport trunk encapsulation dot1q
SW-2 (config-if)# switchport mode trunk
SW-2 (config-if)# switchport nonegotiate
802.1Q:

Unlike Cisco proprietary ISL, standards based 802.1Q does not encapsulate the original frame. Instead it adds a 32-bit field between the source MAC address and the EtherType/length fields. Another difference between ISL and 802.1Q is the concept of a native VLAN. While ISL doesn’t have a native VLAN in 802.1Q a native VLAN will not be tagged when frames for that VLAN are flowing over a trunk link by default.

Attacking the native VLAN:

The use of the native (untagged) VLAN allows for an attack called VLAN hopping. This attack allows for an attacker to craft frames that are “double tagged” which have two 802.1Q tags in the frame. The attack itself would be performed in the following manner:

DT

Figure 3 – Double Tagging

1. The attacker crafts a frame with two 802.1Q tags, the first tag will be for the native VLAN 1 (in this case the default VLAN 1) and the second tag will be for the target VLAN (in this case VLAN 10).

2. SW-1 receives the frame on a port set as the native VLAN and strips the first 802.1Q header. Next, it will forward the frame out any trunk links it has that are set for native VLAN 1. In this case the frame will be forwarded to SW-2 over its trunk link.

3. SW-2 receives the frame on its trunk and see that it is destined for a device in VLAN 20. Assuming the target’s MAC address is already in the MAC table, the frame has its second 802.1Q header removed (because its going to be forwarded over an access port which doesn’t allow 802.1Q headers) and forwarded to the target.

As can be seen above, the attack does require two switches to be trunked together in order to allow for it to be successful.

Protecting the native VLAN:

There are three easy ways to protect against VLAN hopping attacks, only one is required but the use of all three is highly recommended.

1. Do not use the native VLAN on any access port
SW-1 (config)# interface fa 1/0/1
SW-1 (config-if)# description Access Port
SW-1 (config-if)# switchport access vlan 20

2. Set the native VLAN to an unused VLAN (must be configured on both switches of a trunk)
SW-1 (config)# interface gig 1/0/1
SW-1 (config-if)# description Trunk to SW-2
SW-1 (config-if)# switchport trunk native vlan 999

SW-2 (config)# interface gig 1/0/1
SW-2 (config-if)# description Trunk to SW-1
SW-2 (config-if)# switchport trunk native vlan 999

3. Tag native VLAN traffic (must be configured on both switches of a trunk)
SW-1 (config)# interface gig 1/0/1
SW-1 (config-if)# description Trunk to SW-2
SW-1 (config-if)# switchport trunk native vlan tag

SW-2 (config)# interface gig 1/0/1
SW-2 (config-if)# description Trunk to SW-1
SW-2 (config-if)# switchport trunk native vlan tag

 

While defaults are wonderful to have and make certain tasks easier, it must be taken into consideration what those defaults actually enable what type of holes could be opened in a security plan when used. My next post will go into greater detail of using these vulnerabilities as a jumping off point on gaining access to other systems on a network.