hashcat: GPU-Accelerated Hash Cracking for CTFs

Tool · Crypto

hashcat cracks password hashes the same way John the Ripper does — by trying candidates and comparing the result — but it runs that comparison on your GPU instead of your CPU, which for most hash types means an order-of-magnitude speedup. For a CTF crypto or forensics challenge where you've already recovered a hash and just need the plaintext, that speed difference is often what makes brute-forcing it feasible at all.

Identifying the hash format first

hashcat needs to know what kind of hash it's looking at before it can attack it — every hash type has its own mode number:

hashcat --example-hashes | grep -A2 -i "sha256"

A plain MD5 is mode 0, SHA-256 is 1400, and a Linux sha512crypt shadow entry is 1800 — guessing the wrong mode just produces zero matches, so confirming the format (hash length, prefix like $6$) is worth the extra minute.

Dictionary attack

hashcat -m 0 hash.txt wordlist.txt

The most common starting point: try every word in a wordlist (rockyou.txt is the default go-to) as the plaintext. If the challenge's password is a real word or a known leaked password, this alone often finds it in seconds.

Mask attack for known patterns

When a challenge hints at the password's shape — "8 characters, starts with a capital letter" — a mask attack is far faster than a blind dictionary:

hashcat -m 0 hash.txt -a 3 ?u?l?l?l?l?l?l?d

Each ?u/?l/?d is a placeholder (uppercase letter, lowercase letter, digit) — this mask tries every combination matching "one capital, six lowercase, one digit" instead of every possible string of that length.

Rules: mutating a wordlist

hashcat -m 0 hash.txt wordlist.txt -r rules/best64.rule

Rules apply common human tweaks — capitalizing the first letter, appending "123" or "!", swapping "a" for "@" — to every word in a list, covering the gap between "the exact word" and "a mask of every possibility" without the combinatorial blowup of the latter.

Why it's worth learning

hashcat doesn't replace understanding what hash you're cracking or why it's crackable (a fast hash with no salt, a weak password policy) — that's still the actual puzzle in most challenges. What it removes is the ceiling on how many candidates you can try in the time you have, which is the difference between a mask attack finishing in seconds versus a CPU tool taking hours on the same hardware.

← Back to Blog