Lesson 01 Introduction to Hashcat
Theme:

Lab Guide

Time estimate: 30–45 minutes  ·  Goals: Install Hashcat, learn basic commands and parameters, run a test attack on a known hash

Lab Goals

Task 1: Install Hashcat

Installation Instructions

Choose the installation method for your operating system:

macOS

# Using Homebrew
brew install hashcat

# Verify installation
hashcat --version

Linux (Debian/Ubuntu)

# Using apt
sudo apt update
sudo apt install hashcat

# Verify installation
hashcat --version

Linux (Arch)

# Using pacman
sudo pacman -S hashcat

# Verify installation
hashcat --version

Windows

1. Download the latest release from https://hashcat.net/hashcat/
2. Extract the archive to a folder (e.g., C:\hashcat)
3. Open Command Prompt or PowerShell
4. Navigate to the folder: cd C:\hashcat
5. Run: hashcat.exe --version

✓ Check: Running hashcat --version prints a version number (e.g., v6.2.6).

Task 2: Explore Basic Commands

Step 2.1 — Check Available Devices

The -I flag displays information about compute devices detected by Hashcat (CPUs, GPUs, etc.):

hashcat -I

You should see output listing your available devices. Example:

hashcat (v6.2.6) starting in backend information mode

OpenCL Info:
============

OpenCL Platform ID #1
  Vendor..: Apple
  Name....: Apple
  Version.: OpenCL 1.2

  Backend Device ID #1
    Type...........: GPU
    Vendor.ID......: 32
    Vendor.........: Apple
    Name...........: Apple M1
    ...

✓ Check: At least one compute device is listed. If no GPU is detected, Hashcat will fall back to CPU mode.

Step 2.2 — View Help

The --help flag displays the full list of options, attack modes, and hash types:

hashcat --help

This produces extensive output. Take note of these key sections:

✓ Check: You can identify the -m value for MD5 (it is 0).

Task 3: Crack a Known MD5 Hash

Goal

Perform a dictionary attack on a known MD5 hash to verify that your Hashcat installation works correctly.

Step 3.1 — Create the Hash File

Create a file called hashes.txt containing the MD5 hash of the word "password":

echo "5f4dcc3b5aa765d61d8327deb882cf99" > hashes.txt

About This Hash

The string 5f4dcc3b5aa765d61d8327deb882cf99 is the MD5 hash of the plaintext word "password". This is one of the most commonly found hashes in leaked databases, because "password" is one of the most commonly used passwords worldwide.

Step 3.2 — Create a Simple Wordlist

Create a small dictionary file called example.dict with a few common passwords:

cat <<EOF > example.dict
123456
password
12345678
qwerty
abc123
monkey
master
dragon
letmein
football
EOF

Step 3.3 — Run the Dictionary Attack

Execute the following command to crack the hash:

hashcat -m 0 -a 0 -o cracked.txt hashes.txt example.dict

Let's break down each part of this command:

PartMeaning
hashcatThe Hashcat executable
-m 0Hash type: MD5 (mode 0)
-a 0Attack mode: Dictionary (mode 0)
-o cracked.txtWrite recovered passwords to this file
hashes.txtInput file containing target hashes
example.dictWordlist file to use for the attack

Step 3.4 — Verify the Results

Check the output file to see the cracked password:

cat cracked.txt

Expected output:

5f4dcc3b5aa765d61d8327deb882cf99:password

The format is hash:plaintext, showing that the hash 5f4dcc3b... corresponds to the password "password".

✓ Check: The file cracked.txt contains 5f4dcc3b5aa765d61d8327deb882cf99:password.

Troubleshooting

Finishing Up

Once you have completed all three tasks, verify the following:

Self-Check