Module 8: Cracking Authentication Hashes
Aircrack-ng Suite
Using airodump-ng to gather the channel and BSSID we want to attack so we can limit our capture:
kali@kali:~$ sudo airodump-ng wlan0mon
...
CH 2 ][ Elapsed: 30 s ][ 2020-02-29 13:28 ][
BSSID PWR Beacons #Data, #/s CH MB ENC CIPHER AUTH ESSID
C8:BC:C8:FE:D9:65 -23 579 69 1 2 54e. WPA2 CCMP PSK secnet
34:08:04:09:3D:38 -30 638 24 0 3 54e. WPA2 CCMP PSK wifu
00:18:E7:ED:E9:69 -84 104 0 0 3 54e. OPN dlink
BSSID STATION PWR Rate Lost Packets Probes
C8:BC:C8:FE:D9:65 0C:60:76:57:49:3F -69 0 - 1 0 35 secnet
34:08:04:09:3D:38 00:18:4D:1D:A8:1F -26 54 -54 0 31 wifu
30:46:9A:FE:79:B7 30:46:9A:FE:69:BE -73 0 - 1 0 1We want to target ESSID wifu on channel 3 with BSSID 34:08:04:09:3D:38, writing to a file with a "wpa" prefix:
Using aireplay-ng with -0 1 to deauthenticate once, -a to target our BSSID, and -c to identify the associate client:
Capturing the handshake:
It's not a bad idea to leave the traffic capture running. The additional data will assist in confirming the key is correct later on.
Using aircrack-ng against our recently created capture file, wpa-01.cap, specifying the path to our wordlist, the ESSID, and the BSSID:
Confirming our key is correct by decrypting the traffic with airdecap-ng:
We could have also used Wireshark, adding the passphrase for decryption.
Custom Wordlists with Aircrack-ng
Using Aircrack-ng with John the Ripper
Just describing JtR.
Editing John the Ripper Rules
JtR mangling rules are located in /etc/john/john.conf.
Testing our rules by running JtR in wordlist mode and sending stdout as input to grep:
Using Aircrack-ng with JTR
Piping JtR into aircrack-ng:
Using Arcrack-ng with Crunch
Crunch is an easy-to-use password generator and can interact with aircrack-ng in the same was as JtR did. It only requires specifying the first two parameters, the minimum and maximum length of the password:
Limiting Crunch's generation to certain characters:
Crunch also allows us to specify a pattern with the -t option with or without a character set. Different symbols in the pattern define the type of character to use.
@ represents lowercase characters or characters from a defined set
, represents uppercase characters
% represent numbers
^ represents symbols
Generating a wordlist to crack our WPA 4-way handshake:
Another way to generate it using specified characters:
Using the -p option to generate unique words from a character set. Min/maximum length still required but is ignored, hence the 1 1:
Generating a list of unique words from multiple values:
Refining our wordlist more with -t and -p:
Because there's very little value in storing all these generated passwords on disk, we can pipe it directly into aircrack-ng:
Using Aircrack-ng with RSMangler
RSMangler is a Ruby script that takes words as input and modifies them in multiple ways.
Using RSMangler with a wordlist, sending to aircrack-ng:
Hashcat
OpenCL for GPUs
GPU go brrrrr.
Device Properties
Using hashcat to display device information:
It is not recommended to use hashcat for cracking when only the portable OpenCL is available, as it is very slow. Use aircrack-ng instead. Portable OpenCL is 4 to 15 times slower than aircrack-ng depending on the CPU used. On the other hand, the Intel OpenCL has similar speed compared to aircrack-ng.
We do not recommend running hashcat with a device using the portable OpenCL (pocl), as it is known to be buggy. Although hashcat may list the portable OpenCL in the devices list, it will skip it when other OpenCL runtimes are available.
Hashcat Benchmark
Hashcat provides a benchmarking option with -b. Benchmarking with the 2500 hash mode:
Benchmarking with the 22000 hash mode:
Hashcat Utilities
Hashcat provies more than two dozen small utilities useful for password cracking. They're not installed by default but are available through the hashcat-utils package.
After install, these can be found at /usr/lib/hashcat-utils. One specifically relevant for our purposes is cap2hccapx. This exports WPA handshakes from PCAP files to HCCAPx, a format used by the 2500 hash mode in hashcat for WPA/WPA2 handshakes.
Converting PCAP to hccapx for hashcat:
Passphrase Cracking with Hashcat
Using the WPA hash mode, we will crack the file generated by cap2hccapx with the JtR default wordlist. Hash mode 2500 is depcrecated, thus we must use --deprecated-check-disable:
The reason that we can not use cap2hccapx with the 22000 hash mode is that when we used cap2hccapx.bin to create our output.hccapx file, it creates a binary format file. This binary format does not work with the new 22000 hash mode.
To use the 22000 mode we need to convert our wifi-01.cap file to the correct format. There are two ways to do this. The first method is to take our file and upload it to https://hashcat.net/cat2hashcat.
The second method is to use the application hcxtools.
Using Hcxpcapngtool to convert the file:
Using hashcat to crack our newly converted file:
A potfile is created with our cracked passphrases (unless we specify --potfile-disable) which is located at ~/.hashcat/hashcat.potfile. A different path can be specified with --potfile-path.
Airolib-ng
Using Airolib-ng
To use airolib-ng, we first need a text file containing the ESSID of our target AP:
Next, we import this file into the airolib-ng database:
Import our wordlist(s) to the database:
Ignored entries are because WPA passwords are between 8 and 63 characters long.
Make airolib-ng batch process all the PMKs:
Rather than using a wordlist with aircrack-ng, we can choose to pass our database:
As shown, using PMKs go much quicker than trying to crack the PSK.
coWPAtty
Rainbow Table Mode
The main purpose of coWPAtty is to use pre-computed hashes, similar to airolib-ng.
An important point to keep in mind when using pre-computed hashes is that they need to be generated for each unique ESSID. The ESSID is combined with the WPA pre-shared key to create the hash. This means that the hashes for the ESSID of "wifu" will not be the same as those for "linksys" or "dlink".
Creating pre-computed hash tables using genpmk:
Using pre-computed hashtables with coWPAtty:
Last updated