WP Rocket Flaw Lets Attackers Plant PHP Files on WordPress Sites Without a Login

Ethical Hacking Complete Course Zero to Expert
Hack like black hat hackers. Penetration testing, Kali Linux, WiFi and web hacking, and the hacker mindset behind it.
→ Take the full courseTens of thousands of takeover attempts hit WordPress sites in one day, aimed at WP Rocket. The sites at risk had a speed setting switched on. Since 2023, that setting let attackers in without a login.
# TL;DR
The first attack came on November 25, at 15:27 UTC. One attacker tried it by hand on a few WordPress sites. When that got blocked, the attacker came back with the same attack in a different encoding. By the next day, scripts had taken over, and the WordPress security company Patchstack blocked tens of thousands of these attempts on November 26 alone.
The attackers were going after a hole in WP Rocket, a paid plugin that makes WordPress sites faster. It keeps ready-made copies of your pages, so your server does not have to build each page again for each visitor. The company behind it says it is used by more than 5.5 million websites.
In its settings you find two switches that make your site even faster. The first is called “LazyLoad for CSS background images”. With that on, the background images of a page only load once a visitor scrolls down to them. The second is called “Self-host Google Fonts”. With that on, WP Rocket copies the fonts your site uses from Google to your own server, so your visitor’s browser does not have to fetch them there.
The first switch has been in WP Rocket since version 3.15, in 2023. The second came in January 2025. Both are off when you install the plugin. You switch them on yourself, because you want your site to load faster.
And if you did that on WP Rocket 3.15 up to and including 3.24.1, an attacker could run his own code on your site. He needed no password and no login for it. That is how WP Rocket describes it in its own advisory. How many of those 5.5 million sites have one of the two switches on, the company has not said.
To make a page faster, WP Rocket first wants to know what that page looks like on your visitor’s screen. So it adds a small script to your pages. WP Rocket calls that script the beacon. It runs in the browser of each person who visits, measures the page, and sends a short report back to your site. In that report are the web addresses of files the page uses.
That report goes to admin-ajax.php, the file WordPress plugins use for work that happens in the background. The report comes in under the name rocket_beacon. Your visitors are not logged in, so admin-ajax.php takes that report without a login.
Your site then takes the addresses from the report and gets to work. With one of the two switches on, it downloads a file from that address and keeps a copy on your own server.
And that is where it went wrong. According to the researchers at that security company, WP Rocket did not check those addresses well enough. An attacker skips the browser, writes a fake report himself and sends it straight to rocket_beacon, with an address that points to his own server. Your site downloads whatever sits there and saves it as a PHP file.
PHP is the language WordPress is written in. Put a PHP file in the folders of a website, open it in a browser, and the server runs it, with the same rights as your website. From that moment, the attacker is running code on your site.
The attackers even put both switches in one request, the researchers saw, so the attack works on whichever of the two you turned on.
I looked at the code, because WP Rocket’s code is public on GitHub. For the background images, the problem sits in one line. This is how the plugin decided where to save a downloaded file from that switch, before the fix:
| |
It takes the cache folder, adds the name of the server from the address, and then adds the rest of the address. That is all it does. In a file path, ../ means go up one folder. Put enough of those in the address, and the file ends up outside the cache folder, somewhere else on your server. That trick is called path traversal. The code did not check what the file was called at the end either, so the name could end in .php.
The font switch had the same mistake in its own file. This line takes the fonts folder and sticks the path from the address on the end, with no check:
| |
The hole is tracked as CVE-2026-125812, and it got a CVSS score of 9.8 out of 10. CISA, the US cybersecurity agency, added its own note to the CVE record: this attack can be automated, and the technical impact is total. In that scoring, total means full control over the software.
The fixed code is a lot stricter. A file in that cache may now only end in .css or .css.json:
| |
A second check refuses names with .php, .phtml, .phar or another extension a server can run anywhere in them, so a name like shell.php.css does not get through either. The path gets cleaned up first, so ../ no longer takes you out of the folder. And for the fonts, WP Rocket now checks that what it downloaded is a font before it saves it.
A researcher who goes by Vorelito found the hole and reported it through the bug bounty program of that same security company, where researchers report holes in WordPress plugins. The CVE number for it was reserved on November 10.
On November 18, the fix went into WP Rocket’s public code, under the title “Merge commit from fork”. It touched 45 files and added 3,217 lines. The next day, November 19, version 3.24.2 came out.
When you opened the changelog, the list of what changed in that version, you found one line about it: “Security: Improve validation of cached CSS, font and preconnect files”. That line has no CVE number, and it says nothing about someone running code on your site.
So from November 18, the old line and the fix stood next to each other in public, for whoever opened the project. As a site owner, you got a version number and that one line.
On November 23, the security company published the hole in its vulnerability database. On November 25 at 12:09 UTC, the CVE record went online. A little over three hours later came the first attack, six days after the fix was out.
And this was not the first time that report from the browser caused trouble this year. The same rocket_beacon address had another hole that worked without a login. Through the report, an attacker could store his own script in the pages of the site. That is called stored cross-site scripting, and it got the number CVE-2026-5934. It was in WP Rocket up to version 3.21.0.1. Wordfence published it, and three researchers are credited with finding it.
Then on October 1, version 3.23.5 came with this line: “Sanitize image srcset data collected by the beacon before storing it”. With 3.24.2, that makes at least three security fixes in one year for what that report sends into your site.
The attackers keep their PHP files in different places. Some sit on bare IP addresses. Some sit behind nip.io names. A nip.io name has an IP address inside it and points straight to that address, so you do not need a domain of your own. Some sit behind trycloudflare.com addresses. Those are quick tunnels that Cloudflare gives out without an account, and they stop working when the tunnel stops. And some sit on other WordPress sites that were likely hacked before.
Before they attack, a few first check if your site is vulnerable in a way that does not show their own server. One group sent exactly the same request from four home internet connections. The researchers see that as a rotating proxy pool, a service that sends traffic out through many home connections in turn, so it looks like it comes from ordinary households.
The researchers also listed the ten addresses that sent the most. Together they were good for about half of the attempts they blocked. The busiest one, 103.235.74.71, sits at a provider in Indonesia and sent 5,352 requests. Three of the ten are at DigitalOcean, a cloud provider.
In cybersecurity, attribution is one of the hardest problems. IP addresses can be rented and borrowed, and servers can be hijacked. What we know is how this attack works and where the requests came from. Who is behind them, none of the sources says.
Updating WP Rocket closes the hole, but whatever the attacker already left on your site stays there.
The security company Imunify360 describes what these attacks leave behind. The attackers drop PHP files with names that start with wp-media-, then eight characters, digits and the letters a to f, and then .php. They sit in wp-content/ and in wp-content/uploads/. The company behind WP Rocket is called WP Media.
The first file is often small. It runs whatever commands the attacker sends to it, and that is called a webshell. It has the same rights as your website, so it can read what your website reads. That includes wp-config.php, the file in the main folder where WordPress keeps the name, user and password of its database.
Then the attackers put a file in wp-content/mu-plugins/. That folder is for must-use plugins. WordPress turns those on by itself, you cannot switch them off from your dashboard, and they do not show up in your normal list of plugins. They sit in a separate Must-Use section. The file the attackers put there puts their other files back when you delete them.
And they add an administrator account for themselves.
WP Rocket says it in its own advisory too: files or accounts an attacker already created need a separate investigation.
If you run WP Rocket, this is what I would do:
- โ Check the version on your Plugins screen. 3.24.2 or later has the fix
- โ If you cannot update yet, switch off both settings under WP Rocket, Page Optimization, Image & Media. On versions before 3.24, they sit in the Media tab
- โ Look for PHP files that start with
wp-media-inwp-content/,wp-content/uploads/andwp-content/wp-rocket-config/ - โ Open the Must-Use section on your Plugins screen and the folder
wp-content/mu-plugins/, and check each file you did not put there yourself - โ Go through Users, filter on Administrator, and look for accounts you do not know
- โ Search your logs for
rocket_beaconrequests from a visitor that never loaded the page it reports on, or that sends a full web address where WP Rocket expects only a domain name - โ Ask your host for the outgoing connections of your server. Requests to
nip.ionames ortrycloudflare.comtunnels are a warning sign, according to the researchers who saw the attacks
For people who manage a lot of sites, WP Rocket put out a small helper plugin that switches the two settings off. With WP-CLI, the command line tool for WordPress, you install it like this:
| |
On a multisite network, WP Rocket says to activate it on each subsite with the --url option.
Want to see a request like rocket_beacon for yourself? Run a WordPress test site behind Burp Suite and watch each admin-ajax.php call go by.
My Ethical Hacking Complete Course Zero to Expert takes you there step by step: reconnaissance, scanning, exploitation and traffic analysis, hands-on, from your first day with no Linux or hacking background.
โ Join my complete ethical hacking course
Hacking is not a hobby but a way of life.
Sources:
WP Rocket security advisory | Patchstack: WP Rocket RCE under active attack
Stay updated
Get the latest posts in your inbox every week. Ethical hacking, security news, tutorials, and everything that catches my attention. If that sounds useful, drop your email below.