PHP2Shell: how to lock down your server now that AI is finding the exploits

Patching fixes this bug. Taking your server off the public internet fixes the next one.

By AIR Desk · Published · 5 min read
A server inside a glass vault, circled by orange scanning drones, with one blue tunnel of light as the only way in
In shortPHP2Shell is a pair of critical PHP flaws (CVE-2026-109618 and CVE-2026-109619), found with the help of AI and patched on October 21, 2026. Update PHP to 8.5.12, 8.4.27, 8.3.36 or 8.2.35 and restart PHP workers. Then close your server's public ports with Cloudflare Tunnel and Tailscale, so the next AI-found bug has nothing to reach.

What happened

On October 21, PHP shipped emergency fixes for two critical bugs in PHP itself: CVE-2026-109618 and CVE-2026-109619. Security researchers call the pair PHP2Shell.

Both let an attacker run their own code on your server without logging in. They sit in the PHP engine, not in WordPress or Drupal or your own code. So it doesn't matter how carefully your app is written. If it runs on an unpatched PHP, it's exposed.

Almost every PHP version is affected, going back to PHP 5.4. PHP runs roughly 70% of websites, which is why this one made the evening news.

The AI part

This is one of the first internet-scale bugs that AI clearly helped find.

Wiz Research found the flaws using its own tooling plus Gemini 4 Argon and GPT-5.6 Sol. OpenAI says it led a coalition that worked on the issue for about two months before disclosure. The first bug was found on August 19 and reported to PHP five days later.

Attackers were fast too. Amazon's honeypots logged an exploit attempt on October 17, four days before the fix went public. Cloudflare's CEO reported millions of attempts within hours of the announcement.

So far, the attempts seen by Sophos and Arctic Wolf have failed, and Canada's Cyber Centre says it has not confirmed active exploitation. Researchers say a reliable exploit is harder to build than first feared. Don't read that as safe. It's a head start.

Step 1: patch PHP (the only real fix)

Your PHP branch Update to
8.5 8.5.12
8.4 8.4.27
8.3 8.3.36
8.2 8.2.35
8.1, 8.0, 7.4 No official release. Use your distro's patched package, or upgrade
7.3 and older, PHP 5 No fix. Upgrade, or take it offline

Three things people get wrong:

  • Update the PHP that serves your website, not just the one in your terminal. That's PHP-FPM, Apache mod_php, php-cgi, LiteSpeed or FrankenPHP, whichever your server uses.
  • Restart every PHP worker after updating. Old workers keep running the old, vulnerable code.
  • Don't trust the version number alone. Linux distributions often backport the fix into an older version string. Check your package changelog for the two CVE numbers.

Apache mod_php setups carry the highest risk, so patch those first. And check containers and appliances that bundle their own PHP. They don't update with your system.

Step 2: if you can't patch today

None of these are fixes. They buy time.

  • Set session.upload_progress.enabled=0. It reduces exposure but does not fully stop PHP2Shell. It is the recommended fix for the newer, rarer bug CVE-2026-115560, disclosed on October 23, so keep it on until PHP's next release. Check it on the running web server, not with php -i in a shell.
  • Turn on your WAF's emergency rules. Cloudflare, Fastly, Vercel and Google shipped them. Cloudflare itself calls them a stopgap, and they only protect traffic that actually goes through them.
  • Block multipart uploads at the web server if your site doesn't accept uploads. This targets the known entry path but breaks file uploads and some forms.
  • Take the site offline or put it behind a login. That's what Canada's Cyber Centre advises for systems that can't be patched right away.

Step 3: take your server off the public internet

Here's the part that outlives this bug.

Indie maker Pieter Levels (@levelsio) took the blunt route on October 21: "I pre-emptively disconnected ALL my sites / VPS servers from the web." Then he described the setup he recommends to everyone running a VPS. It's simple and it works:

His framing: there are two ways into a server. Through your website, or through the server itself (SSH and any other open port). The fix is to close both to the public.

  1. Website traffic goes through Cloudflare Tunnel. A small program called cloudflared runs on your server and opens a connection out to Cloudflare. Visitors reach your site through Cloudflare, which filters attacks on the way in. Your server no longer needs to answer on ports 80 or 443 at all.
  2. Your own access goes through Tailscale. It puts your laptop, phone and server on a private network that only your devices can join, similar to a company VPN. You SSH over Tailscale instead of the open internet.
  3. Then close every inbound port in your hosting provider's firewall. On Hetzner, for example, an empty firewall blocks everything.

So how do visitors and your laptop still reach the server? The server calls out to Cloudflare and Tailscale, never the other way around. With no inbound connections needed, there's no open door to attack.

Before you close the door:

  • Keep a back door you control. Make sure your provider's web console works, so a mistake doesn't lock you out.
  • Test from outside. Try reaching your server's IP directly on ports 22, 80 and 443. All three should fail.
  • Confirm there's no bypass. If your server's real IP still answers web requests, the tunnel protects nothing.

This doesn't replace patching. A bug in your app can still be reached through the tunnel. But it shrinks your attack surface from "the whole internet can poke every port" to "one filtered front door". When the next AI-found bug drops, that's the difference between a bad night and a calm one.

Step 4: check you weren't already hit

Signs worth looking for in your logs, according to the researchers and Canada's Cyber Centre:

  • Unusual multipart requests followed by out-of-memory errors
  • Bursts of HTTP 500 errors
  • Oversized or malformed PHPSESSID cookies
  • PHP workers restarting for no clear reason
  • Unexpected processes, files, user accounts or outbound connections from the web server

If something looks off, assume the server is compromised: rotate any credentials stored on it, including cloud keys, and rebuild from a clean image.

What it means

AI now finds serious bugs in code the whole internet relies on, and it finds them in weeks. The same tools are available to attackers. The time between disclosure and mass exploitation is shrinking to hours.

Patch speed still matters. But the bigger win is architecture: a server that isn't reachable from the internet doesn't care how clever the next exploit is.

Sources

  1. Wiz Research: PHP2Shell, AI uncovers critical RCE vulnerabilities
  2. Canadian Centre for Cyber Security: Alert AL26-026, critical vulnerabilities impacting PHP
  3. watchTowr: PHP2Shell FAQ, CVE-2026-109618 and CVE-2026-109619 fixes
  4. The Hacker News: PHP warns of another unpatched RCE risk (CVE-2026-115560)
  5. The Hacker News: PHP2Shell, what actually protects you and what doesn't
  6. PBS NewsHour: AI discovered a vulnerability that could impact 70% of websites
  7. Cloudflare docs: Cloudflare Tunnel
  8. Tailscale docs: SSH into a Linux VM
  9. Pieter Levels (@levelsio) on X