Skip to content

fix: rebuild the image on PHP 8.3.37 and patch three dependency advisories - #6

Merged
DManavi merged 3 commits into
mainfrom
dmanavi-php-cve-image-updates
Nov 27, 2026
Merged

DManavi merged 3 commits into
mainfrom
dmanavi-php-cve-image-updates

Conversation

@DManavi

@DManavi DManavi commented Nov 26, 2026 •

Copy link
Copy Markdown
Owner

Every published image (latest, 1, 1.20260820, 1.20260820.0444, on both ghcr.io and Docker Hub) runs PHP 8.3.33. PHP has shipped three security releases since then. Separately, composer audit --locked, which CI runs as a gate, now fails on three dependency advisories. All three commits are fix, so merging this cuts a release, and the release rebuilds and republishes both images.

1. PHP 8.3.33 → 8.3.37 (fix(docker))

The runtime base is now pinned to php:8.3.37-cli-alpine. The floating php:8.3-cli-alpine tag already resolves to the same index digest (sha256:6af812ec…). The published images fell behind only because nothing has built an image since 20 Aug. (There was no 8.3.34 release.)

Release Advisories Highlights
8.3.35 (24 Sep) 12 TLS hostname check falls back to the CN after a SAN mismatch (CVE-2026-91769); heap overflow on a wildcard CN (CVE-2026-91767); credentials leak across origins on HTTP-wrapper redirects (CVE-2026-91766)
8.3.36 (21 Oct) 2 "php2shell" RCEs CVE-2026-109618 and CVE-2026-109619 (CVSS 9.2, on CISA KEV)
8.3.37 (19 Nov) 13 Session RCEs CVE-2026-126714 ("phpAfterShell") and CVE-2026-115560; timezone-cache use-after-free CVE-2026-129496
All 26 CVEs
  • 8.3.35: CVE-2026-91768, CVE-2025-1218, CVE-2026-91769, CVE-2026-91767, CVE-2026-6103, CVE-2026-91765, CVE-2025-14181, CVE-2026-92842, CVE-2026-91766, CVE-2026-93682, CVE-2026-17545, plus GHSA-ch8v-r6jh-4vvr (no CVE)
  • 8.3.36: CVE-2026-109618, CVE-2026-109619
  • 8.3.37: CVE-2026-129538, CVE-2026-129496, CVE-2026-129289, CVE-2026-129292, CVE-2026-129291, CVE-2026-128090, CVE-2026-126714, CVE-2026-115560, CVE-2026-129481, CVE-2026-15353, CVE-2026-129506, CVE-2026-128064, CVE-2026-127960

8.3.37 is the latest 8.3 release and fixes all of them. Two 19 Nov advisories appear only under 8.6.0 (CVE-2026-129474 and CVE-2026-129182), and they affect PHP 8.5+ only. A few advisories cover parts this image never runs: FPM, CGI, Windows, and SOAP (not compiled in).

AGENTS.md gains a Traps entry: a PHP bump has to be committed as fix(docker). Committed as chore, it merges without a release, and the published images keep the old PHP.

2. Alpine security updates the PHP image is missing (fix(docker))

Even on 8.3.37, the base image still carries libxml2 2.13.9-r2 (CVE-2026-86144, high, fixed in -r3), while Alpine 3.24 already ships -r5. The official image is rebuilt for PHP and Alpine releases, not for every Alpine package fix.

libxml2 is reachable by clients: Slim's app-level body parser runs simplexml_load_string on any XML request body before the /v1/hosts group's AuthenticationMiddleware runs (src/Http/AppFactoryBuilder.php:35, config/routes.php:39-45). aws-sdk-php also uses it to parse Route53 responses.

  • The fix: apk upgrade --no-cache in the runtime stage, staying on the image's own Alpine branch. Today it changes exactly two packages: libxml2 2.13.9-r2 → -r5, and zstd-libs 1.5.7 → 1.6.0 (used only by libcurl).
  • The cache problem: that layer must not come from the GitHub Actions cache. CI and both publish workflows share one cache scope, and each export replaces the last. A cached layer would bring back whichever build's packages came first, possibly a different build per architecture.
  • The workflow change: publish-ghcr.yml and publish-dockerhub.yml now set no-cache-filters: runtime. Every release gets that day's Alpine fixes on both amd64 and arm64. The vendor stage still caches, and composer.lock fixes what it produces. The cost is rebuilding pcntl on each release, under emulation for arm64.

3. symfony/yaml and symfony/filesystem 7.4.15 → 7.4.24 (fix)

These are dependencies, not PHP itself, but they ship in the same image, and every PR currently fails CI's audit step because of them.

Package Advisory Fixed in
symfony/yaml (direct) CVE-2026-109413 (high): unbounded recursion in the inline lexer 7.4.18
symfony/yaml CVE-2026-123792: exponential and quadratic parse times 7.4.23
symfony/filesystem (via aws-sdk-php) CVE-2026-135803: Path treats any prefix before :// as a root 7.4.23

Neither is known to be reachable from a client:

  • symfony/yaml parses only what the operator supplies: the config file, read on every request and command, and config:set values. Nothing a client sends is ever read as YAML.
  • src/ never uses symfony/filesystem directly.

I pinned symfony/yaml via composer require and updated symfony/filesystem in the lock only. I resolved on PHP 8.2, the CI floor, and no other package moved.

Verification (local, Docker 29.9)

Published 1.20260820.0444 This branch
PHP_VERSION 8.3.33 8.3.37
Alpine / OpenSSL / curl / libxml2 3.24.1 / 3.5.7 / 8.21.0 / 2.13.9-r2 3.24.4 / 3.5.9 / 8.23.0 / 2.13.9-r5
composer audit --locked 3 advisories clean
grype --only-fixed 121 (OpenSSL ×45, curl ×68, zlib, musl, nghttp2, brotli, libxml2, symfony/yaml) 0

grype doesn't match the PHP interpreter itself, so the PHP CVEs above rest on the version check and PHP's own advisories.

  • Dev image (PHP 8.3.37): composer check passes: audit clean, formatting OK, PHPStan max reports no errors, and 641 tests pass (1 skipped). composer validate passes.
  • Linters: hadolint is clean. actionlint 1.7.12 with shellcheck 0.11.0 reports 0 findings on every workflow.
  • Cache filter: docker build --no-cache-filter runtime takes the vendor stage from cache, rebuilds every runtime step and re-runs apk upgrade.
  • Runtime image, CLI:
    • Runs as uid 1000, pcntl is loaded, expose_php is off, and PHP starts with no warnings.
    • SimpleXML and DOM parsing work on the upgraded libxml2.
    • providers:list, config:validate and hosts:list succeed with the example config.
    • update --all --dry-run with a placeholder token reaches DigitalOcean over TLS and is rejected cleanly.
  • Runtime image, HTTP:
    • /health and /api return 200.
    • Basic auth returns 200 with the right token and 401 with a wrong one.
    • An update with the placeholder token returns 502. The response body is byte-identical to the published image's.
    • The Docker HEALTHCHECK reports healthy.

The code review raised one Medium issue (the cache problem in section 2) and three Low wording errors in comments and commit messages. All are fixed, and the commits were rewritten so their messages stay accurate.

After merge: the release workflow runs, publishes to GHCR, Docker Hub and Packagist, and then verify-release.yml checks the published packages.

DManavi and others added 3 commits November 26, 2026 17:02
Every published image - latest, 1, 1.20260820 and 1.20260820.0444, on
ghcr.io and Docker Hub alike - runs PHP 8.3.33, which is what
php:8.3-cli-alpine pointed at when the last release was built on 20 August.
Three PHP security releases have shipped since, with 27 advisories between
them:

- 8.3.35 (24 Sep), 12: among them TLS hostname verification falling back to
  the CN after a SAN mismatch (CVE-2026-91769), a heap overflow on a crafted
  wildcard certificate CN (CVE-2026-91767), and credentials leaking across
  origins when the HTTP stream wrapper follows a redirect (CVE-2026-91766).
- 8.3.36 (21 Oct), 2: the "php2shell" remote code execution bugs,
  CVE-2026-109618 and CVE-2026-109619, both now in CISA's KEV catalogue.
- 8.3.37 (19 Nov), 13: among them the session RCEs CVE-2026-126714
  ("phpAfterShell") and CVE-2026-115560, and the timezone cache
  use-after-free CVE-2026-129496.

8.3.37 fixes all of them. A few sit in parts this image never runs - FPM,
SOAP, CGI, Windows - but a patch release is the unit PHP ships fixes in.

The floating tag already resolves to 8.3.37. None of it reached anyone
because nothing has built an image since: the publish workflows run for a
release or by hand, and neither has happened. Pinning the patch version puts
the PHP an image ships in the diff - a publish run, for a release or by hand,
now builds the PHP its tag was reviewed with - and turns the next security
release into a one-line fix(docker) change that releases by its type.
AGENTS.md now says so, because the same bump committed as chore would merge
without rebuilding anything.

The rebuild also moves Alpine from 3.24.1 to 3.24.4: OpenSSL 3.5.7 to
3.5.9, curl 8.21.0 to 8.23.0, zlib 1.3.2 to 1.4.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
composer audit --locked - the first step of composer check, and a gate in
CI - now fails on main. Advisories published since the last release cover
two packages that ship in every install and every image:

- symfony/yaml 7.4.15: unbounded recursion in the inline lexer lets a single
  document crash the process (CVE-2026-109413, high), and exponential and
  quadratic parse times let one hold it (CVE-2026-123792). Fixed in 7.4.18
  and 7.4.23.
- symfony/filesystem 7.4.15, through aws-sdk-php: Path treats any prefix
  before "://" as a root, so a path can escape its base directory
  (CVE-2026-135803). Fixed in 7.4.23.

Neither is known to be reachable from a client. symfony/yaml parses only what
the operator supplies - the configuration file, read on every request and
command, and config:set values - and nothing a client sends is ever read as
YAML. Nothing in src/ uses symfony/filesystem directly. Both still ship,
though, and the audit gate cannot pass around them.

Both go to 7.4.24, the newest 7.4 patch: symfony/yaml through its pin with
composer require, symfony/filesystem in the lock alone, since transitive
packages are held only by the lock, as the README notes. Resolved on PHP 8.2,
the floor CI tests, so nothing in the lock needs a newer PHP than
composer.json allows. No other package moved.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Even on PHP 8.3.37 the image still carried libxml2 2.13.9-r2, with
CVE-2026-86144 (high) fixed in -r3, while Alpine 3.24 already ships -r5. The
official PHP image is rebuilt for PHP and Alpine releases rather than for
every Alpine package fix, so the libraries PHP links against can trail the
repositories it was built from. libxml2 is one of them, and a client can
reach it: Slim's body parsing hands it the body of any XML request to a
route, ahead of authentication. aws-sdk-php parses Route53's responses with
it too.

apk upgrade in the runtime stage closes that gap without leaving the image's
Alpine branch, so the ABI PHP was compiled against holds. Today it moves
libxml2 to 2.13.9-r5, and zstd-libs, which only libcurl uses, from 1.5.7 to
1.6.0. grype now reports no fixable vulnerability in the image, down from 121
in the published one.

A cached copy of that layer would quietly undo it. Its cache key is the base
image and the command, so it would bring back the packages of whichever build
made it first - often CI's, days before a release - and, because CI and both
publish workflows share one GitHub Actions cache scope and each export
replaces the last, not necessarily the same build for both architectures. So
the publish workflows build the runtime stage without the cache
(no-cache-filters), and every release takes the fixes available the day it is
built, on both architectures. The vendor stage still caches; composer.lock
fixes what it produces. The price is compiling pcntl again on each release,
under emulation for arm64.

The comment that called the base image tag "the pin that matters" now says
what the tag pins - PHP - since the packages around it no longer come from it
alone.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
@DManavi
DManavi force-pushed the dmanavi-php-cve-image-updates branch from c79628c to 7b9a45f Compare November 27, 2026 00:05
@DManavi
DManavi merged commit b3bf37f into main Nov 27, 2026
7 checks passed
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