PHP security · Seal Security ·

PHP2Shell: CVE-2026-109618 and CVE-2026-109619. On PHP 8.1 or older? We’ll patch it for free.

Official releases fix only PHP 8.2 and newer. For 8.1, 8.0 and 7.4, the PHP team shared source patches that you build yourself. For 7.3 and older, there is nothing. Seal has already patched PHP 5.x and 7.x, and patches 8.0 and 8.1 on request. Same version, both CVEs fixed, free.

With no official release
800,000+
Already patched by Seal
5.x · 7.x
Code changes on your side
0
Chat with a PHP expert Or book a 15-minute call

A real person on Slack. Join as a guest, tell us your PHP version, get the patch. Free.

What happened

How PHP2Shell works

On October 20, details of two PHP bugs leaked before the embargo ended. The PHP security team fixed both on October 21, 2026 in PHP 8.2.35, 8.3.36, 8.4.27 and 8.5.12. Researchers call the pair PHP2Shell. The PHP advisory has the full details.

!

How bad is it?

CVE-2026-109618 and CVE-2026-109619 are both rated CVSS v4.0 9.2. Both allow unauthenticated remote code execution through memory bugs in PHP itself. One fires when PHP runs out of memory partway through a request. The other uses state left over from an earlier request. You can’t fix either in your app.

⇡

How soon will attacks start?

Sansec expects mass attacks within 15 minutes of the release. Once the fix is public, it shows attackers where the bug is.

🛡

Who gets a fix?

Official releases cover PHP 8.2, 8.3, 8.4 and 8.5. For 7.4, 8.0 and 8.1 the PHP team published source patches only, with no release. PHP 7.3 and older get nothing.

CVE-2026-109618: RCE via out-of-memory corruptionGHSA-w8hw-w9fx-j79w · CVSS 9.2 · CWE-416, 755, 824, 1325, 1419

Root cause. PHP uses longjmp() to leave the current context when it runs out of memory. At some points, request memory is reachable before it is fully set up. If any allocation fails at that moment, even one that has nothing to do with that memory, PHP exits early and leaves the memory in an invalid state. Request shutdown then reads or branches on it, which can lead to remote code execution.

How an attacker reaches out-of-memory. Multipart parsing lets a request run out of memory while it stays inside its apparent limits:

  • A multipart request without a usable Content-Length can pass the first post_max_size check and keep sending decoded body data.
  • A multipart part can carry any number of headers. Inside PHP they take far more memory than on the wire, so a request within post_max_size can exhaust memory_limit.
  • Empty file fields don’t count toward max_file_uploads but still create file metadata arrays. Nested field names multiply that work.

Application code that allocates a lot of memory from attacker input can reach the same state.

Why mod_php is the worst case. mod_php always runs request shutdown, even when request startup failed. Body parsing during startup can hit the memory limit, and shutdown then processes the invalid state, before any application code runs. Full RCE was validated over HTTP against mod_php with default input and memory limits and a normal prefork setup with multiple workers.

CVE-2026-109619: RCE via stale global stateGHSA-6wmf-4rv5-p3rp · CVSS 9.2 · CWE-416, 755, 824, 1325, 1419

Root cause. A PHP worker keeps global state (error, session, object and extension state) that can point into memory owned by one request. That state must be reset before the request memory is freed. If a fatal error, including out-of-memory, cuts an operation short, the reset never runs. The next request on the same worker can then use the freed memory before normal initialization replaces it.

What an attack needs. A producer request leaves stale state behind, and a consumer request on the same worker uses it. More workers and worker recycling lower the success rate per request but don’t remove the bug.

Confirmed paths:

  • PHP 8.5 fatal error backtraces. With fatal_error_backtraces on, the backtrace state is never reset at shutdown. This is the basis of the confirmed mod_php exploit.
  • Session upload progress. An upload sets up session and decoder state early. Out-of-memory during input processing frees it while the globals still point to it, and a later upload progress operation uses it. Upload progress is on by default and needs no session_start() in your code. Validated against mod_php and against PHP-FPM with a normal dynamic pool, where it depends on a suitable application operation.

Early INI warnings are also a consumer. A warning or deprecation raised while per-request INI settings are applied, before initialization, reads the stale error state. Examples include deprecated settings such as auto_detect_line_endings=1 and invalid values such as a bad memory_limit or date.timezone. With mod_php these come from .htaccess or php_value. With FPM they come from PHP_VALUE or PHP_ADMIN_VALUE sent by nginx or another frontend. Changing error_reporting, using @, or turning off display_errors or log_errors does not protect you.

Exposure by server setupmod_php, PHP-FPM, FrankenPHP, LiteSpeed
SetupCVE-2026-109618CVE-2026-109619
Apache mod_phpRCE confirmedRCE confirmed
PHP-FPMSusceptible by source analysis, no full exploit shownRCE validated with a normal dynamic pool, needs a suitable application operation
FrankenPHPLikely susceptible, like mod_phpNo early consumer found in the default setup, but not immune
LiteSpeed (LSAPI)Application-specific exploits likely, not validatedConditional

Exploit reliability depends on the PHP build, extensions, frontend behavior and memory allocator layout.

Hardening if you can’t update yetSettings that lower the risk, and what they don’t cover

Both advisories say only an update fully fixes this. Set the values below in php.ini, the FPM pool or the server config, not with ini_set() or .user.ini, and restart every worker.

  • memory_limit = -1, enforced so no pool, directory or app can set a finite limit back. This removes the controllable limit the confirmed exploit uses. An underlying allocation failure can still reach the bug.
  • post_max_size = 8M (32M if you need uploads), with upload_max_filesize below it.
  • At the web server or proxy, limit decoded request size, input field count, multipart parts, headers per part and nesting depth, including for requests without a Content-Length. If you don’t use multipart forms, block them before they reach PHP.
  • Do not use RLIMIT_AS or RLIMIT_DATA. They make mmap() fail and trigger the vulnerable path. A cgroup memory.max can serve as a boundary, ideally one that kills only the affected worker.
  • session.upload_progress.enabled = 0. The advisory suggests keeping it off even after you patch, if you don’t use it.
  • On PHP 8.5, fatal_error_backtraces = 0.
  • Remove invalid or deprecated per-request INI settings that raise warnings before initialization.
  • Stop attacker-controlled requests from predictably hitting fatal errors, including Maximum execution time exceeded. If performance allows, pm.max_requests = 1 gives each worker a single request.
What to look for in your logsAn audit aid, not proof of safety

In an isolated audit, turn on log_errors=On, a working error_log and error_reporting=E_ALL in startup config. Then check Apache, PHP-FPM, proxy and service logs for:

  • Warnings, deprecations and core errors repeated before the target script runs.
  • Warnings raised during extension or server cleanup.
  • Fatal, parse and uncaught error messages.
  • Maximum execution time exceeded.
  • Failures limited to routes, content types, files or plugin options that an attacker controls.

A clean log does not prove you are safe. A failure can happen before PHP writes the message.

What the fix changes8.2.35, 8.3.36, 8.4.27, 8.5.12 and the 7.4 to 8.1 source patches

Out-of-memory handling. The patch removes longjmp() for out-of-memory errors. PHP now stops gracefully at the next safe point in the VM, and exits the process with _exit() if memory use passes a second, higher limit. Shutdown no longer sees half-built state, and memory_limit still works.

State reset. The patch resets the wider set of request-owned global state, so it can’t survive into the next request.

Source backports. The PHP 8.1 backport is a single commit, “Avoid state corruption via bailout,” that touches 23 files across the Zend memory allocator and VM, OPcache, sessions, main/SAPI.c and multipart parsing (main/rfc1867.c). The 8.0 and 7.4 branches carry the same commit message. These are source branches only. You build, package and test PHP yourself.

CVSS v4.0 vector for both: AV:N/AC:H/AT:P/PR:N/UI:N/VC:H/VI:H/VA:H/SC:N/SI:N/SA:N. Network attack, no privileges, no user interaction, high impact, with high attack complexity and attack requirements present.

Am I vulnerable?

Check if your PHP is vulnerable

The advisories list every PHP before 8.2.35, 8.3.36, 8.4.27 and 8.5.12 as affected. The PHP team also patched 7.4, 8.0 and 8.1 in source, so treat those as affected. The advisories don’t cover 7.3 and older, so assume those are affected too. Your branch decides what fix exists for you.

Default PHP packages by Linux distro

If you set up a LAMP stack with apt install php, dnf install php or apk add, this is the PHP you got. Package data checked October 21, 2026.

DistroPackagesPHPStatusDistro support
Ubuntu 20.04 LTSphp7.4, php7.4-fpm, libapache2-mod-php7.47.4VULNERABLEUnless on Ubuntu ProSeal patch readyStandard support ended May 2025. Ubuntu Pro (ESM) machines: fixed in 7.4.3-4ubuntu2.29+esm5 (USN-8948-2).
Ubuntu 22.04 LTSphp8.1, php8.1-fpm, libapache2-mod-php8.18.1Fixed by UbuntuInstall the Ubuntu update.
Ubuntu 24.04 LTSphp8.3, php8.3-fpm8.3Fixed upstreamInstall the Ubuntu update.
Debian 10 (buster)php7.3, php7.3-fpm7.3VULNERABLESeal patch readyOut of LTS. Paid Extended LTS only.
Debian 11 (bullseye)php7.4, php7.4-fpm7.4VULNERABLESource patch onlySeal patch readyLTS ended August 31, 2026. Paid Extended LTS only.
Debian 12 (bookworm)php8.2, php8.2-fpm8.2Fixed upstreamInstall the Debian update.
Debian 13 (trixie)php8.4, php8.4-fpm8.4Fixed upstreamInstall the Debian update.
RHEL 7, CentOS 7php, php-fpm (rpm)5.4VULNERABLESeal patch readyCentOS 7 ended June 30, 2024. RHEL 7 only with paid ELS. More on CentOS 7 end of life.
RHEL 8, Rocky 8, Alma 8php module streams: 7.2 (default), 7.4, 8.0, 8.27.2 to 8.0VULNERABLE7.4, 8.0 streams: source patch only. 8.2 stream: fixed upstream7.x: Seal patch readySupported. Red Hat decides per stream, so check its CVE page.
RHEL 9, Rocky 9, Alma 9php 8.0 (default), module streams 8.1 and newer8.0, 8.1VULNERABLESource patch only. 8.2+ streams: fixed upstreamSupported. Red Hat decides per stream, so check its CVE page.
Amazon Linux 1 (Amazon Linux AMI)php (5.3), php54 to php56, php70 to php73 (rpm)5.3 to 7.3VULNERABLESeal patch readyEnd of life December 31, 2023. No updates.
Amazon Linux 2php 7.x and 8.x from amazon-linux-extras7.x, 8.0, 8.1VULNERABLE7.4 to 8.1: source patch only7.x: Seal patch readySupport ended June 30, 2026.
Amazon Linux 2023php8.1, php8.2 and newer8.1VULNERABLEphp8.1: source patch onlySupported. Check the Amazon Linux security center.
Alpine 3.15php7, php8 (apk)7.4, 8.0VULNERABLESource patch only7.4: Seal patch readyRelease out of support.
Alpine 3.16, 3.17php81 (3.16 also php8)8.1VULNERABLESource patch onlyRelease out of support.
Alpine 3.18, 3.19php81, php82 (3.19 also php83)8.1, 8.2+VULNERABLEphp81: source patch onlyMove to php82 or newer, or patch php81.
Alpine 3.20 and newerphp82, php83, php848.2+Fixed upstreamInstall the Alpine update.

Running PHP 5.x or 7.x? It’s already patched. A PHP expert is on chat to get you the build for your version, free.

Chat with a PHP expert
Which PHP gets a fix

Which PHP versions still get fixes

PHP gives each branch two years of bug fixes and two more years of security fixes. After that, nothing, not even for a 9.2. Here is where each branch stands on October 21, 2026.

8.2+
Official fix
8.2, 8.3, 8.4, 8.5
Fixed in 8.2.35, 8.3.36, 8.4.27, 8.5.12
8.2 security ends Dec 31, 2026
8.1
No official release
End of life Dec 31, 2025
PHP team source patch only
Seal patch free, on request
8.0
No official release
End of life Nov 26, 2023
PHP team source patch only
Seal patch free, on request
7.x / 5.x
No official release
7.4 ended Nov 28, 2022, source patch only
7.3 and older nothing
5.6 ended Dec 31, 2018
Seal patch ready now, free
In short

For 8.1 and older, the official answer is “upgrade to 8.2,” or build a source patch yourself for 7.4 to 8.1. An upgrade is a migration project, and these bugs won’t wait for it. We’ll patch the version you run instead, for free.

Your options

Can’t upgrade right away? Here are your options

On 8.2 or newer, install the fixed release. On anything older, these are the real choices.

Option 1

Upgrade to PHP 8.2 or newer

The long-term answer. It also means fixing deprecations, rebuilding extensions and running full regression tests. For most apps that takes weeks, and attackers won’t wait.

Right, but slow
Option 2

Build the PHP team’s source patch

For 7.4, 8.0 and 8.1, the PHP team shared minimal source patches. You compile, package and test PHP yourself, for every server and image. There is no patch for 7.3 or older.

Possible, but all on you
Option 3

Change settings and wait

The PHP team lists php.ini settings that block the attack paths it confirmed (see Technical details). Worth doing. But the advisories say only an update fully fixes it.

Lowers risk, doesn’t fix
Option 4

Let Seal patch it, free

PHP 5.x and 7.x are already patched, and we patch 8.0 and 8.1 on request. Same version, same config, no app changes. You upgrade later, when it suits you. Chat with a PHP expert →

Fixed in your version, free
FAQ

Common questions

Free patch

On PHP 8.1 or older? Let’s patch it.

PHP 5.x and 7.x are already patched. Tell a PHP expert the version you run, and we send back the same version with CVE-2026-109618 and CVE-2026-109619 fixed. Free.

Chat with a PHP expert Or book a 15-minute call