Chapter 3: Bypassing WLAN Authentication
Author: Vivek Ramachandran, Cameron Buchanan Translator: éŁéŸ License: CC BY-NC-SA 4.0 Keyword: WLAN authentication
Introduction
The illusion of security is worse than insecurity. â Anonymous
The illusion of security is worse than insecurity because you cannot prepare for the possibility of being hacked.
WLAN authentication modes may be weak and can be cracked and bypassed. In this chapter, we will examine some of the basic authentication modes used in WLANs and learn how to crack them.
3.1 Hidden SSID
In default configuration mode, all access points send their SSID in the beacon frames. This allows nearby clients to easily discover them. A hidden SSID is a configuration option where the access point does not broadcast its SSID in the beacon frames. Thus, only clients that know the SSID of the access point can connect to it.
Unfortunately, this method does not provide reliable security, but network administrators consider it secure. A hidden SSID should not be viewed as a security measure. Letâs now see how to discover hidden SSIDs.
Practice Time â Discovering Hidden SSIDs
Follow the guidelines below to get started:
- Using Wireshark, if we monitor the beacon frames in the
Wireless Lab
network, we can view the SSID in plaintext. You should see beacon frames like this: - Configure your access point to hide the
Wireless Lab
networkâs SSID. This configuration may vary across different access points. Here, I need to check theVisibility Status
option for theInvisible
option, like this: - Now, if you check Wiresharkâs logs, youâll find that the SSID of
Wireless Lab
has disappeared from the beacon frames. This is what hiding the SSID does: - To bypass this in beacon frames, we first use passive techniques to wait for normal clients to connect to the access point. This generates probe requests and responses containing the networkâs SSID, thus revealing its existence.
- Alternatively, you can use
aireplay-ng
to send deauthentication packets to all routers representing theWireless Lab
access point by entering:aireplay-ng -0 5 -a --ignore-negative mon0
, where is the routerâs MAC address. The-0
option is used to select the deauthentication attack,5
is the number of packets to transmit. Lastly,-a
specifies the MAC address of the targeted access point. - The deauthentication process will force all normal clients to disconnect and reconnect. Adding a filter to the deauthentication packets to view them individually is a good idea.
- The probe responses from the access point will eventually reveal the SSID. These packets will appear in Wireshark. Once normal clients reconnect, we can view the hidden SSID through probe request and response frames. You can use the filter
(wlan.bssid == 00:21:91:d2:8e:25) && !(wlan.fc.type_subtype == 0x08)
to monitor all non-beacon packets to or from the access point. The&&
symbol represents a logical AND operator, while the!
symbol represents a logical NOT operator:
What Just Happened?
Even though the SSID is hidden and not broadcast, when normal clients attempt to connect to the access point, they exchange probe request and response packets. These packets contain the SSID of the access point. Since these packets are not encrypted, they can be easily sniffed to discover the SSID.
We will involve probe requests in later chapters, for other purposes, such as tracking.
In many cases, all clients may have already connected to the access point, and there may be no probe request or response packets in the Wireshark logs. Here, we can force clients to disconnect from the access point by sending fake deauthentication packets. These packets will force the clients to reconnect to the access point, thus capturing the SSID.
Try It â Selective Deauthentication
In the previous exercise, we broadcast deauthentication packets to force all wireless clients to reconnect. Try verifying how to use the aireplay-ng
tool to perform it selectively on a specific client.
Note that while we demonstrated many concepts using Wireshark, other tools can also perform the attack, such as the aircrack-ng
suite. We recommend exploring the entire aircrack-NG suite and other documentation on the main site: http://www.aircrack-ng.org
.
3.2 MAC Filtering
MAC filtering is an old trick rooted in wired networks for authentication and authorization. Unfortunately, in the wireless world, they fall apart significantly.
The basic idea is authentication based on the clientâs MAC address. A MAC filter is a piece of identifying code assigned to network interfaces, which routers can check against a list of allowed MAC addresses. The list of allowed MAC addresses is maintained by the network administrator and stored on the access point. Letâs now see how easy it is to bypass a MAC filter.
Practice Time â Bypassing MAC Filters
Letâs follow the guidelines below to get started:
- Letâs first configure our access point to use MAC filtering and then add the victim laptopâs client MAC address. On my router, the settings page looks like this:
- Once MAC filtering is enabled, only the allowed MAC addresses can be successfully authenticated by the access point. If we attempt to connect from a machine not on the MAC address whitelist, it will fail.
- Behind this scenario, the access point sends an authentication failure message to the client. The packet capture looks like this:
- To bypass the MAC filter, we can use
airodump-ng
to find the MAC addresses of clients connected to the access point. We can do this by entering theairodump-ng -c 11 -a --bssid mon0
command. By specifying thebssid
command, we monitor only the access point that we are interested in. The-c 11
command sets the channel the access point is on to11
. The-a
command ensures that only relevant clients, and connections to the access point, appear in the outputâs client section. This will show us all clients associated with the access point and its corresponding MAC addresses. - Once weâve found a client MAC address on the whitelist, we can use the tool
macchanger
to change the clientâs MAC address. Kali has this tool by default. You can complete this by using themacchanger âm wlan0
command. The MAC address you specify with the-m
command is the new MAC address for yourwlan0
interface. - You can see that after changing the MAC address to match the whitelist client, we can now connect to the access point.
What Just Happened?
We monitored the airwaves using airodump-ng
to find a MAC address of a legitimate user connected to the wireless network. We then used the macchanger
tool to change our wireless cardâs MAC address to match the client. This tricks the access point into thinking we are a legitimate client, allowing us access to its wireless network.
We encourage you to explore the different options of the airodump-NG
tool by accessing the main siteâs documentation: http://www.aircrack-ng.org/doku.php?id=airodump-ng
.
3.3 Open Authentication
The term âopen authenticationâ is a misnomer because it actually does not offer any authentication. When the access point is configured to use open authentication, all clients that connect to it can be successfully authenticated.
We will now use open authentication to gain authentication and connect to the access point.
Practice Time â Bypassing Open Authentication
Letâs now see how we can bypass open authentication.
- We will first set our
Wireless Lab
access point to open authentication. On my access point, this can be easily done by setting theSecurity Mode
toDisable Security
. - We then use the
iwconfig wlan0 essid Wireless Lab
command to connect to this access point and verify if our connection to the access point was successful. - Note that we did not provide any username/password to connect via open authentication.
What Just Happened?
This was likely the simplest exercise so far. You can see that there was no barrier to connecting to an open authentication network and establishing a connection to the access point.
Shared key authentication uses a shared key, such as WEP, to authenticate clients. The exchange of information is shown in this diagram:
A wireless client sends an authentication request to the access point, which replies with a challenge. The client now needs to encrypt this challenge using the shared key and send it back to the access point. The access point then decrypts it to check if it can restore the original challenge text. If successful, the client is authenticated; if not, it sends an authentication failure message.
The security flaw here is that an attacker can passively listen to the entire communication and gain access to the plaintext and encrypted text of the challenge by sniffing the air. They can use XOR operations to obtain the keystream. This keystream can then be used to encrypt any future challenges sent by the access point without knowing the actual key.
The common form of this shared authentication is WEP, or Wired Equivalent Privacy. Itâs easy to crack and is aided by countless tools that make breaking into WEP networks easy.
In this exercise, we will understand how to sniff the airwaves to capture both the plaintext and the encrypted challenge, obtain the keystream, and use it to authenticate to the access point without needing the shared key.
Bypassing shared key authentication is more challenging than the previous exercises, so follow the steps closely:
- Letâs first set up shared key authentication for our
Wireless Lab
network. We have done so on my access point by setting the security mode to WEP and authentication toShared Key
. - We now connect a legitimate client to this network using the shared key we set in step one.
- To bypass shared key authentication, we need to sniff the packets exchanged between the access point and clients. However, we also need to capture the entire shared key exchange. To do this, weâll use the
airodump-ng
tool with the commandairodump-ng mon0 -c 11 --bssid -w keystream
. The-w
option specifies that Airodump-NG should store information in files prefixed bykeystream
. Itâs a good idea to store different packet capture sessions in different files. This allows you to analyze them even after a long time. - We can either wait for a normal client to connect to the access point or use the deauthentication technique weâve used before to force a reconnection. Once the client connects and succeeds in shared key authentication,
airodump-ng
will automatically capture this change by sniffing the air. When theAUTH
column showsWEP
, it indicates successful capture. - The captured keystreams are stored in files prefixed by
keystream
in the current directory. In my case, the file is namedkeystream-01-00-21-91-D2-8E-25.xor
. - To forge shared key authentication, we use the
aireplay-ng
tool. We execute the commandaireplay-ng -1 0 -e "Wireless Lab" -y keystream-01-00-21-91-D2-8E-25.xor -a -h AA:AA:AA:AA:AA:AA mon0
. Thisaireplay-ng
command uses the keystream we obtained earlier and attempts authentication with the SSIDWireless Lab
for the access point with MAC address00:21:91:D2:8E:25
. Start Wireshark and use the filterwlan.addr == AA:AA:AA:AA:AA:AA
to sniff all packets of interest. We can verify it using Wireshark. You should see logs in the Wireshark interface like this: - The first packet is the authentication request sent from
aireplay-ng
to the access point: - The second packet consists of the challenge text sent from the access point to the client, like this:
- The third packet is where this tool sends the encrypted challenge text back to the access point.
- Since the
aireplay-ng
tool uses the exported keystream for encryption, the authentication is successful, and the access point sends a success message in the fourth packet. - After authentication success, this tool forges association with the access point, like this:
- If you check your access point management interfaceâs wireless logs, you will see a client with MAC address
AA:AA:AA:AA:AA:AA
establishes a connection.
What Just Happened?
We successfully exported the keystream from the shared key authentication exchange and used it to impersonate the access point for authentication.
Try It â Overflowing Access Pointâs Tables
An access point has a limited number of clients it can accommodate, beyond which it will reject additional connections. By writing a small wrapper for aireplay-ng
, we can automatically send hundreds of connection requests from random MAC addresses to the access point. This will overflow the routerâs internal tables, and once the maximum number of clients is reached, the access point will stop accepting new connections. This is often referred to as a denial of service (DoS) tool and can force the router to reboot or make it non-functional. It can also result in all wireless clients losing connectivity and being unable to use the authenticated network.
Quiz â WLAN Authentication
Q1 How do you force wireless clients to reconnect to an access point?
- Send a deauthentication packet
- Restart the client
- Restart the access point
- All of the above
Q2 What does open authentication do?
- Provides adequate security
- Does not provide any authentication
- Requires encryption
- None of the above
Q3 How do you crack shared key authentication?
- Export the keystream from packets
- Export the encryption key
- Send a deauthentication packet to the access point
- Restart the access point
Summary
In this chapter, we explored WLAN authentication. Hidden SSIDs act as âsecurity through obscurityâ strategy and are easily cracked. MAC address filtering does not provide any security, as they can be sniffed from wireless packets with unencrypted MAC addresses. Open authentication does not provide any actual authentication. Cracking shared key authentication is more involved, but with the right tools, we can export and store the keystream, which we can use to respond to all future challenges sent by the access point, ultimately gaining authentication without knowing the actual key.
In the next chapter, we will look into the different WLAN encryption mechanisms â WEP, WPA, and WPA2 â and examine their insecurities.