PHP2Shell: How It Works, Who Is Affected, Detection & Protection


PHP2Shell: How it Works, Who is Affected, Detection, and Protection. Article Cover

What is PHP2Shell?

PHP2Shell is a group of critical memory-safety vulnerabilities in the core PHP runtime that can allow unauthenticated attackers to execute arbitrary code remotely, disclose sensitive server memory, or crash affected PHP processes. Publicly disclosed on October 21, 2026, the vulnerabilities are tracked as CVE-2026-109618 and CVE-2026-109619, both carrying a critical CVSS v4.0 score of 9.2.

Unlike vulnerabilities in individual PHP applications, PHP2Shell affects the underlying PHP interpreter. Consequently, websites running WordPress, Drupal, Joomla, and other PHP-based applications may be exposed even when their application code and plugins are fully patched. The vulnerabilities affect PHP versions dating back to PHP 5.4 and multiple deployment environments, including PHP-FPM, Apache mod_php, and PHP-CGI.

How these vulnerabilities work:

  • Memory corruption during out-of-memory handling (CVE-2026-109618): PHP's emergency error-handling mechanism can interrupt request processing before internal structures are fully initialized. Subsequent operations may access invalid memory, causing crashes or potentially enabling remote code execution.
  • Use-after-free from stale global state (CVE-2026-109619): Fatal errors can leave PHP with pointers to memory that has already been released. Later requests handled by the same worker may access these stale pointers, potentially exposing sensitive memory or enabling arbitrary code execution.
  • Multipart HTTP request processing: Specially constructed multipart/form-data requests can trigger vulnerable memory-management paths during form and file-upload parsing, before application-level PHP code executes.
  • Cross-request state and memory reuse: PHP workers may process multiple requests without restarting. If an earlier request leaves invalid internal state, a subsequent request can encounter freed or reused memory, creating additional exploitation opportunities.
  • Configuration-dependent exploitation: Successful attacks depend on the PHP version, server configuration, enabled functionality, memory allocation behavior, and worker reuse. Although unauthenticated exploitation is possible, reliable code execution is not guaranteed across all affected environments.

The PHP development team released security fixes on October 21, 2026, in versions PHP 8.2.35, 8.3.36, 8.4.27, and 8.5.12. Because these vulnerabilities exist in the runtime itself, updating PHP is the primary remediation rather than relying exclusively on application patches or web application firewalls.

This is part of a series of articles about API security.

In this article:

How PHP2Shell Was Discovered and Disclosed

PHP2Shell was discovered independently by security researchers from California, Wiz Research, and OpenAI Codex Security during August and September 2026. The investigations combined traditional vulnerability research, analysis of historical PHP memory-management issues, and AI-assisted security testing to identify exploitable weaknesses in the PHP runtime.

Calif researcher Ryan Austin identified the initial vulnerabilities on August 1, 2026, and reported the first issue to the PHP security team on August 11. Calif subsequently provided a working remote code execution proof of concept, which PHP maintainers confirmed on August 15. Wiz Research independently discovered related vulnerabilities later that month, while OpenAI Codex Security contributed additional findings in September.

The researchers coordinated with the PHP security team to develop and validate patches before public disclosure. AI systems also contributed to the research process, with Wiz reporting that frontier models helped analyze complex exploitation chains, develop working exploits, and verify fixes.

The coordinated disclosure process encountered complications in October 2026:

  • October 17, 2026: Amazon's MadPot honeypot network recorded an attempted exploitation of PHP2Shell, four days before the vulnerabilities were publicly disclosed. The activity demonstrated that at least one threat actor was attempting to exploit the flaws before patches became available.
  • October 20, 2026: Information about the vulnerabilities leaked publicly ahead of the planned disclosure. CVE identifiers circulated online, and a proof-of-concept demonstration video was briefly published before being removed. The PHP security team accelerated its disclosure schedule.
  • October 21, 2026: PHP officially disclosed the two vulnerabilities, CVE-2026-109618 and CVE-2026-109619, and released patched versions 8.2.35, 8.3.36, 8.4.27, and 8.5.12. Security researchers and infrastructure providers also observed exploitation attempts that day.
  • October 23, 2026: The PHP project disclosed a related but separate remote code execution vulnerability, CVE-2026-115560, involving session upload progress under specific configurations. This issue was not addressed by the October 21 security patches.
  • October 26, 2026: The U.S. Cybersecurity and Infrastructure Security Agency (CISA) added both PHP2Shell vulnerabilities to its Known Exploited Vulnerabilities (KEV) catalog, highlighting the need for organizations to prioritize remediation.

The disclosure highlighted the challenges of coordinating critical security fixes across widely deployed open-source infrastructure. Because PHP powers a substantial proportion of websites, researchers, maintainers, cloud providers, and security vendors needed to coordinate their responses while limiting attackers' opportunities to exploit the vulnerabilities before patches became available.

PHP2Shell vs. Log4Shell: Why a Runtime Flaw Has Such Wide Impact

PHP2Shell and Log4Shell are both critical remote code execution vulnerabilities affecting widely deployed software components, but they differ in their underlying causes and exploitation requirements.

Log4Shell (CVE-2021-44228), disclosed in December 2021, exploited unsafe JNDI lookups in the Apache Log4j Java logging library. PHP2Shell, disclosed in October 2026, involves memory corruption vulnerabilities in the core PHP interpreter.

PHP2Shell is particularly concerning because the vulnerabilities exist below the application layer. A vulnerable PHP runtime can expose multiple applications running on the same infrastructure, even if those applications have no known security flaws. For example, an organization running WordPress, Drupal, and custom PHP applications may face exposure across all three environments due to a shared vulnerable PHP installation.

The key differences between PHP2Shell and Log4Shell include:

Aspect PHP2Shell Log4Shell
Affected component Core PHP interpreter Apache Log4j 2 logging library
Root cause Memory corruption and stale internal state Unsafe JNDI lookups
Attack surface Web applications and products using vulnerable PHP runtimes Java applications processing attacker-controlled data through vulnerable Log4j components
Authentication required Not required for affected exploitation paths Not required for common exploitation paths
Exploitation complexity Generally higher; depends on PHP version, deployment configuration, and memory layout Often relatively low; crafted strings could trigger exploitation when logged
Potential impact Remote code execution, memory disclosure, and service disruption Remote code execution and potential system compromise
Primary remediation Update the PHP runtime to a patched release Update Log4j to a secure release

How the PHP2Shell Vulnerabilities Work

CVE-2026-109618: Memory Corruption During Out-of-Memory Handling

CVE-2026-109618 arises when PHP encounters an out-of-memory (OOM) condition while processing a request and leaves internal data structures incompletely initialized. PHP uses an emergency error-handling mechanism called zend_bailout(), which relies on longjmp() to exit the current execution context after a fatal error.

This abrupt exit can bypass normal initialization and cleanup operations. If a memory allocation fails while request-related structures are only partially initialized, PHP may subsequently attempt to process those structures as though they contain valid data. This can result in invalid memory access, process crashes, or memory corruption that an attacker may exploit for remote code execution.

The vulnerability is particularly significant because the OOM condition can occur during HTTP request parsing, before the application executes its own PHP code. Consequently, the issue may affect applications that do not contain any exploitable application-level vulnerabilities.

CVE-2026-109619: Use-After-Free From Stale Global State in Session Upload Progress

CVE-2026-109619 involves a use-after-free vulnerability caused by internal PHP state persisting beyond the lifetime of the memory it references. When a request encounters a fatal error, certain global structures may not be reset correctly, leaving pointers to memory that PHP has already released.

The problem is especially relevant to PHP's session upload progress functionality, which tracks file-upload activity and can process serialized session data before normal application execution begins. If an earlier request terminates abnormally, a subsequent request handled by the same PHP worker may encounter stale internal state.

Because the memory referenced by these pointers has already been freed, it may be reused for other data. Accessing the stale pointers can therefore cause PHP to interpret unrelated memory as valid internal structures, potentially leading to memory disclosure or arbitrary code execution.

Researchers also identified related exploitation paths involving fatal-error backtrace handling in PHP 8.5. These findings demonstrate that the underlying vulnerability is not limited to a single session-management feature but reflects a broader failure to reset request-specific state after abnormal termination.

The Role of Multipart HTTP Requests in Both Attack Paths

Multipart HTTP requests, commonly used to submit HTML forms and upload files, aid in PHP2Shell exploitation. PHP processes requests using the multipart/form-data content type through its internal request-parsing mechanisms, which allocate memory for form fields, file metadata, and other request structures.

PHP2Shell exploits weaknesses in this processing stage, allowing specially constructed requests to trigger abnormal memory conditions before application-level validation takes place. This makes the attack surface broader than individual file-upload endpoints, because multipart parsing is handled by the PHP runtime itself.

Multipart requests are relevant to the vulnerabilities in several ways:

  • Memory exhaustion: Processing multipart form data can require substantial memory allocations. Certain request structures can cause PHP to exhaust its configured memory limit and enter vulnerable error-handling paths.
  • Incomplete request initialization: An OOM condition during multipart parsing can interrupt the initialization of internal structures, leaving data that subsequent cleanup operations incorrectly assume is valid.
  • Session upload progress: PHP can track upload progress through its session subsystem. This processing may interact with session data and internal state before the application begins executing.
  • Cross-request memory reuse: PHP workers commonly process multiple requests over their lifetime. If one request leaves stale internal state, a later request handled by the same worker may access memory that has already been freed and reused.

These behaviors explain why PHP2Shell can affect multiple PHP-based applications regardless of their individual security controls. Since the vulnerable processing occurs within the interpreter, application-level input validation alone cannot reliably prevent exploitation.

Attack Prerequisites and Exploitation Complexity

Although PHP2Shell can potentially enable unauthenticated remote code execution, successful exploitation depends on several environmental and technical conditions. The vulnerabilities have a CVSS v4.0 score of 9.2, but they are not equivalent to a universally reliable, single-request exploit.

The main factors affecting exploitability include:

  • Vulnerable PHP version: The target must use an affected PHP runtime. The vulnerabilities were addressed in PHP 8.2.35, 8.3.36, 8.4.27, and 8.5.12, while older unsupported branches may remain vulnerable unless security fixes are backported.
  • Request processing configuration: Exploitability depends partly on the PHP server API (SAPI), such as Apache mod_php or PHP-FPM, and how the web server passes requests to the interpreter.
  • Memory allocation behavior: Attackers must trigger specific memory-management failures at points where PHP has not initialized or reset its internal state correctly.
  • Worker reuse: Exploitation paths involving stale global state may require multiple requests to reach the same PHP worker process, allowing memory corruption from an earlier request to influence subsequent processing.
  • Enabled PHP functionality: Some attack paths depend on features such as session upload progress or version-specific error-handling capabilities. Not every exploitation technique applies to every PHP configuration.
  • Memory layout and reliability: Achieving reliable code execution may require knowledge of the target's memory layout and runtime behavior. Differences in operating systems, PHP builds, and server configurations can affect exploit success.

Security researchers have demonstrated exploitation in several environments, including Apache mod_php deployments and certain PHP-FPM configurations. However, the availability of a working exploit for one configuration does not establish that the same technique will succeed against every vulnerable server.

CVE-2026-115560: A Third Flaw in Session Upload Progress

CVE-2026-115560 is an additional PHP remote code execution vulnerability disclosed on October 23, 2026, two days after the initial PHP2Shell announcement. Unlike CVE-2026-109618 and CVE-2026-109619, which involve memory corruption and stale internal state, this vulnerability concerns an inconsistency in how PHP serializes and deserializes session data during file-upload processing.

The vulnerability arises when PHP's session upload progress feature writes session data using one serialization format, but the application subsequently attempts to read that data using another. This mismatch can cause PHP to interpret session contents incorrectly, potentially enabling object injection and remote code execution under certain conditions.

According to the PHP security team, exploitation requires an unusual combination of configuration settings and application behavior:

  • Non-default session serializer: The server configures session.serialize_handler as php_binary or php_serialize.
  • Runtime serializer change: Application code uses ini_set() to switch the serialization handler to php before calling session_start().
  • Enabled upload progress: The session.upload_progress.enabled directive remains enabled, allowing PHP to process and store file-upload progress information in session data.

Because all three conditions must be present, the attack surface is substantially narrower than that of the original PHP2Shell vulnerabilities. Applications that never change their session serialization handler at runtime do not meet the documented conditions for this attack path.

Which Systems Are Affected by PHP2Shell

Affected PHP Versions and Fixed Releases (8.2.35, 8.3.36, 8.4.27, 8.5.12)

The PHP development team released security updates on October 21, 2026, addressing CVE-2026-109618 and CVE-2026-109619 across all four supported PHP branches. Any earlier release within these branches is vulnerable unless it includes a verified vendor backport.

PHP Branch Affected Versions First Fixed Release
PHP 8.5 8.5.0–8.5.11 8.5.12
PHP 8.4 8.4.0–8.4.26 8.4.27
PHP 8.3 8.3.0–8.3.35 8.3.36
PHP 8.2 8.2.0–8.2.34 8.2.35
PHP 7.4–8.1 End-of-life releases Source backports or vendor-maintained fixes
PHP 5.4–7.3 End-of-life releases No official fixed release

Organizations should verify the PHP version used by their web servers rather than relying exclusively on the command-line version. A server may have multiple PHP installations, and the CLI binary may use a different release from the PHP-FPM pool or Apache module serving production traffic.

After applying updates, administrators should restart affected PHP processes or replace running workers to ensure that the patched runtime is loaded into memory. Systems using Linux distribution packages should also check vendor security advisories, because a patched package may retain an older upstream PHP version number.

At-Risk Server APIs: mod_php, PHP-FPM, php-cgi, FrankenPHP, and LiteSpeed

PHP2Shell affects multiple PHP Server Application Programming Interfaces (SAPIs), which determine how the interpreter interacts with the web server and processes incoming requests. However, the exploitation paths and required conditions differ across deployment models.

The PHP security team identified the following environments as potentially vulnerable:

  • Apache mod_php: Considered the highest-risk configuration. Researchers demonstrated unauthenticated remote code execution through Apache's embedded PHP module, with exploitation occurring before application code executes.
  • PHP-FPM: Commonly deployed with Nginx, Apache, and other web servers. PHP-FPM is susceptible to the vulnerabilities, although exploitation may depend on application behavior, worker reuse, and configuration-specific conditions.
  • php-cgi: Executes PHP through the CGI interface. Installations using vulnerable PHP-CGI binaries are within the affected scope, although exploitation requirements may differ from mod_php deployments.
  • FrankenPHP: A modern PHP application server built around a long-running PHP runtime. Its integration with PHP internals makes vulnerable versions potentially susceptible, although exploitability depends on the particular configuration and execution path.
  • LiteSpeed: Uses PHP through the LiteSpeed Server API (LSAPI). Vulnerable PHP builds may expose LiteSpeed-hosted applications, but available exploitation techniques and their reliability are deployment-dependent.

The distinction between these interfaces is important for vulnerability prioritization. While mod_php has demonstrated exploitation paths that do not depend on application-level behavior, other SAPIs may require additional conditions. Nevertheless, the PHP security team's recommendation is to update all vulnerable PHP installations serving HTTP requests.

WordPress, Drupal, Joomla, Magento, and Other PHP Applications

PHP2Shell creates exposure for websites and applications built on PHP, including widely deployed content management systems and e-commerce platforms. The vulnerability is not specific to WordPress, Drupal, Joomla, or Magento, but these applications inherit risk when their hosting environments use affected PHP versions.

Examples of potentially affected applications include:

  • WordPress: WordPress websites may be exposed through their underlying PHP runtime, regardless of whether WordPress core, themes, and plugins are updated.
  • Drupal: Drupal installations running on vulnerable PHP environments face runtime-level exposure even when the Drupal application itself has no known exploitable vulnerabilities.
  • Joomla: Joomla websites depend on PHP for server-side processing and can therefore inherit vulnerabilities from the interpreter used by their hosting infrastructure.
  • Magento (Adobe Commerce): PHP-based e-commerce deployments may be affected through their application servers, including environments that handle customer information, payment workflows, and administrative operations.
  • Laravel, Symfony, and custom applications: Applications built using PHP frameworks are also potentially affected, including internal portals, APIs, and business applications.

Updating an affected application's core software or plugins does not resolve PHP2Shell because the vulnerable code resides in the underlying interpreter. Similarly, an application that does not explicitly implement file uploads may still be exposed through PHP's internal request-processing mechanisms.

Organizations should inventory the PHP runtimes supporting these applications, including those running in containers, virtual machines, shared hosting environments, and third-party appliances.

End-of-Life PHP Versions 5.4 Through 8.1 and Backported Fixes

PHP2Shell presents a particular challenge for organizations running end-of-life PHP versions. Research indicates that at least one of the two original vulnerabilities affects PHP releases dating back to version 5.4, meaning legacy applications may remain exposed even if they have not been modified for years.

The PHP project did not release new official binaries for PHP 7.4, 8.0, or 8.1. Instead, its security team published minimal source backports that vendors, Linux distributions, and organizations maintaining custom PHP builds could incorporate into their existing releases.

For PHP 5.4 through 7.3, the PHP project did not provide equivalent official fixes. Organizations running these versions generally need to migrate to a maintained PHP branch or obtain verified fixes through an extended lifecycle support provider.

Several considerations are especially important for legacy environments:

  • Backported patches: A Linux distribution or commercial PHP vendor may incorporate security fixes without changing the upstream PHP version. Administrators should verify the installed package against the vendor's security advisory.
  • Unsupported application dependencies: Older applications may depend on PHP features removed or changed in modern releases, complicating upgrades and requiring compatibility testing.
  • Commercial extended support: Providers offering long-term PHP maintenance may supply security fixes for otherwise unsupported branches, although coverage must be verified for the specific vulnerabilities.
  • Residual security exposure: Even when PHP2Shell is addressed through a backport, unsupported PHP installations may contain other vulnerabilities that have not received security fixes.

For systems that cannot be upgraded immediately, organizations should restrict network exposure and apply available infrastructure-level protections. However, these controls should be treated as temporary risk reduction measures rather than complete substitutes for a patched runtime.

Related content: Read our article about vulnerable and outdated components.

Hosted Platforms vs. Self-Managed Servers: Who Needs to Patch

Responsibility for remediating PHP2Shell depends on who controls the PHP runtime. In some hosting environments, the provider maintains and updates PHP centrally. In others, customers are responsible for selecting PHP versions, installing security patches, and restarting application services.

The main distinctions are:

Hosting Model Primary Patching Responsibility Required Action
Fully managed WordPress or PHP hosting Hosting provider Confirm that the provider deployed patched PHP versions
Shared hosting Hosting provider, with customer involvement Verify the active PHP version and select a patched release if the control panel allows
Managed VPS Depends on the provider's management agreement Confirm whether PHP runtime patching is included in managed services
Self-managed VPS or dedicated server Customer or system administrator Update PHP packages, restart workers, and verify remediation
Containers and Kubernetes Application or platform team Rebuild images with patched PHP versions and redeploy workloads
Cloud virtual machines Customer under the shared responsibility model Patch the guest operating system's PHP packages and restart services
Serverless and managed application runtimes Depends on platform and runtime configuration Confirm provider-managed updates or redeploy with a patched custom runtime

Managed hosting customers should not assume that their environments are protected simply because the provider advertises automatic updates. Some providers allow customers to select older PHP branches for application compatibility, and these settings may require manual changes.

For self-managed environments, remediation should include development and staging systems alongside production infrastructure. Administrators should also check container base images, golden VM images, deployment templates, and automated provisioning pipelines to prevent vulnerable PHP versions from being reintroduced.

How to Detect PHP2Shell Exploitation

1. Checking the Running PHP Version on Every Host

The first step is to identify every PHP runtime deployed across production servers, staging environments, containers, and third-party appliances. Organizations should verify the versions actively processing web requests rather than relying on package inventories or command-line PHP installations alone.

For example, the following commands can help administrators identify PHP versions on Linux servers:

  • Command-line PHP: Run php -v to identify the default PHP CLI installation.
  • PHP-FPM: Run php-fpm -v or a version-specific command such as php-fpm8.4 -v to check an installed PHP-FPM binary.
  • Installed packages: Use the operating system's package manager to identify PHP packages and determine whether vendor-maintained security backports have been applied.
  • Active web processes: Inspect running Apache, PHP-FPM, and CGI processes to confirm which PHP installations are serving requests.
  • Containers: Review running container images and their PHP binaries, including images deployed through Kubernetes workloads.

For the original PHP2Shell vulnerabilities, PHP versions earlier than 8.2.35, 8.3.36, 8.4.27, and 8.5.12 within their respective branches require attention unless a verified vendor patch has been applied.

Administrators should also inspect effective PHP configuration settings, particularly session.upload_progress.enabled, and confirm that web workers have been restarted after patching. A package may be updated on disk while a running worker continues using an older vulnerable runtime.

2. Suspicious Child Processes Spawned by PHP Workers

Successful PHP2Shell exploitation can allow attackers to execute operating system commands within the security context of the compromised PHP worker. Endpoint detection and response (EDR) tools can identify this activity by monitoring unexpected processes launched by PHP or web server processes.

Under normal conditions, PHP workers primarily execute application code, access permitted files, and communicate with databases or other services. Although some applications legitimately execute external programs, unexpected shells or system utilities launched by web-serving processes warrant investigation.

Security teams should monitor for the following indicators:

  • Unexpected shell execution: PHP-FPM, Apache, or PHP-CGI processes spawning sh, bash, cmd.exe, or PowerShell without a documented application requirement.
  • Download utilities: Web server processes launching tools such as curl, wget, or PowerShell to retrieve executable content from unfamiliar external destinations.
  • Reconnaissance commands: Unexpected execution of operating system utilities used to enumerate users, processes, permissions, and network configurations.
  • Suspicious outbound connections: PHP workers initiating connections to unfamiliar internet hosts, especially when associated with newly spawned processes.
  • Unusual file creation: New executable files, scripts, or PHP files appearing in web directories, temporary directories, or other locations writable by the web server account.
  • Process crashes and restarts: Repeated PHP worker failures, segmentation faults, or abnormal exits occurring alongside suspicious HTTP requests.

Detection rules should correlate process ancestry, command-line arguments, execution timestamps, and network activity. For example, a PHP worker spawning a shell immediately after receiving an unusual multipart request provides stronger evidence than either event alone.

Organizations can use EDR telemetry, Linux audit logs, Falco, or SIEM detections to monitor these behaviors. However, defenders should account for legitimate application workflows that invoke system commands to avoid unnecessary false positives.

3. Web Log and Traffic Indicators: Oversized Multipart Requests and Upload Progress Fields

PHP2Shell exploitation can produce identifiable patterns in HTTP traffic, particularly requests using multipart/form-data. Security researchers have documented attack attempts involving oversized POST bodies, unusual form-field structures, and PHP's session upload progress functionality.

Web application firewalls, reverse proxies, intrusion detection systems, and web server logs can provide visibility into these requests. Relevant indicators include:

  • Oversized multipart POST requests: Unusually large request bodies, particularly those containing repeated data or abnormal form-field structures, may indicate attempts to manipulate PHP's memory allocation behavior.
  • Session upload progress fields: Requests containing PHP_SESSION_UPLOAD_PROGRESS may warrant investigation when the application does not use PHP's upload progress feature. The field name is configurable, so detection rules should account for the server's actual configuration.
  • Unusual multipart field structures: Excessively long field names, deeply nested array parameters, repeated fields, or unexpected file-upload metadata can indicate malformed requests designed to trigger abnormal parsing behavior.
  • Repeated HTTP errors: Bursts of HTTP 500 or 502 responses following large POST requests may indicate failed exploitation attempts that caused memory exhaustion or worker crashes.
  • PHP memory exhaustion messages: Errors such as Allowed memory size exhausted, particularly those reported as occurring in Unknown on line 0, can indicate failures during request initialization rather than application execution.
  • Abnormal session cookies: Unexpectedly large or malformed PHPSESSID values in HTTP responses may indicate memory disclosure associated with some exploitation techniques.

An important limitation is that standard Apache and Nginx access logs generally do not record multipart request bodies. As a result, security teams may need WAF telemetry, reverse-proxy inspection, or network detection tools to identify upload progress fields and malicious multipart parameters.

For effective detection, organizations should correlate suspicious requests with PHP error logs, worker process crashes, and endpoint activity. They should also establish baselines for legitimate file uploads, since large multipart requests and upload progress fields are not inherently malicious.

How to Protect Against PHP2Shell

1. Upgrade PHP and Restart All Worker Processes

Organizations should upgrade their PHP installations to 8.2.35, 8.3.36, 8.4.27, or 8.5.12, depending on the branch in use. These releases address both original PHP2Shell vulnerabilities. For end-of-life PHP branches, administrators should obtain verified security backports from their operating system or support vendor, or migrate to a supported PHP release.

Installing updated packages alone is insufficient if existing PHP processes continue running the vulnerable runtime. Administrators must restart PHP-FPM pools, Apache workers using mod_php, and other affected PHP services to ensure that the patched code is loaded into memory.

Containerized environments require similar attention. Teams should rebuild container images using patched PHP packages, redeploy affected workloads, and verify that old pods or containers are no longer serving traffic. They should also update base images and deployment pipelines to prevent vulnerable versions from being reintroduced.

After deployment, verify the PHP version used by each active web server and inspect vendor security advisories for installations using backported fixes.

2. Disable session.upload_progress and fatal_error_backtraces

PHP2Shell includes exploitation paths involving session upload progress tracking and fatal-error backtrace handling. Disabling these features can reduce exposure to CVE-2026-109619 while organizations deploy security updates.

The relevant PHP configuration settings are:

session.upload_progress.enabled = 0

fatal_error_backtraces = 0

The session.upload_progress.enabled directive controls PHP's built-in file-upload progress tracking. Disabling it prevents the confirmed exploitation paths involving this functionality and also mitigates the related CVE-2026-115560 vulnerability, which was not addressed by the October 21 security releases.

The fatal_error_backtraces directive applies to PHP 8.5 and disables the generation of fatal-error backtraces associated with another demonstrated exploitation path. This reduces diagnostic detail available during debugging, so teams should evaluate the operational impact.

These settings should be applied through the active PHP configuration or server-level settings before request processing begins. Changing them dynamically through application code does not provide equivalent protection. Restart affected PHP workers after making the changes.

Importantly, disabling these features does not fully address CVE-2026-109618 or eliminate every potential exploitation path for CVE-2026-109619.

3. Tighten post_max_size, upload_max_filesize, and memory_limit Settings

PHP2Shell exploitation can involve deliberately triggering memory allocation failures through large or malformed HTTP requests. Administrators should review PHP's request-size and memory-management settings to reduce opportunities for attackers to reach vulnerable execution paths.

The relevant settings include:

  • post_max_size: Restricts the maximum size of POST data PHP accepts. Setting this to the smallest value compatible with legitimate application requirements can limit oversized multipart requests.
  • upload_max_filesize: Controls the maximum size of individual uploaded files. Keep this below post_max_size and avoid permitting unnecessarily large uploads.
  • memory_limit: Controls how much memory an individual PHP script can allocate. Unlike ordinary PHP hardening, simply lowering this limit is not an appropriate PHP2Shell mitigation because it can make the vulnerable out-of-memory condition easier to trigger.

For CVE-2026-109618, published mitigation guidance recommends considering memory_limit = -1 to remove the PHP-level memory exhaustion trigger, while enforcing memory constraints through containers or control groups (cgroups). This approach requires careful capacity planning because removing PHP's per-script limit can increase the risk of resource exhaustion and denial of service.

Administrators should also avoid operating system resource limits such as RLIMIT_AS and RLIMIT_DATA as substitutes, because these may trigger the allocation failures involved in the vulnerability.

Related content: Read our article about insufficient logging and monitoring.

4. Apply WAF Rules and Virtual Patching While Patches Roll Out

A web application firewall can provide temporary protection by identifying and blocking suspicious HTTP requests associated with known PHP2Shell exploitation techniques. Security vendors have published virtual patching guidance and protective rules targeting abnormal multipart requests, excessive request sizes, and other relevant traffic patterns.

Organizations should apply available vendor-managed protections and verify that relevant rules operate in blocking mode rather than monitoring mode alone.

Recommended measures include:

  • Enable PHP2Shell-specific WAF protections: Deploy updated managed rule sets or vendor-provided virtual patches targeting the documented vulnerabilities.
  • Restrict multipart requests: Block multipart/form-data requests on endpoints that do not require file uploads, while preserving legitimate application functionality.
  • Enforce request-size limits: Reject unusually large HTTP request bodies and excessive multipart fields before they reach PHP.
  • Apply rate limiting: Restrict repeated suspicious POST requests that may indicate attempts to manipulate memory allocation or reuse affected worker processes.
  • Monitor WAF events: Review blocked requests, matched rules, source addresses, and request patterns to identify potential exploitation attempts.

WAF protection has important limitations. Some PHP2Shell exploitation paths depend on internal runtime state and memory-management behavior that cannot be reliably identified from HTTP traffic alone. Attackers may also modify request structures to evade known signatures.

Related content: Read our guide to real-time protection against API attacks.

5. Segment PHP Workloads and Run Them with Least Privilege

Although segmentation and least-privilege controls cannot prevent PHP2Shell exploitation directly, they can limit the consequences of a successful attack. Remote code execution typically operates within the security context of the compromised PHP process, making its permissions and network access important factors in determining the potential impact.

Organizations should isolate PHP applications from unrelated workloads and minimize the privileges available to their web server processes.

Recommended controls include:

  • Use dedicated service accounts: Run PHP-FPM pools and application workers under separate, non-privileged operating system accounts. Avoid running PHP processes as root.
  • Isolate applications: Separate PHP applications using containers, virtual machines, or dedicated server environments to reduce cross-application exposure.
  • Restrict network access: Apply firewall rules and network policies that permit PHP workloads to communicate only with required databases, APIs, and internal services.
  • Limit filesystem permissions: Grant write access only to directories that require it, and prevent PHP worker accounts from modifying application code or sensitive system files.
  • Protect credentials and secrets: Avoid storing unnecessary credentials in PHP-accessible configuration files or environment variables. Scope database accounts and API credentials to the minimum required permissions.
  • Monitor runtime behavior: Use endpoint monitoring and container security tools to detect unexpected shell execution, suspicious file modifications, and unauthorized outbound connections.

For containerized deployments, additional controls such as read-only root filesystems, restricted Linux capabilities, and non-root execution can further reduce the impact of a compromised process.

How Radware Protects Against PHP2Shell

Radware AI Xploit Shield had tailored protection for PHP2Shell ready within minutes: three custom signatures, validated against the exploit and delivered through the Radware cloud. Customers can run them in report mode first, then block. This closes the exposure window while teams test and roll out the PHP upgrade.

In addition, Radware API Security Service provides full-lifecycle API protection based on runtime traffic. It combines API discovery, runtime posture management, contextual API testing and AI-driven runtime protection in a single portal, helping security teams see their entire API catalog, prioritize the risks that actually appear in production traffic, and detect and block API threats, including business logic attacks, without deploying agents.

Key capabilities of Radware API Security Service:

  • Continuous API discovery: Provides complete visibility into the API catalog across environments, including third-party, outdated, shadow and deprecated APIs, so teams can quickly identify trends, anomalies and application issues.
  • Complete runtime protection: Protects against all types of API attack vectors, including embedded attacks, business logic attacks, API-focused bot attacks and HTTP DDoS attacks on APIs.
  • Runtime API security posture management: Delivers a real-time, high-fidelity view of API security risks based on live production traffic, surfacing risks that are not visible through traditional tools.
  • Contextual API testing: Runs fully automated API security testing that adapts to application business logic, covers the full OWASP API Top 10, and integrates into CI/CD pipelines to find and fix issues early.
  • Business logic attack mitigation: Automaps API and business logic workflows, then generates and enforces rules to stop abuse of legitimate application flows.
  • AI-based rule automation: Generates and continuously adapts security rules based on runtime production traffic to improve detection accuracy and reduce false positives.
  • HTTPS DDoS attack protection: Automatically generates behavior-based signatures in real time to mitigate HTTPS floods on API endpoints without blocking legitimate traffic.
  • Single-portal experience: Combines discovery, management, risk assessment and runtime protection in one management and reporting portal, eliminating tool sprawl and silos between development and security teams.

Learn more about Radware API Security Service

Contact Radware Sales

Our experts will answer your questions, assess your needs, and help you understand which products are best for your business.

Already a Customer?

We’re ready to help, whether you need support, additional services, or answers to your questions about our products and solutions.

Locations
Get Answers Now from KnowledgeBase
Get Free Online Product Training
Engage with Radware Technical Support
Join the Radware Customer Program

Get Social

Connect with experts and join the conversation about Radware technologies.

Blog
Security Research Center
CyberPedia