PHP2Shell: The Week the Internet’s Engine Needed an Emergency Service

Php2shell the week the internets engine needed an emergency service featured image

If your website is built on WordPress, the most important bit of news this week wasn’t on the front pages. It was a pair of serious security holes in PHP, the software that quietly powers most of the web. The good news first: they’ve been fixed, and the sites I look after are patched.

The security world gave it a suitably dramatic name, PHP2Shell. I’ve had more decaf coffee than is strictly sensible, so here’s what happened, minus the panic and the jargon.

So what is PHP, anyway?

PHP is the engine under your website’s bonnet. WordPress is written in it, along with most of your plugins and your theme.

When someone visits your site, PHP springs into action on your hosting company’s server. It fetches your pages, posts and products from the database, assembles them, and sends a finished page to the visitor’s browser. It does this thousands of times a day without complaint, which is more than can be said for my printer.

You never see PHP and you never need to touch it. But like a car engine, it needs the occasional service and, now and again, a recall.

What went wrong?

This was a recall. Researchers found two flaws in PHP itself, not in WordPress or any plugin. Both were rated critical, scoring 9.2 out of 10 for severity.

In plain English, both were about PHP tidying up badly after itself:

  • Flaw one: if PHP ran out of memory at exactly the wrong moment, it could leave a job half-finished, then later treat that half-finished mess as if it were fine.
  • Flaw two: PHP could keep using leftover scraps from one visitor’s request after it had already thrown them away, and those scraps could get picked up by the next visitor’s request.

Think of a café where the last customer’s order slip is still on the counter when you arrive. Normally harmless. But a clever crook could plant a fake slip and have the kitchen follow it. Here, a well-crafted request could let an attacker run their own code on a web server, without needing a password.

It affected almost every version of PHP from the last decade or so (5.4 right through to 8.5). That’s a lot of websites.

To add to the drama, details leaked on Monday 20 October, a day before the fix was due. That meant the bad guys got a head start, and there were reports of early attacks before the official patch landed. Not ideal.

How was it fixed?

The PHP team released emergency updates on Tuesday 21 October. The fixed versions are 8.2.35, 8.3.36, 8.4.27 and 8.5.12. The fix tackles the root cause, so the various spin-off versions of the attack are covered too.

Because PHP runs on your host’s server, not inside WordPress, it’s your hosting company that installs these updates. The good hosts moved quickly:

  • SiteGround, where most of the sites I look after live, didn’t wait for the official fix. They put protective rules in place across their servers before the patch was out, then rolled out the new versions.
  • Other hosts have been rolling out the patched versions too, some quicker than others.

Versions of PHP that are already out of support (8.1 and older) won’t get the fix at all. The US government’s cyber security agency went as far as advising that sites on those versions be taken offline until they’re upgraded. Which is a polite way of saying “please stop using that”.

What I did about it

As soon as the news broke, I checked the PHP version of every site I look after. Most are on SiteGround and were protected before the official fix arrived, then updated to the patched versions.

A small handful on other hosts were a version behind. I’ve dealt with those, chasing the hosts and moving sites to newer PHP where needed.

I also keep an eye on each site’s PHP error log and security alerts as part of my monthly plans, so if anything odd turns up, I’ll spot it.

Do you need to do anything?

If I look after your website: no. Put the kettle on and have a Jaffa Cake. It’s handled.

If nobody looks after your website: it’s worth a quick check. You can see your PHP version in WordPress under Tools → Site Health → Info → Server. If it isn’t one of the patched versions above, or it’s 8.1 or older, contact your hosting company today.

A heads-up about PHP 8.2

While we’re on the subject, PHP 8.2 stops getting security fixes on 31 December 2026. It’s patched for this week’s problem, but after New Year it won’t be patched for the next one.

Quite a few sites are still on 8.2, so over the coming weeks I’ll be moving the sites I look after on to a newer version. I’ll test each one first so nothing breaks. If yours is affected, I’ll be in touch.

The moral of the story

Weeks like this are exactly why website care matters. Not because disaster struck, but because it didn’t. Someone was watching, the right updates went on, and nobody’s Tuesday was ruined.

If you’d like that kind of peace of mind for your own site, have a look at my Site Care plans or drop me a line. I speak human, I promise.