π§ What Is Subdomain Enumeration?
Subdomain enumeration is the process of finding valid subdomains belonging to a target domain (e.g., login.example.com, dev.example.com, mail.example.com).
Itβs a crucial step in reconnaissance β because subdomains often:
- Reveal hidden apps, staging servers, or admin panels.
- Expose forgotten or misconfigured systems.
- Lead to vulnerabilities like subdomain takeovers, open directories, outdated software, etc.
βοΈ Types of Subdomain Enumeration
There are three major approaches:
1. Passive enumeration
Collects subdomains from public sources (certificate transparency logs, search engines, GitHub, Shodan, VirusTotal) without querying the target directly. Pros: stealthy, fast, low-cost. Cons: can be outdated and misses internal/new hosts. When to use: early recon, scoping, stealthy OSINT.
2. Active enumeration
Directly queries DNS and services: DNS lookups, zone-transfer attempts, brute-forcing names, and HTTP probes to validate hosts. Pros: more complete and verifies live services. Cons: noisy β may trigger alarms and must only be used with permission. When to use: authorised pentests or detailed verification.
3. Hybrid enumeration
Start passive to build a baseline, then run targeted active checks on promising candidates. This balances coverage and noise. Best practice: detect wildcard DNS, rate-limit probes, validate results with HTTP checks, and always follow rules of engagement.
Short, practical tip: always begin passive, enrich selectively, and document your methods β it makes findings reliable and easy to act on.
π§© Passive Subdomain Enumeration
-
Search Engines
-
Google Dork:
site:*.example.com -wwwFilters out the main domain and shows indexed subdomains.
-
-
Certificate Transparency Logs
-
Threat Intelligence Databases
-
Passive Tools
-
Sublist3r
sublist3r -d example.comSources: Google, Bing, Baidu, Yahoo, and others.
-
Assetfinder
assetfinder --subs-only example.com -
Amass (Passive mode)
amass enum -passive -d example.com
-
π Active Subdomain Enumeration
Systematically trying possible subdomain names using a wordlist.
Tool: dnsx, amass, or subfinder
Example:
subfinder -d example.com -w /usr/share/wordlists/subdomains.txt
or with amass:
amass enum -brute -d example.com -src -w subdomains.txt
Common wordlists:
SecLists/Discovery/DNS/subdomains-top1million-5000.txtall.txtfrom assetnote
If DNS misconfiguration allows it, you can extract all subdomains from a zone.
Command:
dig axfr example.com @ns1.example.com
If successful, youβll see a full zone dump.
(Note: this is rare and often fixed, but itβs a big win when it works.)
dnsenum example.com
Performs:
- DNS record collection
- Zone transfer checks
- Brute-forcing with wordlists
π§ Hybrid Tools (Passive + Active)
amass enum -active -brute -src -d example.com -w wordlist.txt -o amass.txt
Features:
- Integrates passive sources + active scans
- Recursive subdomain discovery
- Outputs in multiple formats
-
Find subdomains:
subfinder -d example.com -o subs.txt -
Check which are alive:
httpx -l subs.txt -o alive.txt
knockpy example.com
Performs brute-force + DNS resolution and caches found results.
π Validating Subdomains (Check if they are alive)
After collecting subdomains, verify which are active (responding with HTTP/HTTPS):
cat subs.txt | httpx -silent -o alive.txt
Output example:
https://admin.example.com
https://api.example.com
https://staging.example.com
π Detecting Subdomain Takeover
Occurs when a subdomain (e.g., blog.example.com) points to an external service (GitHub Pages, AWS S3, etc.) thatβs no longer claimed.
-
Use tools:
subjack -w subs.txt -t 100 -timeout 30 -ssl -v -c fingerprints.jsonor
nuclei -l subs.txt -t takeover-detection.yaml
π¦ Automating Everything (One-Line Workflow)
subfinder -d example.com -o sub.txt
amass enum -passive -d example.com -o amass.txt
cat sub.txt amass.txt | sort -u | dnsx -silent | httpx -silent -o alive.txt
This workflow:
- Gathers subdomains.
- De-duplicates.
- Resolves live ones.
π Visualization & Mapping
You can visualize relationships between discovered assets using:
-
Amass viz
amass viz -d3 -dir amass_output -
Maltego (for manual visual mapping).
π§° Recommended Toolkit Summary
| Tool | Type | Description |
|---|---|---|
| Sublist3r | Passive | Fast subdomain discovery from search engines |
| Subfinder | Passive | Reliable, integrates multiple APIs |
| Amass | Hybrid | Advanced recursive and brute-forcing engine |
| Dnsx | Active | DNS resolver and validator |
| Httpx | Active | Live host checking |
| Knockpy | Hybrid | Subdomain brute-forcer |
| Subjack | Active | Subdomain takeover detector |
π Practical Example: Full Workflow
Target: example.com
# 1οΈβ£ Passive Recon
subfinder -d example.com -o subs1.txt
amass enum -passive -d example.com -o subs2.txt
# 2οΈβ£ Combine + Remove duplicates
cat subs1.txt subs2.txt | sort -u > all_subs.txt
# 3οΈβ£ DNS resolution
dnsx -l all_subs.txt -silent -o resolved.txt
# 4οΈβ£ Check live subdomains
httpx -l resolved.txt -silent -o alive.txt
# 5οΈβ£ Check for subdomain takeovers
subjack -w alive.txt -t 100 -ssl -c fingerprints.json -v
π‘ Tips for Professionals
- Always respect scope and authorization β get permission before scanning!
- Use API keys with tools like
subfinderoramassfor more sources. - Schedule regular scans to track new subdomains.
- Save and compare historical data to spot infrastructure changes.
π§° Bonus: GUI Tools
- Spyse β Web-based subdomain & asset discovery.
- PentestTools.com β Easy online recon.
- OWASP Amass GUI integrations (Burp, Recon-ng).
βοΈ Real-World Usage Scenario
If you were pentesting cyfotok.academy, enumeration might reveal:
admin.cyfotok.academy
portal.cyfotok.academy
staging.cyfotok.academy
mail.cyfotok.academy
api.cyfotok.academy
Then:
- Check for outdated CMS (
/wp-login.php,/admin) - Look for misconfigured services (CORS, DNS)
- Detect old dev environments (staging, test servers)
Frequently Asked Questions (FAQs)
Q1: Is subdomain enumeration legal? A: Passive enumeration using public sources is generally legal. Active scanning (DNS brute force, probing) requires authorization. Always confirm scope and permission.
Q2: Which tool should I learn first? A: Start with Amass (aggregation + passive) and httpx for probing. They form a strong base. cyberxsociety.com
Q3: How do I deal with wildcard DNS records? A: Detect by resolving many random subdomains; if they all resolve the same, treat them as wildcard and filter accordingly. Then focus on known or validated hosts.
Q4: Are certificate transparency logs always reliable? A: CT logs are extremely useful but can include stale or misissued certificates; always validate findings with DNS and HTTP probes. sidxparab.gitbook.io
Q5: How often should I run subdomain enumeration? A: For active orgs, at least weekly passive checks plus immediate alerts on new CT certificates; active scans can be run less frequently or on demand.
Q6: Can defenders use the same tools to monitor the org? A: Yes β combine passive collectors, CT monitoring, and API-driven inventory (e.g., SecurityTrails) to create continuous visibility. securitytrails.com
Q7: How do I prioritize findings? A: Prioritize hosts exposing login pages, APIs, or admin interfaces β these typically yield higher-impact vulnerabilities.