This article is for educational purposes only. WiFi penetration
testing should only be performed on networks you own or have explicit written
authorization to test.
If you found this useful, consider giving my article a LIKE
before the police take you away.
In this article, we will explore the process of WiFi penetration testing mainly
using the Aircrack-ng and Hashcat suite of tools to capture a 4-way handshake
and infiltrate a WiFi network. In real-life you would need to gain access to the
network first to implement further exploits such as WiFi phishing, fake access
points, and more.
Process:
Capture the 4-way handshake using Airmon-ng and Airodump-ng
Crack the password offline using Aircrack-ng and Hashcat
Infiltrate the network with found WiFi password
I may use the following terms interchangeably:
AP = Access Point = Network = (the WiFi router in non-technical terms)
BSSID = Basic Service Set Identifier = MAC address of the Access Point
SSID = Service Set Identifier = Network name
Understanding WiFi Security Protocols
WPS: The Obsolete Protocol (~2006-2015)
WiFi Protected Setup (WPS) was designed for convenience but introduced critical
vulnerabilities. An 8-digit PIN is used for quick access between devices on the
same network. The 8-digit PIN can be easily brute-forced, making it obsolete for
secure networks.
Tools: Aircrack-ng, Reaver
Countermeasure: Disable WPS on all access points.
While WPS is rarely used today, always scan
for it during reconnaissance. Legacy networks may still have it enabled.
WPA2: The Current Standard (~2007-present)
WPA2 remains the most common protocol in most WiFi networks today.
The attack vector we will discuss is on capturing the 4-way
handshake during authentication for WPA2.
WPA3: The Future
WPA3 offers improved security but can be vulnerable to downgrade attacks,
forcing networks back to WPA2.
Where WPA3 is better than WPA2:
Each device connected to the network has a unique key; WPA2 uses the same key
for all devices
Advanced encryption standard AES in Galois/Counter Mode (GCM) as opposed to
AES-CCMP
Hardware Requirements
Most built-in WiFi adapters cannot perform
packet injection or enter monitor mode. External adapters are required.
Regular WiFi cards typically operate in Managed Mode, capturing only packets
destined for your MAC address. Penetration testing requires Monitor Mode,
which captures all wireless traffic.
Examples:
Ralink RT5370 WiFi USB Adapter
Alfa AWUS036ACHM 802.11ac WiFi USB Adapter
Adapter Driver Installation
The driver installation may be different for your adapter.
Please refer to the adapter's documentation for the correct installation steps.
Download driver.
Bash
1git clone https://github.com/lwfinger/rtw88
2cd rtw88
3make4sudomakeinstall56# Disable Secure Boot if driver does not load on reboot7# Verify installation8ip a # Should show: localhost, existing WiFi, and ALFA adapter9
This command channel-hops between channels 1-14 (802.11b/g) to discover access
points.
Key Fields:
BSSID: MAC address of the access point unique to the AP.
PWR: Signal strength.
Beacons: Number of beacon frames (indicates signal quality)
ENC: Encryption type (OPN, WEP, WPA, WPA2)
ESSID: Network name
Parse the CSV output for specific targets.
Bash
1head output/scan-01.csv
2cat output/scan-01.csv |grep"NAME OF NETWORK"3
Parse the CSV output for specific targets. hosted withby Xavier
Step 4: Lock Onto Target AP
Channel hopping with airodump-ng is only useful for finding APs. To focus on a
specific AP, you need to use the --bssid flag.
Learning Resource
From experience, you should keep your digital footprint minimal.
Don't leave a trail of data behind you. Passive listening is low risk but your
risk increases dramatically if you are actively sending packets. Focus on
specific targets to keep your digital footprint minimal and save your time.
Once you have identified your target, focus on it specifically:
Focus on single access point. hosted withby Xavier
Capturing the Handshake
This is the hardest and trickiest part in the field because being close enough
to the AP to capture the handshake is difficult. You will need to wait until a
client device deauths then reauths to the AP.
Deauthentication attacks are detectable. Many
networks employ Intrusion Detection Systems (IDS) that monitor for excessive
deauth packets. Use with caution and only when necessary.
There are ways to capture the handshake without forcing deauthentication.
Understanding Deauthentication
Deauth packets are the formal way devices disconnect from access points.
However, they are not always sent:
Actions that send deauth:
Enabling airplane mode
Closing a laptop and laptop enters sleep mode
Shutting down a device
Actions that do not:
Walking out of range
Sudden power loss
The Stealthy Approach
If you show up to a coffee shop trying to hack their WiFi network dressed like this, you will go to jail.
Best practice: Don't force deauthentication at all. Wait for natural
reauthentication events:
People arriving and opening laptops
Devices reconnecting after being away
Natural network activity in busy locations
This maintains stealth and leaves minimal trace.
Forced Deauthentication (When Necessary)
Forced deauthentication is detectable. Many
networks employ Intrusion Detection Systems (IDS) that monitor for excessive
deauth packets. Please give my blog a LIKE before the police come to your door.
Bash
1# Target specific client device2# Find connected clients in the bottom section of airodump-ng output34sudo aireplay-ng --deauth 10 -a <BSSID> -c <CLIENT_MAC>$NETWORK_INTERFACE56# Example:7sudo aireplay-ng --deauth 10 -a AA:BB:CC:DD:EE:FF -c 11:22:33:44:55:66 $NETWORK_INTERFACE8