Debian PHP 8.1 and PHP Core RCE (CVE-2026-109618, CVE-2026-109619), aka, PHP2Shell
So you still run PHP 8.1 in your Debian distribution, i.e., Trixie, Bookworm, Bullseye ...er, or even older, because your PHP application has not been completely upgraded -- for whatever reason -- here is a procedure for you to patch your Debian PHP 8.1 against the artificial intelligence (AI) -aided discovered remote-code-execution (RCE) PHP2Shell. Hopefully it will provide you a little more time and/or actionable insight so as not to take your PHP application offline just yet.
Given the severity of these vulnerabilities, the PHP security team provided minimal source-backports for PHP 7.4, PHP 8.0, and PHP 8.1 to help people building from source or without access to an LTS vendor.
Security advisory: Critical remote code execution vulnerabilities, update now
Thus, you may build your PHP 8.1 from the above official source or, since Debian does no provide long term support (LTS) for its PHP 8.1 release, we may do the next best thing: obtain the patch from a Debian derivative. And in fact, that is what this post is all about; borrowing the patch from Ubuntu Jammy and modify it accordingly for our Debian distribution.

Let's install PHP 8.1 build dependencies; wielding root or super user privilege:
Shell
apt-get install apache2-dev autoconf automake bison chrpath debhelper default-libmysqlclient-dev dh-apache2 dpkg-dev firebird-dev flex freetds-dev libacl1-dev libapparmor-dev libapr1-dev libargon2-dev libbz2-dev libc-client-dev libcurl4-openssl-dev libdb-dev libedit-dev libenchant-2-dev libevent-dev libexpat1-dev libffi-dev libfreetype6-dev libgcrypt20-dev libgd-dev libglib2.0-dev libgmp3-dev libicu-dev libjpeg-dev libkrb5-dev libldap2-dev liblmdb-dev libmagic-dev libmhash-dev libnss-myhostname libonig-dev libpam0g-dev libpcre2-dev libpng-dev libpq-dev libpspell-dev libqdbm-dev libsasl2-dev libsnmp-dev libsodium-dev libsqlite3-dev libssl-dev libsystemd-dev libtidy-dev libtool libwebp-dev libwrap0-dev libxml2-dev libxmlrpc-epi-dev libxslt1-dev libzip-dev locales-all netbase netcat-openbsd re2c systemtap-sdt-dev tzdata unixodbc-dev zlib1g-dev |
NOTE: Attached metztli-GCC14-debian-packaging-for-php-8.1.34-enhanced-with-XMLRPC-address-CVE-2026-109618-109619-ome.patch is designed to be used with the Debian Packaging for PHP 8.1.34-6 referenced immediately below:
Shell
git clone -b debian/8.1.34-6 --single-branch https://salsa.debian.org/php-team/php.git |

Notwithstanding, Debian Packaging for PHP 8.1.34-9 is in the queue and will not require the patch attached at the end of this post. But for now, if you were to attempt to clone PHP 8.1.34-9 you would get an error:
Shell
git clone -b debian/8.1.34-9 --single-branch https://salsa.debian.org/php-team/php.git |
Cloning into 'php'...
warning: Could not find remote branch debian/8.1.34-9 to clone.
fatal: Remote branch debian/8.1.34-9 not found in upstream origin
Accordingly, we assume command two(2) above prior to testing (with the --dry-run flag option) the application of our referenced patch:
Shell
cat ../metztli-GCC14-debian-packaging-for-php-8.1.34-enhanced-with-XMLRPC-address-CVE-2026-109618-109619-ome.patch | patch -d debian --dry-run --fuzz=0 -p1 |

Now we remove --dry-run flag option to patch for real our Debian Packaging for PHP 8.1.34-6:
Shell
cat ../metztli-GCC14-debian-packaging-for-php-8.1.34-enhanced-with-XMLRPC-address-CVE-2026-109618-109619-ome.patch | patch -d debian --fuzz=0 -p1 |

We examine the outcome of our applied patch:
Shell
head debian/changelog | |
ls debian/patches |

And proceed to debianize our PHP 8.1.34 source with the enhanced patches under the debian/patches directory:
Shell
ln -s debian/patches | |
quilt push -a --fuzz=0 |


Prior to our build, we proceed to modify our debian/changelog so as to reflect the fact that our build addresses and/or mitigates the PHP Core RCE (CVE-2026-109618, CVE-2026-109619) critical vulnerability, for instance:
Shell
dch -v 8.1.34-10 -D metztli |


We start the PHP 8.1 build:
Shell
dpkg-buildpackage -F -us -uc -j8 -T binary-arch,binary-indep |

After approximately half-an-hour, assigning eight(8) threads/cores -- as evidenced by the -j8 flag to our dpkg-buildpackage Debian utility, our PHP 8.1 build hack completes:

Shell
git clone -b debian/92 --single-branch https://salsa.debian.org/php-team/php-defaults.git |
AI-Assisted Research Uncovers Critical PHP2Shell RCE Vulnerabilities
DISCLAIMER:P although due diligence has been applied, this resource is made available for testing/evaluation purposes on an AS IS basis. The procedure only reflects my own modifications, my limited testing, and the potential user(s) who execute(s) the procedures assumes all risks.
Please do not hold me or Metztli Information Technology (and/or its associates) responsible if the information provided here does not achieve the desired result. The information is provided AS IS and with the hope that it may be useful to the Internet community --especially those in a predicament due to the critical software vulnerability.
Notwithstanding, There is no implicit or explicit guarantee that the information presented here is accurate --even though due diligence was exercised during the procedure. Accordingly, if an user(s) decide to use the software and/or implement the procedure or shell commands described here she, he, or them, do so at her, his, or their own risk. You have been forewarned.
Metztli IT, but not other entities, reserves the right to modify the content -- to correct and/or elucidated procedure(s), for instance -- and/or even delete all or partial, including blog post, without previous notice.

Attachments:
- metztli-GCC14-debian-packaging-for-php-8.1.34-enhanced-with-XMLRPC-address-CVE-2026-109618-109619-ome.patch (790 KB)
- libapache2-mod-php8.1_8.1.34-10_amd64.deb (1.6 MB)
- libphp8.1-embed_8.1.34-10_amd64.deb (1.6 MB)
- php8.1-bcmath_8.1.34-10_amd64.deb (15 KB)
- php8.1-bz2_8.1.34-10_amd64.deb (10 KB)
- php8.1-cgi_8.1.34-10_amd64.deb (1.6 MB)
- php8.1-cli_8.1.34-10_amd64.deb (1.6 MB)
- php8.1-common_8.1.34-10_amd64.deb (661 KB)
- php8.1-curl_8.1.34-10_amd64.deb (33 KB)
- php8.1-dba_8.1.34-10_amd64.deb (23 KB)
- php8.1-dev_8.1.34-10_amd64.deb (482 KB)
- php8.1-enchant_8.1.34-10_amd64.deb (9.2 KB)
- php8.1-fpm_8.1.34-10_amd64.deb (1.6 MB)
- php8.1-gd_8.1.34-10_amd64.deb (28 KB)
- php8.1-gmp_8.1.34-10_amd64.deb (21 KB)
- php8.1-imap_8.1.34-10_amd64.deb (32 KB)
- php8.1-interbase_8.1.34-10_amd64.deb (15 KB)
- php8.1-intl_8.1.34-10_amd64.deb (124 KB)
- php8.1-ldap_8.1.34-10_amd64.deb (30 KB)
- php8.1-litespeed_8.1.34-10_amd64.deb (1.6 MB)
- php8.1-mbstring_8.1.34-10_amd64.deb (387 KB)
- php8.1-mysql_8.1.34-10_amd64.deb (115 KB)
- php8.1-odbc_8.1.34-10_amd64.deb (31 KB)
- php8.1-opcache_8.1.34-10_amd64.deb (345 KB)
- php8.1-pgsql_8.1.34-10_amd64.deb (57 KB)
- php8.1-phpdbg_8.1.34-10_amd64.deb (1.6 MB)
- php8.1-pspell_8.1.34-10_amd64.deb (8.6 KB)
- php8.1-readline_8.1.34-10_amd64.deb (12 KB)
- php8.1-snmp_8.1.34-10_amd64.deb (21 KB)
- php8.1-soap_8.1.34-10_amd64.deb (121 KB)
- php8.1-sqlite3_8.1.34-10_amd64.deb (29 KB)
- php8.1-sybase_8.1.34-10_amd64.deb (12 KB)
- php8.1-tidy_8.1.34-10_amd64.deb (18 KB)
- php8.1-xml_8.1.34-10_amd64.deb (109 KB)
- php8.1-xmlrpc_8.1.34-10_amd64.deb (13 KB)
- php8.1-xsl_8.1.34-10_all.deb (38 KB)
- php8.1-zip_8.1.34-10_amd64.deb (24 KB)
- php8.1_8.1.34-10_all.deb (39 KB)