Hashcat

Hashcat is the de-facto GPU-accelerated password cracker — the offensive counterpart to John the Ripper, trading John’s broader format support and CPU flexibility for raw speed on modern AMD/NVIDIA hardware via OpenCL, HIP, or CUDA. It’s the standard tool for T1110.002 — Brute Force: Password Cracking, and accepts output from most dump tools directly (Metasploit hashdump, impacket secretsdump.py, Mimikatz .kirbi-derived TGS hashes).

Basic usage

hashcat -m $MODE -a $ATTACK $HASHFILE $WORDLIST
  • -m $MODE — hash type (see table below; full list via hashcat --help or the example_hashes wiki).
  • -a $ATTACK — attack mode: 0 straight wordlist, 1 combinator, 3 mask/brute, 6/7 hybrid wordlist+mask. Default is 0.
  • -O — use an optimized kernel (faster, but limits candidate length — typically ≤32 chars for fast hashes, more for slow ones).
  • -r rules/$RULE.rule — apply a mangling ruleset (e.g. best64.rule, d3ad0ne.rule, OneRuleToRuleThemAll.rule — the hashcat equivalent of John’s --rules).
  • -w 3 (or 4) — workload profile; use -w 4 on a dedicated cracking rig, -w 2 if you’re sharing the GPU with a desktop.
  • --show — print cracked hash:plaintext pairs from the potfile.
  • --username — input lines contain user:hash (strip the username before cracking).

A raw hash can be passed directly in place of $HASHFILE (quote it; the shell loves to eat $ characters). Kali’s hash-identifier and hashid help identify an unknown blob; the hashcat example hashes page shows a canonical sample for every mode.

Common modes

ModeHash type
0MD5
100SHA1
900MD4
1000NTLM (Windows)
1400SHA2-256
1700SHA2-512
1710SHA2-512 with salt (sha512($pass.$salt)) — format $HASH:$SALT
1800UNIX sha512crypt $6$ (unix-password-hash-formats)
3000LM (LANMAN)
3200bcrypt $2*$
5500NetNTLMv1
5600NetNTLMv2
7500Kerberos 5 AS-REQ Pre-Auth etype 23
13100Kerberos 5 TGS-REP etype 23 (RC4)kerberoasting
18200Kerberos 5 AS-REP etype 23as-rep-roasting
19600Kerberos 5 TGS-REP etype 17 (AES128)
19700Kerberos 5 TGS-REP etype 18 (AES256)
19800Kerberos 5 AS-REP etype 17
19900Kerberos 5 AS-REP etype 18

A large set of “Raw Hash, Salted and/or Iterated” modes accept $HASH:$SALT — see the example_hashes wiki for the exact per-mode layout. Output is always HASH:PLAINTEXT tuples; the potfile (~/.hashcat/hashcat.potfile by default) records cracked pairs so re-running the same file is cheap — use --show rather than re-cracking.

A Token length exception almost always means the input line has the wrong shape: an extra field, a stray colon, a missing $ marker, or a hash that got truncated when copied out of a terminal (PowerShell’s console width truncation is the classic culprit for long TGS hashes — use Out-File -Width 8000).

Attack modes in practice

Wordlist (mode 0)

hashcat -m 1000 ntlm.txt /usr/share/wordlists/rockyou.txt -r rules/best64.rule

The workhorse. RockYou plus a mangling ruleset cracks the overwhelming majority of human-chosen passwords against fast hashes (NTLM, MD5).

Combinator (mode 1)

Concatenate every entry of wordlist A with every entry of wordlist B:

hashcat -m 1000 ntlm.txt -a 1 left.txt right.txt

The standalone combinator.bin from hashcat-utils pre-generates the combined list:

/usr/lib/hashcat-utils/combinator.bin $W1 $W2 > combined.txt

Mask / brute force (mode 3)

Masks describe a per-position character class:

PlaceholderClass
?llowercase
?uuppercase
?ddigit
?sspecial
?aall printable ASCII
?b0x00–0xff
# Generate all 4-digit PINs on stdout (no hash needed)
hashcat -a 3 ?d?d?d?d --stdout
 
# Crack an MD5 of a 4-digit PIN
hashcat -a 3 -m 0 $MD5_HASH ?d?d?d?d
 
# Crack NTLM where the policy is "8 chars, first uppercase, ends with two digits"
hashcat -a 3 -m 1000 ntlm.txt ?u?l?l?l?l?l?d?d

Custom classes go in --custom-charset1 (etc.) and are referenced as ?1.

Hybrid (modes 6 / 7)

Wordlist + mask (mode 6) or mask + wordlist (mode 7) — covers “password is a dictionary word plus a year/symbol suffix” better than pure rules:

hashcat -a 6 -m 1000 ntlm.txt rockyou.txt ?d?d?d?d

Consuming output from other tools

  • Metasploit hashdump / post/windows/gather/smart_hashdump — feed the file with -m 1000 --username.

  • Impacket secretsdump.py — same NTLM format, same -m 1000.

  • Impacket GetUserSPNs.py -request — emits Hashcat-format -m 13100 lines directly; pipe to file and crack.

  • Impacket GetNPUsers.py -request — emits -m 18200 AS-REP lines.

  • Rubeus kerberoast — same -m 13100 format.

  • /etc/shadow-m 1800 (sha512crypt), -m 500 (md5crypt), etc. See unix-password-hash-formats for the $id$salt$hash anatomy.

  • MySQL 8 mysql.user.authentication_string — the cached SHA2 (caching_sha2_password) value is a binary blob, not a crackable string. Convert it to hashcat mode 7401 (MySQL $A$ (sha256crypt)) in-database before extraction:

    SELECT CONCAT(
      '$mysql',
      LEFT(authentication_string, 6),
      '*',
      INSERT(HEX(SUBSTR(authentication_string, 8)), 41, 0, '*')
    ) FROM mysql.user WHERE user = 'target';

    Then crack with hashcat -m 7401 -O hash.txt rockyou.txt. The transformation re-wraps the raw bytes into the $mysql$TYPE*SALT*HASH layout hashcat expects; without it the blob is rejected with a token-length error.

  • John’s .pot — John and Hashcat use incompatible potfile formats; extract cracked pairs via john --show and re-feed the uncracked hashes.

Comparing with John the Ripper

HashcatJohn
HardwareGPU-first (OpenCL/HIP/CUDA)CPU-first (some GPU formats)
Format breadth~300 modes400+ formats (jumbo)
Speed on fast hashes (NTLM/MD5)Typically 10–100× John on a decent GPUBaseline
Speed on slow hashes (bcrypt/scrypt/yescrypt)Comparable to JohnComparable to Hashcat
Wordlist rulesrules/*.rule files, similar syntaxInline [List.Rules:…] in john.conf
Best atHigh-volume fast-hash cracking (NTLM, NetNTLMv2, TGS-REP)Long-tail formats (SSH keys, ZIP, RAR, keystore, …)

The natural workflow is to try Hashcat first (especially for kerberoasting, as-rep-roasting, NTLM from hashdump/mimikatz/impacket) and fall back to john-the-ripper for formats hashcat doesn’t support.

Sources

Related: john-the-ripper, kerberoasting, as-rep-roasting, unix-password-hash-formats, mimikatz, impacket, msfconsole, meterpreter, hydra, h8mail.