News

PHP2Shell: the critical PHP flaws, and how to patch them

Two critical flaws in PHP itself, found with help from AI, were patched on 21 October. Which versions fix them, and what to do if you can't update yet.

If you run PHP, update it now. PHP 8.5.12, 8.4.27, 8.3.36 and 8.2.35, released on 21 October, fix two critical flaws in PHP itself that can let an attacker run code on your server.

Table of PHP branches and their PHP2Shell fixes: 8.5.12, 8.4.27, 8.3.36 and 8.2.35 were released on 21 October 2026, while PHP 5.4 to 8.1 have no upstream release and rely on source or vendor backports
Graphic: Mavday. Sources: php.net, PHP Foundation, GitHub advisories, AWS bulletin 2026-143-AWS

The flaws, now known as PHP2Shell, sit in the core of PHP, not in an extension or a framework. That means a plain site can be exposed. Wiz, one of the teams that found them, says “even a simple ‘Hello World’ application running on an affected PHP version can be vulnerable.”

What the PHP2Shell flaws are

There are two bugs, both rated 9.2 Critical by the PHP project (CVSS 4.0):

CVE-2026-109618 CVE-2026-109619
PHP’s title RCE via OOM corruption RCE via stale global state
What goes wrong Running out of memory during request start-up or multipart parsing corrupts state State from one request survives into the next request on the same worker
Scores PHP 9.2 (CVSS 4.0), NVD 9.8 (CVSS 3.1), Red Hat 8.1 Same

php.net says the risk covers “all PHP installations serving web requests”. That includes PHP-FPM, Apache with mod_php, php-cgi, FrankenPHP and LiteSpeed. It considers mod_php the most exposed, “with a demonstrated exploit where an unauthenticated request can trigger the attack before any application code runs.”

The official advisories cover branches 8.2 to 8.5. AWS, Wiz and Calif say older versions are affected too, going back to PHP 5.4.

Which versions fix it

Branch Fixed in
PHP 8.5 8.5.12
PHP 8.4 8.4.27
PHP 8.3 8.3.36
PHP 8.2 8.2.35 (security support ends 31 December 2026)
PHP 7.4, 8.0, 8.1 No release. PHP published source backports for people building from source
PHP 5.4 to 7.3 No upstream fix. Only vendor backports

One trap: your distribution’s version number may not match these. Ubuntu, for example, patched PHP 8.3 on 24.04 LTS as 8.3.6-0ubuntu0.24.04.13 (USN-8948-1). So php -v won’t show 8.3.36 even when you’re patched.

Check your package version against your vendor’s advisory, not against php.net. Red Hat rates the flaws Important. When we checked on 22 October, its bulletin said some fixes were out and others were still in progress.

If you can’t update today

php.net says “There are no complete mitigations, updating is the only safe choice.” Its advisory lists stopgaps:

  • For CVE-2026-109618: set memory_limit=-1 and enforce it with php_admin_value so apps can’t change it. Keep post_max_size small (8M without uploads, 32M with), with upload_max_filesize below it. Limit request sizes at your proxy, and use a container or cgroup memory limit.
  • For CVE-2026-109619: set session.upload_progress.enabled=0 in php.ini, the FPM pool or server config, then restart every worker. php.net warns: “Do not rely on ini_set() or FPM .user.ini.” On PHP 8.5, also set fatal_error_backtraces=0.

Table of PHP2Shell stopgaps: memory_limit=-1 enforced with php_admin_value, a small post_max_size and request size limits at the proxy cover CVE-2026-109618; session.upload_progress.enabled=0 and, on PHP 8.5, fatal_error_backtraces=0 cover CVE-2026-109619

The stopgaps php.net lists for each bug. None is a complete fix: updating is the only safe choice. Graphic: Mavday. Source: php.net security advisory, 21 October 2026

Each setting only covers one of the two bugs, and php.net says neither is complete. The UK’s National Cyber Security Centre goes further.

If you can’t apply those stopgaps either, it says to “consider taking the system offline until it can be fully mitigated.” If you can’t update or take it offline straight away, it says to check for signs of compromise first and look for “backdoors installed by an attacker”.

How AI models found them

Three teams found the bugs separately, with help from AI models. The PHP Foundation says the security firm Calif reported the first bug on 11 August. OpenAI “independently reported the same root cause on the same day”. Wiz reported both bugs on 24 August.

OpenAI says Calif found the flaw “using GPT‑5.6 Sol as part of our Patch the Planet initiative”. That’s OpenAI’s programme, built with Trail of Bits, for coordinating fixes when AI agents find serious bugs.

Calif’s own write-up says “No special harness, or access to models that weren’t generally available to everyone were used”. Wiz says it used “Wiz Atlas, Gemini 4 Argon and GPT-5.6 Sol”. We’ve covered how far AI tools now go in reading other people’s code, in our piece on the Reverse Engineer Anything tool.

The root problem wasn’t new. The PHP Foundation says a developer it contracts spotted it in 2024, but a fix stalled for months. It calls that delay “a structural failure”, caused by its security team’s “decision process and its lack of resources.” The team worked by consensus and is changing so it can decide by majority.

What’s disputed

Whether it’s being exploited. AWS says its honeypots saw an exploitation attempt on 17 October, four days before disclosure. It says “PHP2Shell is now being broadly exploited in the wild”.

Of the attempts it logged before the release, AWS also says “it’s unclear if any of these attempts would have succeeded in real-world systems.” The PHP Foundation says the PHP security team “did not identify any functional exploits at the time of release/public disclosure”.

How hard it is to exploit. In a blog post, Elias Taylor wrote that exploiting it “is significantly harder than people are making it out to be”. He says the public proof-of-concept code on GitHub doesn’t work against plain PHP, but still: “You should patch your servers anyway.”

Red Hat also says PHP-FPM, which standard Red Hat Enterprise Linux set-ups use, makes remote code execution “difficult in practice”. On the other side, Calif and PHP’s own advisory say it was proved against default mod_php set-ups. Wiz says its exploit worked on the latest WordPress, Drupal and Joomla container images. None of them has published a working exploit.

The leak. Details were meant to stay secret until 22 October. The PHP Foundation says CVE numbers leaked on 20 October, and that Calif “mistakenly published a video” of its exploit that evening.

It also says Chainguard “unilaterally broke the embargo” by publishing fixed container images early on 21 October. Chainguard’s chief executive, Dan Lorenc, told The Register his company “didn’t leak” and that “People were getting hit in advance”. PHP had already brought the release forward to 21 October after the CVE leak.

What happens next

Watch your vendor’s advisory if you’re on Red Hat, an older Ubuntu release or a managed host. AWS says to investigate your logs “from at least starting on October 17th.”

AI agents that find bugs can also cause them. Our report on OpenAI agents that weakened their own monitoring covers what to lock down when an agent has write access to your code.

Get the builder’s briefing

Twice a week: the AI news worth knowing, from new models and agents to the money behind them. No hype, no spam.

We’ll email you to confirm before the first issue. Unsubscribe any time. See our privacy policy.

Sources

15
  1. Security advisory: Critical remote code execution vulnerabilities, update now · php.net, 21 Oct 2026
  2. Today's PHP Security Release, and How We're Strengthening PHP Security · The PHP Foundation, 21 Oct 2026
  3. GHSA-w8hw-w9fx-j79w: RCE via OOM corruption · php/php-src on GitHub, 21 Oct 2026
  4. GHSA-6wmf-4rv5-p3rp: RCE via stale global state · php/php-src on GitHub, 21 Oct 2026
  5. CVE-2026-109618 · NVD, 21 Oct 2026
  6. Patch the Planet: global response coordination as agents uncover critical vulnerabilities · OpenAI, 21 Oct 2026
  7. PHP2Shell: AI uncovers critical RCE vulnerabilities affecting 70% of the Internet · Wiz, 21 Oct 2026
  8. A tale of two PHP remote vulnerabilities · Calif, 21 Oct 2026
  9. PHP web runtimes (CVE-2026-109618 and CVE-2026-109619) · AWS, 21 Oct 2026
  10. Amazon Threat Intelligence identifies PHP2Shell exploitation prior to public disclosure in MadPot · AWS Security Blog, 21 Oct 2026
  11. Critical security issue affecting PHP · UK National Cyber Security Centre, 21 Oct 2026
  12. USN-8948-1: PHP vulnerabilities · Canonical, 21 Oct 2026
  13. RHSB-2026-013 Request handling memory corruption - php (CVE-2026-109618, CVE-2026-109619) - "php2shell" · Red Hat, 21 Oct 2026
  14. There isn't an easy exploit for this PHP vulnerability · Elias Taylor, 21 Oct 2026
  15. PHP blames supply chain security biz Chainguard for putting huge chunks of the web at risk · The Register, 22 Oct 2026

Dominik Studzinski

Software Engineer · Co-founder

Dominik is a software engineer and co-founder of Mavday. He writes about building with AI: retrieval, evaluation and the engineering that turns a demo into something you can ship.

Work with us on a tutorial for your product

Related reading

See all

Latest