How To

WP Rocket CVE-2026-125812: Check, Patch and Hunt Planted Files

CVE-2026-125812 went public on November 23 in the Wordfence and Patchstack databases, with Patchstack’s write-up following on November 27. Two days after the listing, at 15:27:11 UTC on November 25, Patchstack logged the first live attack against it. The flaw is an unauthenticated remote code execution bug in WP Rocket, the paid caching plugin that its maker says runs on more than 5.5 million WordPress sites, a figure The Hacker News took from WP Rocket’s own site on December 1. One crafted request to admin-ajax.php with action=rocket_beacon can make the site fetch attacker content and save it as a PHP file.

Original content from computingforgeeks.com - post 201494

WP Rocket 3.24.2 closes it, but patching alone is not the whole job. Sites on an expired licence get no update offer at all, and the fix does not remove files an attacker already planted. We built a vulnerable 3.24.1 install and ran every check, mitigation and cleanup step below on it in December 2026, on Ubuntu 26.04.1 LTS behind nginx with ModSecurity in blocking mode, so each command and its output here comes from that run.

Affected versions and why the advisories disagree

The bug only fires when one of two features is on: “LazyLoad for CSS background images” or “Self-host Google Fonts” (Patchstack calls the second one “Host Fonts Locally”). Patchstack notes that both are off by default but common on performance-tuned sites, which describes most installs where someone paid for WP Rocket in the first place.

The sources do not agree on where the vulnerable range starts. WP Rocket’s own security advisory for CVE-2026-125812 names 3.15 through 3.24.1. Patchstack, Wordfence and The Hacker News all say every version below 3.24.2. To settle it for ourselves, we pulled the public Git tags of the plugin and grepped each one for the two settings and for the unauthenticated AJAX hook:

SourceAffected rangeFixed in
WP Rocket advisory3.15 to 3.24.13.24.2
PatchstackAll versions below 3.24.23.24.2
WordfenceAll versions below 3.24.23.24.2
Our tag greplazyload_css_bg_img from 3.15, wp_ajax_nopriv_rocket_beacon from 3.16.4, host_fonts_locally from 3.183.24.2 hardens the file writes

Our reading: the vendor’s 3.15 floor holds for the paths the advisories describe, because nothing older than 3.15 ships either setting, and the logged-out beacon hook only arrives in 3.16.4. Patchstack’s “below 3.24.2” is the safer rule for anyone triaging a fleet, since it costs nothing to treat a 3.14 site as suspect. We grepped code; we did not fire an exploit at old builds, so take the lower bound as a source reading rather than a proof.

The 3.24.1 to 3.24.2 diff on GitHub has no commit labelled “security”. The changelog line is “Improve validation of cached CSS, font and preconnect files”, and the code matches it: the cache path builder now resolves dot segments, stays inside the per-host cache directory and only writes names ending in .css or .css.json. The font downloader allowlists font extensions and checks the file signature before saving anything.

The dates matter if you’re deciding how far back to look in your logs. Exploitation started six days after the fix shipped, so a site patched on release day was never exposed to the attacks seen so far, while a site still on 3.24.1 today has been under live attack for a week.

Date (2026)EventSource
November 19WP Rocket 3.24.2 released with the fixWP Rocket changelog
November 23Listed in the Wordfence and Patchstack databases, CVSS 9.8 (Patchstack’s article followed on November 27)Wordfence record (researcher Vorelito), Patchstack database
November 25, 15:27:11 UTCFirst exploitation attempt seenPatchstack
November 26Tens of thousands of blocked attempts; 3.24.3 releasedPatchstack, WP Rocket changelog
December 1Wordfence’s advisory, as cited by The Hacker News, reports 135 attacks blocked in the previous 24 hoursWordfence, quoted by The Hacker News
December 222,369 attacks blocked in the previous 24 hours (rolling counter)Wordfence vulnerability record

Treat every site that ran a vulnerable build with either setting on after November 25 as possibly compromised. A patched site with a clean file sweep is fine; a patched site nobody swept is an open question.

The one-minute exposure check with WP-CLI

Exposure is two facts: the plugin version, and whether either setting is on. WP Rocket keeps all its settings in a single serialized option called wp_rocket_settings, so WP-CLI reads both without touching the dashboard. Run it as the web server user and point --path at your docroot:

sudo -u www-data wp --path=/var/www/html plugin get wp-rocket --field=version
sudo -u www-data wp --path=/var/www/html option pluck wp_rocket_settings lazyload_css_bg_img
sudo -u www-data wp --path=/var/www/html option pluck wp_rocket_settings host_fonts_locally

Our lab site after we switched both features on came back as a textbook positive. It reports a vulnerable version with both settings at 1, so it’s reachable through either path.

3.24.1
1
1

There’s a catch on fresh installs. The lazyload_css_bg_img key does not exist until someone saves that setting once, so option pluck prints nothing and exits 1. On our fresh install a missing key meant the feature was off, but a script that treats a non-zero exit as “vulnerable” will flag every untouched site. The same missing key also makes option patch update fail, as the lab showed:

wp option pluck on a fresh WP Rocket install: lazyload_css_bg_img missing and host_fonts_locally set to 0

For a quick look at both keys in one pass, dump the whole option as JSON and pull out just the two fields:

sudo -u www-data wp --path=/var/www/html option get wp_rocket_settings --format=json | grep -oE '"(lazyload_css_bg_img|host_fonts_locally)":[01]'

On the fresh 3.24.1 install only one key came back, because the background lazy load key had never been saved:

"host_fonts_locally":0

That’s why the one-liner we use across a fleet reads the option with wp eval and defaults a missing key to 0. It also reports “not active” when the plugin is installed but switched off, which is not exposed:

sudo -u www-data wp --path=/var/www/html eval '$o = get_option( "wp_rocket_settings", [] ); printf( "wp-rocket %s lazyload_css_bg_img=%d host_fonts_locally=%d\n", defined( "WP_ROCKET_VERSION" ) ? WP_ROCKET_VERSION : "not active", $o["lazyload_css_bg_img"] ?? 0, $o["host_fonts_locally"] ?? 0 );'

One line per site is easy to collect over SSH or your config management tool and sort later. On multisite, settings are stored per subsite, so repeat it with --url= for each subsite rather than trusting the main site’s answer. Our lab was a single site, so treat the multisite loop as the vendor’s advice and check one subsite by hand first. On the vulnerable lab build it printed this:

WP-CLI exposure check showing WP Rocket 3.24.1 with lazyload_css_bg_img=1 and host_fonts_locally=1

Any line with a version below 3.24.2 and a 1 in either field goes to the top of the queue. Below 3.24.2 with both at 0 is not exploitable through the documented paths, but still needs the update before anyone flips a setting back on.

Don’t use the bare HTTP status of a test request as your check. A POST of action=rocket_beacon without a valid nonce already gets 403 from WordPress itself, with a body of just -1, which is what our vulnerable 3.24.1 lab returned. The hook is registered for logged-out visitors even on an unlicensed copy:

sudo -u www-data wp --path=/var/www/html eval 'var_dump( (bool) has_action( "wp_ajax_nopriv_rocket_beacon" ), (bool) has_action( "wp_ajax_rocket_beacon" ) ); global $wp_filter; foreach ( $wp_filter["wp_ajax_nopriv_rocket_beacon"]->callbacks[10] ?? [] as $cb ) { echo get_class( $cb["function"][0] ), "::", $cb["function"][1], "\n"; }'

Both hooks are present on 3.24.1, unlicensed or not. The logged-out one lands in the performance hints subscriber, which is the code the advisories point at.

bool(true)
bool(true)
WP_Rocket\Engine\Common\PerformanceHints\AJAX\Subscriber::add_data

The handlers behind it do check a rocket_beacon_nonce, yet Patchstack and Wordfence both rate the flaw as unauthenticated. Treat the nonce as no protection and judge exposure by version and settings only.

Patching to WP Rocket 3.24.2 or later

With an active licence, this is a normal plugin update from Plugins, or wp plugin update wp-rocket from the shell. WP Rocket is not on wordpress.org, though, so its updates come from the vendor’s own server and only reach sites with a valid licence. Our lab copy had no licence key at all, which is the closest stand in for an expired one; a genuinely lapsed licence may behave differently, so confirm on your own site that no update is offered before you rely on it:

sudo -u www-data wp --path=/var/www/html plugin list --fields=name,version,update,update_version
sudo -u www-data wp --path=/var/www/html plugin update wp-rocket

Both commands report a healthy site. The list shows none in the update column for 3.24.1, and the update command prints a green success:

wp plugin update shows no update for unlicensed WP Rocket 3.24.1 and reports Plugin already updated

“Success: Plugin already updated.” on a vulnerable build is the most dangerous line in this whole runbook, because a nightly wp plugin update --all job will log it every night and nobody will look twice. Read the version number after every update instead of trusting the exit code.

The vendor advisory offers no download exception for lapsed licences, so an expired site either renews or runs on the mitigations in the next two sections until it does. Once you have a 3.24.2 or newer zip from the WP Rocket account that owns an active licence, WP-CLI installs it over the old copy with --force. Our lab zip was built from the public 3.24.3 Git tag:

sudo -u www-data wp --path=/var/www/html plugin install /tmp/wp-rocket.zip --force
sudo -u www-data wp --path=/var/www/html plugin list --fields=name,status,version

WP-CLI removed the old directory, kept the plugin active and reported 3.24.3. No separate deactivate or activate step was needed, which keeps the command safe to script.

wp plugin install --force updates WP Rocket from 3.24.1 to 3.24.3 from a zip file

Settings live in the database, so they carry over the swap. On the patched build we switched both features back on and they stayed on, which is safe from 3.24.2. One more trap: wp plugin verify-checksums wp-rocket cannot help you here. It asks wordpress.org for checksums, gets a 404 for a premium plugin and ends with “Verified 0 of 1 plugins (1 skipped)”, which still reads as Success.

Turning the two settings off when you can’t update yet

For sites stuck on a vulnerable build, WP Rocket’s advisory says to disable both features under WP Rocket, Page Optimization, Image & Media (the Media tab before 3.24). WP-CLI does the same without logging in, and it’s the faster route across many sites:

sudo -u www-data wp --path=/var/www/html option patch update wp_rocket_settings lazyload_css_bg_img 0
sudo -u www-data wp --path=/var/www/html option patch update wp_rocket_settings host_fonts_locally 0

Each command answers with Success: Updated 'wp_rocket_settings' option. on a site where the key exists. If the first one errors with No data exists for key "lazyload_css_bg_img", the feature was never saved and is already off, so move on. Rerun the exposure one-liner afterwards to confirm both fields read 0.

The weakness of this route is that any admin can switch the features back on next week. Background images will load later and fonts will come from Google again, and someone will notice the slower page score. That’s where the vendor’s helper plugin earns its place.

The vendor mitigation plugin and what it really does

WP Media publishes a small helper, wp-rocket-mitigate-cve-2026-125812, in its wp-rocket-helpers repository on GitHub. Download the zip into a scratch directory the web server user can read:

mkdir -p /tmp/helper && cd /tmp/helper
curl -sSL -o wp-rocket-mitigate-cve-2026-125812.zip https://github.com/wp-media/wp-rocket-helpers/raw/refs/heads/master/various/wp-rocket-mitigate-cve-2026-125812/wp-rocket-mitigate-cve-2026-125812.zip
chmod -R a+rX /tmp/helper

The chmod matters because WP-CLI runs as www-data and has to read the zip. From the same directory, install and activate it.

sudo -u www-data wp --path=/var/www/html plugin install ./wp-rocket-mitigate-cve-2026-125812.zip --activate

We read the source before installing it, then tested what it enforces. With both settings at 1 beforehand, activation zeroed them, and an attempt to set one back to 1 was refused:

WP Rocket CVE-2026-125812 mitigation plugin activated, settings forced to 0 and re-enabling refused

Here is its behaviour, from the source and the lab run together. Read the last item twice before you call a site clean.

  • On activation it saves both settings as 0, but only while WP Rocket is below 3.24.2.
  • It filters both settings to 0 at runtime and blocks any save that would turn them on, hence Could not update option.
  • Deactivating it leaves both at 0; it does not restore your old values.
  • It has no Version header (the zip files are dated 2026-11-27), refuses network activation and does nothing on 3.24.2 or later.
  • It deletes nothing. Planted files and rogue accounts stay where they are.

Since it refuses network activation, the vendor’s guidance for multisite is to activate it per subsite with --url=. Its activation also stops with an error on any subsite where WP Rocket itself is not active, so skip those. Remove it once the site is on 3.24.2 or later, then turn the features back on deliberately if you want them.

A ModSecurity stopgap for the rocket_beacon request

If you run many sites behind one nginx and can’t touch every WordPress install today, blocking the action at the web server buys time. The obvious nginx rule does not work, and we tested it so you do not have to find out in production. This is the rule people tend to write first:

    location = /wp-admin/admin-ajax.php {
        if ($arg_action = rocket_beacon) {
            return 403;
        }
        include snippets/fastcgi-php.conf;
        fastcgi_pass unix:/run/php/php-fpm.sock;
    }

The variable $arg_action only sees the query string. A GET with ?action=rocket_beacon was blocked by nginx with its 162-byte error page, but the POST form, which is how the beacon really talks, went straight through to PHP:

nginx arg_action rule blocks the GET rocket_beacon request but the POST body reaches WordPress

Look at the access log byte counts. Both lines say 403, but the POST’s 12 bytes are WordPress answering -1, which means the request reached the vulnerable handler. Stock nginx cannot match on a POST body, so the rule needs a WAF that parses arguments. We used the ModSecurity module from the Ubuntu archive:

sudo apt-get install -y libnginx-mod-http-modsecurity

On Ubuntu 26.04.1 LTS that gave us libnginx-mod-http-modsecurity 1.0.3-2build6 and libmodsecurity3t64 3.0.14-1build2, and enabled the module through /etc/nginx/modules-enabled/50-mod-http-modsecurity.conf. We skipped the OWASP Core Rule Set on purpose, since a CRS rollout during an incident creates its own false positives. Create a rules file with just the one rule:

sudo mkdir -p /etc/nginx/modsec
sudo vim /etc/nginx/modsec/main.conf

Add the engine settings and the rule. It matches admin-ajax.php by filename after path normalisation, then checks the action argument wherever it appears, query string or body:

SecRuleEngine On
SecRequestBodyAccess On
SecAuditEngine RelevantOnly
SecAuditLog /var/log/nginx/modsec_audit.log

SecRule REQUEST_FILENAME "@endsWith /admin-ajax.php" \
    "id:1012581,phase:2,deny,status:403,log,t:none,t:lowercase,t:normalizePath,\
    msg:'WP Rocket CVE-2026-125812: rocket_beacon blocked',chain"
    SecRule ARGS:action "@streq rocket_beacon" "t:none,t:lowercase"

Then switch ModSecurity on in the WordPress server block. These two lines go inside server { }, next to root and index:

    modsecurity on;
    modsecurity_rules_file /etc/nginx/modsec/main.conf;

Test the config before reloading. A healthy load prints the ModSecurity notice with one local rules file:

sudo nginx -t

The line to look for is the rules count. A 0/0/0 there means nginx loaded the module but never found your file.

2026/12/02 00:38:02 [notice] 24336#24336: ModSecurity-nginx v1.0.3 (rules loaded inline/local/remote: 0/1/0)
nginx: the configuration file /etc/nginx/nginx.conf syntax is ok
nginx: configuration file /etc/nginx/nginx.conf test is successful

After sudo systemctl reload nginx we threw four variants of the request at it, plus two requests that must keep working. Every beacon variant was denied, including a URL-encoded underscore and a multipart body, while the WordPress heartbeat and the homepage stayed at 200:

ModSecurity rule returns 403 for every rocket_beacon variant while heartbeat and the homepage return 200

Because WordPress also answers these with 403, the status code alone does not prove the WAF did anything. Proof lives in the error log, where each block names the rule ID:

sudo grep 1012581 /var/log/nginx/error.log | tail -n 1

The matched operator, the variable and the rule ID are all there. Count these lines per day and you also get a rough measure of how hard your sites are being probed.

nginx error.log line showing ModSecurity rule 1012581 denying a rocket_beacon request

This rule has a cost. The same rocket_beacon action carries WP Rocket’s legitimate performance reports, and in the code we grepped the above-the-fold, font preload, preconnect and lazy render features all post through it. Blocking it means those optimisations stop learning from real visits, though our cached homepage kept loading. Remove the rule once the site is on 3.24.2 or later. If you’d rather not run a WAF yourself, Wordfence’s record for the flaw showed 22,369 attacks blocked in the previous 24 hours when we read it on December 2, and Patchstack’s paid RapidMitigate rule was live, by Patchstack’s account, more than two days before the first attack.

Hunting for planted wp-media PHP files

Patchstack’s post on the active exploitation of CVE-2026-125812 is blunt about this: “The update stops new attacks, but it does not remove files an attacker already planted.” Its indicators of compromise come down to four things to look for.

  • PHP files named wp-media-*.php in wp-content, its uploads folder or wp-rocket-config.
  • Outbound requests from the site to nip.io or trycloudflare.com hosts, bare IPs or other compromised WordPress sites.
  • Beacon POSTs from clients that never loaded a page before sending them.
  • Beacon reports carrying full URLs where WP Rocket expects bare domains.

To test the sweep, we dropped two harmless marker files with those names into the lab, owned by www-data like a real drop would be. The name search comes first, with timestamps and owner so you can line hits up against your access logs:

sudo find /var/www/html/wp-content -name 'wp-media-*.php' -printf '%TY-%Tm-%Td %TH:%TM %u %p\n'
sudo find /var/www/html/wp-content/uploads -type f -name '*.php'
sudo grep -E 'nip\.io|trycloudflare\.com' -r /var/log/nginx/ ; echo exit=$?

Both markers turned up, and the uploads sweep found the one in uploads. The log grep exited 1, meaning no match. Read that result carefully, because nginx logs record neither POST bodies nor the outbound fetches PHP makes, so a compromised site can return the same exit 1. The grep only earns its keep once the ModSecurity rule from the previous section is live, since its audit log in the same directory can hold details of the requests it blocked.

find sweep listing planted wp-media PHP files in uploads and wp-rocket-config, nginx log grep finds no callbacks

Don’t rely on the name alone. A second wave will use other names, so widen the net to any PHP newer than wp-config.php outside the plugins and themes folders:

sudo find /var/www/html/wp-content -type f -name '*.php' -newer /var/www/html/wp-config.php -not -path '*/plugins/*' -not -path '*/themes/*'

Expect noise. Besides the two markers, our lab returned three legitimate files that WP Rocket and WordPress rewrite on their own:

/var/www/html/wp-content/uploads/wp-media-test.php
/var/www/html/wp-content/wp-rocket-config/localhost.php
/var/www/html/wp-content/wp-rocket-config/wp-media-test.php
/var/www/html/wp-content/advanced-cache.php
/var/www/html/wp-content/upgrade/index.php

The wp-rocket-config/<hostname>.php file and advanced-cache.php are WP Rocket’s own config and drop-in, and upgrade/index.php is an empty guard file. Anything else in that list deserves a manual read. These three checks round out the sweep:

cd /var/www/html && sudo grep -rlE 'eval\(|base64_decode\(|assert\(' --include=*.php wp-content/uploads wp-content/wp-rocket-config; echo exit=$?
sudo -u www-data wp --path=/var/www/html core verify-checksums
sudo ss -tnp state established | grep -E 'php-fpm|php' ; echo exit=$?

On the lab both greps exited 1 and core passed with Success: WordPress installation verifies against checksums. The ss line catches a PHP worker holding an outbound connection, the callback Patchstack describes, but only while it’s happening, so check your egress firewall or flow logs for the days since November 25 as well. For the third indicator, look in the access log for an IP whose only hit is a POST to admin-ajax.php.

Blocking PHP execution in uploads and wp-rocket-config

A planted file is only a webshell if the web server will execute it. Neither uploads nor wp-rocket-config has any business serving PHP to a browser, so deny it at nginx. Open your site’s server block (ours is wp.conf):

sudo vim /etc/nginx/sites-available/wp.conf

Add this location above the general location ~ \.php$ block. Regex locations are checked in file order, so placing it after the PHP handler would do nothing:

    location ~* ^/wp-content/(uploads|wp-rocket-config)/.*\.php$ {
        deny all;
    }

Test and reload, then request a planted file before and after. The marker in uploads went from 200 to 403, and so did the one in wp-rocket-config:

nginx deny location turns a PHP file in wp-content uploads from 200 to 403

The homepage still returned 200 with WP Rocket active, since the plugin reads that config from disk and never requests it over HTTP. Keep this rule after patching; it costs nothing and defangs the next plugin bug that writes PHP into uploads. It does not cover the wp-content root, which Patchstack also lists as a drop location and which still runs PHP, so the find sweep stays your check there. Our guide to the nginx CVE-2026-123007 patch covers keeping the web server itself current.

Cleanup after a confirmed hit

A file that matches Patchstack’s indicators means the attacker ran code as the web server user, which can read wp-config.php and write to the database. Deleting the file closes one door; it does not undo what that code did while it was there. Start by saving evidence, then work through accounts and secrets.

Copy the planted files and the relevant access log range somewhere off the server before you delete anything, so you can later answer “what did it do” for the site owner. Then list every administrator with its registration date, since a new admin is the usual way back in:

sudo -u www-data wp --path=/var/www/html user list --role=administrator --fields=ID,user_login,user_registered

Our lab had one, created when we built the site. On a real site, compare each date with the November 25 start of attacks.

ID	user_login	user_registered
1	labadmin	2026-12-02 00:13:46

Any admin registered after November 25 that nobody can vouch for gets deleted. Next, rotate the salts so every existing login cookie dies, including any session the attacker minted:

sudo -u www-data wp --path=/var/www/html config shuffle-salts

It prints Success: Shuffled the salt keys. and logs everyone out. Change the database password in wp-config.php and in MariaDB too, because the attacker could read it; our MariaDB setup on Ubuntu 26.04 covers the database side. Reinstall WordPress core and every plugin from clean copies rather than trusting files on a box that ran attacker PHP.

If this landed during the same week as the core release, check our runbook for the WordPress 7.1.5 security release too, since a site behind on one patch is usually behind on others. The same goes for the PHP runtime, covered in the PHP 8.5 install guide for Ubuntu 26.04. For a core flaw handled the same way, from exposure check to cleanup, see the CVE-2026-87902 write-up.

CVE-2026-125812 audit checklist

Work through it per site, and keep the one-liner output as your record of what each site looked like before you touched it:

  1. Run the wp eval exposure one-liner and save its output.
  2. On anything below 3.24.2, set both settings to 0 or activate the vendor helper plugin right away.
  3. Update to 3.24.2 or later, then read the version back; never trust “Plugin already updated.”
  4. If you can’t update every site today, deploy the ModSecurity rule and confirm rule 1012581 hits in the error log.
  5. Sweep for wp-media-*.php, for any PHP in uploads, and for PHP newer than wp-config.php.
  6. Grep logs and egress records since November 25 for nip.io, trycloudflare.com and bare-IP callbacks.
  7. Add the nginx deny for PHP in uploads and wp-rocket-config, and keep it.
  8. On any hit: save evidence, remove unknown admins, shuffle salts, rotate the database password and reinstall from clean copies.
  9. Once patched, remove the WAF rule and the helper plugin, then re-enable the two features if you want them.

Step 3 is the one most likely to be skipped, because the tooling reports success either way. Put the version check in whatever job runs your plugin updates, and a lapsed licence becomes a failed check instead of a quiet gap.

Keep reading

Java4Shell (CVE-2026-114938): Find and Patch Vulnerable JVMs Security Java4Shell (CVE-2026-114938): Find and Patch Vulnerable JVMs UFW Firewall Commands with Examples on Ubuntu 26.04 / 24.04 Security UFW Firewall Commands with Examples on Ubuntu 26.04 / 24.04 nginx HTTP/2 RCE CVE-2026-123007: Check, Disable HTTP/2, Patch Security nginx HTTP/2 RCE CVE-2026-123007: Check, Disable HTTP/2, Patch Enable Post-Quantum TLS in Nginx, Apache, HAProxy and OpenSSH Security Enable Post-Quantum TLS in Nginx, Apache, HAProxy and OpenSSH Delegated Managed Service Accounts (dMSA) on Windows Server 2025 Security Delegated Managed Service Accounts (dMSA) on Windows Server 2025 Patch PHP2Shell (CVE-2026-109619) on Amazon Linux 2023 AWS Patch PHP2Shell (CVE-2026-109619) on Amazon Linux 2023

Leave a Comment

Press ESC to close