Domain & ASN Enumeration
When to Use
- Phase 1 of External Penetration Tests / Bug Bounty hunting.
- When mapping the Attack Surface of a large enterprise or conglomerate.
- When tracking mergers and acquisitions (discovering newly acquired, potentially insecure infrastructure).
- Before conducting vulnerability scanning, to ensure you know every asset the target owns.
Prerequisites
- Target organization name, domain, or individual identifier
- OSINT framework tools installed (theHarvester, Maltego, Recon-ng)
- Understanding of operational security to avoid alerting the target
- Legal authorization for the intelligence gathering scope
Workflow
Phase 1: ASN (Autonomous System Number) Discovery
# Concept: Large organizations have their own ASNs, representing huge blocks of IP addresses.
# We want to map these to find infrastructure they host themselves vs cloud hosting.
# 1. Start with the main domain or company name via BGPView API or Hurricane Electric (bgp.he.net)
curl -s "https://api.bgpview.io/search?query_term=tesla" | jq
# 2. Extract ASNs provided in the response (e.g., AS394380)
# 3. Use Amass to map ASNs to IP ranges
amass intel -asn 394380
# 4. Alternatively, use whois to lookup the organization name
whois -h whois.radb.net -- '-i origin AS394380' | grep -Eo "([0-9.]+){4}/[0-9]+"
# This gives you the CIDR blocks (e.g., 216.239.32.0/19) owned directly by the company.
Phase 2: Reverse WHOIS and Domain Discovery
# Concept: We have the main domain (target.com). Now we want to find OTHER root domains
# owned by the same company (target.net, target-holdings.com, acquired-startup.com).
# 1. Extract WHOIS registrant email or organization name from the main domain
whois target.com | grep "Registrant Organization\|Registrant Email"
# Result: Registrant Organization: Target Corp
# 2. Perform Reverse WHOIS (who owns domains matching this Org/Email?)
# Use Amass Intel module
amass intel -org "Target Corp"
amass intel -whois -d target.com
# 3. Use Crunchbase and Wikipedia to manually search for Subsidaries and Acquisitions.
# Add these root domains to your target list.
Phase 3: Subdomain Enumeration (Passive)
# Concept: Find thousands of subdomains (dev.target.com, api.target.com) without sending
# a single packet to the target's actual servers. Rely on third-party data.
# 1. Certificate Transparency Logs (crt.sh)
# Organizations must register TLS/SSL certs publicly.
curl -s "https://crt.sh/?q=%25.target.com&output=json" | jq -r '.[].name_value' | sed 's/\*\.//g' | sort -u > subdomains_crt.txt
# 2. Use Subfinder (Rapid passive enumeration using multiple APIs)
subfinder -d target.com -all -silent > subdomains_subfinder.txt
# 3. Use theHarvester for search engine scraping
theHarvester -d target.com -b google,bing,linkedin,twitter -f target_harvest.html
Phase 4: Subdomain Enumeration (Active & Bruteforce)
# Concept: Actively query a massive list of potential subdomains against DNS resolvers
# to see which ones actually resolve to an IP address.
# 1. Powerful active enumeration mapping with Amass
amass enum -active -d target.com -brute -w /usr/share/wordlists/SecLists/Discovery/DNS/subdomains-top1million-110000.txt -o amass_active.txt
# Note: Amass can take a long time. For pure speed, Puredns or Massdns is preferred.
# 2. Fast resolution with Puredns
puredns resolve combined_subdomains.txt -r public_resolvers.txt -w resolved_subdomains.txt
Phase 5: Result Compiling & Port Scanning Prep
# We now have a list of all root domains, combined subdomains, and ASNs (CIDR blocks).
# 1. Clean and deduplicate lists
cat subdomains_*.txt | sort | uniq > final_subdomains.txt
# 2. Resolve final subdomains to IP addresses
cat final_subdomains.txt | httpx -silent -rt -ip
# These IPs and CIDR bounds are now ready for Phase 2: Mass Port Scanning (e.g., using Naabu or Masscan).
🔵 Blue Team / Defensive Perspective
- Attack Surface Management (ASM): The blue team must continuously run these exact same procedures to know their exposure. You cannot secure what you do not know you own.
- Dangling DNS: Periodically review DNS records. If a subdomain points to an expired AWS S3 bucket or unrenewed Heroku app, it is a critical Subdomain Takeover vulnerability.
- WHOIS Privacy: Use WHOIS Privacy protection where legally applicable to slow down Reverse WHOIS reconnaissance.
Key Concepts
| Concept |
Description |
| ASN |
Autonomous System Number; uniquely identifies a network routing domain on the internet |
| CIDR |
Classless Inter-Domain Routing; a method for allocating IP addresses and IP routing (e.g., a "/24" block) |
| Certificate Transparency |
Publicly accessible logs of all issued SSL/TLS certificates |
| Active vs Passive Recon |
Active touches the target's servers. Passive asks third parties about the target without touching them. |
Output Format
OSINT Infrastructure Intel Report
=================================
Target Organization: MegaCorp Industries
1. Autonomous Systems Identified:
- AS12345 (MegaCorp US) -> Maps to 192.168.0.0/22
- AS67890 (MegaCorp EU) -> Maps to 10.0.0.0/24
2. Root Domains Identified (Via Reverse WHOIS):
- megacorp.com
- megacorp.net
- acquired-startup.io
- megacorp-staging.com
3. Subdomain Discovery Statistics:
- Certificate Logs (crt.sh): 432
- Passive Scraping (Subfinder): 856
- Active DNS Bruteforce (Amass): 120
- Total Unique Resolvable Subdomains: 1,024
Next Steps Approved: Initiate targeted port scanning against the 1,024 resolved endpoints and 2 identified CIDR blocks.
🛡️ Remediation & Mitigation Strategy
- Input Validation: Sanitize and strictly type-check all inputs.
- Least Privilege: Constrain component execution bounds.
📚 Shared Resources
For cross-cutting methodology applicable to all vulnerability classes, see:
References
1---2name: domain-and-asn-enumeration3description: >4 Identify and map the external corporate footprint of a target organization. Use this skill5 at the absolute beginning of an engagement (Reconnaissance) to identify all registered domains,6 subdomains, IP ranges, and Autonomous System Numbers (ASNs) owned by the target. This skill forms7 the foundation for all subsequent external penetration testing and attack surface management.8domain: cybersecurity9subdomain: osint10category: Corporate Infrastructure11difficulty: beginner12estimated_time: "1-3 hours"13mitre_attack:14 tactics: [TA0043]15 techniques: [T1590.001, T1590.002, T1590.005, T1590.004]16platforms: [linux]17tags: [osint, reconnaissance, asm, domains, asn, subdomains, whois, intel-gathering]18tools: [amass, subfinder, bgpview, whois, crt.sh, theharvester]19version: "1.0"20author: CyberSkills-Elite21license: Apache-2.022metadata:23 source: https://skillmd.com/skills/shulkwisec/domain-and-asn-enumeration24---2526# Domain & ASN Enumeration2728## When to Use29- Phase 1 of External Penetration Tests / Bug Bounty hunting.30- When mapping the Attack Surface of a large enterprise or conglomerate.31- When tracking mergers and acquisitions (discovering newly acquired, potentially insecure infrastructure).32- Before conducting vulnerability scanning, to ensure you know *every* asset the target owns.333435## Prerequisites36- Target organization name, domain, or individual identifier37- OSINT framework tools installed (theHarvester, Maltego, Recon-ng)38- Understanding of operational security to avoid alerting the target39- Legal authorization for the intelligence gathering scope4041## Workflow4243### Phase 1: ASN (Autonomous System Number) Discovery4445```bash46# Concept: Large organizations have their own ASNs, representing huge blocks of IP addresses.47# We want to map these to find infrastructure they host themselves vs cloud hosting.4849# 1. Start with the main domain or company name via BGPView API or Hurricane Electric (bgp.he.net)50curl -s "https://api.bgpview.io/search?query_term=tesla" | jq5152# 2. Extract ASNs provided in the response (e.g., AS394380)5354# 3. Use Amass to map ASNs to IP ranges55amass intel -asn 3943805657# 4. Alternatively, use whois to lookup the organization name58whois -h whois.radb.net -- '-i origin AS394380' | grep -Eo "([0-9.]+){4}/[0-9]+"5960# This gives you the CIDR blocks (e.g., 216.239.32.0/19) owned directly by the company.61```6263### Phase 2: Reverse WHOIS and Domain Discovery6465```bash66# Concept: We have the main domain (target.com). Now we want to find OTHER root domains 67# owned by the same company (target.net, target-holdings.com, acquired-startup.com).6869# 1. Extract WHOIS registrant email or organization name from the main domain70whois target.com | grep "Registrant Organization\|Registrant Email"71# Result: Registrant Organization: Target Corp7273# 2. Perform Reverse WHOIS (who owns domains matching this Org/Email?)74# Use Amass Intel module75amass intel -org "Target Corp"76amass intel -whois -d target.com7778# 3. Use Crunchbase and Wikipedia to manually search for Subsidaries and Acquisitions.79# Add these root domains to your target list.80```8182### Phase 3: Subdomain Enumeration (Passive)8384```bash85# Concept: Find thousands of subdomains (dev.target.com, api.target.com) without sending86# a single packet to the target's actual servers. Rely on third-party data.8788# 1. Certificate Transparency Logs (crt.sh)89# Organizations must register TLS/SSL certs publicly.90curl -s "https://crt.sh/?q=%25.target.com&output=json" | jq -r '.[].name_value' | sed 's/\*\.//g' | sort -u > subdomains_crt.txt9192# 2. Use Subfinder (Rapid passive enumeration using multiple APIs)93subfinder -d target.com -all -silent > subdomains_subfinder.txt9495# 3. Use theHarvester for search engine scraping96theHarvester -d target.com -b google,bing,linkedin,twitter -f target_harvest.html97```9899### Phase 4: Subdomain Enumeration (Active & Bruteforce)100101```bash102# Concept: Actively query a massive list of potential subdomains against DNS resolvers103# to see which ones actually resolve to an IP address.104105# 1. Powerful active enumeration mapping with Amass106amass enum -active -d target.com -brute -w /usr/share/wordlists/SecLists/Discovery/DNS/subdomains-top1million-110000.txt -o amass_active.txt107108# Note: Amass can take a long time. For pure speed, Puredns or Massdns is preferred.109# 2. Fast resolution with Puredns110puredns resolve combined_subdomains.txt -r public_resolvers.txt -w resolved_subdomains.txt111```112113### Phase 5: Result Compiling & Port Scanning Prep114115```bash116# We now have a list of all root domains, combined subdomains, and ASNs (CIDR blocks).117118# 1. Clean and deduplicate lists119cat subdomains_*.txt | sort | uniq > final_subdomains.txt120121# 2. Resolve final subdomains to IP addresses122cat final_subdomains.txt | httpx -silent -rt -ip123124# These IPs and CIDR bounds are now ready for Phase 2: Mass Port Scanning (e.g., using Naabu or Masscan).125```126127## 🔵 Blue Team / Defensive Perspective128- **Attack Surface Management (ASM)**: The blue team must continuously run these exact same procedures to know their exposure. You cannot secure what you do not know you own.129- **Dangling DNS**: Periodically review DNS records. If a subdomain points to an expired AWS S3 bucket or unrenewed Heroku app, it is a critical Subdomain Takeover vulnerability.130- **WHOIS Privacy**: Use WHOIS Privacy protection where legally applicable to slow down Reverse WHOIS reconnaissance.131132## Key Concepts133| Concept | Description |134|---------|-------------|135| ASN | Autonomous System Number; uniquely identifies a network routing domain on the internet |136| CIDR | Classless Inter-Domain Routing; a method for allocating IP addresses and IP routing (e.g., a "/24" block) |137| Certificate Transparency | Publicly accessible logs of all issued SSL/TLS certificates |138| Active vs Passive Recon | Active touches the target's servers. Passive asks third parties about the target without touching them. |139140## Output Format141```142OSINT Infrastructure Intel Report143=================================144Target Organization: MegaCorp Industries1451461. Autonomous Systems Identified: 147- AS12345 (MegaCorp US) -> Maps to 192.168.0.0/22148- AS67890 (MegaCorp EU) -> Maps to 10.0.0.0/241491502. Root Domains Identified (Via Reverse WHOIS):151- megacorp.com152- megacorp.net153- acquired-startup.io154- megacorp-staging.com1551563. Subdomain Discovery Statistics:157- Certificate Logs (crt.sh): 432158- Passive Scraping (Subfinder): 856159- Active DNS Bruteforce (Amass): 120160- Total Unique Resolvable Subdomains: 1,024161162Next Steps Approved: Initiate targeted port scanning against the 1,024 resolved endpoints and 2 identified CIDR blocks.163```164165## 🛡️ Remediation & Mitigation Strategy166- **Input Validation:** Sanitize and strictly type-check all inputs.167- **Least Privilege:** Constrain component execution bounds.168169170## 📚 Shared Resources171> For cross-cutting methodology applicable to all vulnerability classes, see:172> - [`_shared/references/elite-chaining-strategy.md`](../_shared/references/elite-chaining-strategy.md) — Exploit chaining methodology and high-payout chain patterns173> - [`_shared/references/elite-report-writing.md`](../_shared/references/elite-report-writing.md) — HackerOne-optimized report writing, CWE quick reference174> - [`_shared/references/real-world-bounties.md`](../_shared/references/real-world-bounties.md) — Verified disclosed bounties by vulnerability class175176## References177- OWASP: [OSINT Framework](https://osintframework.com/)178- ProjectDiscovery: [Subfinder](https://github.com/projectdiscovery/subfinder)179- OWASP Amass: [Amass GitHub](https://github.com/owasp-amass/amass)