Loading
Share This
Get in Touch
Scroll Down
//PHP2Shell & phpAfterShell: The Critical PHP Vulnerabilities Explained – and How to Secure Your Website

PHP2Shell & phpAfterShell: The Critical PHP Vulnerabilities Explained – and How to Secure Your Website

18 min readUpdated 1. December 2026By Mohsen Hassani

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.
Isometric illustration: a malicious request travels from an attacker to a PHP server and turns into a shell command Attacker / bot Web server running PHP POST / multipart PHP2SHELL · CVE-2026-109618/9$ id▌ Request in.Shell out.
PHP2Shell happens while PHP is still preparing the request – before WordPress or any plugin runs. That is why a CMS update cannot fix it.

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:

CVEWhat goes wrongRating
CVE-2026-109618PHP 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-109619Internal 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.

Four steps of a PHP2Shell attack: memory pressure, broken clean-up, memory leak, command execution 1 Memory pressureHundreds of nestedform fields with longpadded values push PHPto its memory limit. 2 Broken clean-upPHP aborts mid-setup.Half-built data staysin memory and is stilltrusted afterwards. 3 Memory leakThe response leaksinternal memory, so theattacker learns wherePHP’s functions live. 0x7f3a…c0de 4 Command runsA second request usesthat knowledge to jumpinto system() – a shellcommand on your server. $ whoami▌ Everything happens before WordPress is loaded Simplified. Real exploits must be tuned to each server – most attempts fail.
The attacker never touches your WordPress login. The weakness sits one layer below, in PHP’s request handling.

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-data body containing the fields PHPSESSID and PHP_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_OK and read the first 200 bytes of .env and wp-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:

access log · defanged attack request
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.

  1. Dashboard
  2. Tools
  3. Site Health
  4. Info
  5. Server
  1. Log in to your WordPress admin area (yoursite.com/wp-admin).
  2. In the left menu click Tools → Site Health, then the tab Info.
  3. Open the section Server and look for the line PHP version, for example 8.4.28 (Supports 64bit values).
  4. Type this number into the check below.
FULL NUMBER Shows the exact release, e.g. 8.4.28 – this is the number you need.

STRATO

Hosting packages in the STRATO customer login.

  1. Kunden-Login
  2. Your package
  3. Datenbanken und Webspace
  4. PHP-Version einstellen
  1. Log in to the STRATO customer login and select your hosting package.
  2. In the left menu open Datenbanken und Webspace → PHP-Version einstellen.
  3. The active version is shown at the top. Here you can also switch to another version and save.
  4. For the exact number use WordPress Site Health or a short phpinfo test (see “No WordPress”).
BRANCH ONLY Shows e.g. PHP 8.4. STRATO installs the security releases of a branch itself.

Source: STRATO FAQ

IONOS

Linux web hosting. With Managed WordPress and MyWebsite, IONOS manages PHP for you.

  1. IONOS account
  2. Menu
  3. Hosting
  4. PHP tile
  5. PHP settings
  1. Log in to your IONOS account and open Menu → Hosting. If you have several contracts, choose the right one.
  2. In the PHP tile click Open.
  3. The table shows every domain with its PHP version. Click a domain to change it, choose a version and click Save.
BRANCH ONLY Shows the branch per domain, e.g. 8.4.

Source: IONOS Help Center

Hostinger

hPanel. The version applies to all websites in the hosting plan.

  1. hPanel
  2. Websites
  3. Dashboard
  4. Advanced
  5. PHP Configuration
  1. Log in to hPanel and open Websites.
  2. Click Dashboard next to your website.
  3. In the sidebar open Advanced → PHP Configuration. Choose a version and click Update – the change is live within a few minutes.
BRANCH ONLY Shows e.g. PHP 8.4. Outdated versions (8.2 and older) are no longer offered.

Source: Hostinger Help

ALL-INKL.COM

Technical administration (KAS). PHP is set per domain.

  1. KAS login
  2. Domain
  3. Edit (pencil icon)
  4. PHP version
  1. Log in to the KAS (technical administration).
  2. Click Domain in the left menu.
  3. In the Action column click the Edit icon of your domain and look for the PHP version setting.
BRANCH ONLY Shows the branch per domain, e.g. 8.4.

Source: ALL-INKL tutorials

GoDaddy and other cPanel hosts

GoDaddy Web Hosting (cPanel). Most other cPanel hosts use the MultiPHP Manager.

  1. My Products
  2. Web Hosting
  3. Manage
  4. Settings
  5. PHP Version
  1. GoDaddy: open your products, find Web Hosting and click Manage.
  2. Open the Settings tab. Under Server Settings you see the PHP Version with a change button.
  3. Other cPanel hosts: in cPanel open Software → MultiPHP Manager. The table shows the PHP version of every domain.
BRANCH ONLY Shows e.g. PHP 8.4 (ea-php84).

Sources: GoDaddy Help, cPanel docs

SiteGround

Site Tools. Many SiteGround sites use “Managed PHP”, where SiteGround updates the version for you.

  1. Client Area
  2. Websites
  3. Site Tools
  4. Devs
  5. PHP Manager
  1. Log in and open Websites, then click Site Tools next to your site.
  2. Go to Devs → PHP Manager.
  3. The PHP version of your domain is shown there. Click the pencil icon to switch between managed and manual version.
BRANCH ONLY Shows the branch, e.g. PHP 8.4, and whether Managed PHP is on.

Source: SiteGround Knowledge Base

Bluehost

Bluehost Account Manager (shared hosting).

  1. Account Manager
  2. Websites
  3. Manage
  4. Advanced
  5. PHP Version
  1. Log in to the Bluehost Account Manager and click Websites in the left menu.
  2. Click Manage next to your website.
  3. Open the Advanced tab. The PHP Version tile shows the version; Change PHP Version lets you switch and apply.
BRANCH ONLY Shows the branch, e.g. 8.4.

Source: Bluehost Help

DreamHost

DreamHost panel. Each domain can use its own PHP version.

  1. Panel
  2. Manage Websites
  3. Manage
  4. Settings
  5. PHP
  1. Open the Manage Websites page. In list view the PHP column already shows the version of every site.
  2. Click Manage next to your site and open the Settings tab.
  3. In Website Settings click Manage next to PHP to change it. The panel can need up to 24 hours to show the new version.
BRANCH ONLY Shows the branch, e.g. PHP 8.4.

Source: DreamHost Knowledge Base

Namecheap

Shared hosting (Stellar plans) with cPanel.

  1. cPanel
  2. Exclusive for Namecheap Customers
  3. Select PHP Version
  1. Log in to cPanel.
  2. In the section Exclusive for Namecheap Customers (on some servers under Software) open Select PHP Version.
  3. The current version is shown above the extensions. Business plans use PHP Tweaks in the same section instead.
BRANCH ONLY Shows the branch, e.g. 8.4.

Source: Namecheap Knowledgebase

Kinsta

MyKinsta dashboard for managed WordPress.

  1. MyKinsta
  2. WordPress Sites
  3. Environment
  4. Tools
  5. PHP settings
  1. Log in to MyKinsta and open WordPress Sites.
  2. Choose your site and the environment (Live or Staging).
  3. Open Tools. The PHP settings card shows the version; click Change to switch.
BRANCH ONLY Shows the branch, e.g. PHP 8.4.

Source: Kinsta blog

No WordPress? Use a 1-minute phpinfo test

Works for Joomla, Drupal, shops and custom PHP sites.

  1. Create info.php
  2. Upload
  3. Open in browser
  4. Delete again
  1. Create a text file named info.php with this single line: <?php phpinfo();
  2. Upload it with SFTP or the file manager into the main folder of your website.
  3. Open yoursite.com/info.php. The exact version is at the very top, e.g. PHP Version 8.4.28.
  4. Delete the file right away. It shows details about your server that attackers love.
FULL NUMBER Shows the exact release, e.g. 8.4.28.

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 branchFixes PHP2Shell (Oct)Fixes everything (Nov)Support
8.68.6.08.6.0Active
8.58.5.128.5.13Active
8.48.4.278.4.28Active
8.38.3.368.3.37Security only
8.28.2.358.2.36Ends 31 Dec 2026
8.1 and olderno official fixno official fixEnd 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

Website source code on a monitor in gold tones – checking files for backdoors after a hack
A backdoor is often only a few lines hidden between normal code – so look at files, not only at the visible website. Photo: Unsplash

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.php

Web shell written by PHP2Shell payloads into uploads, plugin or theme folders.

php2shell.php · axiom_*.php

Further shell file names seen in attack traffic.

uploads/*.php

Any PHP file in wp-content/uploads – images never need PHP files.

mu-plugins/*.php

Unknown “must-use” plugins that silently create admin users.

P2S_OK · SHL_OK

Markers in logs or responses that show a command ran.

*.oast.pro / .fun / .online

Outgoing 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.

0%

Incident response plan

0 of 9 steps done · Contain → Clean → Secure

✅ All 9 steps done. Your site is clean and protected. Keep the monthly routine – or let me take care of it.
# 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

Leave a Reply

Your email address will not be published. Required fields are marked *

Recent comments

No comments to show.

About Author 01.

Mohsen Hassani

Mohsen Hassani is a web and software developer and IT specialist based in Berlin, Germany. He focuses on building reliable digital solutions, including websites, IT systems, and e-commerce platforms for individuals and businesses. Originally from Afghanistan and born in Iran, he completed his professional IT training in Germany, where he developed a strong technical foundation and built his career in web development and digital technologies. In addition to his technical expertise, he also works as a freelance photographer, combining analytical precision with creative vision.

© Mohsen Hassani 2026 / All rights reserved. Legal noticePrivacy policyTermsRight of withdrawalWithdraw from contract
Get in Touch
Close
Privacy settings