Yucaerin/CVE-2025-6254

GitHub: Yucaerin/CVE-2025-6254

针对 WordPress Doctreat Core 插件未授权权限提升漏洞(CVE-2025-6254)的自动化概念验证利用工具,通过 Role Injection 实现管理员账户创建。

Stars: 0 | Forks: 0

# CVE-2025-6254 — Doctreat Core <= 1.6.8 — 通过 Role Injection 实现的未授权权限提升 ## 🔥 漏洞概述 WordPress 插件 **Doctreat Core** 版本 **<= 1.6.8** 存在 **未授权权限提升** 漏洞。这个严重缺陷允许 **未授权攻击者** 直接通过插件的注册 AJAX endpoint 创建新的 **Administrator** 账户。 该漏洞源于 `hooks/hooks.php` 中的 `doctreat_process_registration()` 函数,它直接接收用户提交的 POST 数据中的 `user_type` 参数,并将其作为 `role` 参数传递给 `wp_update_user()`,而没有进行适当的授权或 allowlist 验证。该插件仅应用了 `esc_sql()`(它不验证角色)——它从未检查该角色对于公开注册是否 **安全**。 **突破性发现:** Doctreat 使用的 nonce (`scripts_vars.ajax_nonce`) 暴露在激活的 Doctreat 主题的任何公开页面上。通常控制用户注册为 "doctors"、"hospitals" 或 "regular_users" 的 `user_type` 参数,可以通过 POST 方式覆盖为 `user_type=administrator` —— 这个值将直接作为 WordPress 的 `role` 参数传递。 ## 🔍 受影响的插件 - **插件名称:** Doctreat Core - **受影响版本:** <= 1.6.8 - **漏洞类型:** 通过 Role Injection 实现的未授权权限提升 - **CVE ID:** CVE-2025-6254 - **CVSS 评分:** 9.8(严重) - **CWE:** CWE-269 — 不当的权限管理 - **影响:** 完全接管网站 — 创建管理员账户 ## 🧨 攻击者可以做什么 | 能力 | 影响 | | --- | --- | | 🔑 无需登录创建管理员账户 | **完全接管网站** | | 📦 访问 WooCommerce 客户数据 | **数据泄露** | | 💉 编辑插件/主题 PHP 文件 | **远程代码执行** | | 🕳️ 安装隐藏的后门 | **持久化访问** | | 👥 查看所有用户数据 | **侵犯隐私** | ## 🧪 漏洞利用特性 - 🔓 **无需身份验证** - 📝 **通过注册 AJAX endpoint 工作** - 🎯 **目标 AJAX endpoint** `/wp-admin/admin-ajax.php?action=doctreat_process_registration` - 🧠 **Role injection** — 在正常注册字段之外提交 `user_type=administrator` - 🌐 **自动提取 nonce** — 从 Doctreat 主题的公开页面抓取 `ajax_nonce` - 🔐 **绕过 nonce 验证** — 使用主题脚本暴露的合法 nonce - 📄 **结果保存至** `result.txt` ## 🧠 漏洞代码 ``` // doctreat_core/hooks/hooks.php ~ line 296 wp_update_user( array( 'ID' => esc_sql( $user_identity ), 'role' => esc_sql( $user_type ), // ← user_type from $_POST via extract($_POST) 'user_status' => 0 ) ); ``` ``` // ~ line 311 — Sets _is_verified after registration update_user_meta( $user_identity, '_is_verified', 'no' ); ``` **注意:** 在具有默认验证设置(`$verify_user` 为空或为 `'remove'`)的目标上,用户会自动通过验证并获得即时的管理员访问权限。启用了邮箱验证或管理员审批的目标将需要额外的验证步骤。 ## 🚀 用法 ``` python3 CVE-2025-6254_exploit.py https://localhost:8085 ``` ### 前置条件 - Python 3.6+ - `requests` 库 (`pip install requests`) - 目标必须具备: - 激活 Doctreat 主题(用于提取 nonce) - 激活 Doctreat Core 插件 <= 1.6.8 - 启用用户注册功能 ## 🛠 修复建议 ``` // SECURE: Allowlist only safe roles for public registration $allowed_roles = array('doctors', 'hospitals', 'regular_users', 'seller'); if (!in_array($user_type, $allowed_roles, true)) { $user_type = 'regular_users'; // ← Reject ALL dangerous roles } ``` - 为注册实现严格的 role allowlist - 为高权限 role 添加 `current_user_can('create_users')` capability 检查 - 在将 `user_type` 传递给 `wp_update_user()` 之前进行验证 - 考虑从公开注册中完全移除 role 分配 ## 🧠 研究员 - 致谢:[Friderika Baranyai (Foxyyy)](https://www.wordfence.com/threat-intel/vulnerabilities/researchers/friderika-baranyai) ## 📚 参考 - [Wordfence 公告](https://www.wordfence.com/threat-intel/vulnerabilities/wordpress-plugins/doctreat_core/doctreat-core-168-unauthenticated-privilege-escalation) ## 🔒 免责声明 此信息仅供 **教育** 和 **授权的渗透测试** 目的使用。未经授权利用计算机系统是非法且不道德的。在测试任何不属于您的目标之前,请务必获得明确的书面许可。
标签:PoC, Web安全, WordPress插件, 协议分析, 暴力破解, 权限提升, 蓝队分析, 逆向工具