/ What Is PHP2Shell?
What Is PHP2Shell?
PHP2Shell is a pair of critical, unauthenticated remote code execution (RCE) flaws in the core engine of PHP, a programming language that runs on web servers. Tracked as CVE-2026-109618 and CVE-2026-109619, the flaws let attackers take control of a web server without logging in. Because they sit in PHP itself, any PHP-based website may be at risk.
Key Takeaways
• PHP2Shell is a pair of critical flaws in the PHP core engine, CVE-2026-109618 and CVE-2026-109619, that let unauthenticated attackers run code on any PHP server that handles web requests.
• Exploitation can occur while PHP parses a request, so application-level controls and logs may never see the attack.
• Attackers began probing before PHP published fixes on October 21, 2026, which left defenders little time to respond.
• PHP 8.1 and older received no official fix, and a graceful reload leaves vulnerable code in memory, so affected systems need an upgrade and a full restart.
• Patching takes time in enterprise environments, so teams should use zero trust architecture to remove direct internet exposure and block outbound command-and-control traffic while upgrades proceed.
Why Is the PHP2Shell Vulnerability Important?
PHP2Shell matters because of its widespread reach, low barrier to attack, and where it strikes in the request. The flaws can trigger while PHP is still reading an incoming web request, before the website’s own code or login checks run, so standard application defenses may never see the attack.
- Critical flaws in the PHP core: In October 2026, PHP’s developers released emergency security updates for two vulnerabilities in the PHP core interpreter.
- Maximum-level severity: Both flaws score 9.2 on the CVSS v4.0 scale, a critical rating, because they can let attackers run code remotely on an affected web server.
- No credentials required and easy to automate: Attackers need no passwords or session tokens, and one crafted HTTP request can be enough to run code on the target server, which makes internet-wide scanning simple and fast.
- Confirmed attacker activity: After filtering out routine scanning, Zscaler ThreatLabz identified 3,038 exploitation attempts from 248 attacker IP addresses across 137 targeted organizations.
- Ongoing campaign: “And this is after removing all the obvious scanning attempts that usually start after a major vulnerability discovery,” said Deepen Desai, EVP, Cybersecurity, Zscaler, in a rapid response webinar. “The team identified over 248 attackers’ IPs, and this trend continues even today as we talk about this,” he added.
- Attack happens inside the engine: Because exploitation occurs while PHP parses the request, application controls and plugin or CMS updates cannot stop it. Emergency WAF rules block known patterns but miss variants and traffic sent directly to the origin server, so patching PHP remains necessary.
“Around 70% of the Internet’s exposed websites use PHP, including popular CMS like WordPress, Drupal, Joomla, and ecommerce platforms like Magento and OpenCart. So this makes the attack surface very fast and vast for threat actors. And since the vulnerable code is in the PHP itself, websites can be affected even if the application code is secure.”– Jithin Prajeev Nair, Director of ThreatLabz Research, Zscaler |
What Is PHP?
PHP is an open-source scripting language that runs on web servers. It builds web pages on demand, so each visitor sees content tailored to the request.
PHP handles each page request in four steps.
- A browser asks for a page.
- The server runs the PHP code and pulls data from a database.
- The server returns finished HTML to the browser.
- Visitors never see the underlying code.
Developers use PHP to process forms, manage logins, and power online stores.
PHP also powers WordPress, which explains why PHP is so widely used. Most websites with a known server-side language use it. Hosting providers support it widely, and it is free to use.
“For over twenty years, PHP has been the default language for internal web interfaces, database utilities, and bundled infrastructure appliances. Even if your developers never write a line of PHP, it is likely sitting inside your environment right now.”– Joby Menon, SVP, Product Management, Zscaler |
Its sheer popularity in modern web environments creates risk. PHP2Shell targets the PHP engine itself, so a single flaw reaches millions of otherwise unrelated websites. Fixing the engine requires updating every server that runs it.
How PHP2Shell Works
PHP2Shell is a pair of memory safety flaws in PHP’s core request-handling engine. Both can let unauthenticated attackers run code on a server, and they may also expose sensitive process memory. That memory may hold passwords, authentication tokens, API keys, and certificates. The name “PHP2Shell” describes the path these flaws open, from a single PHP request to a shell on the server.
CVE-2026-109618: Out-of-Memory Corruption
PHP uses the C function longjmp() to abort a request when it reaches its memory limit. If that error fires while internal request data is only partly initialized, longjmp() skips normal control flow. The memory stays in an inconsistent state.
During request cleanup, PHP reads that invalid data as if it were valid. An attacker can shape the data so PHP follows a pointer the attacker controls. That hands over control of execution. Several out-of-memory strategies can trigger the condition, including oversized allocations and crafted payloads.
CVE-2026-109619: Use-After-Free
PHP workers handle many requests in sequence, and some internal pointers persist between them. After a fatal error, request-owned state can survive in global memory after PHP frees its backing allocation. The next request on the same worker may then read that stale memory before reinitialization.
Attackers can combine this flaw with CVE-2026-109618. The first flaw lets them shape the freed memory, and the second gives them a path to control the instruction pointer.
Where session.upload_progress Fits
The session.upload_progress feature processes a special form field while PHP parses the request body. That happens before any site script runs. Application-level controls and authorization layers never see the attack.
Who Is Affected by PHP2Shell?
PHP2Shell affects PHP versions 5.4 through 8.5.11. Any PHP setup that answers web requests is at risk. The PHP project released fixes on October 21, 2026, but only for versions 8.2 through 8.5.
Fixed and End-of-Life Versions
The fixed releases are PHP 8.5.12, 8.4.27, 8.3.36, and 8.2.35. Updates do not install automatically. Teams must apply them or use equivalent packages from a Linux distribution or hosting provider.
PHP 7.4, 8.0, and 8.1 have reached end of life, so the project issued no official release for them. It published source-only backports instead, and some distribution and long-term support vendors ship patched packages. Versions 5.4 through 7.3 have no fix. Branch 8.2 also reaches end of life on December 31, 2026.
Risk by Web Server Setup
A Server Application Programming Interface (SAPI) is how PHP connects to a web server. Every SAPI that handles web requests is affected by PHP2Shell, but the risk level differs by setup.
What Attackers Can Do with PHP2Shell
Attackers can take over a web server, keep access after patching, and steal secrets from memory. Several follow-up actions can also spread the damage beyond the first server.
- Take over the server: Attackers run operating system commands with the privileges of the web server worker, such as www-data or apache. That access is enough to read application files, change website content, and launch other tools.
- Install web shells: Small, hidden PHP scripts give attackers a way back in. A web shell stays in place after the team applies the patch, so teams must search for new or changed PHP files.
- Expose sensitive data: Leaked process memory can reveal configuration files, database passwords, API keys, and session tokens. Stolen credentials let attackers reach databases and cloud services without further exploits.
- Deliver more malware: Honeypot activity showed attackers fetching additional tools from remote servers. Payloads included botnet malware and remote access trojans.
- Move to other systems: Web servers often connect to databases and internal services. A single compromised host can become the starting point for wider access.
PHP2Shell Timeline: From AI-Assisted Discovery to Active Exploitation
Researchers found PHP2Shell in summer 2026 through independent audits that relied on AI-assisted code analysis. Attackers began probing weeks later, before PHP published a fix on October 21. The sequence shows how little time defenders had between discovery, leak, and active attacks.
- July and August 2026: Calif, a security research firm, began a PHP audit on July 30 and reported the first flaw on August 11. Wiz, a cloud and AI security company, found the flaws on its own on August 19 and reported them on August 24. Two teams reaching the same bugs separately showed how findable AI-assisted analysis made them.
- October 17, 2026: Amazon honeypots logged the earliest known exploit attempt, four days before the fix. Someone had already found a working path.
- October 20, 2026: Details leaked online, including a video of a working proof of concept. PHP moved its planned release up from October 22 to October 21.
- October 21, 2026: PHP released versions 8.5.12, 8.4.27, 8.3.36, and 8.2.35. watchTowr honeypots recorded exploitation the same day.
AI models shaped the discovery. Both teams used them to analyze code. Wiz used Gemini 4 Argon, among other models, to identify the bug, build an exploit, and validate the patch.
How to Check for Exposure and Detect Signs of Compromise
Security teams should confirm which PHP version the website actually runs and monitor the server for attacker behavior. Verifying patch status establishes current risk, while detection establishes whether an attacker gained access before remediation.
Verify the Running PHP Version
- Check the web runtime: The php -v command reports the command-line build, which can differ from the build serving web traffic. Create a temporary page that prints PHP_VERSION, assign it a random name, load it once in a browser, and delete it immediately afterward. A discoverable page exposes version information to outsiders.
- Check the package build: Debian, Ubuntu, and Red Hat backport security fixes into older version numbers, so a patched Ubuntu 24.04 package can still report PHP 8.3.6. Compare the package release against the vendor advisory, or search the package changelog for the CVE IDs.
- Scan from outside: External vulnerability scanners and attack surface management tools identify unpatched or forgotten PHP servers that internal inventories overlook.
Detect Exploit Attempts
Application logs often record no trace of an attack because exploitation occurs during request parsing, before any site code runs. Server-level telemetry provides stronger evidence.
- Monitor process behavior: Alert when apache2, httpd, php-fpm, or php-cgi spawns sh, bash, curl, or wget. Add legitimate child processes, such as mail utilities, to the allowlist to reduce noise.
- Review error logs: Memory exhaustion errors without a script reference, or unexplained worker crashes, may indicate a trigger attempt.
- Inspect requests: Oversized multipart uploads and POST requests to static files warrant review.
- Apply Sigma rules: Convert them for the SIEM in use and tune field names to the local environment.
- Search for web shells: Check web directories for new or modified PHP files.
How to Patch PHP2Shell and Verify the Fix
Upgrade PHP to the fixed release for its branch, then fully restart every service that loads PHP. Updating the package alone leaves running workers on the vulnerable code until they restart.
Upgrade Paths
The fixed releases are PHP 8.5.12, 8.4.27, 8.3.36, and 8.2.35. Teams on distribution packages can install the vendor’s patched build instead, which may keep the old version number. Branches 8.1 and older need a vendor backport or a move to a supported branch.
Patch Steps
- Run the system package manager update, such as apt or dnf. Rebuild PHP against a fixed release for source installs. Recreate containers from patched images.
- Restart PHP-FPM with systemctl restart php-fpm, using the versioned service name, such as php8.3-fpm, on Debian and Ubuntu.
- Restart the web server itself, such as apache2 or httpd, wherever mod_php or LiteSpeed is in use.
- Restart queue workers and other long-running PHP processes.
Restart Warning
A graceful reload is insufficient. Processes started before the update keep the vulnerable code in memory until they exit. With mod_php, the PHP module lives inside the Apache process, so apachectl graceful and similar reloads can leave the old module loaded.
Teams should stop and start the web server fully, and do the same for LiteSpeed and FrankenPHP. Long-running workers, such as queue consumers and scheduled jobs, also need a restart. Skipping this step leaves a patched package on disk beside an unpatched process in memory.
Verify the Fix
Verification confirms that the installed build contains the fix, the running processes loaded it, and the web runtime reports the expected version.
- Confirm the package: Compare the installed package release with the vendor advisory, or search the changelog for both CVE IDs. Version numbers alone can mislead on backported builds.
- Confirm the processes: Check that PHP and web server process start times fall after the update. Tools such as needrestart list services still running outdated libraries.
- Confirm the web runtime: Use a temporary version page to see the build that serves traffic, then delete the page.
- Rescan: Run an external vulnerability scan to confirm the server no longer appears as exposed.
Why PHP Patching Takes Time and How Zero Trust Removes Direct Internet Access
Patching PHP across an enterprise often takes weeks or longer. Applications depend on specific PHP versions and extensions, and legacy custom code can break on newer releases. Third-party commercial systems, such as ERP and CMS platforms, usually need vendor certification before an upgrade. End-of-life branches add another delay because the project issues no official fix for them. Every change also requires testing, a maintenance window, and a full service restart.
Perimeter-based security models make that delay costly. They place web servers on public IP addresses so users can reach them, which leaves every unpatched server visible to the internet. Automated scanners locate vulnerable hosts within hours of a disclosure, and zero-day attacks reach them before any fix exists.
A zero trust approach removes that exposure. Applications stay protected behind a cloud native security exchange, and connections originate from inside the environment and go outward, so the servers accept no inbound traffic from the internet. External scanners find no open ports or reachable addresses to probe.
“A Zero Trust architecture dramatically reduces exposure of your critical applications and lets you put immediate protective layers around vulnerable apps so your teams can patch methodically.”– Joby Menon, SVP, Product Management, Zscaler |
With zero trust, the access policy verifies user identity and device posture before allowing a connection to a specific application. Teams gain time to patch methodically because attackers can no longer reach the vulnerable service directly.
When Disabling Session Upload Progress Helps, Including for CVE-2026-115560
Disabling session upload progress blocks CVE-2026-115560, a separate remote code execution flaw in that feature, until the PHP project releases a fix. The setting also reduces exposure to CVE-2026-109619, the PHP2Shell use-after-free flaw, which reaches PHP through the same feature. Patched servers need it too, because the October 21 updates do not fix CVE-2026-115560.
Exploitation of CVE-2026-115560 is unlikely in practice. An application must set the session serialize handler to php_binary or php_serialize in configuration, then switch to the php handler at runtime with ini_set() before calling session_start(). Teams can search application code for that pattern.
The PHP project recommends a temporary workaround until its next regular release. Apply it in this order:
- Set session.upload_progress.enabled to 0 in php.ini or the server configuration.
- Restart the PHP workers.
- Skip ini_set() for this setting, because it runs too late. PHP processes upload progress while parsing the request.
PHP2Shell Defense Best Practices
A strong defense starts with knowing where PHP runs and keeping every instance on a supported version. Teams that track their PHP footprint can respond to the next disclosure in hours.
Maintain a Real-Time Asset Inventory
Record every PHP deployment, including internal applications, hosting control panels, and staging environments. Staging and forgotten test servers often run older builds yet sit on reachable networks. Capture the PHP version, package build, and server type (mod_php, PHP-FPM, or others) for each, and refresh the data continuously, not quarterly.
Retire End-of-Life PHP Versions
Set a lifecycle policy that removes unsupported branches on a defined schedule. PHP 8.1 and older received no official fix for PHP2Shell, and branch 8.2 reaches end of life on December 31, 2026. Assign an owner and a deadline to each legacy application, and track exceptions as accepted risk with compensating controls.
Audit Vendor and Embedded PHP
Many appliances, management consoles, and commercial platforms bundle their own PHP runtime, so a server patch does not cover them. Ask each vendor to confirm the fixed PHP build and the date it shipped, and apply vendor hotfixes without delay.
How Zscaler Addresses PHP2Shell
Zscaler applies zero trust controls across four stages of risk. Each control reduces exposure while teams patch.
- Exposure management: Zscaler Exposure Management identifies vulnerable PHP applications and guides the fix. It unifies findings from scanners and other sources, ranks them by exploitability in context, and triggers response actions such as host isolation or access restriction before a patch window opens. A zero trust architecture then removes externally exposed PHP assets from the internet.
- Inbound protection: Zscaler Private Access (ZPA) hides internal applications from the public internet. App Connectors make outbound-only connections, so servers expose no listening inbound ports. External scanners find no reachable service to probe or exploit.
- Virtual patching: Autonomous Application Shield, built into ZPA, inspects traffic to private applications inline and applies controls built by Zscaler ThreatLabz for confirmed CVEs. Teams can shield applications that can’t be updated yet, without changing application code or the PHP runtime.
- Outbound containment: Zscaler Internet Access (ZIA) inspects outbound traffic, including encrypted sessions. Threat prevention blocks known command-and-control destinations and payload downloads, which limits what a compromised server can do next.
The Zscaler ThreatLabz team has deployed protections for CVE-2026-109618 and CVE-2026-109619. Learn more about Zscaler’s coverage and how Zscaler Advanced Threat Protection signatures detect exploitation attempts from ZIA traffic targeting internet-exposed servers.
See how Zscaler helps to keep PHP protected and request a custom product demo to learn more.
Frequently Asked Questions
PHP2Shell is a pair of critical flaws in the PHP core engine. Unauthenticated attackers can use a crafted web request to run code on a server. Both flaws carry a CVSS v4.0 score of 9.2. Any PHP setup that serves web requests may be affected, whatever application runs on top.
The two identifiers are CVE-2026-109618 and CVE-2026-109619. The PHP project disclosed and fixed both on October 21, 2026. CVE-2026-115560 is a separate, related issue in session upload progress and does not belong to the pair.
CVE-2026-109618 abuses out-of-memory handling. An aborted request leaves internal data partly initialized, and cleanup then follows an attacker-controlled pointer. CVE-2026-109619 involves stale global pointers. They keep referencing freed request memory, so a later request on the same worker can read it. Attackers can chain the two.
Remote code execution (RCE) is a type of vulnerability that lets an attacker run commands on a system from a distance, usually over a network. The attacker needs no physical access. A successful RCE attack can lead to data theft, malware installation, or full control of the affected server.
PHP is an open source scripting language that runs on web servers. It builds web pages on demand by processing each request, pulling data from a database, and returning finished HTML to the browser. Developers use PHP to process forms and power online stores. It also powers WordPress.
Yes. An unpatched server that runs a vulnerable PHP version can be taken over by an unauthenticated attacker through a crafted web request. Attackers have already exploited the flaws in the wild. Upgrading to a patched PHP release and fully restarting the service closes both flaws.
Yes, if the underlying PHP runtime is unpatched. The flaws sit below the CMS, so core, plugin, and theme updates do not fix them. The hosting provider, operating system package, or container image must supply a patched PHP build, followed by a full restart. CMS-level protections do not cover engine-level flaws.
Yes. Amazon honeypots logged the earliest known attempt on October 17, 2026, four days before the fix. Zscaler ThreatLabz later recorded 1,156 exploitation attempts from 156 unique IP addresses against 70 organizations in the first 48 hours after public disclosure. Successful exploitation has since appeared on honeypot servers.
CVE-2026-115560 is a separate remote code execution flaw in the session upload progress feature. Exploitation requires an application to set the serialize handler to php_binary or php_serialize in configuration, then switch handlers at runtime before calling session_start(). PHP recommends setting session.upload_progress.enabled to 0 until its next regular release.
PHP 8.5.12, 8.4.27, 8.3.36, and 8.2.35 contain the fixes. Versions 5.4 through 8.5.11 are vulnerable. PHP 8.1 and older received no official release. Source backports and vendor packages exist for 7.4, 8.0, and 8.1. Versions 5.4 through 7.3 have no fix, and every patched server needs a full restart to load the new code.
Exploitation occurs while PHP parses the request, before application code runs. Login checks, session validation, and authorization logic never execute. Application-level firewalls and plugins sit above the flaw, so they cannot reliably stop an attack that targets the runtime itself.
The attacker sends a crafted request that drives PHP past its memory limit while it parses input. PHP aborts the request with longjmp(), which skips normal cleanup and leaves structures partly initialized. Cleanup then reads that invalid data. The attacker needs no credentials, and results vary by server configuration.
A server takeover can disrupt operations and expose sensitive data. Costs come from incident response, downtime, lost customer trust, and regulatory penalties. Credentials taken from memory can extend the damage to databases and cloud services, so recovery often reaches far beyond the original server.
Start with an inventory of vendor products that bundle PHP, such as appliances, control panels, and commercial CMS platforms. Request written confirmation of the fixed PHP build and its release date from each vendor. Flag products on end-of-life branches, scan externally for vendor-managed hosts, and set contractual patch timelines.
No. WAF and IPS rules block known attack patterns, but they miss new variants and traffic that reaches the origin server directly. Virtual patching reduces risk while teams test and deploy upgrades. Only a patched PHP runtime removes the flaws.
Zero trust removes direct inbound internet access to applications. Connections run outbound to a cloud security exchange, which verifies identity and policy before allowing access. External scanners find nothing to probe. Outbound inspection can also block command-and-control traffic from a compromised host. Patching remains necessary.
Look for web server processes that spawn sh, bash, curl, or wget. Check web and temporary directories for new or modified PHP files. Review logs for memory exhaustion errors without a script reference, worker crashes, odd multipart uploads, and unexpected outbound connections. Rotate credentials that may have been in memory.