mcpField
P
performing-subdomain-enumeration-with-subfinder

performing-subdomain-enumeration-with-subfinder

github.com/mukul975安全35.2k160 次安装8 周前更新
代码仓库

关于 performing-subdomain-enumeration-with-subfinder

面向安全从业者的 Subfinder 操作指南,涵盖被动枚举子域名、验证主机及将结果纳入侦察流程。

主要功能

  1. 01枚举单个或多个域名
  2. 02选择或排除数据源
  3. 03递归枚举子域名
  4. 04设置速率限制和输出格式
  5. 05使用 httpx 和 dnsx 验证主机
  6. 06与其他侦察工具合并结果

适用场景

  1. 01梳理获准测试的漏洞悬赏目标
  2. 02盘点组织的外部资产
  3. 03在 CI/CD 中跟踪子域名变化
  4. 04识别待评估的云托管子域名

安装

复制下面的命令,在终端中运行。

$npx skills add https://github.com/mukul975/anthropic-cybersecurity-skills --skill performing-subdomain-enumeration-with-subfinder

安装后在 Claude Code 中输入/performing-subdomain-enumeration-with-subfinder确认已加载。

包含的文件

除 SKILL.md 外,安装时一起下载的参考资料和脚本。

LICENSE
assets/
template.md
references/
api-reference.md
standards.md
workflows.md
scripts/
agent.py
process.py

详细介绍

使用 Subfinder 执行子域枚举

适用场景

  • 在渗透测试或漏洞赏金狩猎的侦察阶段
  • 当绘制目标组织的外部攻击面时
  • 在对发现的子域执行漏洞扫描之前
  • 当为持续安全监控构建资产清单时
  • 在需要被动信息收集的红队演练期间

前置条件

  • 已安装 Go 1.21+ 以便从源码构建
  • 已安装 Subfinder v2(go install -v github.com/projectdiscovery/subfinder/v2/cmd/subfinder@latest)
  • 已为被动源配置 API 密钥(Shodan、Censys、VirusTotal、SecurityTrails、Chaos)
  • 提供方配置文件位于 $HOME/.config/subfinder/provider-config.yaml
  • 可访问被动 DNS 和证书透明度源的网络
  • 用于验证发现的子域的 httpx 或 httprobe

工作流

步骤 1 — 安装并配置 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
步骤 2 — 运行基本子域枚举
# 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
步骤 3 — 过滤并自定义源选择
# 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
步骤 4 — 控制速率限制和输出格式
# 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/
步骤 5 — 使用 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
步骤 6 — 集成到更广泛的侦察流水线
# 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/

关键概念

概念描述
被动枚举在不直接查询目标 DNS 服务器的情况下发现子域
证书透明度揭示子域名的 SSL/TLS 证书公开日志
DNS 聚合从多个被动 DNS 数据库收集子域数据
递归枚举发现子域的子域以获得更深覆盖
源提供方用于查询子域情报的外部 API 和数据库
CNAME 记录可能揭示额外基础设施的规范名称记录
泛域名 DNS对任何子域查询都返回结果的 DNS 配置

工具与系统

工具用途
Subfinder主要的被动子域枚举引擎
httpx用于验证存活子域的 HTTP 探测工具
dnsxDNS 解析和验证工具包
Nuclei针对发现主机的基于模板的漏洞扫描器
Amass具有主动/被动模式的补充性子域枚举
gowitness用于可视化侦察的网页截图实用工具
Shodan用于子域情报的全互联网扫描数据库
crt.sh证书透明度日志搜索引擎

常见场景

  1. 漏洞赏金侦察 — 枚举目标项目范围内的所有子域,以识别可能包含漏洞的被遗忘或配置错误的资产
  2. 攻击面测绘 — 为持续的安全监控和风险评估构建可外部访问子域的全面清单
  3. 云资产发现 — 识别指向云服务(AWS、Azure、GCP)的子域,这些子域可能易受子域接管攻击
  4. CI/CD 集成 — 在流水线中自动化子域监控,以检测新子域并就攻击面的变化发出警报
  5. 并购尽职调查 — 在安全评估期间绘制收购目标的完整外部足迹

输出格式

## 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

评论

支持 Markdown