Hashcat Cheatsheet
Hashcat is a well-known password cracking tool featuring GPU support for cracking a large variety of hashes. The success of a cracking attempt largely depends on the quality of the wordlists and the complexity of the passwords being targeted.
Basic Syntax
hashcat -a <attack_mode> -m <hash_type> <hashes> [wordlist, rule, mask, ...]
| Option | Description |
|---|---|
-a | Attack mode |
-m | Hash type ID |
-r | Rules file |
-o | Output file for cracked hashes |
--show | Show previously cracked hashes |
--force | Ignore warnings |
Attack Modes (-a)
| Mode | Name | Description |
|---|---|---|
0 | Straight/Dictionary | Wordlist-based attack |
1 | Combination | Combines words from two wordlists |
3 | Brute-force/Mask | Uses masks to define keyspace |
6 | Hybrid Wordlist + Mask | Appends mask to wordlist entries |
7 | Hybrid Mask + Wordlist | Prepends mask to wordlist entries |
Common Hash Types (-m)
| ID | Hash Type |
|---|---|
0 | MD5 |
100 | SHA1 |
500 | MD5 Crypt / Cisco-IOS / FreeBSD MD5 |
900 | MD4 |
1000 | NTLM |
1300 | SHA2-224 |
1400 | SHA2-256 |
1700 | SHA2-512 |
1800 | SHA-512 Crypt (Unix) |
3000 | LM |
3200 | bcrypt |
5600 | NetNTLMv2 |
13100 | Kerberos 5 TGS-REP |
18200 | Kerberos 5 AS-REP |
22000 | WPA-PBKDF2-PMKID+EAPOL |
Full list: hashcat --help or hashcat.net/wiki/doku.php?id=example_hashes
Identifying Hash Types
Use hashid to quickly identify the hash type and get the hashcat mode:
hashid -m '$1$FNr44XZC$wQxY6HHLrgrGX0e1195k.1'
Analyzing '$1$FNr44XZC$wQxY6HHLrgrGX0e1195k.1'
[+] MD5 Crypt [Hashcat Mode: 500]
[+] Cisco-IOS(MD5) [Hashcat Mode: 500]
[+] FreeBSD MD5 [Hashcat Mode: 500]
Mask Attack Character Sets
| Symbol | Charset |
|---|---|
?l | abcdefghijklmnopqrstuvwxyz |
?u | ABCDEFGHIJKLMNOPQRSTUVWXYZ |
?d | 0123456789 |
?h | 0123456789abcdef |
?H | 0123456789ABCDEF |
?s | Special characters (space, punctuation) |
?a | ?l?u?d?s (all printable) |
?b | 0x00 - 0xff (all bytes) |
Custom charsets: -1, -2, -3, -4 → Reference with ?1, ?2, ?3, ?4
Quick Reference Commands
Dictionary Attack
hashcat -a 0 -m 0 hash.txt /usr/share/wordlists/rockyou.txt
Dictionary Attack with Rules
hashcat -a 0 -m 0 hash.txt /usr/share/wordlists/rockyou.txt -r /usr/share/hashcat/rules/best64.rule
Mask Attack (8 char: 6 lowercase + 2 digits)
hashcat -a 3 -m 0 hash.txt ?l?l?l?l?l?l?d?d
Mask Attack with Custom Charset
hashcat -a 3 -m 0 hash.txt -1 ?l?u ?1?1?1?1?d?d?d?d
Hybrid Attack (wordlist + mask)
hashcat -a 6 -m 0 hash.txt /usr/share/wordlists/rockyou.txt ?d?d?d
Show Cracked Hashes
hashcat -m 0 hash.txt --show
Identify Hash Type
hashid -m '<hash_string>'
Common Rule Files
| Rule File | Description |
|---|---|
best64.rule | 64 standard password modifications |
rockyou-30000.rule | Large ruleset based on rockyou patterns |
dive.rule | Comprehensive rule set |
d3ad0ne.rule | Popular community ruleset |
leetspeak.rule | Leet speak substitutions |
toggles1-5.rule | Case toggling rules |
Location: /usr/share/hashcat/rules/
Useful Options
| Option | Description |
|---|---|
--status | Enable automatic status updates |
--status-timer=N | Set status update interval (seconds) |
-w 3 | Workload profile (1=low, 2=default, 3=high, 4=nightmare) |
--increment | Enable mask increment mode |
--increment-min=N | Start mask length |
--increment-max=N | End mask length |
-O | Enable optimized kernels (faster, but limits password length) |
--username | Ignore username in hash file |
--potfile-disable | Don’t write to potfile |
Cracking Protected Files & Archives
Common Hash Modes for Files
| ID | Type |
|---|---|
9400-9600 | MS Office 2007-2013 |
10400-10700 | |
13600 | WinZip |
17200-17225 | PKZIP |
22100 | BitLocker |
13400 | KeePass |
6211-6243 | TrueCrypt |
13711-13723 | VeraCrypt |
Crack BitLocker Drive
# Extract hash with bitlocker2john (from JtR)
bitlocker2john -i Backup.vhd > backup.hashes
grep "bitlocker\$0" backup.hashes > backup.hash
# Crack with hashcat
hashcat -a 0 -m 22100 backup.hash /usr/share/wordlists/rockyou.txt
The script outputs four hashes: the first two are for the BitLocker password, the latter two for the recovery key. Focus on the password hash ($bitlocker$0$...).
Crack ZIP File (PKZIP)
# Extract hash with zip2john (from JtR)
zip2john protected.zip > zip.hash
# Crack with hashcat (mode depends on ZIP type)
hashcat -a 0 -m 17200 zip.hash /usr/share/wordlists/rockyou.txt
Crack MS Office Document
# Extract hash with office2john (from JtR)
office2john.py document.docx > office.hash
# Crack with hashcat (mode depends on Office version)
hashcat -a 0 -m 9600 office.hash /usr/share/wordlists/rockyou.txt
Crack PDF
# Extract hash with pdf2john (from JtR)
pdf2john.py document.pdf > pdf.hash
# Crack with hashcat
hashcat -a 0 -m 10500 pdf.hash /usr/share/wordlists/rockyou.txt
Crack KeePass Database
# Extract hash with keepass2john (from JtR)
keepass2john database.kdbx > keepass.hash
# Crack with hashcat
hashcat -a 0 -m 13400 keepass.hash /usr/share/wordlists/rockyou.txt
Hunting for Encrypted Files
Find common encrypted file types
for ext in $(echo ".xls .xls* .xltx .od* .doc .doc* .pdf .pot .pot* .pp*"); do
echo -e "\nFile extension: " $ext
find / -name *$ext 2>/dev/null | grep -v "lib\|fonts\|share\|core"
done
Find SSH private keys
grep -rnE '^\-{5}BEGIN [A-Z0-9]+ PRIVATE KEY\-{5}$' /* 2>/dev/null
Check if SSH key is encrypted
ssh-keygen -yf ~/.ssh/id_rsa
# If encrypted, prompts for passphrase
Note: SSH keys are typically cracked with John the Ripper using ssh2john.py, as hashcat doesn’t have a direct mode for SSH private keys.
Crack OpenSSL Encrypted GZIP
Identify the file type:
file GZIP.gzip
# GZIP.gzip: openssl enc'd data with salted password
Brute-force with a loop (errors expected, file extracts on success):
for i in $(cat rockyou.txt); do
openssl enc -aes-256-cbc -d -in GZIP.gzip -k $i 2>/dev/null | tar xz
done