On 21 October 2026, the PHP project released PHP 8.5.12, 8.4.27, 8.3.36 and 8.2.35 to fix two critical vulnerabilities, now widely called PHP2Shell. Both let an attacker run code on a server without logging in. Because the bugs are in PHP itself, not in WordPress, Drupal or any other application, they reach almost every website that runs PHP.
This guide explains what happened in plain terms, then walks through checking and fixing a server. If you run a WordPress site on hosting and just want to know whether you need to do anything, read PHP2Shell and WordPress: do you need to do anything? instead.
The short version: update PHP to the fixed release for your branch, then restart every PHP process. The PHP project is clear that there is no complete workaround: “updating is the only safe choice.”
What happened
PHP’s advisory describes two separate bugs, each rated 9.2 out of 10 (CVSS v4.0):
- CVE-2026-109618, “RCE via OOM corruption”. When PHP runs out of memory at the wrong moment, it can be interrupted while internal request data is only half set up. The cleanup that follows treats that broken data as valid, which an attacker can turn into code execution.
- CVE-2026-109619, “RCE via stale global state”. Some internal state from one request can survive after its memory has been freed. A later request handled by the same PHP worker can then use it before it is reset. The PHP advisory also lists memory disclosure as an impact.
Neither needs a login or any special plugin. Risk is highest on Apache with mod_php, where the PHP Foundation says an unauthenticated request can trigger the out-of-memory bug before any application code runs. Remote code execution was also confirmed on PHP-FPM, through code paths in real applications. Researchers demonstrated attacks against standard WordPress, Drupal and Joomla setups.
The CVE numbers leaked a day before the planned release, so the PHP project moved the release forward to 21 October at 14:00 UTC. Amazon’s threat intelligence team reported exploitation attempts from 17 October, four days before the fix was public. Since then, several security vendors and Singapore’s Cyber Security Agency have reported widespread attempts.
Which versions are affected
| PHP branch | Fixed in | Notes |
|---|---|---|
| 8.5 | 8.5.12 | |
| 8.4 | 8.4.27 | |
| 8.3 | 8.3.36 | |
| 8.2 | 8.2.35 | 8.2 stops receiving security fixes on 31 December 2026 |
| 8.1, 8.0, 7.4 | No official release | The PHP security team published minimal source backports; some Linux distributions and LTS vendors ship patched packages |
| 7.3 and older | No fix | End of life |
Anything older than the fixed version on its branch is affected. According to the researchers’ write-up, the vulnerable code path goes back as far as PHP 5.4.
How to check whether you’re patched
Start with the version number:
php -vOn a web server, the PHP that serves pages can differ from the command-line one. Check the version Site Health or phpinfo() reports for the site itself.
A lower number doesn’t always mean you’re exposed. Linux distributions often backport security fixes without changing the version, so Ubuntu, Debian, Red Hat and CloudLinux packages can be patched while still showing an older number. On those systems, check the package changelog for the CVE:
# Debian / Ubuntu (adjust the package name to your PHP version)zgrep -m1 CVE-2026-109618 /usr/share/doc/php8.3-common/changelog.Debian.gz
# Red Hat, AlmaLinux, Rocky, CloudLinuxrpm -q --changelog php-common | grep -m1 CVE-2026-109618If the CVE appears, that package contains the fix. If it doesn’t, update.
How to fix it
On hosting where you don’t manage the server, the host patches PHP. Confirm with them that the 21 October fixes are applied. If your site runs PHP 8.1 or older, switch to a supported version in your control panel.
On your own server, install your distribution’s updated packages:
# Debian / Ubuntusudo apt updatesudo apt install --only-upgrade 'php*'
# Red Hat, AlmaLinux, Rockysudo dnf upgrade 'php*'With Docker, pull the current official image for your branch (for example php:8.4), rebuild and redeploy. The official images get no fix for 8.1 or older.
On Windows, download the new build for your branch from windows.php.net.
Then restart every PHP process. This is the step people skip. A running PHP-FPM pool or Apache worker keeps the old, vulnerable code in memory until it restarts:
sudo systemctl restart php8.3-fpm # each PHP-FPM version you runsudo systemctl restart apache2 # or httpd, if you use mod_phpCheck the version again afterwards. Don’t forget staging sites, old subdomains and tools that bundle their own PHP: an attacker only needs one of them.
If you can’t update today
The PHP project lists settings that reduce exposure to the known attack paths. In its words, they “do not make an installation safe”, so treat them as a bridge to the update, not a replacement.
Set them in php.ini, the PHP-FPM pool or the server configuration, not with ini_set() or a .user.ini file, and restart every worker afterwards:
; CVE-2026-109618memory_limit = -1 ; set with php_admin_value so applications can't override itpost_max_size = 8M ; 32M if the site needs file uploadsupload_max_filesize = 6M ; keep it below post_max_size
; CVE-2026-109619session.upload_progress.enabled = 0fatal_error_backtraces = 0 ; PHP 8.5 onlyTwo warnings from the advisory: don’t replace the memory limit with RLIMIT_AS or RLIMIT_DATA, because they can trigger the very allocation failure the attack relies on. If you need a memory ceiling, use a container or cgroup limit.
If your site sits behind Cloudflare, its firewall rules for these attacks are on for every plan, including Free. Cloudflare calls them a stopgap: they only see traffic that goes through Cloudflare. For a high-risk site you can’t patch soon, maintenance mode is the safer choice.
On 23 October, the PHP project added one more note: keep session.upload_progress.enabled=0 until the next regular release, which fixes a related, much less likely variant.
Check whether anyone got in
Exploitation started before the fix was public, so look back to 17 October. Warning signs include:
- unusual multipart (file upload) requests followed by memory-limit errors or bursts of HTTP 500 responses
- unexpectedly large or malformed
PHPSESSIDcookies - PHP workers restarting for no clear reason
- files you didn’t create in uploads folders, or new admin accounts
None of these prove a break-in, and their absence doesn’t prove you’re clean. If anything looks wrong, treat the server as compromised. Restore from a backup taken before 17 October where you can, and change the passwords and keys it holds: database passwords, API keys, and the WordPress salts in wp-config.php.
Running PHP 8.1 or older?
This is the moment to move. PHP 8.1 and older no longer get fixes from the PHP project, and 8.2 stops receiving them at the end of 2026, so 8.3 or newer buys you the most time.
Take a full backup first, try the new version on a staging copy if you have one, and check the pages that matter: checkout, contact forms, logins. When a PHP switch breaks something, it’s almost always one plugin or theme that wasn’t ready for the newer version. Find out which one before rolling PHP back. If you do roll back, it should only be for a moment.
Timeline
- 17 October: first exploitation attempts observed by Amazon’s threat intelligence team.
- 20 October: the CVE numbers leak; the PHP project announces a release for the next day.
- 21 October, 14:00 UTC: PHP 8.5.12, 8.4.27, 8.3.36 and 8.2.35 released, with source backports for 7.4, 8.0 and 8.1.
- 23 October: follow-up advisory: keep session upload progress off until the next regular release.