Vulnerability analysis

W3 Total Cache Security Token Exposure (CVE-2026-5032)

Vulnerability details

Software

W3 Total Cache

w3-total-cache

Vulnerability type

Security Token Exposure

Threat level

Medium

W3 Total Cache is used on millions of sites and does everything from page caching to CDN integration. But today, I want to talk about a specific security flaw that highlights why “internal maintenance” features can be a liability if they aren’t properly locked down.

The problem

W3 Total Cache (versions 2.9.3 and below) has a hardcoded bypass for its output buffering pipeline. If a request claims to be from the plugin itself (via the User-Agent header), the plugin essentially steps aside and lets the raw HTML through without processing it.

This isn’t just about skipping the cache. The real issue is “Dynamic Fragments.”

High-performance sites often use these fragments to keep parts of a page dynamic while the rest is cached (think cart counts or personalised greetings). W3TC uses special HTML comments to identify these fragments:

<!-- SECURE_TOKEN mfunc PHP code --><!-- /mfunc SECURE_TOKEN -->

Usually, the plugin executes that code and strips the comments before a visitor ever sees them. But because the crafted User-Agent bypasses this processing, the raw comments – including the secret security token – are served directly to the browser.

  • Unauthenticated access: Anyone can trigger this bypass with a single curl command.
  • Token exposure: The secret W3TC_DYNAMIC_SECURITY constant is leaked in the HTML source.
  • RCE stepping stone: If an attacker has the token, they can attempt to inject their own mfunc tags elsewhere on the site to execute arbitrary PHP.

How it works

The vulnerability exists in the PgCache_ContentGrabber class. When the plugin checks the User-Agent, it looks for a match against the W3TC_POWERED_BY constant “W3 Total Cache”. If it finds it, it assumes it’s an internal request and disables its normal output filtering.

An attacker can exploit this with a simple header, like this…

curl -H "User-Agent: W3 Total Cache" https://example.com/

By viewing the source of the returned page, they can find the mfunc or mclude tags and pluck out the secret token.

Technical notes

The W3TC_DYNAMIC_SECURITY token is meant to be the “gatekeeper” for dynamic code execution. Exposing it effectively removes the lock on the door. While an attacker still needs a way to inject their own tags to achieve full Remote Code Execution (RCE), having the token makes that job much easier.

It’s a classic example of why security shouldn’t rely on “magic strings” or hidden headers that can be easily spoofed by a remote client.

As usual, the fix is straightforward – keep your plugins up-to-date. In this case, update to version 2.9.4 immediately. The patch ensures that sensitive fragments are handled correctly even when caching is bypassed.

For now, though, it does one thing well: it reminds us that “internal” doesn’t mean “unreachable.”

Stop checking plugin versions manually.

Vulnz subscribers were notified about this vulnerability automatically. Drop the 50KB agent onto your client sites and get a weekly "Zero-Click" security digest straight to your inbox.

Automate your vulnerability reporting