30 Days of CTF Series | Day 10: Directory and Content Discovery (Find Hidden Pages and Files)

Welcome to Day 10 of the 30 Days of CTF series.
On Day 8, you found a secret admin path inside robots.txt. But most developers do not list their secret pages anywhere. The admin panel, the old backup file, the test page someone forgot to delete: they are all sitting on the server, just not linked from any page.
If you cannot click on it, how do you find it? You guess, very fast, using a list of thousands of common names. This is called directory and content discovery (also called directory brute forcing or fuzzing), and it is one of the first things you do on any web challenge.
Practice labs for Day 10:
Only Fuzz What You Are Allowed To
Discovery tools send thousands of requests in a short time. Only run them against CTF targets and lab machines you have permission to test, never against random websites.
How Discovery Works
The idea is simple:
- Take a wordlist, a text file with common names like
admin, login, backup, uploads, config.
- For every word, request
http://target.com/<word>.
- Look at the status code of each response.
- Anything that is not
404 Not Found is interesting.
Remember the status codes from Day 8:
200: the page exists and you can see it
301 / 302: it exists and redirects (often a folder, like /admin to /admin/)
401 / 403: it exists, but you are not allowed in yet
404: not found, ignore it
Step 0: Manual Discovery First
Before running any tool, always check these by hand (it takes one minute):
/robots.txt
/sitemap.xml
/.git/
/admin
/login
/backup
/index.php.bak
Also read the page source and JavaScript files for paths like /api/v1/ or /dev/. Tools are great, but your eyes find things tools miss.
Wordlists: The Real Secret
A discovery tool is only as good as its wordlist. On Kali Linux, many are already installed:
/usr/share/wordlists/dirb/common.txt (small, about 4,600 words, start here)
/usr/share/wordlists/dirbuster/directory-list-2.3-medium.txt (big, about 220,000 words)
If the dirbuster list is missing on your system, install it with sudo apt install dirbuster.
The most popular collection is SecLists:
$ sudo apt install seclists
It installs to /usr/share/seclists/. Useful lists inside it:
/usr/share/seclists/Discovery/Web-Content/common.txt
/usr/share/seclists/Discovery/Web-Content/raft-medium-directories.txt
/usr/share/seclists/Discovery/Web-Content/raft-medium-files.txt
Tip: Start with a small list. If you find nothing, move to a bigger one.
Tool 1: Gobuster
Gobuster is simple and fast. Install it if needed:
$ sudo apt install gobuster
Basic directory scan:
$ gobuster dir -u http://target.com -w /usr/share/wordlists/dirb/common.txt
dir means directory mode
-u is the target URL
-w is the wordlist
Look for files with extensions too:
$ gobuster dir -u http://target.com -w /usr/share/wordlists/dirb/common.txt -x php,txt,bak,zip
-x adds each extension to every word, so config also becomes config.php, config.txt, config.bak and config.zip. Backup files like .bak and .zip are gold in CTFs.
Hide noisy status codes:
$ gobuster dir -u http://target.com -w common.txt -b 404,403
Tool 2: ffuf (Fuzz Faster U Fool)
ffuf is extremely fast and very flexible. It uses the keyword FUZZ to mark where the words from your list should go.
$ sudo apt install ffuf
Basic directory scan:
$ ffuf -u http://target.com/FUZZ -w /usr/share/wordlists/dirb/common.txt
Add extensions:
$ ffuf -u http://target.com/FUZZ -w common.txt -e .php,.txt,.bak
Show only useful status codes:
$ ffuf -u http://target.com/FUZZ -w common.txt -mc 200,301,302,403
Filter out fake results:
Some websites return 200 OK for every path, even ones that do not exist (they just show a “page not found” message with status 200). Every result then looks valid. Look at the Size column: all the fake results will have the same size. Filter that size out:
$ ffuf -u http://target.com/FUZZ -w common.txt -fs 1534
-fs 1534 means “hide responses that are exactly 1534 bytes”. This one trick saves you from thousands of false results.
FUZZ can go anywhere:
$ ffuf -u "http://target.com/page.php?FUZZ=test" -w params.txt # guess parameter names
$ ffuf -u "http://target.com/user?id=FUZZ" -w numbers.txt # guess IDs
This is why ffuf is so popular. It is not only for directories.
Tool 3: dirsearch
dirsearch comes with its own built in wordlist and common extensions, so it is the easiest for beginners:
$ sudo apt install dirsearch
$ dirsearch -u http://target.com
Going Deeper: Recursion
When you find a folder like /admin/, there may be more inside it. Run the tool again on that folder:
$ ffuf -u http://target.com/admin/FUZZ -w common.txt
Or let ffuf do it automatically:
$ ffuf -u http://target.com/FUZZ -w common.txt -recursion -recursion-depth 2
Interesting Things to Watch For
When you see these in your results, stop and check them right away:
.git/: the website’s source code history may be exposed. Tools like git-dumper can download the whole repository.
.bak, .old, .swp, ~: backup copies of real files, often containing source code or passwords.
.zip, .tar.gz: full website backups.
/uploads/: may list uploaded files (and will matter on Day 13).
/admin, /dashboard, /panel: admin areas.
/api/: hidden API endpoints.
phpinfo.php, info.php: server configuration details.
config, .env: settings files with passwords and secret keys.
Let’s Solve a Challenge Together
A challenge gives you a website and says:
“Our developer swears there is nothing else on this site except the homepage.”
Step 1: Manual check.
$ curl http://target.com/robots.txt
404 Not Found
Nothing there. Time for a tool.
Step 2: Run ffuf with a small wordlist and some extensions.
$ ffuf -u http://target.com/FUZZ -w /usr/share/wordlists/dirb/common.txt -e .php,.bak,.txt -mc 200,301,403
index.php [Status: 200, Size: 2310]
admin [Status: 403, Size: 277]
backup [Status: 301, Size: 312]
Three results. /admin is forbidden for now. /backup is a folder. Let’s look inside it.
Step 3: Visit the backup folder.
$ curl http://target.com/backup/
Index of /backup
config.php.bak
notes.txt
The server shows a directory listing, a list of every file in the folder.
Step 4: Read the files.
$ curl http://target.com/backup/notes.txt
TODO: remove old config backup before going live!!
$ curl http://target.com/backup/config.php.bak
<?php
$db_user = "admin";
$db_pass = "S3cr3tP@ss";
// HackCTF{d1sc0v3ry_f1nds_f0rg0tt3n_f1l3s}
?>
Flag captured. And a username and password too, which could open that /admin page.
Notice why the .bak file was readable: a normal config.php would be executed by the server and show nothing. But config.php.bak is treated as plain text, so the server shows you the full source code. That is why backup files are so dangerous.
Try It Yourself on Hacklido
1. DVWA
Run gobuster or ffuf against your DVWA lab and compare the results with the pages you can see in the menu. Look for folders and files that are not linked anywhere, like configuration and documentation folders.
Link: open learn.hacklido.com/learn and select DVWA.
2. bWAPP
bWAPP has many pages. Use dirsearch on it and practice reading results: which status codes did you get, and which paths were worth opening?
Link: open learn.hacklido.com/learn and select bWAPP.
3. Metasploitable 2
On Day 5, you scanned this machine with Nmap and found a web server. Now run directory discovery on that web server. You will find several web applications and folders hiding there.
Link: open learn.hacklido.com/learn and select Metasploitable 2.
4. SARGazer (Root Quest)
A Root Quest lab where you exploit a forgotten monitoring dashboard. Use today’s discovery skills to find it first. The full exploitation will make more sense after Week 4, so for now, focus on enumeration and discovery.
Link: learn.hacklido.com/rootquest/sargazer
Day 10 Cheat Sheet
Save this in your notes:
- Check manually first: robots.txt, sitemap.xml, .git/, admin, backup, source code
- Wordlists: start with
dirb/common.txt, then SecLists raft-medium-*
gobuster dir -u URL -w LIST: basic scan
gobuster ... -x php,txt,bak,zip: add extensions
ffuf -u URL/FUZZ -w LIST: basic scan
ffuf ... -e .php,.bak: add extensions
ffuf ... -mc 200,301,403: show only these codes
ffuf ... -fs SIZE: hide fake results of the same size
ffuf ... -recursion: go inside found folders
dirsearch -u URL: easiest, built in wordlist
- Gold findings: .git, .bak, .zip, .env, config, uploads, admin, api
- 403 is not the end: the page exists, come back to it
Day 10 Task
What’s Next?
In Day 11, we will learn our first real web vulnerability: SQL Injection. You will see how one single quote ' in a login form can break a website’s database query, and how attackers use it to log in without a password.
See you tomorrow on Day 11. Happy hacking.