Skip to content

Patch PHP for CVE-2026-109618/109619 and bump FrankenPHP to 1.13.1 - #7

Merged
michaelaguiar merged 2 commits into
mainfrom
php-cve-2026-109618-patch
Oct 21, 2026
Merged

michaelaguiar merged 2 commits into
mainfrom
php-cve-2026-109618-patch

Conversation

@michaelaguiar

@michaelaguiar michaelaguiar commented Oct 21, 2026 •

Copy link
Copy Markdown
Member

Why

PHP 8.5.12, 8.4.27, 8.3.36 and 8.2.35 fix two unauthenticated remote code execution bugs (CVE-2026-109618, CVE-2026-109619; CVSS v4.0 9.2) that affect every PHP SAPI serving web requests, FrankenPHP included. As of today neither php:*-zts-alpine nor dunglas/frankenphp (latest: 1.13.1, built Oct 10) ships the fixed versions.

What

Out-of-band PHP rebuild in each php/8.{2,3,4,5}/frankenphp/Dockerfile: a new php-patched stage

  • downloads php-<patch>.tar.xz from php.net and verifies the sha256 pinned in the Dockerfile (taken from php.net's releases JSON)
  • configures with the upstream image's own flags (read back from php-config --configure-options) and docker-library's build deps and recipe
  • make installs into a staging root, which the final stage copies over the base: libphp.so, CLI/phpdbg binaries, shared extensions, headers, php.ini-*, and /usr/src/php.tar.xz (so core extensions installed later, e.g. by the wordpress variant, build from patched source)
  • PHP_VERSION, PHP_URL, PHP_ASC_URL and PHP_SHA256 env are updated to match

FrankenPHP links libphp.so dynamically and patch releases keep the same API numbers, so FrankenPHP itself isn't rebuilt.

Guards:

  • The final image's main RUN fails the build unless both frankenphp php-cli (which runs the embedded libphp.so) and the php CLI report the patched version.
  • The php-patched stage fails if the base already ships PHP at or above the patch version, so it can't silently downgrade once upstream catches up.

8.2 also applies php-src#18743 (pinned by sha256, same as docker-library's 8.2 alpine images). Without it, the 8.2 ZTS JIT fails to assemble on Alpine 3.24.

FrankenPHP 1.13.1 for all four versions. They were on 1.9 (8.2), 1.11.1 (8.3, 8.5) and 1.12.4 (8.4); 1.13.x also includes FrankenPHP's own 2026-10-04 security fixes.

The dev and wordpress variants rebuild automatically because the base Dockerfiles changed. wordpress-dev doesn't get patched by the merge run (see below).

Follow-up: once the FROM image ships these versions or newer, the php-patched stage fails the build. Then remove that stage, the PHP_PATCH_* ARGs, and the ARG/COPY/ENV block after LABEL.

After merging

  1. Let the merge run of Build and Push Docker Images finish. wordpress-dev is FROM …-frankenphp-wordpress but builds in the same job as wordpress, in parallel, so this run's wordpress-dev images are built on the old, unpatched wordpress tag. That race already existed; it isn't new in this PR.
  2. Then dispatch the workflow on main with build_php_82, build_php_83, build_php_84 and build_php_85. Don't start it while the merge run is still going: cancel-in-progress would cancel the merge run. This second run's wordpress-dev pulls the now-patched wordpress tag.
  3. Confirm with docker run --rm --entrypoint frankenphp ghcr.io/aliasproject/php:<ver>-frankenphp-wordpress-dev php-cli -r 'echo PHP_VERSION;' before rolling out.

Testing (local, amd64)

  • All four base images build; each serves a request through FrankenPHP reporting the patched PHP_VERSION (8.2.35 / 8.3.36 / 8.4.27 / 8.5.12), with OPcache active, no php -m warnings, no error logs, and a passing healthcheck.
  • 8.2: OPcache tracing JIT enables successfully with the #18743 patch.
  • 8.4-frankenphp-wordpress built on the patched base: gd, mysqli, soap and exif all report 8.4.27.
  • 8.4-frankenphp-dev and 8.2-frankenphp-dev build.
  • Both guards were checked to fail: the downgrade guard with PHP_PATCH_VERSION=8.4.26, and the version guard run against the unpatched upstream libphp.
  • arm64 is untested. This workflow only builds on pushes to main or a manual dispatch, so the merge run is the first arm64 build.

Known gaps

  • frankenphp version still prints the old PHP version. That string is compiled into the Go binary; the PHP actually running is the patched one.
  • Not covered here, all still vulnerable:
    • the CLI images (Alpine-packaged PHP)
    • the 8.2 FPM and fpm-nginx images (Alpine php82 package)
    • the 7.4 / 8.0 / 8.1 FPM images (EOL distro packages). PHP 8.1 and older only have unofficial backport branches from the PHP security team.
  • PEAR's installer, run by make install because the reused configure options include --with-pear, downloads install-pear-nozlib.phar from pear.php.net without a pinned hash. docker-library's own base build does the same.

PHP 8.5.12, 8.4.27, 8.3.36 and 8.2.35 fix two unauthenticated RCEs
(CVSS 9.2) affecting every SAPI that serves web requests, FrankenPHP
included. Neither php:*-zts-alpine nor dunglas/frankenphp ships them
yet, so each frankenphp Dockerfile gains a php-patched stage that
rebuilds PHP from the php.net tarball (sha256-pinned) with the upstream
image's own configure flags and copies the result over the base.
FrankenPHP links libphp.so dynamically and patch releases keep the same
API numbers, so the swap needs no FrankenPHP rebuild. The patched
tarball also replaces /usr/src/php.tar.xz so core extensions installed
later (intl, gd, mysqli, ...) build from fixed source. The build fails
if php doesn't report the patched version.

8.2 also needs php-src#18743 (as docker-library applies) for its JIT to
assemble on Alpine 3.24.

FROM pins move from 1.9 / 1.11.1 / 1.12.4 to 1.13.1 across the board,
which also picks up FrankenPHP's own 2026-10-04 security fixes.

Drop the php-patched stage once the FROM image ships the patched PHP.
- Fail the php-patched stage when the base already ships PHP at or
  above PHP_PATCH_VERSION; copying over it would silently downgrade.
- Version guard now also checks `frankenphp php-cli`, which runs the
  libphp.so the server embeds; the `php` CLI is a separate binary and
  could report the patched version while web requests run the old lib.
- Strip only the exact `PHP_UNAME=Linux - Docker` token from the reused
  configure options and fail on any other PHP_UNAME, instead of
  dropping everything after it.
- Copy only /php-install/usr/: PEAR's installer also writes registry
  dotfiles (.channels, .registry, ...) at INSTALL_ROOT, which were
  landing in the image's /.
- Removal note lists everything to delete once upstream catches up.
@michaelaguiar

Copy link
Copy Markdown
Member Author

Review round 1 (the only round, by request)

A fresh-context reviewer ran code-review at high effort and built the 8.2 and 8.4 images itself. It confirmed:

  • requests through the FrankenPHP SAPI run the patched libphp;
  • nothing PHP-related is left stale from the base image (phpize, php-config, headers and the source tarball are all replaced);
  • the GHA layer cache can't reuse a stale build;
  • every version is pinned to FrankenPHP 1.13.1.
# Sev Finding Outcome
1 P1 wordpress-dev builds in parallel with wordpress from the old published tag, so the merge run ships it unpatched Not fixed in code: the race is in the workflow and predates this PR. The PR description now explains it and gives the post-merge step (a second dispatch once the merge run finishes). Restructuring the workflow can be a follow-up.
2 P2 Nothing stops the patch stage from downgrading PHP once upstream catches up Fixed in c0a05a4: php-patched fails if the base PHP is at or above PHP_PATCH_VERSION. Checked to fail with PHP_PATCH_VERSION=8.4.26.
3 P2 The guard checks the php CLI, not the libphp FrankenPHP serves Fixed in c0a05a4: it now checks both frankenphp php-cli and php. Checked to fail against the unpatched upstream libphp.
4 P3 sed 's/ PHP_UNAME=.*//' drops everything after PHP_UNAME Fixed in c0a05a4: strips only the exact PHP_UNAME=Linux - Docker token and fails on any other PHP_UNAME.
5 P3 PEAR's dotfiles land in /; PEAR is downloaded without a pinned hash Partly fixed in c0a05a4: only /php-install/usr/ is copied, so no dotfiles reach /. Declined dropping --with-pear: it would make php-config --configure-options differ from the base, and docker-library's own base build does the same unpinned HTTPS download. Noted under Known gaps.
6 P3 The removal comment omits the ARGs and the ENV block Fixed in c0a05a4.
7 P3 The comment in php/8.4/cli/Dockerfile about the frankenphp base's Alpine version is stale Declined: the CLI images aren't touched by this PR.
— gap The 8.2 FPM and fpm-nginx images (Alpine php82) aren't patched or listed PR description updated to list them under Known gaps.

After c0a05a4, all four images were rebuilt locally (amd64). Each reports the patched version via frankenphp php-cli, has no dotfiles in /, has the patched /usr/src/php.tar.xz and loads every extension without warnings. These fixes weren't sent for a second review because only one round was requested.

@michaelaguiar
michaelaguiar marked this pull request as ready for review October 21, 2026 15:38
@michaelaguiar
michaelaguiar merged commit 34c4345 into main Oct 21, 2026
2 checks passed
@michaelaguiar
michaelaguiar deleted the php-cve-2026-109618-patch branch October 21, 2026 17:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant