Lesson 07 Wordlist Generation
Theme:

Wordlist Generation

Build, customize, and optimize wordlists for effective password cracking.

Introduction

A dictionary attack is only as good as its dictionary. The single most impactful thing you can do to improve your password cracking success rate is to use better wordlists. This lesson covers the full lifecycle: finding existing wordlists, generating custom ones, manipulating them with rules, and combining multiple sources into a single optimized attack dictionary.

Understanding wordlist generation is essential because real-world password cracking is rarely about brute-forcing every possible combination. Instead, it is about exploiting the predictable patterns that humans use when choosing passwords. Good wordlists encode these patterns.

Sources for Wordlists

Wordlists come from several categories, each with distinct strengths:

Data Breach Leaks

When a service is compromised and its password database is leaked, security researchers can extract the plaintext passwords (either directly or after cracking weak hashes). These leaked passwords form the most realistic wordlists because they represent actual human password choices.

Legal notice: Possessing breach data may be illegal in some jurisdictions. Always ensure you are operating within the law and using wordlists only for authorized security testing.

Curated Common Password Lists

Several projects maintain high-quality, deduplicated wordlists:

Personalized Wordlists

When targeting a specific individual (in an authorized engagement), personalized wordlists are highly effective. Tools like CUPP (Common User Passwords Profiler) generate candidates based on personal information: names, birthdates, pet names, favorite sports teams, and common permutations of these.

# CUPP interactive mode — asks questions about the target
cupp -i

# Example output generates: John1990, john1990!, John90, j0hn, etc.

Multilingual Wordlists

Password patterns vary significantly across languages and cultures. A Spanish-speaking user might use "contrasena123" while a German user might choose "passwort2024". When targeting organizations with international employees, include wordlists in relevant languages. Projects like the Universal Password List and language-specific breach data address this need.

Crunch — Systematic Wordlist Generation

Crunch is a command-line tool that generates wordlists based on specified criteria. Unlike breach-based lists, Crunch creates every possible combination within your parameters — making it exhaustive but potentially enormous.

Installation

# Debian/Ubuntu/Kali
sudo apt-get install crunch

# macOS (Homebrew)
brew install crunch

Basic Usage

The core syntax is crunch <min-len> <max-len> [charset] [options]:

# All combinations from 8 to 10 characters using the default charset
crunch 8 10 -o custom_dict.txt

# Only lowercase letters and digits
crunch 8 10 abcdefghijklmnopqrstuvwxyz0123456789 -o custom_dict2.txt

# Only digits, 4 to 6 characters (PINs)
crunch 4 6 0123456789 -o pins.txt

Pattern-Based Generation

The -t flag lets you define patterns using placeholder characters:

PlaceholderMatches
@Lowercase letters (a-z)
,Uppercase letters (A-Z)
%Digits (0-9)
^Special characters
# Pattern: 4 letters followed by 4 digits (e.g., "pass1234")
crunch 8 8 -t @@@@%%%% -o pattern_dict.txt

# Pattern: Uppercase first, lowercase rest, two digits, one symbol
crunch 8 8 -t ,@@@@@%^ -o complex_pattern.txt

Size Considerations

Crunch can generate astronomically large files. Before running a command, estimate the output size:

Tip: Use Crunch's -b flag to split output into multiple files of a specified size: crunch 8 8 -t @@@@%%%% -b 1gb -o START

CeWL — Website-Based Wordlist Generation

CeWL (Custom Word List generator) spiders a website and extracts unique words to build a wordlist. This is particularly effective when targeting an organization, because employees frequently use company jargon, product names, project codenames, and other domain-specific terms as passwords or password components.

Installation

# Ruby gem
gem install cewl

# Kali Linux (pre-installed)
which cewl

Basic Usage

# Spider a website and save unique words
cewl -w web_dict.txt http://example.com

# Set minimum word length to 6 and spider depth to 3 levels
cewl -m 6 -d 3 -w web_dict.txt http://example.com

# Include email addresses found on the site
cewl -e --email_file emails.txt -w web_dict.txt http://example.com

# Extract words from document metadata (PDF, DOCX, etc.)
cewl --meta -w web_dict.txt http://example.com

# Verbose output to see progress
cewl -v -w web_dict.txt http://example.com

Why CeWL Works

Consider a company called "NovaTech Solutions" that makes a product called "StarBridge". CeWL would extract words like "NovaTech", "StarBridge", "Solutions", "innovation", and other terms from the website. Combined with rules, these become candidates like "NovaTech2024!", "starbridge123", "Solutions!", and so on — exactly the kind of passwords employees tend to choose.

Hashcat Rules for Wordlist Manipulation

Hashcat rules are the most powerful way to multiply the effectiveness of any wordlist. Rather than storing every variation on disk, rules generate candidates on the fly during an attack. A wordlist of 10 million words combined with 64 rules produces 640 million candidates — with zero additional disk space.

Using Rule Files

# Apply the best64 rule set
hashcat -m 0 hashes.txt wordlist.txt -r /usr/share/hashcat/rules/best64.rule

# Stack multiple rule files (each word gets rules from BOTH files applied)
hashcat -m 0 hashes.txt wordlist.txt -r rules1.rule -r rules2.rule

# Generate rule candidates to stdout (for testing)
hashcat --stdout wordlist.txt -r best64.rule | head -20

Built-in Rule Files

Rule FileRule CountBest For
best64.rule64Fast initial attacks. The 64 most statistically effective rules.
d3ad0ne.rule~34,000Thorough attacks when you have time. Aggressive mutations.
dive.rule~99,000Maximum coverage. Use overnight or when other methods fail.
toggles1.rule - toggles5.rulevariesCase toggling at specific positions. Good for mixed-case policies.
leetspeak.rulevariesCommon character substitutions (a->@, e->3, etc.).

Rule Syntax Reference

Each line in a rule file contains one or more operations. Multiple operations on the same line are applied sequentially to each word:

RuleDescriptionInputOutput
:Do nothing (passthrough)passwordpassword
lLowercase all charactersPassWordpassword
uUppercase all characterspasswordPASSWORD
cCapitalize first, lowercase restpasswordPassword
CLowercase first, uppercase restpasswordpASSWORD
tToggle case of all charactersPassWordpASSwORD
TNToggle case at position NpasswordPassword (T0)
rReverse the wordpassworddrowssap
dDuplicate the wordpasspasspass
$XAppend character Xpasswordpassword1 ($1)
^XPrepend character Xpassword1password (^1)
sXYReplace character X with Ypasswordp@ssword (sa@)
[Delete first characterpasswordassword
]Delete last characterpasswordpasswor
'NTruncate at position Npasswordpass ('4)

Writing Custom Rules

You can combine operations on a single line. They are applied left to right:

# Rule: capitalize first letter, append "123"
# c $1 $2 $3
# "password" → "Password" → "Password1" → "Password12" → "Password123"

# Rule: replace 'a' with '@', append '!'
# sa@ $!
# "password" → "p@ssword" → "p@ssword!"

# Rule: uppercase all, prepend "!" and append "!"
# u ^! $!
# "password" → "PASSWORD" → "!PASSWORD" → "!PASSWORD!"

Save your custom rules to a .rule file (one rule per line) and use it with the -r flag.

Combining Wordlists

In practice, the most effective approach uses multiple wordlists from different sources. Combining them ensures broad coverage while deduplication keeps the file manageable.

# Basic combination with deduplication
cat dict1.txt dict2.txt | sort -u > combined.txt

# Combine multiple sources
cat rockyou.txt web_dict.txt custom_dict.txt personal.txt | sort -u > mega_dict.txt

# Check the result
wc -l mega_dict.txt
head -20 mega_dict.txt

Optimization Strategies

Attack Strategy: Putting It All Together

A methodical approach to wordlist-based cracking follows this escalation pattern:

  1. Quick win: Top 1000 passwords + best64.rule
  2. Standard: RockYou + best64.rule
  3. Targeted: CeWL output from target website + d3ad0ne.rule
  4. Personalized: CUPP-generated list + best64.rule
  5. Combined: All sources merged + dive.rule
  6. Exhaustive: CrackStation mega-list + dive.rule (may take days)

Further Reading