cve

PHP2Shell CVE-2026-109618/109619: PoC, Attack, Fix & Defense

PHP2Shell CVE-2026-109618/109619: PoC, Attack, Fix & Defense

PHP2Shell: RCE vulnerabilities CVE-2026-109618 and CVE-2026-109619. Attack analysis, Point of View (POC), fixed PHP versions, exposure assessment, and mitigations.

  • Posted on 2026-10-26
  • Reading time: 11 min

PHP2Shell: CVE-2026-109618 and CVE-2026-109619, the two RCEs in PHP core #

On October 20, 2026, the PHP team announced an out-of-cycle security release for the following day; on October 21, at 2:00 PM UTC, the fixed builds were released. According to ServiceNow , details of the flaws were circulating online as early as October 20 before their disclosure. The two flaws, dubbed PHP14Shell , are CVE-2026-109618 and CVE-2026-109619 : both CVSS v4.0 9.2 (Critical) , both remotely accessible, without authentication.

These aren't framework or plugin bugs. They're in the engine that runs the code, so they affect WordPress, Laravel, Drupal, custom applications, and anything else that runs on PHP.

In this article, we'll look at what happens inside PHP, why error handling becomes code execution, how to determine if you're exposed, how to detect attempts, and how to mitigate. This is an analysis for research and defense: you won't find a working exploit here, and there's a reason we'll explain below.

PHP2Shell in brief #

PHP2Shell is the name associated with two unauthenticated RCE vulnerabilities in PHP core: CVE-2026-109618 and CVE-2026-109619. The fixed versions are PHP 8.5.12, 8.4.27, 8.3.36, and 8.2.35. The fix requires updating the runtime and restarting the processes using it. The configuration mitigations only reduce specific attack paths.

questionsResponse
What is PHP2Shell?Two RCE vulnerabilities in the PHP runtime
Which versions fix the problem?8.5.12, 8.4.27, 8.3.36, 8.2.35
Is WordPress involved?Yes, if it runs on a vulnerable PHP runtime
Is it enough to disable PHP errors?No, it does not correct the cause
Is a WAF enough?No, it does not replace the update
How do I check my exposure?Check the runtime used by the web server, not only php -v

Updated October 26, 2026: CVE-2026-115560 #

On October 23, PHP published an informational advisory about an additional vulnerability, CVE-2026-115560 , separate from the two in this article and not covered by the October 21 releases.

According to the PHP team it can only occur with an unusual combination of configuration and code: the application sets session.serialize_handler su php_binary o php_serialize, then changes it at runtime to php with ini_set() prima di session_start(), with session upload progress still active.

The mitigation indicated is session.upload_progress.enabled=0 until the next regular release, when the full advisory will be published. In practice: even after updating to the October 21st versions, keep upload progress turned off.

What are CVE-2026-109618 and CVE-2026-109619? #

These are two distinct bugs, with two separate identifiers, but stemming from the same root cause. Both are classified as use-after-free (CWE-416) and related to a corrupted or unreset state (CWE-824).

CVE-2026-109618CVE-2026-109619
Short nameRCE via OOM corruptionRCE via stale global state
TypeUse-after-free / uninitialized memoryUse-after-free / global state obsolete
When it manifestsIn itself requestIn a request next one on the same worker
StrongNot requiredNot required
CVSS v4.09.29.2

The corrected versions are 8.2.35, 8.3.36, 8.4.27, and 8.5.12 . Branches 8.1 and earlier are end-of-life and do not receive regular updates from the PHP project. However, the team has released minimal source backports for PHP 7.4, 8.0, and 8.1, and some distributors and LTS vendors provide their own backports (details in the mitigation section).

The root cause: longjmp without cleanup #

To understand the bug, you need to understand how PHP reacts to a fatal error, including out of memory (OOM).

Historically, PHP, when it encounters a fatal error, does not go up the stack function by function. It calls zend_bailout(), which internally uses a longjmp: a direct jump to a recovery point, skipping everything in between.

The problem is what gets skipped. If a function had just modified some state and was counting on getting to its cleanup phase to fix it, that cleanup never gets executed. The state remains half-finished: pointers pointing to already-freed memory, structures only partially initialized.

PHP then proceeds with a normal cleanup sequence, which assumes that every structure is consistent. It isn't. And this is where use-after-free comes in.

PHP2Shell: Longjmp without cleanup in PHP, inconsistent state, and use-after-free vulnerabilities.

An everyday example: Imagine you're updating a paper register. You write half a line, then someone snatches the sheet from your hand (the longjmp). The register is left with an incomplete line, and anyone who reads it later trusts it to be valid.

CVE-2026-109618: Corruption in the request itself #

Here, the damage is done during the request that caused the error. An OOM can occur while PHP is still constructing the request data, for example, while parsing a body. multipart/form-data, including the session upload progress manager (session.upload_progress).

The result is that PHP stops with the request memory only partially set, but then cleans up as if it were valid. From there, an attacker who controls the size and content of the request can attempt to turn the corruption into code execution.

An important detail from a defensive perspective: the fact that the corruption occurs before any application code is executed means that no application control, framework, or input validation can stop it. This is also confirmed by an analysis by an independent lab: on the vulnerable build, the test request dies with an out-of-memory fatality "in Unknown on line 0," that is, before the user code.

VulnCheck has independently reproduced the flaws, and its preliminary analysis indicates successful exploitation on ARM64 and on x86 without ASLR, which suggests that ASLR mitigation matters, but should not be considered a sufficient defense.

CVE-2026-109619: The global state that survives #

The second bug is more subtle, and more interesting to understand.

A PHP worker (think of a PHP-FPM process) doesn't come into being and die at every request: it serves thousands of them. That's why it maintains some global state that traverses requests: error status, sessions, objects, extensions, serialize/unserialize.

If a request fails, for example with a fatal error, part of this state can remain "hooked" in memory of the now-freed request. At that point:

  • the global pointer still exists
  • the memory it points to no longer exists
  • the next request on the same worker reads it before have PHP reinitialize it

This explains something surprising: turning off display_errors, turn off log_errors, change error_reporting or use @ it doesn't helpThe state is read before PHP decides whether the message should be displayed.

It also explains why the PHP team insists that the only reliable mitigation is to update, and that no configuration change covers all paths.

Who is exposed #

The PHP advisory covers any installation that serves web requests. Examples cited:

  • PHP-FPM (with Nginx or Apache)
  • Apache with mod_php (higher risk)
  • php-cgi
  • FrankenPHP
  • LiteSpeed ​​(lsphp)
  • Software that includes php.exe / php-cgi.exe on Windows, often without the operator knowing that he has a PHP server

According to the CERT-AGID Remote code execution is confirmed by the vendor on Apache with mod_php, while on PHP-FPM it is possible under specific exploitation conditions.

For CVE-2026-109619, the most important ones are models with persistent workers (FPM, mod_php), because it is the same process that serves different requests. php-cgi classic, which is born and dies at every request, is much less exposed to this second flaw.

How to Know if You're Vulnerable #

The first check is the version. Remember, however, that many Linux distributions apply patches without changing the upstream version number, so an "old" version may already be patched.

bash
# Show the PHP runtime version
php -v

# Show version, SAPI and memory limit in one go
php -r 'echo PHP_VERSION, " ", PHP_SAPI, " memory_limit=", ini_get("memory_limit"), PHP_EOL;'

# Debian/Ubuntu: check whether the distro backported the fix
apt changelog php8.3-fpm | grep -i "CVE-2026-1096"

# RHEL/Fedora family: same check
rpm -q --changelog php | grep -i "CVE-2026-1096"

php -v is not enough: it controls the web server runtime #

php -v Shows the command line interpreter version, which may be different from the one used by the web server (multiple installed versions, containers, control panels). What matters is the version actually serving the requests.

bash
# Is PHP loaded as an Apache module (mod_php)?
apachectl -M 2>/dev/null | grep -i php

# Print the real binary and version behind every running PHP-FPM master
for p in $(pgrep -f 'php-fpm: master'); do
  bin=$(sudo readlink -f /proc/$p/exe)
  echo "$p -> $bin"
  "$bin" -v | head -n 1
done

If the distribution applies backported patches, the reference is the distributor's security advisory, not the version number.

If you want to know what an outsider can see on your assets, check the version header. Only do this on your own or authorized systems.

bash
# Check whether the web server leaks the PHP version
curl -sI https://example.com | grep -i "x-powered-by"

Un X-Powered-By: PHP/8.x.y Visible is information given to those doing reconnaissance. Turn it off with expose_php = Off in php.iniTo find large-scale exposures, engines like Shodan , and that's exactly what attackers will do in the days after a disclosure; and to map the services of your perimeter you can start from Nmap .

After each check, remember that simply updating the package is not enough: the worker already in memory continues to run with the old binary until you restart it.

bash
# Restart PHP-FPM after patching (unit name varies by distro/version)
sudo systemctl restart php8.3-fpm

# Confirm the master process started AFTER the update
ps -o pid,lstart,cmd -C php-fpm8.3

How to detect exploitation attempts #

An RCE in PHP almost always has the same visible effect: the web process spawns a child that shouldn't exist. This is your most robust observation, because it doesn't depend on the signature of a specific exploit.

Parent processes to keep an eye on are php-fpm (on Debian/Ubuntu with the version number, e.g. php-fpm8.3), php-cgi, httpd/apache2 with mod_php, lsphp e frankenphp.

bash
# List shells/interpreters spawned by PHP-FPM workers
ps -eo pid,ppid,user,cmd --forest | grep -A2 "php-fpm" | grep -E "sh|bash|dash|python|perl|nc|curl|wget"

For continuous monitoring, a rule auditd on the execution of binaries by the web server user:

bash
# Log every execve performed by the web server user (adjust uid for your setup)
sudo auditctl -a always,exit -F arch=b64 -S execve -F uid=www-data -k php_exec

# Review hits
sudo ausearch -k php_exec -i | tail -n 50

Then there are the signs in the logs, typical of a memory corruption that doesn't work the first time:

bash
# PHP-FPM workers crashing (memory corruption often ends in SIGSEGV first)
grep -E "exited on signal (11|6)" /var/log/php8.3-fpm.log

# Fatal OOM errors raised outside any application file
grep -E "Allowed memory size .* exhausted in Unknown on line 0" /var/log/php8.3-fpm.log /var/log/nginx/error.log

A burst of these messages from the same IP is a strong indication. A single event could instead be a normal OOM.

If you suspect a compromise, look for PHP files that have appeared where they shouldn't, especially in directories writable by the web server, such as upload folders. A web shell left as a persistence is a classic second step, and understanding how unwanted uploads work helps you recognize them: we discuss this in the guide to file upload attacks.

bash
# PHP files modified in the last 3 days inside upload folders
find /var/www -type f \( -name "*.php" -o -name "*.phtml" -o -name "*.phar" \) \
  -path "*upload*" -mtime -3 -ls

If you find something, the advice is not to simply delete the file: change secrets, environment variables, database passwords, and API keys that the application could read, and rebuild the environment from scratch. In the Cyber ​​Kill Chain model , you're already beyond the exploitation phase, and what follows is post-exploitation.

Mitigation: Patch first #

There is only one correct mitigation: update to a fixed release and restart the workers.

BranchCorrect release
8.58.5.12
8.48.4.27
8.38.3.36
8.28.2.35 (end of support December 31, 2026)
8.1 and earlierNo regular updates: use a backport from your distributor or vendor LTS, the PHP team's minimal backports (build from source), or migrate

For those compiling from source, the PHP team has released three branches with minimal backports: PHP 7.4 , PHP 8.0 , and PHP 8.1 . Always check your vendor's advisory before choosing.

Some practical points that waste time:

  • Containers with fixed tags: A FROM php:8.4.26-apache It doesn't update itself. Change it to 8.4.27-apache. Mobile tags like php:8.4-apache they already point to the correct images, but you still have to reconstruct.
  • Blocked Dependencies: if in composer.json hai "php": "8.4.26" Exactly, a redeploy doesn't change the version. Use an interval like "^8.4".
  • Late distributionsAs of October 21st, some distros (e.g., Amazon Linux) were still listed as pending fixes on various branches. Check the status of yours before committing to a fix.

If you can't update right away #

When patching is not immediately possible, there are settings that make the attack more difficult, without actually fixing it. These should be applied in php.ini, in an FPM pool or server configuration, i.e. before of the request parsing: ini_set() e .user.ini they are not suitable.

this
; Set these in php.ini, an FPM pool or the server config: ini_set() and .user.ini do not work

; Request size limits: 8M if the app needs no uploads, 32M if it does
post_max_size = 8M
; Keep upload_max_filesize below post_max_size
upload_max_filesize = 4M

; Disable session-based upload progress (also the advisory mitigation for CVE-2026-115560)
session.upload_progress.enabled = 0

; Remove the configurable memory limit as an OOM trigger (partial measure)
memory_limit = -1

; PHP 8.5 only: blocks the confirmed fatal backtrace path
fatal_error_backtraces = 0

On PHP-FPM, it is better to set them in the pool with php_admin_value, so the application cannot overwrite them:

this
; PHP-FPM pool: applications cannot override php_admin_value
php_admin_value[memory_limit] = -1
php_admin_value[post_max_size] = 8M
php_admin_value[upload_max_filesize] = 4M
php_admin_value[session.upload_progress.enabled] = 0

Each one has a cost, and it's worth knowing it:

SettingSide effect
post_max_size / upload_max_filesizeLarger requests and uploads are rejected: if you need large files, use 32M
session.upload_progress.enabled = 0PHP session-based progress bar stops working
memory_limit = -1A single request can consume all the RAM on the instance, posing a risk of OOM killers and denial of service. This does not rule out all possible allocation failures, so it's not a secure solution.
fatal_error_backtraces = 0Fatal errors no longer include backtrace (PHP 8.5 only)

Also add web server or proxy level limits on decoded request size, number of fields, multiparts, headers and nesting depth, even for requests without a Content-Length usable. For availability, use container or cgroup. Do not replace. memory_limit with system limitations such as RLIMIT_AS o RLIMIT_DATA: can generate the very allocation failure that the flaw exploits.

These are partial measures, not replacements for the patch.

For CVE-2026-109619, restarting workers clears the memory state that the flaw abuses. This is a useful stopgap measure, not a fix. It also affects the application code: fatal errors and recurring timeouts are how dirty state is created, so fixing them reduces the surface area.

Which PoC to use for studying #

Repositories with complete one-click exploits for these CVEs are already circulating on GitHub, some with hundreds of stars. CERT-AGID reports that the effectiveness of these public PoCs hasn't yet been fully verified, but they still increase the risk of attack attempts. And there's an additional problem: after every famous CVE, fake repositories appear, with backdoors or infostealers hidden within the "exploit script." The name of the repo doesn't guarantee anything.

Don't run PoCs found online on systems you don't control , and don't even do it on your primary machine.

That's why we've published our own version, hack-ita/php2shell-cve-2026-109618-109619 It is an improved version of the existing ones: it starts from the reference exploitation chain (stage 3 of the eness public PoC, the only one that really implements the documented UAF) and extends it with the three missing automated phases — worker rotation, base heap leak via OOM, zval_ptr_dtor from libphp — more automatic fallback between multiple offset profiles, multi-source scanner for leaked pointers in HTTP responses, parser Transfer-Encoding: chunked, confirmation via timing for the blind case, boundary randomization and User-Agent to leave no static signatures, and HTTP CONNECT proxy support to inspect everything in Burp.

The code is licensed under the MIT license, with docs/vulnerability.md which explains the root cause line by line and docs/detection.md With ready-made rules for Snort, Suricata, ModSecurity, Cloudflare, Apache, and lighttpd. Use only in isolated and authorized environments: understanding the mechanism is the key, don't open shells on other people's machines.

How to study it in the lab #

The most educationally sound path is to start from the code, not from the exploit.

bash
# Get the source and check out the last vulnerable release of the 8.4 branch
git clone https://github.com/php/php-src.git
cd php-src
git checkout php-8.4.26

# Build with debug symbols and AddressSanitizer to observe memory errors
./buildconf --force
./configure --enable-debug --enable-address-sanitizer --disable-all --enable-session
make -j"$(nproc)"

Then compare with the correct release and read the difference.

bash
# Compare against the first patched release of the same branch
git diff php-8.4.26 php-8.4.27 --stat
git log php-8.4.26..php-8.4.27 --oneline | grep -i "bailout"

The fix commit is titled “Avoid state corruption via bailout” and introduces a clean exit path (UnwindExit), allocation failure tracking, global variable resets, and a new battery of tests oom_rfc1867_*Reading those tests tells you exactly what scenarios developers consider dangerous, and it's a great exercise in reading a security patch for anyone aiming to do exploit development on a solid foundation.

Common mistakes #

  • "I have display_errors off, so I'm good to go.” No: The state is read before the decision to show the error is made.
  • “I updated the package.” If you haven't restarted PHP-FPM or Apache, the old process is still in memory.
  • “I use a WAF.” It can filter known traffic, but corruption occurs before the application code and depends on the size and structure of the request, not a recognizable string.
  • “My version is old, so I'm vulnerable.” Not necessarily: see the distro's changelog for backports.
  • "php -v It says 8.4.27, so I'm good to go." That's command-line PHP: it controls the runtime used by the web server.
  • “I'm on PHP 8.1, I have time.” It's end-of-life: no regular updates. Consider backports from your vendor or minimal ones from the PHP team, or migrate.

FAQ #

What is PHP2Shell? This is the community name for the pair of vulnerabilities CVE-2026-109618 and CVE-2026-109619, two unauthenticated RCEs in the PHP core, both CVSS v4.0 9.2.

What's the difference between CVE-2026-109618 and CVE-2026-109619? The first is a corruption due to an out-of-memory error that occurs in the same request. The second is a global state stuck in freed memory, which a subsequent request on the same worker reads before reinitialization.

Which PHP versions are correct? 8.2.35, 8.3.36, 8.4.27, and 8.5.12. Branches 8.1 and earlier don't receive regular updates, but there are minimal backports from the PHP team (7.4, 8.0, 8.1) and backports from some distributors and LTS vendors.

Do you need to be authenticated to exploit them? No. All it takes is a specially crafted HTTP request that reaches a vulnerable PHP process.

Does PHP2Shell affect WordPress? WordPress can be affected when it runs on a vulnerable PHP runtime. Updating WordPress, your theme, or plugins alone won't fix a PHP engine vulnerability; you'll need to update your runtime or check with your vendor for a fix.

Are configuration mitigations enough? No. They make the attack more difficult, but according to the PHP team, no configuration covers all paths: the only reliable solution is a patch.

What is CVE-2026-115560? An additional vulnerability announced by the PHP team on October 23, 2026, not fixed by the October 21 releases. It requires an unusual combination of configuration and application code; the indicated mitigation is session.upload_progress.enabled=0 until the next regular release.

Can I test a PoC found online to see if I'm vulnerable? Only in your own, isolated lab. Many post-CVE repositories are fake or contain malware. To test a production system, check the actual runtime version and the vendor's advisory.

How do I check if I've been compromised? Search for abnormal children of PHP processes (shell, curl, wget), worker crashes in FPM logs, memory errors “in Unknown on line 0” and files .php new ones in your upload folders. If you find anything, rotate all the secrets.

Conclusion #

PHP2Shell is a good case study because it doesn't stem from an obvious programming error, but from a years-old design choice: handling fatal errors with a leap that also skips cleanup. For those studying offensive security, the lesson is that the most serious flaws often lie in implicit runtime assumptions. For defenders, the order is simple: patch, restart workers, monitor the web server's child processes, and rotate secrets if in doubt.

Security sources and advisories #

#PHP2Shell #CVE-2026-109618 #CVE-2026-109619 #Remote Code Execution #PHP Vulnerability

leave a message

I'm not a robot