Cyber Security

PHP2Shell (CVE-2026-109618 And CVE-2026-109619): The Critical PHP Flaw Explained

Juan Molina1 min read
PHP2Shell (CVE-2026-109618 And CVE-2026-109619): The Critical PHP Flaw Explained
Share:

On 21 October 2026 the PHP project shipped an emergency security release for two critical flaws in the PHP engine itself: CVE-2026-109618 and CVE-2026-109619, now widely called PHP2Shell. Both can let an unauthenticated attacker run code on a web server with nothing more than a crafted HTTP request. PHP powers a huge share of the web, including WordPress, Drupal, Magento and Laravel, so this one matters far beyond PHP developers.

The short version

Upgrade PHP to 8.5.12, 8.4.27, 8.3.36 or 8.2.35 today. Every PHP install that serves web requests is in scope, on PHP-FPM, Apache mod_php, php-cgi, FrankenPHP and LiteSpeed. PHP 8.1 and older get no official release. Configuration changes reduce exposure but do not make a server safe. Sites built by CodeCraft Studios on our Next.js and Django stack do not run PHP and are not affected.

What Happened, Hour By Hour

This disclosure did not go to plan. The CVE identifiers leaked a day early, the PHP security team pulled the release forward, and attacks were reported before the patches were even out.

When (UTC)What happened
1 Aug 2026Researchers at Calif find multiple remote code execution paths in the PHP engine.
11 Aug 2026Calif reports the first bug to the PHP security team.
24 Aug 2026Wiz Research independently reports the vulnerabilities.
20 Oct 2026The CVE identifiers spread on Hacker News and social media. PHP announces a security release for the next day, moved up from 22 October.
21 Oct, 07:43Cloudflare reports early attacks, before any patch is public.
21 Oct, ~14:00PHP 8.5.12, 8.4.27, 8.3.36 and 8.2.35 are released with the advisory. Technical write-ups follow within hours.

The PHP Foundation credited Calif, Wiz Research and OpenAI, among others. Coverage from Rapid7, Palo Alto Networks Unit 42 and Tenable followed the same day. Unit 42 reports seeing proof-of-concept code, and its Cortex Xpanse telemetry counts over 22.6 million exposed instances that are potentially vulnerable.

The Two Vulnerabilities At A Glance

CVE-2026-109618CVE-2026-109619
PHP's nameRemote Code Execution (Out-of-Memory Corruption)Remote Code Execution (Stale Global State)
Bug classMemory corruption during out-of-memory cleanupUse-after-free across requests in the same worker
SeverityCVSS v4.0 9.2 (NVD: 9.8 on CVSS 3.1)CVSS v4.0 9.2 (NVD: 9.8 on CVSS 3.1)
Login neededNoNo
ImpactCode execution as the web worker userCode execution as the web worker user, plus memory disclosure
GitHub advisoryGHSA-w8hw-w9fx-j79wGHSA-6wmf-4rv5-p3rp
Vulnerable sincePHP 5.4.0 (2012)PHP 5.4.0 (2012)

Where The Bug Lives In A PHP Request

To understand why this is so serious, it helps to know where in the request the bug sits. When a request arrives, the SAPI (the layer that connects PHP to the web server, such as PHP-FPM or mod_php) parses the body before your application gets control. For file uploads that means parsing multipart/form-data. PHP's session upload progress feature also hooks in at this stage, so it can report how far an upload has got.

Figure 1: Both known trigger paths run inside PHP itself, before WordPress, Laravel or any other application code runs.

That timing is the whole story. Security teams usually think about vulnerable plugins and outdated frameworks. Here the flaw is in the engine, so a perfectly patched WordPress or Laravel site is still exposed if the PHP binary underneath it is old. Sansec reports confirmed unauthenticated code execution against Magento 2.4.9, WordPress 7.1.2, Drupal 11.4.3, Joomla 6.1.4, Laravel 13.11, Symfony 8.1, Nextcloud, phpMyAdmin and WHMCS, among others.

CVE-2026-109618: Out-Of-Memory Corruption

PHP enforces a per-request memory_limit. When a request goes over it, PHP raises a fatal error and unwinds with longjmp(), a C mechanism that jumps straight out of deeply nested code instead of returning normally. That is fast, but it skips any cleanup the interrupted code meant to do.

According to Red Hat's description, PHP marks certain internal state as ready to use before all of its memory allocations have finished. If an allocation then fails because memory is exhausted, the half-built state is not rolled back. Shutdown code later treats that uninitialised memory as valid, which corrupts memory. An attacker can push a worker to that edge on purpose with a crafted multipart request that stays inside PHP's configured size limits but still exhausts memory while it is parsed.

The pattern looks roughly like this. This is a simplified illustration of the bug class, not PHP's source code:

/* Simplified illustration of the bug class. Not PHP source. */
request_state *st = get_request_state();

st->ready = 1;                         /* 1. marked usable too early        */
st->buffer = emalloc(attacker_size);   /* 2. allocation fails: memory_limit */
                                       /*    hit, longjmp() unwinds here    */
st->buffer_len = attacker_size;        /* 3. never runs                     */

/* ...later, during request shutdown... */
if (st->ready) {
    efree(st->buffer);                 /* 4. frees an uninitialised pointer */
}

The fix in the patched releases is to only publish state once it is complete, or roll it back when a bail-out happens. That is why memory_limit=-1 appears in the emergency guidance: with no limit there is no out-of-memory bail-out on that path. It is a terrible permanent setting, because one request can then eat all of the server's memory.

CVE-2026-109619: Stale State That Survives The Request

The second bug is a use-after-free. PHP-FPM and mod_php keep worker processes alive and reuse them for many requests, which is good for speed. PHP is supposed to reset its global state between requests. With this flaw, a fatal error or out-of-memory bail-out frees some memory but leaves a pointer to it in global state. The next request handled by the same worker reads that pointer before startup resets it.

Figure 2: A crash in one request leaves a dangling pointer behind, and the next request on the same worker uses it.

PHP's advisory lists two confirmed ways in:

  • Session upload progress: confirmed command execution on both mod_php and PHP-FPM. The callback fires on any POST endpoint before application code runs, and Abstract Security notes the request body is only around 450 bytes, so size-based WAF rules do not catch it.
  • Fatal error backtraces on PHP 8.5: with mod_php, through the fatal_error_backtraces feature, which is on by default in 8.5.

Sansec also describes a memory disclosure angle reminiscent of Heartbleed: freed worker memory can come back to the client inside a PHPSESSID cookie. That memory can hold passwords, session tokens, API keys and other data from other users' requests, and the leak works even when the application never calls session_start(). Note that vendors label the two CVEs slightly differently. We follow PHP's own advisory here.

Session upload progress is a long-standing, rarely used feature that is enabled by default. A legitimate use looks like this, which is why so few sites notice when it is switched off:

<form action="upload.php" method="POST" enctype="multipart/form-data">
  <!-- PHP tracks progress under this key in $_SESSION -->
  <input type="hidden" name="<?= ini_get('session.upload_progress.name') ?>" value="video1">
  <input type="file" name="file">
  <button type="submit">Upload</button>
</form>

Who Is Affected

PHP's guidance is blunt: every PHP installation that serves web requests is at risk, whatever the server setup.

BranchVulnerableFixed inStatus
PHP 8.5before 8.5.128.5.12Supported
PHP 8.4before 8.4.278.4.27Supported
PHP 8.3before 8.3.368.3.36Supported
PHP 8.2before 8.2.358.2.35Supported
PHP 7.4 to 8.1allno official releaseEnd of life; minimal source backports only
PHP 5.4 to 7.3allnoneEnd of life, upgrade required

PHP considers Apache with mod_php the highest risk, because a demonstrated exploit fires on an unauthenticated request before any application code runs. Do not assume a managed host has handled it either. DigitalOcean has emailed customers that PHP on Droplets, Kubernetes, App Platform containers and Marketplace images such as WordPress, LAMP, LEMP and Laravel should be treated as in scope until patched, and it is suspending affected Marketplace images until they are updated.

Linux distributions often backport fixes without changing the upstream version number, so a server that reports PHP 8.3.6 from Ubuntu may or may not be patched. Check your distribution's security notice and package revision, not just php -v. You can confirm which branches are still supported on the official PHP supported versions page.

How To Check Your Servers

1. Find Every PHP Version You Run

Check the binary your web server actually uses. The command-line PHP and PHP-FPM are often different packages:

# CLI version (not always what the web server runs)
php -v

# PHP-FPM version(s) installed
php-fpm8.3 -v 2>/dev/null; php-fpm -v 2>/dev/null

# Debian / Ubuntu: installed packages and their exact revisions
dpkg -l | grep -E '^ii\s+php[0-9.]+-(fpm|cli|common)'

# RHEL / Rocky / Alma
rpm -qa | grep -E '^php(-fpm|-cli|-common)?-[0-9]'

# Docker: what each running container ships
docker ps --format '{{.Names}}' | xargs -I{} sh -c 'echo {}; docker exec {} php -v 2>/dev/null | head -1'

2. Confirm What The Web Server Really Loads

INI values can differ between the CLI and FPM pools. Drop a temporary file into the web root, load it in a browser, then delete it immediately. Never leave it deployed:

<?php
// check.php: delete this file as soon as you have read it
header('Content-Type: text/plain');
echo 'PHP_VERSION=', PHP_VERSION, "\n";
echo 'SAPI=', PHP_SAPI, "\n";
foreach (['memory_limit', 'session.upload_progress.enabled', 'post_max_size', 'upload_max_filesize'] as $k) {
    echo $k, '=', var_export(ini_get($k), true), "\n";
}

3. Inventory The PHP You Forgot About

  • WordPress, Joomla or Drupal installs on marketing subdomains
  • phpMyAdmin, Adminer and other admin panels
  • Old Laravel or CodeIgniter apps still running for one internal team
  • Marketplace or 1-Click images on any cloud provider
  • Agency or vendor-managed sites you pay for but never log in to

How To Patch

Updating PHP is the only complete fix. Typical paths:

# Debian / Ubuntu (distribution packages; confirm the security notice for your release)
sudo apt update && sudo apt install --only-upgrade 'php8.3*'
sudo systemctl restart php8.3-fpm   # or: sudo systemctl restart apache2 for mod_php

# RHEL / Rocky / Alma
sudo dnf upgrade 'php*'
sudo systemctl restart php-fpm

# Docker: pull a patched official image and rebuild
docker pull php:8.4-fpm
docker compose build --pull && docker compose up -d

Restart every worker afterwards. A patched binary on disk does nothing for PHP-FPM children that are still running the old code in memory. Sansec also notes that the Remi repository did not have the fix on release day, so check your package source before assuming you are covered.

Emergency Mitigations If You Cannot Patch Today

These reduce exposure. They do not make PHP safe.

PHP, DigitalOcean and every vendor above agree: configuration changes only block known attack paths. Use them to buy hours, not weeks, and patch as soon as you can.

Apply settings where they take effect before the request is parsed (php.ini or the FPM pool, never .htaccess or ini_set):

; php.ini or a conf.d drop-in (mod_php), then restart Apache
session.upload_progress.enabled = 0
memory_limit = -1            ; blocks the OOM bail-out path; watch server memory closely
post_max_size = 8M
upload_max_filesize = 4M
; PHP 8.5 only:
fatal_error_backtraces = 0
; PHP-FPM: add to EVERY pool file, e.g. /etc/php/8.3/fpm/pool.d/www.conf
php_admin_flag[session.upload_progress.enabled] = off
php_admin_value[memory_limit] = -1

If your site does not need file uploads, blocking multipart requests at the web server shuts down every known trigger. It will break uploads and some checkout forms, so test before and after:

# nginx: inside each server block that serves PHP, then: nginx -t && systemctl reload nginx
if ($http_content_type ~* "multipart/form-data") {
    return 403;
}
# Apache: inside each VirtualHost that serves PHP, then reload Apache
RewriteEngine On
RewriteCond %{HTTP:Content-Type} multipart/form-data [NC]
RewriteRule .* - [F]

Remember to restore memory_limit after patching. CERT-EU also advises isolating internet-facing PHP applications from public networks until a fix is applied and verified, and Cloudflare's managed WAF rules cover known vectors only for traffic that passes through Cloudflare.

What To Look For In Your Logs

Public indicators are still thin, so treat these as hunting leads rather than proof. Focus on the window around 20 and 21 October 2026 and anything after:

# Bursts of multipart POSTs, especially to endpoints that never take uploads
grep -E '"POST [^"]+" ' /var/log/nginx/access.log | awk '{print $1, $7}' | sort | uniq -c | sort -rn | head -50

# Workers hitting the memory limit
grep -h "Allowed memory size of" /var/log/php*-fpm.log /var/log/apache2/error.log 2>/dev/null | tail -50

# FPM children dying on memory corruption
grep -hE "exited on signal (11|6)" /var/log/php*-fpm.log 2>/dev/null | tail -50
  • Unusually long or odd PHPSESSID values in responses, given the memory disclosure path
  • New PHP files in upload or cache directories, unexpected cron jobs, and outbound connections from the web worker user
  • Admin accounts, API keys or plugins you do not recognise

If you find signs of compromise, patching is no longer enough. Rotate every credential the server could read (database passwords, API keys, session secrets, TLS keys), rebuild from a known-good image and review access logs for data that may have left.

Why CodeCraft Studios Sites Are Not Affected

We build on Next.js for the front end and Django with PostgreSQL behind it, deployed on DigitalOcean App Platform. There is no PHP interpreter anywhere in that request path, so neither CVE has anything to attack. After DigitalOcean's notice we checked every App Platform app we run: each one builds on the Node.js or Python buildpacks or a non-PHP container image.

Figure 3: PHP2Shell lives in the PHP engine. A stack without PHP has nothing for it to exploit.

That is not a claim that Python or JavaScript are immune to anything. They have their own CVEs, as we covered in our React2Shell breakdown. What protects a site is a small, modern stack, managed hosting that rebuilds on patched base images, and someone who actually watches advisories. If you are weighing a site rebuild, our guides on template sites versus custom builds and why sites need a redesign every few years cover the trade-offs, and this piece on drag-and-drop builders explains where hosted platforms help and where they don't.

The Business Side: Breach Costs And Cyber Insurance

A remote code execution bug on a public website is exactly the kind of incident cyber insurance exists for: data breach notification, forensics, downtime, ransomware and liability claims. It is also exactly the kind of incident insurers look at closely. Many policies expect known critical vulnerabilities to be patched within a set time, and a claim after a breach through a well-publicised, unpatched flaw can be harder to settle.

  • Know what you are covered for. Read the policy for patching obligations, waiting periods and exclusions before you need it. RhoneRisk will analyze your current policy.
  • Cover the website risk directly. Cyber liability coverage and data breach coverage address the costs that follow a compromise like this.
  • Plan for the worst case. Initial access through a web server is a common first step in ransomware attacks. See ransomware coverage.
  • Keep evidence. Write down when you learned about PHP2Shell, what you patched and when. That timeline matters to insurers, auditors and customers.

Our partners at RhoneRisk specialise in cyber insurance and security for businesses. If a vulnerability like this made you unsure what your policy would actually pay for, get a cyber security quote from RhoneRisk.

Frequently Asked Questions

Is my WordPress site affected?

If it runs on PHP older than 8.5.12, 8.4.27, 8.3.36 or 8.2.35, or an unpatched distribution build, yes. Updating WordPress itself does not fix it, because the flaw is in PHP. Ask your host which PHP version serves the site and when it was patched.

Is this being exploited?

Cloudflare reported early attacks on the morning of 21 October, before the patch. watchTowr reports exploitation attempts and Unit 42 has seen proof-of-concept code. The PHP Foundation said that at release time it had not identified a functional public exploit. Treat it as exploited and patch accordingly.

Is it in CISA's Known Exploited Vulnerabilities catalog?

Not at the time of writing. Keep an eye on the CISA KEV catalog; three older PHP flaws are already listed there, two of them used in ransomware campaigns.

Does turning off session upload progress fix it?

No. It blocks the confirmed session paths for CVE-2026-109619 only. It does nothing for CVE-2026-109618, and variants may exist. Upgrade.

We are on PHP 8.1 or older. What now?

There is no official fixed release. Plan an upgrade to 8.2 or later now, apply the emergency mitigations in the meantime, and consider taking the site offline or behind a WAF until it is done.

Are Node.js, Python or Django sites affected?

Not by these two CVEs, which are specific to the PHP engine. Every stack has its own advisories, which is why patch discipline matters more than the language.

Sources And Further Reading

Need a second pair of eyes on an old PHP site, or ready to move to a stack that does not carry this risk? Talk to CodeCraft Studios. For the latest platform news, see our report on the AWS outage on October 20.

Need This Done For Your Business?

We build websites, apps and search campaigns for businesses across Florida and the US. Tell us what you need and get a fixed quote.