mcpField
V
vhost-enumeration

vhost-enumeration

github.com/uphiago安全1.3k44 次安装8 周前更新
代码仓库

关于 vhost-enumeration

用于通过向目标 IP 测试 Host 标头来发现隐藏虚拟主机的安全技能,涵盖响应过滤、主机名验证,以及证书和反向 DNS 检查。

主要功能

  1. 01使用 ffuf 模糊测试 Host 标头
  2. 02过滤默认响应
  3. 03使用 curl 验证主机名
  4. 04从 TLS 证书 SAN 提取名称
  5. 05利用 PTR 记录并比较主机内容

适用场景

  1. 01发现子域名枚举遗漏的内部主机名
  2. 02识别共享目标 IP 的服务
  3. 03结合证书和响应数据核验候选虚拟主机

安装

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

$npx skills add https://github.com/uphiago/recon-skills --skill vhost-enumeration

安装后在 Claude Code 中输入/vhost-enumeration确认已加载。

详细介绍

虚拟主机枚举

通过模糊测试 Host 标头,发现 IP 地址上的隐藏虚拟主机。许多服务器只会响应特定域名,因此无法通过标准子域名枚举发现。VHOST 模糊测试可以揭示共用同一 IP、但会响应不同主机名的内部服务、开发环境和管理面板。

适用场景

  • 你从 skill_view(name='origin-ip-discovery') 或 skill_view(name='port-service-discovery') 获取了目标 IP 列表。
  • 服务器对未知的 Host 标头返回默认页面或空白页面。
  • 子域名枚举可能遗漏了仅限内部使用的主机名。
  • 某个 IP 上的 SSL 证书在 SAN 字段中列出了多个域名。
  • 你需要映射反向代理后的内部服务。

前置条件

  • 配备 curl、ffuf、dnsx 和 httpx 的 terminal。
  • 用于主机名模糊测试的 DNS 字典。
  • 目标 IP 地址列表。

快速检测

# Basic VHOST fuzz on a single IP
ffuf -u http://TARGET_IP \
  -w /path/to/wordlist.txt \
  -H "Host: FUZZ.target.com" \
  -fs 0 -mc 200,301,302,401,403

流程

阶段 1 — Host 标头模糊测试
# Fuzz for virtual hosts matching the target domain pattern
ffuf -u http://TARGET_IP \
  -w $DNS_WORDLIST \
  -H "Host: FUZZ.target.com" \
  -fs DEFAULT_RESPONSE_SIZE \
  -mc 200,301,302,401,403 \
  -o vhost_ffuf.json

# HTTPS variant
ffuf -u https://target.com \
  -w $DNS_WORDLIST \
  -H "Host: FUZZ.target.com" \
  -mc 200,301,302,401,403

# Fuzz multiple IPs with a wordlist
cat unique_ips.txt | while read ip; do
  ffuf -u "http://$ip" \
    -w $DNS_WORDLIST \
    -H "Host: FUZZ.target.com" \
    -fs 0 -mc 200,301,302 -o "vhost_$ip.json"
  sleep 0.5
done
阶段 2 — 响应筛选
# Auto-calibrate: ffuf detects default response size and filters it out
ffuf -u http://TARGET_IP \
  -w $DNS_WORDLIST \
  -H "Host: FUZZ.target.com" \
  -ac -sf -s \
  -mc 200

# Manual calibration: find the default response size first
curl --max-time 30 --connect-timeout 10 -s http://TARGET_IP -H "Host: nonexistentxxxxx12345.target.com" | wc -c
# Use that size as -fs filter
阶段 3 — 访问 VHOST 目标
# Method 1 — direct curl with Host header
curl --max-time 30 --connect-timeout 10 -H "Host: dev.target.com" http://TARGET_IP

# Method 2 — /etc/hosts injection for browser access
echo "TARGET_IP  dev.target.com internal.target.com admin.target.com" | sudo tee -a /etc/hosts
# Then open http://dev.target.com in browser

# Method 3 — httpx with custom host resolution
echo "http://dev.target.com" | httpx -silent
阶段 4 — SSL 证书 SAN 枚举
# Extract hostnames from SSL certificate
echo | openssl s_client -connect TARGET_IP:443 -servername target.com 2>/dev/null \
  | openssl x509 -noout -text \
  | grep -Eo 'DNS:[^,\s]+' | cut -d: -f2 | sort -u

# Batch: extract hostnames from all discovered IPs
cat unique_ips.txt | while read ip; do
  echo | timeout 5 openssl s_client -connect $ip:443 2>/dev/null \
    | openssl x509 -noout -text 2>/dev/null \
    | grep -Eo 'DNS:[^,\s]+' | cut -d: -f2 | sort -u >> ssl_hostnames.txt
  sleep 0.5
done

# Check which of those hostnames resolve to the target
cat ssl_hostnames.txt | dnsx -silent -a -resp-only | sort -u
阶段 5 — 对 IP 范围执行 PTR 反向 DNS 查询
# If you have IP ranges, resolve PTR records to find hostnames
echo "10.0.0.0/23" | dnsx -silent -resp-only -ptr

# Batch on multiple CIDR ranges
cat cidr_ranges.txt | mapcidr -silent | dnsx -ptr -resp-only -silent > ptr_domains.txt
阶段 6 — 内容差异比较
# For each found VHOST, take a screenshot for visual triage
cat found_vhosts.txt | gowitness file -f - --no-http -P ./vhost_screenshots/

# Compare content across hosts — different content = different service
for host in $(cat found_vhosts.txt); do
  curl --max-time 30 --connect-timeout 10 -sk "http://TARGET_IP" -H "Host: $host" | md5sum
  sleep 0.3
done | sort

注意事项

  • 通配符 DNS 会对任意 Host 标头返回有效的 HTTP 响应。 使用自动校准(-ac),并进行手动验证。
  • 对于不存在的主机名,默认虚拟主机可能会返回通用页面。 使用已知不存在的主机名校准 -fs。
  • 没有 SNI 时,SSL/TLS 会阻止内容比较。 对每个主机名使用 openssl s_client -servername。
  • 有些服务器会接受任意 Host 标头。 这会产生误报,因此请使用手动 curl 验证每项发现。
  • 从你的 IP 可能无法访问仅限内部使用的服务。 访问这些服务可能需要连接内部网络。

验证

  1. ffuf 返回的状态码和响应大小与校准后的默认值不同。
  2. 使用发现的 Host 标头进行手动 curl 请求时,返回的是有意义的内容(而非默认页面)。
  3. 发现的主机名不在公共子域名列表中(此前未知)。
  4. SSL 证书的 SAN 字段确认该主机名属于此服务器。
  5. 截取屏幕截图,并确认它是独立的应用或服务。

相关技能

  • subdomain-enumeration — 生成 DNS 字典并获取现有子域名。
  • origin-ip-discovery — 查找需要进行 VHOST 扫描的源站 IP。
  • web-enumeration — 找到 VHOST 后,模糊测试目录和端点。

评论

支持 Markdown