For people who run servers and websites
PHP2Shell (CVE-2026-109618 and CVE-2026-109619): how it works, who is exposed and how to mitigate it
A technical analysis of the two remote code execution flaws in PHP: the mechanism, the affected versions and configurations, how to confirm whether a server is exposed, and the official mitigations.
The two flaws in a few words
Both come from the same pattern: PHP stops a request halfway (because it ran out of memory or hit a fatal error) and leaves behind internal state that the clean-up code, or the next request, treats as valid[2].
- CVE-2026-109618 (out-of-memory corruption). When PHP runs out of memory while preparing a request, it aborts with
longjmp(). In some contexts that leaves request memory uninitialised, and the end-of-request clean-up reads it or makes decisions based on it[2]. - CVE-2026-109619 (stale global state). A fatal error also aborts with
longjmp(). In some contexts, global state keeps pointing at memory already freed at the end of the request, and the next request handled by the same worker acts on it: a use-after-free[1][2].
Both are classified as CWE-824, with a CVSS v4.0 score of 9.2[2]. Three of the five demonstrated techniques use the session.upload_progress feature as a remote trigger, and one of them exposes around 67 KB of process memory[2].
Why “my application doesn’t use sessions” does not protect you
The vulnerable processing happens before your code runs: it is PHP handling the request body and upload progress, not the application[2]. So the risk does not depend on whether the application uses sessions or uploads, and it is higher on Apache with mod_php, where the attack can succeed before the application[1].
Affected: every PHP installation that serves web requests, whether PHP-FPM, Apache mod_php, php-cgi, LiteSpeed or FrankenPHP[1]. Running PHP in containers or with cgroup memory limits is not enough as a mitigation[3].
Affected and fixed versions
| Branch | Affected | Fixed |
|---|---|---|
| 8.5 | < 8.5.12 | 8.5.12 |
| 8.4 | < 8.4.27 | 8.4.27 |
| 8.3 | < 8.3.36 | 8.3.36 |
| 8.2 | < 8.2.35 | 8.2.35 |
| 7.4, 8.0, 8.1 | All | No official release: distribution/LTS package or minimal source fixes |
| 7.3 and earlier | All | No fix: move to a supported branch |
Source: watchTowr[1]. As for the oldest affected version, Imperva states that the flaws affect versions since PHP 5.4.0, without each having been tested individually[2]; Tek Notícias notes that PHP 5.2 is not affected, although it has had no security fixes since 2011[5].
Linux distribution packages (Debian, Ubuntu, RHEL and derivatives) apply fixes without changing the main version number. On a server with distribution packages, confirm the package version against the distribution’s own security advisory, not just the number PHP announces.
How to confirm whether a server is exposed
- Check the version that serves requests, not the command-line one.
php -vshows the PHP CLI, which may not be the same binary as PHP-FPM or mod_php. Confirm the version of each pool or virtual host, for example with a temporary, protectedphpinfo()that you delete straight afterwards. - Confirm where the package comes from.
# Debian / Ubuntu dpkg -l | grep -E '^ii +php' # RHEL / AlmaLinux / Rocky rpm -qa | grep -i php - Confirm that the running process is the new one. After updating, restart and check when the processes started:
systemctl restart php8.3-fpm # or apache2 / httpd with mod_php ps -o pid,lstart,cmd -C php-fpm8.3 - Don’t forget what is out of sight: subdomains, staging environments, shops and customer areas on their own servers. In Portugal, almost all the higher-education and science hostnames on affected, unpatched servers were subdomains[5].
Mitigations while you cannot update
No configuration mitigates it completely, according to the PHP project[1]. These measures reduce exposure and buy time; the fix is the update.
- Disable session upload progress at the level of
php.ini, the FPM pool or the server configuration, applied before the request is processed.ini_set()in the application and.user.iniare too late[3].session.upload_progress.enabled = 0 - Limit the size and shape of requests in front of PHP: body size, number of fields and multipart parts, headers per part and nesting depth. If the application does not accept multipart, block it before it reaches PHP[3]. For uploads, Rapid7 suggests a
post_max_sizeof 8M (or 32M if needed), withupload_max_filesizebelow that[3]. - Consider disabling OPcache (
opcache.enable = 0), after testing the performance impact[2]. - On PHP 8.5, disable fatal error backtraces (
fatal_error_backtraces = 0) at the administrative level[3]. - Restrict internet access to systems that cannot be updated straight away[1], or, if even that cannot be done in time, consider taking them offline until they are mitigated[4].
Restart every worker after any change, and confirm that no later configuration puts the old values back[3].
Signs of exploitation to look for
Imperva suggests watching for[2]:
- very large multipart requests, or ones with an abnormal number of fields;
- anomalous session parameters and unusually large
PHPSESSIDvalues; - PHP memory-exhausted errors and worker crashes.
If you suspect an intrusion: unexpected child processes, changes to application files, persistence mechanisms, unusual outbound connections and exposed credentials[2]. An absence of log entries does not prove the server is clean[3].
Timeline
- 20 October 2026: the details start circulating on social media ahead of the planned disclosure date (22 October); watchTowr publicly confirms that the flaws are real[1].
- 21 October, 14:00 UTC: the PHP project publishes the fixes. Active exploitation starts being observed[1].
- 22 October: the NCSC asks organisations to act immediately[4]. The flaws are not yet in CISA’s KEV catalogue[1].
Why we should expect more flaws like these
The flaws were found by researchers at Calif, with Wiz, OpenAI and Quarkslab[2], in work that used artificial intelligence to analyse PHP’s code[6]. Use-after-free bugs depend on the program passing through two different states over time, something classic fuzzing tools are poor at finding and that AI-assisted analysis is making easier to look for. With many teams now pointing these tools at old, widely used code, it is prudent to treat this episode as the first of several and to keep PHP on a supported branch.
Frequently asked questions
Which PHP versions fix PHP2Shell?
PHP 8.2.35, 8.3.36, 8.4.27 and 8.5.12, released on 21 October 2026. PHP 7.4, 8.0 and 8.1 have no official release: they need a patched package from the distribution or provider, or the minimal source fixes published by the PHP project. PHP 7.3 and earlier have no fix.
Is updating the package enough?
No. PHP processes that are already running keep the old code in memory. You have to restart PHP-FPM, Apache (for mod_php) or any long-running PHP worker after updating.
Is there a configuration change that fixes it without updating?
Not fully. The PHP project states that no configuration change mitigates the flaws completely. Disabling session.upload_progress and restricting the size and shape of requests reduces exposure, but it is a stopgap until the update.
Does hiding the PHP version protect the server?
No. The flaw is exploited through normal request processing and does not depend on the attacker knowing the version. Hiding the X-Powered-By header only makes checking harder, including your own checks.
Is the flaw already being exploited?
Yes. watchTowr confirms active exploitation since 21 October 2026, seen in its honeypot network. As of 22 October, neither flaw was yet in CISA’s KEV catalogue.
Sources
- PHP2Shell FAQ: CVE-2026-109618 & CVE-2026-109619 Fixes (watchTowr)
- PHP2Shell: When PHP Runs Out of Memory at the Wrong Moment (Imperva)
- CVE-2026-109618 and CVE-2026-109619: Critical Unauthenticated Remote Code Execution in PHP (Rapid7)
- Critical security issue affecting PHP (NCSC, UK)
- PHP2Shell: universidades, câmaras e Estado com servidores em versões (ainda) sem correção (João Tomé) (Tek Notícias)
- O que é a PHP? Falha na programação interrompeu sites em todo o mundo (RTP)
Tell us which site. We'll tell you what to do.
Asking commits you to nothing: we reply first, and only go ahead with your agreement.
- 1We reply the same working dayWe confirm what you need and arrange the diagnosis.
- 2Full diagnosis: €150 + VATOn the server, with what we found and a fixed price for the fix.
- 3If you go ahead, the €150 is deductedYou only pay the difference.