user@ctrlaltinfiltrate:~$ viewing “Gobuster Masterclass”

Gobuster Masterclass

Gobuster Masterclass

Mission Brief: “How to Enumerate with Gobuster.”


1. What is Gobuster

Gobuster is a fast, command‑line tool written in Go for brute‑forcing URIs (files and directories), DNS subdomains, virtual hosts, cloud storage buckets (S3/GCS), TFTP files, and HTTP parameter fuzzing using wordlists.


2. Tool Category: Enumeration

Category: Enumeration
Gobuster discovers hidden resources by systematically probing a target with wordlists. It’s ideal for mapping web directories, finding subdomains, testing vhosts, and uncovering exposed buckets or parameters, all core enumeration tasks in pentesting.


3. Tool Overview

  • What it does:
    Uses customizable wordlists and patterns to brute‑force and enumerate various targets (web paths, DNS names, vhosts, buckets, TFTP, fuzz inputs).
  • Common use‑cases:
  • Web directory/file discovery
  • Subdomain brute‑forcing
  • Virtual‑host probing
  • Cloud bucket enumeration (AWS S3, GCS)
  • TFTP file listing
  • HTTP parameter fuzzing

Exit Codes:

CodeMeaning
0Success (found at least one hit)
1Partial success / warnings
2Error (bad flags or syntax)

4. HTTP Status Codes

Gobuster reports any HTTP status codes encountered. Top 10 commonly seen:

StatusMeaning
200OK (resource exists)
301Moved Permanently
302Found (temporary redirect)
307Temporary Redirect
401Unauthorized (auth required)
403Forbidden (access denied)
404Not Found
500Internal Server Error
502Bad Gateway
503Service Unavailable

⚠️ Gobuster can show any HTTP status code—these are just the most frequent.


5. Flags & Options

🎛️ Global Flags

(apply to all modes)

FlagCategoryDescription
-w <file>, --wordlist <file>WordlistPath to wordlist.
-t <n>, --threads <n>PerformanceNumber of concurrent threads (default: 10).
-o <file>, --output <file>OutputWrite results to a file instead of stdout.
-q, --quietOutputSuppress banner and non‑result output.
-v, --verboseOutputShow verbose messages and errors.
--delay <duration>PerformanceDelay between requests (e.g. 500ms, 1s).
--timeout <duration>PerformanceRequest timeout (default: 10s).
--wordlist-offset <n>Wordlist ControlSkip first n entries in wordlist (resume capability).
-p <file>, --pattern <file>Wordlist‑PatternFile of regex patterns for substitution.
--no-colorOutputDisable colored output.
--no-errorOutputSuppress error messages.
-z, --no-progressOutputDon’t show progress bar.
-h, --helpHelpShow help for all modes/flags.
--versionHelpDisplay Gobuster version.

📂 Directory Mode Flags (dir)

FlagCategoryDescription
-u <url>, --url <url>TargetBase URL (e.g. http://<TARGET_IP>/).
-x <exts>, --extensions <exts>File FilteringTry only these extensions (comma‑separated, e.g. php,txt).
-r, --follow-redirectHTTPFollow HTTP redirects.
-s <codes>, --status-codes <codes>FilteringOnly report these status codes (e.g. 200,301).
-b <codes>, --status-codes-blacklistFilteringExclude these status codes (default: 404).
-e, --expandedOutputPrint full URLs instead of just paths.
-d, --discover-backupHTTPAlso look for common backup file extensions on found entries.
--exclude-length <lens>FilteringIgnore responses matching these body lengths.
-f, --add-slashHTTPAppend a slash (/) to each word before requesting.
-H <hdr>, --headers <hdr>HTTPAdd custom HTTP header(s).
-c <cookie>, --cookies <cookie>HTTPSend cookie(s) with each request.
-m <method>, --method <method>HTTPHTTP method to use (GET, POST, HEAD; default: GET).
-n, --no-statusOutputDon’t display status codes in results.
-k, --no-tls-validationHTTPSkip TLS certificate verification.
-U <user>, --username <user>AuthUsername for HTTP Basic Auth.
-P <pw>, --password <pw>AuthPassword for HTTP Basic Auth.
--proxy <url>ProxySend all requests via this proxy.
--random-agentHTTPUse a random User‑Agent for each request.
Example: Directory Mode
gobuster dir  -u http://<TARGET_IP>/  -w /home/kali/SecLists/Discovery/Web-Content/common.txt  -t 50  --timeout 30s  -o gobuster_dir_example.txt

This command brute‑forces common web directories on , using 50 threads, a 30 s timeout, and saves results to gobuster_dir_example.txt.


🌐 DNS Mode Flags (dns)

FlagCategoryDescription
-d <domain>, --domain <domain>TargetBase domain to enumerate (e.g. <TARGET_HOSTNAME>).
-r <resolver>, --resolver <res>DNSUse this DNS resolver (e.g. 8.8.8.8:53).
--no-fqdnDNSDon’t append system search domains to names.
--wildcardFilteringContinue even if wildcard DNS responses are detected.
-c, --show-cnameDNSDisplay CNAME records for found subdomains.
-i, --show-ipsDNSDisplay IP addresses alongside subdomains.
Example: DNS Mode
gobuster dns -d <TARGET_HOSTNAME> -w /home/kali/SecLists/Discovery/DNS/subdomains-top1million-20000.txt --no-fqdn -t 20 -z -o gobuster_dns_example.txt

This command brute‑forces subdomains of <TARGET_HOSTNAME> (wildcard tolerant), using 20 threads, no progress bar, and writes to gobuster_dns_example.txt.


🏠 Virtual‑Host Mode Flags (vhost)

FlagCategoryDescription
-u <url>, --url <url>TargetBase URL (e.g. http://<TARGET_IP>/).
--append-domainTarget FormattingAuto‑append .<domain> to each word (requires <domain>).
-r, --follow-redirectHTTPFollow HTTP redirects.
-H <hdr>, --headers <hdr>HTTPAdd custom HTTP header(s).
-c <cookie>, --cookies <cookie>HTTPSend cookie(s) with each request.
-k, --no-tls-validationHTTPSkip TLS certificate validation.
-U <user>, --username <user>AuthUsername for HTTP Basic Auth.
-P <pw>, --password <pw>AuthPassword for HTTP Basic Auth.
--proxy <url>ProxySend requests via this proxy.
--random-agentHTTPUse a random User‑Agent.
Example: VHost Mode
gobuster vhost -u http://<TARGET_IP>/ -w /home/kali/SecLists/Discovery/DNS/subdomains-top1million-20000.txt --append-domain -r -o gobuster_vhost_example.txt

This command probes virtual hosts by appending . to each word, follows redirects, and outputs to gobuster_vhost_example.txt.


☁️ S3 & GCS Modes Flags (s3/gcs)

FlagCategoryDescription
-m <n>, --maxfiles <n>Bucket ControlMax objects to list per bucket (verbose only).
--proxy <url>ProxySend requests via this proxy.
--random-agentHTTPUse a random User‑Agent.
--timeout <duration>PerformanceRequest timeout (default: 10s).
Example: S3 Mode
gobuster s3 <TARGET_IP> -w /home/kali/SecLists/Discovery/DNS/subdomains-top1million-20000.txt -m 20 --random-agent -o gobuster_s3_example.txt
Example: GCS Mode
gobuster gcs <TARGET_IP> -w /home/kali/SecLists/Discovery/DNS/subdomains-top1million-20000.txt -m 20 --random-agent -o gobuster_gcs_example.txt

These commands list up to 20 objects in S3 or GCS buckets on , randomizing the User‑Agent.


📡 TFTP Mode Flags (tftp)

FlagCategoryDescription
-s <server>, --server <srv>TargetTFTP server address.
-p <port>, --port <port>TFTP ControlTFTP port (default: 69).
-w <file>, --wordlist <file>WordlistList of filenames to request.
--timeout <duration>PerformanceRequest timeout (default: 1s).
Example: TFTP Mode
gobuster tftp -s <TARGET_IP> -w /home/kali/SecLists/Discovery/Web-Content/common.txt --timeout 2s -o gobuster_tftp_example.txt

This command requests common filenames from the TFTP server on , using a 2 s timeout.


🔀 Fuzz Mode Flags (fuzz)

FlagCategoryDescription
-u <url>, --url <url>TargetURL containing the FUZZ placeholder (e.g. ?id=FUZZ).
--data <data>HTTP‑BodyPOST body with FUZZ placeholders (e.g. pass=FUZZ).
-H <hdr>, --headers <hdr>HTTPHeader(s) with FUZZ placeholders (e.g. -H "X-API: FUZZ").
-w <file>, --wordlist <file>WordlistPath to wordlist.
-m <n>, --maxfiles <n>PerformanceThreads or max items for fuzzing (mode‑dependent).
--pattern <file>Wordlist‑PatternFile of regex patterns for substitution.
Example: Fuzz Mode
gobuster fuzz -u http://<TARGET_IP>/login --data "user=admin&pass=FUZZ" -w /home/kali/SecLists/Discovery/Web-Content/common.txt --random-agent -o gobuster_fuzz_example.txt
This command fuzzes the login endpoint’s pass parameter with common.txt, randomizes User‑Agent, and saves results.

6. Setup & Prerequisites

  1. Serve DVWA at root of default vhost
Bash
 ssh dvwa@192.168.171.131
Bash
sudo nano /etc/apache2/sites-available/000-default.conf
   
   # Change:
   #   DocumentRoot /var/www/html
   # To:
   #   DocumentRoot /var/www/html/dvwa
Bash
sudo systemctl reload apache2


2. **Configure `/etc/hosts`** **on your attacker machine:**
Bash
192.168.171.131 dvwa.local
192.168.171.131 admin.dvwa.local
192.168.171.131 dev.dvwa.local
  1. Burp Proxy
  • In Burp → Proxy → Intercept, ensure “Intercept is off” so Gobuster’s traffic flows automatically.
  1. Increase Gobuster Timeout
  • When proxying through Burp, add --timeout 30s (or higher) to avoid client‑timeout errors.

Build Your Own Command


7. Further Reading & Resources

  • Official Gobuster Repo: https://github.com/OJ/gobuster
  • Usage & Flags Guide: https://github.com/OJ/gobuster#usage
  • SecLists Wordlists: https://github.com/danielmiessler/SecLists
  • PDF Cheat Sheet:

8. Final Tips

  • 💡 Threading vs. Server Load: Raise -t for speed but monitor target stability and IDS/IPS triggers.
  • 💡 Filter Smartly: Use -s and -b in tandem to focus on relevant status codes.
  • 💡 Resume Large Scans: Employ --wordlist-offset to pick up where you left off.
  • ⚠️ Wildcard Detection: Always test with --wildcard to avoid false positives on catch‑all domains.
  • ⚠️ Proxying Best Practices: Combine --timeout with --no-progress when funneling through intercepting proxies.
  • 💡 Output Automation: Leverage JSON or CSV outputs for easy integration into scripts and reports.

Happy Hacking!

About the Author

Thomas Charlesworth

Thomas Charlesworth

Ethical Hacker & AI Engineer

I blend offensive security with custom LLM tooling to empower teams with private, lightning-fast insights. Certified in A+, Network+, Security+, PenTest+—next up, CEH.

Leave a Reply

Your email address will not be published. Required fields are marked *