All field notesBook a 30-min call

Patching PHP2Shell Across a Fleet in a Day

Check whether your PHP version is affected by PHP2Shell (CVE-2026-109618 / CVE-2026-109619), plus how the patch went out across EKS, Cloud Run, and EOL PHP 7.4/8.0 in a day.

CVE-2026-109618 · CVE-2026-109619 · Disclosed 2026-10-21

PHP2Shell Version Checker

Paste a PHP version, `php -v` output, or Dockerfile `FROM php:` lines (one per line) to check exposure to CVE-2026-109618 and CVE-2026-109619. Runs locally in your browser—nothing is sent to a server.

Try an example:

Fixed upstream versions

PHP branchAffectedFirst fixed release
PHP 8.5< 8.5.128.5.12
PHP 8.4< 8.4.278.4.27
PHP 8.3< 8.3.368.3.36
PHP 8.2< 8.2.358.2.35
PHP 5.4 – 8.1All upstream releases (EOL)No official release (backport or upgrade)
Check every PHP runtime on a Linux host (read-only)
php -v; command -v php-fpm >/dev/null && php-fpm -v; pgrep -af 'php-fpm|apache2|httpd|frankenphp'

Check every runtime, not just CLI `php -v`: PHP-FPM pools, Apache mod_php, and containers frequently run different versions.

Running affected or end-of-life PHP in production?

I target a 24-hour turnaround for critical CVE inventory, immediate exposure reduction, and tested patch rollouts across AWS, GCP, and Kubernetes.

Book a 30-min call

On October 21, PHP shipped fixes for two remote code execution flaws, CVE-2026-109618 and CVE-2026-109619, now known as PHP2Shell. Exploit attempts were showing up within hours. Fixed releases exist only for PHP 8.2 through 8.5: 8.2.35, 8.3.36, 8.4.27 and 8.5.12. Anything older is on its own.

I spent the next day and a half rolling the fix across three platforms, plus checking two others to confirm they ran no PHP at all. The platforms had almost nothing in common. One ran current PHP 8.5 on EKS, one ran a mix of 8.1, 8.3 and 8.4 services on Cloud Run, and one ran Drupal on PHP 7.4 and 8.0 behind Cloudflare on GKE. The same playbook worked for all three.

Inventory what is actually running

The repository is not the source of truth. The running image is.

For every PHP workload I traced the deployed image tag back to the CI run that built it and read the base image from the build log. That surfaced problems a repo search would have missed:

  • A workflow on a release branch still pinned an old patch version (8.5.9-cli) after main had moved to the fixed one, so redeploying would have rebuilt the vulnerable image.
  • A staging workflow had merge-conflict markers committed, so its builds had silently stopped running.
  • A FrankenPHP service had the fixed PHP but sat one FrankenPHP release behind, missing that project's own security fixes.

Then rank by exposure. Internet-facing services go first, internal workers after, and anything nobody uses becomes a candidate to switch off.

Pick a path per version, not per fleet

Supported versions (8.2 to 8.5) are the easy case. Bump the pinned patch version, rebuild, and confirm with php -v inside the new image.

PHP 8.1 gets no release. The PHP security team published a source backport branch, but using it means owning a custom PHP build. For services already on 8.1, moving to 8.2.35 was the smaller change: mostly one FROM line, after checking that every locked Composer package accepts 8.2.

PHP 7.4 and 8.0 are a different story. Jumping to 8.2 would mean application upgrades, which you can't do safely in an afternoon. Here I compiled PHP from the official source backport commits on top of the last 7.4 and 8.0 releases, using the stock Docker image's build options, then ran PHP's own test suite on stock and patched builds side by side. Of 7,539 tests, the only real difference was one out-of-memory error-message test, which is the intended behavior change.

Cut exposure while the patch lands

Patching takes hours to days. Exposure can drop in minutes:

  • Remove public access from services that do not need it. Three low-traffic APIs had seen only scanners in 30 days of logs. Closing their public URLs took a minute, was reversible, and kept their Pub/Sub pushes working.
  • Move apps internal-only when another service is their only real caller.
  • Turn on the WAF's managed rules for the CVE, and check which paths skip the WAF. Skip lists tend to be the paths attackers try first.
  • Apply the official php.ini mitigations where an upgrade has to wait: session.upload_progress.enabled=0 for one CVE, and memory_limit=-1 for the other. Set them where the app can't override them, then restart every worker. They are partial mitigations, not a fix.

Expect the supply chain to wobble

On release day, pecl.php.net buckled under the load and returned 502s and 504s for hours, failing base image builds that had nothing wrong with them. Downloading each pinned extension tarball with curl --retry 20 --retry-all-errors and installing from disk got builds through. GitHub Actions also had a degraded evening. Budget time for the tooling, not just the patch.

Make the patch visible

A source-patched PHP 7.4.33 still reports 7.4.33. Add a marker such as an environment variable naming the patch commit, so anyone can confirm what is running without reading a Dockerfile.

Know what behavior changes, too. The patched builds kill the worker when a request runs out of memory instead of returning an error page. Before rolling to production I checked 14 days of logs and found zero out-of-memory errors, so the change would almost never come into play.

Roll out like it matters

  • Staging first, with smoke checks against a recorded baseline.
  • One site at a time in production, quietest traffic first.
  • Payment flows last, with a real test transaction right after deploy.
  • A rollback path that is minutes long and written down before you need it.

What carries over

  • Trust the running image, not the repo. Pinned versions hide on branches you forgot existed.
  • End-of-life PHP is a business risk with a date on it. Every 7.4 and 8.0 site in this incident needed a custom build. The upgrade you postponed is now on the critical path.
  • Shrink the blast radius first. Taking a service off the internet is often faster than patching it, and sometimes it turns out nobody needed it public.

If you run PHP in production and are not sure where you stand on PHP2Shell, the first hour is an inventory, not a rebuild.