One capital letter. That is all it took to turn your encrypted HTTPS request into plaintext HTTP.
If your PHP code fetched HTTPS://api.example.com — with a capital S — PHP did not use TLS. It sent your Authorization header, your tokens, and your POST body in plaintext, where anyone on the network path could read them. And your code had no idea. There was no error, no warning, no log line. It just worked — insecurely.
Who is affected
This is CVE-2026-128064, a High severity flaw rated 8.2, fixed in PHP's 19 November 2026 security release. In this post I will show you exactly how the bug worked, who is affected, how to check your own code in 60 seconds, and how to fix it.
What happened on 19 November 2026
PHP released security updates on 19 November 2026 that fixed 17 new vulnerabilities, seven of them critical. The biggest one in the release was phpAfterShell, a critical remote code execution flaw rated 9.2. But the flaw that caught my eye was CVE-2026-128064 — because of how small the cause was.
The advisory says it plainly: mixed-case HTTPS and FTPS URLs can bypass TLS and expose data. A URL like HTTPS:// or httpS:// was not recognised as secure, so PHP sent the request without encryption. The same applied to FTPS:// and to redirects — even a correct lowercase URL could be downgraded if the server redirected to an uppercase one.
You can read the full breakdown in the Semgrep analysis of the November 2026 PHP release and the InfoSecurity Magazine report on the PHP patches.
How one capital letter broke TLS
Here is the bug, in one line of PHP's C source. In ext/standard/http_fopen_wrapper.c, the code that decides whether a request needs SSL looked like this:
use_ssl = (ZSTR_LEN(resource->scheme) > 4) && ZSTR_VAL(resource->scheme)[4] == 's';
Read that carefully. It checks whether the scheme is longer than 4 characters, and whether the 5th character is a lowercase s. For https, the 5th character is s, so TLS turns on. For HTTPS, the 5th character is S, so the check fails — and PHP treats the URL as plain HTTP.
The scheme itself was parsed case-insensitively, so PHP accepted HTTPS:// as a valid scheme. But the TLS decision was case-sensitive. That mismatch is the whole bug: the front door accepted the URL, and the security check quietly said no.
The same logic applied to FTPS. ftps:// got TLS. FTPS:// did not.
And the bug had been there for two decades. Twenty years of PHP, and one case-sensitive character comparison was the difference between encrypted and plaintext.
What this actually leaked
This is not a theoretical flaw. Any PHP application using file_get_contents(), fopen(), or other stream functions with a mixed-case URL could leak real data. Look at this example:
<?php
$context = stream_context_create([
'http' => [
'header' => 'Authorization: Bearer ' . $apiToken,
'method' => 'POST',
'content' => http_build_query(['email' => $email]),
],
]);
// Lowercase: encrypted with TLS
$data = file_get_contents('https://api.example.com/users', false, $context);
// Uppercase S: sent in PLAINTEXT — token and POST body visible on the network
$data = file_get_contents('HTTPS://api.example.com/users', false, $context);
$data = file_get_contents('httpS://api.example.com/users', false, $context);
The second and third calls look identical to the first one to a human reader. Same host, same path, same token. But the request went out unencrypted. Anyone able to observe the network traffic — a compromised router, a hostile network, a bad actor on shared infrastructure — could read the Authorization header, the token, and the POST body.
And here is the twist that makes it worse: the redirect. Your code can use a perfectly correct lowercase https:// URL, and still be downgraded. If the server redirects to an uppercase HTTPS:// URL, PHP followed the redirect without TLS. You did everything right, and the bug still got you.
Who is affected
The flaw affects PHP versions 8.2 to 8.5 before the 19 November 2026 patch. The fixed versions are:
- PHP 8.2.36
- PHP 8.3.37
- PHP 8.4.28
- PHP 8.5.13
- PHP 8.6.0
PHP 8.1 and older remain unpatched, because those versions are end-of-life. If you are still running 8.1 or older, there is no fix coming — you have to work around it yourself, or upgrade.
This one hit close to home for me. I administer a Debian server running PHP 8.2.35 and 8.4.27. Those are exactly one patch behind the fixed versions — 8.2.36 and 8.4.28. My own servers needed this update. If you run PHP, check your version now:
php -v
If the number is below the fixed version for your branch, you are vulnerable. Update before you do anything else today.
The 60-second check for your code
You do not need a security scanner to find this one. Two quick searches across your codebase will tell you if you are exposed.
First, find every place your code fetches a URL through PHP streams:
grep -rn "file_get_contents\|fopen(" --include="*.php" /path/to/your/app
Then look for uppercase schemes in URLs anywhere in your code, config files, and database seeds:
grep -rniE "HTTPS://|HTTPS%3A|FTPS://" --include="*.php" /path/to/your/app
Also check where your URLs come from. A hardcoded uppercase URL is easy to spot. A URL that comes from user input, a database, an API response, or a redirect is not. If any of those sources can produce a mixed-case scheme, and the URL reaches a stream wrapper, you are exposed — even if every URL you wrote yourself is lowercase.
The exposure needs three things at once: a vulnerable PHP version, a mixed-case URL reaching a stream wrapper, and someone able to observe the network traffic. Remove any one of the three and the attack fails. Patching PHP removes the first one, and it is the only fix you should rely on.
How to fix it
1. Update PHP
This is the real fix. Update to the patched version for your branch:
sudo apt update
sudo apt install php8.2 # or php8.3, php8.4, php8.5 — your branch
php -v
Verify the version number after the update. On my server, that means moving 8.2.35 to 8.2.36 and 8.4.27 to 8.4.28. Small numbers, big difference.
2. Normalise URL schemes to lowercase
If you cannot update right away — for example, you are on PHP 8.1 or older with no patch available — normalise every URL scheme to lowercase before it reaches a stream wrapper. This is the interim fix the advisories recommend:
<?php
function safeUrl(string $url): string {
$parts = parse_url($url);
if ($parts === false || !isset($parts['scheme'])) {
return $url;
}
$parts['scheme'] = strtolower($parts['scheme']);
return (isset($parts['scheme']) ? $parts['scheme'] . '://' : '')
. ($parts['host'] ?? '')
. ($parts['path'] ?? '')
. (isset($parts['query']) ? '?' . $parts['query'] : '');
}
$data = file_get_contents(safeUrl($url), false, $context);
This is a workaround, not a fix. It protects your own code, but it does not protect a library or a framework that builds URLs internally. Update PHP as soon as you can.
3. Validate redirect targets
Because redirects can also trigger the downgrade, do not follow redirects blindly. If your code follows redirects, validate the redirect target's scheme and host before following it. Better still, use an HTTP client library that handles TLS properly, such as Guzzle, instead of raw stream functions for anything that carries credentials.
4. Stop putting secrets in stream calls
Long term, the safest pattern is to stop sending credentials through file_get_contents() at all. Use a proper HTTP client, keep secrets in environment variables or a secrets manager, and never log request URLs or headers that contain tokens. The less sensitive data flows through the simplest code paths, the smaller the blast radius when one of those paths has a bug.
The rest of the November 19 release
CVE-2026-128064 was not the only serious flaw in this release, and if you update PHP you fix all of them at once. The others worth knowing about:
- phpAfterShell, CVE-2026-126714, rated 9.2 — a critical flaw in PHP's default file session handler that can lead to remote code execution. You can read more in the Precursor Security write-up on phpAfterShell.
- CVE-2026-129291, rated 8.8 — a PHP-FPM use-after-free that lets someone who can already run PHP code in a worker execute commands as the FPM master, which commonly runs as root.
- CVE-2026-127960, rated 8.7 — folded HTTP response headers can cause excessive CPU consumption and denial of service.
- CVE-2026-128090, rated 7.7 — an OpenSSL-signed Phar archive can be downgraded and modified while the trusted public key stays unchanged.
One update fixes all of them. That is the point: patching is not about one CVE. It is about staying on a supported, patched branch so the next one does not catch you either.
Why a bug like this survives for twenty years
This is the part I keep coming back to. The bug was not hidden. It was one line of C code, in a function thousands of developers have read. The check looked reasonable. https has an s at position 4. It worked for every normal URL. It only failed for a case nobody thought to test — a capital S.
That is how most security bugs survive. Not because they are clever, but because they are boring. Nobody writes a test for HTTPS:// because nobody writes HTTPS://. Except that URLs come from users, from databases, from APIs, from redirects — and somewhere in that chain, a capital letter shows up.
The fix was also one line: compare the whole scheme case-insensitively instead of checking one character. That is the lesson. Security is not about the big, dramatic vulnerabilities. It is about the one-character assumptions in code that runs a million times a day.
FAQ: PHP CVE-2026-128064
What is CVE-2026-128064?
It is a High severity vulnerability (rated 8.2) in PHP's stream wrappers. A mixed-case HTTPS or FTPS URL, such as HTTPS:// or httpS://, was not recognised as secure, so PHP sent the request without TLS encryption, exposing credentials, tokens, and request bodies in plaintext. It was fixed on 19 November 2026.
Which PHP versions are affected?
PHP 8.2 to 8.5 before the 19 November 2026 patch. Fixed versions are 8.2.36, 8.3.37, 8.4.28, 8.5.13, and 8.6.0. PHP 8.1 and older are end-of-life and remain unpatched.
How does the bug work?
PHP's HTTP stream wrapper decided whether to use SSL by checking if the 5th character of the URL scheme was a lowercase s. For https that is true. For HTTPS or httpS it is false, so PHP used plain HTTP. The scheme was parsed case-insensitively, but the TLS check was case-sensitive.
Can a redirect trigger it?
Yes. Even a correct lowercase https:// URL can be downgraded if the server redirects to an uppercase HTTPS:// URL, because the redirect target goes through the same flawed check.
How do I check if my code is affected?
Run php -v and compare with the fixed version for your branch. Then search your codebase for file_get_contents and fopen calls that fetch URLs, and for uppercase HTTPS:// or FTPS:// strings in code, config files, and database seeds.
What is the fix?
Update PHP to 8.2.36, 8.3.37, 8.4.28, 8.5.13, or 8.6.0. If you cannot update, normalise all URL schemes to lowercase before passing them to stream wrappers, and validate redirect targets — but treat that as a temporary workaround, not a fix.
Final thoughts
Check your PHP version today. It takes five seconds:
php -v
If you are on 8.2.35, 8.4.27, or anything below the fixed versions, update now. Then search your code for stream fetches and uppercase URLs. Then, when you have a quiet moment, think about how many other one-character assumptions are sitting in the code you run every day.
A capital S should never be the difference between encrypted and plaintext. Now it is not — as long as you patch.
If this helped, let me know in the comments. Did you find an uppercase URL in your codebase?
More from me: my DEV profile.


Top comments (0)