Skip to content

🚨 CVE-2026-128064: a capital "S" in HTTPS:// silently turned off TLS in PHP — patch today (8.2.36 / 8.3.37 / 8.4.28 / 8.5.13 / 8.6.0)

hhf technology·5 min read

TL;DR

PHP’s HTTP and FTP stream wrappers accept URL schemes case-insensitively, but they only enabled TLS when the scheme contained a lowercase s at a fixed position. So https:// used TLS and HTTPS://, httpS://, FTPS:// did not — they went out as plain HTTP on port 80.

Anything sensitive that your PHP code put on that request — Authorization: Bearer …, Basic auth, cookies, POST bodies, FTP logins, uploaded/transferred files — travelled the network in cleartext.

  • CVE: CVE-2026-128064 (GHSA-f6gg-rchx-xw8j), CWE-319, PHP’s own score 8.2 (CVSS 4.0)
  • Fixed in: PHP 8.2.36, 8.3.37, 8.4.28, 8.5.13, and 8.6.0
  • Not fixed, ever: PHP 5.6 → 8.1 (EOL). Those lines are permanently vulnerable; mitigation only.
  • Patch today. Same release also carries a CVSS 9.2 session-write RCE (more below), so you want this update regardless.

The bug, in one line of C

From ext/standard/http_fopen_wrapper.c:

use_ssl = (ZSTR_LEN(resource->scheme) > 4)       && ZSTR_VAL(resource->scheme)[4] == 's';

ZSTR_VAL(scheme)[4] is “the fifth character of the scheme string”, compared against a lowercase s. The wrapper happily accepts HTTPS (scheme matching is case-insensitive), then fails this test and falls through to the plaintext branch:

if (use_ssl && resource->port == 0)    resource->port = 443;else if (resource->port == 0)    resource->port = 80;

Reproducer (from the research writeup):

<?php$ctx = stream_context_create(['http' => [    'header' => 'Authorization: Bearer secret',]]);
file_get_contents('https://api.example.com/',  false, $ctx); // TLSfile_get_contents('HTTPS://api.example.com/',  false, $ctx); // plaintext!file_get_contents('httpS://api.example.com/',  false, $ctx); // plaintext!

The same fixed-position test exists in the FTP wrapper, so FTPS:// logins go over plain FTP.

The fix compares the whole scheme, case-insensitively:

use_ssl = zend_string_equals_literal_ci(resource->scheme, "https");

Why this matters on a self-hosted stack

This is an outbound problem, and that’s the part that catches people out.

Your inbound TLS is fine. Pangolin, Traefik, Nginx Proxy Manager, Cloudflare Tunnels, Authentik — none of that is involved. Those terminate and re-originate incoming connections. This bug is about what a PHP process does when it dials out: to a payment API, a mail relay, a webhook endpoint, an S3/Wasabi bucket, a metrics endpoint, another container, a partner’s API.

Two things make it worse than a typo:

1. The redirect path is the realistic trigger. A 307 from a legitimate HTTPS endpoint to a URL written with an uppercase scheme preserves the POST body and any retained auth headers, and sends them in cleartext. Data can leak even if the destination rejects the plaintext connection — the bytes were already on the wire. You don’t have to have typed HTTPS:// anywhere; a third party you call just has to redirect you to it.

2. Your own validation passes. If you sanitise with stripos($url, 'https://') === 0, a case-insensitive regex, filter_var($url, FILTER_VALIDATE_URL), or strtolower() on the host only — the URL passes your check and still goes out unencrypted. The mismatch between “case-insensitive accept” and “case-sensitive TLS decision” is the entire vulnerability.

Concretely, the realistic exposure in the kinds of stacks we run here:

  • WordPress — plugins and themes call file_get_contents(), wp_remote_get() with the streams fallback, or bundled SDKs for remote image import, feed fetching, licence checks, backup uploads, and payment gateways. Plugin code is where mixed-case URLs actually get written by hand.
  • Nextcloud — external storage, app store / preview fetching, and third-party app integrations that hit remote APIs.
  • Laravel / Symfony / CodeIgniter apps under CloudPanel or a RunCloud-style panel — anything using the streams wrapper instead of cURL/Guzzle.
  • Cron jobs and one-off scripts — the sync.php someone wrote in 2019 with a URL pasted from a browser address bar or a provider’s dashboard.
  • PHP base images — if you pin php:8.4-fpm or an older :8.3-apache and don’t rebuild, you’re on whatever minor was current when the layer was pulled.

And to be fair to our own tooling: Pangolin, Traefik, CrowdSec, Middleware Manager and Gerbil are Go, not PHP. They are not affected by this CVE. The exposure here is the PHP applications you’re publishing behind them — which in this community usually means WordPress and Nextcloud.


Am I affected?

Everything before these builds:

Branch Fixed version Notes
8.6 8.6.0 first release of the branch, ships fixed
8.5 8.5.13
8.4 8.4.28 Debian trixie: 8.4.28-1~deb13u1 (DSA-6641-1, 19 Nov 2026)
8.3 8.3.37
8.2 8.2.36 Debian bookworm php8.2 was still marked vulnerable in the tracker at time of writing — check before you assume the mirror has it
8.1 and older — EOL, no fix coming. Mitigate manually.

Check what you’re actually running — inside the container, not on the host:

# docker / compose stacksdocker exec -it <php-container> php -vdocker exec -it <php-container> php -r 'echo PHP_VERSION, PHP_EOL;'
# host packages (Debian/Ubuntu)dpkg -l | grep -E '^ii\s+php'php -v
# what image tag is your stack actually pulling?docker compose config | grep -i 'image:.*php'docker image inspect php:8.4-fpm --format '{{.RepoDigests}}'

If you’re on a pinned image tag like php:8.4-fpm, note that the tag moves — you need a docker compose pull && docker compose up -d (or an image rebuild) to actually get 8.4.28. A restart changes nothing.

For Debian/Ubuntu hosts:

sudo apt updatesudo apt install --only-upgrade php8.4-cli php8.4-fpm php8.4-common   # match your branchsudo systemctl reload php8.4-fpm

If you can’t patch immediately

Do these in order — they’re worth having regardless:

  1. Normalise the scheme right before it hits a stream function. Lowercase the scheme of every URL, including ones that arrive from config, env vars, database rows and API responses. Normalising only the first URL doesn’t help; redirect targets need it too.
  2. Turn off automatic redirects (follow_location => 0 in the HTTP context) and validate each hop yourself. This closes the 307 leak, which is the more likely real-world path.
  3. Block outbound port 80 at the network layer. In a homelab this is usually one rule on your egress VLAN or the container network: allow tcp/443 out, deny tcp/80 out, log the denials. It costs nothing (nothing legitimate should be doing plaintext HTTP to the internet in 2026) and it turns this bug from a silent leak into a noisy failure.
  4. Audit the code you can see:
# find stream-wrapper URL use in a projectrg -n --glob '*.php' "file_get_contents\s*\(\s*['\"](https?|ftps?)://" .rg -n --glob '*.php' "fopen\s*\(\s*['\"](https?|ftps?)://" .rg -n --glob '*.php' "stream_context_create" .
# find mixed-case schemes — the actual smoking gunrg -n --glob '*.php' "['\"](HTTPS|HttpS|httpS|Https|FTPS|Ftps)://" .
  1. Hunt for evidence. If your stack has ever proxied a user-supplied URL (image importers, feed readers, link previews, “test this webhook” buttons), check whether you see outbound :80 traffic to external hosts in your firewall, Traefik access logs, or a tcpdump capture on the egress interface. CrowdSec won’t help here — it watches inbound.

Don’t stop at this CVE

The 19 November release is a big one — 18 CVEs across the supported branches, several critical. Two worth knowing by name:

  • CVE-2026-126714 (“phpAfterShell”) — CVSS 9.2. An interrupted pwrite()/ftruncate() during session upload-progress handling can leave a malformed file-backed session that session_start() later deserialises, chaining to remote code execution. Unauthenticated. If you run file-based PHP sessions (the default) on a public-facing PHP app, this is the one that should move your patch window from “this weekend” to “now”.
  • CVE-2026-115560 — session serializer mismatch, also RCE, needs a narrower setup.
  • Also in the batch: PHP-FPM request smuggling, PHP-CGI out-of-bounds write, timezone cache UAF, PHAR OpenSSL signature bypass via algorithm downgrade, SOAP UAF, and a stream-wrapper DoS via folded response headers.

Full notes: PHP: PHP 8 ChangeLog


Checklist

  • php -v on every PHP container/host I run — branch and patch level recorded
  • Upgraded to 8.2.36 / 8.3.37 / 8.4.28 / 8.5.13 / 8.6.0 or later (or the distro build: trixie 8.4.28-1~deb13u1)
  • docker compose pull + up -d on pinned image tags, or rebuilt custom images
  • Grepped my own code for mixed-case HTTPS:// / FTPS:// literals
  • Confirmed redirects are disabled or validated hop-by-hop in code that fetches remote URLs
  • Outbound tcp/80 denied and logged at the egress firewall
  • Anything still on PHP ≤ 8.1 scheduled for migration — it will not be patched

References


If you hit anything odd after upgrading — PHP-FPM not reloading, a container serving a stale version, an app that breaks on the new behaviour — post your php -v, your compose file (redact secrets) and the exact error, and we’ll dig in. Mark the answer as Solved when it’s fixed so the next person searching finds it.

Have a thought or a question? Join the discussion below with your community account.