Go Back

Is PHP2Shell Being Exploited, and How Do I Patch It? A Practical Response Guide

Sunil Gupta 03 Nov 2026
Is PHP2Shell Being Exploited, and How Do I Patch It? A Practical Response Guide

Yes. Active exploitation of PHP2Shell has been confirmed. Organizations should inventory affected PHP deployments, upgrade to patched releases, restart and verify active workers, and investigate pre-patch activity for evidence of compromise. Reports describe confirmed remote code execution as well as earlier exploitation attempts, so patching alone does not resolve the question of whether a host was already compromised. (Moses, 2026; PHP Group, 2026; Unit 42, 2026)

Key Takeaways

  • Inventory PHP hosts, including staging systems, containers, and managed hosting.
  • Upgrade to a fixed PHP release and restart every worker process.
  • Review pre-patch logs and system activity for signs of exploitation.
  • Keep WAF protections enabled as defense-in-depth, not as a patch substitute.

What PHP2Shell is, and why unauthenticated matters

PHP2Shell refers to two critical, unauthenticated remote code execution vulnerabilities in the PHP runtime. The PHP project assigned both a CVSS v4.0 score of 9.2 and announced fixed releases 8.5.12, 8.4.27, 8.3.36, and 8.2.35 on October 21, 2026. Because the vulnerabilities can be reached through web requests, an attacker does not need valid credentials to attempt exploitation. (PHP Group, 2026; Unit 42, 2026)

CVE-2026-109618 involves out-of-memory error handling via longjmp(), which can leave partially initialized request memory available to the shutdown routine. CVE-2026-109619 involves stale global state referencing freed request memory: a fatal error can interrupt the reset of that state, and a later request handled by the same worker may access it before normal initialization. These conditions can enable remote code execution. (bukka, 2026a; bukka, 2026b)

The affected deployments include PHP-FPM, Apache mod_php, php-cgi, FrankenPHP, and LiteSpeed. PHP identifies mod_php as the highest-risk configuration because an attack can run before application code is reached. The PHP project supports branches 8.2, 8.3, 8.4, and 8.5 through active or security-only support. PHP 8.1 and older are end-of-life and no longer receive regular project updates. For these vulnerabilities, the PHP security team also provided minimal source backports for PHP 7.4, 8.0, and 8.1; these are distinct from vendor-provided backported packages. Check with your vendor for supported packages or backports. A backport does not restore upstream support for an end-of-life branch; treat it as an interim measure while planning migration to a supported version. (PHP Group, n.d.; PHP Group, 2026)

Exploitation is confirmed in the wild

Cloudflare reported attack traffic targeting its customers and confirmed that WAF protections were deployed before public disclosure. Separately, AWS MadPot honeypots recorded exploitation attempts as early as October 17, four days before public disclosure. BleepingComputer later reported confirmed remote code execution against an Apache mod_php host; that report does not establish that every affected configuration is equally exploitable. (Gatlan, 2026; Molteni et al., 2026; Moses, 2026)

In its October 29, 2026 update, Unit 42 reported active PHP2Shell exploitation against internet-exposed PAN-OS management interfaces. For affected PAN-OS appliances, follow Palo Alto Networks’ product-specific advisory: remove public internet access to management interfaces, restrict access to trusted internal IP addresses, and apply available PAN-OS fixes. (Palo Alto Networks, 2026; Unit 42, 2026)

The UK National Cyber Security Centre urged organizations to update promptly and advised taking systems offline if they could not be adequately updated or mitigated. PHP says there are no complete mitigations: upgrading is the only safe choice. (National Cyber Security Centre, 2026; PHP Group, 2026)

Exposure estimates describe different measurements, not confirmed vulnerable servers. According to Unit 42, Cortex Xpanse identified more than 22.6 million exposed instances potentially vulnerable to the two flaws based on telemetry. VirusTotal identified roughly 5.1 million IP addresses running PHP, about 3.8 million with at least one open port; these figures describe the internet-facing PHP footprint, not confirmed vulnerable hosts. Treat both sets of figures as indicators of scale, not counts of vulnerable or compromised systems. (Sánchez, 2026; Unit 42, 2026)

Patch checklist: inventory, upgrade, verify

The NCSC recommends finding PHP systems across the environment, prioritizing internet-facing assets, and checking software that may bundle PHP. Include systems that are easy to miss: staging environments, shared hosting, container images, and appliances. (National Cyber Security Centre, 2026)

  • Record each host’s PHP version and web-server mode.
  • Upgrade affected systems to the patched release for their currently supported PHP branch. For end-of-life branches, verify whether an approved vendor backport is available as an interim measure and plan migration to a supported PHP version (PHP Group, n.d.; PHP Group, 2026).
  • Restart PHP workers and web services so they load the updated runtime.
  • Verify the running version after restart. For vendor-backported packages, also verify the installed package against the vendor’s security advisory. A package update alone does not prove that active processes are using the patched runtime.

Log review: what to look for before you patch

Review the period before the update, not just the time since disclosure. Review web-server logs from before the patch for suspicious POST requests, particularly multipart/form-data activity and requests involving PHP_SESSION_UPLOAD_PROGRESS. Also investigate unexpected process execution, file modifications, PHP worker processes spawning shells, and unusual outbound connections. AWS recommends investigating activity from at least October 17, 2026. (Moses, 2026; Unit 42, 2026)

A single unusual request is not proof of compromise, but suspicious process or file activity warrants investigation. If you find credible indicators, treat the host as potentially compromised: preserve relevant evidence, involve incident responders, and consider rebuilding from a known-good image based on the investigation findings and scope of compromise. The NCSC advises checking for compromise and backdoors before upgrading when immediate patching is not possible. (National Cyber Security Centre, 2026)

What a WAF rule does and does not do

A WAF can block known request patterns and add a useful layer of defense. Cloudflare recommends updating PHP while keeping WAF protections enabled. Upgrading to a patched PHP release is the only complete remediation. WAF rules and configuration changes can reduce exposure while patching is underway, but they should not be treated as substitutes for upgrading. Keep applicable WAF rules enabled, but patch the runtime and investigate possible pre-patch access. (Molteni et al., 2026; PHP Group, 2026)

Build web application security skills with CodeRed Pro

For practitioners strengthening web security fundamentals, CodeRed Pro’s Mastering OWASP Fundamentals is a relevant catalog match; its title does not specifically mention PHP. The Google Gruyere exploitation lab offers hands-on web exploitation practice. Explore the broader learning paths and hands-on labs to build related skills.

FAQ: PHP2Shell patching and exposure

Does a WAF rule protect me from PHP2Shell?

A WAF rule can block known exploit traffic, but PHP says its configuration mitigations do not fully protect against the flaws. Cloudflare recommends applying PHP updates while keeping WAF protections enabled. Keep the WAF enabled as defense-in-depth, and update PHP. (Molteni et al., 2026; PHP Group, 2026)

Which PHP versions are fixed?

The fixed releases are PHP 8.5.12, 8.4.27, 8.3.36, and 8.2.35. PHP 8.1 and older are end-of-life and no longer receive regular project updates. Minimal source backports from the PHP security team for PHP 7.4, 8.0, and 8.1, or vendor-provided backports, do not restore upstream support. Use a backport only as an interim measure while planning migration to a supported PHP version. (PHP Group, n.d.; PHP Group, 2026)

How do I tell if a server was hit?

Review web logs from before patching for suspicious POST requests to PHP endpoints, particularly multipart/form-data requests involving PHP_SESSION_UPLOAD_PROGRESS where request-body telemetry is available. Check for new files in web-writable directories and PHP workers starting shells or making unexpected outbound connections. These are investigation leads, not proof by themselves; if you find credible evidence, treat the host as potentially compromised and involve incident responders. (Moses, 2026; National Cyber Security Centre, 2026; Unit 42, 2026)

Conclusion

Patch every PHP deployment, restart and verify its workers, then investigate activity from before the update. A WAF can add protection, but it cannot replace a fixed runtime or establish that a host was not already compromised.

References

CONTINUE READING FOR FREE

Enter your email to read the complete article.

Join 250,000+ security practitioners who stay updated with CodeRed. Get access to all the latest content on the platform. No spam. Unsubscribe anytime.

We’ll remember you on this device, so you won’t need to fill out the form again.