Arranca IO

A critical PHP flaw, 140 sites, one day

On October 21 a flaw was disclosed in PHP itself, the software under WordPress and most of the web. Here is what the day looked like from the side that answers for the sites.

On the morning of October 21 two flaws in PHP were disclosed together, under the name php2shell. PHP is the language under WordPress, Laravel and most of the web, so this was not a plugin problem that a plugin update fixes. A single request, sent before any of the site's own code runs, could take over the server. There was no public scanner, no way to tell from a site's pages whether it had been hit, and the fix was a new PHP release that every host had to roll out on its own schedule.

Here is what the day looked like for us. We are on care plans for our own clients and for an agency partner's clients, about 140 sites between two hosting accounts, and a care plan means this is our problem before it is theirs.

Morning: find out where everything stands

The first hour went on reading, from the people who found the flaw and from PHP itself, to get three facts straight: which versions were fixed, which were not, and what could be done while waiting. The fixed releases were new versions of PHP 8.2, 8.3, 8.4 and 8.5. Anything on 8.1 or older had no fix coming, because those branches are no longer maintained.

Then a sweep. A script asked every site which PHP version it was running and wrote down the answer. The result: every site was one release behind, which was expected, since the fix had been out for an hour. Thirty-seven were on versions that would never get a fix. Those were the real exposure, and they had been for a while. A site on an unmaintained PHP branch is one disclosure away from this every day of the year.

Afternoon: move the sites that had no fix coming

The thirty-three WordPress sites in that group had to move to a supported PHP version that day, before the fix even arrived, so that when it did they would get it. Moving a site to a newer PHP is not free: code written for an old version can stop working on a new one. So before touching anything live, we ran each site's code through a check for the things PHP 8 no longer accepts, and found them: constructors written the old way, a function PHP removed years ago, a lazy way of opening a code block. We patched those files first, keeping the originals.

Then the move, on one account through the host's API and on the other with a small switch at the top of each site's configuration, in batches of a few sites at a time, with a check from the outside after each one: homepage, login page, two inner pages, the right version in the response, no error page. Anything that failed the check rolled back on its own. Two sites did break, each from a leftover file from an old host that nobody had looked at in years. Both were found and repaired within the hour.

Night: confirm the host's fix when the version number did not change

The host rolled its fix out that night, and here is the part worth knowing if you ever have to check this yourself. It shipped the fix as a backport: the same PHP version numbers, with the fix applied underneath. The sweep from the morning could no longer tell a patched server from an unpatched one, and anyone waiting for the number to tick over would wait forever.

We confirmed it another way. On the server itself, the PHP packages showed the rebuild date and the install time, half an hour after the platform vendor declared the fixed builds stable, and every running PHP worker pointed at the new files. That, with the host's own status page, was the evidence. One of the two flaws had also been blocked fleet-wide by a setting the host already had off, which we checked from inside a running site.

After: what is left, and what it cost

By the end of the week every client on a care plan had a note saying their site was protected, what we had done, and that nothing was needed from them. Three old Laravel applications could not simply be moved and needed proper upgrades; one is done, two are scheduled. A handful of sites on other hosts were checked one by one. And the thirty-three sites we moved are now on a version that itself stops getting security fixes at the end of this year, so the next move is already planned, with the same checks run first.

Nobody's site went down for a visitor. The whole day cost the clients nothing beyond what the care plan already covers. That is the point of the plan: when something like this lands, someone who already knows your site is looking before you have read the news. What the plans include, and what to do if you are not on one and something is wrong right now.