Writing

PHP2Shell: Critical PHP Vulnerabilities and How to Patch

9 min read

PHP2Shell, CVE-2026-109618 and CVE-2026-109619, fixed in PHP 8.5.12, 8.4.27, 8.3.36 and 8.2.35, and in cPanel EasyApache 4 25.91
PHP2Shell is two critical flaws in PHP's core engine. Fixed releases and a cPanel update shipped on October 21, 2026.

Last night Kirill Firsov, CTO of FearsOff, posted a three-minute video on X with a short caption: “php2shell. Tomorrow is a helluva day.”

He wasn’t exaggerating. Today, October 21, the PHP project shipped emergency fixes for two critical vulnerabilities in PHP itself, now known as PHP2Shell. Details leaked before the planned disclosure, exploits were already circulating, and Cloudflare reported attacks on PHP sites hours before the patch went out.

If you run anything on PHP, this is the update to drop everything for.

The video walks through the exploit chain, which Firsov credited to the security firm Calif. A few hours later he followed up with a stopgap and a blunt instruction: “UPGRADE TO THE LATEST PHP after 2pm UTC.”

What PHP2Shell is

PHP2Shell is the name for two vulnerabilities, CVE-2026-109618 and CVE-2026-109619. The PHP security team rates both 9.2 (critical) on CVSS v4.0. watchTowr scored them a full 10.0.

What matters most is where the bugs live. They are not in WordPress, a plugin or a framework. They are in PHP’s core engine, so your own code doesn’t need to be vulnerable at all. PHP says the risk covers “all PHP installations serving web requests, including PHP-FPM, Apache with mod_php, php-cgi, FrankenPHP and LiteSpeed.” Wiz, one of the teams that found the bugs, says every PHP version released in the last decade is affected by at least one of them, going back to PHP 5.4 from 2012. Wiz also points out that PHP powers about 70% of websites.

In plain terms, here is what goes wrong:

  1. An attacker sends requests designed to push PHP into a fatal error, such as running out of memory. The warning signs Wiz and Sansec published point at unusual multipart (file upload style) requests and malformed session cookies.
  2. The fatal error interrupts PHP partway through setting up or cleaning up the request, and PHP leaves behind internal state that points at memory it has already freed.
  3. The next request handled by that same PHP worker picks up the stale state. Depending on the path, that leaks memory from other requests or corrupts memory in a way the attacker can steer.

The two CVEs map to those failure modes:

The end result is unauthenticated remote code execution. PHP says the risk is highest on mod_php, with “a demonstrated exploit where an unauthenticated request can trigger the attack before any application code runs.” No login, no vulnerable plugin, no user interaction. Sansec lists confirmed pre-auth code execution against current versions of WordPress, Drupal, Joomla, Magento, Nextcloud, MediaWiki, Roundcube, phpMyAdmin, Laravel, Symfony and WHMCS.

Why the window is measured in minutes

Coordinated disclosure normally gives defenders a head start. This one fell apart.

Before the release, Sansec put it bluntly to Ars Technica: “We expect mass attacks to start within 15 minutes of the release.”

The reasoning is simple. Once a fix is public, attackers compare the old and new code to see exactly what changed, and that turns a vague advisory into a working exploit. With exploits already leaked, they had even less work to do. Sansec’s guidance after the release hasn’t softened: “We expect mass exploitation now that the patch and the writeups are public.”

Fifteen minutes is shorter than most change approval meetings.

The AI angle

This blog is mostly about AI, and PHP2Shell is as much an AI story as a PHP story.

The bug class is old. Sansec traces related PHP memory-limit issues back to 2004, plus a 2020 bug report and a 2024 audit finding, none of which were shown to be exploitable. What changed is the cost of turning a fragile memory bug into a reliable exploit. Wiz says its team used frontier models, including GPT-5.6 Sol and Gemini 4 Argon, for discovery, exploit development and patch validation, and that the models helped adapt the exploit across PHP versions, configurations and memory layouts. In Wiz’s words: “Frontier AI models substantially reduced that barrier, turning a longstanding flaw into an exploit.”

Their timeline shows how fast that goes: first bug on August 19, unauthenticated code execution against Drupal on August 20, and against WordPress on August 21.

Attackers have the same tools. When decade-old bugs can be weaponized in days and patches can be reverse engineered in minutes, how fast you patch is a security control in its own right.

What to update to

PHP released fixes in:

PHP 8.1 and older no longer get official releases. Given the severity, the PHP team published minimal source backports for 7.4, 8.0 and 8.1 for people who build from source, and Linux distributions and LTS vendors received the patches in advance, so check your distro for updated packages. One catch: PHP says the volunteer-run rpms.remirepo.net repository won’t have updates today. If you depend on it, switch to distribution packages or build from source.

cPanel has shipped its fix

If your sites run on cPanel & WHM, a release on php.net doesn’t reach you directly. cPanel builds its own PHP packages through EasyApache 4, so you’re waiting on cPanel.

That wait is over. cPanel released EasyApache 4 25.91 today, October 21. Its release notes say it “fixes two critical PHP vulnerabilities (CVE-2026-109618 and CVE-2026-109619) in ea-php74 through ea-php85.” That includes the end-of-life 7.4, 8.0 and 8.1 builds, which is good news for anyone with older sites on a cPanel box. The same release also patches ea-libcurl for 14 vulnerabilities and updates ea-nginx, ea-nginx-njs and ea-modsec30.

If you manage the server, EasyApache 4 packages come through the system package manager. As root:

# AlmaLinux, Rocky Linux, CloudLinux
dnf update 'ea-*'

# Ubuntu
apt update && apt upgrade

Then restart PHP-FPM and Apache so no worker keeps running the old code:

/scripts/restartsrv_apache_php_fpm
/scripts/restartsrv_httpd

To confirm the update landed, rpm -qa --last 'ea-php*' | head lists the most recently installed packages (on Ubuntu, check /var/log/dpkg.log). For ea-php74, 80 and 81 the version number won’t change, because cPanel backported the fix, so look at the install date rather than php -v. If the server also has PHP from somewhere else, such as CloudLinux alt-php or a hand-built binary, update that separately.

If you’re on shared hosting, you can’t patch PHP yourself. Ask your host whether EasyApache 4 25.91 is installed, and use MultiPHP Manager in cPanel to check which PHP version each of your domains runs. A domain pinned to an old version needs the patched build as much as the server default does.

What you risk by waiting

Remote code execution with no login is about as bad as web vulnerabilities get. If you hold off, here is what’s on the table:

The long tail is the larger concern. Forensics instructor Hal Pomeranz warned about the forgotten and embedded PHP apps nobody remembers to patch, and the UK’s NCSC is urging organizations to consider taking offline any system they can’t fix right away.

If you can’t patch this minute

PHP is clear that only the update fixes this: “There are no complete mitigations, updating is the only safe choice.” If you need a few hours, these reduce exposure without making you safe:

PHP also lists memory_limit = -1 for CVE-2026-109618, but that lets a single request eat all of the server’s memory, so only use it with a container or cgroup limit around PHP.

Check whether you were hit

If a server was exposed before you patched, check it rather than assume it’s clean. Wiz and Sansec suggest looking for:

Wiz notes application logs may show little because the attack happens below the application, so check web server and PHP-FPM logs too. Then look for the usual signs of a break-in: new or recently changed PHP files (on cPanel, find /home/*/public_html -name '*.php' -newermt 2026-10-20 is a quick start), new admin users, unfamiliar cron jobs and unexpected outbound connections. If you find something, treat it as an incident: restore from a clean backup and rotate database passwords, API keys and application secrets.

The short version

  1. Find every PHP install you’re responsible for, including the forgotten ones.
  2. Update to PHP 8.5.12, 8.4.27, 8.3.36 or 8.2.35, or install EasyApache 4 25.91 on cPanel.
  3. Restart PHP-FPM and Apache so no worker runs old code.
  4. Confirm the new packages are actually in place.
  5. Check anything that was exposed before the patch for signs of compromise.
  6. Get off PHP 8.1 and older, and put 8.2’s end of life on the calendar.

Firsov’s warning turned out to be an understatement. The comparisons to Log4Shell are already flying, and the sites that come out of this fine will be the ones that patched today.

Sources