Jeanback1/react-rsc-cve-2025-55182-lab

GitHub: Jeanback1/react-rsc-cve-2025-55182-lab

一个用于演示和分析 React Server Components Flight 协议原型污染 RCE 漏洞(CVE-2025-55182)的教育实验环境,包含漏洞实例、修复实例和利用脚本。

Stars: 0 | Forks: 0

# CVE-2025-55182 实验环境 — React Server Components RCE [![Docker](https://img.shields.io/badge/docker-compose-blue)](docker-compose.yml) [![License](https://img.shields.io/badge/license-MIT-green)](LICENSE) [![CVE](https://img.shields.io/badge/CVE-2025--55182-red)](https://react.dev/blog/2025/12/03/react-server-components-security-update) 演示 **CVE-2025-55182** 的教育实验环境 —— 这是一个严重的 (CVSS 10.0) 远程代码执行 (RCE) 漏洞,存在于 React Server Components 中,由 Flight 协议反序列化器中的原型污染引起。 ## 快速开始 ``` # Clone git clone https://github.com/Jeanback1/react-rsc-cve-2025-55182-lab.git cd react-rsc-cve-2025-55182-lab # 启动实验环境(漏洞实例 + 已修复实例) docker compose up -d # 等待约2分钟,以完成两个容器的构建和启动。 # 利用漏洞实例 python exploit/exploit.py http://localhost:3011 id # 对已修复实例尝试相同的攻击 —— 攻击失败 python exploit/exploit.py http://localhost:3012 id ``` ## 实验环境架构 ``` docker compose ┌────────────────────────────────┐ │ │ attacker ────▶│ :3011 → rsc-lab-vulnerable │ React 19.2.0 │ (Server Action) │ ← exploitable │ │ │ :3012 → rsc-lab-patched │ React 19.2.1 │ (no Server Action) │ ← patched └────────────────────────────────┘ ``` | 容器 | 端口 | React 版本 | Server Action | 是否存在漏洞 | |-----------|------|---------------|---------------|-------------| | `rsc-lab-vulnerable` | 3011 | 19.2.0 | 是 | **是** | | `rsc-lab-patched` | 3012 | 19.2.1 | 否 | 否 | ## 环境要求 - **Docker** + Docker Compose v2 - **Python 3.8+** 并安装 `requests` (`pip install requests`) ## 文件说明 ``` ├── docker-compose.yml # Lab orchestration ├── README.md # This file ├── LICENSE │ ├── vulnerable/ # Vulnerable Next.js app │ ├── Dockerfile │ ├── package.json # react@19.2.0, next@15.4.0 │ └── app/ │ ├── layout.tsx │ ├── page.tsx # Server Component + Server Action │ └── actions.ts # 'use server' — the attack surface │ ├── patched/ # Patched Next.js app │ ├── Dockerfile │ ├── package.json # react@19.2.1, next@15.4.8 │ └── app/ │ ├── layout.tsx │ └── page.tsx # Server Component only (no Server Actions) │ ├── exploit/ │ ├── exploit.py # Educational RCE exploit (well-commented) │ ├── requirements.txt │ └── pyproject.toml │ └── docs/ └── CVE-2025-55182.md # Full technical analysis ``` ## 漏洞利用用法 ``` # 单条命令执行 python exploit/exploit.py # 示例 python exploit/exploit.py http://localhost:3011 id python exploit/exploit.py http://localhost:3011 "cat /etc/passwd" python exploit/exploit.py http://localhost:3011 "ls -la /app" ``` 该漏洞利用分为三个阶段进行: 1. **构建** 一个包含 `__proto__` 遍历的 Flight payload → 污染 `Object.prototype.then` 2. **发送** 该 payload,通过 Server Action endpoint 以 `multipart/form-data` 格式发送 3. **提取** 从 `X-Action-Redirect` 响应头中提取命令输出 (base64 编码) ## 受影响版本 | 包 | 存在漏洞 | 已修复 | |---------|-----------|---------| | `react` | ≤ 19.2.0 | ≥ 19.2.1 | | `react-dom` | ≤ 19.2.0 | ≥ 19.2.1 | | `react-server-dom-webpack` | ≤ 19.2.0 | ≥ 19.2.1 | ## 技术深入分析 请参阅 [`docs/CVE-2025-55182.md`](docs/CVE-2025-55182.md) 获取完整的分析说明: - Flight 协议的工作原理 - 为什么 `__proto__` 遍历具有危险性 - 逐步的漏洞利用链 - 检测与缓解策略 ## 参考资料 - [React 安全公告 — 2025 年 12 月](https://react.dev/blog/2025/12/03/react-server-components-security-update) - [CWE-502:不可信数据的反序列化](https://cwe.mitre.org/data/definitions/502.html) - [Next.js Server Actions](https://nextjs.org/docs/app/building-your-application/data-fetching/server-actions-and-mutations)
标签:Docker, React, Syscalls, XXE攻击, 原型链污染, 安全漏洞靶场, 安全防御评估, 漏洞复现, 版权保护, 编程工具, 请求拦截, 远程代码执行, 逆向工具