PHP2Shell (CVE-2026-109618, CVE-2026-109619): What to Patch
TL;DR: CVE-2026-109618 and CVE-2026-109619, known as PHP2Shell,1 are two critical bugs in the PHP core that can allow unauthenticated remote code execution. Both are rated 9.2 under CVSS v4.0.2 The PHP project fixed them on 21 October 2026 in PHP 8.5.12, 8.4.27, 8.3.36 and 8.2.35, and says only the update is a complete fix.2 Amazon recorded a first exploitation attempt against its honeypots on 17 October, four days before the fixed releases.1
This is for you if you run PHP that serves web requests, through Apache with mod_php, PHP-FPM, php-cgi, FrankenPHP or LiteSpeed, and must decide what to patch first. Skip this if you run no PHP.
Key points
- mod_php carries the highest risk: the exploit runs before any application code.2
- PHP 8.1 and older get no fixed release from the PHP project.2
- Even after you patch, the PHP project suggests
session.upload_progress.enabled=0"until the next regular bugfix release".2
How do CVE-2026-109618 and CVE-2026-109619 work?
Both bugs make PHP act on request memory in an invalid state. In CVE-2026-109618, PHP runs out of memory while request data is "only partially initialized". The PHP project adds that "Request cleanup may then treat the invalid data as valid".2
CVE-2026-109619 is a use after free: state from one request survives after its memory is freed, and a later request on the same worker uses it.3 The PHP project confirmed two triggers for it: session upload progress, and fatal error backtraces on PHP 8.5.3
Both advisories give the vector CVSS:4.0/AV:N/AC:H/AT:P/PR:N/UI:N/VC:H/VI:H/VA:H/SC:N/SI:N/SA:N. It describes a network attack that needs neither privileges nor user interaction, with high complexity and conditions in the target's deployment (AT:P). For CVE-2026-109619, the confirmed impact is "unauthenticated heap use-after-free, memory disclosure and remote code execution", with code running as the web worker.3
Which PHP versions are affected, and which fix them?
The advisories mark every release below the fixed version of each branch as vulnerable.23
| Branch | Fixed release | Note |
|---|---|---|
| 8.6 (release candidates) | 8.6.0 RC4 | Test build, not for production |
| 8.5 | 8.5.12 | |
| 8.4 | 8.4.27 | |
| 8.3 | 8.3.36 | |
| 8.2 | 8.2.35 | End of life on 31 December 2026 |
| 8.1 and older | None from the PHP project | Minimal source backports for 7.4, 8.0 and 8.1 from the PHP security team, or a vendor backport |
How do you check which PHP build a server runs?
php -v shows only the command-line binary. To see the packages that serve web requests, including mod_php, ask the package manager:
dpkg -l | grep -E 'libapache2-mod-php|php[0-9.]*-fpm'
rpm -qa 'php*'
Linux distributions received the patches in advance.2 Vendor backports can keep an older version number, so look for both CVE IDs in the package changelog or vendor advisory. After installing the fix, restart Apache, PHP-FPM and any long-running PHP workers, which keep the old code until then.
What should you patch first?
Patch internet-facing servers on Apache with mod_php first. The PHP project names mod_php as the highest risk, because its demonstrated exploit runs "before any application code runs".2 Then patch other internet-facing PHP servers. Internal servers come last, but the PHP project puts "all PHP installations serving web requests" at risk.2 The advisories report where code execution was validated:3
| Server setup | CVE-2026-109618 | CVE-2026-109619 |
|---|---|---|
| Apache with mod_php | Validated, with default PHP limits | Validated, both triggers |
| PHP-FPM | Susceptible, no complete exploit | Validated, session trigger |
| FrankenPHP | "Likely susceptible" | Not validated, not ruled out |
| LiteSpeed | Application-specific exploits "likely but unvalidated" | Conditional candidate |
On PHP-FPM, the session exploit needs an application operation that hits a fatal error after storing request state, then an upload-progress request on the same worker.3
What can you do if you cannot patch today?
The three settings below narrow the confirmed attack paths, but the PHP project warns that they "reduce exposure to specific attack paths but do not make an installation safe."2
| Setting | What it blocks | The PHP project's caveat |
|---|---|---|
memory_limit=-1, set so applications can't override it (for example php_admin_value), then restart every worker | The controllable memory-limit failure in CVE-2026-109618 | "an underlying allocation failure can still reach the vulnerable path" |
session.upload_progress.enabled=0, then restart every worker | The confirmed session paths of CVE-2026-109619 | "not other variants" |
fatal_error_backtraces=0 on PHP 8.5, then restart every worker | The fatal backtrace path of CVE-2026-109619 | "the confirmed fatal backtrace path only" |
If you set memory_limit=-1, cap memory with a container or cgroup limit instead, preferably one that kills only the affected worker, and never with RLIMIT_AS or RLIMIT_DATA.2
The session setting must apply before PHP parses the request, so set it in php.ini, the FPM pool or the server configuration, not with ini_set() or .user.ini. The PHP project lists more measures. Set a low post_max_size (8M, or 32M with file uploads), add request limits at the web server or proxy, and remove invalid or deprecated per-request settings that emit diagnostics before initialization. It advises fixing attacker-reachable fatal errors and execution timeouts too.2 Amazon also suggests blocking multipart file uploads where the application can work without them.1
The advice to keep upload progress off after patching comes from a 23 October note on CVE-2026-115560, a rarer path. It says: "Applications that never change the serialize handler at runtime can keep the feature enabled".2
Is PHP2Shell exploited, and what should you search for?
Amazon reports exploitation attempts against its honeypots. The first came on 17 October, and more followed on 21 October from 02:00 UTC, twelve hours before the fixed releases. Amazon says "it's unclear if any of these attempts would have succeeded in real-world systems", but also that PHP2Shell now sees "broad exploitation attempts in the wild".1
Amazon advises searching from 17 October, not 21 October.1 It suggests three checks:
- POST requests with the
PHP_SESSION_UPLOAD_PROGRESSstring in form uploads - Unexpected process execution or file changes on web application servers
- Traffic from the six addresses below
# IP address First seen by Amazon
103.216.220.92 17 Oct 2026
31.223.184.166 21 Oct 2026
37.19.200.5 21 Oct 2026
134.209.159.64 21 Oct 2026
103.114.163.188 21 Oct 2026
95.217.98.37 21 Oct 2026
Amazon notes that the list includes shared anonymization infrastructure, so investigate a match rather than block it.1 Searching for PHP_SESSION_UPLOAD_PROGRESS needs logs that include request bodies.
The CVE-2026-109619 advisory also asks you to review "Apache, PHP-FPM, reverse proxy and service logs" for fatal errors and Maximum execution time exceeded. These point to exposure: a fatal error or timeout opens the CVE-2026-109619 path, so fix their cause. The advisory warns that "absence of an error in logs is not proof of safety". Because CVE-2026-109619 can also disclose memory, a clean search does not rule out leaked secrets.3
How Haxset can help
Haxset's AI-Driven ASM tracks your internet-facing hosts and reports what changed between runs, and Agentic Pentesting runs autonomous penetration tests of your web applications. Haxset does not keep the prompts its AI models process and does not train models on them. It stores only scan metadata and scan results. To find out more, contact us.
References
-
CJ Moses, Amazon, Amazon Threat Intelligence identifies PHP2Shell exploitation prior to public disclosure in MadPot, AWS Security Blog, 21 October 2026. ↩ ↩2 ↩3 ↩4 ↩5 ↩6
-
PHP project, News archive 2026, php.net: "Upcoming Critical PHP Security Release" (20 October 2026), "Security advisory: Critical remote code execution vulnerabilities, update now", the PHP 8.5.12, 8.4.27, 8.3.36 and 8.2.35 release announcements and "PHP 8.6.0 RC4 available for testing" (21 October 2026), and Informational advisory: Session upload progress (23 October 2026). ↩ ↩2 ↩3 ↩4 ↩5 ↩6 ↩7 ↩8 ↩9 ↩10 ↩11 ↩12 ↩13 ↩14
-
PHP project, GitHub security advisories GHSA-w8hw-w9fx-j79w: RCE via OOM corruption (CVE-2026-109618) and GHSA-6wmf-4rv5-p3rp: RCE via stale global state (CVE-2026-109619), 21 October 2026. ↩ ↩2 ↩3 ↩4 ↩5 ↩6 ↩7
Interested in how this research applies to your organization?
Get in touch
