top of page

Hashcat: A Guide and Practical Uses (Casey Mullis)

Hashcat: A Comprehensive Guide and Practical Uses

 

Introduction

In today's digital age, cybersecurity is a top priority. Passwords, encryption keys, and authentication methods are the primary defenses against unauthorized access to data. However, no system is entirely impenetrable, and one of the key tools in the arsenal of security professionals (and unfortunately, attackers) is password cracking. Hashcat, a popular and powerful tool for this task, is widely used for cracking password hashes. With its high speed, flexibility, and support for numerous hash types, Hashcat has become an indispensable tool for ethical hacking, penetration testing, and digital forensics.

 

This article explores what Hashcat is, how it works, and provides practical examples of its usage.

 

What is Hashcat?

Hashcat is an open-source, advanced password recovery tool known for its efficiency in cracking encrypted passwords or "hashes." It supports various hashing algorithms, including MD5, SHA1, SHA256, NTLM, and bcrypt, and can run on CPUs, GPUs, and specialized hardware like FPGAs and ASICs. What sets Hashcat apart is its ability to leverage the power of modern GPUs, allowing it to crack passwords much faster than CPU-only methods.

 

How Does Hashcat Work?

When passwords are stored by systems, they are usually hashed — transformed into a fixed-length string that doesn't resemble the original password. Hashcat tries to reverse this process by generating hash values from possible passwords and comparing them to the target hash. This process can be done using different techniques, such as brute-force attacks, dictionary attacks, or rule-based attacks.


Hashcat supports numerous cracking methods, including:

  • Dictionary attacks: Using predefined lists of possible passwords.

  • Brute-force attacks: Trying every possible combination of characters.

  • Mask attacks: Using patterns to target specific password structures.

  • Rule-based attacks: Modifying dictionary words based on specific rules.

  • Hybrid attacks: Combining dictionary and brute-force methods.

 

Practical Examples of Hashcat in Action

 

Example 1: Cracking NTLM Hashes from Windows Systems

NTLM (New Technology LAN Manager) is a suite of Microsoft security protocols intended to provide authentication, integrity, and confidentiality to users. However, NTLM hashes are vulnerable to password-cracking attacks.

 

Scenario: You’ve obtained an NTLM hash from a Windows machine and need to recover the password for investigative purposes.

 

Steps:

  1. Obtain the NTLM hash. Example: aad3b435b51404eeaad3b435b51404ee

  2. Run Hashcat against the NTLM hash with a dictionary (wordlist) attack:

 

hashcat -m 1000 hash.txt wordlist.txt

In this case:

  1. -m 1000 specifies the hash type (NTLM).

  2. hash.txt is the file containing the hash.

  3. wordlist.txt is the dictionary file containing potential passwords.

  4. Hashcat will attempt to find the password by comparing the NTLM hash to the generated hashes from the wordlist.

 

Practical Tip: This method is especially useful in recovering weak passwords where users may have used common or easily guessable passwords.

 

Example 2: Cracking WPA2 Handshake for Wireless Networks

Wireless networks are often protected with WPA2 encryption, but poorly chosen passwords can still be cracked. Hashcat can be used to crack WPA2-PSK hashes using the four-way handshake.

Scenario: During a penetration test, you capture a WPA2 handshake and need to check the strength of the password.

 

Steps:

  1. Capture the WPA2 handshake using tools like aircrack-ng.

  2. Run Hashcat with the WPA2 handshake file:

 

hashcat -m 2500 handshake.hccapx wordlist.txt

In this case:

  1. -m 2500 specifies the WPA2 hash mode.

  2. handshake.hccapx is the file containing the captured handshake.

  3. wordlist.txt is the file with potential passwords.

  4. Hashcat will compare the dictionary words against the captured handshake to try and recover the Wi-Fi password.

 

Practical Tip: This approach is effective for networks where the password is weak or commonly used.

 

Example 3: Brute-Force Attack on a Simple MD5 Hash

MD5 is a widely known hashing algorithm, though it's not recommended for security purposes today due to its vulnerabilities. However, MD5 is still commonly used in older systems and databases.

 

Scenario: You've found an MD5 hash from an outdated application, and you need to recover the password to access legacy systems.

 

Steps:

  1. The hash might look like this: 5d41402abc4b2a76b9719d911017c592 (MD5 hash for the word "hello").

  2. Run Hashcat with a brute-force attack:

 

hashcat -m 0 -a 3 hash.txt ?a?a?a?a?a

In this case:

  1. -m 0 specifies the MD5 hash mode.

  2. -a 3 specifies the brute-force attack mode.

  3. ?a?a?a?a?a means that you are brute-forcing a five-character password using all possible character combinations.

  4. Hashcat will try all possible combinations of five-character passwords until it finds one that matches the given MD5 hash.

 

Practical Tip: Brute-force attacks are slow for long passwords but work effectively for short or simple passwords. Always use masking to narrow down possibilities and reduce cracking time.

 

Example 4: Mask Attack with Known Password Pattern

Often, users follow predictable patterns when creating passwords, such as appending numbers or special characters to dictionary words. In these cases, a mask attack is more efficient than a brute-force attack.

 

Scenario: You know the password is eight characters long and starts with "Pass" followed by four numbers.

 

Steps:

  1. Use a mask attack to target the specific pattern:

hashcat -m 0 -a 3 hash.txt Pass?d?d?d?d

  1. Pass is the known part of the password.

  2. ?d represents digits (0-9), so it will try all combinations of digits for the last four characters.

  3. Hashcat will attempt all combinations of passwords that fit the "PassXXXX" format.

 

Practical Tip: Mask attacks are particularly useful when parts of the password are known, speeding up the cracking process significantly.

 

Conclusion

Hashcat is a versatile tool that can handle a wide range of password-cracking tasks, making it essential for security professionals, ethical hackers, and digital forensic experts. By leveraging its advanced attack modes—dictionary, brute-force, mask, and hybrid—Hashcat can efficiently crack many different types of hashes. Whether you're auditing passwords, conducting penetration tests, or working on a forensic investigation, Hashcat offers the speed, flexibility, and power to get the job done.

 

However, it is crucial to use Hashcat ethically and within the boundaries of the law. Password cracking tools are powerful, and misuse can lead to legal consequences. Always ensure that you have permission and legal authority before attempting to crack passwords.

 

Criminal Investigator

Coweta County Sheriff’s Office

Emory Casey Mullis has been in Law Enforcement for over 20 years, encompassing both military and civilian roles. His journey with computers began with a Gateway 266 MHz, which was the pinnacle of consumer technology at the time, costing around $2000. Driven by pure curiosity, he disassembled his new computer right out of the box, much to the dismay of his wife, who insisted, "It better work when you put it back together!" This hands-on experience provided him with a foundational understanding of computer hardware and sparked his career as a Cyber Investigator.

Over the years, Casey has tackled numerous cyber cases, continually honing his skills and knowledge. He emphasizes the importance of questioning, challenging, and testing daily to stay abreast of the latest tools, software, and technologies. Despite the ongoing challenges, he thrives on the dynamic nature of cyber forensics and eagerly embraces every opportunity to learn and grow in this ever-evolving field.


 

70 views

Recent Posts

See All

Comments


bottom of page