PHP2Shell (CVE-2026-109618 and CVE-2026-109619): What It Is and How to Patch

ApexlyTech Team 11 min read
PHP2Shell (CVE-2026-109618 and CVE-2026-109619): What It Is and How to Patch

TL;DR: On 21 October 2026 the PHP project released PHP 8.5.12, 8.4.27, 8.3.36 and 8.2.35 to fix two critical vulnerabilities, CVE-2026-109618 and CVE-2026-109619, which the Canadian Centre for Cyber Security says are known as "php2shell". Both are rated 9.2 (Critical) under CVSS v4.0 and can allow unauthenticated remote code execution on servers that handle web requests with PHP. Updating is the only complete fix. If you cannot update today, the PHP security team lists interim measures, starting with session.upload_progress.enabled=0, that reduce exposure but do not make a server safe.

Key facts at a glance

  • CVEs: CVE-2026-109618 ("RCE via OOM corruption") and CVE-2026-109619 ("RCE via stale global state").
  • Severity: Critical, CVSS v4.0 base score 9.2 for each.
  • Fixed in: PHP 8.5.12, 8.4.27, 8.3.36 and 8.2.35, announced on 21 October 2026.
  • At risk: all PHP installations serving web requests, including PHP-FPM, Apache with mod_php, php-cgi, FrankenPHP and LiteSpeed. The PHP project considers the risk highest for mod_php.
  • Impact: code execution with the privileges of the web worker account, with no login required.
  • PHP 8.1 and older: no longer updated by the PHP project; use a vendor backport or upgrade.

What happened

On 20 October 2026 the PHP security team gave advance notice of a security release for two critical vulnerabilities, scheduled for 21 October 2026 at 14:00 UTC. The releases shipped that day with a security advisory titled "Critical remote code execution vulnerabilities, update now", which strongly encourages all PHP users to update immediately. Linux distributions and LTS vendors received the patches in advance.

The PHP announcements do not use a nickname. The name "php2shell", usually written PHP2Shell, comes from the Canadian Centre for Cyber Security alert AL26-026 and is used in other security coverage.

The two vulnerabilities in plain language

CVE-2026-109618: RCE via out-of-memory corruption

When PHP runs out of memory while handling a request, it stops what it is doing immediately. According to the advisory, this can happen while internal request data is only partly set up, and the cleanup that runs at the end of the request may then treat that half-initialised data as valid. The advisory says attacker-controlled input can push a request into this out-of-memory state within PHP's normal limits, and that the confirmed impact is unauthenticated remote code execution as the web worker account, validated against Apache mod_php. PHP-FPM is considered susceptible based on source analysis, and FrankenPHP and LiteSpeed are considered likely susceptible.

CVE-2026-109619: RCE via stale global state

PHP keeps some internal state (for errors, sessions, objects and extensions) that briefly points into memory owned by a request. The advisory explains that this state can survive after the request's memory has been freed, and a later request handled by the same worker can use it before normal initialisation resets it: a use-after-free. Exploitation needs one request to leave the stale state behind and a later request on the same worker to use it. The advisory states that remote code execution was validated against mod_php and PHP-FPM through the session lifecycle, and against mod_php through fatal error backtraces on PHP 8.5.

Both records list the same weaknesses, led by CWE-416 (use after free), and the same CVSS v4.0 vector: AV:N/AC:H/AT:P/PR:N/UI:N/VC:H/VI:H/VA:H. In plain terms: reachable over the network, no privileges or user interaction needed, high impact on confidentiality, integrity and availability, but with high attack complexity and specific conditions that must be present.

Who is affected

Every supported PHP branch before the fixed release is affected:

PHP branchVulnerableFixed in
8.5Before 8.5.128.5.12
8.4Before 8.4.278.4.27
8.3Before 8.3.368.3.36
8.2Before 8.2.358.2.35
8.1 and olderNo upstream releaseVendor backport, or upgrade

For PHP 8.1 and older, the PHP project no longer ships updates. Some distributions and LTS vendors provide backported fixes. Given the severity, the PHP security team also published minimal source backports for PHP 7.4, 8.0 and 8.1 for people who build from source or have no LTS vendor. Note too that PHP 8.2 reaches end of life on 31 December 2026, so an 8.2 server patched today still needs an upgrade plan.

The advisory names PHP-FPM, Apache with mod_php, php-cgi, FrankenPHP and LiteSpeed. If PHP serves web traffic for you in any of these ways, including through a CMS such as WordPress, a framework such as Laravel, or a third-party product or container image that bundles PHP, treat the server as affected until you have confirmed the version.

Effects and business impact

Remote code execution as the web worker account means an attacker who succeeds can do whatever that account can do. On a typical PHP server that includes reading application code and configuration files (database credentials and API keys often live there), reading or changing data the application can reach, altering pages, and using the server as a foothold toward other systems. The CVSS vector rates the impact on confidentiality, integrity and availability as high.

On exploitation status, as of 23 October 2026: the Canadian Centre for Cyber Security reported that a proof of concept is available with no active exploitation identified at that time, adding that this can change quickly. Rapid7 reported that multiple public proofs of concept exist, each working only against specific combinations of operating system, PHP version and web server, and that it had seen reports of exploitation attempts but had not confirmed exploitation. Neither situation is a reason to wait.

How to check your PHP version

Check the PHP that actually serves your site, not just the one on your command line, since a server can have several versions installed:

  • Command line: php -v prints the CLI version. The FPM binary is often versioned, for example php-fpm8.4 -v on Debian and Ubuntu.
  • Web server: your hosting panel, or an existing admin page that reports the PHP version (most CMSs and frameworks have one), shows the version the site really runs.
  • Containers: run php -v inside the running container, or check the base image tag in your Dockerfile.

Distribution packages can carry the fix under their own version numbering, so a server from a Linux distribution or LTS vendor may be patched without showing 8.4.27 or the matching upstream number. In that case, check your vendor's security notice for the package version that contains the fix.

How to patch

The goal is the same everywhere: run PHP 8.5.12, 8.4.27, 8.3.36, 8.2.35 or later on your branch (or a vendor build containing the fixes), then restart every PHP process so no worker keeps running the old code.

Debian and Ubuntu servers

sudo apt update
sudo apt install --only-upgrade 'php8.4*'
sudo systemctl restart php8.4-fpm   # PHP-FPM
sudo systemctl restart apache2      # Apache with mod_php

Replace 8.4 with your branch. If you use a third-party PHP repository, confirm it has published the fixed build.

RHEL, AlmaLinux and Rocky Linux

sudo dnf upgrade 'php*'
sudo systemctl restart php-fpm httpd

Docker images

Rebuilding without pulling can reuse a cached, vulnerable base image. Pin your base image to a fixed release, or pull before you build, then redeploy every container:

# Dockerfile
FROM php:8.4.27-fpm

# Build with a fresh base image, then verify
docker build --pull -t my-app .
docker run --rm my-app php -v

The official image publishes patch-level tags on every supported branch, for example php:8.4.27-fpm, php:8.3.36-fpm and php:8.5.12-apache.

Shared hosting, cPanel and hPanel

On shared hosting, the provider supplies PHP. Use your panel's PHP version tool (MultiPHP Manager in cPanel, PHP Configuration in Hostinger's hPanel) to see which version each site uses and move off any end-of-life version. Then ask your host to confirm that their PHP builds include the fixes for CVE-2026-109618 and CVE-2026-109619, and when they were deployed.

Restart every worker

Installing new packages does not replace code already loaded in running workers. Restart PHP-FPM, Apache (for mod_php), FrankenPHP or LiteSpeed's PHP processes after updating, then confirm the version again.

If you cannot patch today: interim mitigations

The PHP security team is explicit that only an update is a complete solution. The measures below reduce exposure to specific attack paths but do not make an installation safe. Apply them in php.ini, the FPM pool or the web server configuration, never with ini_set() or an FPM .user.ini, and restart every worker afterwards.

For CVE-2026-109619 (stale global state)

  • Set session.upload_progress.enabled=0. This blocks the confirmed session paths, though not other variants, and the advisory suggests keeping it off after patching if you do not use the feature.
  • On PHP 8.5, set fatal_error_backtraces=0. This blocks the confirmed fatal backtrace path only.
  • Remove invalid or deprecated settings applied per request that emit diagnostics before initialisation. Hiding diagnostics with error_reporting, display_errors or @ does not help.
  • Fix fatal errors and execution timeouts that an attacker can reach, including in callbacks, upload or import processing and cleanup. Where performance allows, the advisory also suggests considering pm.max_requests=1.

For CVE-2026-109618 (out-of-memory corruption)

  • Set memory_limit=-1 in a way applications cannot override, such as php_admin_value, and check that no pool, directory or application setting puts a finite limit back. Pair it with a container or cgroup memory limit so a runaway worker cannot take down the host, preferably one that kills only the affected worker. Do not use RLIMIT_AS or RLIMIT_DATA for this, as they can cause the vulnerable allocation failure.
  • Keep post_max_size low: 8M for applications without file uploads, 32M where uploads are needed, with upload_max_filesize below it.
  • Enforce request limits at the web server or proxy for request size, input field count, multipart part count, header count and nesting depth, including for requests without a usable Content-Length. If the application does not use multipart requests, the advisory suggests blocking them at the frontend.

Example: a PHP-FPM pool

; /etc/php/8.4/fpm/pool.d/www.conf (path varies by distribution)
php_admin_flag[session.upload_progress.enabled] = off
php_admin_value[memory_limit] = -1
php_admin_value[post_max_size] = 8M
php_admin_value[upload_max_filesize] = 6M

Under Apache with mod_php, the equivalent directives are php_admin_flag session.upload_progress.enabled off and php_admin_value post_max_size 8M. Remember to restart every worker.

A follow-up advisory on session upload progress

On 23 October 2026 the PHP project published an informational advisory for a separate issue, CVE-2026-115560. It recommends setting session.upload_progress.enabled=0 until the next regular bugfix release. The issue needs an unusual combination of configuration and application code, and anyone who already applied this setting for CVE-2026-109619 needs to do nothing further. It is one more reason to leave the feature off unless you use it.

Detection and hardening checklist

  • Inventory: list every server, container image and third-party product that runs PHP, including appliances and images that bundle it.
  • Prioritise: patch internet-facing systems and applications that process untrusted input first. If a system cannot be fixed quickly, consider isolating it from public networks.
  • Verify: after patching, confirm the version the web server runs, not only the CLI.
  • Review logs: check web server, application, authentication and endpoint logs for suspicious activity, and look for unexpected processes, commands, files, accounts or outbound connections.
  • If you suspect compromise: patching does not remove an attacker who is already in. Investigate, rebuild from a known-good state where needed, and rotate the credentials and keys the web worker could read.
  • Least privilege: run PHP workers as a dedicated, unprivileged account that can write only where the application needs to.
  • Reduce attack surface: leave session.upload_progress.enabled off unless you use it, and keep request limits at the proxy.
  • Plan upgrades: move off PHP 8.1 and older now, and schedule PHP 8.2 sites before its end of life on 31 December 2026.

For our own platforms we treated this as an immediate update: our container images require PHP 8.4.27 or later and ship with session.upload_progress.enabled = 0.

How ApexlyTech can help

If you run PHP applications and want a second pair of hands, we can help inventory your PHP estate, roll the update through servers and container images, apply the interim settings where an update has to wait, and plan upgrades off end-of-life versions. See our web application development and cloud solutions services, or contact us to talk it through.

Frequently asked questions

What is PHP2Shell?

PHP2Shell is the name used for two critical PHP vulnerabilities, CVE-2026-109618 and CVE-2026-109619, fixed on 21 October 2026. Both are rated CVSS v4.0 9.2 and can allow unauthenticated remote code execution on PHP installations that serve web requests.

Which PHP versions fix CVE-2026-109618 and CVE-2026-109619?

PHP 8.5.12, 8.4.27, 8.3.36 and 8.2.35. PHP 8.1 and older get no upstream release; use a vendor backport, the PHP team's source backports for 7.4, 8.0 and 8.1, or upgrade to a supported branch.

Does setting session.upload_progress.enabled to 0 protect my server?

Only partly. It blocks the confirmed session paths of CVE-2026-109619 but not other variants, and it does nothing for CVE-2026-109618. The PHP security team says updating is the only complete fix.

Is my WordPress or Laravel site affected?

The vulnerabilities are in PHP itself, not in a particular application, so any site served by a vulnerable PHP version is affected regardless of the CMS or framework. Updating PHP and restarting its workers fixes it.

Do I need to restart anything after updating?

Yes. Restart PHP-FPM, Apache (for mod_php), FrankenPHP or LiteSpeed's PHP processes so no worker keeps running the old code, then confirm the version the web server reports.

Are the vulnerabilities being exploited?

As of 23 October 2026, public proofs of concept exist. The Canadian Centre for Cyber Security reported no active exploitation identified at that time, and Rapid7 reported exploitation attempts but no confirmed exploitation. Patch now rather than wait for that to change.

Sources

This article reflects the advisories as published on 24 October 2026. Check the sources above for any later updates.