Commands / Attacking a web app

Attacking a web app

gobuster

Also content discovery, directory brute force, forced browsing, dirb

Guesses a web server's paths and files from a wordlist, keeping the ones that answer.

A web server serves any path it has, linked or not. gobuster dir -u URL -w WORDLIST requests each name in the wordlist and prints the ones that answer, with their status and size — so an old backup or admin page that no page links shows up anyway. It needs both -u and -w: with no wordlist it refuses, because it invents nothing. -q quiets everything but the finds; -x php,txt also tries each name with those extensions. (It also has dns and vhost modes for subdomains and virtual hosts.)

gobuster command usage

gobuster dir -u URL -w WORDLIST [-q] [-x EXTENSIONS] [-t THREADS] [-s CODES] [-b CODES] [-k] [-r] [-o FILE]
gobuster dns -d DOMAIN -w WORDLIST
gobuster --help

Options

dir
directory/file discovery mode (there are also dns and vhost modes)
-u http://10.0.1.20
the target URL to guess paths under
-w /usr/share/dirb/wordlists/common.txt
the wordlist of names to try; without it gobuster refuses
-q
quiet: print only the paths that answered, not the banner or progress
-x php,txt
also request each name with these extensions appended
-t 40
how many requests to make at once (threads)
-s 200,301
show only these status codes
-b 404
treat these status codes as not-found and hide them (the default hides 404)
-r
follow redirects instead of reporting them
-k
accept any TLS certificate (for an https target)
-o finds.txt
also write the results to the file after it

gobuster examples

gobuster dir -u http://10.0.1.20 -w /usr/share/dirb/wordlists/common.txt -q
Guesses common paths on the target and prints only the ones that answer.
backup               (Status: 200) [Size: 250]
gobuster dir -u http://10.0.1.20 -w /usr/share/dirb/wordlists/common.txt -x php,txt -q
Also tries each name as name.php and name.txt.

Pitfalls

  • No -w and it stops at Required flag "wordlist" not set: a path-guesser is only its wordlist.
  • A path missing from the wordlist is never found; a bigger or site-specific list finds more.

Run it on real machines

Learn it on real machines.

Every lab is a small network of real Linux machines in your browser. Sign in with Google or email to start.

Start this lab