HP2Shell on Google Cloud and Docker

PHP2Shell on Google Cloud and Docker: what patched itself and what we had to rebuild

Guillem

— 3 reading minutes

On 21 October PHP released fixes for two critical vulnerabilities, CVE-2026-109618 and CVE-2026-109619, now known as PHP2Shell. Both allow remote code execution without authentication and affect every way PHP serves web requests: PHP-FPM, Apache with mod_php, php-cgi, FrankenPHP and LiteSpeed. The fixed versions are 8.5.12, 8.4.27, 8.3.36 and 8.2.35. PHP's own advisory is clear that updating is the only complete mitigation.

That week we went through the PHP projects we maintain, one by one. Most run in containers, on Google Cloud or elsewhere, and a few on App Engine.

The image tag doesn't tell you which PHP you are running

Many Dockerfiles start from an image tagged with the minor version, something like «8.4». That tag moves forward with each release, but it only tells you which branch you asked for. Which patch version ends up in production depends on when the image was last built.

In several projects the tag said 8.4 and the container was still running a version from before 21 October, with nothing in the repository to show it.

What we did was pin the exact patch version in the base image, so the version is visible in the code and changes only when someone changes it on purpose.

Cached builds keep serving the old version

Some pipelines reuse base image layers from the build cache to save time, so even with a correct tag the new build was made from the image they already had. The deploy and the tests passed, but PHP was still the vulnerable version.

The fix is to force the base image to be downloaded again (or to clear the cache) when rebuilding for a security patch. With the exact version pinned, as in the previous step, a stale cache shows up as a version mismatch.

Check the version that answers in production

For each project, once deployed, we checked the PHP version from inside the running container, because the Dockerfile and the image registry only show what should be running. Only then did we mark the project as done. That check is how we found the two problems above.

App Engine: the first notice said it was already patched

Google's release notes for the PHP runtime said on 21 October that PHP workloads had been patched automatically. The next day the same note was marked as incorrect: the guidance was to redeploy with updated dependencies. On 24 October Google listed the updated runtimes and asked to rebuild and redeploy.

If you read only the first note, you might have assumed there was nothing to do. We redeployed every App Engine service and then checked the version, as with the containers. 

If you are thinking about moving off App Engine, we wrote about how we migrated a Symfony application from App Engine to Cloud Run.

Version headers and the session mitigation

We stopped announcing the PHP and web server versions in response headers. It doesn't fix anything by itself, but it means a scanner can't tell from outside which version you run.

On 23 October PHP published another vulnerability, CVE-2026-115560, without a fixed version. It only affects applications that combine a specific session configuration with a change made at runtime, and PHP recommended disabling session upload progress until the fix arrives. We applied it in all projects.

What we would check, in order

  1. Find out which PHP version each project is actually running in production, from inside the service.
  2. Pin the exact patch version in the base image (8.5.12, 8.4.27, 8.3.36 or 8.2.35, or later).
  3. Rebuild without cache and redeploy. On App Engine, redeploy too.
  4. Check the version again once deployed.
  5. Apply the session upload progress mitigation until PHP releases the fix for CVE-2026-115560.
  6. If a project runs on PHP 8.1 or older, plan the upgrade. Those branches no longer get official fixes.

If you have PHP projects and aren't sure they're up to date, tell us about them and we'll review them with you.

📫
Here’s today’s article. Feel free to reach out to us on social media as always, or at hola@softspring.es with any questions or suggestions!

Let’s work together!

Do you want to tell us your idea?

CONTACT US