Basic Password Cracking with Hashcat
Master the fundamental techniques for cracking passwords using Hashcat.
1. Dictionary Attacks
Dictionary attacks use a list of words (wordlist) to attempt cracking a password. This is often the first step in password cracking.
Basic Dictionary Attack
Use a wordlist to crack an MD5 hash
hashcat -m 0 -a 0 hash.txt wordlist.txt
This command uses the wordlist.txt file to attempt cracking the MD5 hash(es) in hash.txt. The -m 0 specifies MD5 mode, and -a 0 indicates a straight attack using the provided wordlist.
2. Rule-Based Attacks
Rule-based attacks apply modifications to words in the wordlist, increasing the chances of cracking passwords that are variations of dictionary words.
Rule-Based Attack
Apply rules to a wordlist attack
hashcat -m 0 -a 0 hash.txt wordlist.txt -r rules/best64.rule
This command applies the best64.rule to each word in the wordlist, generating multiple password candidates per word. Rules can significantly increase the effectiveness of your attacks.
3. Basic Mask Attacks
Mask attacks use patterns to generate password candidates. They're useful when you know something about the password structure.
Basic Mask Attack
Crack passwords with a specific pattern
hashcat -m 0 -a 3 hash.txt ?d?d?d?d?d?d?d?d
This command attempts to crack passwords that are exactly 8 digits long. The ?d represents any digit (0-9).
4. Combination Attacks
Combination attacks use two wordlists to create password candidates by combining words from both lists.
Combination Attack
Combine words from two wordlists
hashcat -m 0 -a 1 hash.txt wordlist1.txt wordlist2.txt
This command combines each word from wordlist1.txt with each word from wordlist2.txt to create password candidates.
5. Hybrid Attacks
Hybrid attacks combine wordlists with masks, allowing you to add patterns before or after dictionary words.
Hybrid Wordlist + Mask Attack
Append digits to dictionary words
hashcat -m 0 -a 6 hash.txt wordlist.txt ?d?d?d?d
This command appends four digits to each word in the wordlist. The -a 6 specifies a hybrid wordlist + mask attack.
Tips for Success
- Start with smaller wordlists and gradually increase size
- Use rules to expand your password candidates
- Customize masks based on known password policies
- Combine different attack methods for better results
- Monitor your hardware temperatures during long cracking sessions
Ethical Considerations
Always use Hashcat responsibly and ethically. Only attempt to crack passwords on systems you own or have explicit permission to test. Unauthorized access to systems or data is illegal and unethical. These techniques should be used for educational purposes, security testing, and password recovery on your own systems.