Tool introduction: hashcat

In modern applications, passwords are not stored in plaintext but as hashes. Since cryptographic hash functions are designed as one-way functions, it is not possible to directly derive the original password from a given hash. Instead, password recovery relies on a fundamentally different approach: generating candidate passwords, applying the same hashing function, and comparing the result to the target hash.

This process is inherently computationally intensive and becomes more efficient with specialized tooling. hashcat is one of the most powerful tools available for this purpose. It is primarily used in offline password attacks, where attackers already possess password hashes and can perform verification locally. By leveraging the massive parallelism of modern GPUs via OpenCL or CUDA, hashcat can test extremely large numbers of password candidates in a very short time.

Basic Usage

The syntax of hashcat follows a consistent and modular structure:

hashcat -m [hash-type] -a [mode] [hash-file] [wordlist/mask]

This structure reflects the core idea of the tool: selecting a hash algorithm, defining an attack strategy, and supplying input data such as hashes and candidate sources.

Important Parameters

  • -m (hash mode): Specifies the hashing algorithm used (e.g., 0 = MD5, 100 = SHA1, 1800 = SHA512-Crypt, 3200 = bcrypt)
  • -a (attack mode): Defines the attack strategy (e.g., 0 = dictionary, 3 = mask)
  • -o [file]: Writes successfully cracked passwords to an output file
  • -b (benchmark): Measures the performance of the hardware for specific algorithms
  • --show: Displays already cracked hashes from the potfile without re-running the attack

These parameters allow hashcat to be highly flexible while still maintaining a relatively simple command-line interface.

Attack Modes

hashcat provides several attack modes, each optimized for different assumptions about password structure and user behavior.

1. Dictionary Attack (-a 0)

A dictionary attack uses predefined lists of passwords, often derived from real-world data breaches. Instead of searching the entire keyspace, this approach focuses on likely candidates.

hashcat -m 0 -a 0 hashes.txt rockyou.txt

In practice, this is often the most efficient starting point. Many users reuse weak or previously leaked passwords, meaning that a well-chosen wordlist can yield results very quickly.

2. Mask Attack (Intelligent Brute Force, -a 3)

A mask attack refines the brute-force approach by introducing structure. Rather than testing all possible combinations blindly, it defines patterns that reflect common password formats.

hashcat provides predefined character classes:

  • ?l → lowercase letters
  • ?u → uppercase letters
  • ?d → digits
  • ?s → special characters

These can be combined to describe expected password patterns.

Example:

hashcat -m 0 -a 3 hashes.txt ?u?l?l?l?l?l?d?d

This mask represents a password starting with one uppercase letter, followed by five lowercase letters and ending with two digits. By reducing the search space to realistic patterns, mask attacks significantly improve efficiency compared to naive brute-force approaches.

3. Hybrid Attacks (-a 6, -a 7)

Hybrid attacks combine dictionary and mask techniques. They extend known password candidates with additional characters, reflecting common user behavior such as appending numbers or symbols.

  • -a 6: wordlist + suffix
  • -a 7: prefix + wordlist

Example:

hashcat -m 0 -a 6 hashes.txt rockyou.txt ?d

In this case, each password from the wordlist is extended by a digit. This approach is particularly effective because many real-world passwords follow predictable modification patterns.

4. Rule-Based Attacks (-r)

Rule-based attacks are among the most powerful techniques in hashcat. Instead of manually defining patterns, rules automatically transform password candidates from a wordlist according to predefined operations.

Rule Description Input Output
c Capitalize first letter binsec Binsec
$! Append character binsec binsec!
sao Substitute characters banana bonono
d Duplicate abc abcabc

Example:

hashcat -m 0 -a 0 hashes.txt rockyou.txt -r rules/best64.rule

Rules are especially effective because they mimic real-world password creation patterns, such as replacing letters with numbers or adding suffixes like years or symbols.

Performance and Efficiency

The performance of hashcat is typically measured in hashes per second (H/s), indicating how many candidate passwords can be tested in a given time frame.

The achievable speed depends heavily on both the hardware and the hash algorithm:

  • GPUs are extremely efficient for fast hash functions such as MD5, NTLM, or SHA1 due to their parallel architecture
  • CPUs are often used for slower, memory-intensive algorithms such as bcrypt or Argon2, where raw parallelism is less effective

Note: hashcat stores cracked passwords in a file called hashcat.potfile. If a hash has already been cracked in a previous session, it will not be recomputed, which significantly improves efficiency in repeated runs.

Classification

In practical scenarios, success is rarely determined by brute computational power alone. Instead, it depends on selecting the appropriate attack strategy based on assumptions about password structure and user behavior.

Short, targeted attacks using wordlists and rule-based transformations often produce better results in minutes than exhaustive brute-force attacks would achieve over much longer periods.

binsec academy GmbH – Advanced Pentest Training Lab

binsec academy GmbH operates the Pentest Training Lab, a highly practical online platform dedicated to real penetration testing. Simulating complex corporate networks and advanced real-world attack scenarios within isolated lab environments, it is engineered to sharpen the skills of aspiring and professional penetration testers. Upon conquering our rigorous, fully practical examination, participants earn the distinguished Binsec Academy Certified Pentest Professional (BACPP) designation — proving their technical capability to methodically uncover and evaluate vulnerabilities in modern IT infrastructures.

Explore the Pentest Training Lab

binsec GmbH – Experts in Penetration Testing

As the operative pentesting core of the binsec group, binsec GmbH has provided high-end, human-led penetration testing since 2013. Rejecting automated scans, our permanently employed, certified senior pentest experts deliver manual deep-dive assessments of web applications, APIs, mobile apps, complex network infrastructures, cloud environments, and advanced red team simulations. Specializing in high-regulation sectors like Payment, Banking, and Healthcare, we provide clear risk evaluations and actionable reports to effectively assess your business-critical systems.

Get Manual Expert Penetration Testing Services

Contact

binsec GmbH
Clemensstraße 6-8
60487 Frankfurt am Main
Germany

Legal notice

Director: Patrick Sauer
Authorized Officer: Dominik Sauer, Florian Zavatzki
Registration: Frankfurt am Main, HRB97277
Turnover Tax Identification No.: DE290966808