---
title: "PHP2Shell vulnerability: A review and patching guide for businesses"
description: PHP2Shell allows unauthenticated remote code execution in PHP. Check which versions need patching, how to upgrade, and how to protect your website today.
slug: lo-hong-php-php2shell
type: news
locale: en-US
author: Martha Tran
date: "2026-10-23T08:22:57.143Z"
lastmod: "2026-10-23T08:22:57.042Z"
thumbnail: "https://static.vncdn.vn/vnetwork.vn/pub/websites/uploads/1/96/php2shell_thumb.png"
sabo: On October 21, 2026, the PHP development team disclosed two critical vulnerabilities, collectively known as PHP2Shell, that allow attackers to execute code on web servers without authentication. Because the flaws reside in the PHP core itself, updating website source code or plugins is not enough to fix them. This article explains how severe this PHP vulnerability is, which systems need to be reviewed, the detailed patching steps, and the protective layers businesses need while waiting to update.
---

<h2><strong>1. What is the PHP2Shell vulnerability?</strong></h2><p>PHP2Shell is the collective name for two critical vulnerabilities, tracked as CVE-2026-109618 and CVE-2026-109619, which the PHP development team disclosed together with patches on October 21, 2026. Both are memory corruption bugs located in the core of the PHP interpreter. They are independent of each other, yet they can complement one another.</p><p>Notably, PHP2Shell is not an application layer flaw like common&nbsp;<a href="https://www.vnetwork.vn/en-US/news/bao-mat-trang-web/">web security vulnerabilities</a> such as&nbsp;<a href="https://www.vnetwork.vn/en-US/news/chong-tan-cong-sql-injection/">SQL injection</a>,&nbsp;<a href="https://www.vnetwork.vn/en-US/news/tan-cong-xss-la-gi/">XSS</a> or the issues on the&nbsp;<a href="https://www.vnetwork.vn/en-US/news/top-10-lo-hong-owasp-va-cach-bao-ve-webapp-2022/">OWASP Top 10</a> list. The vulnerabilities do not live in frameworks or content management systems (CMS) such as WordPress, Laravel or Drupal, but in the PHP software that runs those applications. As a result, every website running on PHP needs to be reviewed, regardless of the platform a business uses.</p><p>According to the PHP development team, both vulnerabilities scored 9.2 on the CVSS v4.0 scale, which rates vulnerability severity up to a maximum of 10. The flaws were discovered by researchers with the help of artificial intelligence (AI) tools and were reported to the PHP development team before public disclosure.</p><figure class="table" style="width:100%;"><table class="ck-table-resized"><colgroup><col style="width:23.32%;"><col style="width:53.56%;"><col style="width:23.12%;"></colgroup><thead><tr><th><strong>Vulnerability ID</strong></th><th><strong>Description</strong></th><th><strong>Severity</strong></th></tr></thead><tbody><tr><td>CVE-2026-109618</td><td>RCE via memory corruption during OOM handling</td><td>Critical, CVSS 9.2</td></tr><tr><td>CVE-2026-109619</td><td>RCE via global state persisting across requests</td><td>Critical, CVSS 9.2</td></tr></tbody></table></figure><h2><strong>2. How the PHP2Shell vulnerability works</strong></h2><p>Both PHP2Shell vulnerabilities exploit the way PHP manages memory when request processing is interrupted, but they differ in when the unsafe memory region is accessed.</p><h3><strong>2.1 CVE-2026-109618: Remote code execution (RCE) via memory corruption during OOM handling</strong></h3><p>CVE-2026-109618 stems from how PHP handles out-of-memory conditions. PHP uses the memory_limit directive to cap the memory available to each request. When that limit is exceeded, PHP raises an out-of-memory (OOM) error and halts processing immediately, skipping its normal resource cleanup routine.</p><p>An attacker sends a specially crafted multipart/form-data request containing many nested parts to trigger an OOM error at the exact moment PHP is parsing the request and its internal data is only partially initialized. The cleanup process may then treat this incomplete data as valid, corrupting the heap memory of the process. Apache mod_php shares memory space with the Apache process, which makes it easier to exploit, while PHP-FPM is still affected but slightly more complex to exploit.</p><h3><strong>2.2 CVE-2026-109619: Remote code execution (RCE) via global state persisting across requests</strong></h3><p>While CVE-2026-109618 strikes when PHP runs out of memory, CVE-2026-109619 takes advantage of long-lived PHP-FPM workers that handle many consecutive requests. In the first malicious request, the payload triggers a fatal error in the multipart parser, causing PHP to free certain memory regions while still holding pointers to them.</p><p>When a second malicious request reaches the same worker, PHP may reuse these stale pointers before its state is reinitialized, resulting in a use-after-free condition. By controlling the memory layout, an attacker can overwrite internal function pointers and execute arbitrary code within the PHP process.</p><h2><strong>3. How dangerous is the PHP2Shell vulnerability?</strong></h2><p>PHP2Shell is rated critical because it allows attackers to remotely execute arbitrary code on a target server without authentication, credentials, session cookies, tokens or any flaw in the web application itself.</p><h3><strong>3.1 Consequences of successful exploitation</strong></h3><p>Once exploitation succeeds, an attacker can run operating system commands with the privileges of the PHP process and then:</p><ul><li>Upload a webshell and install a backdoor to maintain long-term access.</li><li>Read configuration files containing database credentials, API keys and other secrets.</li><li>Extract data from the application database, causing a&nbsp;<a href="https://www.vnetwork.vn/en-US/news/data-breach-la-gi/">data breach</a>.</li><li>Install cryptocurrency mining&nbsp;<a href="https://www.vnetwork.vn/en-US/news/malware-la-gi/">malware</a> or&nbsp;<a href="https://www.vnetwork.vn/en-US/news/6-loai-hinh-ransomware-pho-bien-doanh-nghiep-can-biet-nam-2024/">ransomware</a>.</li><li>Move laterally to attack other servers on the internal network.</li><li>Deface the website and tamper with data.</li></ul><h3><strong>3.2 Websites without file upload features can still be attacked</strong></h3><p>PHP2Shell is exploited while PHP parses the body of multipart/form-data HTTP requests, even before any PHP application code is executed. A website does not need a file upload feature. As long as the PHP SAPI accepts multipart/form-data POST requests, the service is exposed. Conversely, ordinary GET requests cannot trigger either vulnerability.</p><h3><strong>3.3 Exploitation status after disclosure</strong></h3><p>According to the PHP Foundation, remote code execution has been demonstrated on Apache mod_php with its default configuration, and proof-of-concept exploit code appeared publicly on the day of disclosure. The severity led many government agencies around the world to temporarily take their websites offline as a precaution. In Vietnam, the Department of Cybersecurity and the National Cybersecurity Association have advised organizations and businesses running PHP websites to review their systems and apply the patches promptly.</p><h2><strong>4. Which businesses need to review this PHP vulnerability?</strong></h2><p>Businesses need to review their exposure to PHP2Shell if they operate websites, portals or internal systems running an unpatched version of PHP. The level of impact depends on how PHP is deployed on the&nbsp;<a href="https://www.vnetwork.vn/en-US/news/server-la-gi/">server</a> through its SAPI and on the PHP version branch in use.</p><h3><strong>4.1 Affected SAPIs</strong></h3><p>The SAPI (Server API) is the interface layer between PHP and the web server. The following SAPIs are all affected by PHP2Shell:</p><ul><li>PHP-FPM</li><li>Apache mod_php (highest risk for CVE-2026-109618)</li><li>php-cgi</li><li>FrankenPHP</li><li>LiteSpeed SAPI</li></ul><h3><strong>4.2 Affected and patched versions</strong></h3><p>The PHP development team has released patches for all four supported branches. Businesses should check the PHP branch they use against the table below to determine which version to upgrade to:</p><figure class="table"><table class="ck-table-resized"><colgroup><col style="width:33.33%;"><col style="width:33.33%;"><col style="width:33.34%;"></colgroup><thead><tr><th><strong>PHP branch</strong></th><th><strong>Affected if lower than</strong></th><th><strong>Patched version</strong></th></tr></thead><tbody><tr><td>8.2.x</td><td>&lt; 8.2.35</td><td>8.2.35</td></tr><tr><td>8.3.x</td><td>&lt; 8.3.36</td><td>8.3.36</td></tr><tr><td>8.4.x</td><td>&lt; 8.4.27</td><td>8.4.27</td></tr><tr><td>8.5.x</td><td>&lt; 8.5.12</td><td>8.5.12</td></tr></tbody></table></figure><h3><strong>4.3 End-of-life PHP branches</strong></h3><p>End-of-life PHP branches (5.x, 7.x, 8.0 and 8.1) do not receive official patches. Businesses running these branches must migrate to PHP 8.2 or later, which are still supported.</p><p>Given the severity of the vulnerabilities, the PHP security team has provided minimal source-level fixes for PHP 7.4, 8.0 and 8.1, and several Linux distributions and long-term support (LTS) vendors have also released updated packages for these branches. These are only stopgap measures while preparing to upgrade. In addition, PHP 8.2 reaches end of life on December 31, 2026, so businesses on this branch should also plan an early move to a newer version.</p><h3><strong>4.4 Websites on hosting services</strong></h3><p>For websites on a&nbsp;<a href="https://www.vnetwork.vn/en-US/news/hosting-la-gi/">hosting</a> service, the PHP version is usually managed by the provider. Businesses should contact their hosting provider to confirm the PHP version in use and the patch status of the server.</p><h2><strong>5. How to fix the PHP2Shell vulnerability</strong></h2><p>The definitive fix, and the only fully effective one, is to upgrade PHP to a patched version and then restart the PHP service. The PHP development team has also stated that no mitigation is complete and that updating is the only safe option.</p><h3><strong>5.1 Official patch information</strong></h3><ul><li>The patches were released at 14:00 UTC on October 21, 2026 (21:00 Vietnam time), ahead of the original schedule of October 22. Before that, the CVE IDs of both vulnerabilities had leaked on the afternoon of October 20.</li><li>The official CVSS score of both vulnerabilities is 9.2. According to the PHP Foundation, the 10.0 score circulating in the leaked information is inaccurate.</li><li>Linux distributions and LTS vendors received the patches before disclosure, so businesses can check for updated packages from their operating system vendor.</li><li>Source code and Windows builds are available on the official PHP download page.</li></ul><h4><strong>Step 1: Upgrade PHP packages to a patched version</strong></h4><p>Upgrade the PHP packages to the safe version that matches the PHP branch installed on the server, as listed in the version table above.</p><h4><strong>Step 2: Restart the PHP service</strong></h4><p>After upgrading, you must restart the PHP service (php-fpm or Apache). Updating RPM/DEB packages does not automatically stop running PHP worker processes. The old binary remains in memory, so the vulnerability persists until the service is restarted.</p><h4><strong>Step 3: Verify the version</strong></h4><p>After restarting, check the PHP and PHP-FPM versions to confirm the system is running the patched build. Note that some Linux distributions, such as Ubuntu, backport fixes to the released version and keep the original version number, so php -v may still show the old number even though the package has been updated. In this case, compare the installed package version against the security advisory of that distribution. If you use a third-party repository and the version has not changed after updating, the repository may not have the new release yet; in that case, switch to the distribution packages or build from source.</p><h3><strong>5.2 Upgrade commands by operating system</strong></h3><h4><strong>Debian 12 / Debian 13</strong></h4><pre><code class="language-plaintext"># update the repository index
apt update
# upgrade all php8.2 packages
apt install php8.2-fpm php8.2-cli php8.2-{bz2,curl,gd,intl,mbstring,mysql,opcache,xml,zip}
# restart php-fpm
systemctl restart php8.2-fpm
# check the version
php8.2 -v
php-fpm8.2 -v</code></pre><p>If you are using php8.3 or php8.4, replace "8.2" in the commands above with the specific PHP version running on your server.</p><h4><strong>Ubuntu 22.04 / 24.04</strong></h4><pre><code class="language-plaintext">apt update
apt install php8.2-fpm php8.2-cli php8.2-{bz2,curl,gd,intl,mbstring,mysql,opcache,xml,zip}
systemctl restart php8.2-fpm
php8.2 -v
php-fpm8.2 -v</code></pre><h4><strong>Rocky Linux 9 (Remi PHP repository)</strong></h4><pre><code class="language-plaintext"># update the php packages
dnf update php php-fpm php-bz2 php-curl php-gd php-intl php-mbstring php-mysqlnd php-opcache php-xml php-zip
# restart the service
systemctl restart php-fpm
# check the version
php -v
php-fpm -v</code></pre><h2><strong>6. Temporary mitigations on the server</strong></h2><p>If PHP cannot be upgraded right away, businesses can apply temporary mitigations on the server. These measures make exploitation harder but can still be bypassed by skilled attackers, so they only reduce risk and cannot replace patching:</p><ul><li>WAF rules: Block POST requests with&nbsp;<i>Content-Type:</i>&nbsp;<i><strong>multipart/form-data</strong></i> that have excessively nested structures, too many parts or abnormally large form fields.</li><li>INI setting:&nbsp;<i><strong>session.upload_progress.enabled = Off</strong></i>, which removes a common technique used for heap shaping in exploitation attacks.</li><li>Run PHP worker processes under a dedicated user without administrative privileges. Never run PHP as root.</li><li>Tune the&nbsp;<i><strong>memory_limit</strong></i> parameter appropriately to make out-of-memory (OOM) conditions harder to trigger without affecting normal application behavior.</li><li>Network ACL: Restrict the source IP addresses that can reach the web port if public access is not required.</li><li>Enable full access logging and monitor for abnormal multipart POST traffic.</li></ul><h2><strong>7. The role of a WAF while waiting to patch PHP</strong></h2><p>A web application firewall (<a href="https://www.vnetwork.vn/en-US/news/waf-la-gi/">WAF</a>) operates at&nbsp;<a href="https://www.vnetwork.vn/en-US/news/layer-7-la-gi/">Layer 7</a> of the&nbsp;<a href="https://www.vnetwork.vn/en-US/news/mo-hinh-osi-la-gi/">OSI model</a> and can block multipart/form-data POST requests with excessively nested structures, too many parts or abnormal fields before they reach the server. The Department of Cybersecurity and the National Cybersecurity Association note that a well-configured WAF significantly reduces the likelihood of attack, giving businesses more time to roll out patches safely as part of a&nbsp;<a href="https://www.vnetwork.vn/en-US/news/defense-in-depth/">Defense in Depth</a> strategy.</p><p>VNIS (VNETWORK Internet Security) is the VNETWORK security and acceleration platform for Web/App/API, providing real-time protection against multi-layer&nbsp;<a href="https://www.vnetwork.vn/en-US/news/ddos-la-gi-va-cach-ngan-chan-cac-loai-tan-cong-ddos-server/">DDoS</a> attacks, malicious bots and vulnerability exploits, including&nbsp;<a href="https://www.vnetwork.vn/en-US/news/lo-hong-zero-day-la-gi-cac-cach-bao-ve-toi-uu-truoc-lo-hong-zero-day/">zero-day</a> vulnerabilities. The platform uses AI to detect abnormal behavior early while maintaining performance and user experience.</p><h3><strong>7.1 The two-layer protection model of VNIS</strong></h3><p>VNIS protects business systems through two layers, handling attacks from the network infrastructure layer up to the application layer:</p><ul><li><strong>Infrastructure layer protection:</strong> VNIS combines AI Smart&nbsp;<a href="https://www.vnetwork.vn/en-US/news/load-balancing-la-gi/">Load Balancing</a> and Multi-CDN to handle network layer DDoS attacks. AI automatically analyzes access behavior, distributes traffic efficiently and filters out abnormal traffic sources before they overload the system.</li><li><strong>Application layer protection:</strong> VNIS deploys AI-powered&nbsp;<a href="https://www.vnetwork.vn/en-US/news/waap-la-gi-uu-diem-vuot-troi-cua-waap/">WAAP</a> (Web Application and API Protection) to stop Layer 7 DDoS attacks, malicious bots and common vulnerabilities on the OWASP Top 10 list. This layer directly protects the processing logic of Web/App/API, which is often exploited in depth and difficult to detect.</li></ul><figure class="image"><img style="aspect-ratio:2640/1485;" src="https://static.vncdn.vn/vnetwork.vn/pub/websites/uploads/1/61/ddos là gì 3.png" alt="The two-layer protection model of VNIS" width="2640" height="1485"><figcaption>The two-layer protection model of VNIS</figcaption></figure><h3><strong>7.2 Key features of VNIS</strong></h3><ul><li>Real-time detection and mitigation of multi-layer DDoS attacks (Layer 3/4/7).</li><li>WAAP with an integrated&nbsp;<a href="https://www.vnetwork.vn/en-US/news/ai-waf/">AI WAF</a> and continuously updated security rules that automatically filter and block vulnerability exploits.</li><li>Access behavior monitoring and real-time log analysis to detect abnormal traffic.</li><li>Global Multi-CDN that keeps websites fast and stable even under attack.</li><li>A 24/7 SOC team that helps businesses respond quickly to incidents.</li></ul><h2><strong>8. Conclusion</strong></h2><p>PHP2Shell shows that risk can sit at the platform layer, an area businesses often overlook when reviewing website security. The three priorities right now are upgrading PHP to a patched version, restarting services so the patch takes effect, and adding a WAF layer to reduce risk during the rollout. If your business needs advice on protecting its websites and Web/App/API systems against new vulnerabilities, the VNETWORK team of experts is ready to help.</p><h2><strong>FAQ: Frequently asked questions about the PHP2Shell vulnerability</strong></h2><h3><strong>1. Are WordPress websites affected by the PHP2Shell vulnerability?</strong></h3><p>Yes, if the server running WordPress uses an unpatched version of PHP. The vulnerability resides in the core of the PHP interpreter, not in WordPress, so updating WordPress, themes or plugins will not fix it. Businesses need to upgrade the PHP software on the server itself.</p><h3><strong>2. Are websites without a file upload feature safe from the PHP2Shell vulnerability?</strong></h3><p>No. The vulnerability is triggered when PHP parses multipart/form-data POST requests, before any application code is executed. As long as the PHP SAPI accepts this type of request, the website is exposed, even without a file upload feature.</p><h3><strong>3. Why can a server still be exploited after the PHP packages have been updated?</strong></h3><p>Updating RPM/DEB packages does not automatically stop running PHP worker processes. The old binary remains in memory until the php-fpm or Apache service is restarted, so the vulnerability persists if this step is skipped.</p><h3><strong>4. How should the PHP2Shell vulnerability be handled on PHP 7.4 or 8.1?</strong></h3><p>PHP 7.x, 8.0 and 8.1 have reached end of life and do not receive official patches, so businesses need to migrate to PHP 8.2 or later. While preparing to upgrade, they can use the source-level fixes provided by the PHP security team or updated packages from long-term support vendors, combined with temporary mitigations and a WAF.</p><h3><strong>5. Can a WAF replace patching the PHP vulnerability?</strong></h3><p>No. A WAF helps block known exploit requests and significantly reduces the likelihood of attack, but it can still be bypassed by new exploit variants. Upgrading PHP to a patched version remains the only way to fix the vulnerability completely.</p>
