PHP2Shell on PHP older than 8.2: what you can do without a release
The short answer depends on your PHP version. On 8.2 or newer, install the fixed release. On 7.4, 8.0 or 8.1 there is no release, but the PHP security team published source patches, and your Linux distribution may already ship them. On 7.3 or older there is nothing from the PHP project, so you reduce the exposure and plan the upgrade.
This article is for the owner of an old PHP application and whoever looks after its server. It covers what PHP2Shell is, how to find out where you stand, and what to change today.
What PHP2Shell is
PHP2Shell is the name for two flaws in PHP itself, CVE-2026-109618 and CVE-2026-109619. Both are rated critical. They are in the PHP engine, not in your application, a framework or a plugin, so they affect a site no matter how carefully its code was written.
An attacker needs no login. A crafted web request can make PHP mishandle its own memory, and the PHP project reports that this can lead to the attacker running their own code on the server. The project confirmed a working attack against Apache with mod_php, the setup most old PHP applications still use.
The fixes were released on October 21, 2026, for supported PHP versions only. PHP 8.1 and everything older no longer receive releases from the PHP project.
Step 1: find out which PHP serves your site
The version that matters is the one answering web requests. It is often not the one a command line reports, because a server can have several PHP versions installed.
- Ask your host or check the control panel. Most hosting panels show the PHP version per site.
- Check from the site itself. A temporary page that calls
phpinfo()shows the version serving the site. Delete it straight afterwards; it tells an attacker a lot. - Don't trust the version number alone on Linux. Distributions such as Debian and Ubuntu patch old PHP versions without changing the main version number. Check that the distribution's security update for PHP is installed.
Step 2: see what exists for your version
| Your PHP | What exists | What to do |
|---|---|---|
| 8.2, 8.3, 8.4, 8.5 | Fixed releases: 8.2.35, 8.3.36, 8.4.27 and 8.5.12. | Install the fixed release and restart PHP. |
| 7.4, 8.0, 8.1 | No release. The PHP security team published source-only patches, and some Linux distributions and paid long-term-support vendors ship patched packages. | Check whether your distribution or vendor has a patched package. If not, apply the settings below and plan the upgrade. |
| 7.3 and older | Nothing from the PHP project. | Apply the settings below, limit what the server accepts, and plan the upgrade. A paid long-term-support vendor may cover your version. |
The source patches for 7.4, 8.0 and 8.1 are not something to install with one command. They are changes to PHP's source code, meant for people who build PHP themselves. If your server uses PHP packages from a distribution or a host, the practical question is whether that supplier has shipped them.
Step 3: apply the PHP project's interim settings
The PHP project published settings that block the attack paths it has confirmed. It is direct about their limit: they are not a complete fix, and only updating is.
memory_limit = -1
post_max_size = 8M ; 32M if the site takes file uploads
upload_max_filesize = 8M ; keep it below post_max_size
session.upload_progress.enabled = 0- Set them where PHP reads them first. Use
php.ini, the PHP-FPM pool file or the Apache configuration. Settings made in application code or in a.user.inifile take effect too late. - Restart every PHP process afterwards. A process that was already running keeps the old settings.
- Check nothing overrides the memory setting. A site-level or application-level memory limit puts the risk back.
- Expect two side effects. Upload progress bars that rely on PHP stop working, and large uploads are refused.
Removing the memory limit sounds backwards, and on its own it means one runaway request can use all the server's memory. The PHP project suggests pairing it with a memory cap on the container or service instead. It warns against the older process limits RLIMIT_AS and RLIMIT_DATA, which can trigger the flaw.
Step 4: limit what reaches PHP
The confirmed attacks use file-upload requests. The less of that traffic reaches PHP, the smaller the exposure.
- Block upload requests where the site takes none. If the application has no upload forms, the web server can refuse multipart requests before PHP sees them.
- Cap request size at the web server. Set it in Apache, nginx or the proxy in front, not only in PHP.
- Take it off the public internet if you can. An internal tool that only staff use can sit behind a VPN or an address allowlist until it is upgraded.
Step 5: look for signs someone got in first
Attack attempts were reported the day the fixes came out. If the server sat exposed for weeks, check before assuming it is clean:
- PHP files you don't recognise in upload or cache folders
- Administrator accounts nobody created
- Scheduled tasks nobody set up
- The web server connecting out to addresses you don't know
Finding any of these means the job has changed from prevention to incident response, which is separate, specialist work.
Why “just upgrade PHP” is not one step
For a modern application, moving to a fixed PHP version is an afternoon. For an old one it is a project, because the application was written for the old PHP. CakePHP 2, for example, was never built for PHP 8, so the framework has to move before PHP can. We cover that path on the CakePHP rescue page.
There is also a second date. PHP 8.2 loses security support on December 31, 2026, so a server patched to 8.2 today is unsupported again in weeks. Plan the upgrade to land on 8.3 or newer.
Want this done for you? Our PHP2Shell check covers steps 1 to 4 on one server for $495 fixed, with a written summary of what we found and changed.
