The To DS and From DS Fields

Currently I’m studying for the Certified Wireless Analysis Professional (CWAP) exam and I’m rereading the study guide and I found the chapters that examined the different fields and elements present in the MAC header most interesting. I had a rough idea, but during my studies learned a great deal more about the unique fields and elements dedicated to wireless that keep the network functioning and help packets get delivered. Two fields of particular interest are the To Distribution System (To DS) and From Distribution System (From DS) and how these fields determine if the frame is leaving or entering the wireless environment.

Distribution System

Just a quick definition of the distribution system and basically the DS is the infrastructure that connects multiple access points together to form an Extended Service Set (ESS). The DS is typically an 802.3 Ethernet wired network, but it doesn’t have to be, and the DS can even be a wireless back haul.

MAC Header & Frame Control Field

Lets now look at the MAC header which can contain four address fields. The number of address fields is a major difference between Ethernet frames, which only use two address fields, and wireless frames that could use as many as four address fields. Each address field is 6 bytes in length to hold a standard 48 bit MAC address, and most wireless frames will only use three of the address fields, and wireless frames being transmitted in a wireless distribution system would be the only frames using all four address fields.

The MAC header contains the Frame Control Field consisting of 11 sub fields (see pic below) including the To DS and From DS fields. The To DS and From DS fields are each 1 bit and can be occupied with a 1 or a 0 and there are four possible combinations using these two fields.

MAC Header

The To DS and From DS fields are important for assessing the packet since the bit combination of these fields identifies if the frame is entering or leaving the wireless environment. The fields can also show if the packet is part of an ad hoc network, or part of a wireless distribution system, and if the frame is a Management or Control frame not intended to leave the wireless environment.

To DS and From DS fields are both 0

The frame is either part of an ad-hoc network or the frame is not intended to leave the wireless environment. The screen shot below shows a Beacon Management frame with a status of not leaving the DS or network (see the highlighted line). Management and Control frames will always have the To DS and From DS fields set to 0 and are never sent to the distribution system network.

An Ad-hoc network connects multiple wireless devices together, and typically does not connect to a wired network, so there is no DS involved or requirement to have the fields set to 1.

beacon

To DS field is 1 and From DS field is 0

The frame is leaving the wireless environment and is intended for a computer on the distribution system network. For example after a wireless station authenticates it will need to obtain an IP address and that request will be forwarded by the AP to the DHCP server that resides on the distribution system network.

To DS field is 0 and From DS field is 1

The packet is entering the wireless environment coming from the DS. The screen shot below shows a Data (Type/Subtype field) frame capture in Wireshark, and the highlighted line shows the To DS and From DS fields along with a status of the frame coming from the DS to the station via the access point.

datatods0fromds1

To DS and From DS fields are both 1

When both the To DS and From DS are set to 1 the packet is involved with a wireless distribution system (WDS) network. WDS networks are used to connect multiple networks together, typically for building-to-building connectivity, or a WDS can connect access points together to from a wireless mesh network.

Address Fields

As mentioned the MAC header can contain four addresses and these addresses can change depending on how the To DS and From DS fields are set. Here is quick reference for how the address fields are set for each To DS and From DS combination.

To DS and From DS are both 0

Address 1 = Destination
Address 2 = Source
Address 3 = BSSID

To DS field is 1 and From DS field is 0

Address 1 = BSSID
Address 2 = Source
Address 3 = Destination

To DS field is 0 and From DS field is 1

Address 1 = Destination
Address 2 = BSSID
Address 3 = Source

To DS and From DS are both 1

Address 1 = Receiver
Address 2 = Transmitter
Address 3 = Destination
Address 4 = Source

 Conclusion

When observing packets in a sniffer or pen testing a wireless network It is important to look at the To DS and From DS fields to verify the direction of flow for the packet and how these fields then relate to the MAC addresses in the header.

Wireshark 802.11 Display Filters

Wireshark 802.11 frame type and subtype display filters to quickly sort packet captures.

displayfilter

Management Frames
Control Frames
Data Frames
Association Request
Association Response
Reassociation Request
Reassociation Response
Probe Request
Probe Response
Beacon
ATIM
Disassociation
Authentication
Deauthentication
Action Frames
Block ACK Request
Block ACK
Power Save Poll
Request to Send
Clear to Send
ACK
CFP End
CFP End ACK
Data + CF ACK
Data + CF Poll
Data + CF ACK + CF Poll
Null Data
Null Data + CF ACK
Null Data + CF Poll
Null Data + CF ACK + CF Poll
QoS Data
QoS Data + CF ACK
QoS Data + CF Poll
QoS Data + CF ACK + CF Poll
Null QoS Data
Null QoS Data + CF Poll
Null QoS Data + CF ACK + CF Poll
wlan.fc.type==0
wlan.fc.type==1
wlan.fc.type==2
wlan.fc.type_subtype==0
wlan.fc.type_subtype==1
wlan.fc.type_subtype==2
wlan.fc.type_subtype==3
wlan.fc.type_subtype==4
wlan.fc.type_subtype==5
wlan.fc.type_subtype==8
wlan.fc.type_subtype==9
wlan.fc.type_subtype==10
wlan.fc.type_subtype==11
wlan.fc.type_subtype==12
wlan.fc.type_subtype==13
wlan.fc.type_subtype==24
wlan.fc.type_subtype==25
wlan.fc.type_subtype==26
wlan.fc.type_subtype==27
wlan.fc.type_subtype==28
wlan.fc.type_subtype==29
wlan.fc.type_subtype==30
wlan.fc.type_subtype==31
wlan.fc.type_subtype==33
wlan.fc.type_subtype==34
wlan.fc.type_subtype==35
wlan.fc.type_subtype==36
wlan.fc.type_subtype==37
wlan.fc.type_subtype==38
wlan.fc.type_subtype==39
wlan.fc.type_subtype==40
wlan.fc.type_subtype==41
wlan.fc.type_subtype==42
wlan.fc.type_subtype==43
wlan.fc.type_subtype==44
wlan.fc.type_subtype==46
wlan.fc.type_subtype==47

CWNA CWSP CWAP Study Resources

General Resources

802dot11logoQuick overview of 802 legacy, 802.11a, 802.11b, 802.11g, 802.11n, and the 802.11ac draft standard.

Free Wi-Fi Learning Resources from CWNP

The CWNP Question of the Day (QOTD)

CWNP Exam Terms

CWNP Study Guide CD-ROM Downloads

Packetlife WLAN cheat sheet

Wi-Fi Alliance home page

CWNA

Certified Wireless Network Administrator (CWNA) Overview of the Certificfation

CWNA Certified Wireless Network Official Study Guide: Exam PW0-105 (CWNP Official Study Guides)

Here is the link to download the updated PW0-105 CWNA exam objectives

24GHz_channels

5ghzuniibandschannels.jpg

Wi-Fi Back to Basics – 2.4 GHz Channel Planning

Wikipedia page on  WLAN Channels

802.11 Medium Access

Introduction to Wi-Fi Wireless Antennas

Wi-Fi CERTIFIED™ for WMM®-Power Save

Aerohive’s Medium Contention & Mac Sublayer WiFi 101 video (28:00)

Easy db Math in 5 Minutes

Radio Frequency Measurements (1:13)

Understanding IEEE 802.11n

Memorize 802.11 MCS values and Data rates for CWNA or CWDP (YouTube Video)

CWSP

CWSP Certified Wireless Security Professional Official Study Guide: Exam PW0-204 (CWSP Official Study Guides)

Here is the link to download the updated PW0-204 CWSP exam objectives

EAP Types (Excel file for my own reference)

Marcus Burton, Director of Product Development at CWNP, teaches you the 802.11 4-way handshake. (YouTube Video)

Authentication & Key Management (Marcus Burton, CWNP)

CWSP-802.11r Over-the-Air FT

White Paper (PDF download) Robust Secure Network Fast BSS Transition

White Paper (PDF download) 802.11i Authentication and Key Management

User Guide for the Cisco Secure Access Control System 5.2 (good extra reading on different flavors of EAP)

George Stefanick – CWSP Journey Chapter 5 – RSN

George Stefanick – CWSP Journey Chapter 4 – EAP, EAP, EAP, and EAP

EAP-TLS and PEAP: what they are, part 1 (YouTube Video)

EAP-TLS and PEAP: what they are, part 2 (YouTube Video)

CWAP

CWAP Certified Wireless Analysis Professional Official Study Guide

CWAP Exam Objectives (PDF)

WIRELESS LAN SECURITY MEGAPRIMER PART 5:DISSECTING WLAN HEADERS

802.11 Beacons Revealed

802.11 Beacon Intervals – The Real Story

What is QAM?

CWAP – MAC Header : Frame Control

Understanding Wi-Fi Carrier Sense (Revolution Wi-Fi)

802.11 PPDU Formats

CWAP Study Guide Errata

Extras

My CWNA/CWSP/CWAP YouTube Channel

How I Studied to Pass the CNWA Certification Exam

WiFI Kiwi’s Blog – CWSP Passed!

Cyber Spring Cleaning! Don’t Forget Your Wireless Router!

cleaning-productsAs the weather warms up articles to remind us about cleaning up our devices, online accounts, making backups, and changing passwords are sure to show up, but don’t forget to add your wireless router to this list. Over time the wireless environment may have changed and the number of devices connecting to the network has increased and you have noticed a decrease in the performance. I have listed some items to check to either improve the performance or security of your wireless network.

Upgrade the Router

Electronics age fast and if you’re still running an 802.11g router it is time to upgrade. Look for an 802.11n protocol wireless router or get the latest and greatest 802.11ac router and be ready for the next wave of wireless devices. Either way you’ll notice a performance boost and the router won’t create a bottleneck in the network.

Check for the Latest Firmware

While not as often as Windows or Apple software updates a routers software called firmware does get the occasional update. Firmware could add functionality, patch bugs, or add security features. When you log into the routers management interface look for the firmware section to verify the current version and download any available updates. The firmware update could take several minutes to complete and at some stages you may think nothing is happening, but do not power off or restart the router during the update since this could brick the device!

Move to the 5 GHz Band

This could be more technical than most people can understand, but wireless networks can run in the 2.4 GHz and 5 GHz bands. Most home wireless networks use the 2.4 GHz band and along with wireless networks the 2.4 GHz band has signals from microwaves, cordless telephones, baby monitors, and other home devices making it very crowded. With the 2.4 GHz band being so crowded there are interference issues that can affect performance of the wireless network. Setting up the wireless network in the less used 5 GHz band will result in less interference and better performance.

Change the Channel

wifianalyzerWhether you’re wireless network runs in the 2.4 GHz or 5 GHz band things around you may have changed since the original setup and a quick scan of the neighboring networks may show channel interference. Scanning utilities such as InSSIDer or WiFi Analyzer will offer a snapshot of the wireless networks in range along with channel usage. As mentioned the 2.4 GHz band will be very crowded and channels 1, 6, and 11 the most heavily used. The best option is to move the network to the 5 GHz band, but if you stay in the 2.4 GHz band move the network to a non-used channel, but know that interference from adjacent 2.4 GHz channels can still effect performance of the wireless network.

Upgrade to WPA2 Security

If your still using WEP for wireless security it is time to update it to WPA2. WEP was cracked long ago and many utilities to crack WEP are freely available from the internet. When selecting the WPA2 Passphrase don’t use a common dictionary word, your pet’s name, your phone number, keyboard pattern, ect… For the best security a completely random 20 plus character WPA2 passphrase should be used. For further advice on selecting a secure WPA passphrase please read my earlier blog post.

Disable WPS

WiFi Protected Setup (WPS) or push and connect security has a known security flaw and should be disabled in the routers management interface. Even if you’re not using WPS to connect and secure devices to the wireless network it could be enabled by default and needs to be disabled manually.

Change the Passphrase

It is recommended to change personal passwords regularly so include your wireless passphrase to that list and make sure to change it at least once a year. For further advice on selecting a secure WPA passphrase please read my earlier blog post.

Setup a Guest Network

If people come to your house and ask to get on the wireless network it might be time to set up a separate guest network. It is not a good idea to hand out the WPA2 code for the main wireless network to everyone and having the guest network and traffic isolated from the main network is preferred. Many home routers allow multiple networks or enabling the guest network. You can also use a second router for the guest network, but make sure the routers are physically 10 feet apart from each other, and use enough channel separation to eliminate interference. Do assign a simpler WPA2 passphrase on the guest network so you’re not broadcasting an open network that anyone can connect to.

Disable Slower Wireless Protocols

Disabling slower protocols basically disables slower network speeds and can improve performance of the network. If your router and devices support the 802.11n protocol then disabling the 802.11g and 802.11b protocols will keep those devices from connecting and causing the network to communicate at those slower speeds.

Conclusion

So don’t run over to the wireless router with the feather duster or throw it in the dish washer, but if the network seems sluggish or not running as smoothly as it once was there are some things you can do. Check the user’s manual or the router manufactures website for extra help and tips to set up or configure the router. Thanks for reading and post any comments or questions below. I may not be able to answer specific router questions, but I can try to respond with a link or site URL for extra help.

How to Fix the SIOCSIFFLAGS Error in Kali Linux

I recently rebuilt my laptop and reloaded the applications I use for pentesting including Virtualbox and Kali Linux. If you need help setting up Kali Linux in Virtualbox here is a great link that walks through the setup process.

Once I had Kali up and running in my virtual environment I plugged in my ALFA wireless adapter and made sure the USB device was running in the virtual environment.

I ran iwconfig to verify the wireless interface.

iwconfig

So far so good and I ran ifconfig to verify the interface was up, but the only interface returned was the loopback.

loopback

After discovering the wireless interface was not up and I ran ifconfig wlan0 up to bring it up and got the SIOCSIFFLAGS error.

siocsifflags

I wrote about this error a while back when I was running Backtrack 5 and I first started using the Fern WiFi Cracker. I decided to expand on that post plus I was asked about creating a script to run all the commands at one time instead of typing them individually. The script should be run every time Kali is booted, but after your adapter is plugged in and recognized.

First open a text editor and type in the script shown in the screen shot below. I prefer the gedit text editor and since that is not loaded in Kali I used Leafpad and coming from the Windows world it reminds me of Notepad.

script

Name the file and save it to the Root directory.

saveas2

Open the Terminal window and do a quick ls command to verify the file is present.

lscommand

To run the script type ./<file name>

filepremissions

You’ll probably get an error message about permissions denied and running the chmod 755 <file name> command will adjust the permissions on the file as needed.

chmodalfa

Rerun the script ./<file name>

runscript

If there are no errors you are good to go and can run ifconfig to verify the wireless interface is up.

ifconfig

I will run the script every time I boot Kali whether or not the interface shows as being up in the ifconfig results.

Trouble shooting wireless issues in Kali Linux can be a frustrating process, but use your Google Fu skills and you’ll find a lot of good links and people offering up advice. Good Luck!

Changing Your MAC Address Using Macchanger

Macchanger is a free utility used to change the MAC address of the network adapter. Macchanger can randomly assign a MAC address or assign a specific MAC address of your choosing.

Usage

There are several instances changing the MAC address is necessary, but I use the utility while pentesting a wireless network with MAC filtering enabled and have to assign an approved MAC address to the wireless adapter.

Install

The Macchanger utility is included with Kali Linux, but to install the application, update it, or verify your using the most up to date version run the following command. In the screen shot that follows the install command confirms that the newest version is already installed.

#apt-get install macchanger

macchangeinstall

Help

Help with Macchanger can be accessed by running the following two commands.

#macchanger --help

#man macchanger

Assign a Random MAC Address

I’m using an Alfa USB wireless adapter and I will run the following commands to verify the adapters interface and the permanent MAC address.

#ifconfig

#ifconfig wlan1

Macchanger can also be used to verify the manufacture burned in MAC address by running the following command.

#macchanger--show wlan1

Change the MAC address using one of the following commands.

#macchanger -r wlan1

#macchanger -A wlan1

Error Message

If you get an error message the MAC address can’t be changed and the adapter is busy take the adapter down and then rerun Macchanger. (Only the OUI portion of the MAC address is shown in the screen shot and the last 3 octets are blocked out)

adapterbusy

#ifconfig wlan1 down 

#macchanger -A wlan1

changemac

Bring the interface back up and verify the MAC address is changed.

#ifconfig wlan1 up 

#macchanger --show wlan1

changemac2

To return the MAC address to the vendor burned in address run the following command. You may have to take the interface down first.

#ifconfig wlan1 down

#macchanger --permanent wlan1

Assign a Specific MAC Address

The following command will assign a specific MAC address.

#macchanger --mac=aa:bb:cc:11:22:33 wlan1

macspec

Using the Macchanger GUI

If you’re not comfortable running commands there is a Macchanger GUI. A couple of commands will have to be run from the terminal window. One to install the Macchanger GUI application and the second to start the GUI application.

#apt-get install macchanger-gtk

#macchanger-gtk

macchangegtk

After the GUI opens select the options to change the MAC address and click the Change MAC button.

As you can see Macchanger is a great utility to change the MAC address and is simple to use and offers a GUI application as well. Let me know any questions in the comments section below or share any commands you find easier to use with Macchanger, or pass along any other utilities you use to change the MAC address.

Thanks for visiting my blog and happy pentesting!