Critical PHP Vulnerabilities: PHP2Shell Flaws, Patching and Containment
Two critical flaws in PHP core (CVE-2026-109618 and CVE-2026-109619, named PHP2Shell) permit unauthenticated remote code execution across servers running PHP. This emergency guide sets out affected versions, discovery commands, vendor update steps and immediate containment measures for UK organisations.
What the PHP2Shell vulnerabilities mean
The PHP security team disclosed two critical flaws on 20 October 2026, releasing source fixes and distribution packages on 21 October. Tracked as CVE-2026-109618 and CVE-2026-109619 and collectively labelled PHP2Shell, both issues carry a CVSS score of 9.2 out of 10. The flaws affect PHP releases dating back to PHP 5 in 2004, meaning exposure extends across modern and legacy installations alike.
The issues involve memory management inside the PHP core rather than typical web application bugs such as SQL injection. CVE-2026-109618 allows an attacker to trigger an out-of-memory state that corrupts memory, leading under specific conditions to unauthenticated remote code execution. CVE-2026-109619 is a use-after-free defect where PHP continues to reference memory freed after an earlier request.
Because proof-of-concept exploit details leaked before patches reached all package channels, unpatched internet-facing servers face immediate risk of full server takeover, configuration exposure and database theft.
Systems and applications exposed to compromise
Any system executing PHP to handle web traffic is exposed. This includes CMS deployments such as WordPress, Drupal, Joomla, Magento, MediaWiki, phpBB, Laravel, Symfony and WHMCS.
The risk is not confined to public e-commerce or marketing websites. Internal administration interfaces, CI/CD runners, monitoring consoles, hosting panels, Docker containers and network vendor appliances that embed PHP internally are all exposed if reachable.
Organisations must prioritise internet-facing PHP services and systems with direct access to production databases, payment gateways, session stores or customer records.
Fixed versions and discovery commands
Official upstream releases fixing both vulnerabilities are PHP 8.5.12, 8.4.27, 8.3.36 and 8.2.35. Supported Linux distributions backport fixes into their own package versions, so an unchanged version string such as PHP 8.2.20 can still contain the fix if the distribution security advisory confirms it.
Audit all servers and containers using discovery commands: run php -v and php-fpm -v on command lines; run dpkg -l | grep -E 'php|libapache2-mod-php' on Debian and Ubuntu hosts; run rpm -qa | grep -i php on RHEL, Rocky and Alma hosts; and run docker ps --format '{{.Names}} {{.Image}}' across container nodes.
Where workloads run on managed hosting or Platform-as-a-Service environments, request written confirmation from the provider that their deployed PHP runtime contains the 21 October 2026 security fix.
Patching process and mandatory service restart
Take complete backups of application code, databases, configuration files and SSL certificates before updating production runtimes. Record installed extensions and php.ini configurations, then verify rollback procedures.
On Debian and Ubuntu, run sudo apt update && sudo apt upgrade for all PHP packages. On enterprise Linux distributions, apply distribution updates via dnf update. On Docker and Kubernetes clusters, rebuild container images from patched base images and roll out new pods rather than restarting old containers.
Restart PHP-FPM, Apache mod_php or the supervising application service immediately after package installation. A package update on disk does not replace running worker processes held in memory, leaving the server vulnerable until workers restart.
Immediate containment when immediate patching is not possible
If a system cannot be patched within hours, isolate it from the public internet. Restrict access to a corporate VPN, trusted static IP allowlists or a segregated administrative management network.
Where web applications do not require file uploads, block multipart form submissions at the web server or reverse proxy. Disable the PHP upload progress bar where applicable to close known trigger paths.
Web application firewalls provide partial protection by blocking known exploit payloads, but they do not replace runtime patches. Treat web application firewall rules as a temporary holding measure while emergency patching proceeds.
Checking for indicators of active compromise
Preserve audit logs and system state before patching an exposed server. Check process tables for unexpected child processes spawned by PHP-FPM or web server workers, including bash, sh, perl, python or powershell.
Inspect web document roots for newly created PHP scripts, modified .htaccess rules, unfamiliar cron tasks, new systemd units or newly added SSH authorised keys and administrative user accounts.
If you identify evidence of compromise, isolate the host from internal networks, preserve memory and disk images for forensic review, rotate all credentials stored on or accessible from the machine, and rebuild from clean infrastructure.
Common questions
- Which PHP versions are affected by PHP2Shell?
- Both CVE-2026-109618 and CVE-2026-109619 affect PHP releases dating back to PHP 5. Official patched releases are PHP 8.5.12, 8.4.27, 8.3.36 and 8.2.35. Supported Linux distributions also supply backported package updates for their long-term releases.
- Does a web application firewall protect against PHP2Shell?
- A web application firewall does not replace an updated PHP runtime. While inspecting or blocking specific multipart patterns blocks certain exploit attempts, memory corruption can be triggered in multiple ways. Full patching remains necessary.
- Why must PHP services be restarted after applying the update?
- Applying an operating system package updates files on disk, but running PHP-FPM or Apache worker processes remain in memory until restarted. Restart the relevant system service or container to ensure fixed binaries handle incoming web requests.
- What immediate containment steps should be taken if patching is delayed?
- Isolate internet-facing PHP systems behind a VPN or trusted IP allowlist, block multipart requests at the reverse proxy if file uploads are not required, disable upload progress monitoring, and increase audit logging for unexpected spawned processes and web root file writes.
Official UK sources checked
- BACS Warning: Critical Vulnerabilities in PHP (PHP2Shell)
- Computer Weekly: Critical PHP flaws put millions of websites at risk of takeover
- The Record: Security teams issue warnings over PHP flaws
- Techweez: Critical PHP Security Vulnerabilities Disclosed
- Search Engine Journal: Critical PHP Core Security Flaws Affect Websites
- American Hospital Association Advisory: Critical Vulnerabilities Discovered Impacting PHP
Related UK cybersecurity guides
Small business ransomware response checklist: what to do in the first hour
This guide sets out what a UK manager should do in the first 60 minutes after ransomware is suspected. It covers safe containment without powering machines off, preserving evidence, contacting your insurer and cyber incident helpline, and notifying Action Fraud, the NCSC and the ICO where required.
How Often Should a Small Business Test Its Backups? A Monthly and Quarterly Routine
A backup that has never been restored is an assumption, not a control. This guide sets out a monthly spot check and a quarterly full restore for a business of 5 to 50 staff, with the named evidence to keep so a manager, assessor or insurer can see the routine is real.
The Cyber Essentials 14 day patching rule: which updates count and how to prove it
Cyber Essentials requires in-scope software to be updated within 14 days of release when the fix is rated critical or high risk, scores CVSS v3 7 or above, or has no published severity. This guide explains which updates qualify, what falls outside the rule, and the records that show an assessor when each patch was released and installed.
