Overview
Subdomain enumeration discovers all subdomains associated with a target domain. Development environments, admin panels, legacy applications, and staging servers frequently live on subdomains with weaker security than the main site — running outdated software, using weaker authentication, or exposing functionality not intended for public access. Enumeration can be active (direct DNS interaction) or passive (public data sources only).
When To Use
- Early in the external recon phase of any web engagement or CTF
- When the main domain presents no obvious foothold but subdomains might
- When looking for dev, staging, or admin panels with weaker access controls
- When building a complete picture of a target’s internet-facing attack surface
Requirements
- A known target domain
- DNS access (standard internet connectivity is sufficient for external targets)
- Wordlists — SecLists Discovery/DNS is the standard source
Attack Steps
Phase 1 — Zone Transfer Attempt (always try first)
- Identify the nameservers for the domain:
dig NS example.com - Attempt a zone transfer against each nameserver:
dig axfr example.com @<ns> - If successful, the full zone file is returned — all subdomains and IPs exposed at once
- Zone transfers succeed only when
allow-transferis misconfigured; rare but worth attempting before brute force
Phase 2 — Passive Subdomain Discovery
- Query Certificate Transparency logs for subdomains embedded in TLS certificate SANs:
curl -s "https://crt.sh/?q=example.com&output=json" | jq -r '.[].name_value' | sort -u - Use search engine operators to surface indexed subdomains without querying DNS:
site:example.com -www - Check online DNS aggregation databases (SecurityTrails, Shodan, DNS Dumpster) for passively collected records
- Passive methods produce zero detectable traffic on the target
Phase 3 — Active Brute Force
- Select a wordlist — start with
subdomains-top1million-5000.txtfor speed; use the 110k list for thoroughness - Run DNSenum for a combined brute force and zone transfer attempt:
dnsenum --enum example.com -f /usr/share/seclists/Discovery/DNS/subdomains-top1million-20000.txt -r - Alternatively use Gobuster DNS mode:
gobuster dns -d example.com -w /usr/share/seclists/Discovery/DNS/subdomains-top1million-5000.txt - Gobuster is faster for raw brute force; DNSenum additionally scrapes Google and attempts zone transfers automatically
- For recursive subdomain discovery (sub.sub.example.com), use DNSenum with the
-rflag
Phase 4 — Validation
- For each discovered subdomain, confirm it is live by making an HTTP/HTTPS request
- Check the response code, server header, and page content for fingerprinting clues
- Note any subdomains returning interesting status codes (200, 301, 403) — 403 can still be worth probing
- Add confirmed live subdomains to your target list for further enumeration
Detection
- High-volume DNS queries in a short time will trigger DNS-based IDS or rate limiting on the target’s nameservers
- Zone transfer attempts are logged by all modern DNS servers
- Passive CT log queries and search engine operators produce zero detectable activity on the target
Mitigation
- Configure DNS servers to deny AXFR to unauthorized sources (restrict
allow-transferto known secondaries) - Enable DNS query rate limiting to slow automated brute-force attempts
- Minimize subdomain exposure — decommission unused subdomains and don’t create DNS records for services still in development
Related Knowledge
Related Playbook
Related Tools
References / Images
- SecLists DNS wordlists: https://github.com/danielmiessler/SecLists/tree/master/Discovery/DNS
- crt.sh: https://crt.sh