Preloader
PHP
  • Estimated reading time: 10 Minutes

PHP2Shell Explained: Critical PHP Vulnerabilities, Affected Versions, and How to Fix Them

PHP2Shell Explained: Critical PHP Vulnerabilities, Affected Versions, and How to Fix Them

PHP is one of the most widely used server-side programming languages, it powers millions of websites and applications worldwide. From WordPress blogs and e-commerce platforms to complex enterprise systems built with Laravel and Symfony. PHP remains a fundamental part of the modern web without a doubt, however, its widespread adoption also makes vulnerabilities in the PHP runtime particularly concerning, as a single security flaw can potentially affect countless applications regardless of how securely they were developed.

In October 2026, the disclosure of PHP2Shell, a name given to two critical vulnerabilities identified as CVE-2026-109618 and CVE-2026-109619, raised serious concerns across the cybersecurity community. These memory-management vulnerabilities can potentially allow unauthenticated attackers to execute arbitrary code on affected servers, making them especially dangerous for internet-facing PHP applications. The discovery prompted emergency security releases from the PHP development team, additional protections from security providers such as Cloudflare, and the publication of proof-of-concept code by security researchers.

In this article, we'll explore what PHP2Shell is, how the two vulnerabilities work, which PHP versions and applications are affected, and how to protect your servers by applying the appropriate security patches.

What Is PHP2Shell?

PHP2Shell is the name given to a set of critical security vulnerabilities discovered in PHP, one of the most widely used server-side programming languages for building websites and web applications. It was publicly disclosed on October 21, 2026, these vulnerabilities affect the PHP runtime itself and can potentially allow attackers to execute malicious code on vulnerable web servers without authentication.

PHP2Shell

The discovery of PHP2Shell raised significant concerns across the web hosting and cybersecurity industries because PHP powers millions of websites worldwide. Security providers, including Cloudflare, responded by deploying protective firewall rules, while the PHP development team released security updates to address the underlying vulnerabilities. For developers and system administrators, the most important response to PHP2Shell is to identify vulnerable PHP installations and upgrade them to patched versions, rather than relying exclusively on firewalls or other temporary security measures.

Understanding the Two Critical PHP2Shell Vulnerabilities

The two vulnerabilities involve different internal mechanisms:

  • CVE-2026-109618: A memory-corruption vulnerability related to how PHP handles out-of-memory conditions, potentially leaving internal data structures in an inconsistent state.
  • CVE-2026-109619: A use-after-free vulnerability involving stale global state, where PHP may attempt to access memory that has already been released.

The potential consequences include unauthorized code execution, exposure of sensitive information, and disruption of affected services. However, actual exploitability depends on the PHP version, server configuration, and application environment.

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

The first vulnerability, CVE-2026-109618, involves a flaw in how PHP handles out-of-memory (OOM) conditions while processing incoming requests. When PHP receives an HTTP request, it allocates memory to store information such as request parameters, uploaded files, and other internal data structures. Normally, these structures are initialized before PHP uses or releases them.

However, when memory allocation fails at a critical point, PHP's error-handling mechanism can interrupt execution before certain internal structures have been properly initialized. This creates a dangerous situation: during subsequent cleanup operations, PHP may attempt to process or release memory using invalid or uninitialized pointers. Under specific conditions, an attacker may be able to influence this memory and potentially redirect program execution.

The vulnerability is particularly concerning because attackers may trigger the underlying memory-management failure through specially crafted HTTP requests, without requiring valid login credentials. Successful exploitation could allow an attacker to execute arbitrary code with the permissions of the affected PHP process, potentially compromising the application and its data.

CVE-2026-109619: Use-After-Free Through Stale Global State

The second vulnerability, CVE-2026-109619, is associated with a memory-safety issue known as use-after-free (UAF). A use-after-free vulnerability occurs when a program continues to reference a memory location after that memory has already been released. If the same memory is subsequently reused for different data, accessing the outdated reference can cause unpredictable behavior or potentially allow an attacker to manipulate program execution.

In the case of PHP2Shell, the vulnerability involves internal global state that can remain accessible after the memory associated with an earlier request has been freed. This is especially relevant in server environments where PHP worker processes handle multiple requests during their lifetime.

An attacker may be able to exploit the issue by causing one request to leave behind an invalid reference. A subsequent request handled by the same worker could then interact with that stale memory before PHP properly resets its internal state. Depending on the execution environment and the attacker's ability to influence memory contents, this behavior may result in memory corruption and potentially remote code execution.

Characteristic CVE-2026-109618 CVE-2026-109619
Vulnerability type Out-of-memory memory corruption Use-after-free
Root cause Incomplete initialization during memory allocation failure Stale references to previously freed memory
Trigger Memory exhaustion during request processing Reuse of invalid state across requests
Potential impact Remote code execution Remote code execution
Authentication required No, under exploitable conditions No, under exploitable conditions
Severity Critical (CVSS 4.0: 9.2) Critical (CVSS 4.0: 9.2)

Several public GitHub repositories now provide proof-of-concept (PoC) code, vulnerability scanners, and reproducible Docker environments for testing PHP2Shell (CVE-2026-109618 and CVE-2026-109619).

PHP2Shell testing repositories

Repository

Purpose

Type

joshuarosato/php2shell-poc

Demonstrates the vulnerability and includes instructions for reproducing it against vulnerable and patched PHP 8.5 builds

Exploit PoC and lab

RedSideSecurity/php2shell

Multi-version environment covering PHP 8.2–8.5, with detection and exploitability verification tools

Research lab and toolkit

Nayrae/CVE-2026-109618

Self-contained demonstration involving PHP's session upload-progress mechanism

Exploit PoC

covertswarmlabs/PHP2Shell-Check

Assesses potential exposure without attempting remote code execution

Non-invasive scanner

mikensec/php2shell-lab

Offline environment for analyzing PoC samples and developing detection rules

Defensive research lab

Which PHP Versions were Affected by PHP2Shell?

The vulnerabilities are particularly concerning for organizations running older PHP applications because updating the application's dependencies or framework does not automatically resolve security flaws within the PHP interpreter itself.

The following table summarizes the affected PHP branches, vulnerable version ranges, first patched releases, and recommended actions.

PHP Version Affected Versions First Patched Version Security Status Recommended Action
PHP 8.5 8.5.0 – 8.5.11 8.5.12 Patched Upgrade to 8.5.12 or newer
PHP 8.4 8.4.0 – 8.4.26 8.4.27 Patched Upgrade to 8.4.27 or newer
PHP 8.3 8.3.0 – 8.3.35 8.3.36 Patched Upgrade to 8.3.36 or newer
PHP 8.2 8.2.0 – 8.2.34 8.2.35 Patched Upgrade to 8.2.35 or newer; plan migration before EOL
PHP 8.1 8.1.x No official upstream release End of life Migrate to a supported PHP branch
PHP 8.0 8.0.x No official upstream release End of life Migrate to a supported PHP branch
PHP 7.4 7.4.x No official upstream release End of life Migrate to PHP 8.4 or newer
PHP 7.0–7.3 All releases No official upstream release End of life Upgrade or migrate the application
PHP 5.x Historical releases; exposure varies by vulnerability No official upstream release End of life Replace or migrate the legacy runtime

Unofficial Security Patches for Older PHP Versions

Although PHP 8.1 and earlier versions no longer receive official security updates, several third-party maintainers have released backported patches addressing PHP2Shell, including fixes for legacy versions such as PHP 5.6 and PHP 7.4.

One notable example is Ondřej Surý, the maintainer of the widely used DEB.SURY.ORG repositories for Debian and the PHP PPA for Ubuntu. These repositories provide security-maintained PHP packages for older branches, including PHP 5.6.

Other providers have also released patched packages, allowing organizations to address PHP2Shell without immediately migrating their legacy applications.

Which Websites, Frameworks, and Applications Are at Risk?

One of the most concerning aspects of PHP2Shell is that the vulnerabilities affect the PHP runtime itself, rather than a specific framework, content management system (CMS), or third-party library. Consequently, a wide variety of websites and applications may be exposed if they rely on vulnerable PHP installations.

PHP powers a significant portion of the modern web, ranging from small personal blogs to large e-commerce platforms, enterprise applications, and government systems. Even applications with properly maintained dependencies and secure coding practices may be affected if their underlying PHP interpreter has not received the necessary security patches.

Popular PHP Frameworks and CMS Platforms

The following table highlights some of the most widely used PHP-based technologies that could be affected by PHP2Shell.

Platform Type Potential Exposure
WordPress Content Management System Websites running on vulnerable PHP installations
Laravel PHP Framework Web applications and APIs using affected PHP runtimes
Symfony PHP Framework Enterprise applications, APIs, and legacy systems
Drupal Content Management System Websites and applications relying on vulnerable PHP versions
Joomla Content Management System CMS installations using affected PHP runtimes
Magento / Adobe Commerce E-commerce Platform Online stores and payment-related applications
PrestaShop E-commerce Platform Online stores hosted on vulnerable PHP environments
CodeIgniter PHP Framework Custom web applications and APIs
CakePHP PHP Framework Business applications and legacy systems
Custom PHP Applications Various Applications directly executing vulnerable PHP code

How Cloudflare Helps Protect Websites Against PHP2Shell

Following the disclosure of the critical PHP2Shell vulnerabilities (CVE-2026-109618 and CVE-2026-109619), Cloudflare announced that it had deployed additional security protections through its Web Application Firewall (WAF). According to Cloudflare's official announcement, these protections were deployed approximately nine hours before the vulnerabilities were publicly disclosed on October 21, 2026.

Cloudflare is a widely used web infrastructure and cybersecurity platform that provides services such as content delivery networks (CDNs), DDoS protection, bot management, and web application firewalls. By routing website traffic through its global network, Cloudflare can inspect incoming requests and block suspicious activity before it reaches the origin server.

Websites across different industries, including technology platforms, e-commerce businesses, and online entertainment services such as slotsvader.com, can benefit from Cloudflare's infrastructure to improve website security, availability, and performance. For websites handling significant traffic or sensitive user information, this additional security layer can help reduce exposure to automated attacks and known exploitation techniques.

In response to PHP2Shell, Cloudflare introduced WAF rules designed to detect and block known attack patterns targeting the vulnerabilities. These protections are available across its Free and paid plans, helping website administrators reduce immediate exposure while preparing necessary PHP updates.

However, Cloudflare's WAF protections should not be considered a permanent fix for PHP2Shell. Although they can block known exploitation attempts, they do not eliminate the underlying vulnerabilities in the PHP runtime. Website owners should still upgrade to a patched PHP version and maintain appropriate server-side security configurations.

How to Fix PHP2Shell: Updating PHP to a Patched Version

The most effective way to protect a server against PHP2Shell is to upgrade PHP to a version containing the official security fixes for CVE-2026-109618 and CVE-2026-109619. Because these vulnerabilities affect PHP's internal memory management, updating application dependencies, CMS plugins, or PHP frameworks alone will not resolve the underlying security issues.

Administrators should install the latest versions or newer security-maintained releases. For older PHP branches, including PHP 5.6, 7.4, 8.0, and 8.1, third-party repositories may provide backported security patches.

Keep PHP Updated to Prevent Future Vulnerabilities

PHP2Shell demonstrates why maintaining the PHP runtime is just as important as updating application code and third-party dependencies. Administrators should establish a regular patch-management process, monitor security advisories, remove unused PHP installations, and avoid running unsupported versions whenever possible.

For organizations operating multiple servers or applications, maintaining an inventory of installed PHP versions can make it easier to identify vulnerable environments when new security advisories are published. Ultimately, upgrading to a patched PHP runtime is the only reliable way to eliminate the underlying PHP2Shell vulnerabilities. Firewalls, intrusion detection systems, and network restrictions provide additional protection, but they should complement security updates rather than replace them.

Conclusion

PHP2Shell serves as a very important reminder that even mature and widely adopted programming languages are not immune to critical security vulnerabilities. The discovery of CVE-2026-109618 and CVE-2026-109619 demonstrates how flaws in PHP's internal memory management can potentially expose thousands of applications to serious security risks, including unauthenticated remote code execution.

One particularly interesting aspect of PHP2Shell is the role artificial intelligence played in its discovery. Security researchers from Wiz, OpenAI, and Calif independently investigated these vulnerabilities, using AI-assisted security research to help identify and analyze weaknesses that had remained in PHP for years. This highlights how artificial intelligence is transforming cybersecurity research, making it possible to uncover complex vulnerabilities that traditional auditing methods may have overlooked.

Fortunately, official security patches are available for PHP 8.2 through PHP 8.5, while third-party maintainers such as Ondřej Surý have provided backported fixes for older PHP branches, including PHP 5.6. Security providers like Cloudflare have also deployed additional protections to mitigate known exploitation techniques.

For developers and system administrators, maintaining supported software, monitoring security advisories, and applying patches promptly will become increasingly essential in this evolving security landscape.

Our Sponsors

Our blog is proudly supported by industry-leading sponsors.