Journal

PHP Vulnerabilities: PHP2Shell and How to Fix Them

PHP Vulnerabilities: PHP2Shell (CVE-2026-109618 and CVE-2026-109619) and How to Fix Them

Introduction

PHP vulnerabilities can put websites at risk by allowing attackers to exploit security weaknesses. PHP2Shell is a serious security concern linked to CVE-2026-109618 and CVE-2026-109619. Therefore, website owners should check their PHP versions and install the appropriate security updates to protect their websites.

These vulnerabilities are identified as CVE-2026-109618 and CVE-2026-109619. They can allow attackers to execute unauthorized code on affected servers. Therefore, website owners, developers, and system administrators should understand these php vulnerabilities and take appropriate action.

In this guide, you will learn whatPHP2Shell is, which PHP versions are affected, how to check your current version, and how to protect your website. Most importantly, you will discover why installing the correct security updates is essential.

What Is PHP2Shell?

PHP2Shell is the name associated with two critical vulnerabilities in the PHP programming language. Both flaws involve problems with memory handling during request processing. Consequently, an attacker may be able to exploit a vulnerable server and execute unauthorized code remotely.

CVE-2026-109618: Out of Memory Corruption

This vulnerability involves PHP handling an out of memory error incorrectly. In certain situations, PHP may interrupt request processing while internal data is only partially initialized. As a result, later processing may handle invalid data and create an opportunity for remote code execution.

CVE-2026-109619: Stale Global State

This vulnerability involves internal state that may continue to reference memory after that memory has been released. Consequently, a later request handled by the same worker may use outdated information before the state is properly initialized.

Both issues are serious because successful exploitation may compromise a server. Therefore, administrators should install the appropriate security patches instead of relying only on temporary workarounds.

Which PHP Versions Are Affected?

Understanding your PHP version is the first step toward protecting your website. According to the official security advisory, affected versions include releases before the following patched versions.

  • PHP 8.5: Update to 8.5.12 or later.

  • PHP 8.4: Update to 8.4.27 or later.

  • PHP 8.3: Update to 8.3.36 or later.

  • PHP 8.2: Update to 8.2.35 or later.

PHP 8.1 and older branches also require attention because they no longer receive regular security fixes from the main PHP project. However, some operating system vendors provide backported patches for older versions.

Therefore, check your hosting provider's security advisory before deciding whether your installation is protected. Whenever possible, move to a supported PHP release.

How to Check Your Current PHP Version

Before installing an update, identify the PHP version your website actually uses. You can check it through the command line or your hosting control panel.

Method 1: Use the Command Line

If you have terminal or SSH access, run this command:

php -v

The output displays the PHP version available through the command line. However, your website may use a different PHP installation. Therefore, confirm the version configured for your web server or PHP-FPM service as well.

Method 2: Check Your Hosting Control Panel

Many hosting providers display the PHP version in their control panels.

First, log in to your hosting account. Next, open the PHP settings or software section. Finally, check which version is assigned to your website.

If you use cPanel, Plesk, or another hosting platform, follow its official instructions to identify and update the correct PHP version.

Method 3: Use a Temporary PHP Information File

If necessary, an administrator can create a temporary PHP file containing this code:

<?php

phpinfo();

?>

Place the file in the appropriate website directory and open it in a browser to inspect the PHP configuration.

However, this method can expose sensitive configuration information. Therefore, restrict access to the file and remove it immediately after checking. Never leave a publicly accessible PHP information page on a production website.

How to Fix PHP2Shell Vulnerabilities

Fixing php vulnerabilities requires timely security updates, careful testing, and ongoing monitoring. Follow these steps to reduce the risk of compromise.

1. Update PHP to a Patched Release

First, identify the PHP version used by your website. Then, install the appropriate patched release through your hosting provider or operating system's supported package repository.

For the main release branches, the patched versions are PHP 8.5.12, 8.4.27, 8.3.36, and 8.2.35.

However, selecting a newer version in your control panel does not always complete the process. Confirm that the running web server and PHP workers are using the updated installation. If necessary, restart the relevant services according to your provider's instructions.

2. Test Your Website After Updating

PHP updates can affect older applications, themes, and plugins. Therefore, test the update in a staging environment whenever possible.

Check important website functions, including login forms, contact forms, database connections, and checkout processes. In addition, review application logs for unexpected errors.

Once testing is complete, deploy the update to your live website and confirm that the patched PHP version is active.

3. Use a Web Application Firewall

A Web Application Firewall, or WAF, can help filter malicious web requests before they reach your application.

Furthermore, a properly configured WAF may reduce exposure to certain attack patterns. However, it cannot correct the underlying PHP vulnerabilities. Therefore, use it as an additional security layer rather than a replacement for patching.

4. Review PHP Configuration Settings

Some administrators restrict functions such as exec, shell_exec, system, and passthru when their applications do not need them.

These restrictions may reduce certain risks. However, they do not provide a complete fix for PHP2Shell because the vulnerabilities involve PHP's internal request handling.

Therefore, review your application's requirements before changing the disable_functions setting in php.ini. Test any changes carefully to avoid breaking legitimate website functionality.

5. Monitor Logs and Review Security

After updating PHP, review your web server, application, and system logs for unusual activity. For example, investigate unexpected requests, unfamiliar file changes, suspicious processes, or unexplained errors.

In addition, keep your content management system, plugins, themes, and server software updated. Regular security reviews help you identify other weaknesses before they become serious problems.

If you suspect that an attacker has already compromised your server, follow your incident response procedures. Isolate affected systems when appropriate, preserve relevant logs, investigate the breach, and restore services only after addressing the cause.

How to Protect Your Website From Future PHP Vulnerabilities

Although PHP2Shell requires immediate attention, ongoing security practices are equally important. A consistent maintenance routine can help prevent future problems.

Keep Software Updated

Install security updates for PHP, your operating system, your content management system, and other server components. Moreover, subscribe to official security announcements so you can respond quickly when new issues emerge.

Remove Unsupported Software

Older PHP versions and abandoned plugins may no longer receive security fixes. Therefore, replace unsupported components whenever possible and upgrade applications that depend on outdated software.

Limit Server Access

Give each user and application only the permissions it needs. In addition, protect administrator accounts with strong passwords and multifactor authentication where available.

Maintain Reliable Backups

Create regular backups of your website files, databases, and essential configuration. Store copies securely and test the restoration process periodically.

As a result, you will be better prepared to recover if a security incident damages your website or data.

Conclusion

PHP2Shell highlights the importance of responding quickly to critical php vulnerabilities. CVE-2026-109618 and CVE-2026-109619 can create serious security risks for affected PHP environments. Therefore, identify your current PHP version, install the appropriate security updates, and confirm that your web server is running the patched release.

Furthermore, use a WAF as an additional layer of protection, monitor logs, maintain secure backups, and remove unsupported software. By combining timely updates with regular maintenance, you can reduce security risks and protect your website more effectively.

Frequently Asked Questions About PHP Vulnerabilities

1. What Is PHP2Shell?

PHP2Shell refers to two critical PHP vulnerabilities, CVE-2026-109618 and CVE-2026-109619. Under affected conditions, these flaws can allow remote code execution. Therefore, administrators should install the appropriate security updates.

Yes. Both affect PHP request processing, but they have different underlying causes. One involves out of memory handling, while the other involves stale internal state. Both require the relevant security fixes.

3. Which PHP Versions Are Affected by PHP2Shell?

The affected main release branches include versions before PHP 8.5.12, 8.4.27, 8.3.36, and 8.2.35. However, older unsupported branches and vendor packages require separate verification.

4. Can a Web Application Firewall Completely Prevent PHP2Shell?

No. A WAF may help filter malicious requests, but it does not repair the underlying vulnerabilities. Therefore, installing the appropriate PHP security update remains essential.

5. How Often Should I Check PHP Vulnerability News?

Review official security announcements regularly and subscribe to relevant alerts. In addition, check for updates whenever your hosting provider or software vendor publishes a new security advisory.

6. What Should I Do if My Hosting Provider Does Not Offer a Patched PHP Version?

Contact your hosting provider and ask when the security update will be available. Meanwhile, follow its recommended temporary protections. If it cannot provide a suitable fix, consider migrating to a supported hosting environment.

7. Will Updating PHP Break My Website?

It can cause compatibility issues, especially when your website uses outdated plugins or applications. Therefore, test the update in a staging environment, back up your website, and check essential functions before deploying it.

8. Is Disabling Shell Execution Functions Enough to Fix PHP2Shell?

No. Restricting functions such as exec and shell_exec may reduce certain risks, but it does not fix the underlying PHP flaws. Consequently, installing the correct security patch is essential.

9. Where Can I Find Official PHP Security Updates?

Check the official PHP website, your operating system vendor's security announcements, and your hosting provider's documentation. These sources can help you identify the appropriate patched release for your environment.

10. What Should I Do if I Suspect My Server Has Been Compromised?

Treat the incident seriously. First, isolate the affected system when appropriate and preserve relevant logs. Next, investigate suspicious activity, remove unauthorized changes, and restore from a verified clean backup if necessary. Finally, patch the vulnerability and review access credentials before returning the server to normal operation.

https://fahadbk.com/journey