# 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.

Canonical: https://red.run.cloud/learn/php2shell-docker-image-patched · By Timothy Lindblom · Published 2026-11-04 · Updated 2026-11-04

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.

| Fact | Detail | Source |
|---|---|---|
| CVE ids | CVE-2026-109618 and CVE-2026-109619, CVSS v4 9.2 each | [PHP notice](https://www.php.net/archive/2026.php#2026-10-21-5) |
| Fixed releases | 8.5.12 · 8.4.27 · 8.3.36 · 8.2.35 | PHP notice |
| Scope | Every PHP installation that serves web requests: PHP-FPM, mod_php, php-cgi, FrankenPHP, LiteSpeed | PHP notice |
| Official php image | Library file lists the four fixed releases on Debian trixie and bookworm and Alpine 3.24 and 3.23; update commit dated 21 October 2026 | [Docker library](https://github.com/docker-library/official-images/blob/master/library/php), [commit history](https://github.com/docker-library/php/commits/master) |
| Older branches | No 8.1 or older tags in that library file | Docker library |
| Exploitation | In the CISA exploited catalog since 26 October 2026. Honeypot attempts from 17 October, vendor-claimed; no named victim in the sources we read | [CISA KEV](https://raw.githubusercontent.com/cisagov/kev-data/main/known_exploited_vulnerabilities.csv), [AWS](https://aws.amazon.com/blogs/security/amazon-threat-intelligence-identifies-php2shell-exploitation-prior-to-public-disclosure-in-madpot/) |
| Checked | 4 November 2026 | this 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](/learn/php2shell) is on its own page, and [the other PHP2Shell guides](/learn/topics/php2shell) 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](/learn/inventory-every-php-runtime-serving-your-business) 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](https://docs.docker.com/build/cache/invalidation/), so an `apt-get` or `FROM` step can reuse an old layer. The build reference describes [`--pull`](https://docs.docker.com/reference/cli/docker/buildx/build/) 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](https://kubernetes.io/docs/concepts/containers/images/). A pod restarted under an unchanged tag can start the old image again.

Digest pinning has the opposite risk. Docker's [pull documentation](https://docs.docker.com/reference/cli/docker/image/pull/) 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.

<figure class="ln-figure">
<svg viewBox="0 0 720 150" role="img" xmlns="http://www.w3.org/2000/svg" font-family="Geist, sans-serif">
<title>Five steps from a fixed base image to a verified running container</title>
<rect x="0" y="0" width="720" height="150" fill="#FFF1EF"/>
<g font-size="13" fill="#1A0F0F" text-anchor="middle">
<rect x="12" y="38" width="124" height="64" rx="10" fill="#FFFFFF" stroke="#EAD3CF"/>
<text x="74" y="66">Base image</text><text x="74" y="86" fill="#655553">fixed PHP</text>
<rect x="152" y="38" width="124" height="64" rx="10" fill="#FFFFFF" stroke="#EAD3CF"/>
<text x="214" y="66">Rebuild</text><text x="214" y="86" fill="#655553">--pull --no-cache</text>
<rect x="292" y="38" width="124" height="64" rx="10" fill="#FFFFFF" stroke="#EAD3CF"/>
<text x="354" y="66">Push</text><text x="354" y="86" fill="#655553">new tag or digest</text>
<rect x="432" y="38" width="124" height="64" rx="10" fill="#FFFFFF" stroke="#EAD3CF"/>
<text x="494" y="66">Replace</text><text x="494" y="86" fill="#655553">every container</text>
<rect x="572" y="38" width="136" height="64" rx="10" fill="#C70500"/>
<text x="640" y="66" fill="#FFFFFF">Verify</text><text x="640" y="86" fill="#FFFFFF">inside the container</text>
</g>
<g stroke="#B00500" stroke-width="2" fill="none">
<path d="M138 70h12M278 70h12M418 70h12M558 70h12"/>
</g>
<text x="360" y="130" font-size="12" fill="#655553" text-anchor="middle">A step skipped anywhere leaves the old PHP serving requests.</text>
</svg>
<figcaption>The path from a fixed base to a confirmed fix. The Dockerfile edit is only the first box.</figcaption>
</figure>

## 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 base | What the source says | What you do |
|---|---|---|
| Official `php:*` image | Dockerfile [builds PHP from the php.net tarball](https://github.com/docker-library/php/blob/master/8.4/trixie/fpm/Dockerfile) (8.4.27 on trixie fpm at our check). Library lists 8.5.12, 8.4.27, 8.3.36, 8.2.35 | Rebuild with `--pull` so you get the fixed tag. Debian's package status does not apply to this image |
| Official `wordpress` image | Library lists PHP 8.2 to 8.5 variants (apache, fpm, fpm-alpine), WordPress 7.1.4 | Pull, then read the PHP version inside. We did not confirm each variant was rebuilt on the fixed base |
| Debian or Ubuntu plus `apt install php` | Debian 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.13 | Rebuild with `--no-cache` so `apt` runs again. Check the package changelog, since the version number looks old |
| RHEL or UBI | Red Hat says customers must rebuild when base images update. Its bulletin, last updated 23 October, still lists no package versions | Track the errata, then rebuild and redeploy |
| AlmaLinux | Packages such as php-8.3.33-1.el10\_2.alma.1 are vendor-claimed fixes with lower numbers than upstream | Verify with `rpm -q --changelog`, not the version |
| Alpine | We could not read an Alpine advisory for these CVEs | Treat as unknown. Check the package revision for your branch |
| `php:8.1` or older | Not in the official library file | See 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`](https://kubernetes.io/docs/reference/kubectl/generated/kubectl_rollout/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](/learn/is-google-cloud-patched-for-php2shell) and for [images running on Fly.io](/learn/is-fly-io-patched-for-php2shell).

> 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](/learn/who-is-responsible-for-patching-my-website) helps decide who answers. Agencies with many client images can use the [client triage list](/learn/php2shell-agency-client-triage).

## 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.

| Evidence | What it shows | What it cannot show |
|---|---|---|
| Dockerfile `FROM` line | What you intended to build | What is running |
| Image creation time and ID | When this image was built | Whether containers use it |
| Container image ID and start time | The image behind the live container | That every replica and worker service matches |
| PHP version in the container | The build the process reports | A vendor backport, if the number is low |
| Package changelog naming both CVEs | A backport on distro packages | A 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

<div class="ln-selftest">
<h3>Where your container stands right now</h3>
<p>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.</p>
<ol>
<li><span class="ln-state ln-state-detected">Detected</span> <strong>The site serves PHP and the exposed version is below the fixed release for its branch.</strong> Treat it as exposed. Rebuild and redeploy today.</li>
<li><span class="ln-state ln-state-unknown">Unknown</span> <strong>The version is hidden, or could be a backport, or you cannot tell which image serves this domain.</strong> This is the common case for containers behind a proxy. Get the image digest and container start time from your platform.</li>
<li><span class="ln-state ln-state-confirmed">Confirmed by owner evidence</span> <strong>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.</strong> The runtime is patched. Whether anything got in earlier is a separate question.</li>
</ol>
<p>No scan, ours included, moves you from "unknown" to "confirmed".</p>
</div>

## 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](https://www.php.net/supported-versions.php), 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](/learn/does-a-waf-stop-php2shell) 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](/learn/was-my-site-exploited-via-php2shell) lists the indicators. If anything is found, rotate every secret the container could read with this [step-by-step secret rotation walkthrough](/learn/rotate-secrets-after-a-breach-guide). The [October 2026 tracker](/learn/october-2026-security-meltdown-tracker) covers the other October incidents, and [the fix guide](/learn/php2shell-fix-patch-php-runtime) 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)](https://www.php.net/archive/2026.php#2026-10-21-5): 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)](https://github.com/php/php-src/security/advisories/GHSA-w8hw-w9fx-j79w)
3. [GHSA-6wmf-4rv5-p3rp: CVE-2026-109619 (php/php-src advisory)](https://github.com/php/php-src/security/advisories/GHSA-6wmf-4rv5-p3rp)
4. [Docker Official Image: php (library definition)](https://github.com/docker-library/official-images/blob/master/library/php): 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 history](https://github.com/docker-library/php/commits/master): Security update commit to the four fixed releases dated 21 October 2026.
6. [docker-library/php Dockerfile, 8.4 fpm on Debian trixie](https://github.com/docker-library/php/blob/master/8.4/trixie/fpm/Dockerfile): Builds PHP 8.4.27 from the php.net source tarball.
7. [Docker Official Image: wordpress (library definition)](https://github.com/docker-library/official-images/blob/master/library/wordpress)
8. [Docker docs: build cache invalidation](https://docs.docker.com/build/cache/invalidation/)
9. [Docker docs: build best practices](https://docs.docker.com/build/building/best-practices/)
10. [Docker docs: docker buildx build reference](https://docs.docker.com/reference/cli/docker/buildx/build/)
11. [Docker docs: docker compose up reference](https://docs.docker.com/reference/cli/docker/compose/up/)
12. [Docker docs: docker image pull](https://docs.docker.com/reference/cli/docker/image/pull/)
13. [Kubernetes docs: images, pull policy and digests](https://kubernetes.io/docs/concepts/containers/images/)
14. [Kubernetes docs: kubectl rollout restart](https://kubernetes.io/docs/reference/kubectl/generated/kubectl_rollout/kubectl_rollout_restart/)
15. [Red Hat security bulletin RHSB-2026-013](https://access.redhat.com/security/vulnerabilities/RHSB-2026-013): Container 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-070](https://docs.cloud.google.com/support/bulletins): Published 21 October 2026. Tells customers to redeploy workloads with updated dependencies.
17. [Canonical: PHP2Shell vulnerability fixes available (Ubuntu blog)](https://ubuntu.com/blog/php2shell-vulnerability-fixes-available)
18. [Debian security tracker: CVE-2026-109618](https://security-tracker.debian.org/tracker/CVE-2026-109618)
19. [AlmaLinux: PHP2Shell patched packages (21 October 2026)](https://almalinux.org/ko/blog/2026-10-21-php2shell-cve-2026-109618-cve-2026-109619/)
20. [Amazon Threat Intelligence: PHP2Shell attempts in MadPot honeypots before disclosure (AWS Security Blog, 21 October 2026)](https://aws.amazon.com/blogs/security/amazon-threat-intelligence-identifies-php2shell-exploitation-prior-to-public-disclosure-in-madpot/): Vendor telemetry. AWS says it is unclear whether the attempts would have succeeded on real systems.
21. [CISA Known Exploited Vulnerabilities catalog (CSV feed)](https://raw.githubusercontent.com/cisagov/kev-data/main/known_exploited_vulnerabilities.csv): Both CVEs added 26 October 2026, federal due date 29 October. Checked 4 November 2026.
22. [PHP supported versions (php.net)](https://www.php.net/supported-versions.php)
