I have already written two posts about PHP2Shell: what website owners need to do now and which PHP versions close the gap. This one is about the question behind them: How does such an attack work - and why is this vulnerability so dangerous?
It is based on the German-language video “PHP2Shell: How a memory error becomes a shell” by Hood Informatik, which explains the background very clearly. I have added the reports of the researchers who found the flaws and the official advisory - all sources are listed at the end. I deliberately leave out technical details on exploiting the vulnerability; the diagrams show the process the way it matters to you as a website owner, and you can click through them step by step.
Why PHP2Shell is so dangerous
Most security vulnerabilities WordPress owners hear about are in a plugin or theme. Then only websites with exactly that plugin are affected, and a plugin update fixes the problem. PHP2Shell is different:
- The flaw is in PHP itself - the program that runs your PHP code. That means WordPress, WooCommerce, Joomla, Drupal, Shopware, Nextcloud, Laravel and every other PHP application are affected, according to Calif going back to PHP 5.4.
- No login required. Attackers need neither a password nor any action by a user. Crafted requests over the internet are enough.
- The attack happens before your code. In the most dangerous variant, it takes place while PHP is still reading the request - before a single line of your application runs. Your own code can be flawless and the server is still vulnerable.
- The result is remote code execution. Anyone who can run their own code on the server can read data, leave backdoors or use the server for further attacks.
Leaked posts before the disclosure often mentioned a CVSS score of 10. The PHP team settled on 9.2 because the attack is complex: whether it succeeds depends on the PHP version, the web server and the state of the memory, and an attacker may need many attempts. That is still enough for mass attacks - automated attempts cost an attacker nothing.
How an attack works
From your website’s point of view, an attack via PHP2Shell roughly looks like this. Below each step, you can see which protection takes effect at that point.
Course of an attack - and where you stop it
- Finding servers. Attackers search automatically for websites running PHP - that is around 70% of all websites.
- Sending crafted requests. At first glance the requests look harmless, but they are built to push PHP to its memory limit. It often takes many attempts.
- PHP aborts in the middle of its work. Instead of stopping cleanly, PHP abruptly leaves the task it is working on - a half-finished state remains in memory.
- Foreign code runs. PHP relies on this state being valid and keeps working with it. If the attacker controls the data in it, they can run their own code.
- The server is compromised. From here, the damage depends on what the attacker intends and how well your website is secured and backed up.
Why a memory error can do so much damage
To understand why a simple lack of memory can lead to a server takeover, two basics help.
First: PHP processes are reused. A process handles a request, cleans up and then takes the next one. For each request it gets its own memory area, which is released at the end. That is safe - as long as nothing points to this released memory afterwards.
Second, every request goes through three phases:
A request in three phases
PHP limits the memory per request, to 128 MB by default. When this limit was exceeded, PHP did not return a clean error but abruptly left the task it was working on and jumped straight to error handling. The aborted task never finishes its work: it may already have recorded that new data exists without having fully created it.
Later, PHP relies on everything that has been recorded being valid. With the first vulnerability, this happens while the same request is being cleaned up. With the second vulnerability, a leftover reference points to memory that was released long ago - and only the next request to the same process accesses it. Experts call this a use-after-free. In both cases: whoever can influence the leftover data influences what PHP does with it.
The researchers at Wiz also show that this path can leak memory contents to the outside - in the worst case including passwords or API keys from other people’s requests.
How the update fixes the problem
The patch goes straight to the root cause: it removes the abrupt abort when memory runs out.
Memory limit reached - two possible paths
- The memory limit is reached. A request needs more memory than PHP allows it. This is where the paths split.
- Without update: PHP aborts abruptly. The task currently running is left halfway through.
- Without update: a broken state remains. Half-finished data or references to released memory are left behind - the starting point for the attack.
- With update: the task finishes cleanly. PHP lets the running work complete and only aborts afterwards.
- With update: nothing is left behind. As a safeguard, there is a second, higher limit at which the process ends on the spot - without reusing any broken state.
mod_php or PHP-FPM: who is affected and how badly?
On web servers, PHP usually runs in one of two variants: with mod_php, PHP is built into the Apache web server as a module. With PHP-FPM, PHP runs as a separate service to which the web server passes requests. The advisory lists all variants as affected, but the risk is distributed differently:
| Variant | Risk according to the advisory and the researchers |
|---|---|
| mod_php (Apache) | Highest. Full code execution was demonstrated with default settings - regardless of which application is running. |
| PHP-FPM | High. Here, a successful attack also depends on the application. The researchers still demonstrated it against widely used systems such as WordPress. |
| php-cgi, FrankenPHP, LiteSpeed | Affected, and likewise only fully protected by the update. |
For you, this means: the variant at most decides how urgent the update is - not whether you need it.
20 years old: why the flaw only became dangerous now
What stands out most is how old the underlying problem is:
From known flaw to shell
- 2004 - Security researcher Stefan Esser finds a similar vulnerability involving the memory limit.
- 2020 - A related bug is reported and classified as harmless.
- 2024 - A security audit (OSTIF and Quarkslab) finds the problem again but cannot prove it is exploitable.
- August 2026 - Calif, Wiz and OpenAI provide exactly that proof with the help of AI models and report the vulnerabilities to the PHP team.
- October 21, 2026 - The PHP team releases the security updates, one day earlier than planned, because details leaked on October 20.
The AI did not “find” the flaw: the Calif researcher knew about the old vulnerabilities and had the model search for them specifically. The AI sped up the laborious work of turning a known flaw into a working attack. Wiz writes that a single researcher managed in a week what previously would have taken a world-class team months. For the industry, that is the real lesson: a known flaw can no longer be considered harmless just because it is hard to exploit.
Is PHP2Shell already being exploited?
As of October 22, 2026, this is disputed:
- Cloudflare has observed attack attempts on customer sites and seen attackers trying to get around its protection rules.
- watchTowr reports attacks on its decoy servers (honeypots) since October 21.
- Other sources had no confirmed cases up to their publication, and the US agency CISA does not yet list the vulnerabilities in its catalog of actively exploited vulnerabilities.
So there are attack attempts, but no confirmed picture of mass exploitation yet. The researchers’ complete attack has not been made public.
How to recognize attack attempts
Because the attack runs below your application, the logs of WordPress or your shop often show nothing. The researchers name other signs that you or your hosting provider can watch for:
- a striking number of 500 errors in a short time,
- messages about an exceeded memory limit in the PHP error log, often in connection with upload requests,
- unusually large or strange-looking session cookies in the server’s responses,
- PHP processes that restart unusually often.
On their own, these signs are no proof - but piling up at the same time, they are a good reason to take a closer look.
What you should do now
- Check and update your PHP version - even if your own code is clean. PHP 8.5.12, 8.4.27, 8.3.36 and 8.2.35 are safe, as is a package from your Linux distribution that contains the fix. How to check your version and what to watch out for on Debian and Ubuntu is covered in this post.
- Restart PHP-FPM after the update, otherwise the old processes keep running the old version. With managed hosting, your provider takes care of this - ask if in doubt.
- Replace old PHP versions. There are no official updates for PHP 8.1 and older. Many hosting providers are therefore locking affected websites or forcing the switch. What can go wrong in the process is described in “There has been a critical error on this website” after the PHP update.
- Use workarounds only as a bridge. The advisory names settings that make individual attack paths harder, and providers such as Cloudflare filter known patterns. According to the researchers, both are only partial measures and no replacement for the update.
I can help you with the switch
Not sure which PHP version runs on your server, or your website shows errors after the update? I check your website, move it to a current PHP version and fix incompatibilities in plugins and theme. If it has to be fast: my WordPress emergency support is there for exactly that. And so you do not have to take care of such updates yourself in the future, there is WordPress maintenance. If plugins or the theme need to be adapted, I take care of that as a WordPress programmer in Vienna.
Sources
- Video (German): PHP2Shell: How a memory error becomes a shell - Hood Informatik (YouTube, October 21, 2026)
- CVE-2026-109618 and CVE-2026-109619 - CVE.org
- PHP security release of October 21, 2026 - php.net
- PHP2Shell - report by the researchers - Calif
- PHP2Shell: PHP RCE - Wiz Research
- PHP vulnerabilities: WAF protection - Cloudflare
- PHP CVE-2026-109618 FAQ - watchTowr




