Subdomain enumeration finds the hostnames that exist under a domain, and its two families fail in opposite directions. Passive enumeration reads what third parties already recorded, so it returns names that no longer exist. Active enumeration generates candidates and resolves them, so it only finds names somebody already thought to ask for.
One subfinder run against tesla.com returns more than six hundred names in seconds, and well under half of them still resolve.
Either family on its own gives a confident and wrong picture, so the steps below run both and check the output of each.
The tools are subfinder, dnsx, puredns and httpx.
Passive enumeration only reads public logs, so it runs against tesla.com, which runs a published bug bounty and whose certificates and DNS records are already in databases anyone can query.
Active enumeration sends packets, so it runs against vulnweb.com, a set of deliberately vulnerable hosts Acunetix publishes for people to point scanners at.
The two families of subdomain enumeration
Passive enumeration collects subdomain names from third parties that already recorded them: certificate transparency logs, passive DNS aggregators, search indexes, and autonomous system number (ASN) and WHOIS pivots. You never send a packet to the target, because you are querying somebody else's copy of the data.
Active enumeration generates candidate names and resolves them against the nameservers that answer for the domain. Every query reaches the target's DNS infrastructure, and a brute force sends a lot of them.
| Passive | Active | |
|---|---|---|
| What it queries | Third-party logs and aggregators | The domain's own nameservers |
| What the target sees | Nothing | Every lookup you make |
| Tools used here | subfinder | puredns, dnsx |
| Finds | Names that were published somewhere, once | Names matching a wordlist you supply |
| Fails by | Returning dead names, and missing anything never logged | Missing anything unconventional, and trusting bad resolvers |
The first is quiet and turns up things nobody meant to publish. The second is loud and turns up things nobody published at all.
Passive enumeration with subfinder
subfinder queries around thirty passive sources at once, including certificate transparency, passive DNS and threat-intel feeds, then unions the answers and deduplicates them.
It shows most of what has ever been published about a domain and touches nothing the target owns.
subfinder -d tesla.com
subfinder returned more than six hundred names in a few seconds, and no request reached the target. The list holds names that were published at some point, which says nothing about which hosts exist today.
Resolving the passive list with dnsx
Certificate transparency is append-only, so a certificate issued in 2021 stays in the log even if the host it covered was torn down the week after. A name in subfinder's output therefore says only that the name was published somewhere, once. Whether it points at anything today is a DNS question.
dnsx takes the list and resolves it.
Pipe subfinder straight into it.
subfinder -d tesla.com -silent | dnsx -a -resp -r 1.1.1.1,8.8.8.8![dnsx output: eleven akamai-apigateway hostnames under tesla.com, each followed by a blue [A] record type and a green IP address, and every one of those addresses is 23.193.108.68](https://cdn.0xexploitlabs.org/blog/passive-vs-active-subdomain-enumeration/resolve.534c57bc.webp)
Well under half of the names survive. Names go dead when staging environments are retired, when per-deploy hostnames expire after an afternoon, or when a service shuts down and its certificate lives on. In the unresolved list you cannot tell which names are live and which are dead. dnsx resolved each name, and well under half still answered.
-r 1.1.1.1,8.8.8.8 names the resolvers explicitly.
The default resolver pool rate-limited a bulk run this size down to nothing halfway through, and two fast public resolvers made the result reproducible.
Bad resolvers produce wrong answers in active enumeration, and the sections below come back to them.
Testing for a wildcard DNS record
From here on, every command sends packets, so the target is vulnweb.com.
A wildcard DNS record can invalidate a brute force before it starts.
A wildcard is an entry such as *.example.com that answers for any name at that level, so every name you invent resolves, and the brute force reports your whole wordlist as live hosts.
To catch one, resolve names that cannot exist and read the response status instead of the answer, because a timeout and a genuinely missing name both print nothing.
for i in 1 2 3; do
n="$(openssl rand -hex 6).vulnweb.com"
printf '%-38s %s\n' "$n" "$(dig "$n" +noall +comment | grep -oE 'status: [A-Z]+')"
done
Each of the three comes back NXDOMAIN, the DNS status code for a non-existent domain: the nameserver states that the name does not exist instead of failing to answer.
So there is no wildcard here, and a positive result means something.
On a domain that does answer a wildcard, all three come back with an address, and a 100,000-word brute force reports 100,000 live hosts with no evidence behind any of them.
Test every branch, not only the apex.
*.dev.example.com can exist while the apex has no wildcard, so one test says nothing about the rest of the tree.
Brute forcing subdomains with puredns
With no wildcard present, you can invent names and resolve them.
puredns drives massdns through a wordlist, resolves against a pool of public resolvers, filters wildcards, and re-checks every hit against a trusted resolver so a flaky answer does not become a false positive.
puredns bruteforce subdomains.txt vulnweb.com \
-r resolvers.txt --resolvers-trusted resolvers.txt
It found three hosts: www, rest and localhost, all plain words that were already in the list.
It missed testphp, testasp, testaspnet and testhtml5, the actual applications on this domain, each a live host that the passive pass and the probe below both see.
A wordlist only finds names that someone already put in it, so a brute force misses any host whose name does not follow a common pattern.
Run passive first and permute what it finds, instead of relying on a generic list to guess the names.
Probing live hosts with httpx
A name that resolves has an address, but that does not mean anything is listening there, or that what listens is what you assume.
httpx sends one request per host and reports the status code, the page title and the stack it fingerprints.
These five names share one owner and look nearly identical at the DNS layer, yet they are five different applications.
httpx -u testphp.vulnweb.com,testasp.vulnweb.com,testaspnet.vulnweb.com,rest.vulnweb.com,testhtml5.vulnweb.com \
-status-code -title -tech-detect
Every host returns 200, and each is a different thing underneath: a PHP application on Apache, a classic ASP forum on Microsoft Internet Information Services (IIS), an ASP.NET application, an HTML5 site and an Invicti REST API.
Resolution gave five addresses.
The probe shows what runs on each and on which stack, so you can pick the one worth your afternoon.
One command turns the name list into a target list.
Every command from the wildcard test down sent a packet to a server, which is why they ran against vulnweb.com and the passive pass did not.
Where passive enumeration is wrong
It returns names that no longer resolve. On a long-lived domain with automated certificate issuance, expect well over half of the passive names to be dead on arrival.
It only sees names that were logged somewhere.
It misses an internal service behind a private certificate authority (CA), a plain-HTTP host that never got a certificate, and a name that only appears as the target of a canonical name (CNAME) record.
A wildcard certificate is the worst case: one log entry, *.example.com, covers every real name beneath it.
Its freshness is somebody else's decision. Passive DNS aggregators sample, so two of them queried on the same day can return different sets. Neither is wrong, and that is why subfinder unions several sources.
Where active enumeration is wrong
A wordlist only knows the names someone thought of.
The brute force above found www, rest and localhost from five thousand words and missed every testphp-style host on the domain.
It finds api, staging and vpn because every list has them.
It cannot find pf-edge-04, tenant-7719 or jenkins-old-do-not-delete, and hosts named like that are often the ones worth finding.
Permute the names you already have instead of relying on a generic list.
Resolvers change the answer.
Public resolvers rate-limit, cache negative answers aggressively, and some return an ad-server address for a name that does not exist.
A brute force through a bad pool gives false negatives from the rate limiting and false positives from the hijacked answers, in the same output, with nothing marking which is which.
So puredns re-validates every hit against a trusted resolver, and the dnsx run named its resolvers by hand.
Check your resolvers against a known-good and a known-bad name before a long run, and again during it.
The full enumeration sequence, step by step
- Go passive first, and go wide.
subfinder -d targetunions thirty sources in one command. Do not throw away odd-looking names before resolving them. - Test for wildcards at the apex and at every branch before you trust a positive.
- Resolve through named resolvers.
dnsx -r 1.1.1.1,8.8.8.8, keeping the full response. Most of the passive list falls away here. - Brute force, then permute.
puredns bruteforceclears wildcards and validates hits, but a generic wordlist only finds conventional names. Seed the active pass with what resolved and permute those. - Probe what survived.
httpx -status-code -title -tech-detectseparates a live site from a dead record, and one stack from another, which turns a name list into a target list. - Diff against last time. The most valuable output of recon is not the list. It is what changed since the last run.
A first enumeration of a large domain gives you hundreds of names and no sense of which ones matter. Run it again after a week and compare the two lists. The names that appear only in the new list are the ones that changed, and those are worth reading one at a time.
Authorisation, and choosing a target
The passive pass named tesla.com because certificate transparency and passive DNS are already public, and reading them touches nothing Tesla owns.
The wildcard test, the brute force and the probe all sent packets, so they ran against vulnweb.com, which Acunetix publishes so people can point scanners at it.
Passive data is public, but that does not make acting on it allowed.
Active enumeration sends traffic to real infrastructure, and resolving, brute-forcing or probing a name is that kind of traffic.
Tesla runs a published bug bounty, so testing *.tesla.com inside its scope is authorized.
A scope is narrower than a whole domain, though: it names hosts that are off-limits, and the existence of a bug bounty does not mean anything you do there is fine.
When you do not have that authorization in writing, use a domain that exists to be tested.
Get the scope, know which names are inside it, and know which ones belong to a shared-tenancy provider rather than your target.
