Insights

Hashcat on Parrot OS: mask attacks and password cracking

7 min read

Hashcat on Parrot OS password cracking title card

Hashcat on Parrot OS: mask attacks and password cracking

Hashcat on Parrot OS is a fast, GPU-accelerated password recovery utility that supports over 100 hash types and seven attack modes. It takes a cryptographic hash, generates candidate passwords, hashes each candidate with the same algorithm, and reports a match. Defenders use it to test how well their own password storage would hold up after a breach. Testers use it to show a client, safely and on their own lab, why weak hashing and weak passwords are still a real risk.

This post walks through Hashcat on Parrot OS: where it comes from, how to install it if it is missing, how to run a lawful mask attack on a lab VM you own, and what defences and detections make the tool’s work much harder. The install steps follow Parrot’s own documentation, and the command examples follow the official Hashcat documentation.

What Hashcat on Parrot OS is and when to use it

Hashcat is an open-source password recovery tool. Its stated purpose is to detect weak Unix passwords, and it has grown into a fast, broad auditing tool that covers password hashes from Linux, Windows, macOS, web applications and archives. Defenders use it to test how well their own password storage would hold up after a breach. Testers use it to show a client, safely and on their own lab, why weak hashing and weak passwords are still a real risk.

The tool supports five unique modes of attack for over 300 highly-optimized hashing algorithms. Hashcat currently supports CPUs, GPUs, and other hardware accelerators on Linux, and has facilities to help enable distributed password cracking. The most useful attack mode for most defensive audits is mask attack (attack mode 3). Unlike brute force which tries every possible combination, mask attack allows you to define patterns based on common password structures, dramatically reducing the keyspace.

When you have a captured password hash (for example from a forensic dump of a system you own) and you want to test whether your users’ passwords would survive a similar attack, Hashcat is the ideal tool. The mask attack is particularly valuable because it can emulate how humans actually design passwords. For example, a password like Julia1984 can be guessed with the mask ?u?l?l?l?l?l?l?l?l?d?d?d?d (capital name + year) in minutes instead of the years brute force would require.

Before you crack, you often map the network with a tool like Nmap and gather passive information with SpiderFoot. After you crack, you may inspect the same traffic in Wireshark. Hashcat sits in the middle: it turns a captured hash into a yes-or-no answer about the password.

Installing it on Parrot OS

Parrot OS Security Edition ships with Hashcat pre-installed; the Parrot tools overview lists it under password auditing alongside John the Ripper. Check that it is present by running hashcat with no arguments, which prints its usage summary:

hashcat

If you are on Parrot OS Home Edition, a minimal install, or a container, add it from Parrot’s repositories:

sudo apt update
sudo apt install hashcat -y

If you encounter installation issues with hashcat on newer Parrot OS versions that use SMP PREEMPT_DYNAMIC, you may need to install from source. Follow these steps:

sudo apt update
sudo apt install build-essential git
sudo git clone https://github.com/hashcat/hashcat.git
cd hashcat
make
sudo make install

You will also want to ensure OpenCL is installed and working, as Hashcat requires GPU acceleration for optimal performance. For AMD systems, you may need to install specific OpenCL packages or configure them through Parrot’s package manager. If you are using a newer release with the Debian package approach, you may need to compile Hashcat manually to avoid dependency conflicts.

Keep Parrot OS current with sudo parrot-upgrade, as the software management documentation recommends, so Hashcat and its OpenCL support stay up to date.

Ethical and lawful use

Only crack password hashes you are authorised to test. In the UK, accessing or attempting to access a system’s data without permission can engage the Computer Misuse Act 1990. Hashcat is an offline attack tool by nature: the attacker needs the hash file first, which usually means the system was already compromised. Treat the hash file itself as sensitive: keep it on your lab machine, do not email it, and delete it when the exercise is done.

The practical rule is simple. Audit your own systems, or systems covered by a written scope that names the targets and the time window. Do not run Hashcat against a dump taken from a client or employer unless that work is in scope and agreed in writing.

Worked example on a lab target

Lab target: your own throwaway Parrot OS or Debian VM on an isolated host-only network. Nothing below touches a real system. If you still need a lab, see our guide to creating a pentesting environment with Parrot OS and Kali Linux on VirtualBox.

First, create a test account with a password that matches a common pattern that you already know. This is the whole point of the exercise: you are checking how fast Hashcat recovers something an attacker would also try. Choose a password that includes a name and year, like your friend’s name and current year:

sudo useradd -m labuser
sudo usermod -p 'labuser:Summer2026' labuser

Next, create a hash of the password using SHA-256 to test Hashcat:

sudo apt install openssl -y
echo 'Summer2026' | openssl dgst -sha256 | cut -d' ' -f2 > labuser.sha256

Now, run a mask attack on the captured hash using the pattern that matches your known password. For Summer2026, we know it’s a capital name + 4 digits:

hashcat -m 1800 -a 3 labuser.sha256 ?u?l?l?l?l?l?l?l?l?d?d?d?d

Breaking this down:

  • -m 1800 specifies SHA-256 hash type
  • -a 3 selects mask attack mode
  • labuser.sha256 is the target hash file
  • ?u?l?l?l?l?l?l?l?l?d?d?d?d is the mask: capital letter, 7 lowercase letters, 4 digits

Hashcat will now try every possible combination matching this pattern. For a password like Summer2026, it should find the match very quickly, demonstrating how vulnerable a predictable password structure is. If Hashcat takes too long or doesn’t find the password, consider adjusting the mask. For example, if the name part is shorter, use a shorter mask like ?u?l?l?l?d?d.

You can also use a hybrid attack if you want to combine a dictionary word with patterns:

hashcat -m 1800 -a 12 labuser.sha256 ?u?l?l?l?l?l?l?l?l?d?d?d?d?d?d ?w

Here, ?w marks where the dictionary word goes within the mask pattern. This allows Hashcat to try words like Password followed by various year patterns.

For a more sophisticated attack, Hashcat supports a PCFG attack (attack mode 4) which uses a trained grammar to guess passwords in the order real users choose. This can be particularly effective because it knows that passwords like Summer2026 are more likely than random-looking combinations:

hashcat -m 1800 -a 4 labuser.sha256 ruleset

Hashcat will automatically generate a ruleset from previous cracking runs, then use it to prioritize likely candidates.

Defences and detections

Hashcat only succeeds when the hash file is already in the attacker’s hands and the passwords behind it are weak. Both halves are fixable.

  • Use a slow, salted algorithm. bcrypt, scrypt, Argon2id and yescrypt (the default on modern Linux) are deliberately expensive to compute. A fast hash like a single round of MD5 or SHA-1 lets Hashcat try billions of candidates; a slow hash cuts that to a trickle. Keep the work factor tuned as hardware improves.
  • Screen passwords against known-breached lists. Long, unique passphrases matter more than forced complexity rules. Checking new passwords against a breached-password list stops the rockyou-style entries before they are ever stored.
  • Require multi-factor authentication. When a stolen password alone is not enough, an offline cracking result matters far less. Prioritise MFA for email, VPN, cloud consoles and anything reachable from the internet.
  • Protect the hash database itself. Restrict read access to /etc/shadow and any exported password store, back it up encrypted, and log privileged access. The whole attack above starts with a file the attacker should not have been able to read.
  • Detect credential-dumping behaviour. Running unshadow on a production Linux host is a recognised credential-dumping signal. Elastic publishes a detection rule for exactly this behaviour ("Potential Linux Credential Dumping via Unshadow"), and most EDR and SIEM platforms can alert on similar command patterns. Alert on unshadow, on unexpected reads of /etc/shadow, and on Hashcat binaries running outside your approved tooling.
  • Force resets when weak hashes appear. If an audit recovers a password, reset it, and check whether that password or pattern appears elsewhere in the estate. Then re-run the audit to confirm the fix.

Hashcat on Parrot OS is a fair test of your password storage, not a curiosity. If a lab audit like the one above breaks your real password policy in minutes, fix the hashing and the policy before someone else runs the same test without your permission.