Writing

PHP2Shell: the bug under seven in ten websites

· 9 min read

Last week, a lot of the internet did something unusual. It switched itself off on purpose.

The Dutch government portal went dark. So did every website of the French Interior Ministry. Canadian government sites came down for a while. Wikipedia’s owner shut many of its support tools, the Internet Archive went briefly offline, and even 4chan and Something Awful closed their doors. When government ministries and 4chan agree on something, you know it is serious.

The reason was PHP2Shell: two bugs in PHP, the programming language running underneath most of the web. Most of these sites went offline as a precaution, before anyone knew whether they had been attacked. Nobody wanted to find out the hard way.

The PHP mascot, the elePHPant. Photo: Atomic Taco, CC BY-SA 2.0, via Wikimedia Commons
The PHP mascot, the elePHPant. Photo: Atomic Taco, CC BY-SA 2.0, via Wikimedia Commons

First, what is PHP?

When you open a web page, a computer somewhere has to build it for you: fetch your account, your basket, the latest posts. On most websites, the language doing that building is PHP. WordPress is written in it, and so are Drupal, Joomla, Magento, Moodle, Nextcloud and MediaWiki.

PHP is the plumbing of the web. Nobody puts plumbing on their holiday photos, and nobody thinks about it until the kitchen floods.

Data: W3Techs. Chart: my own
Data: W3Techs. Chart: my own

What went wrong

The two bugs have the official names CVE-2026-109618 and CVE-2026-109619. Both are rated 9.2 out of 10 for severity. Both let an attacker run their own commands on a web server without logging in, which is roughly the worst thing a web bug can do. The name PHP2Shell comes from Wiz, one of the security firms that found them: from PHP to a shell, the command line of the server.

The best way I found to understand it is a busy restaurant.

A PHP server has a few workers, like waiters, and each one serves many visitors one after another. Every visitor gets a fixed amount of memory, like a tray. If a request needs more than its tray, PHP stops the job immediately and jumps to an emergency exit.

Now imagine a waiter carrying a stack of plates who is told to drop everything and leave, right now. Some plates are still on the table, half cleared. The waiter comes back and serves the next customer at the same table, using whatever is lying there. The first bug, the “out-of-memory” one, is exactly this: PHP is interrupted at the wrong moment and leaves half-finished data behind that it later treats as valid. The second is similar: a bit of internal state from one visitor survives into the next visitor’s request after its memory has already been freed.

Source: Imperva and Help Net Security. Diagram: my own
Source: Imperva and Help Net Security. Diagram: my own

The nasty trick is that the attacker plays both customers. The first request is a giant file upload, built to make PHP run out of memory at just the right moment. The second request arrives at the same worker and finds the leftovers waiting. If the attacker has also arranged what is sitting in that freed memory, PHP ends up running the attacker’s instructions as if they were its own.

Two details make this worse than an ordinary bug:

  • It happens before the website’s own code even starts. The trigger is in how PHP reads uploads, so a perfectly written website is exposed too. The researchers say even a simple “Hello World” page on an affected PHP version is vulnerable. You can lock every door of your house, but it doesn’t help if the foundation has a hole.
  • It is old. The researchers found affected versions going back to PHP 5.4. Reuters reported the flaws had existed for about a decade. In internet years, that is roughly the Stone Age.

In one variant, the leftover memory is sent straight back to the attacker inside a cookie, about 67 KB of the server’s memory at a time. Sansec warns that this could include passwords, session tokens and secret keys. Imagine asking a waiter for the bill and getting the restaurant’s safe combination stapled to it.

Found with the help of AI

In July I wrote about an AI that hacked Hugging Face to pass its exam. This time, AI is on the side of the good guys. Mostly.

The bugs were found in August by two teams independently. Ryan Austin at the security firm Calif found them while auditing PHP’s code with OpenAI’s GPT-5.6 Sol, as part of OpenAI’s “Patch the Planet” project. Wiz Research found them using Google’s Gemini 4 Argon, GPT-5.6 Sol and its own tool. Wiz says the AI models helped work through the complicated chain of steps needed to turn the bugs into a working attack, and that the models made that much easier than it used to be.

Wiz did not undersell it either: “These findings rank among the most severe vulnerabilities discovered in PHP, and arguably in software history.” It compared PHP2Shell to Heartbleed, the famous bug from 2014. Heartbleed was also the first bug I remember having its own logo. Now PHP2Shell has its own website too. Bugs have better marketing than most start-ups.

The Heartbleed logo from 2014. Image: Leena Kurjenniska / Codenomicon, CC0, via Wikimedia Commons
The Heartbleed logo from 2014. Image: Leena Kurjenniska / Codenomicon, CC0, via Wikimedia Commons

There is an awkward part to the story. According to ITdaily, a 2024 security audit had already spotted early signs of the memory problem. No way to attack it was known then, the team could not agree on a fix, and other things took priority. The PHP project itself called the delay a “structural failure”. So a human spotted the drip two years ago, and an AI later showed how big the flood could be.

Then the surprise got spoilt

Normally, a bug like this follows a careful plan. The finders tell the developers in secret, the fix is prepared quietly, big companies and Linux distributions get it in advance, and everything is released at the same moment. Calif reported the first bug on 11 August. The release was set for 14:00 UTC on 21 October. That is more than ten weeks of keeping a secret that affects seven in ten websites. Anyone who has tried to plan a surprise party knows how this ends.

Source: Sansec, Help Net Security and BleepingComputer. Chart: my own
Source: Sansec, Help Net Security and BleepingComputer. Chart: my own

On 20 October, PHP announced that a security release was coming. The same day, details leaked online, with a wrong release time and an inflated severity of 10 out of 10. Calif accidentally published a video of its exploit. The company Chainguard released its own fixed software more than six hours before the official patch, which let attackers compare old and new code to see what had changed. The PHP Foundation was, politely put, not pleased. It said the early release broke the embargo and undid weeks of coordinated work. Chainguard’s CEO Dan Lorenc apologised for the extra stress and said disclosure “is rarely flawless”.

The strangest detail came later. Amazon’s trap servers, called honeypots, recorded an attack attempt on 17 October, four days before the fix was public. Amazon does not know how the attacker got the details that early.

On release day, Cloudflare saw early attacks at 07:43 UTC, hours before the fix came out. The UK’s National Cyber Security Centre told organisations to take offline any system they could not fix immediately. Security researcher Kevin Beaumont predicted “a mass of incidents” and called it “one of the biggest vulns in years”. That is why so many sites pulled the plug.

Wikimedia’s bug tracker, taken offline on release day. Screenshot: Wikimedia Foundation, CC BY 4.0, via Wikimedia Commons
Wikimedia’s bug tracker, taken offline on release day. Screenshot: Wikimedia Foundation, CC BY 4.0, via Wikimedia Commons

So was it as bad as it sounded?

So far, the answer is: less than feared, but more than nothing.

The security firm Sansec looked closely at the public exploits and found that they did not work against a default PHP installation. Most needed the target website to have a second, separate bug, and some only worked because that bug had been added to the test server on purpose. PHP’s own security team said none of the exploits published before the patch actually worked. The real attack needs the right server setup and good timing, and when the timing is off, the server can simply crash instead.

Difficult still means possible, though. Over the weekend, Adel Karimi from Perplexity caught a real, successful attack on one of his honeypots, running PHP 8.4.26 on Apache. He pointed out that his trap was deliberately set up in a way that suited the attacker. On Monday, the US cyber agency CISA added both bugs to its list of vulnerabilities known to be exploited, and gave federal agencies until Thursday to patch.

And on Friday, PHP shared temporary advice for a third, related bug, CVE-2026-115560, which has no fix yet. It only works with “an unusual combination of configuration and application code”, and switching off the session upload progress feature blocks it for now. So the plumber has left, but asked everyone not to use the upstairs shower for a while.

The tiny team behind it all

The quote that stayed with me most came from Elizabeth Barron, the executive director of the PHP Foundation, speaking to Reuters:

“We have one full-time staff member (that’s me) and 14 mostly part-time contractors.”

So the language under roughly seven in ten websites, used by governments, universities and online shops, is looked after by one full-time employee and a group of part-timers, funded by donations and grants. The board members are unpaid volunteers. Reuters also reported that, thanks to AI, proposed code changes have nearly doubled in a year, while the number of contributors has not.

There is a famous xkcd comic called “Dependency” about exactly this: a tall tower of modern software resting on one small block that someone has been quietly maintaining for years. Programmers share it as a joke. Last week it read more like a news report.

What I think

A bug that only works if the server runs out of memory at exactly the wrong moment sounds like something you would only ever see in a lab. That was my first thought. The more I read, the less I believed it.

Old bugs exist in every large piece of software, so that part does not surprise me. The speed does. The same AI tools that helped the good guys find these bugs can help others find the next ones. And as we saw with the leak, once a fix exists, attackers can work backwards from it within hours. The time between “a fix is out” and “someone is attacking you” used to be days or weeks. Now it is shrinking towards hours.

As a project manager, the part I keep thinking about is the 2024 audit. Someone saw the problem two years ago. It stayed open because nobody could prove it was dangerous, the team could not agree, and there were other priorities. Every risk register knows this kind of entry: rated “medium”, discussed once, then left alone until it becomes the only thing anyone talks about. I don’t read that as carelessness. A small team with almost no budget has to choose, and the quiet risks usually lose.

I also think the reaction was mostly right, even if the bugs turned out harder to use than the headlines suggested. When the plumbing of the internet might be broken, closing the shop for a day while you check is sensible. I would rather read a slightly embarrassing “we went offline for nothing” than a “we stayed online and lost everyone’s passwords”.

And finally, the money. Big tech companies are spending enormous sums on AI, and their AI just found a decade-old hole in a language they all depend on. Fixing it fell on a foundation with one full-time person. If even a tiny share of the AI budget went to the people who maintain the web’s plumbing, the next PHP2Shell might be found and fixed in 2024, not on the front page in 2026.

If you run a website, or pay someone who does, now is a good moment to ask a simple question: which PHP version are we on? The fixed versions are 8.5.12, 8.4.27, 8.3.36 and 8.2.35. Anything older than 8.2 is no longer supported. If the answer is “we’re not sure”, that is the real bug.

Sources