Hashcat explained: hash modes, attack modes and how to defend passwords

Hashcat is a powerful and versatile password cracking tool designed for cybersecurity professionals to assess and strengthen password security. It supports many hash types and offers multiple attack modes, including dictionary, brute-force, and hybrid attacks, utilizing CPU and GPU hardware acceleration. It is widely used by penetration testers, security researchers, and forensic analysts for efficient password recovery. By mastering Hashcat’s commands and performance optimization techniques, users can crack various password hashes and ensure the security of their systems while adhering to ethical guidelines.

Dec 11, 2024 - 16:44
Updated: 11 days ago
114.6k
Hashcat explained: hash modes, attack modes and how to defend passwords

Quick answer: Hashcat is a free password recovery tool that tests guesses against password hashes, using a GPU for speed. You choose a hash mode (-m) for the hash type and an attack mode (-a) such as wordlist or mask. Use it only on hashes you are authorised to audit. Its success depends mostly on how the passwords were hashed.

Key takeaways

  • Hashcat tests guesses against hashes. It does not reverse them.
  • The -m option selects the hash type and -a selects the attack method.
  • Fast hashes such as MD5 and NTLM fall quickly; slow hashes such as bcrypt and Argon2 resist.
  • Audit only hashes you are authorised to test, as part of a scoped engagement.
  • Defence: unique salts, slow hashing, long passphrases and MFA.

What is Hashcat?

Hashcat is a free, open-source tool that recovers passwords from their hashes by trying many guesses very quickly. It is documented at hashcat.net. It can use GPUs, which makes it fast on hash types designed to be fast.

A hash is a one-way fingerprint of a password. Hashcat does not reverse it. It hashes each guess and compares the result with the stored hash.

Legal note. Cracking hashes you are not authorised to test is a crime under India's IT Act. Legitimate uses are authorised password audits, penetration tests, recovering your own data and learning in a lab with hashes you created.

How do you tell Hashcat what to do?

The general shape of a command is:

hashcat -m <hash mode> -a <attack mode> <hash file> <wordlist or mask>
  • -m tells it which hash type the file contains.
  • -a tells it how to generate guesses.
  • --show prints passwords it has already recovered from its potfile.
  • --help lists all modes. The mode numbers are in the built-in help and the Hashcat wiki.

Which hash modes matter in practice?

Hash typeWhy it matters
MD5, SHA-1Old, fast, still found in legacy databases
NTLMWindows account hashes in many networks
sha512cryptLinux password hashes
bcryptSlow by design, much harder to attack
WPA/WPA2Wi-Fi handshakes, covered in our Wi-Fi guides

Identify the hash type before you start. Picking the wrong mode wastes time and returns nothing.

What attack modes does Hashcat offer?

  • Dictionary (straight): tries each word in a list, optionally with rules that change case or add digits.
  • Mask: tries guesses that fit a pattern, such as a word followed by four digits.
  • Combinator and hybrid: join words together, or a word and a mask.
  • Rules: transform each word, which is far more efficient than blind guessing.

The key point for defenders is that people choose predictable passwords, so wordlists with rules succeed more often than pure brute force.

Why does hashing choice matter so much?

Speed decides the outcome. A fast hash like MD5 lets a GPU test enormous numbers of guesses per second. A deliberately slow algorithm such as bcrypt or Argon2 cuts that number dramatically, and a unique salt per user stops the same guess from being tested against every account at once. The OWASP Password Storage Cheat Sheet describes current recommendations for storing passwords. Check it for the algorithm and settings it currently advises.

How is an authorised audit done?

  1. Get written permission and agree scope.
  2. Obtain hashes through a legitimate route, for example a test copy of a directory database.
  3. Identify the hash type and run a time-limited audit with a good wordlist and rules.
  4. Report the percentage and categories of weak passwords, such as reused or based on company names. Avoid listing passwords against named people where you can.
  5. Recommend fixes: stronger hashing, a banned-password list, longer minimums and MFA.
  6. Delete the hashes and results securely when the engagement ends.

What should you build for a lab?

Create your own test accounts in a VM, set passwords of varying strength, extract the hashes you generated, and see which ones fall to a small wordlist. Record the time taken for each. That teaches the lesson without touching anyone else's data.

What are the hardware needs?

A modern GPU makes a large difference for fast hashes. A CPU works for learning. Drivers matter, and installation problems usually come from missing GPU drivers or OpenCL runtime. Check the Hashcat documentation for your hardware.

How do you defend against it?

  • Hash with bcrypt, scrypt or Argon2, and a unique salt per password.
  • Require long passphrases and block common and breached passwords.
  • Add multi-factor authentication so a cracked password is not enough.
  • Protect hash databases like secrets, and monitor for exfiltration.

For related tools read John the Ripper and password cracking tools for ethical hackers.

Next steps

To practise password security in a legal lab, see our CEH v13 AI course or the VAPT course. Compare tools in Hydra, the network login tester.

Related reading

Frequently Asked Questions

Hashcat recovers passwords from hashes by testing many guesses quickly, usually on a GPU. Security teams use it for authorised password audits, penetration tests and recovering their own data.

The tool is legal. Using it on hashes you are not authorised to test is a crime. Use it on your own lab hashes or under a written scope and permission from the data owner.

The -m option selects the hash type, such as MD5 or NTLM. The -a option selects the attack mode, such as dictionary or mask. Choosing the right hash mode first is essential.

Slow, salted algorithms such as bcrypt and Argon2 limit guesses per second and stop one guess being tested against every user. Fast hashes such as MD5 allow vast numbers of guesses on a GPU.

No. Hashes cannot be reversed. Hashcat hashes each guess and compares it with the stored hash, so it succeeds only when a guess matches the real password.

Hash with bcrypt, scrypt or Argon2 with unique salts, require long passphrases, block breached passwords, use multi-factor authentication and protect hash databases from theft and monitor for unusual access.

What's Your Reaction?

Like Like 0
Dislike Dislike 0
Love Love 0
Funny Funny 0
Wow Wow 0
Sad Sad 0
Angry Angry 0
Vaishnavi

Vaishnavi is a skilled tech professional at the Ethical Hacking Training Institute in Pune, responsible for managing and optimizing the technical infrastructure that supports advanced cybersecurity education. With deep expertise in network security, backend operations, and system performance, she ensures that practical labs, online modules, and assessments run smoothly and securely. Her behind-the-scenes contributions play a vital role in delivering a seamless and secure learning experience for aspiring ethical hackers.