漏洞挖掘方法论 (Bug Hunting Methodology)
被动侦察 (Passive Recon)
- 使用 shodan.io、fofa.info、zoomeye.ai 或 odin.io 来检测类似的应用。
# https://github.com/glennzw/shodan-hq-nse
nmap --script shodan-hq.nse --script-args 'apikey=<你的ShodanAPI密钥>,target=<目标域名>'
- 使用相同的 favicon 搜索类似的网站:pielco11/fav-up;或者搜索略有不同的图标:profundis.io/favicon-matcher
python3 favUp.py --favicon-file favicon.ico -sc
python3 favUp.py --favicon-url https://隐藏在Cloudflare后的域名/assets/favicon.ico -sc
python3 favUp.py --web 隐藏在Cloudflare后的域名 -s
- 在短链接 (Shortener URLs) 中搜索:shorteners.grayhatwarfare.com、utkusen/urlhunter
-
在储存桶 (Buckets) 中搜索:buckets.grayhatwarfare.com
-
使用 往昔之门 (The Wayback Machine) 来探测被遗忘的端点。
# 寻找 JS 文件、旧链接
curl -sX GET "http://web.archive.org/cdx/search/cdx?url=<目标域名.com>&output=text&fl=original&collapse=urlkey&matchType=prefix"
- 使用 michenriksen/GitRob 在 GitHub 仓库中查找私密信息。
gitrob analyze johndoe --site=https://github.acme.com --endpoint=https://github.acme.com/api/v3 --access-tokens=token1,token2
- 执行 Google Dorking 搜索:ikuamike/GoogleDorking.md
site: *.example.com -www
intext:"dhcpd.conf" "index of"
intitle:"SSL Network Extender Login" -checkpoint.com
- 使用 HackerTarget 枚举子域名
curl --silent 'https://api.hackertarget.com/hostsearch/?q=targetdomain.com' | grep -o '\w.*targetdomain.com'
- 使用 CommonCrawl 枚举端点
echo "targetdomain.com" | xargs -I domain curl -s "http://index.commoncrawl.org/CC-MAIN-2018-22-index?url=*.targetdomain.com&output=json" | jq -r .url | sort -u
主动侦察 (Active Recon)
网络发现 (Network Discovery)
-
子域名枚举 (Subdomains enumeration)
- 枚举已发现的子域名:projectdiscovery/subfinder、OWASP/Amass
subfinder -d hackerone.com amass enum -passive -dir /tmp/amass_output/ -d example.com -o dir/example.com- 子域名置换 (Permutate):infosec-au/altdns
- 子域名爆破:Josue87/gotator
- 使用 blechschmidt/massdns 将子域名解析为 IP,记得使用像 trickest/resolvers 这样优质的解析服务器列表。
- 子域名接管 (Subdomain takeovers):EdOverflow/can-i-take-over-xyz
-
网络发现
- 使用
nmap、robertdavidgraham/masscan 和 projectdiscovery/naabu 扫描 IP 范围。 - 探测服务、版本和 Banner 信息。
- 使用
-
审查最新的收购案例 (Acquisitions)
-
ASN 枚举
- projectdiscovery/asnmap:
asnmap -a AS45596 -silent - asnlookup.com
- projectdiscovery/asnmap:
-
DNS 区域传输 (DNS Zone Transfer)
host -t ns domain.local
domain.local name server master.domain.local.
host master.domain.local
master.domain.local has address 192.168.1.1
dig axfr domain.local @192.168.1.1
Web 发现 (Web Discovery)
常见文件
security.txt:一个提供联络信息(如电子邮件或 PGP 密钥)的文件,用于报告网站的安全问题。
sitemap.xml:列出网站的所有重要 URL,以便搜索引擎可以有效地索引它们。
<urlset>
<url><loc>https://example.com/</loc></url>
<url><loc>https://example.com/about</loc></url>
</urlset>
robots.txt:告诉搜索引擎爬虫它们可以在你的网站上访问或不能访问哪些页面或文件。
枚举文件与文件夹
枚举所有可访问的文件和子目录。一旦识别出底层技术,就优先使用有针对性的字典,而不是通用字典。使用 Assetnote (https://wordlists.assetnote.io) 等提供的技术特定字典,能显著提高覆盖率和效率。例如 httparchive_parameters_top_1m_2026_01_27.txt、httparchive_directories_1m_2026_01_27.txt 和 httparchive_php_2026_01_27.txt。
ffuf -H 'User-Agent: Mozilla' -v -t 30 -w mydirfilelist.txt -b 'NAME1=VALUE1; NAME2=VALUE2' -u 'https://example.com/FUZZ'
gobuster dir -a 'Mozilla' -e -k -l -t 30 -w mydirfilelist.txt -c 'NAME1=VALUE1; NAME2=VALUE2' -u 'https://example.com/'
识别并枚举可能被无意泄露的备份文件和临时文件。这些文件通常包含源代码、凭据或敏感配置数据,通常由编辑器、部署流程或手动备份创建。
爬取网站的页面和资源,以识别额外的攻击面并扩大评估范围。
Next.js 端点
在 Next.js 中,window.__BUILD_MANIFEST 是框架自动注入到客户端 JavaScript 包中的运行时全局变量。
转到 DevTools->Console 并执行以下 JavaScript 代码:
如果在浏览器控制台中检查应用(针对生产构建版本),你可能会看到类似以下的内容:
{__rewrites: {…}, /: Array(10), /404: Array(8), /500: Array(4), /_error: Array(1), …}
/: (10) ['static/chunks/2852872c-b605aca0298c2109.js', 'static/chunks/3748-2a8cf394c7270ee0.js']
/404: (8) ['static/chunks/2852872c-b605aca0298c2109.js', 'static/chunks/3748-2a8cf394c7270ee0.js']
/500: (4) ['static/chunks/3748-2a8cf394c7270ee0.js', 'static/chunks/1221-b44c330d41258365.js']
/[slug]: (30) ['static/chunks/2852872c-b605aca0298c2109.js', 'static/chunks/29107295-4cc022cea922dbb4.js']
/_error: ['static/chunks/pages/_error-6ddff449d199572c.js']
/about/[slug]: (31) ['static/chunks/2852872c-b605aca0298c2109.js']
JS 与 HTML 注释
检索源代码中的注释。
互联网档案 (Internet Archive)
通过审查来自 Wayback Machine 和 Internet Archive 等来源的存档内容,识别历史 URL 和端点。
隐藏参数 (Hidden Parameters)
搜索“隐藏”参数:
技术栈映射 (Map Technologies)
-
使用 projectdiscovery/httpx 或 projectdiscovery/wappalyzergo 枚举 Web 服务
- 网站图标 (Favicon) 哈希
- JARM 指纹
- ASN
- 状态码
- 服务
- 技术(Github Pages, Cloudflare, Ruby, Nginx 等)
-
使用 projectdiscovery/cdncheck 查找 WAF,并使用 christophetd/CloudFlair 识别真实 IP。
- 使用 sensepost/gowitness 为每个网站抓取屏幕截图。
手动测试
通过代理探索网站:
自动化漏洞扫描器
寻找 Web 漏洞 (Looking for Web Vulnerabilities)
- 探索网站并寻找本仓库中列出的漏洞:SQL 注入、XSS、CRLF、Cookies 等。
- 测试业务逻辑 (Business Logic) 弱点
- 过高或负数值
- 尝试所有功能并点击所有按钮
-
订阅网站并为额外的功能付费以进行测试。
-
检查支付功能 —— @gwendallecoguic
如果你测试的 Web 应用使用了外部支付网关,请查看文档以查找测试信用卡号,购买某些商品。如果该应用未禁用测试模式,则可以免费购买。
摘自 https://stripe.com/docs/testing:“使用以下任何测试卡号、将来有效的过期日期以及任何随机 CVC 号码,即可成功完成付款。每张测试卡的账单国家均设置为美国。”
测试卡号与令牌
| 卡号 (NUMBER) | 品牌 (BRAND) | 令牌 (TOKEN) |
|---|---|---|
| 4242424242424242 | Visa | tok_visa |
| 4000056655665556 | Visa (借记卡) | tok_visa_debit |
| 5555555555554444 | Mastercard | tok_mastercard |
国际测试卡号与令牌
| 卡号 (NUMBER) | 令牌 (TOKEN) | 国家 (COUNTRY) | 品牌 (BRAND) |
|---|---|---|---|
| 4000000400000008 | tok_at | 奥地利 (AT) | Visa |
| 4000000560000004 | tok_be | 比利时 (BE) | Visa |
| 4000002080000001 | tok_dk | 丹麦 (DK) | Visa |
| 4000002460000001 | tok_fi | 芬兰 (FI) | Visa |
| 4000002500000003 | tok_fr | 法国 (FR) | Visa |