← All lessons Stage 2 · Lesson 4
20 min

Subdomains, directories and content discovery

Stage 2 · Lesson 4 · 20 minutes · Requires Lesson 3


The one-line answer

Much of an application is never linked from its own pages — content discovery is how you find the directories, files and subdomains the owner forgot about.

The boundary: passive sources (robots.txt, certificate logs) are public. Brute-forcing directories or subdomains sends many requests to a server — that is active testing and needs authorisation. Practise on labs and OWASP Juice Shop running on your own machine.


Why you should care

In Lesson 3 you mapped everything an application shows you. But applications collect leftovers: a /backup/ folder, an old /admin-v1/ page, a staging. subdomain someone set up for testing two years ago. Nobody links to them, so nobody maintains them — which makes them some of the weakest parts of an organisation.

A large share of real bug bounty findings start exactly here: not with a clever attack, but with finding something that was never supposed to be reachable.


How it actually works

"Unlinked is not protected"

Recall Stage 0, lab 03 (the hidden endpoint). If a page exists on the server and the server doesn't check who's asking, anyone who types the URL gets it. Not linking to it hides it from casual users — not from anyone who looks.

Free recon: files the site publishes itself

robots.txt — tells search engines what not to index:

User-agent: *
Disallow: /admin/
Disallow: /internal-reports/

It's a request to polite crawlers, not a lock. And it's often a neat list of exactly the places the owner considers sensitive (recall Stage 0, lab 01).

sitemap.xml — the opposite: a list of pages the owner wants indexed. Sometimes it includes pages that aren't linked anywhere else.

Certificate transparency: finding subdomains for free

Recall Stage 0 Lesson 4 (DNS). Every HTTPS certificate issued by a public authority is recorded in public certificate transparency (CT) logs. When a company gets a certificate for staging.example.com, that name becomes public.

Sites like crt.sh let you search these logs. Searching %.example.com lists subdomains that have ever had a certificate — often including dev., test., vpn., old.. This is entirely passive: you're reading a public log, not touching the company's servers.

Wordlist-based discovery (the concept)

For directories and files, there's no public log. So testers guess — systematically. A tool takes a wordlist (a list of common names like admin, backup, config, api, .git, test) and requests each one:

GET /admin       → 404
GET /backup      → 404
GET /api         → 200   ← exists
GET /.git/       → 403   ← exists, but blocked (still interesting)
GET /old         → 301   ← redirects somewhere

You read the results the same way as Lesson 2: status codes and response lengths. Anything that isn't the normal "not found" is worth noting.

  • Wordlists: the most widely used free collection is SecLists (on GitHub). It has lists for directories, files, subdomains, parameters and more.
  • Tools: common free tools include ffuf, gobuster and feroxbuster. Burp Community can do small versions of this with Intruder (slowly — Lesson 2).

You don't need to master a tool now. Understand the idea: send many guesses, look for responses that differ from "not found".

A note on "soft 404s": some sites return 200 with a "page not found" message for everything. Then status codes are useless and you compare response length instead.

Burp's built-in discovery

Burp Pro includes a content discovery feature; in Community, Intruder with a short wordlist does the same job at learning scale. Results also feed into the site map from Lesson 3.

Why staging and dev subdomains matter

staging.example.com and dev.example.com are where developers try new code. They're often:

  • running older or debug versions with verbose errors,
  • protected with weak or default passwords — or none,
  • forgotten after the project ends but left running.

Recall Stage 0 Lesson 4 on subdomain takeover: when a subdomain still points (via DNS) to a cloud service the company no longer uses, someone else can sometimes claim that service and serve content on the company's name.


See it yourself

  1. Passive, safe anywhere: visit https://www.google.com/robots.txt and any large site's /robots.txt. What do they ask crawlers not to visit? (Reading a public file is fine. Visiting the disallowed paths on a site you're not authorised to test is not.)
  2. Passive: search crt.sh for a domain you own — or for learntechfacile.com — and look at what names appear.
  3. Active, on your own machine: run OWASP Juice Shop locally (instructions on its project page). With Burp running, check its /robots.txt, then try a few likely paths by hand in Repeater: /ftp, /admin, /backup. Note status codes and lengths.
  4. Active, on a lab: in an Information disclosure lab, send the home page request to Intruder, add a position on the path, use a tiny list (10–20 words) and sort results by status and length.

How attackers abuse this

  • Exposed backups and config files — backup.zip, config.old, .env — can contain passwords, API keys or the whole source code.
  • Exposed .git folders can let someone download the application's full source and history.
  • Forgotten admin panels on old paths or staging subdomains, often with weaker protection.
  • Subdomain takeover to host phishing pages on a trusted company name.

The defensive fix:

  • Never rely on robots.txt for secrecy. Don't list sensitive paths there at all — protect them with authentication instead.
  • Require authentication and authorisation on every endpoint, linked or not.
  • Keep deploys clean: no backups, .git folders, .env files or test pages in the web root.
  • Decommission properly: when a project or cloud service ends, delete the DNS record too. Keep an inventory of subdomains — CT logs show you what attackers see.
  • Monitor for bursts of 404s from one address — a classic sign of directory brute-forcing (a Stage 5 detection).

Common mistakes

  • Treating 403 as "nothing there". A 403 confirms the path exists. Note it.
  • Only checking status codes on sites that return 200 for everything. Compare lengths.
  • Giant wordlists first. Start small and relevant (e.g. a short common-directories list). Huge lists are slow and noisy.
  • Brute-forcing without permission. Thousands of requests against a site you don't have authorisation for is not "just looking".
  • Forgetting the passive sources. robots.txt, sitemap.xml and CT logs cost nothing and often give the best leads.

Check yourself

  1. A site's robots.txt says Disallow: /internal/. Is /internal/ protected? Why or why not?
  2. How can you find a company's subdomains without sending a single request to their servers?
  3. Directory brute-forcing returns 404 for most words, 403 for /.git/, and 200 for /backup/. Which results matter and why?
Answers
  1. No. robots.txt is only a request to well-behaved crawlers. Anyone can read it and visit the path. Only authentication and authorisation on the server protect /internal/.
  2. Search certificate transparency logs (e.g. crt.sh). Certificates issued for subdomains are publicly logged.
  3. Both /.git/ (403 means it exists — exposed source code is a serious risk if it's ever readable) and /backup/ (200 means it's reachable — check what it contains). The 404s simply don't exist.

Your lab

  • PortSwigger Information disclosure labs: https://portswigger.net/web-security/information-disclosure
  • OWASP Juice Shop, run locally on your own machine: https://owasp.org/www-project-juice-shop/ — find its hidden directory using only the techniques in this lesson.

Writeup: what you found, how you found it (passive or active), and the fix.


Summary in your language

தமிழில் சுருக்கம்

ஒரு application-இன் பல பகுதிகள் அதன் pages-இல் link செய்யப்படுவதில்லை — content discovery மூலம் மறக்கப்பட்ட directories, files, subdomains-ஐக் கண்டுபிடிக்கலாம். robots.txt, sitemap.xml, certificate transparency logs (crt.sh) ஆகியவை இலவசமான passive வழிகள். Wordlist கொண்டு பல பெயர்களை முயற்சிப்பது active சோதனை — அதற்கு அனுமதி தேவை. Link இல்லை என்றால் பாதுகாப்பு இல்லை. பாதுகாப்பு: ஒவ்வொரு endpoint-க்கும் authentication, web root-இல் backup/.git/.env கோப்புகள் இல்லாமல் இருத்தல், பயன்படாத subdomain-களின் DNS பதிவுகளை நீக்குதல்.

हिंदी में सारांश

किसी application के कई हिस्से उसके pages पर link नहीं होते — content discovery से भूले हुए directories, files और subdomains मिलते हैं। robots.txt, sitemap.xml और certificate transparency logs (crt.sh) मुफ़्त passive तरीके हैं। Wordlist से कई नाम आज़माना active testing है — इसके लिए अनुमति चाहिए। Link न होना सुरक्षा नहीं है। बचाव: हर endpoint पर authentication, web root में backup/.git/.env files न रखना, और बंद हुई services के subdomain के DNS records हटाना।

Want this summary in Malayalam, Telugu, Kannada or another language? Tell us — the most requested languages get added next.


What's next

You've found what's there — now work out what it's running: Fingerprinting: what is this thing running?