Dev.to Security 🔐 Cybersecurity 👁 0 📖 10 min read

PHP2Shell: Two Critical PHP Security Vulnerabilities Every Developer Should Know About

PHP2Shell Explained: Critical PHP RCE Vulnerabilities, Affected Versions, and How to Secure Your Server Two critical PHP vulnerabilities have put web application security in the spotlight. Here is what developers, DevO

PHP2Shell Explained: Critical PHP RCE Vulnerabilities, Affected Versions, and How to Secure Your Server

Two critical PHP vulnerabilities have put web application security in the spotlight. Here is what developers, DevOps engineers, and hosting providers need to know.

On October 21, 2026, the PHP project released security updates addressing two critical vulnerabilities identified as CVE-2026-109618 and CVE-2026-109619, collectively discussed under the name PHP2Shell.

These vulnerabilities can allow unauthenticated remote code execution (RCE) on affected PHP installations. In practical terms, a vulnerable server may process a specially crafted network request in a way that allows an attacker to execute unauthorized code.

The PHP runtime is used across a large portion of the web, making these vulnerabilities important for developers, system administrators, managed hosting providers, and organizations running PHP-based applications.

Read the full security report from Puffx Host: PHP2Shell: Critical PHP Flaw — Update Now

In this article, we will examine how PHP2Shell works at a high level, which versions are affected, how to prioritize remediation, and what you should check before considering a server secure.

1. What Is PHP2Shell?

PHP is a server-side programming language that processes application logic, interacts with databases, handles requests, and generates dynamic web pages.

It is used by popular platforms and applications, including WordPress, Drupal, and many custom PHP websites.

PHP2Shell refers to two critical vulnerabilities in the PHP runtime itself. This distinction matters because a vulnerability in the language runtime can affect multiple applications running on the same server.

The reported issues are not limited to a particular WordPress plugin or application framework. They concern the underlying PHP runtime that processes web requests.

The two vulnerabilities are:

  • CVE-2026-109618: Remote code execution associated with memory corruption during out-of-memory handling.
  • CVE-2026-109619: Remote code execution associated with stale internal state and use-after-free behavior.

Both vulnerabilities were assigned a reported CVSS v4.0 severity score of 9.2, placing them in the critical category.

Official references:

2. Why Is Remote Code Execution So Dangerous?

Remote code execution is one of the most serious classes of application security vulnerability.

Normally, a web server receives a request, processes it through the application stack, and returns a response. A runtime vulnerability can disrupt that expected process.

If an attacker successfully exploits an RCE vulnerability, the attacker may be able to execute code with the privileges of the affected server process.

Depending on those permissions and the server's configuration, potential consequences include:

  • Access to sensitive application data.
  • Unauthorized changes to website files.
  • Exposure of database credentials stored in configuration files.
  • Installation of malicious scripts or backdoors.
  • Abuse of server resources.
  • Attempts to access other services or applications available to the compromised account.

These are potential consequences of successful exploitation, not proof that every vulnerable website has been compromised.

The actual impact depends on factors such as process permissions, isolation between hosting accounts, filesystem access, application architecture, and other security controls.

3. Technical Overview: How the Two Vulnerabilities Differ

Understanding the underlying concepts helps developers understand why runtime patches are important.

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

Applications have memory limits to prevent excessive resource consumption.

PHP can interrupt request processing when a request exceeds the configured memory limit. During that interruption, internal request data may not have been fully initialized.

The reported vulnerability involves cleanup logic handling invalid or partially initialized internal data as though it were valid.

This creates an opportunity for memory corruption under the relevant conditions.

The important engineering lesson is that error handling and cleanup paths are part of the security boundary. Code that runs when an application fails must be just as carefully designed and tested as code that handles normal requests.

CVE-2026-109619: Stale Internal State

A use-after-free vulnerability occurs when software continues to use a memory reference after the memory it points to has been released.

The memory may subsequently be reused for something else. If the application continues to treat the old reference as valid, unexpected behavior can follow.

In the reported PHP2Shell issue, internal state can survive after the memory associated with it has been freed. A subsequent operation may encounter that stale state before it has been properly reinitialized.

The risk depends on the runtime configuration and the execution path involved.

These are runtime-level problems. Fixing an unrelated application bug or updating a WordPress plugin does not, by itself, repair a vulnerable PHP runtime.

4. Which PHP Versions Are Affected?

The PHP project published security releases for four branches on October 21, 2026.

PHP branch Security-fixed release
PHP 8.5 8.5.12
PHP 8.4 8.4.27
PHP 8.3 8.3.36
PHP 8.2 8.2.35

Install the appropriate patched release or a verified security-fixed package supplied by your operating system or hosting vendor.

What about PHP 8.1, 8.0, and 7.4?

Older branches require special attention because they are no longer covered by the same official release process as currently supported branches.

The PHP project has published minimal source backports for certain older branches, and some operating-system vendors provide their own security fixes. Availability depends on the specific branch and package source.

If your server runs an older version:

  1. Check whether your distribution or hosting vendor supplies a security backport.
  2. Confirm that the installed package includes the relevant fix.
  3. Plan a migration to a supported PHP branch.
  4. If you cannot mitigate the exposure promptly, restrict public access until remediation is possible.

Do not judge security solely by the displayed version number. Some vendor packages backport security patches without changing the upstream version string to the latest release number.

Reference: PHP Supported Versions

5. How to Check Your Website's PHP Version

A common mistake is checking the PHP version available in the terminal and assuming the website uses the same runtime.

That is not always true.

A server can have multiple PHP versions installed, with different versions assigned to individual domains, command-line jobs, containers, or PHP-FPM pools.

Method A: Using SSH

Run:

php -v

This shows the PHP version used by the command-line executable resolved by your shell.

You can also check which executable is being used:

which php

On Windows, the equivalent command is:

where.exe php

These commands help identify the CLI runtime, but they do not independently establish which PHP runtime is serving your website.

Method B: Using cPanel

For websites hosted through cPanel:

  1. Sign in to cPanel.
  2. Open MultiPHP Manager or Select PHP Version, depending on your configuration.
  3. Locate the domain you want to inspect.
  4. Check its assigned PHP version.
  5. Ask your hosting provider whether the actual serving runtime has received the relevant security update.

If you manage your own VPS or dedicated server, also inspect the package source, PHP-FPM pools, Apache configuration, and any containers that run PHP.

Avoid leaving a public phpinfo() page accessible on production websites. Such pages can disclose sensitive configuration details.

6. How to Patch PHP2Shell Properly

A security update is not complete merely because a package was downloaded or a version setting was changed.

You need to confirm that the running service actually uses the fixed runtime.

Step 1: Inventory your PHP installations

Identify all systems that may contain PHP, including:

  • Public-facing websites and APIs.
  • WordPress and Drupal installations.
  • cPanel and Plesk hosting accounts.
  • VPS and dedicated servers.
  • PHP-FPM and Apache mod_php deployments.
  • Containers and deployment images.
  • Third-party products and appliances that bundle PHP.
  • Development, staging, and internal applications.

Do not rely only on your main website inventory. A forgotten subdomain or an old application can still expose a vulnerable runtime.

Step 2: Prioritize internet-facing systems

Start with publicly accessible systems, particularly those running vulnerable PHP versions.

The PHP team identified Apache mod_php as a particularly high-risk configuration because a demonstrated attack path can be reached before application code executes.

Other request-serving PHP configurations—including PHP-FPM, php-cgi, FrankenPHP, and LiteSpeed—also require assessment.

Step 3: Install the correct security update

Use the package manager or trusted software distribution channel for your environment.

For example, on a Debian- or Ubuntu-based system, you can inspect installed PHP packages with:

dpkg -l | grep -E 'php[0-9.-]*'

On a compatible RPM-based system, you can inspect installed packages with:

rpm -qa | grep -i '^php'

These are inventory commands, not patching commands. The correct update procedure depends on your operating system, configured repositories, PHP installation method, and application requirements.

Do not blindly replace system PHP packages with unrelated packages from an untrusted repository.

Step 4: Restart the relevant services

After installing an update, restart or reload the relevant PHP and web server services as required by your environment.

For example, a PHP-FPM deployment may require restarting the appropriate PHP-FPM service, while an Apache deployment may require restarting Apache or its relevant PHP handler.

Service names differ between operating systems and PHP versions. Confirm the correct service before running administrative commands.

Step 5: Verify the running runtime

Check the package status and the PHP version serving the application. Verify that the appropriate fix is present and that old worker processes have been replaced.

Step 6: Test the application

Check important application functions, including:

  • Login and session handling.
  • File uploads.
  • Database connectivity.
  • API endpoints.
  • Background jobs and cron tasks.
  • Payment and checkout workflows.
  • Error logs and application performance.

A successful update should leave the application functional while ensuring the relevant security fix is active.

7. Are WordPress Websites Affected?

WordPress is written primarily in PHP, so the PHP runtime used by a WordPress website must be assessed.

Updating WordPress core, themes, or plugins is important, but those updates are not substitutes for patching the underlying PHP installation.

WordPress administrators should:

  1. Confirm the PHP version assigned to their website.
  2. Contact their hosting provider if they cannot verify the runtime.
  3. Apply a compatible security-fixed PHP package.
  4. Update WordPress core, plugins, and themes.
  5. Back up the site and database.
  6. Review logs for suspicious activity.
  7. Test the website after the change.

The same principle applies to Drupal, custom PHP applications, and other platforms that depend on PHP.

8. What If You Cannot Update Immediately?

The preferred solution is to apply the appropriate security fix.

If immediate remediation is not possible, consider temporarily isolating the affected application from public access or restricting access to trusted networks while the update is prepared.

A web application firewall may provide an additional defensive layer, but it is not a replacement for a patched runtime.

PHP's interim guidance includes configuration changes that can reduce exposure in certain circumstances. However, these measures are incomplete and must not be treated as proof that an unpatched installation is safe.

For production systems, consult the official advisory and have a qualified administrator assess the appropriate temporary controls.

9. How to Investigate a Potential Compromise

A vulnerable version does not automatically mean an attacker has compromised the server. However, an internet-facing system that remained vulnerable should be assessed carefully.

Review:

  • Web server and PHP application logs.
  • Authentication and administrative activity.
  • Unexpected files or modified application code.
  • Unknown scheduled tasks or processes.
  • Unexpected outbound network connections.
  • Changes to application configuration files.
  • Suspicious access to credentials or sensitive data.

Look for activity around the period when the system was exposed, and preserve relevant logs before making changes that could destroy evidence.

If there is credible evidence of compromise, isolate the affected system where appropriate and follow your incident-response process. Patching alone may not remove a backdoor or reverse unauthorized changes.

Do not publish sensitive logs or credentials while requesting assistance.

10. What Hosting Providers Should Do

Hosting providers have a particular responsibility because one server can serve many customer websites.

A practical response should include:

  • Inventorying affected PHP installations.
  • Identifying domains using vulnerable runtimes.
  • Updating system packages or applying verified vendor backports.
  • Restarting services and verifying loaded versions.
  • Reviewing monitoring and security logs.
  • Checking container images and bundled PHP runtimes.
  • Communicating clearly with customers.
  • Maintaining backups and incident-response procedures.

For shared hosting, customers may not have the privileges required to update the server-level PHP runtime themselves. In that situation, the provider should confirm the patch status and explain any required customer-side actions.

At Puffx Host, we encourage website owners to verify their PHP versions and work with their hosting provider to resolve any outstanding security issues.

Read our full report: PHP2Shell: Critical PHP Flaw — Update Now

11. Developer Checklist

Before closing your PHP2Shell remediation task, confirm the following:

  • [ ] All PHP installations have been inventoried.
  • [ ] Internet-facing systems have been prioritized.
  • [ ] The correct security-fixed package or verified backport has been installed.
  • [ ] PHP-FPM, Apache, or other relevant services are running the fixed code.
  • [ ] Containers and bundled PHP runtimes have been checked.
  • [ ] WordPress, plugins, frameworks, and dependencies have been reviewed.
  • [ ] Logs have been examined for signs of compromise.
  • [ ] Backups and recovery procedures have been verified.
  • [ ] Application functionality has been tested.
  • [ ] Remaining vulnerable systems have been isolated or have a documented remediation plan.

Conclusion

PHP2Shell highlights an important lesson in secure software engineering: application security depends on the entire stack, including the runtime, operating system, dependencies, and server configuration.

Developers should verify official advisories and apply the appropriate security updates. DevOps teams should inventory their infrastructure and confirm that running services use the fixed packages. Hosting providers should prioritize exposed systems and communicate clearly with customers.

Security maintenance is not a one-time task. It requires ongoing monitoring, timely updates, and a clear incident-response process.

At Puffx Host, we believe reliable hosting begins with responsible infrastructure management, security awareness, and proactive maintenance.

Keep your runtime patched. Monitor your infrastructure. Protect your applications.

Official References

  1. PHP Official Website and Security Releases
  2. PHP Supported Versions
  3. CERT-EU: Critical Vulnerabilities in PHP
  4. Canadian Centre for Cyber Security Advisory
  5. UK National Cyber Security Centre Advisory

About Puffx Host

Puffx Host provides web hosting services designed to help businesses and developers run their websites and applications.

Website: https://puffxhost.com

For security guidance and related updates, visit our PHP2Shell security article.

Editorial note: Technical details and release information in this article are based on the cited advisories available at the time of writing. Always consult the current official guidance for your specific environment.

php #security #webdev #devops

📰 Read the original article on Dev.to Security

Originally published by Dev.to Security. Aggregated on AIWithGhost for educational purposes — full credit and traffic to the original publisher.