MOOBON
Technical Article ・ AWS / Security

The Critical PHP Vulnerabilities "php2shell"How to check and update PHP on Amazon Linux, and what to do until you can

Published October 22, 20268 min readMOOBON Tech Blog

On October 21, 2026, two severe PHP vulnerabilities (CVE-2026-109618 / CVE-2026-109619) were disclosed. A single crafted request may let an unauthenticated attacker run arbitrary code on the server. AWS targets October 22 for updated Amazon Linux packages. This article covers how to check and update PHP on Amazon Linux, and the interim mitigations to use until you can.

This article reflects information as of October 22, 2026. Check the Amazon Linux Security Center in "Related links" for the current package status.

1. What is happening

CVEDescription
CVE-2026-109618When processing is interrupted by out-of-memory (OOM), request cleanup uses data that was never fully initialized. The main attack route is forcing OOM with multipart (file upload style) requests.
CVE-2026-109619Internal state that still points to a finished request's memory is used by the next request on the same worker (use-after-free). session.upload_progress, enabled by default, is one route.
  • Unauthenticated remote code execution. The PHP team rates both at CVSS v4.0 9.2 (Critical). Arbitrary code runs with the web server process's privileges, and files such as database credentials may be read.
  • Exploited before application code runs. It happens while the request is being accepted, so applications such as WordPress or Laravel cannot prevent it. With Apache mod_php, a successful attack has been demonstrated with default settings.
  • Exploitation attempts are already reported. The CVE IDs leaked the day before disclosure, so the PHP fixes were released a day early, on October 21. The same day, Cloudflare and watchTowr reported observing exploitation attempts. Security vendors around the world are warning about it under the name "php2shell."

PHP is said to run nearly 70% of websites, so the impact is very broad. Treat internet-facing PHP servers as top priority.

2. Affected versions

BranchAffected versionsFixed version
8.58.5.0–8.5.118.5.12
8.48.4.0–8.4.268.4.27
8.38.3.0–8.3.358.3.36
8.28.2.0–8.2.348.2.35
5.4–8.1AllNo official fix (end of life)

Every form that handles web requests is in scope: PHP-FPM, Apache mod_php, php-cgi, FrankenPHP and LiteSpeed. PHP 8.1 and older are end of life, so only minimal patches for source builds are available. PHP 8.2 also reaches end of life on December 31, 2026.

3. Amazon Linux package status

According to the AWS security bulletin (2026-143-AWS), updated Amazon Linux packages are targeted for October 22, 2026. The status of each package in the Amazon Linux Security Center is as follows (as of October 22).

OSPackageStatus
Amazon Linux 2023php8.2 / php8.3 / php8.4 / php8.5Pending Fix
Amazon Linux 2023php8.1No Fix Planned
Amazon Linux 2 (Extras)php8.2Pending Fix
Amazon Linux 2 (Core)php (5.4)No Fix Planned

PHP marked "No Fix Planned" (php8.1 on AL2023 and the default PHP 5.4 on AL2) will not get fixed packages. Apply the interim mitigations in section 6, then switch to php8.3 or later or migrate to Amazon Linux 2023. Our record of migrating WordPress from Amazon Linux 2 to 2023 is in this article.

4. Check your environment

PHP version and packages

# PHP version (CLI)
php -v

# installed PHP packages
rpm -qa 'php*' | sort

# how the web server runs PHP (php-fpm or Apache mod_php)
systemctl status php-fpm httpd --no-pager | grep -E 'Loaded|Active'
httpd -M 2>/dev/null | grep -i php

The CLI and the web server may run different PHP builds. Check the web-side version by temporarily placing phpinfo(), or with php-fpm -v for PHP-FPM.

Are fixed packages available? (Amazon Linux 2023)

# is a newer release version available?
sudo dnf check-release-update

# check security updates by CVE
sudo dnf updateinfo list --cve CVE-2026-109618 --releasever=latest
sudo dnf updateinfo list --cve CVE-2026-109619 --releasever=latest
On Amazon Linux 2023, the repository version is locked to the AMI's release. A plain dnf update won't install packages shipped in a newer release. Add --releasever=latest to check and update.

Are fixed packages available? (Amazon Linux 2)

# any PHP security updates?
sudo yum updateinfo list security all | grep -i php

# PHP enabled via amazon-linux-extras
amazon-linux-extras | grep -i php

Check many instances at once

For EC2 instances with Systems Manager, Run Command can collect the PHP version from every instance in one go.

aws ssm send-command \
  --document-name AWS-RunShellScript \
  --targets Key=tag:Role,Values=web \
  --parameters 'commands=["php -v | head -1","rpm -qa php* | sort"]' \
  --comment "php2shell check"

aws ssm list-command-invocations --command-id <COMMAND_ID> --details \
  --query 'CommandInvocations[].[InstanceId,CommandPlugins[0].Output]' --output text

5. Apply the fixed packages

Once the fixed packages are available, update and then restart every PHP process. Without a restart, the old PHP keeps running.

Amazon Linux 2023

# update only the PHP packages from the latest release
sudo dnf upgrade --releasever=latest 'php8.3*'

# or move the whole OS to the latest release
sudo dnf upgrade --releasever=latest

# restart (both php-fpm and Apache)
sudo systemctl restart php-fpm
sudo systemctl restart httpd

# verify (8.3.36 or later for 8.3)
php -v

If you use php8.4 or php8.5, adjust the package name accordingly.

Amazon Linux 2 (php8.2 from Extras)

sudo yum update 'php*'
sudo systemctl restart php-fpm
sudo systemctl restart httpd
php -v   # 8.2.35 or later

Containers and AMIs

  • For containers such as ECS, rebuild your image on a base image that includes the fixed PHP and replace the tasks.
  • If Auto Scaling launches from an AMI, build an updated AMI and switch the launch template. Updating only the running instances means the next scale-out launches the old PHP.

6. Interim mitigations

Until the fixed packages arrive, or if you run a PHP with no planned fix, the following lower the chance of a successful attack. None of them is a complete fix. Update as soon as you can.

CVE-2026-109619: disable upload progress

; /etc/php.ini (or a file under /etc/php.d/)
session.upload_progress.enabled = 0

; on PHP 8.5, also
fatal_error_backtraces = 0

Put this in php.ini, a PHP-FPM pool or the Apache config, and restart every worker. ini_set() and .user.ini don't work. If you don't use the upload progress feature, keeping it disabled even after patching is recommended.

CVE-2026-109618: limit request size

; no file uploads
post_max_size = 8M
; with file uploads (keep upload_max_filesize below this)
post_max_size = 32M
  • If your site doesn't use multipart requests, reject them in front of PHP at the load balancer or web server.
  • Limit request size, header count and input field count at the web server or proxy, including requests without Content-Length.
  • The PHP team also lists memory_limit = -1 (set so applications can't override it), but this risks exhausting memory, so combine it with a container or cgroup memory limit. Don't use process memory limits such as RLIMIT_AS, which can trigger the vulnerability.

Block with AWS WAF

If AWS WAF is attached to your ALB or CloudFront, AWS recommends the following two measures.

  • CVE-2026-109618: enable SizeRestrictions_BODY in the Core rule set (CRS), which blocks request bodies over 8 KB. It also blocks uploads such as those from the WordPress admin screen, so check the exclusion conditions before enabling it.
  • CVE-2026-109619: add a custom rule that blocks POST requests whose body contains PHP_SESSION_UPLOAD_PROGRESS and whose body or cookie contains PHPSESSID (AWS shows an example named "PHP2Shell").

AWS also plans to update the "PHP application" managed rule group.

7. Elastic Beanstalk and Lightsail

ServiceWhat AWS doesWhat you do
Elastic BeanstalkReleased PHP platform v4.13.12 on 10/21. A platform with the fixed PHP is targeted for 10/22With managed platform updates on, it is applied in the next maintenance window. Otherwise, update the platform version manually
LightsailUpdated blueprints expected on 10/21AWS does not update running instances. Recreate from the new blueprint and migrate, or update PHP inside the instance
Amazon WorkMailMitigated by configuration. Upgrade to PHP 8.3.36 targeted for 10/22No action needed

AWS services themselves are not affected. What is affected is the PHP that you run on top of these services.

FAQ

Frequently Asked Questions

QAm I safe if I use PHP-FPM?
A

No. Exploitation was demonstrated against Apache mod_php, but the PHP team says PHP-FPM, php-cgi, FrankenPHP and LiteSpeed are also affected. Any PHP that handles web requests is in scope.

QDo I need to update WordPress or other applications?
A

These are bugs in PHP itself and can be exploited before any application code runs. Updating WordPress or plugins does not protect you; update PHP itself.

QWhat about the default PHP (5.4) on Amazon Linux 2?
A

The php package in the Amazon Linux 2 Core repository is marked "No Fix Planned." Apply the interim mitigations and move to an environment that ships a fixed PHP, such as Amazon Linux 2023.

QAre configuration changes (interim mitigations) enough?
A

No. Both the PHP team and AWS say updating to a fixed version is the only complete fix. The mitigations only lower the chance of a successful attack until the fixed packages arrive.

QWhat if I run PHP in containers (ECS, for example)?
A

Update the base image (php:8.3-fpm, for example) to one that includes the fixed PHP, rebuild your image, and replace the tasks. Updating inside a running container is undone by the next deployment.

MOOBONISO/IEC 27001 CertificationAWS Partner Select Tier ServicesKinsta Agency Partner Badge
Copyright © 2026 MOOBON, Inc. All Rights Reserved.
Standard: ISO/IEC 27001:2022
Scope: Web system design support / Development, operation, and maintenance of in-house cloud services / Contract system development, operation, and maintenance / Server construction, operation, and maintenance