On this page

Subdomain enumeration is the process of finding every subdomain of a domain, such as api.example.com or staging.example.com. You combine passive sources (certificate transparency logs, passive DNS and search engines) with active techniques (DNS brute force and permutations), then resolve and probe the results to find live hosts. It is the first step of most external penetration tests, VAPT engagements and attack surface reviews.

This guide covers each technique, the tools that do the work (subfinder, amass, dnsx and httpx), how to triage the results, and how to turn a one-off script into repeatable discovery.

Why subdomain enumeration matters

Attackers rarely start with your main website. They start with whatever you forgot: a staging server with debug mode on, an old admin panel, a campaign microsite on an abandoned hosting account. Every subdomain is a potential entry point, and most organizations have more of them than they think.

Good enumeration gives you:

  • A complete target list for a pentest, so nothing in scope is missed.
  • Shadow IT visibility: services stood up outside normal change processes.
  • Takeover candidates: DNS records still pointing at cloud resources that no longer exist.
  • A baseline to compare against, so you notice new hosts as they appear.

Before you start: authorization and scope

Passive enumeration reads public data and does not touch the target. Active enumeration sends DNS queries and HTTP requests to infrastructure you may not own. Treat both with care:

  • Get written authorization before any active testing, with the domains in scope listed explicitly.
  • Confirm ownership of what you find. A subdomain can point at a third party such as a CDN, SaaS platform or hosting provider. Testing that provider’s infrastructure needs its own permission.
  • Follow program rules in bug bounty work, including scope and rate limits.
  • Throttle active work. Aggressive brute forcing can overload DNS resolvers and trigger alerts.

If in doubt, stay passive.

Passive subdomain enumeration

Passive techniques collect names from third-party data sets. They are quiet, fast and often surprisingly complete.

Certificate transparency logs

Publicly trusted TLS certificates are recorded in public certificate transparency (CT) logs. Each certificate lists the hostnames it covers, so CT logs reveal subdomains as soon as a certificate is issued, often before the service is announced.

You can query CT data through search services such as crt.sh:

curl -s "https://crt.sh/?q=%25.example.com&output=json" \
  | jq -r '.[].name_value' \
  | sed 's/^\*\.//' \
  | sort -u

Two limitations: wildcard certificates (*.example.com) hide individual names, and internal hosts that use a private certificate authority never appear.

Passive DNS data

Passive DNS providers record DNS resolutions observed over time. They reveal subdomains that resolved in the past, even if they no longer appear on any certificate, and historical IP addresses that can expose origin servers behind a CDN. Most providers require an API key and limit free queries.

Search engines and internet-wide scan data

Search engines index subdomains that serve public content. A query such as site:example.com -site:www.example.com surfaces hosts beyond the main website.

Internet-wide scan engines go further. They index services by hostname, TLS certificate, page title and banner, so you can find hosts that share an organization’s certificate or favicon, even on IP ranges you did not know about.

Other passive sources

  • Web archives list URLs captured over the years, including subdomains that no longer exist.
  • Public code repositories leak hostnames in configuration files and CI scripts.
  • The application’s own JavaScript often references API, asset and third-party hosts.

Passive tools: subfinder and amass

You rarely query each source by hand. These tools aggregate many sources in one run:

# subfinder: fast passive enumeration across many sources
subfinder -d example.com -all -silent -o passive.txt

# amass v4+: enum is passive by default (the old -passive flag is deprecated)
amass enum -d example.com

Both tools return far more with API keys for the sources they support. subfinder reads keys from ~/.config/subfinder/provider-config.yaml. Flags change between major versions, especially for amass, so check -h for the version you have installed.

Active subdomain enumeration

Active techniques find names that no data set has seen: hosts that never had a public certificate and never served indexed content.

DNS brute force with wordlists

Brute forcing tries candidate names (dev, vpn, api-v2, jenkins) against the domain’s DNS and keeps the ones that resolve. dnsx handles this directly:

dnsx -d example.com -w subdomains.txt -silent -o brute.txt

Wordlist choice matters more than tool choice. Start with a curated list of common names (SecLists ships several sizes), then add terms specific to the target: product names, internal project names, regional codes and environment names.

Check for wildcard DNS first

Some domains answer every query, so anything-at-all.example.com resolves. If you do not handle this, brute forcing “finds” every word in your list. Test with a random label before you start:

dig +short x7k2q9-does-not-exist.example.com

If that returns an address, the domain uses wildcard DNS. Use a tool with wildcard filtering, such as puredns or the wildcard options in dnsx, or compare each answer with the wildcard response and discard matches.

Permutations and alterations

Once you know some real names, generate variations of them. If api.example.com and dev.example.com exist, then api-dev, dev-api and api2 are good guesses. Tools such as alterx, dnsgen and gotator create these permutations. Feed them names you have already confirmed:

alterx -l known.txt -silent | dnsx -silent -o perms.txt

Permutation lists grow fast. Run them against confirmed names only, and expect diminishing returns after one round.

Zone transfers

A misconfigured name server may hand over the whole zone. It is rare, but it takes seconds to check:

dig axfr example.com @ns1.example.com

Resolve and probe: from names to live hosts

Not every name you find is alive. This step turns a list of names into a list of targets.

Resolve every candidate and keep the names that return a record:

cat passive.txt brute.txt perms.txt | sort -u > all.txt
dnsx -l all.txt -silent -o resolved.txt

Probe each resolved host for web services with httpx. This is ProjectDiscovery’s httpx, not the Python HTTP client of the same name. It reports the status code, page title and detected technologies:

httpx -l resolved.txt -sc -title -td -silent -o live.txt

The output looks something like this:

https://api.example.com [200] [API Gateway] [Nginx]
https://staging.example.com [401] [Sign in] [Express]
https://old.example.com [404] [Not Found] [Apache HTTP Server]
https://jenkins.example.com [403] [Forbidden] [Jetty]

Triage: what to look at first

Signal Why it matters
Names like dev, staging, test, old, beta Non-production systems often have weaker controls and debug features enabled
401 or 403 on admin or CI tools Something sensitive is reachable from the internet, even if it is protected
Default pages and “Index of” titles Unconfigured servers and open directory listings
CNAME to a cloud service that returns an error A possible subdomain takeover
Outdated technology versions Known vulnerabilities to check against CVE data
Hosts that are new since the last scan Changes that may have skipped security review

Subdomain takeover

A takeover happens when a DNS record points to an external resource, such as a cloud storage bucket or a hosted app, that has been deleted. An attacker who claims the same resource name on that service can then serve content on your subdomain. List CNAME records with dnsx -l resolved.txt -cname -resp and look for providers that return “not found” style errors. Confirm carefully, and report rather than exploit.

Putting it together: a repeatable pipeline

# 1. Passive sources
subfinder -d example.com -all -silent -o passive.txt

# 2. Brute force (after checking for wildcard DNS)
dnsx -d example.com -w subdomains.txt -silent -o brute.txt

# 3. Merge, de-duplicate and resolve
cat passive.txt brute.txt | sort -u | dnsx -silent -o resolved.txt

# 4. Permutations of confirmed names
alterx -l resolved.txt -silent | dnsx -silent -o perms.txt

# 5. Probe everything that resolves
cat resolved.txt perms.txt | sort -u | httpx -sc -title -td -silent -o live.txt

Run it once and you have a snapshot. Run it regularly and compare the results, and you have the beginnings of attack surface monitoring. Your attack surface changes every time someone ships a service, so a one-off list goes stale quickly.

How WhyXpose automates subdomain enumeration

Scripts like this work, but they leave you maintaining API keys, servers, output files and diffs by hand. WhyXpose takes care of the repetitive parts:

  • Attack Surface Discovery stores your company’s domains as assets. For each domain, it queries passive data sources, then checks every host for HTTP status, page title and technology. You can filter by status code, review probe history (what changed between scans) and scan history, and export results to CSV.
  • Recon Canvas lets you build pipelines such as Domain → Whois → Subdomains → Live hosts → Vulnerability scan by drag and drop. Each run is split across a pool of cloud machines, and the results are merged and de-duplicated. You can upload custom wordlists and watch per-node progress live.
  • AI-guided recon lets WhyXpose AI plan and run recon and scan pipelines and choose next steps, and certified pentesters verify what it finds before anything reaches your report.
  • Scope is enforced. Only domains in your company’s own assets can be scanned, and cloud machines are destroyed when the run ends.

Scheduled runs and new-host monitoring are coming soon. Need expert testers to go deeper on what you find? See our penetration testing services.

Book a demo to see discovery and Recon Canvas in action.

Put this guide into practice

Subdomains from passive sources, every host checked, and experts who validate what discovery finds.

Explore attack surface discovery