22.4 Hashcat: Fast GPU Cracking
In short: Hashcat is the fastest cracker; it uses the GPU, so it tries far more guesses per second than John.
Hashcat is the fastest cracker; it uses the GPU, so it tries far more guesses per second than John. You must tell it the hash type with -m and the attack mode with -a.
hashcat --help | less # list hash modes (-m) and attack modes (-a)
# wordlist attack (mode 0) on MD5 hashes (mode 0 = MD5)
hashcat -m 0 -a 0 hashes.txt /usr/share/wordlists/rockyou.txt
# wordlist + rules
hashcat -m 0 -a 0 hashes.txt rockyou.txt -r /usr/share/hashcat/rules/best64.rule
# SHA-512 Linux crypt (mode 1800)
hashcat -m 1800 -a 0 shadow_hashes.txt rockyou.txt
# brute force (mode 3): 6 lowercase letters
hashcat -m 0 -a 3 hashes.txt ?l?l?l?l?l?l
# see results
hashcat -m 0 hashes.txt --show
Common -m modes: 0 MD5, 100 SHA1, 1800 sha512crypt, 3200 bcrypt, 1000 NTLM. Mask symbols: ?l lowercase, ?u uppercase, ?d digit, ?s symbol, ?a all.
Notice bcrypt (3200): it is so slow that Hashcat manages only a few thousand guesses a second instead of billions – proof of why you store passwords with bcrypt.
Ravindra Bagale's Tip
If the box (or VM) has no real GPU, Hashcat runs slowly – that's normal; the goal is to learn the concept. If you give the wrong -m number, you get a "line-length exception"; identify the hash type correctly and give the right -m. hashcat --example-hashes shows a sample for each mode.
Ravindra Bagale's Tip – मराठी
Box (किंवा VM) मध्ये खरा GPU नसेल तर Hashcat हळू चालतो – ते normal आहे, concept शिकायचा आहे. चुकीचा -m number दिला तर "line-length exception" येतो; hash type बरोबर ओळखून -m द्या. hashcat --example-hashes ने प्रत्येक mode चा नमुना दिसतो.
Ravindra Bagale's Tip – हिंदी
Box (या VM) में असली GPU नहीं है तो Hashcat धीरे चलता है – यह normal है, concept सीखना है. गलत -m number दिया तो "line-length exception" आता है; hash type सही पहचानकर -m दो. hashcat --example-hashes से हर mode का नमूना दिखता है.
Lab
Make an MD5 hash of a short word (echo -n hello | md5sum), put it in a file, and crack it with hashcat -m 0 -a 0. Then hash the same word with bcrypt in PHP (password_hash) and try -m 3200; note how much slower it is – that is your defence working.
Extended teaching notes
Why this lesson matters
Cryptography fails when people invent it. Use standard libraries, modern algorithms (AES-GCM, TLS 1.2+, bcrypt/argon2) and protect keys in a KMS or secrets manager.
Where crypto shows up
[('Passwords', 'bcrypt/argon2/PBKDF2 via the framework hasher — never plain MD5/SHA1.'), ('TLS', "Terminate on ALB/nginx with ACM/Let's Encrypt; redirect HTTP to HTTPS."), ('JWT / API tokens', 'Short lifetime, rotate signing keys, store secrets outside Git.'), ('Disk / S3', 'Provider or customer-managed keys; least privilege on decrypt.')]
Mini case study
Suppose we are on a purple-team exercise for an Indian mid-size company (sample data). Red notes a technique from this lesson against a lab clone. Blue must show the control that stops it, the log that would have fired, and the ticket that hardens production. That is the standard this course trains you for.
Defender's worksheet (do this today)
- Write the lesson title, date and the exact lab target you are allowed to use.
- List three owned systems (VMs, apps, or cloud accounts) where this lesson applies.
- Run one safe check from the lesson on a lab system only. Paste the command and output.
- Write a two-sentence fix you would give a teammate.
- Name one related public advisory (CERT-In, CISA, NVD, or a vendor bulletin) with its date.
Indian workplace (sample data)
Suppose we are a junior analyst at Infosys, TCS, Wipro or a fintech SOC in Bengaluru/Pune. Turn this lesson into one checklist item with an owner, a due date and a place to store evidence (ticket + screenshot).
Global practice
Compare your notes with OWASP, CIS Benchmarks, NIST CSF/IR guidance or a cloud Well-Architected security question. Write five lines on what overlaps.
Everyday analogy
Explain the risk and the fix to a family member without jargon. If they can repeat the warning, you understand it well enough to teach juniors.
Key terms
- Control: a safeguard (patch, config, process, detection).
- Finding: a weakness backed by evidence.
- Remediation: the fix plus how you verified it.
- Scope: systems you have written permission to touch.
- Least privilege: only the access the task needs.
- Defence in depth: several layers so one failure does not end the story.
Common mistakes
- Skipping written permission "just for a quick scan".
- Practising on hostel, office or public targets without authorisation.
- Collecting tool output without writing the fix.
- Copying attack steps onto production to "verify". Defenders verify with versions, configs and patches.
- Publishing screenshots that contain secrets, cookies or internal hostnames.
Recap
- Evidence, fix, owner, date.
- Own lab only.
- Fix > spectacle.