CG
SkillsPerforming Subdomain Enumeration with Subfinder
Start Free
Back to Skills Library
Application Security๐ŸŸก Intermediate

Performing Subdomain Enumeration with Subfinder

Enumerate subdomains of target domains using ProjectDiscovery's Subfinder passive reconnaissance tool to map the attack surface during security assessments.

4 min read7 code examples

Prerequisites

  • Go 1.21+ installed for building from source
  • Subfinder v2 installed (`go install -v github.com/projectdiscovery/subfinder/v2/cmd/subfinder@latest`)
  • API keys configured for passive sources (Shodan, Censys, VirusTotal, SecurityTrails, Chaos)
  • Provider configuration file at `$HOME/.config/subfinder/provider-config.yaml`
  • Network access to passive DNS and certificate transparency sources
  • httpx or httprobe for validating discovered subdomains

Performing Subdomain Enumeration with Subfinder

When to Use

  • During the reconnaissance phase of penetration testing or bug bounty hunting
  • When mapping the external attack surface of a target organization
  • Before performing vulnerability scanning on discovered subdomains
  • When building an asset inventory for continuous security monitoring
  • During red team engagements requiring passive information gathering

Prerequisites

  • Go 1.21+ installed for building from source
  • Subfinder v2 installed (go install -v github.com/projectdiscovery/subfinder/v2/cmd/subfinder@latest)
  • API keys configured for passive sources (Shodan, Censys, VirusTotal, SecurityTrails, Chaos)
  • Provider configuration file at $HOME/.config/subfinder/provider-config.yaml
  • Network access to passive DNS and certificate transparency sources
  • httpx or httprobe for validating discovered subdomains

Workflow

Step 1 โ€” Install and Configure Subfinder

# Install subfinder
go install -v github.com/projectdiscovery/subfinder/v2/cmd/subfinder@latest

# Verify installation
subfinder -version

# Configure API keys for enhanced results
mkdir -p $HOME/.config/subfinder
cat > $HOME/.config/subfinder/provider-config.yaml << 'EOF'
shodan:
  - YOUR_SHODAN_API_KEY
censys:
  - YOUR_CENSYS_API_ID:YOUR_CENSYS_API_SECRET
virustotal:
  - YOUR_VT_API_KEY
securitytrails:
  - YOUR_ST_API_KEY
chaos:
  - YOUR_CHAOS_API_KEY
EOF

Step 2 โ€” Run Basic Subdomain Enumeration

# Single domain enumeration
subfinder -d example.com -o subdomains.txt

# Multiple domains from a file
subfinder -dL domains.txt -o all_subdomains.txt

# Use all passive sources (slower but more thorough)
subfinder -d example.com -all -o subdomains_all.txt

# Silent mode for piping to other tools
subfinder -d example.com -silent | httpx -silent -status-code

Step 3 โ€” Filter and Customize Source Selection

# Use specific sources only
subfinder -d example.com -s crtsh,virustotal,shodan -o filtered.txt

# Exclude specific sources
subfinder -d example.com -es github -o results.txt

# Enable recursive subdomain enumeration
subfinder -d example.com -recursive -o recursive_subs.txt

# Match specific patterns
subfinder -d example.com -m "api,dev,staging" -o matched.txt

Step 4 โ€” Control Rate Limiting and Output Format

# Rate limit to avoid API throttling
subfinder -d example.com -rate-limit 10 -t 5 -o rate_limited.txt

# JSON output for programmatic processing
subfinder -d example.com -oJ -o subdomains.json

# Output with source information
subfinder -d example.com -cs -o subdomains_with_sources.txt

# Collect results in a directory per domain
subfinder -dL domains.txt -oD ./results/

Step 5 โ€” Validate Discovered Subdomains with httpx

# Pipe subfinder output to httpx for live validation
subfinder -d example.com -silent | httpx -silent -status-code -title -tech-detect -o live_hosts.txt

# Check for specific ports
subfinder -d example.com -silent | httpx -ports 80,443,8080,8443 -o web_services.txt

# Resolve IP addresses
subfinder -d example.com -silent | dnsx -a -resp -o resolved.txt

Step 6 โ€” Integrate with Broader Recon Pipeline

# Chain with nuclei for vulnerability scanning
subfinder -d example.com -silent | httpx -silent | nuclei -t cves/ -o vulns.txt

# Combine with amass for comprehensive enumeration
subfinder -d example.com -o subfinder_results.txt
amass enum -passive -d example.com -o amass_results.txt
cat subfinder_results.txt amass_results.txt | sort -u > combined_subdomains.txt

# Screenshot discovered hosts
subfinder -d example.com -silent | httpx -silent | gowitness file -f - -P screenshots/

Key Concepts

ConceptDescription
Passive EnumerationDiscovering subdomains without directly querying target DNS servers
Certificate TransparencyPublic logs of SSL/TLS certificates revealing subdomain names
DNS AggregationCollecting subdomain data from multiple passive DNS databases
Recursive EnumerationDiscovering subdomains of subdomains for deeper coverage
Source ProvidersExternal APIs and databases queried for subdomain intelligence
CNAME RecordsCanonical name records that may reveal additional infrastructure
Wildcard DNSDNS configuration returning results for any subdomain query

Tools & Systems

ToolPurpose
SubfinderPrimary passive subdomain enumeration engine
httpxHTTP probe tool for validating live subdomains
dnsxDNS resolution and validation toolkit
NucleiTemplate-based vulnerability scanner for discovered hosts
AmassComplementary subdomain enumeration with active/passive modes
gowitnessWeb screenshot utility for visual reconnaissance
ShodanInternet-wide scanning database for subdomain intelligence
crt.shCertificate transparency log search engine

Common Scenarios

  1. Bug Bounty Reconnaissance โ€” Enumerate all subdomains of a target program scope to identify forgotten or misconfigured assets that may contain vulnerabilities
  2. Attack Surface Mapping โ€” Build a comprehensive inventory of externally accessible subdomains for ongoing security monitoring and risk assessment
  3. Cloud Asset Discovery โ€” Identify subdomains pointing to cloud services (AWS, Azure, GCP) that may be vulnerable to subdomain takeover
  4. CI/CD Integration โ€” Automate subdomain monitoring in pipelines to detect new subdomains and alert on changes to the attack surface
  5. Merger & Acquisition Due Diligence โ€” Map the complete external footprint of an acquisition target during security assessment

Output Format

## Subdomain Enumeration Report
- **Target Domain**: example.com
- **Total Subdomains Found**: 247
- **Live Hosts**: 183
- **Unique IP Addresses**: 42
- **Sources Used**: crt.sh, VirusTotal, Shodan, SecurityTrails, Censys

### Discovered Subdomains
| Subdomain | IP Address | Status Code | Technology |
|-----------|-----------|-------------|------------|
| api.example.com | 10.0.1.5 | 200 | Nginx, Node.js |
| staging.example.com | 10.0.2.10 | 403 | Apache |
| dev.example.com | 10.0.3.15 | 200 | Express |

### Recommendations
- Remove DNS records for decommissioned subdomains
- Investigate subdomains with CNAME pointing to unclaimed services
- Restrict access to development and staging environments

Verification Criteria

Confirm successful execution by validating:

  • [ ] All prerequisite tools and access requirements are satisfied
  • [ ] Each workflow step completed without errors
  • [ ] Output matches expected format and contains expected data
  • [ ] No security warnings or misconfigurations detected
  • [ ] Results are documented and evidence is preserved for audit

Compliance Framework Mapping

This skill supports compliance evidence collection across multiple frameworks:

  • SOC 2: CC6.1 (Logical Access), CC8.1 (Change Management)
  • ISO 27001: A.14.2 (Secure Development), A.14.1 (Security Requirements)
  • NIST 800-53: SA-11 (Developer Testing), SI-10 (Input Validation), SC-18 (Mobile Code)
  • OWASP LLM Top 10: LLM01 (Prompt Injection), LLM02 (Insecure Output)

Claw GRC Tip: When this skill is executed by a registered agent, compliance evidence is automatically captured and mapped to the relevant controls in your active frameworks.

Deploying This Skill with Claw GRC

Agent Execution

Register this skill with your Claw GRC agent for automated execution:

# Install via CLI
npx claw-grc skills add performing-subdomain-enumeration-with-subfinder

# Or load dynamically via MCP
grc.load_skill("performing-subdomain-enumeration-with-subfinder")

Audit Trail Integration

When executed through Claw GRC, every step of this skill generates tamper-evident audit records:

  • SHA-256 chain hashing ensures no step can be modified after execution
  • Evidence artifacts (configs, scan results, logs) are automatically attached to relevant controls
  • Trust score impact โ€” successful execution increases your agent's trust score

Continuous Compliance

Schedule this skill for recurring execution to maintain continuous compliance posture. Claw GRC monitors for drift and alerts when re-execution is needed.

Use with Claw GRC Agents

This skill is fully compatible with Claw GRC's autonomous agent system. Deploy it to any registered agent via MCP, and every execution will be logged in the tamper-evident audit trail.

// Load this skill in your agent
npx claw-grc skills add performing-subdomain-enumeration-with-subfinder
// Or via MCP
grc.load_skill("performing-subdomain-enumeration-with-subfinder")

Tags

subdomain-enumerationreconnaissancebug-bountyattack-surfacesubfinderpassive-reconosint

Related Skills

Penetration Testing

Conducting External Reconnaissance with OSINT

7mยทintermediate
Threat Intelligence

Performing OSINT with Spiderfoot

3mยทintermediate
Threat Intelligence

Building Threat Actor Profile from OSINT

6mยทintermediate
Red Team & Offensive Security

Performing Open Source Intelligence Gathering

3mยทintermediate
Application Security

Bypassing Authentication with Forced Browsing

6mยทintermediate
Application Security

Implementing Devsecops Security Scanning

3mยทintermediate

Skill Details

Domain
Application Security
Difficulty
intermediate
Read Time
4 min
Code Examples
7

On This Page

When to UsePrerequisitesWorkflowKey ConceptsTools & SystemsCommon ScenariosOutput FormatSubdomain Enumeration ReportVerification CriteriaCompliance Framework MappingDeploying This Skill with Claw GRC

Deploy This Skill

Add this skill to your Claw GRC agent and start automating.

Get Started Free โ†’