Directory & Virtual Host Discovery
Concept
Web servers often expose admin panels, backups, or APIs that aren't linked from the visible site. Directory/content discovery brute-forces paths against a wordlist to surface them; virtual-host discovery finds additional sites hosted on the same IP under different Host headers.
When to Use
- Any HTTP/HTTPS service found during port scanning.
- When the visible site looks static/minimal but the box theme implies a web attack path.
Workflow
- 1Identify the tech stack
whatweb/curl headers to pick the right wordlist/extensions.
- 2Run directory discovery
gobuster/ffuf against common wordlists.
- 3Run vhost discovery if a domain name is involved
Especially if /etc/hosts or a hostname was given.
- 4Recurse into interesting directories
Re-run discovery inside found paths.
- 5Manually inspect each hit
View source, check for comments, backup extensions.
Commands
gobuster dir -u TARGET_URL -w FILE_PATH -x php,txt,bakgobuster dir -u http://10.10.11.25/ -w /usr/share/wordlists/dirb/common.txt -x php,txt,bak
Brute-forces directories/files on the target URL using a wordlist, also trying given extensions.
-u— Target URL, must include scheme (http/https).-w— Wordlist file path.-x— Comma-separated extensions to append to each word (php, txt, bak, etc.).
When to use: Default first pass once an HTTP service is confirmed.
Expected output:
/admin (Status: 301) /config.php.bak (Status: 200)
Look for: 3xx redirects (often real directories), 200s on files with backup extensions, 403s worth retrying with different casing.
Next step: Browse each hit; for .bak/.old/.txt files, download and read directly (may leak source/credentials).
ffuf -u TARGET_URL/FUZZ -w FILE_PATH -mc 200,301,302,403ffuf -u http://10.10.11.25/FUZZ -w /usr/share/wordlists/seclists/Discovery/Web-Content/raft-medium-files.txt -mc 200,301,302,403
Fast fuzzer; FUZZ marks the injection point replaced word-by-word from the wordlist.
-mc— Match only these HTTP status codes (filters noise).-fs— (not used here) filter responses by size — useful to hide a constant 'not found' page.
When to use: When gobuster's hit rate is too noisy, or you need to fuzz a parameter/subdomain, not just a path.
Expected output:
admin [Status: 301, Size: 0]
Look for: Responses with a different size/status than the baseline 404 page.
Next step: Investigate each match; recurse ffuf into subdirectories found.
ffuf -u TARGET_URL -H 'Host: FUZZ.TARGET_DOMAIN' -w FILE_PATH -fs SIZEffuf -u http://10.10.11.25 -H 'Host: FUZZ.example.htb' -w /usr/share/seclists/Discovery/DNS/subdomains-top1million-5000.txt -fs 1234
Virtual host discovery: fuzzes the Host header to find other sites served from the same IP.
-H— Custom header; here it injects FUZZ into the Host value.-fs SIZE— Filter out the default/wrong-vhost response size (find this baseline first).
When to use: When the box gives a domain name, or /etc/hosts needs a subdomain added to reach hidden content.
Expected output:
admin.example.htb [Status: 200, Size: 5421]
Look for: Any vhost whose response size differs from the default-site baseline.
Next step: Add the discovered vhost to /etc/hosts and browse it directly.
Tools
Gobuster
Directory, file, DNS and vhost brute-forcing.
When to use: General-purpose, fast, simple syntax — good default choice.
sudo apt install gobustergobuster dir -u URL -w WORDLISTExample workflow: gobuster dir on root -> inspect hits -> gobuster dns for subdomains if a domain is in scope.
FFUF
Highly flexible HTTP fuzzer (paths, params, headers, vhosts).
When to use: When you need filtering by response size/word count, or to fuzz something other than a path.
sudo apt install ffufffuf -u URL/FUZZ -w WORDLISTExample workflow: Baseline a known-404 response size, then filter it out with -fs while fuzzing.
WhatWeb
Fingerprints the web technology stack (CMS, server, frameworks).
When to use: Before choosing a wordlist/extension set, to tailor the fuzz to the stack (e.g. .aspx vs .php).
sudo apt install whatwebwhatweb TARGET_URLExample workflow: whatweb output showing WordPress -> pivot to WPScan instead of generic fuzzing.
Findings & Interpretation
Interesting
- /admin, /backup, /uploads, /.git, /api
- Config/backup files: config.php.bak, .env, web.config.bak
Suspicious
- Directory listing enabled (Apache 'Index of /')
- Inconsistent response sizes suggesting hidden logic (e.g. auth-gated content returning 200 instead of 403)
False Positives
- Custom 404 pages returning HTTP 200 — always baseline the 'not found' response size/content first
How to Validate
- Request the path directly with curl -i to see raw headers/body
- Diff response size against a known-nonexistent path
Next Step
- Feed any discovered CMS/framework into the Web Exploitation category.
- Download and grep any backup/config files for credentials.
Troubleshooting
Gobuster returns hundreds of false '200' hits for everything.
Likely cause: The app returns 200 for a custom 404/catch-all page instead of a real 404.
Verify: curl -i TARGET_URL/definitely-not-a-real-path and note the body size.
Fix: Re-run with --exclude-length <size> (gobuster) or -fs <size> (ffuf) to filter that constant size.
Recovery: Re-run the scan with the filter in place.
Avoid repeating: Always baseline a nonexistent path before trusting status-code filtering alone.