AttackResearch disclosurePHP (CVE-2026-109618, CVE-2026-109619)

PHP2Shell, and where an AI firewall can and cannot stand in its way

Two critical PHP flaws, patched in emergency releases on 21 October 2026, let an unauthenticated request corrupt PHP’s memory and run code before application logic sees it. NoFly does not patch PHP. Where it helps is narrow and worth being precise about: a PHP service reached only through NoFly’s MCP gateway never receives the crafted request, and NoFly refuses to pretend it can exploit a memory-corruption bug it cannot.

By the NoFly team

What NoFly would decideIllustrative
Blocked before it ranMCP gateway
POST /mcp Transfer-Encoding: chunked Content-Type: multipart/form-data …
Agent
php-mcp-server · upstream
Came from
A crafted request aimed at a PHP MCP server behind the gateway
Rule
Only parsed JSON-RPC, re-serialized with a declared length, reaches an upstream
Why
The gateway rebuilds the request from parsed JSON, so the attacker’s own framing, multipart bodies and chunked transfer included, never reaches PHP.

What happened

On 21 October 2026 the PHP project shipped emergency releases (8.5.12, 8.4.27, 8.3.36, 8.2.35) for two flaws the industry called PHP2Shell, CVE-2026-109618 and CVE-2026-109619, both rated 9.2. They stem from PHP leaving its memory in a corrupted state when a request ends abnormally, and both can be driven to remote code execution by an unauthenticated request.

Every way of serving PHP is affected, PHP-FPM, Apache with mod_php, php-cgi, FrankenPHP and LiteSpeed, with mod_php considered highest risk. The problem sits in how PHP handles a request that ends abnormally, which an unauthenticated caller can bring about before application code has a say.

This is a runtime memory-corruption bug in PHP, not an AI agent flaw. We are writing it up anyway, because PHP increasingly sits behind MCP servers and internal tools that agents call, and because the honest answer to “would your firewall have stopped it” is more useful than a confident one.

  1. 01

    A crafted request reaches a PHP service directly.

  2. 02

    PHP’s request handling corrupts its own memory before app code runs.

  3. 03

    That corruption is driven to code execution on the server.

  4. 04

    The attacker has a shell on a box an agent may depend on.

Why it worked

Probable cause

A memory-handling bug in PHP’s request path, reachable by anyone who can send the service an HTTP request in the right shape.

How NoFly stops it

  • Protect

    A PHP MCP server reachable only through NoFly’s hosted gateway does not receive the attacker’s bytes. The gateway parses JSON-RPC and forwards it re-serialized with a declared content length and a four-header allow-list, so no multipart body, chunked transfer or stray cookie crosses to the upstream. That narrows the reach rather than closing it: one of the two flaws can also be set off by an error the application itself raises on a valid request, and the barrier only holds where the gateway is the one way in.

  • Attack

    When an advisory like this one is turned into an attack against your agents, NoFly refuses to fake it: a memory-corruption, use-after-free or out-of-memory bug is marked as something the attack engine cannot honestly reproduce, rather than reported as a pretended pass or breach.

  • Discover

    The MCP inventory shows how every server on every machine is launched, so the ones started with php are easy to list and patch first. NoFly does not inventory every PHP install on your hosts; that is a dependency scanner’s job.

What to do this week

This week4 actions
  1. Patch PHP to 8.5.12, 8.4.27, 8.3.36 or 8.2.35. Nothing here is a substitute for that.
  2. List the MCP servers and agent tools that run on PHP, and patch those first.
  3. Put PHP services that agents reach behind the gateway rather than exposing them directly.
  4. Remember the gateway reduces reach here, it does not make an unpatched PHP server safe.

Find out what your AI is allowed to do today.

Book a call and we will map your agents, MCP servers and keys with you, or start on one laptop with the free scan.

Book a demo
npm i -g @nofly/agent