30 November 2026, Monday News and writing on self-hosting, AI and economics efeer.im
Efe Erim Blog
News

PHP2Shell: the engine under the internet patches a bug from 2012

The 20-second version: Two critical vulnerabilities were found in PHP, the software that runs most of the websites on the internet, and a patch came out on 21 October. Attacks began before the patch was released, but the expected devastation never arrived, because exploiting the flaws requires extra conditions on the target. If your server runs PHP and its version number isn’t one of the four listed at the end of this post, you still have work to do.

One morning in the Netherlands, websites took themselves offline

On the morning of Wednesday 21 October, several websites in the Netherlands took themselves offline. They included Tweakers, the country’s most-read tech site, the website of the House of Representatives, the national cyber security centre NCSC and Security.NL. None of them had been attacked. They went down as a precaution, because of a risk that nobody could yet say had actually been exploited. The reason they shut down was a name: PHP2Shell.

On the same day, the UK’s National Cyber Security Centre told organisations to consider switching off any systems they couldn’t patch straight away. You very rarely hear that advice. It’s the quickest way to tell people how serious a vulnerability is.

What PHP is, and why nobody can avoid it

When you open a page in your browser, a large share of the code that builds that page is written in PHP. That covers WordPress, Nextcloud, Magento, Drupal, Joomla, MediaWiki, phpMyAdmin and Roundcube, along with corporate websites, government services, online shops and media sites. It’s misleading to think of PHP as a single program. It works more like an engine that sits underneath the web server, and every request passes through it.

That’s why the most frustrating part of PHP2Shell was this: the flaw wasn’t in the sites’ own code. It was in the engine underneath that code. Cleaning up your shop’s or your blog’s code changes nothing. The patch has to go into PHP itself.

Two flaws, one outcome: code execution without logging in

The two vulnerabilities have been assigned CVE-2026-109618 and CVE-2026-109619. Both score 9.2 out of 10, and both lead to the same place: an attacker can run their own code on the server without logging in. The affected setups are PHP-FPM, mod_php on Apache, php-cgi, FrankenPHP and LiteSpeed. The riskiest is mod_php, where a single request can trigger the attack before any application code has run.

Technically, both bugs are about memory. If PHP is interrupted at an unexpected moment while handling a request, typically by hitting the memory limit and crashing, it leaves half-finished internal data behind. The next request assumes that data is intact and uses it. What makes the two flaws so serious is less the bug itself than where it sits: memory management and error handling, two places that every request passes through.

The nastiest detail is in the second flaw. CVE-2026-109618 doesn’t just execute code. It leaks memory too. PHP’s file upload progress mechanism can send freed worker memory back to the client inside the response cookie (PHPSESSID). That memory can contain passwords, session tokens, API keys and even TLS private keys left over from other requests. This path works without your application code ever running, so it works even on a site that never starts a session.

The PHP project's critical security announcement, 21 October 2026
The PHP project’s announcement of 21 October, covering the two vulnerabilities, who is affected and the patched versions (source: php.net).

This bug has been there since 2012

The patches were released on 21 October at 14:00 UTC as PHP 8.2.35, 8.3.36, 8.4.27 and 8.5.12. But the code path containing the bug goes all the way back to PHP 5.4.0, released in 2012. So the code the internet patched that day was fourteen years old.

Timeline of the PHP2Shell vulnerability, from 2012 to 21 October 2026
The fourteen years between the year the bug shipped and the day the patch came out.

The first sign appeared in an external security audit in 2024. At the time there was a theory about how it could be exploited, but nobody found a real way to do it. In August 2026, the security firm Calif reported unconditional remote code execution from the same root cause. OpenAI independently confirmed that root cause, Wiz found additional ways to exploit it, and Trail of Bits started auditing the engine. From then on, the fix was the PHP Foundation’s top priority.

The PHP Foundation’s own post is open about the time it took. Several approaches to the fix were tried, and each one came at the cost of breaking backward compatibility or creating a new denial-of-service risk. The team couldn’t reach a unanimous decision, and the work stalled and restarted for months. In the Foundation’s words, the delay was a structural failure, caused both by the team’s decision-making process and by a lack of resources. PHP runs most of the world’s websites, yet its security work depends on a handful of developers paid by the Foundation and on volunteers.

This time round, it was AI that sped things up. According to Wiz’s assessment, the exploit chain was at the limit of what a human researcher would have the patience for, and frontier models lowered that barrier. The same tools were also used for defence. PHP’s own code scanning, the triage of incoming reports and the verification of exploits are now done with models. The Foundation’s main point is this: the tools find bugs faster, but the decision about which fix is the right one is still made by engineers who know the whole codebase, and there are very few of them.

Disclosure discipline broke down

The plan was for the patch to ship on 22 October, with distributions ready so that everyone could update on the same day. It didn’t go to plan. On 20 October, at around 18:00 Turkish time, the CVE numbers started circulating on forums and social media, along with an incorrect score of 10.0 (the real score is 9.2). No technical details leaked, but within hours the project published its advance notice and moved the release forward by a day.

Then two more links in the chain broke. One of the firms that had reported the flaw accidentally published an exploit video, and a container company broke the embargo six hours early by making its fixed images public. So before the patch was officially out, the fix was already circulating where anyone could examine it. Meanwhile, Amazon’s honeypot network logged an exploitation attempt on 17 October, four days before the flaw was announced. The attempt came through an anonymisation service. Nobody yet knows how the attackers learned the details.

So why didn’t the expected devastation arrive?

People expected a wave like Log4Shell or Shellshock, where a single request could hit everyone. It never happened. According to an assessment published on 22 October, the public exploit tools don’t work against a default PHP installation. The attack needs specific knowledge of the target server and extra conditions, often a separate flaw in the victim’s own application, such as a file inclusion bug. Some attempts only work once someone has added a bug like that to a test server by hand. So far, nobody has demonstrated a chain that hits everyone with a single request.

That doesn’t make the flaw harmless. Attacks really did begin on the day the patch came out, and there’s no official patch for PHP 8.1 or earlier. But the sites that shut down in the Netherlands that day didn’t stay offline because of risk. They stayed offline because of uncertainty. Panic and danger aren’t the same thing.

What I did on my own server

I have five services running PHP, and that morning every one of them was on an unpatched version. I updated them one at a time. There’s no single button for this in a control panel, because some come as container images and some as packages. The lesson for me is clear: the flaw wasn’t in my code, so I couldn’t fix it by cleaning up my own site. The only fix is to update the engine underneath, and that update usually isn’t in your hands. If you use a hosting provider, it happens on their schedule.

My second takeaway is more uncomfortable. What left this bug unfixed for two years wasn’t technical difficulty. It was a shortage of people to make the decision and of money to pay them. Right now, the security of an internet-facing engine runs on a budget that nobody is paying for. That’s why a flaw like this doesn’t simply go away once it’s patched. In network appliances, control panels, embedded devices and similar places, the same code keeps running until the vendor releases a new image. This time round, an enterprise network operating system was disclosed as affected, and a fixed version hasn’t been released yet.

What to do today if you run a server

Type php -v on the server and check the version number it shows. If it isn’t 8.2.35, 8.3.36, 8.4.27 or 8.5.12, you need to update. Distribution packages are out for Ubuntu, Debian and Red Hat. There’s no official patch for PHP 8.1 and older, but some distributions and commercial support providers have backported the fix to older versions. If that’s your situation, check your distribution’s own security advisory. If you don’t manage your server yourself, you only need to ask your provider one thing: which PHP version am I on, and has the patch been applied? For anyone who needs to check quickly, an open-source scanner has also been released (php2shell-scanner).

There’s no timeline for the devices that will never get the patch. They’ll stay vulnerable. The story is over for now, but this code path sat on a shelf for fourteen years without anyone looking at it. We don’t yet know what else is on that shelf.

Sources

Image sources: the cover image is an illustration made for this post. The announcement screenshot comes from php.net’s security announcement of 21 October 2026. The timeline was made for this post using the dates given in the PHP Foundation’s and Sansec’s statements.

The technical details in this post are based on the PHP project’s announcement of 21 October, the PHP Foundation’s statement and Sansec’s research note.

This post was translated with the help of AI. Read the original (Türkçe)

More from News

See all
Subscribe
Notify me of:
0 0 Comments
Oldest
Newest Most liked

Language