What is PHP2Shell?
10/26/2026 – Stephanie Buckley
PHP2Shell is a critical security vulnerability found in the PHP programming language, which powers roughly 75% of all websites on the internet (including WordPress). It allows external attackers to take complete control of a web server without needing a username or password.
How the Flaw Works
-
- The Attack Trigger: An attacker sends a highly complex, malformed request to a website’s server that is designed to consume an excessive amount of memory.
- The Memory Panic: When the server’s PHP software detects that it is about to run out of memory, it triggers an emergency shutdown procedure to prevent the system from crashing.
- The Cleanup Failure: During this rapid shutdown, PHP attempts to clean up its temporary files and data. However, a coding flaw causes it to improperly clear memory addresses, leaving a doorway open in the operating system’s memory.
- The Code Execution: The attacker exploits this specific window, injecting malicious commands directly into the server’s system memory. This gives them a “shell”—a direct command line into the server.
The Immediate Impact
Because the vulnerability occurs at the core software level before WordPress or any security plugins even load, traditional website firewalls cannot block it. Once an attacker exploits this flaw, they gain full administrative access to the underlying server. This allows them to steal databases, alter website files, harvest user credentials, or use the server to launch further cyberattacks.
Resolution
The flaw resides entirely within the server’s PHP software, meaning updating WordPress or themes will not fix it. Security is only achieved by upgrading the server’s PHP environment to a patched version (such as 8.2.35, 8.3.36, 8.4.27, or 8.5.12 or higher), which changes how the software handles emergency memory cleanups.
How it Can Affect the Merchant
Imagine your web server is a busy restaurant, and PHP is the master chef in the kitchen.
Normally, when customers (website visitors) place an order, the chef prepares the meal, cleans up the workstation, and gets ready for the next order.
PHP2Shell is a major flaw in how the chef handles an emergency clean-up. Here is how it works in plain terms:
- The Setup: A malicious visitor sends a massive, confusing order to the restaurant that is completely impossible to make.
- The Panic: The chef realizes the kitchen is running out of counter space and ingredients, panics, and yells, “Stop! Cancel this order!”
- The Mistake: While rushing to throw away the bad order and clean the kitchen, the chef accidentally leaves the back door wide open and drops their set of master keys on the floor.
- The Takeover: The attacker walks right through the open back door, picks up the keys, and now completely controls the kitchen.
Why is this so dangerous?
Once the attacker gets those “keys,” they can control the entire website. They can steal customer data, change what is on the site, or use the server to launch attacks on other companies.
Because PHP runs roughly 75% of the entire internet (including popular platforms like WordPress), this flaw put millions of websites at immediate risk.
How is it fixed?
Website administrators must update their server’s PHP software immediately. Upgrading to the latest version teaches the “chef” how to clean up their mess safely without leaving the back door wide open.
If you manage a website, let me know how your site is hosted (like WordPress, cPanel, or a custom cloud server). I can give you specific steps on how to check if you’re safe.
Keeping WordPress Safe
Since your website runs on WordPress, it is powered entirely by PHP underneath. This means your site is directly exposed to PHP2Shell unless your server has been updated.
Because this is a server-level flaw rather than a WordPress application flaw, updating WordPress itself or updating your plugins will not fix it. You have to fix the foundation the website sits on. Here’s how:
1. Check your PHP version inside WordPress
You can see what version of PHP your server is using directly from your dashboard:
-
- Log into your WordPress admin dashboard.
- Go to Tools > Site Health.
- Click on the Info tab at the top.
- Scroll down and click on the Server dropdown section.
- Look for the PHP version line.
2. Compare your version to the safe list
The official PHP security team released emergency patches. To be safe from PHP2Shell, your server must be running one of these exact versions or higher:
-
-
- 2.35 or higher
- 3.36 or higher
- 4.27 or higher
- 5.12 or higher
-
(Note: If your site is running an older major version like PHP 7.4 or 8.0, it is critically vulnerable and completely unsupported. You should upgrade to a modern, patched version immediately).
3. How to apply the fix
How you update depends on your hosting setup:
-
-
- Managed WordPress Hosts (e.g., WP Engine, Kinsta, Flywheel): These providers usually handle critical server-level patches automatically. Check your hosting panel or reach out to their support team to confirm they have updated your environment’s PHP runtime.
- Shared Hosting (e.g., Bluehost, HostGator, SiteGround): Log into your hosting account control panel (like cPanel). Search for “Select PHP Version” or “PHP Manager” and switch your site’s environment to one of the safe versions listed above.
- Cloud or VPS Servers (e.g., DigitalOcean, AWS, Linode): If you manage your own virtual server, you must SSH into your machine and manually update your PHP packages (via apt-get update && apt-get upgrade or your system’s package manager), then restart your PHP-FPM or Apache service to apply the fix.
-
A Warning About Security Plugins
Security firewalls (like Wordfence or Sucuri) are actively blocking thousands of these attacks, but they cannot fully protect your site from this specific issue. The attack triggers before WordPress or its plugins even load, meaning a hacker can bypass your plugins entirely. Only updating the server’s PHP software guarantees safety.
Looking to Learn More About PHP2Shell?
Fill out the form below, and a Bold representative will contact you shortly.
Disclaimer: This article is for general information only and is not professional cybersecurity, IT or legal advice. Bold Integrated Payments (“Bold”) wrote it in good faith from information that was publicly available when it was published. Security issues and fixes change quickly, so Bold makes no warranties about whether this content is accurate, complete or current. Before you change your website or server, check the official advisories from the PHP project and your hosting provider, and talk to a qualified professional. To the fullest extent permitted by law, Bold is not liable for any loss or damage that results from relying on this article. Mentions of third-party products or providers are for illustration only and are not endorsements.

