GO KALI FREE
IntermediateSecurity

Hashcat Guide: GPU-Accelerated Password Recovery

Learn to use Hashcat for GPU-accelerated password recovery including attack modes, rule-based attacks, mask attacks, and performance optimization.

#Hashcat#Password Cracking#GPU#Hash Recovery#Password Security

The GPU That Cracks Billions of Passwords Per Second

When security researchers audited Ashley Madison's breached database in 2015, they turned to a tool that could test billions of password combinations per second using off-the-shelf graphics cards. Hashcat — running on a single GPU — cracked millions of bcrypt-hashed passwords in days, demonstrating that even "secure" hashing falls to dedicated hardware when the attacker controls the cracking rig.

Hashcat is the world's fastest password recovery tool, leveraging GPU acceleration to achieve billions of hash calculations per second. It supports over 300 hash types across multiple attack modes.

Prerequisites

Before studying Hashcat, you should understand:

  • **Hashes Explained** — How password hashing works
  • **Password Security Guide** — Password fundamentals
  • **GPU Basics** — CUDA, OpenCL concepts
  • **Linux Commands Explained** — Command line usage
  • Installation

    # Hashcat is pre-installed in GO KALI
    hashcat --help
    
    # Check GPU availability
    hashcat -I
    
    # Manual installation
    sudo apt install hashcat
    
    # Or download latest version
    wget https://github.com/hashcat/hashcat/releases/latest/download/hashcat-x.x.x.7z
    7z x hashcat-x.x.x.7z
    

    Hashcat Attack Modes

    Dictionary Attack (-a 0)

    The most common mode. Test each word from a wordlist against the hash:

    hashcat -m 0 -a 0 hashes.txt /usr/share/wordlists/rockyou.txt
    
    # -m 0 = MD5 hash mode
    # -a 0 = Dictionary attack
    # hashes.txt = File containing target hashes
    # rockyou.txt = Wordlist
    

    Combinator Attack (-a 1)

    Combine words from two wordlists:

    hashcat -m 1000 -a 1 ntlm_hashes.txt words1.txt words2.txt
    

    Mask Attack (-a 3)

    Brute force using character masks for specific positions:

    hashcat -m 0 -a 3 hashes.txt ?l?l?l?l?l?l?d?d
    
    # ?l = lowercase letter
    # ?u = uppercase letter
    # ?d = digit
    # ?s = special character
    # ?a = all characters
    # ?h = hex digit (lowercase)
    # ?H = hex digit (uppercase)
    

    Hybrid Attack (-a 6 and -a 7)

    Combine dictionary + mask:

    # Word + mask suffix (-a 6)
    hashcat -m 0 -a 6 hashes.txt wordlist.txt ?d?d?d
    
    # Mask + word prefix (-a 7)
    hashcat -m 0 -a 7 hashes.txt ?d?d?d wordlist.txt
    

    Hash Modes

    Common hash modes in Hashcat:

    | Mode | Hash Type |

    |------|-----------|

    | 0 | MD5 |

    | 100 | SHA1 |

    | 1400 | SHA256 |

    | 1700 | SHA512 |

    | 1000 | NTLM |

    | 3200 | bcrypt |

    | 5500 | NetNTLMv1 |

    | 5600 | NetNTLMv2 |

    | 13100 | Kerberos 5 TGS-REP |

    | 18200 | Kerberos 5 AS-REP |

    | 2500 | WPA/WPA2 |

    | 22000 | WPA-PBKDF2-PMKID+EAPOL |

    Rule-Based Attacks

    Rules modify words from a wordlist to try variations:

    # Basic rule usage
    hashcat -m 0 -a 0 hashes.txt wordlist.txt -r /usr/share/hashcat/rules/best64.rule
    
    # Multiple rules
    hashcat -m 0 -a 0 hashes.txt wordlist.txt -r rule1.rule -r rule2.rule
    
    # Built-in rules
    ls /usr/share/hashcat/rules/
    
    # best64.rule — 64 most effective rules
    # d3ad0ne.rule — Extensive rule set
    # T0XlC-insert_00-99.rule — Number insertion
    # T0XlC-insert_space_and_special_00-99.rule
    # rockyou-30000.rule — 30000 rules from rockyou analysis
    

    Creating Custom Rules

    # Rule syntax examples
    # $ = append
    # ^ = prepend
    # s = substitute
    # r = reverse
    
    # Append a digit
    $0 $1 $2
    
    # Capitalize first letter
    c
    
    # Toggle case
    T0 T1 T2 T3
    
    # Substitute characters
    s@a          # Replace @ with a
    s0o s1i s3e  # Leet speak substitutions
    
    # Example rules file (leet.rule):
    :
    c
    c$0$0$0
    c$0$0$1
    s@a
    s@a s0o
    s@a s0o s$s
    

    Performance Optimization

    Device Selection

    # List available devices
    hashcat -I
    
    # Use specific device
    hashcat -m 0 -a 0 hashes.txt wordlist.txt -d 1
    
    # Use multiple GPUs
    hashcat -m 0 -a 0 hashes.txt wordlist.txt -d 1,2
    

    Workload Profile

    # Workload profiles (-w):
    # 1 = Low (desktop usable)
    # 2 = Default
    # 3 = High (desktop slow)
    # 4 = Nightmare (desktop unusable)
    
    hashcat -m 0 -a 0 hashes.txt wordlist.txt -w 3
    

    Session Management

    # Restore session after interrupt
    hashcat -m 0 -a 0 hashes.txt wordlist.txt --session my_session
    
    # Continue from previous session
    hashcat --restore --session my_session
    
    # Show current progress
    hashcat --status --session my_session
    

    Optimized Kernels

    # Enable optimized kernels (for short passwords)
    hashcat -m 0 -a 3 hashes.txt ?a?a?a?a?a?a?a?a -O
    
    # --optimized-kernel -O
    # Limits password length but significantly increases speed
    

    Potfile Management

    Hashcat stores cracked passwords in the potfile:

    # Default potfile location
    ~/.local/share/hashcat/hashcat.potfile
    
    # Show cracked hashes
    hashcat --show hashes.txt
    
    # Show only remaining hashes
    hashcat --left hashes.txt
    
    # Use custom potfile
    hashcat -m 0 hashes.txt wordlist.txt --potfile-path ./custom.pot
    

    Real-World Scenarios

    Auditing NTLM Hashes

    # Extract NTLM hashes from Windows SAM (requires admin)
    reg save hklmsam sam.save
    reg save hklmsecurity security.save
    reg save hklmsystem system.save
    
    # Dump hashes with secretsdump.py or samdump2
    secretsdump.py -sam sam.save -system system.save LOCAL
    
    # Crack NTLM hashes
    hashcat -m 1000 ntlm_hashes.txt /usr/share/wordlists/rockyou.txt -r best64.rule
    
    # With mask for 8-char passwords with special chars
    hashcat -m 1000 ntlm_hashes.txt -a 3 ?a?a?a?a?a?a?a?a --increment
    

    Cracking bcrypt Hashes

    # bcrypt is intentionally slow
    # Use smaller wordlists and targeted rules
    hashcat -m 3200 bcrypt_hashes.txt targeted_wordlist.txt
    
    # bcrypt benchmark
    hashcat -b --benchmark-all -m 3200
    # Result: Much slower than MD5 (this is by design!)
    

    Cracking WPA2 Handshakes

    # Convert pcap to hashcat format
    hcxpcaptool -z hashes.txt capture.pcap
    
    # Crack WPA2
    hashcat -m 22000 hashes.txt /usr/share/wordlists/rockyou.txt
    

    Common Mistakes

    Wrong hash mode: Using the wrong -m value wastes time. Verify hash types with hashid.

    Not using rules: Plain dictionary attacks crack far fewer passwords than rule-based attacks.

    Bad wordlist selection: RockYou is great for common passwords. For targeted attacks, use custom wordlists.

    GPU not detected: Ensure proper GPU drivers and OpenCL/CUDA installation.

    Best Practices

  • **Start with dictionary + rules** before moving to brute force
  • **Use targeted wordlists** — Create wordlists based on target information
  • **Leverage rules** — Rules multiply wordlist effectiveness
  • **Use mask attacks for known patterns** — If password policy is known
  • **Save sessions** — Use --session for long-running attacks
  • **Benchmark first** — Know your hash rate for time estimation
  • **Combine approaches** — Run multiple attacks in sequence
  • Related Tools

  • **John the Ripper** — CPU-based password cracking
  • **hashid** — Identify hash types
  • **crunch** — Generate custom wordlists
  • **cewl** — Generate wordlists from websites
  • **kwprocessor** — Keyboard walk pattern generator
  • Related Articles

  • Hashes Explained
  • John the Ripper Guide
  • Password Auditing
  • Dictionary Attacks
  • Summary

    Hashcat is the fastest password recovery tool, leveraging GPU acceleration. Key attack modes include dictionary, combinator, mask, and rule-based attacks. Success depends on choosing the right attack mode, using effective rules, and selecting appropriate wordlists. bcrypt and Argon2 resist GPU attacks by design, requiring different strategies.

    Knowledge Check

  • What is the advantage of GPU acceleration for password cracking?
  • Name four Hashcat attack modes and their use cases.
  • What is the purpose of rules in Hashcat?
  • Why is bcrypt cracking much slower than MD5 even on GPUs?
  • What is the potfile and how is it used?
  • References

    {@ref kali-tools}

    {@ref nist-sp800-53}

    Frequently Asked Questions

    What is Hashcat used for?

    Hashcat is a GPU-accelerated password recovery tool that cracks over 300 hash types. It is used for password auditing, penetration testing, and recovering lost passwords from encrypted files or password hashes.

    What is the difference between Hashcat and John the Ripper?

    Hashcat uses GPU acceleration for significantly faster cracking, while [John the Ripper](/articles/john-ripper-guide) relies on CPU processing. Hashcat supports more hash types and attack modes, but John offers unique features like incremental mode and automatic hash detection.

    What is a Hashcat mask attack?

    A mask attack (mode `-a 3`) brute-forces passwords using character class placeholders. For example, `?l?l?l?l?d?d` tests all six-character passwords with four lowercase letters followed by two digits. Masks let you target specific password patterns instead of trying every combination.

    What is the Hashcat potfile?

    The potfile (`~/.local/share/hashcat/hashcat.potfile`) stores previously cracked hashes so Hashcat never wastes time re-cracking them. Use `hashcat --show` to view cracked results and `hashcat --left` to see remaining uncracked hashes.

    What are Hashcat rules and why should I use them?

    Rules modify words from a wordlist to generate password variations like capitalization, leet speak substitutions, and appended digits. Using rules with `best64.rule` can crack 10-100x more passwords than a plain dictionary attack.

    How do I choose the right Hashcat hash mode (`-m`)?

    Match the `-m` flag to your hash type. Common modes include `0` for MD5, `1000` for NTLM, `3200` for bcrypt, and `13100` for Kerberos TGS. Use `hashcat --example-hashes` or tools like `hash-identifier` to identify unknown hashes.

    How fast can Hashcat crack passwords?

    Speed depends on hash type and GPU power. MD5 can reach billions of hashes per second on modern GPUs, while bcrypt intentionally runs at thousands per second. Check performance with `hashcat -b` to benchmark your hardware.

    Can Hashcat crack bcrypt passwords?

    Yes, but bcrypt is intentionally slow by design. Hashcat mode `-m 3200` handles bcrypt, but cracking even simple passwords takes significantly longer than MD5 or NTLM. Use targeted wordlists rather than exhaustive brute force for bcrypt.

    How do I crack WPA2 handshakes with Hashcat?

    Convert the pcap capture to Hashcat's `.hc22000` format using `hcxpcapngtool`, then run `hashcat -m 22000 handshake.hc22000 wordlist.txt`. The handshake must include the four-way EAPOL exchange for cracking to succeed.

    What GPU do I need for Hashcat?

    NVIDIA GPUs with CUDA support are recommended. An RTX 3060 can crack MD5 at ~20 GH/s, while an RTX 4090 exceeds ~100 GH/s. AMD GPUs work via OpenCL but NVIDIA generally offers better Hashcat performance.