What happened
On October 21, 2026, the PHP team released security updates for two critical vulnerabilities in the language core, nicknamed PHP2Shell. Their details had leaked the day before on the Hacker News forum, ahead of the planned disclosure date. CISA published an alert the same day, as did the UK's NCSC.
| Identifier | Severity | Nature | |---|---|---| | CVE-2026-109618 (GHSA-w8hw-w9fx-j79w) | Critical, CVSS v4 9.2 | Memory corruption while handling an out-of-memory condition | | CVE-2026-109619 (GHSA-6wmf-4rv5-p3rp) | Critical, CVSS v4 9.2 | Use-after-free: internal state survives from one request to the next on the same worker |
Both allow unauthenticated remote code execution with the privileges of the web process (www-data, apache, nginx…).
This is not a WordPress, Laravel or Symfony flaw: it is the PHP engine itself. Your code can be flawless and the server is still exposed until PHP is updated.
1. Am I affected?
Yes, if you serve web requests with PHP and your version is older than the fixed releases:
| Branch | Fixed version | |---|---| | 8.5 | 8.5.12 | | 8.4 | 8.4.27 | | 8.3 | 8.3.36 | | 8.2 | 8.2.35 | | 8.1 and older | No longer maintained: limited backports published for 7.4, 8.0 and 8.1, otherwise migrate |
Every web execution mode is affected: PHP-FPM, Apache mod_php, php-cgi, FrankenPHP, LiteSpeed. The highest risk is with mod_php, where the attack can succeed before any application code runs.
To check the version:
php -v
php -r 'echo PHP_VERSION, PHP_EOL;'
Be careful: the command-line version is not always the one used by the web server. To be sure, check the package actually loaded:
# Debian / Ubuntu
dpkg -l | grep -E 'php[0-9.]*-(fpm|cgi)|libapache2-mod-php'
# RHEL / Rocky / Alma
rpm -qa | grep -E '^php'
# Docker: the base image version
docker run --rm your-image php -v
Don't forget hidden PHP: Docker images, appliances, admin panels, monitoring tools, NAS devices… CISA stresses this point.
2. Fix it: update PHP
Updating is the only complete fix. Rapid7 recommends doing it as an emergency, outside your usual patch cycle.
Debian / Ubuntu server
sudo apt update
sudo apt install --only-upgrade 'php*'
sudo systemctl restart php8.3-fpm # adjust to your version
sudo systemctl restart apache2 # if using mod_php
Distributions and long-term support vendors received the fixes in advance: they may ship a patched package whose version number still looks old. Check your distribution's advisory rather than relying on php -v alone.
Note: PHP warned that the Remi repository (rpms.remirepo.net) would not be updated on October 21. Use your distribution's packages or build from source.
Docker
# Pin a fixed version, never an old floating tag
FROM php:8.3.36-fpm
docker build --pull -t my-app .
docker compose up -d --force-recreate
Rebuilding the image is not enough: you must redeploy and check that the old containers were actually replaced.
Shared hosting
On shared hosting, PHP is managed by the provider. Check the selected version in your control panel, move to 8.2 at minimum, and read your provider's announcements about the rollout of the fixes.
PHP 8.1 or older
There will be no standard fix. Only partial source backports were published for 7.4, 8.0 and 8.1. CISA recommends taking offline systems that can't be updated. Now is the time to migrate to PHP 8.3 or 8.4.
3. Until you can patch: reduce exposure
These measures lower the risk without removing it. They must be applied at server level (php.ini, FPM pool or Apache configuration), because ini_set() or a .user.ini file takes effect too late.
; Blocks the confirmed path through session upload progress (CVE-2026-109619)
session.upload_progress.enabled = 0
; PHP 8.5 only: blocks the confirmed path through fatal error backtraces
fatal_error_backtraces = 0
; Limit request size
post_max_size = 8M ; 32M if the application handles uploads
upload_max_filesize = 4M ; always below post_max_size
Restart all PHP workers after the change.
On the web server or WAF side:
- Limit request body size (
client_max_body_sizeon Nginx,LimitRequestBodyon Apache). - Block
multipart/form-datarequests on routes that don't accept uploads: the first flaw is notably exploited through crafted multipart forms. - Enable WAF rules for file uploads, first in monitoring mode, then in blocking mode.
The PHP advisory also suggests forcing memory_limit=-1 to avoid the out-of-memory path. It is a delicate measure: without a memory cap, a single request can saturate the server. Only apply it with strict request size limits upstream, and never as a substitute for updating.
4. Check that you weren't compromised
No indicators of compromise have been published yet, and the absence of traces in the logs proves nothing. Several proofs of concept are circulating: for now they only work on specific combinations of version, OS and web server, but a more reliable exploit is expected.
What to watch for:
- A PHP process (
php-fpm,apache2,httpd) spawning a shell (sh,bash) or tools such ascurl,wget,nc. - Recent PHP files in upload or cache folders, or at the web root.
- Unusual outbound connections from the web server.
- Spikes in
Allowed memory size exhaustederrors or worker crashes (segfault) in the logs.
# Unexpected child processes of PHP workers
ps -ef --forest | grep -A3 -E 'php-fpm|apache2|httpd'
# PHP files modified in the last 7 days under the web root
find /var/www -name '*.php' -mtime -7 -ls
# Worker crashes
journalctl -u 'php*-fpm' --since '2026-10-15' | grep -iE 'segfault|SIGSEGV|exited on signal'
If in doubt: isolate the server, keep the logs, reinstall from a clean image and rotate every secret the application can reach (database, API keys, .env).
Checklist
- [ ] Inventory of every system running PHP, including in Docker images and appliances
- [ ] PHP at 8.5.12 / 8.4.27 / 8.3.36 / 8.2.35 or a patched distribution package
- [ ] PHP-FPM and Apache workers restarted, containers recreated
- [ ] PHP 8.1 and older migrated or taken offline
- [ ] In the meantime:
session.upload_progress.enabled=0, request size limited, multipart blocked where it isn't needed - [ ] Hunt for suspicious processes, recent PHP files and worker crashes
Sources: CISA — Critical Vulnerabilities in PHP Require Immediate Patching · Rapid7 — CVE-2026-109618 and CVE-2026-109619 · Google Cloud — Responding to core PHP vulnerabilities · NCSC — Critical security issue affecting PHP