Insights · Security

PHP2Shell: what to do if your system still runs PHP 7 or 8.1, and how to move off legacy PHP

Published

By Ithaca

On 21 October 2026, the PHP project fixed two critical flaws that can allow code to run on the server without a login. If your system runs a supported version, the path is to update today. If it runs PHP 7.4, 8.0 or 8.1, there is no official fixed version: CISA asks for those systems to be taken offline until they are fixed or upgraded, and the next choice is between a backport, a version upgrade and modernization. This article covers both situations.

The sources are the PHP project's announcement, the alerts from security agencies and the write-ups from those who took part in the discovery or monitor attacks, all with link and date. Passages are summarized from those sources. No one from Ithaca took part in discovering or fixing these flaws.

What PHP2Shell is

PHP2Shell is the nickname for two vulnerabilities in PHP itself, CVE-2026-109618 and CVE-2026-109619. The name appears in the NSA advisory of 21 October 2026, according to which the flaws are in PHP, and not in the hosted application or its configuration. According to the advisory, they can allow an attacker to take over the web server with no prior access and no authentication.

The PHP project's security advisory, of the same date, describes both:

  • CVE-2026-109618, memory corruption in out-of-memory (OOM) handling. When memory runs out, PHP can be interrupted with internal request data only partly initialized, and the request cleanup can treat that invalid data as valid.
  • CVE-2026-109619, stale global state. An internal state that belongs to one request can survive after the memory behind it has been freed. A following request, served by the same worker, can use that state before normal initialization resets it.

The Canadian Cyber Centre classifies both as use-after-free (CWE-416). In the advance notice of October 20, the PHP project gave both a score of 9.2 on the CVSS v4.0 scale.

Who is affected

According to the PHP project, every installation that serves web requests is at risk, including PHP-FPM, Apache with mod_php, php-cgi, FrankenPHP and LiteSpeed. The risk is highest with mod_php: there is a demonstrated exploit in which an unauthenticated request triggers the attack before any application code runs. The PHP Foundation adds that, with PHP-FPM, remote execution was confirmed through paths that go through the application code.

Three practical consequences:

  • Well-written code is not enough. The flaw is in the language engine. Wiz, which demonstrated the attack on WordPress, Drupal and Joomla, states that even a "Hello World" application on an affected version can be vulnerable.
  • PHP 8.1 and earlier are affected too, and the PHP project no longer publishes releases for them. CERT-EU puts those end-of-life branches on its list of affected products. According to Wiz, versions going back to PHP 5.4 have at least one of the problems.
  • PHP may be where nobody is looking. NCSC-NL points out that PHP comes embedded in appliances, network equipment, management interfaces and third-party products, where the administrator may not be able to update PHP directly.

On the 21st, CERT-EU reported proofs of concept in circulation. CISA and the Cyber Centre said they had not observed active exploitation as of the alerts' publication, and the Cyber Centre warned that this could change quickly. The same day, Amazon reported exploitation attempts against its decoy sensors (honeypots) since October 17, four days before the announcement, and wrote that, after the fix, the flaw began to be exploited at scale. Amazon itself says it was not clear whether the attempts before the announcement would have succeeded against a real system.

How to check the PHP version

  • In the server terminal: php -v shows the version of the command-line PHP, as the PHP manual describes. The manual shows that the output also includes the SAPI, cli in the example. To know the version that serves the site, check through the web server as well.
  • Through the web server: a file with <?php phpinfo(); shows the version and configuration of the PHP that serves the site. Delete the file right afterwards: according to the manual, the page lists compile options, extensions, environment, configuration and HTTP headers, and that should not stay public.
  • In the hosting control panel: on shared hosting, look for the PHP version in the control panel or ask support which version serves your site and when the fixed package goes in.
  • In WordPress: the Tools > Site Health > Info screen, Server section, shows the server configuration, and the Status tab warns when the site runs an outdated version of PHP, according to the WordPress documentation.

If PHP came from a Linux distribution package, do not stop at the version number. According to the PHP project, distributions and extended support (LTS) vendors received the fixes before the announcement, and they are the ones who confirm the fixed package. Check your vendor's security advisory.

Which versions are fixed

BranchFixed versionPHP project security support
8.58.5.12until Dec. 31, 2029
8.48.4.27until Dec. 31, 2028
8.38.3.36until Dec. 31, 2027
8.28.2.35until Dec. 31, 2026
8.1, 8.0 and 7.4no official release; minimal source backportended Dec. 31, 2025, Nov. 26, 2023 and Nov. 28, 2022

The fixed versions came out on 21 October 2026. The deadlines come from the PHP project's supported versions and unsupported branches pages. 8.2.35 fixes PHP2Shell, but the 8.2 branch leaves support on 31 December 2026. In our reading, moving up to 8.2 now buys little time, and anyone who can should aim for 8.3 or a newer version.

Users of the volunteer repository rpms.remirepo.net should switch to the distribution's packages or build from source, the PHP project asks, because the repository would not have an update on the day of the announcement.

What to do if you cannot update today

Only the update fixes it. In the PHP project's words, the measures below reduce exposure to specific attack paths, but do not make the installation safe.

  • Inventory first. The NSA, CISA and NCSC-NL ask for the same start: list everything that runs PHP, beginning with what is exposed to the internet, including third-party products, appliances and container images.
  • Take offline or isolate. The NSA says that, if an immediate update is not feasible, the system should be taken offline until it is fully mitigated. CISA asks the same of anyone who cannot update right away or is still on PHP 8.1 or earlier: take PHP systems offline until they are fixed or upgraded. CERT-EU and the Cyber Centre speak of isolating exposed applications from the public network until the fix.
  • Vendor backport. For PHP 8.1 and earlier, distributions and LTS vendors offer backported fixes. The PHP project published minimal source backports for 7.4, 8.0 and 8.1, for those who build PHP themselves or have no LTS vendor.
  • PHP configuration changes. The announcement lists measures for each flaw, among them memory_limit=-1, preferably set in a way the application cannot change and with a memory limit on the container or the cgroup, a low post_max_size and session.upload_progress.enabled=0 with a restart of all workers. It also says where to apply each one and what not to use instead. Each measure blocks only attack paths already confirmed. Apply them from the text of the announcement, not from a summary.
  • Limits on the web server, the proxy or the WAF. The PHP project suggests limiting, on the web server or the proxy, the size of the decoded request, the number of fields, multipart parts and headers, and the nesting depth. CISA says a WAF can offer some protection until the update. According to BleepingComputer, Cloudflare published WAF rules for the known attack methods and called those protections temporary.
  • More logging and more attention. The NSA asks for enhanced logging in the environment. The Cyber Centre asks for a review of web server, application, authentication and endpoint logs, and for investigation of unexpected processes, commands, files, accounts or outbound connections tied to PHP. Wiz points to unusual multipart requests followed by memory limit errors or repeated HTTP 500 responses, and large or malformed PHPSESSID cookies, as signs. CISA asks for attention to PHP workers that open shells or download tools, and Amazon suggests starting the investigation on October 17, not on the date of the announcement.

Stuck on an unsupported version: backport, upgrade or modernization

Among its measures, the NSA includes replacing end-of-life PHP services, which will not be compatible with the fix. For anyone running 7.4, 8.0 or 8.1, this week's urgency hides a bigger decision. There are three paths, and they can be combined.

PathWhat it isForAgainst
BackportApply the fix to the old PHP, through an LTS vendor's package or the PHP project's minimal backportFast; the application code does not changeThe branch is still unsupported by the project; the next flaw calls for another backport; the minimal backport requires building PHP
Version upgradeMove the application to 8.3 or a newer versionOfficial fixes again, for this flaw and the next ones, within the support windowRuns into dependencies, removed extensions and missing tests; the timeline depends on the size of the system and the test coverage
ModernizationReplace the system in parts, with the new built alongside the oldTackles the debt that kept the system on the old version; each new part starts on a supported version and with testsIt is the longest path and, on its own, does not solve this week's urgency

In our reading, the order that makes sense is to close this week's door first (backport, isolation or, as CISA asks for unsupported versions, taking the system offline) and do the upgrade or the modernization next, so as not to depend on a backport for the next flaw. Lift and shift on its own is not on the list: moving the system to another server without changing the application does not change the code that ties the system to the old version (lift and shift vs modernization).

Why "just update PHP" stalls on legacy code

  • Removed extensions and functions. PHP 7.0 removed extensions such as mysql and ereg, according to the PHP manual. PHP 8.0 removed functions such as each() and create_function() and changed other behaviors, listed in the backward incompatible changes in PHP 8.0. Anyone on 7.4 still has that step ahead.
  • Dependencies. Before the upgrade, check which PHP versions the framework and each library accept. If one of them only runs on the old version, the PHP upgrade now includes upgrading it too, with whatever API changes come along.
  • Missing tests. Without tests that pin down the current behavior, there is no way to confirm before the deploy what the upgrade changed. That is why, in the modernization guide, the step that comes before touching anything is pinning down the current behavior with characterization tests.
  • Concentrated knowledge. When only one or two people know why each part exists, the upgrade waits on their calendar (developer shortage for old systems).

The PHP project itself went through this. According to the PHP Foundation, the first signs of the problem behind CVE-2026-109618 appeared in 2024, during an external audit, and the fix stalled and restarted for months because each solution brought a side effect: a compatibility break, a new denial-of-service risk or a change in third-party extensions. The foundation calls the delay a structural failure. In our reading, it is the same mechanism as technical debt in legacy systems: every fix option had a cost, and the decision kept getting pushed back (what a legacy system is and the cost of technical debt).

What AI changed in this story

According to Wiz, frontier AI models helped find the flaws and made it practical to build exploits that work against different targets. Wiz's write-up says that, with these models and the right tools, one researcher did in a week what used to take months of work by a top-tier team. The PHP Foundation tells the other part: Calif and OpenAI reported the same root problem on August 11, Wiz sent further attack vectors on August 24, and AI-assisted research also increased the volume of reports the PHP security team receives. AI helps validate and group reports, but, according to the foundation, a person decides each case and works on each fix.

In our reading, what changes for anyone with legacy code is the attacker's cost. An old flaw that was hard to exploit was protected, in practice, by that very difficulty, and Wiz writes that this complexity may stop being a barrier. That does not mean every old system will be attacked tomorrow. It means that putting off the update has become more expensive.

The other side holds too. The same tools that read old code looking for flaws can also be used to document business rules, write tests and replace the system in parts. The difference lies in who supervises and in what gets recorded (only approve what you can explain and security for AI coding agents).

Where the platform comes in

Ithaca's agentic development platform handles legacy system modernization at autonomy level 4: the coding agents read the current system, write tests that pin down what it does today and build each new part, and the team decides the order and reads what goes to production. Every session is recorded. The method for systems that cannot stop is in legacy system modernization with AI, without stopping the business.

This does not replace this week's fix. For PHP2Shell, the path is the one in this article: update, apply the backport or isolate.

If the system is stuck on an unsupported version and every update feels like a project of its own, the next step is a free assessment, in which the agents read the system with your team. PHP refactors have already been delivered with the platform. Documenting the rules and writing tests come afterwards, if the decision is to go ahead. Request a free assessment

Frequently asked questions

What is PHP2Shell?

It is the nickname for two critical vulnerabilities in PHP itself, CVE-2026-109618 and CVE-2026-109619, fixed on 21 October 2026. According to the PHP project, they can allow unauthenticated remote code execution on installations that serve web requests. Both score 9.2 on the CVSS v4.0 scale.

How do I check my site's PHP version?

On the server, the php -v command shows the version of the command-line PHP. To see the version that serves the site, use a file with phpinfo() and delete the file right afterwards, or check the hosting control panel. In WordPress, the Tools > Site Health screen shows the server configuration. If PHP comes from a Linux distribution package, also check the vendor's security advisory.

Which PHP versions fix PHP2Shell?

PHP 8.5.12, 8.4.27, 8.3.36 and 8.2.35, released on 21 October 2026. According to the PHP project, the 8.2 branch leaves security support on 31 December 2026, and 8.3 receives fixes until 31 December 2027.

My system runs PHP 7.4, 8.0 or 8.1. Is it affected?

Yes. The PHP project no longer publishes releases for 8.1 and earlier, and CERT-EU includes those branches in its list of affected products. There are three ways out: a package with a backported fix from a distribution or an LTS vendor, the minimal source backport the PHP project published for 7.4, 8.0 and 8.1, or an upgrade to a supported version. If none of these is possible right now, the NSA and CISA advise taking the system offline until it is fixed.

My site runs WordPress. Does updating WordPress and the plugins fix it?

No. The flaw is in PHP, not in the application. The NSA says the flaws are not in the hosted application or its configuration, and Wiz demonstrated the attack on WordPress, Drupal and Joomla. The fix is the PHP update, done by the hosting provider or by whoever administers the server.

Does a WAF fix PHP2Shell?

It helps, but it does not fix it. According to CISA, a WAF can offer some protection until the update, and Cloudflare, according to BleepingComputer, called its rules temporary. The PHP project states that only the update is a complete fix; the other measures reduce exposure without making the installation safe.

Why does updating the PHP version sometimes break the system?

Because new versions remove or change parts of the language. PHP 7.0 removed extensions such as mysql and ereg, and PHP 8.0 removed functions such as each() and create_function(). It is also necessary to check whether the framework and the libraries accept the new version. Without tests that pin down the current behavior, there is no way to confirm before the deploy what changed. That is why upgrading legacy code starts with characterization tests.

Was PHP2Shell discovered by AI?

In part. Wiz says frontier AI models helped find the flaws and build the exploits. The PHP Foundation says the first signs of the root problem appeared in 2024, in an external audit, and that Calif, OpenAI and Wiz reported the problem and attack vectors between August and September 2026. According to the foundation, AI also helps the PHP team validate reports, with a person deciding each case.

Is it worth rewriting the system from scratch instead of updating PHP?

In our reading, rarely all at once. Rewriting everything at once takes time and risks losing rules that only the old system knows. Replacing it in parts, with the new built alongside the old and each part covered by tests, reduces the risk of each step. For PHP2Shell, the fix or the isolation comes first; modernization is the next decision.

Sources

Start with what weighs most on your backlog.

Tell us what is stuck. After the NDA and access to the code, the agents read the system with your team and show where to start.

Phone is optional. How we use your data, including to measure our ads: Privacy policy.