Website Security

PHP2Shell Vulnerability: What It Is and How to Keep Your PHP Website Secure

1 min read

PHP2Shell Vulnerability: What It Is and How to Keep Your PHP Website Secure

On October 21, 2026, the PHP team released emergency fixes for two serious security flaws in PHP itself. Together, they're now known as PHP2Shell. Details leaked before the fixes were ready, and exploit code was already going around, so this isn't one to leave for later.

If your website runs on PHP, and that includes WordPress, Joomla, Drupal, Laravel and most custom sites, here's what you need to know, explained in plain language.

What Is PHP2Shell?

PHP2Shell is a pair of bugs in the way PHP handles memory: CVE-2026-109618 and CVE-2026-109619. Both are rated 9.2 out of 10 in severity.

Here's what goes wrong, in simple terms:

  • CVE-2026-109618: When a request uses up PHP's memory limit at exactly the wrong moment, PHP stops halfway through setting things up. Later, it treats that half-finished work as if it were complete.
  • CVE-2026-109619: When an error interrupts a request, PHP can hold on to memory it has already released. The next visitor’s request, handled by the same PHP process, can then reach that leftover memory.

An attacker can trigger both bugs on purpose with specially crafted requests, without logging in. In the worst case, they could run their own code on your server, read data they shouldn't see, or take your site down.

On October 23, PHP disclosed a third related flaw, CVE-2026-115560, linked to a feature called session.upload_progress. More on that below.

Which PHP Versions Are Affected?

Every PHP version older than the fixed releases is affected, going back at least to PHP 5.4.

PHP BranchSafe VersionSupport Status
PHP 8.58.5.12 or newerActive
PHP 8.48.4.27 or newerActive
PHP 8.38.3.36 or newerSecurity fixes only
PHP 8.28.2.35 or newerSecurity fixes end December 31, 2026
PHP 8.1 and olderNo official fixEnd of life

Will Updating WordPress or My Plugins Fix It?

No, and this is the part that surprises most people. PHP2Shell lives in PHP, the engine that runs your website, not in WordPress, your theme or your plugins. You can have every plugin up to date and still be exposed.

The only complete fix is running a patched version of PHP.

How Do I Check If My Site Is Safe?

Start by checking your PHP version in your hosting control panel (in cPanel, look for MultiPHP Manager or Select PHP Version. WordPress users can also find it under Tools → Site Health → Info → Server.

There's one catch. Many hosts apply security fixes without changing the version number, so a site showing "8.1" or "8.3" might already be protected. The reliable sign is the build date: if it’s October 21, 2026 or later, the fix is in place.

To see the build date, create a file with a random name (for example, check-7f3k9q2.php) containing this single line:

<?php phpinfo(INFO_GENERAL);

Open it in your browser, note the Build Date, then delete the file right away. A forgotten phpinfo file tells attackers a lot about your server.

What Should I Do Right Now?

1. Update PHP. Move to 8.5.12, 8.4.27, 8.3.36 or 8.2.35 (or newer). This is the only step that actually fixes the problem.

2. Turn off session upload progress. Hardly any modern site uses this old PHP feature, because upload progress bars today are handled by JavaScript. Turning it off closes the door used by CVE-2026-115560 and reduces your risk from PHP2Shell while you update.

On most shared hosting, add this line to a .user.ini file in your website's main folder:

session.upload_progress.enabled = Off

If you manage your own server or VPS, add the same line to php.ini or your PHP-FPM pool configuration, then restart all PHP workers. Without a restart, the change doesn't take effect.

Two quick tips: changes to .user.ini can take up to five minutes to apply, and setting this with ini_set() in your code won't work, because PHP reads uploads before your code even runs.

3. Keep upload limits sensible. If your site doesn't accept file uploads, keep post_max_size and upload_max_filesize small. Smaller limits give attackers less room to work with. This lowers your risk, but it doesn't replace updating.

Isn’t a Firewall Enough?

A web application firewall (WAF) can block known PHP2Shell attack patterns, and it's a useful safety net. But attackers can tweak their requests to slip past firewall rules. The firewall buys you time, and the PHP update closes the hole. You need both.

I’m on PHP 8.1 or 8.2. Should I Upgrade?

Yes. PHP 8.1 and older no longer receive official fixes, so you’re relying on your hosting provider to patch them for you. PHP 8.2 is patched for now, but its security support ends on December 31, 2026.

If you’re updating anyway, go straight to PHP 8.3 or 8.4 so you only migrate once. Test the new version on a staging copy of your site first, and check that your theme and plugins work before switching the live site.

Was My Site Already Attacked?

Most sites weren't, but it's worth a quick check, especially if your site ran an unpatched PHP version after mid-October. Look for:

  • New .php files you don’t recognise, especially in upload folders
  • Admin users, cron jobs or FTP accounts you didn't create
  • Sudden spikes of HTTP 500 errors in your logs

If anything looks wrong, restore a clean backup, change your passwords and API keys, and contact your hosting support team for a malware scan.

How Cloudexter Can Help

With Cloudexter hosting, you can switch each website to a supported PHP version and adjust PHP settings like session.upload_progress right from your control panel. If you’re not sure whether your site is protected, our support team can check your PHP version and build date and help you plan an upgrade.

The Bottom Line

PHP2Shell is serious, but the fix is simple. Make sure your site runs a patched PHP version, turn off session upload progress, and plan your move to PHP 8.3 or 8.4 before the end of the year. Those few steps keep your website protected from PHP2Shell and ready for whatever comes next.

Need a hand? Explore Cloudexter’s hosting plans or contact our support team today.

Apurva

Apurva is a Technology and Web Hosting Content Writer at Cloudexter, covering web hosting, cloud infrastructure, WordPress, Linux, server management, website security, and performance optimization. The goal is to simplify complex technical concepts and help developers, businesses, and IT professionals make informed technology decisions.