PHP2Shell: How to Protect Your Website Visitors
PHP2Shell is a pair of critical flaws in the PHP engine that let an attacker run code on a web server with crafted HTTP requests, no login needed. On Apache with mod_php, one request is enough. PHP shipped patches on October 21, 2026. The first recorded exploitation attempt came four days earlier.
TL;DR
- What it is: two critical flaws in the PHP engine, CVE-2026-109618 and CVE-2026-109619, each rated CVSS v4.0 9.2. They allow remote code execution without a login, plus memory disclosure.
- Who is exposed: every PHP installation that serves web requests. Researchers demonstrated attacks on WordPress, Drupal, Joomla, and Magento.
- Status: attackers are already trying it. Amazon recorded the first attempt on October 17, four days before disclosure.
- What to do: update to PHP 8.5.12, 8.4.27, 8.3.36, or 8.2.35, restart PHP workers, rotate secrets, and check what runs on your checkout and login pages.
This guide shows you how to check your servers, how to fix them, and why a compromised server puts your website visitors at risk.
What is PHP2Shell?
PHP2Shell is the name for two memory-safety flaws in the PHP engine, CVE-2026-109618 and CVE-2026-109619. They let an unauthenticated attacker run code on a PHP web server, or read memory left by other users’ requests. The bugs sit in PHP itself, so every application on an affected version is exposed.
How PHP2Shell works
The flaws are in how PHP cleans up after a fatal error, such as running out of memory, partway through a request. Cleanup can leave stale internal state behind, and a later request on the same worker can reuse it. Wiz Research demonstrated two outcomes:
- Remote code execution without a login. Wiz ran it against the default
wordpress:latest,drupal:latest, andjoomla:latestcontainer images. Those were sample targets: a “Hello World” app on an affected PHP version is exposed too. - Memory disclosure. An attacker can read a chunk of live worker memory, including data from other requests: passwords, session tokens, API keys, and certificates. It works without code execution, even if the app never starts a session.
PHP2Shell at a glance
| Fact | Detail |
|---|---|
| CVEs | CVE-2026-109618 (code execution via out-of-memory corruption), CVE-2026-109619 (code execution via stale global state) |
| Severity | CVSS v4.0 9.2 for each, per the PHP project |
| Affected setups | Every PHP install that serves web requests: PHP-FPM, Apache with mod_php, php-cgi, FrankenPHP, LiteSpeed. mod_php carries the highest risk |
| Affected versions | Every release of the past decade, back to PHP 5.4, per Wiz |
| Fixed in | PHP 8.5.12, 8.4.27, 8.3.36, and 8.2.35 (October 21, 2026). Source patches only for 7.4, 8.0, and 8.1. No fix for 7.3 and older |
| Found by | Wiz Research, using AI-assisted research, with Calif and OpenAI |
| Exploitation | Attempts in the wild since October 17, 2026, per Amazon Threat Intelligence |
Is PHP2Shell being exploited?
Yes. Amazon Threat Intelligence recorded an exploitation attempt on October 17, 2026, four days before public disclosure, and more attempts from multiple actors on October 21. Amazon now describes the flaws as broadly exploited in the wild, and Cloudflare and watchTowr report attacks against both CVEs (Tenable).
| Date (2026) | What happened |
|---|---|
| August 24 | Wiz reports the bugs to the PHP project |
| September 21 | PHP acknowledges the report |
| October 17 | Amazon’s honeypots record the first exploitation attempt |
| October 20 | PHP publishes an advance notice of the security release |
| October 21 | PHP ships 8.5.12, 8.4.27, 8.3.36, and 8.2.35. Wiz, Calif, and OpenAI publish details. Amazon sees attempts from multiple actors |
How attackers got exploit details before disclosure is still unknown (Help Net Security). Most patch plans assume you hear about a flaw before attackers use it. With PHP2Shell, attackers moved first.
How to check if your servers are affected
Check the PHP version your web service actually runs, not just the one on the command line, then compare it with the fixed releases. Start with internet-facing servers.
- Inventory every place PHP runs. Include web hosting, containers, appliances, and products that bundle their own PHP runtime. CERT-EU points to an NCSC-NL list of affected third-party products.
- Check the version the web service uses. On Linux, for example:
php -v
php-fpm -v
systemctl list-units --type=service | grep -E 'php.*fpm'
apachectl -M | grep -i php
ps -ef | grep -E '[p]hp-fpm|[p]hp-cgi|[f]rankenphp|[l]itespeed'
On Debian and Ubuntu, the FPM binary carries its version, for example php-fpm8.3 -v. Check containers separately: list them with docker ps, then run the version check inside each one with docker exec <container> php -v. For managed hosting or bundled products, ask the vendor which PHP build runs your site and whether it’s patched.
- Compare with the fixed versions. Linux vendors often backport fixes without changing the version number, so check your vendor’s security advisory before you mark a server safe or vulnerable.
| PHP branch | Vulnerable | Fixed in |
|---|---|---|
| 8.5 | Before 8.5.12 | 8.5.12 |
| 8.4 | Before 8.4.27 | 8.4.27 |
| 8.3 | Before 8.3.36 | 8.3.36 |
| 8.2 | Before 8.2.35 | 8.2.35 |
| 7.4, 8.0, 8.1 | All versions | No official release: upgrade, use a verified vendor backport, or apply PHP’s source patch |
| 7.3 and older | All versions | No fix: upgrade, or use a verified vendor backport |
Sources: PHP security release, CERT-EU advisory 2026-018. Full technical details are in PHP’s GitHub advisories for CVE-2026-109618 and CVE-2026-109619.
What an external scan can and can’t tell you. An external scan can find PHP-powered sites. It can’t reliably confirm whether they’re patched: servers may hide version headers, and vendors backport fixes. Confirm with an authorized, authenticated vulnerability scan or a package inventory. Don’t send exploit or proof-of-concept requests to production servers.
How to fix PHP2Shell
Update PHP, then restart every PHP worker. That is the only complete fix. Workarounds only reduce specific attack paths.
- Patch and restart. Install PHP 8.5.12, 8.4.27, 8.3.36, or 8.2.35, or your vendor’s patched package. Then restart PHP-FPM, Apache, or whatever runs your workers, so none keep running the old code.
- On PHP 8.1 or older, upgrade if you can. These branches no longer get PHP releases. For 7.4, 8.0, and 8.1, the PHP team published minimal source patches, and some vendors ship backports. PHP 7.3 and older have no fix. Note that PHP 8.2 reaches end of life on December 31, 2026.
- Can’t patch today? Take the server off the public internet while you investigate. PHP’s interim settings reduce exposure but don’t make a server safe:
- Set
memory_limit=-1so no pool, directory, or app can override it, and cap memory with a container or cgroup limit that kills only the affected worker. - Lower
post_max_size(8M without uploads, 32M with them) and enforce request-size limits at the web server or proxy. - Set
session.upload_progress.enabled=0in php.ini or the FPM pool, then restart all workers. - On PHP 8.5, set
fatal_error_backtraces=0and restart all workers.
- Set
- Assume a server may already have been touched. Rotate secrets that lived in PHP worker memory: database passwords, API keys, session secrets, and admin tokens. Review recent changes to templates, static JavaScript files, and settings stored in the database.
- Look for the warning signs Wiz lists. Watch for unusual multipart requests followed by memory-limit errors or repeated HTTP 500 responses, unexpectedly large or malformed
PHPSESSIDresponse cookies, and unexplained PHP worker churn. The flaws run below the application layer, so app logs may show little.
Why a server compromise puts your website visitors at risk
A shell on your server is also a way into your customers’ browsers. Here is a hypothetical attack chain, not one Wiz reported:
- An attacker finds a PHP-based store on an unpatched PHP version and gets code execution.
- They change a template, a bundled JavaScript file, or a database-stored setting, so the checkout page loads one extra script.
- The script reads the card fields as the customer types, then sends the data to an attacker-controlled domain, disguised as an analytics call.
- Checkout keeps working, orders complete, and server logs look normal. The theft happens in your customers’ browsers.
This is Magecart-style skimming, introduced through a server compromise: the attacker plants the script from your own server. Memory disclosure opens a second route. A leaked admin token or API key can make the same change with no code execution at all.
The same risk runs through your vendors. If a vendor that serves scripts to your checkout runs unpatched PHP, a breach of its server can push malicious code to your visitors. You can patch your servers. You can’t patch theirs.
Patching closes the door. It doesn’t tell you whether someone already walked through it.
Where Reflectiz helps
Reflectiz doesn’t patch PHP. It shows you what a compromise does in your visitors’ browsers, and it tests how far an attacker could get on your live site.
Security Hub: catch what reaches the browser
Reflectiz Security Hub monitors what runs on your pages in the browser: first-party and third-party scripts, the domains they contact, and which of them touch sensitive inputs. It baselines normal behavior per page and flags deviations.
It is also agentless. A monitoring script added to your pages ships from your own server, so a compromised server can strip or alter it. Reflectiz scans your pages from the outside, in real browsers, so detection doesn’t depend on the server an attacker may control.
In the scenario above, the skimmer has to do three observable things: run on the checkout page, read the card fields, and send data somewhere. If that behavior shows up during the user journeys Reflectiz monitors, Security Hub can flag:
- a new or changed script on the payment page that isn’t in the baseline
- that script reading the card number, expiry, or CVV fields
- data leaving the page for a domain the checkout has never used
Obfuscation alone doesn’t hide a skimmer, because detection is based on behavior, not file hashes or known signatures. The same visibility supports PCI DSS v4.0.1 requirements 6.4.3 and 11.6.1 for payment-page scripts.
Offensive Hub: test what a stolen credential can reach
PHP2Shell’s memory disclosure is a reminder that secrets leak. If a session token or admin API key escapes, how far an attacker gets depends on your application: whether sessions expire and rotate, whether authorization runs on every request, and whether one stolen credential opens the whole back office.
Reflectiz Offensive Hub tests that layer. Its AI agents map your live site in a real browser and validate exploitable risks across the OWASP Top 10, including broken access control and authentication failures, with deeper attack chains for login and checkout flows.
Scope note: Reflectiz doesn’t monitor server-side activity. Treat it as a detection layer for customer-facing consequences, alongside server-side telemetry.
What to do this week
- Patch PHP everywhere and restart the workers. Then rotate secrets that may have sat in worker memory.
- Ask every vendor that hosts your PHP, or serves scripts to your checkout, whether it has patched.
- List every script that runs on your checkout and login pages, first-party and third-party, and who approved each one.
- Map where data typed into those pages goes: which scripts read it, and which domains receive it.
- Alert on any new script or new data destination on those pages.
Can’t answer 3 and 4 today? Reflectiz shows you what runs on your sensitive pages and where customer data goes.
Sources
FAQs
What is PHP2Shell?
PHP2Shell is a pair of critical flaws in the PHP engine, CVE-2026-109618 and CVE-2026-109619, disclosed on October 21, 2026. They let an unauthenticated attacker run code on a PHP web server or read memory from other requests. Both are rated CVSS v4.0 9.2.
Which PHP versions are affected by PHP2Shell?
Every PHP installation that serves web requests and runs a version before 8.5.12, 8.4.27, 8.3.36, or 8.2.35. Wiz says the bugs go back to PHP 5.4. PHP 8.1 and older get no new releases: the PHP team published source patches for 7.4, 8.0, and 8.1 only. Otherwise, upgrade or use a verified vendor backport.
Is PHP2Shell being exploited?
Yes. Amazon Threat Intelligence recorded an exploitation attempt on October 17, 2026, four days before disclosure, and attempts from multiple actors on October 21. Cloudflare and watchTowr also report attacks against both CVEs.
How do I check if my server is vulnerable to PHP2Shell?
Check the PHP version your web service runs (PHP-FPM, mod_php, php-cgi, FrankenPHP, or LiteSpeed), not only the command-line PHP. Compare it with the fixed releases. Linux vendors often backport fixes, so confirm with your vendor’s advisory.
Is there a PHP2Shell workaround if I can’t patch?
Take the server off the public internet while you investigate. PHP’s interim settings, such as memory_limit=-1 and session.upload_progress.enabled=0, block specific attack paths but don’t make a server safe. Updating PHP is the only complete fix.
Can PHP2Shell affect my website visitors?
Yes. An attacker with code execution, or a stolen admin token, can plant a skimming script on your checkout page. Patching stops new break-ins. Client-side monitoring shows whether a malicious script already reaches your customers’ browsers.
Subscribe to our newsletter
Stay updated with the latest news, articles, and insights from Reflectiz.
Related Articles
AI Has Changed The Web.
Are You Ready for What’s Next?
Third-party code shifts by the hour. Supply-chain compromises strike without warning. AI-driven web attacks now evolve faster than traditional security can ever keep up.
Reflectiz delivers the continuous, real-time visibility needed to expose the risks traditional tools miss entirely.
Zero code changes. Zero access to your data. Ultimate peace of mind.