WordPress WPMasterToolkit 漏洞检测利用工具

功能特性

  • 版本比对分析 - 比对检测版本与已知漏洞版本(≤ 1.13.1),快速判断风险等级
  • 安全认证支持 - 提供 WordPress 管理员登录接口,支持凭证验证与会话保持
  • 错误处理机制 - 完善的异常捕获与超时控制,避免请求阻塞
  • SSL 证书绕过 - 支持自签名或无效证书的 HTTPS 站点检测

安装指南

系统要求

  • Python 3.6 及以上版本
  • 依赖库:requests, beautifulsoup4, argparse(Python 标准库)

依赖安装

pip install requests beautifulsoup4

克隆项目

git clone https://github.com/your-repo/wp-wpmastertoolkit-exploit.git
cd wp-wpmastertoolkit-exploit

使用说明

基础用法

# 检测目标站点是否存在漏洞
python exploit.py --target https://example.com

完整利用流程

# 1. 探测漏洞
# 2. 获取管理员凭证后登录
# 3. 执行后续利用操作

API 概览

函数名功能描述参数返回值
probe_vulnerability(target_url)探测目标插件版本并判断漏洞target_url: 目标站点 URLbool: 是否存在漏洞
breach_wp_login(session, login_url, username, password, headers)WordPress 管理员登录认证session: requests 会话对象
login_url: 登录地址
username/password: 凭证
headers: 请求头
bool: 登录是否成功

核心代码

漏洞探测模块

def probe_vulnerability(target_url):
    """
    探测目标站点的 WPMasterToolkit 插件版本并判断是否存在 CVE-2024-56249 漏洞
    
    工作流程:

    2. 发送 GET 请求获取文件内容
    3. 使用正则表达式提取 Stable tag 版本号
    4. 将版本号转换为数字并与 1131(对应 1.13.1)比对
    5. 返回是否存在漏洞的布尔值
    """

    try:

        if response.status_code == 200:
            match = re.search(r'Stable tag:\s*([\d.]+)', response.text)
            if match:
                version = match.group(1)
                print(f"[🔍] Detected plugin version: {version}")
                if float(version.replace(".", "")) <= 1131:
                    print("[🔥] Target is VULNERABLE to CVE-2024-56249! Exploiting...")
                    return True
                else:
                    print("[❌] Target is NOT vulnerable. (Version is newer than 1.13.1).")
                    return False
            else:
                print("[⚠️] Could not determine plugin version.")
                return False
        else:

            return False
    except requests.RequestException as e:
        print(f"[❌] Error while probing vulnerability: {e}")
        return False

管理员登录模块

def breach_wp_login(session, login_url, username, password, headers):
    """
    WordPress 管理员登录认证模块
    
    工作流程:
    1. 构造包含用户名、密码的表单数据
    2. 发送 POST 请求到 wp-login.php
    3. 检查响应 cookies 中是否存在 wordpress_logged_in 字段
    4. 返回认证结果
    
    注意:需要预先创建 requests.Session() 对象以保持会话状态
    """
    print("[🔑] Attempting to log in...")
    login_data = {
        "log": username,
        "pwd": password,
        "rememberme": "forever",
        "wp-submit": "Log In"
    }
    try:
        response = session.post(login_url, data=login_data, headers=headers, timeout=10)
        if any("wordpress_logged_in" in cookie.name for cookie in session.cookies):
            print("[✅] Authentication successful!")
            return True
        else:
            print("[❌] Authentication failed! Check credentials.")
            return False
    except requests.RequestException as e:
        print(f"[❌] Request error during authentication: {e}")
        return False

6HFtX5dABrKlqXeO5PUv/0nSCHLuN5ycRUBr9FOrdhs=