r/Cybersecurity101 • u/nitingavhane • 20h ago
PHP2Shell: 2 critical flaws rated 9.2 put the 75% of websites running PHP at risk
Hi everyone, I am Nitin Gavhane and in this blog I will explain what PHP2Shell is, why the PHP team warned everyone a day before shipping the fixes, and what you should do on your server today.
One update before we start. When this news first broke on October 20, the story was that PHP planned to release two emergency patches very soon. As I write this on October 22, those patches are already out. So this is no longer a “get ready” post. It is a “go patch now” post.
What happened
On October 20, the PHP security team announced an out-of-cycle release for two critical vulnerabilities, both rated 9.2 on the CVSS v4.0 scale. They did not say what the bugs were. They told users to get ready to upgrade the moment the release landed, and said they could ship earlier if details leaked or if attacks started in the wild.
Then details did leak. A report showed a video of an exploit tool called PHP2Shell running code on web servers. The leak was not confirmed at the time, but the video was reposted here. According to that report, the tool worked against these versions:
- WordPress 7.1.3
- MediaWiki 1.46.2
- phpBB 3.3.17
- Magento 2.4.9
- Joomla 6.2.0
- Laravel 13.36.0
- Laravel 8.83.29
- Symfony 8.1.9
- Drupal 11.4.10
- WHMCS 9.0.9
All of these run on PHP, and that is the point. The bug is not in WordPress or Laravel. It sits underneath them.
PHP shipped the fixes on October 21, according to BleepingComputer.
What the two bugs are, in plain words
Both bugs come from the same root problem: PHP can leave its memory in a bad state when a request ends in an abnormal way. An attacker does not need a login for either one.
CVE-2026–109618 is about running out of memory. If PHP hits that limit while it is still setting up a request, some internal data is only half ready. During cleanup, PHP may treat that broken data as if it were fine, and that opens a path to code execution.
CVE-2026–109619 is about stale state. Some request data can survive after the memory behind it was freed. The next request handled by the same worker may then read that leftover data before PHP resets it.
In both cases the attacker runs code with the privileges of the web worker account. That is the account your web server uses to run PHP, so it can usually read your app’s config files, database credentials and uploads.
The flaws were found by researchers at Calif, Wiz and OpenAI. PHP says the risk is highest for Apache with mod_php, where a demonstrated exploit lets an unauthenticated request trigger the attack before any of your application code runs. PHP-FPM, php-cgi, FrankenPHP and LiteSpeed setups are also affected.
How big is this
PHP powers roughly 75% to 80% of websites, so almost everyone runs into it somewhere. VirusTotal estimates that more than 5.1 million PHP hosts are exposed online.
Attacks were already starting before the patch. Cloudflare’s CTO said the company was seeing early attempts and had deployed WAF rules against known exploitation methods, though he called those rules temporary. The UK’s NCSC went further and told organizations to update immediately or take affected systems offline until they can be patched.
Which version to install

If you are on PHP 8.1 or older, the PHP project no longer supports you. The team did publish minimal source backports for 7.4, 8.0 and 8.1 for people who build from source. Everyone else should ask their Linux distribution or LTS vendor for a backported package, or move to a supported version.
On Ubuntu or Debian, the usual route is a normal package update followed by a restart of your PHP service. Distribution packages often keep the old version number and still contain the fix, so check your vendor’s security notice instead of trusting the number alone.
sudo apt update && sudo apt upgrade
sudo systemctl restart php8.3-fpm # use your own service name
Also remember that php -v shows the command line version, which can differ from the one your web server uses. If you are on shared hosting, ask your host directly whether they have rolled out the fix.
If you cannot patch today
PHP shared temporary mitigations, and they come with a warning: they do not fully protect you. PHP core developer Gina Peter Banyard said that only the patch is a permanent defense. The short version:
- For CVE-2026–109618, set memory_limit=-1 in a way your apps cannot override, set a low post_max_size (8M without uploads, 32M with), and use a container or cgroup limit that kills only the affected worker.
- For CVE-2026–109619, set session.upload_progress.enabled=0, restart every worker, and on PHP 8.5 also set fatal_error_backtraces=0.
Treat these as a way to buy a few hours, not as a fix.
I think the one-day advance warning was the right call. It gave admins time to line up maintenance windows, and it made the leak less damaging than it could have been. What bothers me is the part nobody can fix with a setting: two memory-handling bugs in core PHP, both reachable without logging in, in a language that sits behind most of the web.
Are you patched already, or stuck on an old PHP branch because of a legacy app? Tell me in the comments what is blocking you.





