Back to articles

PHP2Shell: what happened in PHP in autumn 2026 and what is still left to do

PHP 16 min read

Updated on 16 November 2026. Patch status can change: links to the official advisories are given throughout the text.

On 21 October 2026, the PHP project shipped four emergency releases that fix two critical unauthenticated remote code execution flaws, known together as PHP2Shell. Two days later a third flaw was announced, and as of 16 November it still has no fix. In the meantime, attacks have been observed against some very specific equipment.

This article is for developers, technical leads and administrators who run PHP. It walks through the timeline, explains how the two flaws work, lists the fixed versions and ends with the checks to run on your servers, commands included.

Illustration from the PHP Foundations article on the 21 October 2026 security release Image: The PHP Foundation.

The short version

  • PHP 8.5.12, 8.4.27, 8.3.36 and 8.2.35 fix CVE-2026-109618 and CVE-2026-109619. The PHP project says there are no complete mitigations and that updating is the only safe choice (21 October advisory).
  • Every installation that serves web requests is affected, and the risk is rated highest for Apache with mod_php.
  • CVE-2026-115560, announced on 23 October, only affects a rare combination of configuration and code. It is waiting for the next regular bugfix release. Until then, PHP suggests session.upload_progress.enabled=0.
  • Exploitation attempts are happening. They target specific deployments, which does not mean every unpatched PHP server has been compromised.

Timeline

Date Event
2024 External audit of PHP by Quarkslab. While fixing one of the reported issues, a PHP core developer spots the first signs of the memory problem behind CVE-2026-109618. No concrete attack vector is found at the time.
30 July 2026 The security firm Calif starts an audit of PHP as part of the Patch the Planet program.
11 August Ryan A, a researcher at Calif, reports a remote code execution with the same root cause as the 2024 problem.
24 August Wiz reports further attack vectors.
18 September OpenAI reports additional vectors.
24 September Security releases 8.5.11, 8.4.26, 8.3.35 and 8.2.34.
20 October The two CVE IDs leak online. PHP brings its pre-announcement forward: two critical flaws, both rated 9.2 on CVSS 4.0.
21 October Fixed versions and technical details are published.
22 October CERT-FR is aware of proofs of concept for specific PHP deployments.
23 October PHP publishes an advisory on CVE-2026-115560.
26 October Updated Windows builds with Brotli 1.2.1. CERT-FR observes exploitation attempts targeting specific deployments.
29 October Unit 42 reports active exploitation against PAN-OS management interfaces exposed to the internet.
12 November PHP 8.6.0 RC7. The final 8.6.0 release is planned for 19 November.

Sources: PHP Foundation, php.net 2026 news archive, alert CERTFR-2026-ALE-014, Unit 42.

September: routine security updates

On 24 September, PHP released versions 8.5.11, 8.4.26, 8.3.35 and 8.2.34 (changelog). In its 25 September alert, GovCERT.HK says the fixed vulnerabilities could lead to denial of service and lists them: CVE-2025-1218, CVE-2025-14181, CVE-2026-6103, CVE-2026-17545, CVE-2026-91765 to CVE-2026-91769, CVE-2026-92842 and CVE-2026-93682.

These CVEs differ in their conditions and in their impact, so each one has to be read in its own record. None of them is part of PHP2Shell. A server still on 8.4.26, for example, is up to date for September and still vulnerable to both October flaws.

PHP2Shell: two flaws in the heart of the engine

Both flaws sit in memory management and error handling, two areas that nearly every request goes through. The PHP Foundation explains that this is also why they were hard to fix without breaking compatibility, hurting performance or forcing changes on third-party extensions.

CVE-2026-109618: an allocation that fails at the wrong moment

PHP aborts a request that exceeds memory_limit with longjmp(), a jump that leaves the current context abruptly. According to advisory GHSA-w8hw-w9fx-j79w, there are moments when request memory is already reachable before it is fully initialized. If an allocation fails right then, PHP exits without putting that state back in order, and the request shutdown procedure may later read the incomplete data as if it were valid.

The sketch below illustrates the idea. It is deliberately simplified and is not PHP's code.

/* Simplified sketch to illustrate the mechanism. This is not PHP's code. */
jmp_buf bailout;

void handle_request(void) {
    if (setjmp(bailout) == 0) {
        request.data = alloc_struct();  /* the structure is already reachable */
        fill(request.data);             /* an allocation fails here: longjmp(bailout, 1) */
    }
    shutdown(&request);                 /* cleanup reads the half-initialized request.data */
}

The advisory describes several ways to hit the memory limit with a multipart request that appears to stay within PHP's limits: a body without a usable declared length, an unrestricted number of headers in a part, or empty file controls that do not count towards max_file_uploads.

Not every setup is exposed in the same way:

  • With Apache and mod_php, the request shutdown procedure runs even when request startup has failed. The attack therefore triggers before any application code runs, and remote code execution was validated with default settings.
  • With PHP-FPM, the child process exits when startup fails, which blocks that particular path. The technical advisory treats FPM as susceptible based on source analysis and states that no complete exploit has been demonstrated for it on this flaw. The PHP Foundation, for its part, writes that code execution was confirmed on PHP-FPM through application-level code paths.
  • FrankenPHP is considered likely exposed in the same way as mod_php, based on source analysis. LiteSpeed (LSAPI) is closer to the FPM case and has not been validated.

The advisory adds that exploit portability and reliability depend on the PHP build, the extensions, frontend behavior and allocator layout.

Card for advisory GHSAw8hww9fxj79w RCE via OOM corruption on GitHub Image: php-src security advisory on GitHub.

CVE-2026-109619: global state that outlives the request

Between two requests, a PHP worker keeps global state (errors, session, objects, extensions) that points to memory owned by the current request. That state has to be reset before the memory is released. Advisory GHSA-6wmf-4rv5-p3rp explains that a fatal error can interrupt an operation before that reset happens. The next request handled by the same worker can then use a pointer to memory that has already been freed (a use-after-free).

Exploitation takes two requests served by the same worker: one that leaves the state behind and one that consumes it before normal initialization. The advisory confirms two cases:

  • PHP 8.5 fatal error backtraces (fatal_error_backtraces), the basis of the confirmed exploitation on mod_php;
  • session upload progress (session.upload_progress), which is enabled by default and reachable without the application ever calling session_start(). On this path, code execution was validated on both mod_php and FPM.

Hiding errors offers no protection. The advisory states that changing error_reporting, using @, or disabling display_errors and log_errors makes no difference, because the global state is read before PHP decides whether to display or log anything.

Card for advisory GHSA6wmf4rv5p3rp RCE via stale global state on GitHub Image: php-src security advisory on GitHub.

What the patch changes

The patch removes longjmp() for out-of-memory errors. PHP now triggers a delayed stop at the next safe point in the virtual machine, and an immediate process exit with _exit() if memory use reaches a second, higher threshold. For the second flaw, it resets a wider set of state between requests.

Affected and fixed versions

Branch 24 September release First version that fixes PHP2Shell (21 October) Windows rebuild of 26 October
PHP 8.5 8.5.11 8.5.12 8.5.12-1
PHP 8.4 8.4.26 8.4.27 8.4.27-1
PHP 8.3 8.3.35 8.3.36 8.3.36-1
PHP 8.2 8.2.34 8.2.35 8.2.35-1

A few notes to help read this table:

  • As of 16 November, no regular release has shipped on these branches since 21 October. The versions in the third column are therefore also the latest ones (php.net archive).
  • PHP 8.1 and older no longer receive updates from the project. Given the severity, the security team published minimal source backports of the fixes for PHP 7.4, 8.0 and 8.1, meant for people who build PHP themselves. Those branches remain unsupported. CERT-FR lists all 5.x, 7.x, 8.0.x and 8.1.x versions among the affected systems.
  • Linux distributions and LTS vendors received the patches in advance. If you use their packages, their bulletin is the reference, because a package can be fixed without the PHP version number changing.
  • PHP 8.2 reaches end of life on 31 December 2026.
  • PHP 8.6.0 RC4 already contains both fixes. Release candidates are not meant for production.

The -1 suffix on the Windows builds marks a package rebuild with updated dependencies and no change to the PHP source. It ships Brotli 1.2.1, which fixes CVE-2026-111497, an out-of-bounds write during decompression. According to PHP, the vulnerable decoder can be reached through the cURL extension when automatic HTTP response decompression is enabled. cURL disables it by default, but an application or an HTTP client library can turn it on.

What we know about exploitation

There are three levels to keep apart: what is technically possible, what has been shown in a proof of concept, and what has been seen in real attacks.

On proofs of concept, the PHP Foundation recounts how coordinated disclosure went off the rails two days before the planned date. On 20 October the CVE IDs circulated online with a wrong score of 10.0. Calif then published a video of its proof of concept by mistake; it was taken down quickly, but copies spread. On 21 October at 07:41 UTC, Chainguard published images containing the fix, more than six hours before the coordinated release. The foundation says the security team had not identified any functional exploit in circulation at the time of the release. The next day, CERT-FR said it was aware of proofs of concept for specific deployments.

On attacks, CERT-FR writes in its 26 October update that it is seeing exploitation attempts targeting specific PHP deployments. On 29 October, Unit 42 confirmed active exploitation against PAN-OS management interfaces exposed to the internet. Dream Research described a campaign that chains PHP2Shell with a Linux kernel privilege escalation to gain root, and Unit 42 says it verified that attacker's tooling. Palo Alto Networks estimates that roughly 0.02% of its installed base had an exposed management interface and was impacted.

Unit 42 also reports more than 22.6 million exposed instances that are potentially vulnerable, based on Cortex Xpanse telemetry. That figure measures exposure. It does not count compromised servers, and it does not prove that each instance is exploitable.

Header image of the Unit 42 Threat Brief on PHP2Shell Image: Unit 42, Palo Alto Networks.

PHP is also embedded in products that nobody thinks of as PHP applications: firewalls, appliances, admin panels. The Dutch NCSC maintains a list of affected software, which CERT-FR describes as non-exhaustive.

CVE-2026-115560: the third flaw, still unpatched

On 23 October, PHP published an informational advisory about another possible code execution related to session.upload_progress. Three conditions have to be met:

  1. session.serialize_handler is set to php_binary or php_serialize in the configuration;
  2. the application switches it back to php at runtime with ini_set(), before calling session_start();
  3. session upload progress is still enabled, which is the default.

In practice, the affected setup looks like this:

; php.ini or pool configuration
session.serialize_handler = php_serialize
<?php
// Somewhere in the application, before the session starts
ini_set('session.serialize_handler', 'php');
session_start();

An application that never changes the session serializer at runtime is not affected and can keep the feature enabled. PHP considers this combination unlikely in practice and chose to fix it in the regular release cycle, with a full advisory when the next version ships.

Where do things stand? According to the php.net archive as checked on 16 November, the only publications since 21 October are the Windows builds of 26 October and the PHP 8.6.0 release candidates (RC5, then RC7). So no stable version fixes CVE-2026-115560 at this date, which RescuePHP's 14 November follow-up confirms. I found no official source saying whether PHP 8.6.0, expected on 19 November, will include the fix.

To check whether your code matches this case:

# Is the serializer changed at runtime? (remember the vendor/ directory too)
grep -rnE "ini_set\(\s*['\"]session\.serialize_handler" --include='*.php' .

# Configured value. Careful: this command reads the command-line configuration
php -i | grep -E 'session\.(serialize_handler|upload_progress\.enabled)'

Until the fix lands, the protection PHP recommends is a single line:

session.upload_progress.enabled = 0

If you already applied this setting on 21 October as a mitigation for CVE-2026-109619, keep it. The trade-off is that PHP's native upload progress data in $_SESSION is no longer available. Progress bars driven by the browser in JavaScript keep working.

What to do on your servers

1. Check the version the web server actually runs

php -v shows the command-line version, which can differ from the one handling HTTP requests.

php -v                      # command line only
php-fpm8.4 -v               # the binary name depends on the distribution
apachectl -M | grep -i php  # is mod_php loaded?

The most reliable way is to ask the web process itself, with a temporary script served by the server:

<?php
// check-php.php: delete it as soon as you are done
header('Content-Type: text/plain; charset=utf-8');

$fixed  = ['8.2' => '8.2.35', '8.3' => '8.3.36', '8.4' => '8.4.27', '8.5' => '8.5.12'];
$branch = PHP_MAJOR_VERSION . '.' . PHP_MINOR_VERSION;

printf("SAPI    : %s\n", PHP_SAPI);
printf("Version : %s\n", PHP_VERSION);

if (!isset($fixed[$branch])) {
    echo "No fixed version known to this script for this branch: check php.net or your vendor.\n";
} elseif (version_compare(PHP_VERSION, $fixed[$branch], '>=')) {
    echo "The version number includes the PHP2Shell fixes.\n";
} else {
    echo "Version number older than the fixes: check your distribution's bulletin.\n";
}

foreach (['memory_limit', 'post_max_size', 'session.upload_progress.enabled',
          'session.serialize_handler', 'fatal_error_backtraces'] as $key) {
    printf("%s = %s\n", $key, var_export(ini_get($key), true));
}

The version number is not always enough to conclude. A distribution can ship a fixed package under an older number, which is why the third case points you to its bulletin.

2. Update, then restart

Install the fixed versions or your vendor's packages, then restart the processes, containers included. A reload is not enough to be sure every worker is running the new binary.

sudo systemctl restart php8.4-fpm   # adjust the service name to your version
sudo systemctl restart apache2      # or httpd, if you use mod_php

For container images, rebuild them from an updated base image, redeploy, then check the version inside the running container.

3. If the update has to wait

PHP published measures that reduce exposure to specific attack paths and states that they do not make an installation safe. Set them at a level the application cannot override. ini_set() and .user.ini files come too late.

For a PHP-FPM pool:

; /etc/php/8.4/fpm/pool.d/www.conf (example path)

; CVE-2026-109618
php_admin_value[memory_limit] = -1
php_admin_value[post_max_size] = 8M      ; 32M if the application accepts file uploads

; CVE-2026-109619 and CVE-2026-115560
php_admin_flag[session.upload_progress.enabled] = off

; PHP 8.5 only
php_admin_flag[fatal_error_backtraces] = off

For Apache with mod_php:

<IfModule php_module>
    php_admin_value memory_limit -1
    php_admin_value post_max_size 8M
    php_admin_flag session.upload_progress.enabled off
</IfModule>

Read the full advisory before applying these settings, because they have operational consequences:

  • memory_limit=-1 removes the per-request memory limit. PHP advises replacing it with a container or cgroup limit, preferably with a policy that kills only the affected worker. A failing system allocation can still reach the vulnerable path.
  • Avoid RLIMIT_AS and RLIMIT_DATA: they cause exactly the allocation failure that triggers the flaw.
  • upload_max_filesize must stay below post_max_size.
  • Disabling session.upload_progress blocks the confirmed session paths and leaves the other variants open.
  • If the application does not use multipart forms, the technical advisory recommends blocking those requests at the frontend.

CERT-EU recommends that, where patching is not possible, you consider isolating exposed applications from public networks until the fix is applied and verified.

4. Inventory everything that embeds PHP

List your servers, containers and images, then the third-party products that bundle PHP. For those, the fix comes from the vendor and its bulletin is the reference.

5. Look for traces

On a server that stayed exposed without the fix, look for signs of unusual activity. In its Threat Brief, Unit 42 publishes hunting queries for Cortex XDR that spot commands launched from a PHP process or a web worker. Advisory GHSA-6wmf-4rv5-p3rp suggests a log audit: fatal errors, Maximum execution time exceeded, warnings repeated before scripts run. It warns that a clean log does not prove there was no attack.

How these flaws were found, and the role of AI

The PHP Foundation tells the story with unusual candor. In 2024, PHP went through its first external audit in years, funded by the Sovereign Tech Agency, organized by OSTIF and carried out by Quarkslab. A core developer spotted the memory problem while fixing one of the reported issues. A potential exploit was theorized at the time, but no concrete vector was found.

Several fixes were considered. Each had a cost: a compatibility break, new denial-of-service potential, or changes to coordinate across many third-party extensions. The security team, which decided by consensus, could not settle on one, and the work stalled and restarted for months. The foundation calls this delay a structural failure, caused by the decision process and by a lack of resources. It says the team is changing its rules so that decisions can be made by majority.

Things moved in the summer of 2026. On 11 August, Ryan A at Calif reported a remote code execution based on the same root cause. OpenAI reported that root cause independently, and Wiz and OpenAI then added further vectors. From that date on, the fix became the top priority for the whole security team funded by the foundation.

On AI's share of the work, the sources are specific:

  • OpenAI writes that Calif identified the flaw using its GPT-5.6 Sol model, as part of Patch the Planet, and that Wiz independently discovered and reported both vulnerabilities. The company says it provided model access and expertise, and helped test the fixes and prepare guidance.
  • The PHP Foundation says it had PHP scanned earlier in the year with Anthropic's Claude Mythos, through Alpha-Omega, and has since added other tools, including OpenAI's Daybreak Red for validating reports and exploits.
  • The foundation also points to the volume effect: 15 CVEs published since 1 July, and more than 100 reports that turned out to be invalid, duplicates or not reproducible. AI helps the team validate and group reports, and every decision and every patch is still the work of a person.

So it would be inaccurate to say AI discovered an unknown flaw on its own. A developer had spotted the problem in 2024. In 2026, AI tools were used to find a concrete exploitation path and then to validate the fixes, with human teams from several organizations involved at every step.

Image from OpenAIs article on coordinating the response to the PHP vulnerabilities Image: OpenAI.

The foundation's post ends with a call for funding. Security work on PHP depends on a small group of developers paid by the foundation and a little volunteer help. Tools now find bugs faster than before, for defenders and attackers alike. Choosing the right fix for a long-standing design decision in the engine, on the other hand, takes engineers who know the entire PHP codebase, and the foundation says there are too few of them.

What to keep an eye on

Three things are still open as of this update. The next regular release of the 8.2 to 8.5 branches should bring the fix and the full advisory for CVE-2026-115560. PHP 8.6.0 is expected on 19 November. And PHP 8.2 will receive no security fixes after 31 December 2026, which leaves little time to plan the migration of projects still running on it.

Sources

Official sources:

Response teams and alerts:

Technical analysis and follow-up:

Community discussions (individual accounts, with no value as technical confirmation):


Written by Jatniel, senior full-stack PHP developer.

Find me on LinkedIn, GitHub and X.

Share this post

I’d like to use Google Analytics to see which pages are useful to you. Nothing is stored without your consent. Learn more