白帽故事 · 2026年1月7日

90%的白帽子都会踩的‘侦察’误区

90%的黑客都栽在这个侦察误区上,你也中了么?

"工具越多=结果越好"?

通常的情况是这样的。一个黑客发现了一个目标,比方说 target.com,开始兴奋起来,立刻打开终端开始运行:

subfinder -d target.com -o subdomains.txt
amass enum -d target.com >> subdomains.txt
assetfinder --subs-only target.com >> subdomains.txt
findomain -t target.com -u findomain_results.txt
chaos -d target.com -o chaos_subs.txt

然后排序、去重,运行 httpx:
cat *.txt | sort -u | httpx -threads 200 -o live_hosts.txt

成功拿到3400个活跃子域名,在所有目标上运行nuclei:
nuclei -l live_hosts.txt -t ~/nuclei-templates/ -o nuclei_results.txt

然后一片寂静…

虽然得到了大量的数据,但是没有漏洞。没有理解。只是一个不知道该怎么处理的海量清单。

亲身经历的故事

去年,白帽小哥在一个金融科技项目的漏洞赏金计划上狩猎,范围大,赏金丰厚,竞争激烈。小哥按照常规操作——运行“武器库”中的每一个侦察工具:

subfinder -d fintech-target.com -all -o subs.txt
amass enum -passive -d fintech-target.com -o amass.txt
cat subs.txt amass.txt | sort -u | httpx -silent -threads 200 | tee live.txt
cat live.txt | nuclei -t cves/ -t exposures/ -o nuclei.txt

收集了大量数据,运行自动化扫描器,然后开始随机地四处戳探。

两周后,收获0个漏洞。😭

与此同时,另一个黑客在三天内就在该公司的合作伙伴门户中发现了一个关键IDOR(不安全的直接对象引用)漏洞,当问他是怎么做到的时,他的回答让小哥大吃一惊:

"我只看了5个子域名,用Burp跑了一遍,映射了每个端点,理解了其中的逻辑…"

误区:广度优先于深度

这就是90%的黑客做错的地方:他们优先考虑覆盖范围而非理解深度。

他们希望在理解任何东西之前扫描一切m典型的流水线是这样的:

典型的错误工作流

子域名 → httpx → nuclei → 也许加上 ffuf → ???

但是,这完全没有理解,没有分析,只有自动化,然后是困惑。

真正的优质侦察是什么样子?

以下是小哥当前实际使用的方法论:

第一步:聚焦子域名发现

不再运行5个工具,而是最多用一两个:

主要使用 subfinder 并指定特定来源

subfinder -d target.com -sources crtsh,alienvault -o subs_initial.txt

有时会加上被动的 amass:
amass enum -passive -d target.com -o amass_passive.txt

合并并去重

cat subs_initial.txt amass_passive.txt | sort -u | tee all_subs.txt

这通常能获得50-200个子域名,可管理,不会让人不知所措。

第二步:智能过滤

不要把什么都丢给 httpx:
检查哪些存活并获取技术栈信息:
cat all_subs.txt | httpx -silent -tech-detect -status-code -title -o live_detailed.txt

寻找有趣的模式

cat live_detailed.txt | grep -iE "admin|staging|dev|test|api|internal|vpn|jenkins|gitlab" | tee interesting.txt

现在我可能有了10-20个真正值得调查的目标。

第三步:深度端点发现

这就是大多数人搞砸的地方。他们发现了 admin-panel.target.com,然后马上就开始尝试SQL注入,但他们从未搞清楚到底存在哪些端点。

小哥是这样做的:

使用 gospider 爬取并寻找端点:
gospider -s "https://admin-panel.target.com" -o gospider_output -c 10 -d 3

提取 URL 和参数:
cat gospider_output/* | grep -Eo "(http|https)://[a-zA-Z0-9./?=_-]*" | sort -u | tee endpoints.txt
寻找 JavaScript 文件:
cat gospider_output/* | grep "\.js" | tee js_files.txt
运行 GAU (Get All URLs) 来查找历史端点:
echo "admin-panel.target.com" | gau --blacklist png,jpg,gif,css | tee gau_urls.txt

现在看到了真正的攻击面,不仅仅是域名,还有端点。

第四步:JavaScript 分析

大多数黑客会跳过这一步,大错特错,JS文件会泄露API端点、硬编码的秘密、逻辑缺陷…

下载所有 JS 文件:
cat js_files.txt | while read url; do wget -q "$url" -P js_files/; done
在 JS 中寻找 API 端点:
grep -r -E "api|endpoint|/v1/|/v2/" js_files/ | tee api_endpoints.txt

搜寻秘密:
grep -r -iE "api_key|apikey|secret|token|password|aws_access" js_files/ | tee secrets.txt

寻找有趣的参数:
grep -r -E "\?[a-zA-Z]+=|&[a-zA-Z]+=" js_files/ | tee parameters.txt

第五步:配合 Burp 进行手动探索

小哥会将所有流量通过 Burp Suite 代理,然后实际使用这个应用:

设置 Burp 为系统代理 (Linux系统):

export http_proxy=http://127.0.0.1:8080
export https_proxy=http://127.0.0.1:8080

然后到处……点点看,创建账户,尝试功能,观察 Burp 中的 HTTP 历史记录。

主要寻找:

• 身份验证端点

• 有趣的 API 路径

• 奇怪的参数

• HTTP 方法和状态码

• Cookies 和 Headers

• 应用逻辑

一个带命令的真实案例

某SaaS公司的漏洞赏金项目:

第一步:基础侦察

subfinder -d saas-company.com -o subs.txt cat subs.txt | httpx -silent -status-code -title | tee live.txt

发现有趣的子域名:api-internal.saas-company.com

第二步:创建账户并通过 Burp 代理

注意到有 API 调用发送到 api-internal.saas-company.com/v2/

第三步:用 ffuf 发现端点

ffuf -w ~/wordlists/api-endpoints.txt -u https://api-internal.saas-company.com/v2/FUZZ -mc 200,401,403

发现:/v2/users, /v2/teams, /v2/admin/reports

第四步:测试 /v2/admin/reports (无认证)

curl -X GET "https://api-internal.saas-company.com/v2/admin/reports" \
  -H "Content-Type: application/json"

返回:401 未认证

第五步:用我的普通用户令牌尝试

curl -X GET "https://api-internal.saas-company.com/v2/admin/reports" \
  -H "Authorization: Bearer eyJ0eXAiOiJKV1QiLC..." \
  -H "Content-Type: application/json"

200 OK,包含了所有用户的个人身份信息 (PII)
权限失效 = 关键性 IDOR

赏金:4500美元,大约花费3小时。

目前在使用的侦察脚本

一个简单的bash脚本:

#!/bin/bash
# focused_recon.sh 🎯
TARGET=$1
if [ -z "$TARGET" ]; then
    echo "用法: ./focused_recon.sh target.com"
    exit 1
fi
echo "[+] 开始对 $TARGET 进行聚焦侦察 🚀"
# 子域名发现 🔍
echo "[+] 寻找子域名..."
subfinder -d $TARGET -silent -o subs.txt
# 检查存活主机并探测技术栈 💻
echo "[+] 检查存活主机..."
cat subs.txt | httpx -silent -tech-detect -status-code -title -o live.txt
# 过滤有趣的目标 🎯
echo "[+] 过滤有趣的目标..."
cat live.txt | grep -iE "admin|staging|dev|test|api|internal" | tee interesting.txt
# 爬取每个有趣的目标 🕷️
echo "[+] 爬取有趣的目标..."
while read url; do
    echo "[+] 爬取 $url"
    gospider -s "$url" -o crawl_output -c 10 -d 2 -t 10
done < interesting.txt
# 提取 JS 文件 📜
echo "[+] 提取 JS 文件..."
grep -r "\.js" crawl_output/ | grep -Eo "(http|https)://[a-zA-Z0-9./?=_-]*\.js" | sort -u | tee js_urls.txt
# 下载并分析 JS 🔎
echo "[+] 分析 JavaScript 文件..."
mkdir -p js_files
cat js_urls.txt | while read js_url; do
    wget -q "$js_url" -P js_files/
done
echo "[+] 在 JS 中寻找秘密... 🔑"
grep -r -iE "api_key|apikey|secret|token|password" js_files/ | tee secrets_found.txt
echo "[+] 寻找 API 端点... 🗺️"
grep -r -E "api/|/v1/|/v2/|endpoint" js_files/ | tee api_endpoints.txt
echo "[+] 侦察完成!✅ 检查输出文件:"
echo "    - interesting.txt (先看这里! 🎯)"
echo "    - secrets_found.txt 🔑"
echo "    - api_endpoints.txt 🗺️"

使用方法:

chmod +x focused_recon.sh
./focused_recon.sh target.com

高级技巧

  1. 用 Arjun 发现参数

当我找到一个有趣的端点时,我用 Arjun 来发现隐藏的参数:

arjun -u https://api.target.com/v1/users/profile -m GET -o arjun_params.txt

这会发现了很多导致漏洞的隐藏参数。

  1. 用 ffuf 进行模糊测试

用于 API 枚举:

ffuf -w <(seq 1 10) -u https://api.target.com/vFUZZ/users -mc 200,401,403

模糊测试端点:

ffuf -w ~/wordlists/api_endpoints.txt -u https://api.target.com/v2/FUZZ -mc all -fc 404

模糊测试参数:

ffuf -w ~/wordlists/parameters.txt -u "https://target.com/api/user?FUZZ=test" -mc all -fr "error|invalid"
  1. Wayback Machine 查找历史端点
    获取所有历史 URL:
    echo "target.com" | waybackurls | tee wayback.txt
    过滤出有趣的模式:
    cat wayback.txt | grep -E "\.json|\.xml|\.conf|\.sql|\.bak|admin|api" | tee wayback_interesting.txt
    测试它们是否仍然有效:
    cat wayback_interesting.txt | httpx -silent -status-code -mc 200

  2. GitHub 搜索泄露的秘密
    使用 github-search 工具:
    github-search -d target.com -t $GITHUB_TOKEN -o github_results.txt

或者手动搜索
搜索: "target.com" api_key
搜索: "target.com" password
搜索: "target.com" filename:.env

你需要的心态转变

停止思考:"我能找到多少个子域名?"
开始思考:"我对这一个子域名的理解有多深?"

你的终端命令应该反映的是理解,而不仅仅是数据收集:

糟糕的做法:
巨大的工具输出.txt → ???

好的做法:
聚焦的发现.txt → 手动分析 → 测试 → 收益

小哥目前的做法(实际流程)

当我开始研究一个新目标时,实际流程如下:

  1. 运行聚焦的子域名发现 (5–10 分钟)

    subfinder -d target.com -o subs.txt
    cat subs.txt | httpx -silent -tech-detect | grep -iE "admin|api|dev" | tee interesting.txt
  2. 挑选最有趣的子域名
    (根据关键词、技术栈、状态码)

  3. 深入分析 1–2 小时
    彻底爬取:
    gospider -s "https://interesting-sub.target.com" -d 3 -c 10 -o crawl/

    • 提取并分析 JS
    • 下载 JS 文件
    • grep 搜索秘密和端点
    • 手动试用应用
    • 观察 Burp HTTP 历史记录
    • 映射功能点
  4. 记录一切
    格式:

    • 子域名: api.target.com
    • 技术栈: Node.js, Express
    • 有趣的端点: /v2/admin/, /internal/
    • 奇怪的行为: 在 /users/{id} 中接受任意用户 ID
    • 下一步: 测试 /users/{id} 端点的 IDOR
  5. 有条不紊地测试
    根据学到的东西进行挑战,比如:

  • 设定一个 2 小时的计时器
  • 从初步发现中挑选1个子域名 🎯
  • 运行这个工作流:
    TARGET="你选择的子域名.com"

    1. 爬取 (15 分钟) 🕷️
      gospider -s "https://$TARGET" -d 3 -c 10 -o crawl_$TARGET/
    2. 分析 JS (30 分钟)
      提取、下载、grep 搜索秘密/端点
    3. 在 Burp 中映射 (45 分钟)
      使用应用,观察流量
    4. 测试发现 (30 分钟)

小哥常用的工具列表如下:

子域名发现:🔍

• subfinder

• amass (被动模式)

HTTP 探测:💻

• httpx (带有状态码、标题、技术栈检测)

• nmap (针对特定端口)

爬取:🕷️

• gospider

• gau (用于历史 URL)

模糊测试:💥

• ffuf

• arjun (用于参数发现)

JS 分析:📊

• wget

• grep

手动:👨💻

• Burp Suite

• 浏览器

• 大脑

就这么多了,五个类别,质量胜于数量。

你的侦察流程是怎样的?有什么命令或技巧可以分享?欢迎在评论区留言。

原文:https://infosecwriteups.com/the-recon-mistake-90-of-hackers-make-52723b69b154