PHP2Shell & phpAfterShell: The Critical PHP Vulnerabilities Explained – and How to Secure Your Website
In October 2026 a pair of critical PHP flaws called PHP2Shell made world news: an attacker without any account could, in the worst case, run commands on the web server – before a single line of WordPress, WooCommerce or custom code was even loaded. Four weeks later, on 19 November, PHP shipped the next round of critical fixes, including a new session flaw nicknamed phpAfterShell. In this article I explain in plain words what went wrong inside PHP, what the attack traffic actually looked like, what attackers tried to do on websites, and exactly what you need to do now.
- What: memory-safety bugs in PHP itself (CVE-2026-109618, CVE-2026-109619) – not a WordPress or plugin bug. Rated 9.2 of 10.
- Who: every website that runs PHP – WordPress, WooCommerce, Joomla, Drupal, Magento, Laravel and custom apps.
- Fix: update PHP to 8.2.36, 8.3.37, 8.4.28, 8.5.13 or 8.6 (19 November releases cover both rounds) and restart PHP.
- Important: updating WordPress does not update PHP. Only your hosting provider or server admin can do that.
- Already hacked? Look for the files and signs listed below – or let me check and clean your site.
What is PHP2Shell?
PHP is the programming language that powers most of the web – around 70 % of all websites with a known server-side language, including every WordPress, WooCommerce, Joomla and Drupal site. Every time someone opens one of these pages, the web server starts PHP, PHP reads the request (URL, cookies, form fields, uploads) and then runs the website’s code.
PHP2Shell is the nickname for two vulnerabilities inside PHP itself:
| CVE | What goes wrong | Rating |
|---|---|---|
| CVE-2026-109618 | PHP runs out of memory while it is still building the request data. The half-built data is left behind, and the clean-up code trusts it anyway. | Critical, 9.2 |
| CVE-2026-109619 | Internal state outlives the memory it points to. The next request handled by the same PHP worker can act on that stale data. | Critical, 9.2 |
Both are classic memory-safety bugs in the C code of PHP. With a carefully shaped request, an attacker can bend this broken memory into running their own command – hence the name: PHP to shell. No login, no plugin, no user interaction needed.
Researchers found the flaws in August 2026 with the help of AI-assisted code audits. One of the two root causes had already been noticed in 2024, but was never fixed because no exploit had been shown at that time.
Timeline: from leak to mass scanning
- August 2026Security researchers (Calif and Wiz) independently discover the flaws and report them to the PHP team.
- 17 OctoberAmazon’s honeypots record a first exploitation attempt – four days before the official disclosure.
- 20 OctoberDetails leak online, a proof-of-concept video appears too early. PHP publishes an early warning, Cloudflare deploys emergency firewall rules.
- 21 OctoberPHP releases 8.2.35, 8.3.36, 8.4.27 and 8.5.12. Within 45 minutes Cloudflare sees tens of thousands of exploit attempts. Government sites in several countries go offline as a precaution.
- Late OctoberConfirmed exploitation in the wild: a server with Apache and PHP 8.4.26 is compromised, Palo Alto firewalls are rooted, a botnet tries to recruit web servers. CISA adds both CVEs to its list of known exploited vulnerabilities.
- 19 NovemberNext security release: PHP 8.2.36, 8.3.37, 8.4.28, 8.5.13 and the new PHP 8.6 fix 17 more issues – seven of them critical, including phpAfterShell.
- 31 December 2026PHP 8.2 reaches end of life. After that date it gets no security fixes at all.
How the attack works – step by step
To understand why this was so dangerous, you need to know one detail: PHP prepares everything a request contains before your website code starts. It parses cookies, splits form fields into arrays, stores uploads and – if a feature called session upload progress is active – writes progress information into a session. All of this happens in memory that PHP manages itself.
What the attack traffic looked like
Wordfence analysed thousands of blocked attack requests against WordPress sites. They share a clear pattern, which also helps you recognise them in your own logs:
- A POST request to the homepage, sent with a normal-looking browser User-Agent and
Connection: close. - A
multipart/form-databody containing the fieldsPHPSESSIDandPHP_SESSION_UPLOAD_PROGRESS– the session upload progress feature is the entry point. - More than 130 nested fields like
t[0],t[1]… filled with long padded strings – their only job is to create memory pressure. - Embedded shell commands that print a marker such as
P2S_OKand read the first 200 bytes of.envandwp-config.php.
This is a shortened and defanged example of such a request. It does not work as an exploit – it shows what to look for:
POST / HTTP/1.1 Host: example-shop.com User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) … Cookie: PHPSESSID=p2s8f3… Connection: close Content-Type: multipart/form-data; boundary=----x ------x Content-Disposition: form-data; name="PHP_SESSION_UPLOAD_PROGRESS" p2s ------x Content-Disposition: form-data; name="t[0][0][0]…" # × 130+ nested fields AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA… # padding → memory pressure ------x # embedded payload (shortened): system("echo P2S_OK; id; uname -a; env; head -c 200 wp-config.php; head -c 200 .env")
What attackers do once a command runs
The payloads show exactly what the attackers want. If the first command works, the next steps follow automatically:
Confirm
Print a marker like P2S_OK, SHL_OK or ping a callback domain to see that the code really ran.
Profile
Run id, uname -a and hostname to learn which server and which user they control.
Steal secrets
Read wp-config.php, .env and environment variables: database passwords, salts, API and payment keys.
Stay inside
Drop a small PHP web shell such as wp2s.php into a writable uploads, plugin or theme folder.
Load more
Download a second stage with curl or wget: spam tools, crypto miners or botnet malware for DDoS attacks.
Stolen database passwords and keys stay valuable after you update PHP. If a server was reached before it was patched, the update closes the door – but the attacker may already have the keys to the house.
How many websites were really hacked?
Honest answer: the panic was bigger than the damage – so far. Exploits for PHP2Shell are hard to build reliably, because they have to be tuned to each server’s PHP build, memory layout and limits. That is why most of the millions of attempts failed.
- Confirmed: a successful attack on an Apache server with PHP 8.4.26 (memory leak, then command execution within milliseconds), Palo Alto Networks firewalls rooted by a China-linked group, and a Mirai botnet variant trying to recruit web servers for DDoS attacks.
- WordPress: as of the latest public reports, security companies such as Wordfence had not confirmed a single WordPress site hacked through PHP2Shell – despite tens of thousands of blocked attempts per day.
- The real risk: according to Qualys, about 71 % of visible PHP installations run end-of-life versions (5.4 to 8.1). These get no official fixes – and old, unmaintained servers are exactly where attacks succeed.
Attackers also improve their tools every week. “No confirmed WordPress hacks yet” is not a reason to wait – it is the window to update.
The November follow-up: phpAfterShell and six more critical flaws
On 19 November 2026 PHP released the next security update. It does not replace the October fix – it adds to it. If your host updated to 8.4.27 in October, you are still missing these fixes.
CVE-2026-126714 · Critical 9.2. PHP’s default file-based sessions write upload-progress data in a way that is not atomic. If an attacker kills a PHP worker in the middle of such a write – for example by hitting the memory limit or a timeout – a broken, half-written session file stays on the disk. The next request that calls session_start() reads and unserializes it. A carefully prepared file can turn into an object injection and, together with suitable code in the application, into code execution. October’s PHP2Shell fixes do not cover this path.
CVE-2026-129289 · Critical 9.2. If Nginx or Apache keeps the connection to PHP-FPM open for reuse, an attacker can hide a second FastCGI request inside the body of the first one. PHP-FPM does not throw away unread body bytes, so the hidden request runs on the same connection – bypassing routing rules of the front-end server.
CVE-2026-129481 · Critical 9.2. A use-after-free after an interrupted session shutdown – a variant that the October patch for CVE-2026-109619 did not fully close. Two further use-after-free bugs (CVE-2026-129182 and CVE-2026-129474) only affect PHP 8.5.
At release time none of the November flaws was known to be exploited, and several need special configurations. But they affect every supported PHP branch, and proof-of-concept code for at least one of them appeared on GitHub on the same day. Treat the update as urgent.
Is your website affected? Check your PHP version
Here is the catch: most hosting panels only show the branch, for example PHP 8.4. That is not enough, because the security fix arrived in one specific release of that branch – 8.4.28. The exact number with all three parts is what tells you whether your site is protected.
Real example: a hosting panel shows PHP 8.4, while WordPress Site Health on the same website shows 8.4.28 – fully patched. If you only see two numbers, use the WordPress method below.
Where to find your PHP version
Choose your hosting provider – twelve of the most used hosts in Germany and worldwide. The steps come from the providers’ own help pages.
WordPress Site Health – the easiest way
Works with every hosting provider. You only need an administrator login.
- Dashboard
- Tools
- Site Health
- Info
- Server
- Log in to your WordPress admin area (yoursite.com/wp-admin).
- In the left menu click Tools → Site Health, then the tab Info.
- Open the section Server and look for the line PHP version, for example 8.4.28 (Supports 64bit values).
- Type this number into the check below.
STRATO
Hosting packages in the STRATO customer login.
- Kunden-Login
- Your package
- Datenbanken und Webspace
- PHP-Version einstellen
- Log in to the STRATO customer login and select your hosting package.
- In the left menu open Datenbanken und Webspace → PHP-Version einstellen.
- The active version is shown at the top. Here you can also switch to another version and save.
- For the exact number use WordPress Site Health or a short phpinfo test (see “No WordPress”).
Source: STRATO FAQ
IONOS
Linux web hosting. With Managed WordPress and MyWebsite, IONOS manages PHP for you.
- IONOS account
- Menu
- Hosting
- PHP tile
- PHP settings
- Log in to your IONOS account and open Menu → Hosting. If you have several contracts, choose the right one.
- In the PHP tile click Open.
- The table shows every domain with its PHP version. Click a domain to change it, choose a version and click Save.
Source: IONOS Help Center
Hostinger
hPanel. The version applies to all websites in the hosting plan.
- hPanel
- Websites
- Dashboard
- Advanced
- PHP Configuration
- Log in to hPanel and open Websites.
- Click Dashboard next to your website.
- In the sidebar open Advanced → PHP Configuration. Choose a version and click Update – the change is live within a few minutes.
Source: Hostinger Help
ALL-INKL.COM
Technical administration (KAS). PHP is set per domain.
- KAS login
- Domain
- Edit (pencil icon)
- PHP version
- Log in to the KAS (technical administration).
- Click Domain in the left menu.
- In the Action column click the Edit icon of your domain and look for the PHP version setting.
Source: ALL-INKL tutorials
GoDaddy and other cPanel hosts
GoDaddy Web Hosting (cPanel). Most other cPanel hosts use the MultiPHP Manager.
- My Products
- Web Hosting
- Manage
- Settings
- PHP Version
- GoDaddy: open your products, find Web Hosting and click Manage.
- Open the Settings tab. Under Server Settings you see the PHP Version with a change button.
- Other cPanel hosts: in cPanel open Software → MultiPHP Manager. The table shows the PHP version of every domain.
Sources: GoDaddy Help, cPanel docs
SiteGround
Site Tools. Many SiteGround sites use “Managed PHP”, where SiteGround updates the version for you.
- Client Area
- Websites
- Site Tools
- Devs
- PHP Manager
- Log in and open Websites, then click Site Tools next to your site.
- Go to Devs → PHP Manager.
- The PHP version of your domain is shown there. Click the pencil icon to switch between managed and manual version.
Source: SiteGround Knowledge Base
Bluehost
Bluehost Account Manager (shared hosting).
- Account Manager
- Websites
- Manage
- Advanced
- PHP Version
- Log in to the Bluehost Account Manager and click Websites in the left menu.
- Click Manage next to your website.
- Open the Advanced tab. The PHP Version tile shows the version; Change PHP Version lets you switch and apply.
Source: Bluehost Help
DreamHost
DreamHost panel. Each domain can use its own PHP version.
- Panel
- Manage Websites
- Manage
- Settings
- PHP
- Open the Manage Websites page. In list view the PHP column already shows the version of every site.
- Click Manage next to your site and open the Settings tab.
- In Website Settings click Manage next to PHP to change it. The panel can need up to 24 hours to show the new version.
Source: DreamHost Knowledge Base
Namecheap
Shared hosting (Stellar plans) with cPanel.
- cPanel
- Exclusive for Namecheap Customers
- Select PHP Version
- Log in to cPanel.
- In the section Exclusive for Namecheap Customers (on some servers under Software) open Select PHP Version.
- The current version is shown above the extensions. Business plans use PHP Tweaks in the same section instead.
Source: Namecheap Knowledgebase
Kinsta
MyKinsta dashboard for managed WordPress.
- MyKinsta
- WordPress Sites
- Environment
- Tools
- PHP settings
- Log in to MyKinsta and open WordPress Sites.
- Choose your site and the environment (Live or Staging).
- Open Tools. The PHP settings card shows the version; click Change to switch.
Source: Kinsta blog
No WordPress? Use a 1-minute phpinfo test
Works for Joomla, Drupal, shops and custom PHP sites.
- Create info.php
- Upload
- Open in browser
- Delete again
- Create a text file named info.php with this single line:
<?php phpinfo(); - Upload it with SFTP or the file manager into the main folder of your website.
- Open yoursite.com/info.php. The exact version is at the very top, e.g. PHP Version 8.4.28.
- Delete the file right away. It shows details about your server that attackers love.
Check your version
Type the number you found – 8.4 or 8.4.28 both work.
PHP2Shell & November fix check
Pick your branch or type the full number from Site Health. The check runs only in your browser.
| PHP branch | Fixes PHP2Shell (Oct) | Fixes everything (Nov) | Support |
|---|---|---|---|
| 8.6 | 8.6.0 | 8.6.0 | Active |
| 8.5 | 8.5.12 | 8.5.13 | Active |
| 8.4 | 8.4.27 | 8.4.28 | Active |
| 8.3 | 8.3.36 | 8.3.37 | Security only |
| 8.2 | 8.2.35 | 8.2.36 | Ends 31 Dec 2026 |
| 8.1 and older | no official fix | no official fix | End of life |
On managed hosting, a fixed PHP build can keep an older version number, because Linux distributions backport fixes. If the number looks old, ask your host in writing whether the PHP2Shell and November fixes are included.
What you need to do now
1. Update PHP – not just WordPress
A WordPress, plugin or theme update cannot fix a bug in PHP. Ask your hosting provider today, or switch the version yourself in the hosting panel. Choose the newest branch your site supports – ideally PHP 8.3 or 8.4. Before you switch, create a full backup and test the home page, login, contact form and checkout afterwards.
2. Restart PHP
A new PHP version only protects you after every PHP worker has been restarted. On your own server:
sudo apt update && sudo apt install --only-upgrade 'php8.4*'
sudo systemctl restart php8.4-fpm # or: sudo systemctl restart apache2
php -v # check version and build date
3. Temporary protection if you cannot update today
These settings reduce the risk until the update is installed. They are not a replacement for it:
; php.ini – disable the main entry point (rarely needed by WordPress)
session.upload_progress.enabled = 0
; PHP 8.5 only – CVE-2026-129474
zend.exception_ignore_args = 1
# Nginx – stop FastCGI connection reuse (CVE-2026-129289)
fastcgi_keep_conn off;
# Apache mod_proxy_fcgi
# ProxyPass "fcgi://127.0.0.1:9000/" enablereuse=off
Also block or rate-limit unusually large multipart/form-data POST requests to your homepage in your firewall or WAF. Do not limit memory with RLIMIT_AS or RLIMIT_DATA – that can trigger the vulnerable code path. And do not run random “PHP2Shell checker” scripts from GitHub against your live site.
Signs that your website was already hacked

If your server ran an unpatched PHP version after 17 October, check it. These are the indicators published from real attack traffic and lab tests:
wp2s.phpWeb shell written by PHP2Shell payloads into uploads, plugin or theme folders.
php2shell.php · axiom_*.phpFurther shell file names seen in attack traffic.
uploads/*.phpAny PHP file in wp-content/uploads – images never need PHP files.
mu-plugins/*.phpUnknown “must-use” plugins that silently create admin users.
P2S_OK · SHL_OKMarkers in logs or responses that show a command ran.
*.oast.pro / .fun / .onlineOutgoing DNS or HTTP requests to these callback domains.
With SSH access you can search for these signs in a few minutes:
# PHP files that do not belong in uploads
find wp-content/uploads -type f -name "*.php"
# Known shell names and recently changed PHP files
find . \( -name "wp2s.php" -o -name "php2shell.php" -o -name "axiom_*.php" \) -print
find . -name "*.php" -newermt "2026-10-17" -not -path "./wp-content/cache/*"
# Attack markers in the access log
grep -E "PHP_SESSION_UPLOAD_PROGRESS|P2S_OK" /var/log/nginx/access.log*
# Admin accounts and scheduled tasks (WP-CLI)
wp user list --role=administrator --fields=ID,user_login,user_registered
wp cron event list
Without SSH, check in your hosting file manager: unknown PHP files in uploads, new files in mu-plugins, admin users nobody created, strange cron jobs in the hosting panel and unexplained traffic or CPU spikes.
If you find something: the clean-up plan
Work through the plan in three phases. Tick each step when it is done – your progress is saved in this browser, so you can come back later.
Incident response plan
0 of 9 steps done · Contain → Clean → Secure
Take the site offline or into maintenance mode
Visitors and Google should not see malware. Customers’ data stays safe while you work.
≈ 5 minSave a copy of files, database and logs
This is your evidence: it shows when and how the attacker came in.
≈ 15 minUpdate PHP to a November release and restart it
Close the hole first – otherwise the attacker simply comes back.
≈ 10 minRestore a clean backup from before 17 October
Or remove every backdoor by hand and compare the core files with a fresh WordPress download.
≈ 30–90 minReinstall WordPress, plugins and themes
Only from official sources – never from “free premium” download sites.
≈ 20 minDelete unknown admins, mu-plugins and cron jobs
These are the attacker’s spare keys. Check them twice.
≈ 15 minChange every password
WordPress admins, database, FTP/SSH, hosting panel and email.
≈ 20 minNew salts and new API keys
Rotate SMTP, payment and API keys from wp-config.php or .env – the attacker may have read them.
≈ 15 minSearch Console, monitoring and backups
Remove Google warnings, set up off-site backups and a monthly update routine.
≈ 30 min# new salts in wp-config.php – logs out every user
wp config shuffle-salts
If customer data such as names, emails or orders may have been accessed, the GDPR can require you to report the incident to your data protection authority within 72 hours. Document what you found and when.
Was your website hacked? I'll get it back.
I clean hacked WordPress, WooCommerce and PHP websites, close the hole, update PHP safely and set up backups and monitoring so it does not happen again. Personal help from Berlin – in English, German or Farsi.
How to protect your website in the future
PHP2Shell showed one thing very clearly: security is not only about plugins. A website stands on several layers – hosting, PHP, the CMS, plugins, accounts and backups. If one layer is outdated, the others cannot save it.
- Keep PHP current. Use a supported branch and let your host install security releases quickly. PHP publishes fixes every four weeks.
- Choose hosting that reacts. Good hosts patched PHP2Shell within hours and told their customers. Ask your host how they handled it.
- Use a web application firewall. Cloudflare and Wordfence blocked most PHP2Shell traffic before patches were installed.
- Keep tested off-site backups – daily for shops, at least weekly for business sites.
- Monitor file changes so a new PHP file in uploads triggers an alert.
- Reduce what can be abused: remove unused plugins, themes and admin accounts.
Read more in my WordPress Security Guide and my Website Maintenance Checklist – or let me take care of it with a support plan.
FAQ
Is PHP2Shell a WordPress vulnerability?
No. It is a bug in PHP, the language WordPress runs on. That is why WordPress, Joomla, Drupal, Magento and custom PHP applications are all affected in the same way – and why only a PHP update fixes it.
I updated WordPress and all plugins. Am I safe?
Not necessarily. WordPress updates do not change PHP. Check your PHP version under Tools → Site Health → Info → Server and compare it with the table above.
My host updated PHP in October. Do I need to do anything?
Yes. The October releases fixed PHP2Shell, but the November release fixes seven further critical flaws, including phpAfterShell. You need 8.2.36, 8.3.37, 8.4.28, 8.5.13 or PHP 8.6.
I still use PHP 7.4 or 8.1. What now?
These versions are end of life and get no official fixes. Some Linux distributions and vendors offer backports, but the safe solution is an upgrade to PHP 8.3 or newer – after testing your theme and plugins on a staging copy.
Does a security plugin protect me?
A firewall plugin or service can block known attack patterns and gives you time, but it cannot fix PHP. Attackers already change their payloads to get around firewall rules.
Can you check or clean my website?
Yes. I check the PHP version, the server and the files for the indicators above, clean the site if needed and secure it afterwards. Book a free call and tell me what you see.
Sources: PHP security advisories, Wiz, watchTowr, Wordfence, Unit 42, Qualys, Cloudflare and Amazon Threat Intelligence reports (October–November 2026). Last updated: 1 December 2026.
- 8 views
- 0 Comment

