HackproofHacks
Tools8 min read

How to Find Subdomains of a Domain: 6 Methods That Work

Every forgotten subdomain is part of your attack surface. Six practical ways to find them, from a free online tool to command-line recon.

Hassan Ansari

Hassan Ansari

Why finding subdomains matters

A company rarely has just one website. There is the main site, then app., api., staging., old., vpn. and a long tail of services nobody remembers launching. Each one is part of the attack surface, and the forgotten ones are the most dangerous because nobody patches them.

That is why subdomain enumeration is usually the first step of both a bug bounty hunt and a penetration test. It is also something defenders should run against their own domains regularly. If you only want a quick answer, the free subdomain finder runs the passive methods below for you in one step.

Only test domains you own or have written permission to test.

Method 1: Certificate transparency logs

Every publicly trusted TLS certificate is recorded in public certificate transparency (CT) logs. Searching those logs for a domain reveals every hostname that has ever had a certificate, including ones that are not linked from anywhere. This is passive: you never touch the target.

The crt.sh service exposes a search over the logs. A query for %.example.com returns names under that domain:

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

CT logs are the single richest passive source, and they are what the online finder queries first. Their limit is that a subdomain that never had a public certificate will not appear.

Method 2: Passive DNS and data sources with subfinder

subfinder queries many passive sources at once, including CT logs, DNS datasets and search indexes, and prints the unique names it finds:

go install -v github.com/projectdiscovery/subfinder/v2/cmd/subfinder@latest
subfinder -d example.com -silent -o subs.txt

Adding API keys for sources that need them, through its provider configuration file, increases coverage noticeably.

Method 3: OWASP Amass

Amass combines passive collection with optional active techniques such as DNS resolution and name alterations. A passive-only run keeps it quiet:

amass enum -passive -d example.com -o amass-subs.txt

Because each tool queries a slightly different set of sources, running both subfinder and amass and merging the output beats running either alone.

Method 4: Search engines and archives

Search engines index subdomains that are linked somewhere public. A query such as site:example.com -www surfaces them. Web archives are another source: tools like waybackurls pull every URL the archive has seen for a domain, and the hostnames in that list often include subdomains that no longer appear in search.

echo example.com | waybackurls | awk -F/ '{print $3}' | sort -u

Method 5: DNS brute-forcing

Some subdomains never had a public certificate and are not linked anywhere. A brute-force approach tries a wordlist of likely names against the domain’s DNS and keeps the ones that resolve. This is an active technique, so only use it on domains you are permitted to test and keep the request rate reasonable.

subfinder -d example.com -silent | dnsx -silent
ffuf -u https://FUZZ.example.com -w names.txt -mc all -fs 0

The first line resolves the names you already collected to confirm they are live. The second shows host-header style fuzzing with ffuf once you have a wordlist.

Once you have a few IP addresses, reverse DNS and related-domain searches can reveal more hosts that share infrastructure. Checking the SSL certificate on a known host often lists additional names in its Subject Alternative Name field, which is a quick way to find siblings.

echo | openssl s_client -connect example.com:443 -servername example.com 2>/dev/null \
  | openssl x509 -noout -ext subjectAltName

What to do with the list

A raw list of names is only the start. Resolve each one to find which are live, note which sit behind a CDN such as Cloudflare, and check what is running on each. Look especially for:

  • Staging, test and development hosts that mirror production with weaker controls.
  • Admin panels and login pages exposed to the internet.
  • Subdomains whose DNS record points at a deleted cloud resource, which can allow subdomain takeover.
  • Outdated software versions with known vulnerabilities.

Check the HTTP security headers and SSL configuration of anything you find. For a structured next step, the website security audit guide walks through what to review on each host.

Quick comparison

Method Active or passive Finds Misses
CT logs Passive Any host that had a public certificate Hosts with no certificate
subfinder Passive Names from many public sources Private or unindexed names
amass Passive or active Broad coverage, name alterations Names outside its sources
Search and archives Passive Publicly linked or historic names Never-linked hosts
Brute-force Active Unlisted names on guessable words Names not in the wordlist
Reverse and SAN lookups Passive Sibling hosts on shared infrastructure Isolated hosts

Try it without installing anything

The free subdomain finder combines certificate transparency and DNS lookups, resolves each name, flags Cloudflare and lets you export the results. It is the fastest way to see what a domain exposes before you decide whether to go deeper with the command-line tools above.

If you find more exposure than you expected on your own domains, a web application penetration test will show what an attacker could do with it.

#subdomain finder#subdomain enumeration#recon#certificate transparency#subfinder#amass#osint
Free newsletter

Liked this? I write one like it every week.

One practical security lesson in your inbox each week, explained the same simple way. Join 10,000+ readers. Unsubscribe anytime.

From the article

Need a security assessment?

HackproofHacks provides web application and API penetration testing, using the same techniques covered in this article, with your explicit authorisation. See our free security tools.

More on Tools.

All articles →
FAQ

Questions about this topic.

How do I find all subdomains of a domain?

No single method finds every subdomain, so combine several. Start with certificate transparency logs, which list every public TLS certificate issued for a domain. Add DNS-based discovery with a tool like subfinder or amass, search engine queries, and a wordlist brute-force for names that never had a public certificate. Merge the results and resolve each name to confirm it is live.

Is it legal to find subdomains?

Passive methods such as certificate transparency lookups and search queries read public information and are generally fine. Active methods that send many DNS queries or probe hosts should only be run against domains you own or have written permission to test. Always follow the rules of any bug bounty program you are testing under.

What is the best free subdomain finder?

For a quick check, an online passive finder that queries certificate transparency logs and DNS is the fastest option and needs no installation. For deeper coverage, run subfinder or amass locally and combine several sources, since each source sees different names.

Why do subdomains matter for security?

Old staging sites, forgotten admin panels and abandoned services often run outdated software and sit outside normal monitoring. Subdomains pointing at deleted cloud resources can also be taken over by attackers. Knowing every subdomain is the first step in reducing your attack surface.