Fix guides / Ubuntu

Fix php2shell on Ubuntu

Ubuntu backports the fix and keeps the original upstream number, so 24.04 still reports PHP 8.3.6 after the update. Compare the package version with the table below, upgrade with apt and restart PHP. Packages from the ondrej/php PPA use upstream numbers instead: they need 8.5.12, 8.4.27, 8.3.36, 8.2.35 or later.

These steps fix CVE-2026-109618 and CVE-2026-109619. Upstream releases and distribution package numbers are in the fixed versions table.

Can’t update right now? Apply the temporary mitigations.

Not sure which PHP your site uses? Start with the self-check.

1. Check what you have installed

Installed PHP packages and their versions:

dpkg -l 'php*' 'libapache2-mod-php*' | grep ^ii

Installed and available version of one branch (replace 8.3 with yours):

apt-cache policy php8.3-common

Does PHP come from a third-party PPA such as ondrej/php? If this prints anything, compare with the upstream fixed versions, not the table below.

grep -rhs ondrej /etc/apt/sources.list /etc/apt/sources.list.d/

Fixed package versions

DistributionPackageFixed package versionAdvisory
Ubuntu 26.10 (stonking)php8.58.5.9-0ubuntu2.1Ubuntu CVE tracker
Ubuntu 26.04 LTS (resolute)php8.58.5.4-0ubuntu1.5Ubuntu CVE tracker
Ubuntu 24.04 LTS (noble)php8.38.3.6-0ubuntu0.24.04.13Ubuntu CVE tracker
Ubuntu 22.04 LTS (jammy)php8.18.1.2-1ubuntu2.28Ubuntu CVE tracker
Ubuntu 20.04 LTS (focal)php7.47.4.3-4ubuntu2.29+esm5Ubuntu CVE tracker
Requires Ubuntu Pro
Ubuntu 18.04 LTS (bionic)php7.27.2.24-0ubuntu0.18.04.17+esm14Ubuntu CVE tracker
Requires Ubuntu Pro
Ubuntu 16.04 LTS (xenial)php7.07.0.33-0ubuntu0.16.04.16+esm22Ubuntu CVE tracker
Requires Ubuntu Pro (Legacy Support)

2. Install the update

Upgrade only the PHP packages of your branch (replace 8.3):

sudo apt update && sudo apt install --only-upgrade 'php8.3*' 'libapache2-mod-php8.3'

Ubuntu 16.04, 18.04 and 20.04 get the fix only through Ubuntu Pro (16.04 also needs Legacy Support). Check that ESM is enabled:

pro status

Attach the machine to your Ubuntu Pro subscription if it isn’t yet, then run the upgrade again:

sudo pro attach <your-token>

3. Restart PHP

Running PHP-FPM and Apache workers keep the old code in memory until they restart.

Restart every PHP-FPM service:

sudo systemctl restart "php*-fpm"

If Apache runs PHP as a module (mod_php):

sudo systemctl restart apache2

If needrestart is installed, list services that still use old libraries:

sudo needrestart -r l

4. Verify

The installed changelog should mention both CVEs (replace 8.3):

zgrep -E "CVE-2026-10961[89]" /usr/share/doc/php8.3-common/changelog.Debian.gz

Check a package changelog in the archive before installing it:

apt changelog php8.3-common | grep -E "CVE-2026-10961[89]"

Then confirm the version your website really uses with the temporary file from the self-check page.

Other environments

FAQ

Why does PHP still say 8.3.6 after the update?

Ubuntu applies security fixes to the version it shipped instead of moving to a new upstream release. What counts is the full package version: on 24.04 you need 8.3.6-0ubuntu0.24.04.13 or later.

Ubuntu 22.04 ships PHP 8.1, which is end-of-life. Is it fixed?

Yes. PHP 8.1 gets no official release, but Ubuntu backported the fix: php8.1 8.1.2-1ubuntu2.28.

Do I need to reboot?

No. Restarting PHP-FPM and Apache is enough for these PHP vulnerabilities.