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        1

We 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.

Some wireless drivers ignore directed deauthentication and only respond to broadcast deauthentication. We can run the same aireplay-ng deauthentication command without the -c parameter.

If 802.11w is in use, unencrypted deauthentication frames are ignored. The only course of action is to wait for a client to connect.

Using aircrack-ng against our recently created capture file, wpa-01.cap, specifying the path to our wordlist, the ESSID, and the BSSID:

Without both -e and -b parameters, aircrack-ng normally prompts to choose a network to crack. In this case, since there is only one network, aircrack-ng automatically chooses our target.

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:

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:

aircrack-ng can also use .hccapx files as input for cracking.

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.

Creating pre-computed hash tables using genpmk:

Using pre-computed hashtables with coWPAtty:

Last updated