Skip to content
Use our free scanner to check your security!
Vulnerability alerts

php2shell, How to protect yourself (CVE-2026-109618, CVE-2026-109619)

PHP2Shell is the name being used for the reported vulnerabilities CVE-2026-109618 and CVE-2026-109619. PHP has announced two critical issues, each rated CVSS v4.0 9.2. CERT-EU identifies the potential for unauthenticated remote code execution.

AssistSec Team

Key takeaways

  • Shortly after the leak, PHP released an advisory saying an upcoming security release was scheduled that would address the two vulnerabilities. The PHP security team ranks both flaws critical severity (with a CVSS v4.0 rating of 9.2). PHP said its emergency updates would occur Wednesday, October 21 at 10am ET (and that it may ship even earlier if technical details go public or exploitation starts).
  • Researchers at watchTowr confirmed the vulnerabilities are real and said they reproduced CVE-2026-109618. As of the publication of this blog on October 20, AssistSec has not seen in-the-wild exploitation of these vulnerabilities in our partner environments.
  • Upload-progress research explains a request-processing boundary that app validation cannot protect after the fact. The precise root causes still need confirmation.
  • The impacted and fixed versions are not yet confirmed. Reporting suggests PHP versions 5 through 8 may be affected, and that only currently supported branches will get a fix. That would leave end-of-life PHP versions exposed with no patch at all.

Background and potential impact

On October 20, Hacker News posted disclosed information about two critical PHP vulnerabilities. The post was removed, but screenshots circulated on social media. watchTowr subsequently confirmed the leak, stating that disclosure had originally been scheduled for Thursday, October 22.

The PHP security team then announced an emergency security release for October 21 at 14:00 UTC. Both vulnerabilities carry a CVSS v4.0 score of 9.2. The team also indicated that it could release the fixes earlier if further technical details or evidence of active exploitation emerged.

The potential impact extends across applications that depend on PHP, including WordPress, Drupal, Joomla, Magento, hosting control panels and third-party software with bundled PHP runtimes. Identifying affected systems requires checking the underlying PHP installations, including those maintained by hosting providers or software vendors.

If you can patch at 14:00 UTC

Before the security release, confirm how you will deploy the update and verify application behaviour afterward. Test any configuration changes and arrange the access, approvals and staff needed for an emergency restart. Apply the update to the PHP runtime handling web requests, whether PHP-FPM, Apache mod_php or CGI. Updating the application alone does not replace that runtime.

The patch

RCE via OOM corruption (CVE-2026-109618):

PHP uses longjmp() for out-of-memory (OOM) errors to exit the current context and abort handling of the request. In some contexts, request memory is temporarily reachable before it is fully initialized. If any allocation fails at that point, PHP does not properly account for the early exit and leaves the request memory in an invalid state. The failed allocation does not need to be related to the invalid memory. The request shutdown procedure may then read or branch on it. Multiple OOM strategies can consistently trigger this condition and lead to remote code execution (RCE).

The patch removes longjmp() for OOM, avoiding an early exit out of contexts that do not properly account for it. It is replaced with a delayed, graceful soft OOM triggered at the next VM safe point, and an immediate hard OOM using _exit() if memory consumption reaches a second, higher threshold. The shutdown procedure will no longer see invalid state, and PHP's normal ability to limit memory consumption is retained.

  • Set memory_limit=-1, preferably in a way applications can't override, such as php_admin_value in the FPM pool or Apache configuration, and check that no pool, directory or application setting puts a finite limit back. This removes the controllable PHP memory limit failure, but an underlying allocation failure can still reach the vulnerable path.
  • Set a low post_max_size. For applications that don't require file uploads, set post_max_size = 8M. If file uploads are necessary, set post_max_size = 32M. Keep upload_max_filesize below post_max_size. Consider enforcing limits at the web server or proxy level for decoded request size, input field count, multipart part count, header count, and nesting depth. These limits must also cover requests without a usable Content-Length.
  • Use a container or cgroup limit as an availability boundary, preferably with a policy that kills only the affected worker. Do not substitute RLIMIT_AS or RLIMIT_DATA, as these can cause the vulnerable allocation failure.

RCE via stale global state (CVE-2026-109619):

PHP contains various global state, such as error, session, object and extension state that is retained by a worker but points to memory owned by one request. That state must be reset before the request memory is released. Some input, configuration, session and error handling operations run before normal initialization of the next request. They inadvertently access stale state not reset by the previous request before initialization has a chance to replace it, causing a use after free. A strategically crafted heap layout can produce full remote code execution (RCE).

State can survive for more than one reason. A fatal error, including one caused by memory exhaustion, can abandon an operation before it performs its matching reset. A warning or other nonfatal diagnostic can also repopulate error state after that state was already cleared during shutdown. The request heap is then freed while the worker global field still refers to it. A later operation that runs before normal request initialization can consume the stale value.

Successful exploitation of this vulnerability requires both a producer and a consumer. The producer is a PHP operation that stores state owned by one request in a location PHP can access later in a subsequent request. The consumer is a subsequent PHP operation that reads, frees, branches or otherwise acts on the stale state previously stored by the producer.

A concrete vulnerability would arise under the following conditions:

  1. A reachable PHP operation stores request-owned state in a globally accessible location, acting as the producer.
  2. The state is not reset, or another operation repopulates it after its normal reset.
  3. PHP releases the request memory while the persistent worker retains the referring global state.
  4. The same worker handles another request.
  5. A PHP operation reads, frees, branches or otherwise acts on the stale state before normal request initialization resets it, acting as the consumer.

The demonstrated producing and consuming operations occur in different HTTP requests handled by the same worker. The exact affected versions, configuration and mitigations depend on the internal state affected by the producing operation.

  • Set session.upload_progress.enabled=0 and restart every worker. Use php.ini, an FPM pool or server configuration that applies before request parsing. Do not rely on ini_set() or FPM .user.ini. This blocks the confirmed session paths but not other variants.
  • On PHP 8.5, set fatal_error_backtraces=0 and restart every worker. This blocks the confirmed fatal backtrace path only.
  • Remove invalid or deprecated settings applied per request that emit diagnostics before initialization. Hiding diagnostics with error_reporting, display_errors or @ does not help.

Patches are available here:

  • https://github.com/php/php-src/security/advisories/GHSA-6wmf-4rv5-p3rp
  • https://github.com/php/php-src/security/advisories/GHSA-w8hw-w9fx-j79w

Detection and indicators of compromise

PHP_SESSION_UPLOAD_PROGRESS and multipart/form-data are normal PHP features. Neither proves an attack.

Look for unusual upload traffic alongside PHP crashes, unexpected shell processes, suspicious files or unfamiliar outbound connections.

Access logs often exclude upload fields, so finding no matches does not rule out an attack.

If you suspect compromise, preserve logs and investigate. Patching fixes the vulnerability but does not remove an attacker’s access.

Quick log check

Search your PHP error log for memory errors, crashes and timeouts. Replace the example path with your configured PHP error log location. This depends on your server’s logging settings.

Powershell (Windows)

Select-String -Path 'C:\path\to\php-error.log' -Pattern 'Allowed memory size.*exhausted|Out of memory|segmentation fault|SIGSEGV|Maximum execution time.*exceeded'

Bash (Linux)

sudo grep -Ein 'Allowed memory size.*exhausted|Out of memory|segmentation fault|SIGSEGV|Maximum execution time.*exceeded' /path/to/php-error.log

Back to the blog

Interested in a pentest?

Discover how AssistSec's AI agents give your organisation faster and more thorough insight into vulnerabilities.

Contact us