1. Red
  2. Learn
  3. PHP2Shell

PHP2Shell Docker image patched: rebuild, redeploy, verify

Is your PHP2Shell Docker image patched? Rebuild from PHP 8.5.12, 8.4.27, 8.3.36 or 8.2.35, replace every running container, then verify the running image.

By Timothy Lindblom, FounderPublished 4 November 20268 min readHow we check facts
On this page
  1. Who is affected in a Docker setup?
  2. Why does a new base image not fix my running container?
  3. Which base image gives me the fix?
  4. How do I rebuild and redeploy the image?
  5. How do I verify the running container?
  6. Am I affected? A three-state self-test
  7. What if my image is PHP 8.1 or older?
  8. Did anything run before the rebuild?

A PHP2Shell fix reaches a Docker site only when you rebuild the image from a base that contains PHP 8.5.12, 8.4.27, 8.3.36 or 8.2.35 (or a vendor package naming both CVEs), push it, and replace every running container. Pulling a new tag or editing the Dockerfile changes nothing for containers already running. Check the running container rather than the Dockerfile.

FactDetailSource
CVE idsCVE-2026-109618 and CVE-2026-109619, CVSS v4 9.2 eachPHP notice
Fixed releases8.5.12 · 8.4.27 · 8.3.36 · 8.2.35PHP notice
ScopeEvery PHP installation that serves web requests: PHP-FPM, mod_php, php-cgi, FrankenPHP, LiteSpeedPHP notice
Official php imageLibrary file lists the four fixed releases on Debian trixie and bookworm and Alpine 3.24 and 3.23; update commit dated 21 October 2026Docker library, commit history
Older branchesNo 8.1 or older tags in that library fileDocker library
ExploitationIn the CISA exploited catalog since 26 October 2026. Honeypot attempts from 17 October, vendor-claimed; no named victim in the sources we readCISA KEV, AWS
Checked4 November 2026this page

Who is affected in a Docker setup?

Any container whose PHP serves web requests. The PHP project lists PHP-FPM, Apache with mod_php, php-cgi, FrankenPHP and LiteSpeed, and calls mod_php the highest-risk setup. Running inside a container does not take a site out of scope. The full story of the PHP2Shell flaw is on its own page, and the other PHP2Shell guides cover specific hosts and setups.

Queue workers and cron containers are not web-serving, but they are usually built from the same image. Rebuilding the shared image fixes all of them at once, so inventory every service that references it, using a full PHP runtime inventory if you run more than a few.

Why does a new base image not fix my running container?

An image is a snapshot. A container keeps the PHP it was started with until it is replaced. Three places keep the old code alive after the official image moves.

  1. Running containers. Nothing updates them in place. The fix arrives by replacing them.
  2. Cached build layers. Docker's docs say the cache for RUN instructions isn't invalidated automatically between builds, so an apt-get or FROM step can reuse an old layer. The build reference describes --pull as always attempting to pull all referenced images, and --no-cache as not using the cache.
  3. Tags that did not change. A tag is a pointer that moves. Kubernetes defaults the pull policy to IfNotPresent when none is set, which skips the pull if the image already exists on the node. A pod restarted under an unchanged tag can start the old image again.

Digest pinning has the opposite risk. Docker's pull documentation says a pinned digest does not pull updated versions, which may include security updates. If your Dockerfile or manifest pins the digest of a pre-fix base, it stays on the old PHP until you change the digest.

Five steps from a fixed base image to a verified running container Base imagefixed PHP Rebuild--pull --no-cache Pushnew tag or digest Replaceevery container Verifyinside the container A step skipped anywhere leaves the old PHP serving requests.
The path from a fixed base to a confirmed fix. The Dockerfile edit is only the first box.

Which base image gives me the fix?

It depends on where your PHP comes from. Look at the first FROM line of your Dockerfile, then use the row that matches. Status is as read on 4 November 2026.

Your baseWhat the source saysWhat you do
Official php:* imageDockerfile builds PHP from the php.net tarball (8.4.27 on trixie fpm at our check). Library lists 8.5.12, 8.4.27, 8.3.36, 8.2.35Rebuild with --pull so you get the fixed tag. Debian's package status does not apply to this image
Official wordpress imageLibrary lists PHP 8.2 to 8.5 variants (apache, fpm, fpm-alpine), WordPress 7.1.4Pull, then read the PHP version inside. We did not confirm each variant was rebuilt on the fixed base
Debian or Ubuntu plus apt install phpDebian tracker: bookworm 8.2.35-1~deb12u1, trixie 8.4.27-1~deb13u1. Canonical: Ubuntu 22.04 8.1.2-1ubuntu2.28, 24.04 8.3.6-0ubuntu0.24.04.13Rebuild with --no-cache so apt runs again. Check the package changelog, since the version number looks old
RHEL or UBIRed Hat says customers must rebuild when base images update. Its bulletin, last updated 23 October, still lists no package versionsTrack the errata, then rebuild and redeploy
AlmaLinuxPackages such as php-8.3.33-1.el10_2.alma.1 are vendor-claimed fixes with lower numbers than upstreamVerify with rpm -q --changelog, not the version
AlpineWe could not read an Alpine advisory for these CVEsTreat as unknown. Check the package revision for your branch
php:8.1 or olderNot in the official library fileSee the end-of-life section below

If you build PHP yourself in a multi-stage Dockerfile, the fixed source is the php.net release for your branch, and the check is the same.

How do I rebuild and redeploy the image?

Do these on the machine or CI job that builds your image. They change files and running services, so run them in staging first if you have one.

  • Find every Dockerfile and compose file that mentions PHP: grep -rn "^FROM" --include="Dockerfile*" .
  • Update the base to a fixed tag (for example php:8.4-fpm-trixie or a pinned 8.4.27), or change a pinned digest to a post-fix one.
  • Build without reusing old layers: docker build --pull --no-cache -t registry.example.com/myapp:2026-10-24-php8.4.27 .
  • Push under a tag you have never used. A new tag defeats the IfNotPresent cache on Kubernetes nodes.
  • Replace containers. On Compose: docker compose build --pull --no-cache, then docker compose up -d --force-recreate. On Kubernetes: point the Deployment at the new tag or digest and watch the rollout finish.
  • Do the same for queue, scheduler and cron services built from the image.

The Compose reference describes --force-recreate as recreating containers even if their configuration and image have not changed, which is why a plain restart is not enough. Kubernetes documents kubectl rollout restart as recreating all pods of a resource. That recreates pods, and with an unchanged tag and IfNotPresent it can reuse the old image on the node.

On managed platforms, follow the vendor. Google's bulletin GCP-2026-070, published 21 October 2026, tells customers to redeploy their workloads with updated dependencies, and says some Cloud Run and App Engine workloads with automatic updates may be patched on their own. If you are not sure which applies to you, ask. The same rebuild logic is spelled out for Google Cloud workloads and for images running on Fly.io.

For [service name] in [environment]: which image digest is running, was that image built after 21 October 2026 from a base containing PHP 8.5.12, 8.4.27, 8.3.36, 8.2.35 or a package naming CVE-2026-109618 and CVE-2026-109619, and when did the containers start?

If someone else owns the image, this page on who is responsible helps decide who answers. Agencies with many client images can use the client triage list.

How do I verify the running container?

Check what runs, not what you built. Each command reads state and changes nothing.

docker image inspect --format '{{.Id}} {{.Created}}' registry.example.com/myapp:2026-10-24-php8.4.27
docker container inspect --format '{{.Image}} {{.State.StartedAt}}' web
docker exec web php-fpm -v

The image ID printed by the second command must equal the one from the first, and the start time must be later than the build time. php -v inside the container reports the command line binary, so for FPM images prefer the FPM binary.

EvidenceWhat it showsWhat it cannot show
Dockerfile FROM lineWhat you intended to buildWhat is running
Image creation time and IDWhen this image was builtWhether containers use it
Container image ID and start timeThe image behind the live containerThat every replica and worker service matches
PHP version in the containerThe build the process reportsA vendor backport, if the number is low
Package changelog naming both CVEsA backport on distro packagesA restart, which the start time covers

On Kubernetes, compare the image ID or digest reported by every running pod, since an old replica can survive a partial rollout.

Am I affected? A three-state self-test

Where your container stands right now

A check from outside can read a version banner if the site exposes one. It cannot see your image digest, your build time or when your containers started.

  1. Detected The site serves PHP and the exposed version is below the fixed release for its branch. Treat it as exposed. Rebuild and redeploy today.
  2. Unknown The version is hidden, or could be a backport, or you cannot tell which image serves this domain. This is the common case for containers behind a proxy. Get the image digest and container start time from your platform.
  3. Confirmed by owner evidence You hold an image built after 21 October 2026 on a fixed base, and every running container reports that image ID with a later start time. The runtime is patched. Whether anything got in earlier is a separate question.

No scan, ours included, moves you from "unknown" to "confirmed".

What if my image is PHP 8.1 or older?

The PHP project's notice says 8.1 and older no longer get project releases, and the official image file has no tags for them. A pinned php:8.1-* or php:7.4-* base therefore has no official fixed image to move to. Your options, in order:

  1. Move to 8.4 or 8.5 and test in staging. Per php.net's supported versions, 8.2 has security support until 31 December 2026 and 8.4 until 31 December 2028.
  2. Use a vendor image whose changelog names both CVEs, and read the changelog.
  3. Apply the interim settings in the PHP notice. Set session.upload_progress.enabled=0 in php.ini or the pool configuration, not with ini_set(), and restart every worker. For memory exhaustion, PHP advises a container or cgroup limit as an availability boundary and says not to use RLIMIT_AS or RLIMIT_DATA. PHP calls updating the only complete solution.
  4. Restrict who can reach the container directly. A WAF in front can cut exposure while you patch, but it does not replace the fix.

PHP's 23 October follow-up on CVE-2026-115560 recommends the same upload-progress setting until the next bugfix release. It is a separate issue.

Did anything run before the rebuild?

Possibly. CISA added both CVEs to its exploited catalog on 26 October. AWS reported honeypot attempts from 17 October, four days before disclosure, and says it is unclear whether they would have worked on real systems. Replacing a container does not tell you what ran in the old one, or what it could read.

Check upload directories and mounted volumes for PHP files you did not put there, look for new admin accounts and scheduled tasks, and read the web server log from 17 October on. Was my site exploited lists the indicators. If anything is found, rotate every secret the container could read with this step-by-step secret rotation walkthrough. The October 2026 tracker covers the other October incidents, and the fix guide covers non-container servers.

If you want an outside view of what the site shows, the free scan reads the stack your site serves and matches each version to known vulnerabilities. It is a lookup: it can say a version is affected, not whether your setup is exposed.

Questions people ask

I use the official php Docker image. Is my site patched?

Only if your running containers were started from an image built after 21 October 2026 on a fixed tag: 8.5.12, 8.4.27, 8.3.36 or 8.2.35. The official image having a fixed tag does not change containers that are already running. Rebuild, redeploy, and check the version inside the running container.

I pulled php:8.4-fpm yesterday. Do I still need to do anything?

Check which version the pulled image reports and whether your application image was rebuilt on top of it. A pull updates the base on your machine only. Your own image, and every container started from the old one, keep the old PHP until you build, push and replace them.

Does docker compose restart or a pod restart apply the fix?

No. A restart starts the same image again. You need a new image, then a recreate (docker compose up --force-recreate) or a rollout that references the new tag or digest. On Kubernetes, a node that already holds the old image can start the old code again if the tag did not change.

My Dockerfile still says php:8.1. What can I do this week?

The official image lists no 8.1 or older tags, so there is no fixed official image to move to on that branch. Move to 8.4 or 8.5 and test, or use a vendor image that names both CVEs in its changelog. Until then apply the interim settings in the PHP notice and limit who can reach the container.

Can a scan tell me my container is patched?

No. From outside, a scan can see a version banner if one is exposed and cannot see your image digest, your build date or when the container started. Treat an outside result as detected or unknown. Only the image and container details from your own platform confirm it.

Sources

  1. PHP security notice, 21 October 2026, with 23 October follow-up (php.net)CVE ids, fixed releases, scope, container and cgroup advice, interim settings. Checked 4 November 2026: no newer release since 21 October.
  2. GHSA-w8hw-w9fx-j79w: CVE-2026-109618 (php/php-src advisory)
  3. GHSA-6wmf-4rv5-p3rp: CVE-2026-109619 (php/php-src advisory)
  4. Docker Official Image: php (library definition)Lists 8.5.12, 8.4.27, 8.3.36 and 8.2.35, no 8.1 or older. Checked 4 November 2026.
  5. docker-library/php commit historySecurity update commit to the four fixed releases dated 21 October 2026.
  6. docker-library/php Dockerfile, 8.4 fpm on Debian trixieBuilds PHP 8.4.27 from the php.net source tarball.
  7. Docker Official Image: wordpress (library definition)
  8. Docker docs: build cache invalidation
  9. Docker docs: build best practices
  10. Docker docs: docker buildx build reference
  11. Docker docs: docker compose up reference
  12. Docker docs: docker image pull
  13. Kubernetes docs: images, pull policy and digests
  14. Kubernetes docs: kubectl rollout restart
  15. Red Hat security bulletin RHSB-2026-013Container guidance for RHEL and UBI bases. Last updated 23 October 2026, 13:15. Still listed no package versions at our 4 November 2026 check.
  16. Google Cloud bulletin GCP-2026-070Published 21 October 2026. Tells customers to redeploy workloads with updated dependencies.
  17. Canonical: PHP2Shell vulnerability fixes available (Ubuntu blog)
  18. Debian security tracker: CVE-2026-109618
  19. AlmaLinux: PHP2Shell patched packages (21 October 2026)
  20. Amazon Threat Intelligence: PHP2Shell attempts in MadPot honeypots before disclosure (AWS Security Blog, 21 October 2026)Vendor telemetry. AWS says it is unclear whether the attempts would have succeeded on real systems.
  21. CISA Known Exploited Vulnerabilities catalog (CSV feed)Both CVEs added 26 October 2026, federal due date 29 October. Checked 4 November 2026.
  22. PHP supported versions (php.net)

Facts on this page are dated and point at the primary source next to them. If a vendor status changes after the date shown, the vendor's page wins; tell us at support@run.cloud and we will update it.