learn/phase-2/p2-w8/lesson 06
Milestone 8 · lesson 6

Subdomain Enumeration: Passive & Active Recon

Hands-on: run subfinder, amass intel, gobuster, httpx, dig axfr in the sandbox terminal.
Lab: The Subdomain They Forgot

Brute-force DNS to find a subdomain passive tools miss, then read it.

What you'll learn

  • Explain what a subdomain is and why finding them all expands the attack surface.
  • Understand how passive tools actually work: Certificate Transparency, API aggregation, search-engine dorking.
  • Use ASN scanning (amass intel) to map an organisation's whole network space, not just one domain.
  • Tell a subdomain (DNS-level) apart from a virtual host (server-level), and know when each discovery method applies.
  • Use active techniques: DNS brute-forcing, permutations, virtual-host fuzzing, and zone transfers.
  • Resolve and probe found names with dnsx and httpx to keep only the live hosts.

Subdomain Enumeration: Passive & Active Recon

What is a subdomain, and why hunt for them?

A subdomain is an extension of a company's main domain, used to split off a specific part of their online presence: api.acme.com, dev.acme.com, blog.acme.com. The root domain acme.com might be a polished, well-defended marketing site, while dev-portal.acme.com is a forgotten test server nobody patched in two years.

Every subdomain is a separate door into the organisation, sometimes an entirely different application, a different team, a different (often weaker) level of security. Before a single exploit is attempted, mapping every one of these doors is what Subdomain Enumeration is for, and it is usually the very first step of a penetration test or bug bounty engagement.

Passive vs active

PassiveActive
Talks to the target?No, queries third partiesYes, sends DNS/HTTP to the target
Noise / detectionSilentCan trip rate limits / WAFs
FindsAnything ever made publicHidden names not in public data

Real recon uses both: passive first (free and silent), then active to fill the gaps.

Passive enumeration

Certificate Transparency: how crt.sh actually works

Every publicly trusted TLS certificate a Certificate Authority issues gets logged forever in a public, tamper-proof ledger called Certificate Transparency (CT). This was built so anyone could audit which certificates exist for a domain, but it doubles as a subdomain goldmine: if internal-api.acme.com ever got an HTTPS certificate, even briefly, it is permanently recorded, whether or not it still resolves today. crt.sh is simply a web search interface over these logs.

curl -s 'https://crt.sh/?q=%.acme.com&output=json' | jq -r '.[].name_value' | sort -u

CertSpotter offers the same CT log data but as a queryable API instead of a web page, useful for scripting:

curl -s 'https://api.certspotter.com/v1/issuances?domain=acme.com&include_subdomains=true&expand=dns_names'

How aggregator tools like subfinder actually find results

You might assume subfinder scans acme.com directly. It mostly doesn't. Tools like subfinder and amass are API aggregators: they fire off requests to dozens of third-party sources at once, CT log services, Shodan, BinaryEdge, SecurityTrails, and more, then merge and de-duplicate whatever comes back into one clean list. Because the data is already indexed on someone else's servers, this can map an organisation's public-facing surface in seconds without a single packet reaching the target itself.

subfinder -d acme.com -all -silent -o subfinder.txt
amass enum -passive -d acme.com -o amass.txt
assetfinder --subs-only acme.com

Search-engine dorking

Search engines crawl and index huge amounts of the internet, including subdomains you'd never guess. A dork query filters that index down to just the target:

site:*.acme.com -site:www.acme.com

This finds every indexed page on any acme.com subdomain while excluding the main www site, surfacing the unusual ones search engines happened to crawl.

ASN scanning: mapping the whole network, not just one domain

So far every technique starts from a domain name. ASN scanning flips the approach: it starts from the organisation's network ownership.

An ASN (Autonomous System Number) identifies a block of IP address space that one organisation controls on the internet. Large companies often own their own ASN. Once you find it, you can enumerate every IP address and domain hosted inside it, including infrastructure that has nothing to do with acme.com by name but is still owned and run by Acme.

amass intel -org "Acme"          # find ASNs and netblocks belonging to the org
amass intel -asn 12345           # given an ASN, list its netblocks and domains

This is how you catch infrastructure that a plain subdomain scan would completely miss, a separate acquired company, a legacy brand, a raw IP with no DNS name pointing at it at all.

Subdomain vs virtual host, a distinction beginners miss

These two look similar in a URL but are found completely differently:

Subdomain (DNS level)Virtual Host (Server level)
Where it livesAn A/CNAME record in public DNSA routing rule inside Apache/Nginx config
VisibilityVisible to public DNS and OSINT toolsOften invisible to DNS, hidden from the outside
How it's foundPassive discovery (crt.sh, subfinder)Active fuzzing (ffuf spraying the Host header)
What routes the requestThe internet routes you to an IP by DNSThe web server then routes you to a folder/app by the Host header you sent

In short: DNS gets you to the right server; the Host: header then tells that server which site to actually serve. A server can quietly host ten virtual hosts with no public DNS record pointing at nine of them, which is exactly why active vhost fuzzing (below) matters even after passive recon is done.

Active enumeration

DNS brute-forcing

Take a wordlist (see the wordlists lesson, the SecLists DNS lists are the standard) and test every word.acme.com. This finds names that were never published anywhere public, and were therefore invisible to every passive method above.

gobuster dns -d acme.com -w /usr/share/seclists/Discovery/DNS/subdomains-top1million-5000.txt
puredns bruteforce wordlist.txt acme.com -r resolvers.txt

Permutations

Mutate names you've already found (api -> api-dev, api2, staging-api) with dnsgen, gotator, or altdns, then resolve the candidates. This catches predictable naming patterns a plain wordlist would never guess.

Virtual-host (vhost) fuzzing

Spray the Host: header against a single IP to reveal the hidden vhosts discussed above:

ffuf -u https://acme.com -H 'Host: FUZZ.acme.com' -w wordlist.txt -mc 200,403

Zone transfer (AXFR)

A misconfigured nameserver will hand you the entire DNS zone in one request, an instant, complete list:

dig axfr @ns1.acme.com acme.com

Most servers refuse this, but it is always worth one try. The public zonetransfer.me zone is left open on purpose so you can see a successful dump.

Resolve, then probe

A raw name list is full of dead entries. Two steps clean it up:

  1. Resolve which names actually point somewhere (dnsx).
  2. Probe which of those run a live web server (httpx / httprobe).
cat subfinder.txt amass.txt | sort -u | dnsx -silent > resolved.txt
httpx -l resolved.txt -title -sc -ip

A [403] or [401] host is still alive, do not throw away non-200 results; locked-down admin panels are exactly what you want to find.

Try it (terminal)

  1. subfinder -d acme.com , see the passive results.
  2. curl -s 'https://crt.sh/?q=%.acme.com' , certificate transparency names.
  3. amass intel -org acme , map the ASN and netblocks the org owns.
  4. gobuster dns -d acme.com -w wordlist.txt , notice it finds internal, jenkins, git that passive missed.
  5. ffuf -u https://FUZZ.acme.com -w wordlist.txt , vhost fuzzing.
  6. httpx -l subs.txt , probe which names are live web servers.
  7. dig axfr @ns1.acme.com acme.com (refused), then dig axfr @nsztm1.digi.ninja zonetransfer.me (leaks the zone).

Stay in scope

Active enumeration sends real traffic. Only test domains you are authorised to (your own, or those in a bug-bounty program's scope). Rate-limit brute force, respect robots.txt and program rules, or you will get your IP banned, or worse.

Why this matters

The biggest bugs are usually not on the main site, they are on the forgotten dev, staging, or admin subdomain nobody patched. Thorough subdomain enumeration, passive, active, and ASN-level, is the difference between testing one app and testing the company's whole exposed estate.

Check your understanding

10 questions

Type an answer and press Check. Grading is keyword-based and forgiving, so short answers are fine.

  1. 1

    A company's main site is acme.com. Give an example of a subdomain that might expose an internal or forgotten system.

  2. 2

    Write the subfinder command to passively enumerate subdomains of acme.com.

  3. 3

    crt.sh finds subdomains by reading a public log of every TLS certificate a CA has ever issued. What is that log called?

  4. 4

    Tools like subfinder don't scan the target directly for most of their results. What do they do instead?

  5. 5

    Which amass subcommand finds the ASN (Autonomous System Number) and IP netblocks an organisation owns?

  6. 6

    Once you know an organisation's ASN, what can you discover across that whole network space?

  7. 7

    A subdomain lives in DNS records (A/CNAME); a virtual host is a routing rule inside the web server config (Apache/Nginx) and may not appear in public DNS at all. Which one does passive discovery (like subfinder) find?

  8. 8

    A passive scan misses internal.acme.com, but a DNS brute-force finds it. Which kind of enumeration discovered it, passive or active?

  9. 9

    Write the dig command that attempts a DNS zone transfer of acme.com from its nameserver ns1.acme.com.

  10. 10

    You have a list of names in subs.txt. Which tool probes them and keeps only the ones running a live web server?