Hashcat Guide: GPU-Accelerated Password Recovery
Learn to use Hashcat for GPU-accelerated password recovery including attack modes, rule-based attacks, mask attacks, and performance optimization.
The GPU That Cracks Billions of Passwords Per Second
When security researchers audited Ashley Madison's breached database in 2015, they turned to a tool that could test billions of password combinations per second using off-the-shelf graphics cards. Hashcat — running on a single GPU — cracked millions of bcrypt-hashed passwords in days, demonstrating that even "secure" hashing falls to dedicated hardware when the attacker controls the cracking rig.
Hashcat is the world's fastest password recovery tool, leveraging GPU acceleration to achieve billions of hash calculations per second. It supports over 300 hash types across multiple attack modes.
Prerequisites
Before studying Hashcat, you should understand:
Installation
# Hashcat is pre-installed in GO KALI
hashcat --help
# Check GPU availability
hashcat -I
# Manual installation
sudo apt install hashcat
# Or download latest version
wget https://github.com/hashcat/hashcat/releases/latest/download/hashcat-x.x.x.7z
7z x hashcat-x.x.x.7z
Hashcat Attack Modes
Dictionary Attack (-a 0)
The most common mode. Test each word from a wordlist against the hash:
hashcat -m 0 -a 0 hashes.txt /usr/share/wordlists/rockyou.txt
# -m 0 = MD5 hash mode
# -a 0 = Dictionary attack
# hashes.txt = File containing target hashes
# rockyou.txt = Wordlist
Combinator Attack (-a 1)
Combine words from two wordlists:
hashcat -m 1000 -a 1 ntlm_hashes.txt words1.txt words2.txt
Mask Attack (-a 3)
Brute force using character masks for specific positions:
hashcat -m 0 -a 3 hashes.txt ?l?l?l?l?l?l?d?d
# ?l = lowercase letter
# ?u = uppercase letter
# ?d = digit
# ?s = special character
# ?a = all characters
# ?h = hex digit (lowercase)
# ?H = hex digit (uppercase)
Hybrid Attack (-a 6 and -a 7)
Combine dictionary + mask:
# Word + mask suffix (-a 6)
hashcat -m 0 -a 6 hashes.txt wordlist.txt ?d?d?d
# Mask + word prefix (-a 7)
hashcat -m 0 -a 7 hashes.txt ?d?d?d wordlist.txt
Hash Modes
Common hash modes in Hashcat:
| Mode | Hash Type |
|------|-----------|
| 0 | MD5 |
| 100 | SHA1 |
| 1400 | SHA256 |
| 1700 | SHA512 |
| 1000 | NTLM |
| 3200 | bcrypt |
| 5500 | NetNTLMv1 |
| 5600 | NetNTLMv2 |
| 13100 | Kerberos 5 TGS-REP |
| 18200 | Kerberos 5 AS-REP |
| 2500 | WPA/WPA2 |
| 22000 | WPA-PBKDF2-PMKID+EAPOL |
Rule-Based Attacks
Rules modify words from a wordlist to try variations:
# Basic rule usage
hashcat -m 0 -a 0 hashes.txt wordlist.txt -r /usr/share/hashcat/rules/best64.rule
# Multiple rules
hashcat -m 0 -a 0 hashes.txt wordlist.txt -r rule1.rule -r rule2.rule
# Built-in rules
ls /usr/share/hashcat/rules/
# best64.rule — 64 most effective rules
# d3ad0ne.rule — Extensive rule set
# T0XlC-insert_00-99.rule — Number insertion
# T0XlC-insert_space_and_special_00-99.rule
# rockyou-30000.rule — 30000 rules from rockyou analysis
Creating Custom Rules
# Rule syntax examples
# $ = append
# ^ = prepend
# s = substitute
# r = reverse
# Append a digit
$0 $1 $2
# Capitalize first letter
c
# Toggle case
T0 T1 T2 T3
# Substitute characters
s@a # Replace @ with a
s0o s1i s3e # Leet speak substitutions
# Example rules file (leet.rule):
:
c
c$0$0$0
c$0$0$1
s@a
s@a s0o
s@a s0o s$s
Performance Optimization
Device Selection
# List available devices
hashcat -I
# Use specific device
hashcat -m 0 -a 0 hashes.txt wordlist.txt -d 1
# Use multiple GPUs
hashcat -m 0 -a 0 hashes.txt wordlist.txt -d 1,2
Workload Profile
# Workload profiles (-w):
# 1 = Low (desktop usable)
# 2 = Default
# 3 = High (desktop slow)
# 4 = Nightmare (desktop unusable)
hashcat -m 0 -a 0 hashes.txt wordlist.txt -w 3
Session Management
# Restore session after interrupt
hashcat -m 0 -a 0 hashes.txt wordlist.txt --session my_session
# Continue from previous session
hashcat --restore --session my_session
# Show current progress
hashcat --status --session my_session
Optimized Kernels
# Enable optimized kernels (for short passwords)
hashcat -m 0 -a 3 hashes.txt ?a?a?a?a?a?a?a?a -O
# --optimized-kernel -O
# Limits password length but significantly increases speed
Potfile Management
Hashcat stores cracked passwords in the potfile:
# Default potfile location
~/.local/share/hashcat/hashcat.potfile
# Show cracked hashes
hashcat --show hashes.txt
# Show only remaining hashes
hashcat --left hashes.txt
# Use custom potfile
hashcat -m 0 hashes.txt wordlist.txt --potfile-path ./custom.pot
Real-World Scenarios
Auditing NTLM Hashes
# Extract NTLM hashes from Windows SAM (requires admin)
reg save hklmsam sam.save
reg save hklmsecurity security.save
reg save hklmsystem system.save
# Dump hashes with secretsdump.py or samdump2
secretsdump.py -sam sam.save -system system.save LOCAL
# Crack NTLM hashes
hashcat -m 1000 ntlm_hashes.txt /usr/share/wordlists/rockyou.txt -r best64.rule
# With mask for 8-char passwords with special chars
hashcat -m 1000 ntlm_hashes.txt -a 3 ?a?a?a?a?a?a?a?a --increment
Cracking bcrypt Hashes
# bcrypt is intentionally slow
# Use smaller wordlists and targeted rules
hashcat -m 3200 bcrypt_hashes.txt targeted_wordlist.txt
# bcrypt benchmark
hashcat -b --benchmark-all -m 3200
# Result: Much slower than MD5 (this is by design!)
Cracking WPA2 Handshakes
# Convert pcap to hashcat format
hcxpcaptool -z hashes.txt capture.pcap
# Crack WPA2
hashcat -m 22000 hashes.txt /usr/share/wordlists/rockyou.txt
Common Mistakes
Wrong hash mode: Using the wrong -m value wastes time. Verify hash types with hashid.
Not using rules: Plain dictionary attacks crack far fewer passwords than rule-based attacks.
Bad wordlist selection: RockYou is great for common passwords. For targeted attacks, use custom wordlists.
GPU not detected: Ensure proper GPU drivers and OpenCL/CUDA installation.
Best Practices
Related Tools
Related Articles
Summary
Hashcat is the fastest password recovery tool, leveraging GPU acceleration. Key attack modes include dictionary, combinator, mask, and rule-based attacks. Success depends on choosing the right attack mode, using effective rules, and selecting appropriate wordlists. bcrypt and Argon2 resist GPU attacks by design, requiring different strategies.
Knowledge Check
References
{@ref kali-tools}
{@ref nist-sp800-53}