Hashcat

Cracking Miscellaneous Files & Hashes

  • The password cracking tool JohnTheRipper help us extract the password hashes from files etc, can be viewed herearrow-up-right.

Staphy$ sudo git clone https://github.com/magnumripper/JohnTheRipper.git
Staphy$ cd JohnTheRipper/src
Staphy$ sudo she./configure && make

There are also Python ports of most of these tools available that are very easy to work with. The majority of them are contained in the JohnTheRipper jumbo GitHub repo herearrow-up-right.

One additional tool ported to Python is keepass2john.pyarrow-up-right tool for extracting a crackable hashes.

  • Hashcat can be used to attempt to crack password hashes extracted from some Microsoft Office documents using the office2john.pyarrow-up-right tool.

Staphy$ python office2john.py file.docx 

Hashcat - Cracking MS Office Passwords

Staph$ hashcat -m 9600 file_hash /opt/useful/SecLists/Passwords/Leaked-Databases/rockyou.txt

Cracking Password Protected Zip Files

we may find an interesting zip file password protected! We can extract these hashes using the compiled version of the zip2johnarrow-up-right tool.

Extract Hash

Hashcat - Cracking ZIP Files

Cracking Password Protected KeePass Files

We can use keepass2john.py to extract the hash:

Cracking Protected PDF Files

We can extract the hash of the passphrase using pdf2john.pyarrow-up-right. The following command will extract the hash into a format that Hashcat can use.

Extract Hash

  • Cracking Wireless (WPA and WPA2) Handshakes with Hashcat

Cracking MIC

To perform this type of offline cracking attack, we need to capture a valid 4-way handshake, by sending de-authentication frames to force a client (user) to disconnect from an AP. When the client reauthenticates (usually automatically), the attacker can attempt to sniff out the WPA 4-way handshake without their knowledge.

Once we have successfully captured a 4-way handshake with a tool such as airodump-ngarrow-up-right, we need to convert it to a format that can be supplied to Hashcat for cracking, he format required is hccapxand Hashcat hosts an online service to convert to this format (not recommended for actual client data but fine for lab/practice exercises): https://hashcat.net/cap2hccapxarrow-up-right. To perform the conversion offline, we need the hashcat-utils repo from GitHub.

Hashcat-Utils - Installation

Cap2hccapx - Convert To Crackable File

Hashcat - Cracking WPA Handshakes

Cracking PMKID

This attack can be performed against wireless networks that use WPA/WPA2-PSK (pre-shared key) and allows us to obtain the PSK being used by the targeted wireless network by attacking the AP directly. The attack does not require deauthentication (deauth) of any users from the target AP. The PMK is the same as in the MIC (4-way handshake) attack but can generally be obtained faster and without interrupting any users.

Hcxtools - Installation

To perform PMKID cracking, we need to obtain the pmkid hash. The first step is extracting it from the capture (.cap) file using the tool hcxpcaptool from the hcxtools GitHub repo.

We may run into compilation errors which can be solved as follows:

Missing Dependency - openssl/sha.h

Installation of Dependencies

Installation of Dependencies

Missing Dependency - curl/curl.h

Missing Dependency - curl/curl.h

Installation of Dependencies

Extract PMKID

There is as Change in Hash mode Hashcat 16800 So what are the benefits of hash mode 22000?

For users who don't want to struggle with compiling hcxtools from sources there is an online converter: https://hashcat.net/cap2hashcat/arrow-up-right

If you choose the online converter, you may need to remove some data from your dump file if the file size is too large. Most of the time, this happens when data traffic is also being recorded.

For more information Visit this thread in Hashcat site (https://hashcat.net/forum/thread-10253.htmlarrow-up-right).

Optimization

  • Optimized Kernels: This is the -O flag, which according to the documentation, means Enable optimized kernels (limits password length). The magical password length number is generally 32, with most wordlists won't even hit that number. This can take the estimated time from days to hours, so it is always recommended to run with -O first and then rerun after without the -O if your GPU is idle.

  • Workload: This is the -w flag, which, according to the documentation, means Enable a specific workload profile. The default number is 2, but if you want to use your computer while Hashcat is running, set this to 1. If you plan on the computer only running Hashcat, this can be set to 3.

Mask Attack

Hybrid Mode

  • Hybrid mode is a variation of the combinator attack, wherein multiple modes can be used together for a fine-tuned wordlist creation.

Mode 6 to append mask.

Mode 7 to prepend mask.

Creating Wordlists

Tools :

Rules

  • The rule-basedarrow-up-right attack is one of the most complicated of all the attack modes. The reason for this is very simple. The rule-based attack is like a programming language designed for password candidate generation. It has functions to modify, cut or extend words and has conditional operators to skip some, etc. That makes it the most flexible, accurate and efficient attack.

Hashcat debugging Rules

Hashcat - Cracking Passwords Using Wordlists and Rule

Hashcat - Default Rules

Hashcat provides an option to generate random rules on the fly and apply them to the input wordlist. The following command will generate 1000 random rules and apply them to each word from rockyou.txt by specifying the "-g" flag. There is no certainty to the success rate of this attack as the generated rules are not constant

There are a variety of publicly available rules as well, such as the nsa-rulesarrow-up-right, Hob0Rulesarrow-up-right, and the corporate.rulearrow-up-right which is featured in the book How to Hack Like a Legendarrow-up-right. These are curated rulesets generally targeted at common corporate Windows password policies or based on statistics and probably industry password patterns.

Last updated