
Docker lab and Python PoC reproducing CVE-2026-120019, an unauthenticated stored XSS in W3 Total Cache <= 2.10.7 via predictable minify placeholder tokens, with a patched 2.11.0 control.
Security-research material for reproducing and validating CVE-2026-120019:
W3 Total Cache <= 2.10.7 lets an unauthenticated commenter plant forged
minify-placeholder tokens in comment content; when an HTML-minify pass runs
with the predicted md5(time()) namespace, the ignored-comment preserver
splices the comment's raw stem-comment content into the attacker's attribute
value - script-capable attributes mount outside any comment context, and with
page cache enabled the poisoned HTML is served to every subsequent visitor.
random_bytes(16) plus a
collision guard (_ensurePlaceholderHash) that extends the hash until it
does not occur in the source HTML; the same hardening applied to
Minify_HTML's 'MINIFYHTML' . md5($_SERVER['REQUEST_TIME']) namespaceAV:N/AC:H/PR:N/UI:N/S:C/C:L/I:L/A:N) - CWE-79mfunc entry present in the ignored-comment stems list, and the
attacker must predict the md5(time()) placeholder namespace by reading
the server clock from the HTTP Date response header within the applicable
time windowUse only on systems you own or are explicitly authorized to test. The PoC posts inert comments (the payload marker only sets a JS variable) and writes nothing to disk.
Status: proven in the supplied lab.
W3 Total Cache 2.10.7 (WordPress 7.1.2, page cache Disk Enhanced + HTML minify with default stems, commentable post):
comment posted : stem comment + 15 forged md5(time()) placeholder tokens
result : render with minify pass at a predicted second splices the
raw stem comment into an attacker title attribute -
autofocus/onfocus escape the comment context
2.10.7 persist : injection served from the page cache to a fresh anonymous
GET (stored, not one-shot)
2.11.0 : namespace unpredictable + collision guard; payload inert
across the full attempt budget (patched negative control)
The PoC asserts the injected markup (event-handler attributes mounted on an
anchor chosen by the attacker) rather than driving a browser; whether
autofocus+tabindex triggers focus handlers on load is browser-dependent,
but the injection primitive - arbitrary attacker HTML/attributes spliced into
a live element context - is the XSS sink the advisory describes, and any
script-capable attribute vector the target's output context allows lands the
same way.
The pipeline. With minify.enabled + minify.html.enable,
Minify_Plugin::ob_callback() runs minify_html() over every HTML page
render (Minify_Plugin.php:367-371). The HTML-minify pass preserves the
configured "ignored comment stems" - by default google_ad_, RSPEAK_,
mfunc (ConfigKeys.php:985-995) - across minification using
Minify_IgnoredCommentPreserver (Minify_Plugin.php:628-635).
The predictable namespace. The preserver's placeholder tokens are
%%IgnoredCommentPreserver_<hash>_<index>%% where the hash is
// lib/Minify/Minify/IgnoredCommentPreserver.php:10, W3TC 2.10.7
$this->_replacementHash = 'IgnoredCommentPreserver_' . md5(time());
second-resolution and fully predictable from any Date response header.
The blind restore. After minification, every token is swapped back with its stored raw comment - no escaping, no context awareness:
// IgnoredCommentPreserver.php:28-33, 2.10.7
public function replace($html) {
$html = str_replace(array_keys($this->_placeholders),
array_values($this->_placeholders), $html);
str_replace matches the token text anywhere in the document - including
inside attacker-supplied attribute values. Stem-matching is case-insensitive
stristr, so a commenter's <!--mfunc ... --> (which wp_kses keeps verbatim
because it is an HTML comment) is reserved raw and re-emitted raw.
The fix. 2.11.0 replaces the namespace with CSPRNG output and, decisively, extends it while it occurs anywhere in the source HTML - planted token text can never collide with a real placeholder:
// lib/Minify/Minify/IgnoredCommentPreserver.php, W3TC 2.11.0
protected function _ensurePlaceholderHash( $source = null ) {
if ( ! \is_string( $this->_replacementHash ) || '' === $this->_replacementHash ) {
$this->_replacementHash = 'IgnoredCommentPreserver_' . \bin2hex( \random_bytes( 16 ) );
}
while ( \is_string( $source ) && false !== \strpos( $source, $this->_replacementHash ) ) {
$this->_replacementHash .= \bin2hex( \random_bytes( 8 ) );
}
The same _ensurePlaceholderHash pattern was applied to Minify_HTML's own
placeholders ('MINIFYHTML' . md5($_SERVER['REQUEST_TIME']) in 2.10.7) - a
second, equally predictable collision domain the advisory title does not
name; this lab does not exercise it.
Date header) and post
one comment containing:
<!--mfunc " autofocus tabindex=1 onfocus=... x=" -->
(quote-only body survives wp_kses intact - angle brackets get stripped
or entity-encoded), andtitle attributes are forged tokens
%%IgnoredCommentPreserver_md5(T)_i%% for each candidate second T in
the window and reservation index i (each existing stem comment on the
page shifts the index).autofocus tabindex=1 onfocus=window.CVE120019X=1 mount as
live attributes of the anchor.Requirements: Docker with Compose v2, Python 3.10+ on the host.
./lab verify
Builds the 2.10.7 lab, requires the injection to fire (and to persist in the
page cache), then builds the 2.11.0 lab and requires its absence. Remove
everything with ./lab reset.
Vulnerable control:
[!!!] PLACEHOLDER-TOKEN INJECTION CONFIRMED (stored XSS)
posted : comment with 15 forged md5(time()) placeholder tokens
evidence: raw ignored-stem comment spliced into a title attribute;
autofocus/onfocus escapes the comment context
context : ...title=<!--mfunc " autofocus tabindex=1 onfocus=window.CVE120019X=1 x=" --> ...
persist : injection served from the page cache to a fresh anonymous GET
(stored, not just one-shot)
RESULT: VULNERABLE CONTROL CONFIRMED
Patched control:
[*] payload present but inert on this render (md5(time()) namespace did not
match a planted token)
[=] injection not observed within the attempt budget. Either the plugin is
patched (>= 2.11.0: random_bytes namespace + collision guard) or every
render second fell outside the predicted window.
RESULT: PATCHED CONTROL CONFIRMED
A marker present only inside the intact HTML comment is not accepted as
proof; the stem comment's content must appear outside comment context,
spliced into the attacker's attribute (the title=...<!--mfunc signature
adjacency in the PoC regex).