PHP2Shell, eMudhra and PingCAP explained

So the Dutch government turned off its own login system this morning. On purpose. DigiD, the thing people in the Netherlands use for their taxes and pretty much every government service, went offline along with the Dutch parliament website and a bunch of others because two bugs in PHP leaked before anyone had a fix ready.

It wasnt even the only weird thing this week. An Indian certificate authority called eMudhra had a private key that was literally the number 4 (not a joke, Ill explain) and PingCAP, the company behind the TiDB database, found out someone had been walking around its systems with stolen credentials for almost a month. Plus a few smaller things I squeezed in at the end.

If you run PHP anywhere and youre only going to read one line of this post, update to 8.5.12, 8.4.27, 8.3.36 or 8.2.35 today.

Most of the post is about PHP since its the big one. Ill explain it in normal language first and get more technical further down, and if code isnt your thing you can skip the code blocks without missing anything.

what even is PHP #

PHP is a language that runs on web servers. You never see it directly, it builds the page on the server before your browser gets it. WordPress runs on it and so does Wikipedia, and if youve ever bought something from a random online store theres a decent chance it was running Magento or WooCommerce, which are PHP too. W3Techs puts it at about 69% of websites (out of the ones where they can tell what the server runs) which is kinda insane for a language that gets made fun of as much as PHP does.

This blog is Python (Flask) btw so for once I got to just sit back and watch the chaos lol.

PHP2Shell #

how it leaked #

Quick background first. When a researcher finds a bad bug theyre supposed to report it privately, the maintainers fix it quietly, Linux distros and other vendors get the patch early and then on an agreed date (the embargo) everything gets released at once so attackers and defenders find out at the same time.

That was supposed to happen on Thursday Oct 22, but on Tuesday at 15:20 UTC someone posted on Hacker News that two critical PHP bugs were about to drop, with two CVE numbers attached (CVE-2026-109618 and CVE-2026-109619, CVEs are just ID numbers for security bugs) and their evidence was, barely paraphrasing here, trust me bro lol. Then watchTowr, a security company, posted that the leak was real and everyone was supposed to wait until Thursday, and that they had already reproduced one of the bugs themselves. A screenshot of an exploit tool called PHP2Shell started going around (credited to a security team called Calif) along with a short video of it working that got deleted pretty quickly.

At 19:33 UTC PHP posted an advance notice moving the release up to Wednesday Oct 21 at 14:00 UTC, which is 10am here in Toronto, and said theyd go even earlier if attacks started showing up.

the internet kinda panicked #

At 07:43 UTC on Wednesday Cloudflares CTO said they were already seeing early attacks, and Cloudflare pushed emergency firewall rules to every customer including people on the free plan. They called it a stopgap themselves. Those rules only protect traffic that goes through Cloudflare, if an attacker finds your servers real IP address they can skip it completely.

Plenty of organizations decided they werent going to gamble on that and pulled their sites offline.

DOS style error messages for the sites that went offline on Oct 21: DigiD, MijnOverheid, Tweede Kamer, NCSC, Tweakers, RTL Nieuws, Smartschool and Notubiz

DigiD and MijnOverheid (the Dutch government login and inbox), the Dutch parliament, Tweakers, RTL, about 100 municipalities that use a meeting system called Notubiz and Smartschool over in Belgium all went down on purpose. Even the Dutch NCSC took its own site offline (yes the national cyber security centre lol) and told everyone else that any PHP system reachable from the internet was probably vulnerable until it got updated.

Sansec, a company that protects online stores, expected mass attacks within about 15 minutes of the patch going public (once a fix is out you can compare the old and new code and work backwards to the bug, so the clock starts the second it ships). Gina Peter Banyard, one of the PHP core developers, said patching was the only real mitigation and that she sadly knew too much, which is a pretty scary thing to hear from someone who works on PHP lol.

I threw the timeline into a little video so its easier to follow.

the fix #

PHP ended up shipping about 25 minutes early, around 13:34 UTC.

the official PHP security advisory on php.net for CVE-2026-109618 and CVE-2026-109619

Source: php.net security advisory

Your PHP version Update to
8.5.x 8.5.12
8.4.x 8.4.27
8.3.x 8.3.36
8.2.x 8.2.35
8.1 and older no official release (see below)

If youre on 8.1 or older youre on an end of life version and the PHP project doesnt put out releases for those anymore. They did publish small source patches for 7.4, 8.0 and 8.1 anyway for people who compile PHP themselves, and some Linux distros backport fixes into their old packages. That helps a lot here because one Shodan count from the day before found about 884,000 servers advertising PHP 8.1 or older in their headers, 59% of all the ones that showed a version.

PHP says every installation serving web requests is affected, so PHP-FPM, Apache with mod_php, php-cgi, FrankenPHP and LiteSpeed. Apache with mod_php is the worst of them. One request from someone who isnt even logged in can set the whole thing off before the website runs a single line of its own code.

how the PHP bugs actually work #

Okay, technical part. Ill try to keep it readable.

Both of these are RCE bugs (remote code execution) and its the worst kind of bug you can have, someone on the internet gets your server to run whatever commands they want with the same permissions as the web server, so they can dump your database or skim card numbers off your checkout page, whatever they feel like.

diagram of a web request going from the internet to the web server to PHP setup to the app, with both PHP2Shell bugs inside the PHP setup step before the app runs

Before WordPress or Laravel or whatever you wrote sees a request, PHP sets it up. It parses form data and file uploads and handles session stuff, then cleans all of it up again after the request is done. Both bugs sit in that setup and cleanup code. Sansec pointed out that fixing your own app code cant help with this, and in the worst case your app hasnt even started yet when the attack lands.

bug 1: running out of memory at the worst time #

CVE-2026-109618, PHP calls it RCE via OOM corruption (OOM means out of memory).

PHP is written in C, and when it runs out of memory partway through something it bails using a C function called longjmp(). Think emergency exit. It teleports the program back to a spot it saved earlier and skips everything in between, which sometimes includes the rest of whatever data it was in the middle of building, and later the cleanup code comes along, finds that half built data and treats it like its fine.

Its easier to see in code so I wrote a tiny made up example that makes the same mistake (PHPs real code is a lot bigger and messier).

#include <setjmp.h>
#include <stdio.h>

typedef struct {
    int ready;
    char *name;
} Request;

static jmp_buf bailout;
static Request req; // global, like the state PHP keeps around

void setup_request (void) {
    req.ready = 1;       // mark it as ready...
    longjmp(bailout, 1); // ...then "run out of memory" and bail
    req.name = "hello";  // never runs
}

int main (void) {
    if (setjmp(bailout) == 0) {
        setup_request();
    }

    // the cleanup trusts the flag and uses the data
    if (req.ready) {
        printf("cleaning up: %s\n", req.name); // name was never set!
    }

    return 0;
}

setjmp saves the spot and longjmp jumps back to it. ready got set and name never did. I compiled it with -Wall -Wextra and gcc didnt warn about a thing, it printed cleaning up: (null) and exited like everything was normal. With PHP the half built thing is real request memory, and if an attacker can shape whats in it they can turn that into running their own code. It reminded me of my webcam ASCII art post where I spent ages making sure everything got released in the right order, except this cleanup code runs on millions of servers.

And the attacker doesnt have to get lucky with memory. According to the advisory a specially crafted upload can push PHP over its memory limit even though the request looks like a normal size. On mod_php that all happens during startup, before the website code runs. PHP confirmed a full working attack there with default settings. For PHP-FPM (what you usually get with nginx) they say its likely possible from reading the source but nobody has shown a complete attack for this one yet.

As for the fix, PHP doesnt use longjmp() for out of memory anymore, it waits for the next safe point and stops there cleanly, and if memory keeps climbing past a second higher limit it just kills the worker with _exit().

bug 2: leftovers from the last request #

CVE-2026-109619, RCE via stale global state (bear with me on this one, it needs some background).

A PHP server doesnt launch a new program for every visitor. It keeps some workers alive and each one handles requests back to back, like a cashier going through a line of customers (a cashier who sometimes forgets to clear the last guys receipt off the counter, which is basically the bug). Every request gets its own chunk of memory that gets thrown out when its done, but the worker also has some global variables that stick around between requests and a few of those point into the current requests memory, so theyre supposed to get wiped before that memory is thrown out.

Sometimes they dont get wiped. A fatal error at the wrong moment (running out of memory counts) can interrupt things before the reset happens, so the memory gets freed while the global still points at it. Next request lands on the same worker. Some code runs before PHP gets around to resetting, reads that old pointer and ends up using memory that belongs to something else now. Thats a use after free, probably the most classic C bug there is.

The advisory calls the request that leaves the stale pointer behind a producer and the later one that uses it a consumer. They confirmed two ways in, a PHP 8.5 feature called fatal_error_backtraces and session upload progress. That second one tracks how far along a file upload is, its on by default and your app doesnt even have to use sessions for it to be reachable. This bug works against both mod_php and PHP-FPM.

PHP even suggests leaving session upload progress off after you patch since more attackers are going to go looking for bugs in a feature barely anyone uses or tests (kinda funny to put that in an official advisory lol).

Four reporters are credited in the advisories and one of them is LCFR from Calif, the same name that was on the leaked screenshot.

what to do if you run PHP #

If you have PHP running anywhere (a VPS, a WordPress site, some Laravel side project, your homelab) check the version first.

php -v

You want 8.5.12, 8.4.27, 8.3.36 or 8.2.35 or newer depending on your branch. On a Linux server that usually just means running your distros package updates since the distros got the patch early, then restarting PHP-FPM or Apache so the old workers die off. Shared hosting is on your host, so check that they did it.

PHP lists some config settings that lower the risk (turning off session.upload_progress.enabled and restarting every worker is one of them) but they were really clear that only updating fixes it, so dont let a firewall rule or a config change make you feel safe. If you were getting PHP from the Remi repository, which is common on RHEL, Rocky and Alma, it had no update today and PHP told people to switch to distro packages or build from source. Any ancient PHP box that nobody is allowed to touch should come off the public internet until someone can update it.

For everyone who doesnt run servers theres nothing to install, this one is on the websites. I would be a bit more careful with "your account was compromised" emails for the next while though since phishing usually follows when sites get breached.

eMudhra: the private key that was literally 4 #

Completely different kind of disaster.

what a certificate authority even is #

The padlock in your browser shows up because the website handed your browser a certificate saying its really example.com. Anyone can generate a certificate though, so somebody trusted has to vouch for it. Certificate authorities (CAs) are the companies your browser and OS trust out of the box to do that, and they vouch for a site by signing its certificate with their private key. Basically the private key is the CAs master stamp.

diagram of the chain of trust: a root CA signs an intermediate CA which signs a website certificate, next to a long random 384 bit key compared to one of eMudhras real private keys, the number 4

Get the stamp and you can make certificates for any site you want, ie: your bank, and browsers would accept them. If youre also on the same network as your victim (public wifi, a hacked router) thats enough to read or mess with their "secure" traffic.

what happened #

eMudhra is a CA based in India. On Saturday Oct 17 at 20:06 UTC a researcher who only goes by Wayne reported to the browser makers that the private keys behind 8 of eMudhras intermediate certificates were compromised, and to prove it he signed the message "We have a problem here - Wayne" with every single one of the 8 keys. Iconic tbh.

Scott Helme dug into the certificates after that and it got even better. Well, worse. They were P-384 keys (a kind of elliptic curve key) and a P-384 private key is supposed to be a random 384 bit number, roughly 10^115 possibilities. All 8 of eMudhras were whole numbers under 256 and one of them was 4. Like the number 4. He pulled all 8 out of the public certificates in under a second on a laptop.

According to eMudhra the keys came from a key generation ceremony on April 30, 2025 using certified hardware security modules (tamper resistant boxes that pretty much exist to protect keys). Something went wrong in a step where the keys get wrapped and unwrapped, a second weak set got created next to the strong ones and the weak set is what got published to the browsers, where it sat for about 18 months.

how bad is it #

Mozilla blocked the certificates in Firefox under 3 hours after the report and nobody had to update or restart anything. Chrome blocked them the same day, Apple on Oct 19 and Microsoft on Oct 20, and eMudhra revoked them on Oct 18.

Chrome also went through Certificate Transparency, a public log that every trusted website certificate has to be recorded in, and found zero website certificates from the 6 website facing intermediates logged before the block. A certificate that isnt logged doesnt work in Chrome, so a forged one would have failed there anyway. eMudhra says only 1 of the 8 was ever used in production.

curl, Python, Node, Go, Java, Docker images and plenty of apps ship their own list of trusted CAs though, and Helme found a lot of them never check whether a certificate got revoked. In his tests they accepted a forged certificate for Stripes API. Not great if youre running a payment backend or a trading bot on that stuff (people browsing in Chrome were fine).

Fixes are coming out for Go (1.27.3 and 1.26.10), Pythons certifi (2026.10.19), Rusts webpki-roots (1.0.10) and Mozillas NSS (3.131.1), with Node still pending at the time of writing. If you maintain anything update the CA bundles and rebuild your containers. Cloudflare said in their write up that you shouldnt fix certificate errors by turning verification off, and yeah, if something starts throwing cert errors after an update please dont just slap verify=False on it and move on.

eMudhras stock dropped 20% today btw.

PingCAP: a month long visitor #

PingCAP makes TiDB, an open source distributed SQL database, and runs TiDB Cloud which is the hosted version.

Their incident report went up on Oct 19. Someone had stolen service account credentials (logins that programs use, kinda like a bot account) and used them to get into PingCAPs internal systems from September 9 all the way to October 7, so almost a month of someone just hanging around in there. PingCAP noticed on Oct 7. By Oct 14 they had shut every access path they could find and fixed four vulnerabilities that an outside security firm reported.

The attacker took TiDB Cloud account info. Names, emails, which orgs and projects people are in, cluster IDs and text and errors from the SQL editor. They also got business records (customer contacts, contracts, orders, pricing and billing settings), a table of TiDB Cloud API key values that were encrypted, and source code. PingCAP says theres no sign the API keys were decrypted or used and no sign the data people store in their TiDB databases was touched. A group called FulcrumSec claimed the attack but nobody has verified their numbers.

Everyone pastes junk into a SQL editor while debugging (passwords, customer emails, whatever) so if you ever did that in the TiDB Cloud editor I would assume its exposed.

PingCAP wants TiDB Cloud users to swap their API keys for new ones (make the new key, update whatever uses it, then revoke the old one) and delete any they dont use. Check your logs too. Be suspicious of emails from "PingCAP" for a while because the attackers have billing contacts and contract terms, so a fake invoice could look extremely real.

the rest of the week #

ConnectWise got hit by a supply chain attack. Their Cloud Backup app (it used to be SkyKick) connects to customers Microsoft 365 accounts, and somebody got their hands on the apps secret credential, which basically works as a key to every Microsoft 365 account the app is installed in. Huntress saw sign in attempts across almost 1,000 tenants with 300+ that looked successful and 162 confirmed so far. With that access the attacker could read and write mail and files and get past MFA. In some tenants they also planted extra credentials in other apps to get back in later, so just disabling the ConnectWise app doesnt clean it up. ConnectWise shut down a few of its services while they figure it out.

Microsoft broke its own record on Oct 13 with 1,413 vulnerabilities fixed in one Patch Tuesday, up from about 974 in September, which also beats their total for all of 2025. They credit their own AI tools for digging up old bugs in old code. One of the 1,413 (CVE-2026-96951) was already being used in attacks, its a Windows bug that removes the warning you get on files downloaded from the internet, so go update Windows if you havent this month.

Last one. NorForge, a security firm, found attackers using Cairn (an open source platform for running AI agents that people normally use for legit pen testing) against real companies, and some of them left their dashboards open for anyone to look at. The biggest group alone had over 1,100 attack projects going, mostly against online stores and payment systems, and roughly 10% of attempts worked. Reuters named John Deere and SharkNinja as victims and both say the damage was limited. Ive been testing how good these models are at code (see my Opus 5.5 vs Gemini 4 Argon comparison) and they really are good enough to run this kind of thing now. Leaving the dashboards public was a choice though lol.

my take #

Two of these (PingCAP and ConnectWise) were just stolen credentials, no clever exploit needed. eMudhra had all that fancy certified hardware and still ended up with a private key of 4 because one step in the ceremony broke lol. I dont really have a neat lesson from any of it other than update your stuff and guard your credentials.

Then theres the leak.. coordinated releases only work if everyone keeps quiet until the date, and one Hacker News post turned that into about 22 hours of the whole internet scrambling. That said PHP handled it really well, they moved the release up and still shipped early, and they even made patches for versions they officially dont support anymore. Mozilla also had eMudhra blocked within 3 hours on a Saturday.

Anyways, if you run PHP anywhere go run php -v right now.

resources #

PHP2Shell:

eMudhra:

PingCAP:

the rest:

< All posts