跳转至

漏洞挖掘方法论 (Bug Hunting Methodology)

被动侦察 (Passive Recon)

# https://github.com/glennzw/shodan-hq-nse
nmap --script shodan-hq.nse --script-args 'apikey=<你的ShodanAPI密钥>,target=<目标域名>'
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
urlhunter --keywords keywords.txt --date 2020-11-20
# 寻找 JS 文件、旧链接
curl -sX GET "http://web.archive.org/cdx/search/cdx?url=<目标域名.com>&output=text&fl=original&collapse=urlkey&matchType=prefix"
python theHarvester.py -b all -d domain.com
gitrob analyze johndoe --site=https://github.acme.com --endpoint=https://github.acme.com/api/v3 --access-tokens=token1,token2
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)

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 密钥)的文件,用于报告网站的安全问题。
Contact: mailto:security@example.com
  • sitemap.xml:列出网站的所有重要 URL,以便搜索引擎可以有效地索引它们。
<urlset>
  <url><loc>https://example.com/</loc></url>
  <url><loc>https://example.com/about</loc></url>
</urlset>
  • robots.txt:告诉搜索引擎爬虫它们可以在你的网站上访问或不能访问哪些页面或文件。
User-agent: *
Disallow: /admin/

枚举文件与文件夹

枚举所有可访问的文件和子目录。一旦识别出底层技术,就优先使用有针对性的字典,而不是通用字典。使用 Assetnote (https://wordlists.assetnote.io) 等提供的技术特定字典,能显著提高覆盖率和效率。例如 httparchive_parameters_top_1m_2026_01_27.txthttparchive_directories_1m_2026_01_27.txthttparchive_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/'

识别并枚举可能被无意泄露的备份文件和临时文件。这些文件通常包含源代码、凭据或敏感配置数据,通常由编辑器、部署流程或手动备份创建。

bfac --url http://example.com/test.php --level 4
bfac --list testing_list.txt

爬取网站的页面和资源,以识别额外的攻击面并扩大评估范围。

katana -u https://tesla.com
echo https://google.com | hakrawler

Next.js 端点

在 Next.js 中,window.__BUILD_MANIFEST 是框架自动注入到客户端 JavaScript 包中的运行时全局变量。

转到 DevTools->Console 并执行以下 JavaScript 代码:

console.log(window.__BUILD_MANIFEST)
console.log(__BUILD_MANIFEST.sortedPages)

如果在浏览器控制台中检查应用(针对生产构建版本),你可能会看到类似以下的内容:

{__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 注释

检索源代码中的注释。

<!-- HTML 注释 -->
// JS 注释

互联网档案 (Internet Archive)

通过审查来自 Wayback Machine 和 Internet Archive 等来源的存档内容,识别历史 URL 和端点。

gau --o example-urls.txt example.com
gau --blacklist png,jpg,gif example.com

隐藏参数 (Hidden Parameters)

搜索“隐藏”参数:

x8 -u "https://example.com/?something=1" -w <wordlist>

技术栈映射 (Map Technologies)

echo www.hackerone.com | cdncheck -resp
www.hackerone.com [waf] [cloudflare]

手动测试

通过代理探索网站:

自动化漏洞扫描器

nuclei -u https://example.com
./nikto.pl -h http://www.example.com

寻找 Web 漏洞 (Looking for Web Vulnerabilities)

  • 探索网站并寻找本仓库中列出的漏洞:SQL 注入、XSS、CRLF、Cookies 等。
  • 测试业务逻辑 (Business Logic) 弱点
    • 过高或负数值
    • 尝试所有功能并点击所有按钮
  • 《Web 应用程序黑客手册》(The Web Application Hacker's Handbook) 核查清单

  • 订阅网站并为额外的功能付费以进行测试。

  • 检查支付功能 —— @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

参考资料 (References)