web hacking

Gobuster: Directory, DNS and Virtual Host Bruteforcing for Web Enumeration

Gobuster: Directory, DNS and Virtual Host Bruteforcing for Web Enumeration

Gobuster is a fast tool for brute-forcing directories, DNS, and virtual hosts. A practical guide to using it for web enumeration during a penetration test.

  • Posted on 2026-02-09
  • Reading time: 7 min

Finding hidden directories, exposed configuration files, and undocumented virtual hosts is the first step in compromising a web application. Gobuster does exactly that: it launches massive HTTP requests against a target using wordlists, identifying paths and resources that don't appear in the site's visible links.

Written in Go, Gobuster is fast and can handle hundreds of parallel requests without performance issues. It supports three main modes: dir for bruteforce directories/files, dns for subdomain enumeration and vhost for virtual host discovery. Unlike older tools like DirBuster, Gobuster is command-line, scriptable, and easily integrated into automated pipelines.

It occurs in the Reconnaissance phase of the kill chain (MITRE ATT&CK T1595.003). The article covers all modalities, including wordlist selection, status codes to interpret, and operational integration with scanners and exploits.


Setup and Installation #

Kali Linux (pre-installed):

bash
gobuster version

Output:

text
gobuster v3.6

Manual installation:

bash
sudo apt install gobuster

From source (latest version):

bash
go install github.com/OJ/gobuster/v3@latest

The track is located in ~/go/bin/gobuster.

Necessary wordlists:

Gobuster doesn't include wordlists. The best ones for web enumeration come from SecLists:

bash
sudo apt install seclists

Typical paths:

  • /usr/share/seclists/Discovery/Web-Content/common.txt → 4.727 entries, fast scan
  • /usr/share/seclists/Discovery/Web-Content/directory-list-2.3-medium.txt → 220.560 entries, deep scan
  • /usr/share/seclists/Discovery/DNS/subdomains-top1million-5000.txt → for subdomain enum

Basic Use #

Dir mode — Bruteforce directory #

bash
gobuster dir -u http://10.10.10.50 -w /usr/share/seclists/Discovery/Web-Content/common.txt

Output:

text
===============================================================
Gobuster v3.6
===============================================================
[+] Url:           http://10.10.10.50
[+] Threads:       10
[+] Wordlist:      common.txt
===============================================================
/.htaccess            (Status: 403) [Size: 277]
/admin                (Status: 301) [Size: 313]
/api                  (Status: 200) [Size: 0]
/backup               (Status: 301) [Size: 315]
/config               (Status: 403) [Size: 277]
/login                (Status: 200) [Size: 1523]
/uploads              (Status: 301) [Size: 316]
/server-status        (Status: 403) [Size: 277]
===============================================================

Reading output:

  • 200 → Accessible page, ready to explore
  • 301 → Redirect (existing directory)
  • 403 → Forbidden (exists but not accessible — potential misconfiguration)
  • 404 → Not found (Gobuster filters them by default)

DNS mode — Subdomain enumeration #

bash
gobuster dns -d target.com -w /usr/share/seclists/Discovery/DNS/subdomains-top1million-5000.txt

Output:

text
Found: mail.target.com
Found: vpn.target.com
Found: dev.target.com
Found: staging.target.com
Found: api.target.com

vhost mode — Virtual host discovery #

bash
gobuster vhost -u http://10.10.10.50 -w /usr/share/seclists/Discovery/DNS/subdomains-top1million-5000.txt --append-domain

Useful when multiple applications are hosted on the same IP with virtual hosting.


Operating Techniques #

Search for files with specific extensions #

Don't just search directories. Search for configuration files, backups, and scripts:

bash
gobuster dir -u http://10.10.10.50 -w /usr/share/seclists/Discovery/Web-Content/common.txt -x php,txt,bak,old,conf,sql,zip

Output:

text
/config.php.bak       (Status: 200) [Size: 482]
/database.sql         (Status: 200) [Size: 15728]
/backup.zip           (Status: 200) [Size: 3472890]
/.env                 (Status: 200) [Size: 312]

Un .env exposed or a downloadable SQL backup are game over for many applications.

Filter by response size #

Many applications return 200s on everything with a custom error page. Filter by size:

bash
gobuster dir -u http://10.10.10.50 -w wordlist.txt --exclude-length 1523

If the custom 404 page has size 1523, all responses with that size are filtered.

HTTP Basic Authentication #

bash
gobuster dir -u http://10.10.10.50/admin -w wordlist.txt -U admin -P password123
bash
gobuster dir -u http://10.10.10.50/dashboard -w wordlist.txt -c "PHPSESSID=abc123def456"

Scan behind login — find features accessible only to authenticated users.

Custom User Agent #

WAFs and applications can block scanner user-agents:

bash
gobuster dir -u http://target.com -w wordlist.txt -a "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36"

HTTPS with invalid certificates #

bash
gobuster dir -u https://10.10.10.50 -w wordlist.txt -k

The flag -k ignore SSL certificate errors.


Advanced Techniques #

Recursive Bruteforce #

Gobuster doesn't support built-in recursion. It simulates this with a wrapper:

bash
gobuster dir -u http://10.10.10.50 -w common.txt -o first_pass.txt
grep "Status: 301" first_pass.txt | awk '{print $1}' | while read dir; do
  gobuster dir -u "http://10.10.10.50${dir}" -w common.txt -o "recursive_${dir//\//_}.txt"
done

For native recursion, use Dirsearch which supports it out of the box.

Pattern-based brute force #

Search for endpoints with numeric or temporal patterns:

bash
for i in $(seq 1 100); do echo "report_$i"; done > custom_wordlist.txt
gobuster dir -u http://10.10.10.50/documents/ -w custom_wordlist.txt -x pdf

Find files as report_42.pdf that would not appear in generic wordlists.

Parallelization on multiple targets #

bash
cat web_targets.txt | xargs -P 5 -I {} gobuster dir -u http://{} -w common.txt -o gobuster_{}.txt -q

5 parallel instances of Gobuster, one per target. The flag -q suppresses header for clean output.

Fuzzing parameters with fuzz mode #

Gobuster v3.6 includes a fuzz mode for searching parameters:

bash
gobuster fuzz -u http://10.10.10.50/api/FUZZ -w /usr/share/seclists/Discovery/Web-Content/burp-parameter-names.txt

FUZZ is replaced with each entry in the wordlist.


Practical Pentest Scenarios #

Scenario 1: CTF/HTB Web Application — Finding the Admin Panel #

bash
gobuster dir -u http://10.10.10.50 -w /usr/share/seclists/Discovery/Web-Content/directory-list-2.3-medium.txt -x php,html -t 50

Expected output:

text
/index.php            (Status: 200) [Size: 8421]
/login.php            (Status: 200) [Size: 2103]
/admin                (Status: 301) [Size: 313]
/backup               (Status: 301) [Size: 315]
/secret               (Status: 301) [Size: 315]

What to do if it fails:

  • All paths return 200 → The application has a custom 404 page. Identify the size of the 404: curl -s http://target/nonexistent | wc -c. Then: --exclude-length SIZE.
  • Rate limiting active → Reduce thread: -t 5. Add delay: --delay 200ms.

Timeline: Wordlist common (4.7K): 30 seconds. Medium (220K): 5-10 minutes at 50 threads.

Scenario 2: Enterprise Web App — Post-Authentication Enumeration #

bash
gobuster dir -u https://portal.corp.local/app -w /usr/share/seclists/Discovery/Web-Content/raft-medium-directories.txt -c "session=eyJhbGciOiJIUzI1NiJ9..." -k -x json,xml -t 30

Expected output:

text
/app/api/users        (Status: 200) [Size: 4521]
/app/api/config       (Status: 200) [Size: 891]
/app/admin/settings   (Status: 200) [Size: 3210]
/app/debug            (Status: 200) [Size: 156]

What to do if it fails:

  • 401 Unauthorized on all → The session cookie has expired. Renew your session and update the cookie.
  • WAF blocks requests → Change User-Agent and reduce the rate. Try headers. X-Forwarded-For: 127.0.0.1.

Timeline: 3-8 minutes with raft-medium wordlist.

Scenario 3: Subdomain enumeration on external target #

bash
gobuster dns -d target.com -w /usr/share/seclists/Discovery/DNS/subdomains-top1million-20000.txt -t 50

Expected output:

text
Found: dev.target.com
Found: staging.target.com
Found: jenkins.target.com
Found: grafana.target.com

What to do if it fails:

  • Wildcard DNS active (all resolves) → Use --wildcard for automatic detection. If wildcard is confirmed, switch to tools like ffuf with response size filtering.
  • Few results → Change DNS resolver: -r 8.8.8.8The default resolver may filter or cache.

Timeline: 20K subdomains at 50 threads: 1-2 minutes.


Toolchain Integration #

Gobuster is the link between web port discovery (Masscan/Nmap) and exploitation.

Operational flow:

Masscan (port scan) → Nmap (service ID) → Gobuster (content discovery) → Burp Suite / sqlmap / manual exploit

Data transfer:

bash
# Da Nmap: estrai host con porta 80/443
grep "80/open\|443/open" nmap_scan.gnmap | awk '{print $2}' > web_hosts.txt

# Gobuster su ciascuno
while read host; do
  gobuster dir -u "http://$host" -w common.txt -o "gobuster_$host.txt" -q
done < web_hosts.txt
FeaturesGobusterDirsearchfufDirBuster
LanguageGoPythonGoJava
Swift ★ ★ ★ ★ ★★★★ ☆☆★ ★ ★ ★ ★★★☆☆☆
Native recursionNoYesNoYes
DNS ModeYesNoNoNo
vhost modeYesNoYesNo
Advanced filteringBaseBaseAdvancedBase
Machine maintenanceAttivaAttivaAttivaAbandoned

Attack Chain Complete #

Objective: Access a web server via an exposed backup file.

Phase 1 — Port Discovery (3 min)

bash
sudo masscan 10.10.10.0/24 -p 80,443,8080,8443 --rate 1000

You find 10.10.10.50 with port 80 and 8080 open.

Phase 2 — Content Discovery with Gobuster (8 min)

bash
gobuster dir -u http://10.10.10.50 -w directory-list-2.3-medium.txt -x php,bak,zip,sql -t 50

trovi /backup/site.zip (Status: 200).

Phase 3 — Backup Analysis (10 min)

Download the file. Inside you will find config.php with database credentials and a file .git/ with the history of the code.

Phase 4 — Exploitation (15 min)

The credentials in the backup grant access to the database. You find an SQL injection in the source code and exploit it to execute commands.

Phase 5 — Post-exploitation (20 min)

You install a Weevely3 web shell for persistence and start internal enumeration.

Total timeline: ~56 minutes.


Detection & Evasion #

What the Blue Team monitors #

  • Abnormal HTTP request volume from a single IP (hundreds of 404s in a few seconds)
  • WAF rules that match User-Agents of known scanners (Gobuster default: gobuster/3.6)
  • Sequential pattern of requests to non-existent paths

Relevant logs #

  • Apache/Nginx access log → hundreds of 404 entries from the same IP
  • WAF log (ModSecurity, Cloudflare, AWS WAF) → directory traversal and file probing patterns
  • SIEM → correlation between request volume and source IP

Evasion techniques #

  1. Legitimate User-Agent: -a "Mozilla/5.0 (Windows NT 10.0; Win64; x64) Chrome/120.0.0.0". Removes the Gobuster fingerprint.
  2. Voluntary rate limiting: -t 5 --delay 500msKeep the volume below the detection threshold.
  3. Source IP rotation: If possible, route traffic through multiple proxies to distribute requests across different IPs.

Cleanup #

Gobuster leaves no artifacts on the target. The only traces are entries in the web server logs.


Performance & Scaling #

Optimal threads: The default is 10. For robust targets, 50-100 threads work well. Above 100, you risk saturating the target or experiencing rate limiting.

Wordlist and times:

WordlistEntryTime (~50 threads)
common.txt4.727~15 sec
directory-list-2.3-small.txt87.664~ 3 min
directory-list-2.3-medium.txt220.560~ 8 min
raft-large-directories.txt62.284~ 2 min

Extensions: Each extension added multiplies the number of requests. With -x php,txt,bak on common.txt: 4.727 × 4 = 18.908 requests.

Resource Consumption: Gobuster uses about 20-40MB of RAM and minimal CPU. The bottleneck is always the target's network or rate limiting.


Technical Tables #

Command Reference #

FlagDescription
dirBruteforce directory mode
dnsSubdomain DNS mode
vhostVirtual host mode
fuzzFuzzing mode
-u URLTarget URL
-w wordlistPath to the wordlist
-t NThread number
-x ext1,ext2Extensions to look for
-s codesStatus code to display
-b codesStatus code to be excluded
--exclude-length NExclude answers by size
-c cookieSession cookies
-kIgnore SSL errors
-a agentCustom User Agent
-o fileOutput to file
-qQuiet mode (no header)
--delay durationDelay between requests

Recommended wordlists by scenario #

ScreenwritingWordlistEntryNote
quick scancommon.txt4.727First quick pass
In-depth scandirectory-list-2.3-medium.txt220.560Standards for CTF and pentests
API discoveryapi-endpoints.txt~ 2.000Specific to REST API
Backup filesraft-large-files.txt37.042Search for residual files
Subdomainsubdomains-top1million-5000.txt5.000Quick subdomain enum

Troubleshooting #

ProblemCauseFix
All paths return 200custom 404 pageUsa --exclude-length with 404 page size
Too many false positivesWildcard DNS or generic redirectIdentify the pattern and filter with -b o --exclude-length
connection refusedTarget unreachable or wrong portCheck connectivity: curl -I URL
Slow scanLow threads or slow networkIncrease thread: -t 50
Too many open filesUlimit too lowulimit -n 10000 before throwing
WAF blocks requestsRecognized User-AgentChange with -a "Mozilla/..."

FAQ #

Is Gobuster better than ffuf? It depends. Gobuster is simpler and includes native DNS/vhost modes. ffuf is more flexible for advanced fuzzing with fine-grained filtering. For basic brute-force directories, they are equivalent.

Which wordlist do I use for the first scan? common.txt of SecLists. If you don't find anything, go down to directory-list-2.3-medium.txt.

Does Gobuster support recursion? No, it doesn't. Use Dirsearch if you need automatic recursion, or script the recursion with a bash wrapper.

Can I use Gobuster through a proxy? Yup: gobuster dir -u URL -w wordlist --proxy socks5://127.0.0.1:1080Works with HTTP and SOCKS5 proxies.

How do I manage rate limiting? Reduce thread (-t 5), add delay (--delay 500ms) and change the User-Agent. If the WAF is aggressive, use IP rotation via proxy chains.

Can Gobuster find GET parameters? Not natively. Use the mode fuzz with FUZZ in the URL: gobuster fuzz -u http://target/page?FUZZ=test -w params.txt.


Cheat sheet #

ActionCommand
Quick scan dirgobuster dir -u URL -w common.txt
Dir with extensionsgobuster dir -u URL -w wordlist -x php,txt,bak
Elevated Threadsgobuster dir -u URL -w wordlist -t 50
With cookiesgobuster dir -u URL -w wordlist -c "session=..."
HTTPS no cert checkgobuster dir -u https://URL -w wordlist -k
Subdomain enumgobuster dns -d domain.com -w subdomains.txt
Vhost discoverygobuster vhost -u URL -w subdomains.txt --append-domain
Fuzzinggobuster fuzz -u URL/FUZZ -w wordlist
Via proxygobuster dir -u URL -w wordlist --proxy socks5://127.0.0.1:1080
Output to filegobuster dir -u URL -w wordlist -o results.txt

Disclaimer: Gobuster is an open-source security assessment tool. Using it on targets without authorization is illegal. Always obtain written permission before running scans. Repository: github.com/OJ/gobuster.


Want to support HackIta? Visit hackita.it/supporto to donate. For professional penetration testing and one-on-one training, check out hackita.it/servizi.

#directory-enumeration

leave a message

I'm not a robot