PHP2Shell: Patch PHP 8.2–8.5 and Find Exposed Runtime Copies
- Saeed Abbasi
- 641 reads
Two PHP flaws enable unauthenticated code execution and memory disclosure. Find exposed runtimes, apply fixed builds, and verify every worker.

Two PHP flaws put web facing runtimes under pressure
PHP2Shell describes two vulnerabilities, CVE-2026-109618 and CVE-2026-109619, each rated 9.2 under CVSS v4.0. Both can enable unauthenticated remote code execution, and researchers have also demonstrated disclosure of PHP worker memory. That memory may contain passwords, authentication tokens, or API keys. The practical task for operators is to find every PHP runtime serving requests, apply the right vendor fix, and restart the processes that load it.

Apache mod_php deserves early attention. PHP reports a demonstrated exploit that can trigger before application code runs. Cloudflare has reported attack traffic, including attempts to evade its protections. PHP-FPM, php-cgi, FrankenPHP, and LiteSpeed deployments are also in scope, though exploitability depends on configuration and application behavior.
Both bugs involve request state and memory cleanup. CVE-2026-109618 can leave request data only partly initialized after an out-of-memory error. Cleanup code then treats that data as valid, opening a route to code execution. CVE-2026-109619 leaves references to request data after its memory has been freed. If the same worker handles another request before those references are reset, it may use stale data. Researchers have demonstrated code execution through this sequence.

For the second flaw, the demonstrated paths include mod_php and, under suitable application conditions, PHP-FPM. PHP-FPM startup behavior blocks one particular out-of-memory route associated with the first flaw; that behavior does not remove the need to patch FPM. The vulnerabilities have high impact, but successful exploitation depends on factors such as memory layout, build details, and worker scheduling.
Exposure is broad, and unsupported versions complicate the fix
Qualys Threat Research Unit analyzed anonymized data from more than 10,000 customers. It found 167 million PHP package installations; 156 million had a known PHP version, and 73% of those were on internet-facing assets. Among installations with a known version, 44 million, or 28%, ran supported PHP branches from 8.2 to 8.5. A further 110 million, or 71%, ran PHP 5.4 to 8.1, branches at end of life or outside support. Only 199,000 installations had been patched in the first 12 hours after disclosure.

Those figures point to two separate jobs. For supported branches, teams need to deploy available fixed releases. For older versions, many installations may not receive a vendor patch; the durable route is to upgrade to a supported branch or obtain a fixed build through a distribution or support provider. A version string alone may not settle the question, since distribution packages can include backported fixes while retaining an older upstream version number.
The upstream fixed releases are PHP 8.5.12, 8.4.27, 8.3.36, and 8.2.35. Check the applicable vendor advisory for distribution-managed installations. PHP has also supplied limited source backports for versions 7.4, 8.0, and 8.1. Teams on those branches should confirm what their provider has built and how it is delivered.


Updating is the complete fix. Where an update is delayed, PHP recommends configuration changes that reduce specific attack paths. Restrict public access or isolate a service temporarily if a fixed build cannot be deployed promptly. Each system awaiting an update should have an assigned owner and a remediation deadline.
Start with inventory, then confirm exposure
Finding PHP across a fleet can be harder than checking a server’s command line version. A host may contain parallel branches, PHP bundled with an appliance, copies inside application directories, or a runtime different from the one returned by php -v. Containers and cloud images add their own copies. Inventory needs to account for where PHP is installed and which instance actually serves traffic.

Qualys offers QID 45110, “PHP Server Detected,” as an inventory check. It identifies PHP installations, but does not confirm that either vulnerability is present. Use it to build a list, then compare each runtime and package with the relevant upstream or vendor fix. Qualys also suggests using CyberSecurity Asset Management to locate PHP installations, flag unsupported software, and prioritize internet facing systems. Its example inventory queries include:
(software: ((name: "php")))to find assets with PHP installed.((software: (((name: "PHP") AND (version: (*..8.1))))))to find PHP 8.1 and earlier.((asset.criticalityScore: [4..*)) AND (software: (((name: "PHP") AND (version: (*..8.1))))))to focus on critical assets running those versions.
Qualys lists a range of detection checks for PHP and distribution packages, including QID 520310 for the two PHP2Shell vulnerabilities, QID 389102 for PHP installations, and QID 39033 for an unauthenticated check. Other entries cover packages from Red Hat, Amazon Linux, Rocky Linux, SUSE, Debian, Arch, Alpine, Gentoo, Fedora, and Ubuntu. The available checks change as package providers publish fixes, so teams should use current detection content and the vendor’s package details when confirming status.

For Windows assets, Qualys Deep Scan can extend detection beyond managed software in standard locations to PHP binaries in configured custom folders and secondary drives. Findings include the binary path, detected version, and recommended fixed version. The feature is available for Windows Cloud Agent 6.2 or later, with directory rules and scan resource controls. That matters when updating the primary PHP installation could leave a second, overlooked copy in place.
Qualys InstaScan matches advisory information against existing software inventory, surfacing findings as supported vendor data is processed without waiting for a new scheduled scan. Qualys says it typically presents findings within minutes of advisory processing. Its supported sources include Red Hat, Ubuntu, Debian, and Oracle Linux. The operational value depends on the quality and freshness of the inventory already being reported.

Prioritize the reachable runtime, not just the package list
A vulnerable version found on a host does not tell a team whether the affected entry point is reachable. Qualys Enterprise TruRisk Management (ETM) uses TruConfirm to check live production assets with a benign upload request. The check first verifies that the target runs PHP, then sends a probe intended to mimic an initial attacker request without creating files, executing code, or applying memory pressure. PHP startup warnings indicate that the entry point is reachable and the recommended setting, session.upload_progress.enabled=0, is absent.
Qualys says confirmed exposure receives a higher TruRisk score and supporting evidence, which can help teams order remediation. In one customer environment cited by the company, 1,539 assets ran PHP and 25 were confirmed exploitable. That example illustrates the difference between a broad inventory and a validated set of reachable systems; it should not be treated as a general estimate of exposure rates.

Public proof-of-concept scripts are a poor substitute for safe validation on production servers. Some hold uploads open for close to a minute; others send oversized requests to trigger memory exhaustion. Both approaches can tie up workers. The upload technique may write client-supplied data into a session file, and a run interrupted at the wrong point can leave that file behind. More fundamentally, a proof of concept triggers the vulnerable memory path directly and may crash a worker.
Scripts shared online are also untrusted code. Test them in an isolated lab using a cloned, snapshotted system. On live systems, use a validation method designed to check reachability without exercising the vulnerable path. Traffic from a proof of concept can also look like an attack to monitoring tools, and testing systems you do not own is not appropriate.

PHP2Shell can also sit behind web applications and APIs that host teams do not easily connect to their server inventory. Qualys TotalAppSec identifies applications and APIs and can flag exposed PHP version information. That information is a lead, not proof: teams still need to verify the runtime version and patch state. Qualys positions TotalAppSec alongside its VMDR and TotalCloud findings to connect application exposure with the underlying infrastructure.
For web applications and APIs, the source lists QID 520310 and QID 533086 for PHP2Shell detection. It also lists QID 520404 for a related session upload progress issue, CVE-2026-115560. These checks can help assess externally visible exposure, while host and cloud assessments verify the PHP package itself. The appendix cautions that QID 533068 is intrusive and may crash unpatched applications; it should be limited to non-production systems or systems confirmed patched, with operational impact assessed before use.

Cloud native workloads need the same runtime tracing
PHP may be present in Amazon Machine Images, container images, build artifacts, Kubernetes workloads, and serverless functions as well as traditional servers. Qualys TotalCloud and Container Security are presented as ways to identify vulnerable components across images and deployed workloads. Correlating stored images with running containers helps distinguish an affected image sitting in a registry from one currently serving an application.
Qualys also describes Runtime Vulnerability Reachability, which uses an eBPF-based container sensor to identify packages observed in running containers and connect that evidence to vulnerability findings. When combined with internet exposure and workload context, the aim is to focus teams on vulnerable components in active use. Remediation then means updating dependencies, rebuilding images, and redeploying workloads, not merely changing a package on a host.


Use configuration changes as a bridge to patching
PHP’s temporary guidance reduces exposure to particular mechanisms; it does not make an unpatched installation safe. For CVE-2026-109618, recommendations include limiting request size and complexity, reducing input nesting and upload counts, and blocking multipart requests where applications do not need them. PHP suggests post_max_size=8M for applications without uploads or post_max_size=32M where uploads are needed, with upload_max_filesize below that limit. Web servers and proxies should enforce request limits independently, including where a usable content length is absent.
PHP also recommends setting memory_limit=-1 administratively to remove the attacker-controlled failure associated with PHP’s configured memory cap. This has a tradeoff: removing the per-request cap can increase resource exhaustion risk, so teams need to account for worker and host capacity. Container or cgroup memory limits can serve as an availability boundary, ideally limiting termination to the affected worker, but they do not prevent all allocation failures. PHP warns against using RLIMIT_AS or RLIMIT_DATA as substitutes because they can force the very failures that reach the vulnerable path.

For CVE-2026-109619, set session.upload_progress.enabled=0 before request parsing and restart every worker. Application level ini_set() and FPM .user.ini are not reliable ways to apply this setting early enough. PHP also recommends fatal_error_backtraces=0 on PHP 8.5 to block a demonstrated mod_php path, and removing invalid or deprecated per-request settings that generate diagnostics before initialization. Suppressing error messages does not prevent the underlying access.
Teams should fix fatal errors and timeouts that an external request could trigger, including failures in callbacks, uploads, imports, and cleanup. For PHP-FPM, pm.max_requests=1 can limit each worker to one request, reducing state carry-over, but it may have a performance cost and is not a replacement for patching.

Qualys offers a mitigation that disables session upload progress across web-facing PHP runtimes on a host and adjusts related session handling. It applies a configuration change and restarts the PHP service, then checks that the effective setting is active. Qualys says the change removes the vulnerable code path from execution, but it remains an interim measure. For hosts without an agent, a mitigation script is available through the Custom Assessment and Remediation library in TruRisk Eliminate and can be run on scanner-based systems.
Qualys Policy Audit includes an “Assess PHP Secure Configuration Baseline” policy, available through the Policy Library by searching for “PHP2Shell.” Its controls check installed PHP version, memory and request settings, upload limits, session upload progress, fatal error backtraces, and FPM worker recycling. The controls support Linux through the scanner or Cloud Agent, and Windows through the Cloud Agent.
Restarting workers is part of remediation
Installing a package does not prove that the web application is using it. Running workers may still have the old code loaded, which is especially relevant to the stale-state flaw. After patching, restart the services that load PHP or replace the relevant containers, then verify the runtime serving requests.
For Ubuntu updates, the source describes the available packages as userspace changes that do not require an operating system reboot. PHP processes still need a restart. Qualys rates the cited updates as high reliability, but that rating is the company’s assessment; operators should follow their normal deployment controls.
After the patched runtime is confirmed, review temporary configuration changes. Restore a suitable finite memory_limit, and check upload restrictions and worker recycling settings against application needs. Test application behavior under memory pressure: the patched runtime may terminate a worker at its hard memory threshold without running normal shutdown handlers.
Qualys’ PHP2Shell dashboard groups PHP installations, discovery sources, internet exposure, unsupported and unpatched versions, mod_php risk, and remediation status. It also displays detection age and whether a finding is active, fixed, or reopened. The dashboard is intended to help sort work by operating system and risk while new package fixes appear.
Verify each copy and keep the scope current
A sound closeout checks every PHP location, including parallel branches, hosting packages, appliance bundles, containers, and images. Confirm the full package version against the provider’s advisory, update the correct binary or image, and restart or replace the processes using it. Then rerun the relevant host, cloud, and application checks.
For containers, rebuild from patched dependencies and redeploy; for applications and APIs, rescan externally visible information while separately confirming the runtime fix. Keep temporary configuration measures in place only as long as needed and document which systems still await updates. The key operational distinction is simple: inventory identifies candidates, validation narrows attention to reachable exposure, and a restarted, verified runtime closes the remediation loop.
PHP2Shell’s next practical challenge is likely to be the long tail of unsupported copies and vendor-specific package builds. Teams that track runtime location, package provenance, and active worker state will be better placed to confirm that a fix has reached the code actually serving requests.