PHP2Shell (CVE-2026-109618, CVE-2026-109619): check and update
PHP2Shell (CVE-2026-109618, CVE-2026-109619) is two unauthenticated PHP RCE flaws (CVSS 9.2). Update to 8.2.35, 8.3.36, 8.4.27 or 8.5.12, or apply stopgaps.
PHP2Shell, the two PHP vulnerabilities CVE-2026-109618 and CVE-2026-109619, is fixed by updating to PHP 8.5.12, 8.4.27, 8.3.36 or 8.2.35. "PHP2Shell" is not a php.net name; it is the name used for these two CVEs by, among others, the Dutch National Cyber Security Centre's operational information repository and Siemens ProductCERT advisory SSA-566512.
On 2026-10-21 the PHP project released 8.5.12, 8.4.27, 8.3.36 and 8.2.35, fixing two vulnerabilities that can lead to unauthenticated remote code execution. Both are CVSS v4.0 9.2, and the advisory asks every PHP user to update immediately. Official sources: the php.net 2026 news archive and GHSA-6wmf-4rv5-p3rp.
[1] Decide whether the server is in scope. The advisory covers every PHP installation that serves web requests: PHP-FPM, Apache mod_php, php-cgi, FrankenPHP and LiteSpeed. It rates mod_php highest. A host that only runs CLI scripts is not on that list, but it uses the same packages, so update it too.
| CVE | What it is | Advisory |
|---|---|---|
| CVE-2026-109618 | Out-of-memory handling interrupts PHP while request data is half-initialized, and cleanup treats it as valid | GHSA-w8hw-w9fx-j79w |
| CVE-2026-109619 | Request state survives after its memory is freed, and the next request on the same worker uses it | GHSA-6wmf-4rv5-p3rp |
[2] Check whether the installed PHP is a fixed build. Upstream, anything below 8.2.35, 8.3.36, 8.4.27 or 8.5.12 is affected. Ubuntu keeps the upstream version number and backports the fix, so compare the package version instead (USN-8948-1, 2026-10-21).
| Release | Source package | Fixed package version |
|---|---|---|
| Ubuntu 24.04 LTS | php8.3 | 8.3.6-0ubuntu0.24.04.13 |
| Ubuntu 22.04 LTS | php8.1 | 8.1.2-1ubuntu2.28 |
| Ubuntu 26.04 LTS | php8.5 | 8.5.4-0ubuntu1.5 |
| Ubuntu 26.10 | php8.5 | 8.5.9-0ubuntu2.1 |
The number php -v prints (8.3.6 on 24.04) is a separate matter; PHP shows 8.3.6, is it patched? covers how to compare. To see what the repository offers, run the command below. **Refresh the package lists with apt-get update first.** Before that, Candidate: is also the old version and equals Installed:, so an unfixed server reads as fixed.
# apt-get update$ apt-cache policy php8.3-cliphp8.3-cli: Installed: (none) Candidate: 8.3.6-0ubuntu0.24.04.13 Version table: 8.3.6-0ubuntu0.24.04.13 500 500 http://kr.archive.ubuntu.com/ubuntu noble-updates/main amd64 Packages 500 http://security.ubuntu.com/ubuntu noble-security/main amd64 Packages 8.3.6-0maysync1 500 500 http://kr.archive.ubuntu.com/ubuntu noble/main amd64 Packages[3] Upgrade the packages. List the PHP packages first, then upgrade only those. These commands were not run for this article; they are standard APT usage.
# apt-get update# apt list --upgradable 2>/dev/null | grep -i php# apt-get install --only-upgrade php8.3-cli php8.3-fpm libapache2-mod-php8.3Replace the package names on the last line with the ones the list shows. If you built from source or use an official binary (including Windows), take the matching branch from the PHP downloads page. Windows builds were reissued on 2026-10-26 as 8.5.12-1, 8.4.27-1, 8.3.36-1 and 8.2.35-1: same PHP source, rebuilt with Brotli 1.2.1, which fixes CVE-2026-111497 (php.net says it is reachable through the cURL extension when automatic HTTP response decompression is enabled). On Windows, take the -1 build.
[4] Restart the services after upgrading. On 24.04 the php8.3-fpm install script restarts the service on upgrade and the needrestart hook restarts the services that need it, by default. Processes started outside a service, or servers with automatic restarts turned off, still keep processes on old files, so check. The evidence, the check and the restart are in Finding processes still on old code with needrestart.
[5] Use stopgaps only if you cannot upgrade right now. The advisory is explicit: these reduce exposure but do not make an installation safe; only the update is a complete fix.
| Target | Measure (summary of the advisory) |
|---|---|
| CVE-2026-109618 | Set memory_limit=-1 where applications cannot override it, such as php_admin_value in the FPM pool or the Apache config, and check that no pool, directory or app setting puts a finite limit back |
| CVE-2026-109618 | Lower post_max_size: 8M for apps without uploads, 32M if uploads are needed. Keep upload_max_filesize below it |
| CVE-2026-109618 | Use container or cgroup limits as an availability boundary, killing only the affected worker. Do not use RLIMIT_AS or RLIMIT_DATA; they can trigger the vulnerable allocation failure |
| CVE-2026-109619 | Set session.upload_progress.enabled=0 and restart every worker. Do not rely on ini_set() or .user.ini |
| CVE-2026-109619 (PHP 8.5) | Set fatal_error_backtraces=0 and restart every worker |
| CVE-2026-109618 | Consider limits at the web server or proxy for decoded request size, input field count, multipart part count, header count and nesting depth. They must also cover requests without a usable Content-Length |
| CVE-2026-109619 | Remove invalid or deprecated per-request settings that emit diagnostics before initialization, and fix attacker-reachable fatal errors and execution timeouts. Hiding diagnostics with error_reporting, display_errors or @ does not help |
Checking that the session upload progress setting really applied has its own article: Turning off session.upload_progress.
Record the original values before applying stopgaps, and roll them back after patching.
- Copy every file you change first (FPM pools
/etc/php/8.3/fpm/pool.d/*.conf, the Apache site config,php.ini) withcp -a <file> <file>.bak, and note the current values, for examplephp-fpm8.3 -i | grep -E '^(memory_limit|post_max_size|upload_max_filesize|session.upload_progress.enabled)'(values a pool overrides withphp_admin_valueare read from the pool file itself). memory_limit=-1lets a single request use all of the server's memory. While it is in place, keep the container or cgroup limit from the third table row and watch memory use.- Once the fixed release is running after [3] and [4], put
memory_limitback to its original value and restart every worker. The advisory says the patch keeps "PHP's normal ability to limit memory consumption". - Do not roll back
session.upload_progress.enabled=0. The 10/23 notice above says to keep it until the next regular release, and the advisory suggests leaving it off even after patching if you do not need the feature. - The advisory says a lower
post_max_sizeand frontend request limits "reduce hard OOM and denial of service risk even after applying the patch", so keep them if the app copes. If uploads break or similar, restore the original values. - The advisory does not say whether to restore
fatal_error_backtraces=0(8.5) after patching. If you need the traces, restore it once the patched version is confirmed. - When rolling back, edit only the relevant lines instead of copying the
.bakfile back (restoring the whole copy would also undo settings you meant to keep). Check withphp-fpm8.3 -t, then restart the workers withsystemctl restart php8.3-fpm(for Apache mod_php,apachectl configtestthensystemctl restart apache2).
[6] PHP 8.1 and older get no official release. The advisory points to distribution or LTS-vendor backports, or an upgrade to a supported branch, and given the severity the PHP security team also published minimal source backports for PHP 7.4, 8.0 and 8.1 (for people building from source or without an LTS vendor). As the table shows, Ubuntu 22.04 fixed it in the php8.1 package; 20.04 and older are fixed through Ubuntu Pro (ESM) in USN-8948-2 (php7.4 on 20.04: 7.4.3-4ubuntu2.29+esm5). The branch calendar is in Is my PHP still getting security patches?.
Where checks go wrong
- The 24.04 repository lists both
8.3.6-0ubuntu0.24.04.13and8.3.6-0maysync1. The first is the fixed build. Seen from package lists that have not been refreshed withapt-get update,Candidate:can still be the old one. - Judging a distribution package by the upstream number (8.3.36) makes the fixed 24.04 package look too old. The linked article in step [2] explains that mismatch.