Gradient background transitioning from teal at the top to dark green at the bottom.

PHP2Shell May Reach Your Agents Through Their Tools

A critical PHP flaw gives attackers code execution and a read of worker memory, and a growing share of the tools your agents call runs on PHP, from the WordPress MCP Adapter to Laravel MCP. We cover where agents touch PHP, how to tell if yours do, and the control that holds when a trusted tool server turns hostile.

Published
October 21, 2026

TL;DR

  • PHP2Shell is two critical bugs in PHP's engine (CVE-2026-109618 and CVE-2026-109619, CVSS 9.2) that hand an unauthenticated attacker code execution and a read of live worker memory. Nearly every release since PHP 5.4 is affected. Fixes shipped October 21 in 8.5.12, 8.4.27, 8.3.36 and 8.2.35, with backports for 7.4 through 8.1. PHP calls updating the only complete mitigation.
  • Agent harnesses rarely run on PHP themselves. A growing share of the tools they call does: the WordPress MCP Adapter (50,000+ active installs), Laravel MCP, the Drupal MCP Server and the official PHP MCP SDK all serve agents over HTTP, through the request path these bugs live in.
  • Owning a PHP host means owning the tool server every connected agent trusts: its tool descriptions, its responses, and every token an agent sends it. The memory-disclosure variant skims those tokens without a shell.
  • Start by patching, then treat your agents' MCP inventory as a PHP exposure list, rotate the credentials agents handed to PHP-hosted endpoints, and keep a control at the tool call that holds whoever is answering on the other end.

A patch that could not wait

PHP2Shell is a flaw in PHP's own engine, so every application on an affected version is exposed, down to a bare "Hello World". When a request runs out of memory partway through startup, PHP leaves stale internal state behind, and the next request on the same worker reuses it. One chain turns that into unauthenticated remote code execution. Another returns an attacker-sized slice of worker memory inside a PHPSESSID cookie, memory that Wiz says may hold passwords, authentication tokens, API keys and certificates from other requests. Wiz demonstrated RCE against WordPress, Drupal and Joomla, and Calif extended the list to Magento, Laravel, Symfony and others. Details leaked a day early, and several vendors were reporting exploitation attempts before the fixes shipped, none confirmed successful at the time of writing.

Update to a fixed version, or take your vendor's backport. For hosts that cannot move today, PHP lists partial mitigations (disabling session upload progress and fatal-error backtraces, lifting the memory limit) and says none of them makes an installation safe. A WAF with rules for the known vectors buys time. The web tier is only the first place this lands.

Where your agents touch PHP

The mainstream harnesses rarely run on PHP. Claude Code, Codex, Cursor and their peers are built in TypeScript, Python and Rust. The PHP exposure for an agent program lives one hop away, in the servers the agents call and the credentials they carry to them.

  • MCP servers inside PHP applications: The WordPress MCP Adapter exposes a site's Abilities API to any MCP client over HTTP, authenticated as a WordPress user. The Drupal MCP Server puts an /mcp endpoint inside the site and reports 1,300 installs while still in beta. Laravel MCP registers servers as web routes behind Sanctum or Passport tokens. The official PHP SDK, maintained by the PHP Foundation and Symfony, ships HTTP transport for everyone else. Each of these endpoints is served by the request path PHP2Shell abuses.
  • Keys stored where PHP can read them: WordPress 7.0's Connectors API holds Anthropic, Google and OpenAI API keys so site features can call models, and keys saved through the admin screen sit unencrypted in the database.
  • Content agents read: WordPress, Drupal and MediaWiki power a large share of what agents browse and ingest. A compromised site keeps its domain reputation, so content planted for agents arrives with years of trust attached.
  • The agent can be the delivery path. PHP2Shell needs nothing more than an HTTP request to a vulnerable worker. An agent with a fetch tool, fed injected instructions, can send that request to an internal PHP host the outside attacker could never reach on their own. Reachability is the whole game, and an agent reaches further than the internet does.

The attack chain, host to agent

Once an attacker lands on a PHP host, or merely reads its memory, the tokens the agents sent there are theirs, and so is the MCP server running on it. From that point, the tool descriptions and tool results every connected agent reads come from the attacker, carrying the server's name and the organization's trust, even though no prompt has been jailbroken and no harness exploited. The agent simply keeps following a tool it has always followed.

We see this layer every day across the environments we monitor: coding agents connected to a managed WordPress platform through its MCP server, with tools that run WP-CLI and pull environment configuration; a Laravel MCP server taking shape inside a product team's repository; agents holding WordPress application passwords so they can push pages over the REST API. This is what wiring an agent into a content stack looks like in 2026.

The remediation is agentic too

OpenAI shipped a version checker and two Codex skills for finding vulnerable hosts, and this is the week many teams will point coding agents at their fleets to patch at scale. Emergency work with sudo across many hosts is where an agent's wrong assumption does the most damage, as when a Cursor agent reached for a leftover broad-scope token and wiped a production database in seconds.

A footnote for the MCP crowd: the protocol's co-creator, David Soria Parra, was the release manager for PHP 5.4 and 5.5, and 5.4 is the oldest version PHP2Shell reaches.

What to notice as defenders

Before the alerting, answer one question: which of your agents' tools sit on PHP? The inventory you already keep gets you most of the way.

- Trace each MCP server to the application behind it: The PHP-hosted ones are the WordPress MCP Adapter, the Drupal MCP Server, Laravel MCP and anything built on the official PHP SDK. A response-header check helps, though an MCP server often sits behind a Node or Go proxy, so it can confirm the application rather than the front door.

- Note the credential each agent hands those servers: The application passwords and bearer tokens agents send are what the memory-read variant skims, so that list doubles as your rotation list.

- Find out who patches the PHP: A managed platform such as WordPress VIP or Pantheon does it for you, so confirm the build. A self-hosted app is yours to patch today.

On the web tier, Wiz's signals are the ones to wire into alerting:

  • Unusual multipart requests followed by memory-limit errors.
  • Bursts of HTTP 500s on endpoints that never fail.
  • Oversized or malformed PHPSESSID cookies in responses.
  • PHP worker churn with no deploy to explain it. Application logs will show little, since the activity happens below the application layer.

On the agent tier, look one hop out from those servers:

  • Changed tool surfaces: MCP servers whose tool list or descriptions changed after October 20, or tool results that start carrying instructions instead of data.
  • New destinations after a PHP-hosted call: an agent that calls a WordPress or Laravel endpoint and then reaches a domain it has never used.
  • Outbound requests to internal PHP hosts: an agent sending HTTP at an internal WordPress, Laravel or Drupal host it has no task-level reason to touch, which is what the injected-delivery path looks like from the inside.
  • Credentials from new places: application passwords and bearer tokens that agents sent to PHP endpoints before the patch, now used from unfamiliar sources. Rotate them either way.
  • Fleet-patching sessions outside change windows, with sudo, package managers and container pulls fanning out across hosts.

How Capsule helps

  • Inventory: Capsule keeps the list of MCP servers your agents connect to, with endpoint, transport and authentication type, and the tools behind each one. The PHP-hosted servers become a filter on a list you already have.
  • Posture: Findings flag over-permissioned MCP servers, tools with destructive reach, servers that ingest untrusted content, and secrets hardcoded in skill files, alongside reputation assessments for the servers and skills themselves. The servers that matter most after a compromise are usually the ones already carrying a finding.
  • Runtime enforcement: Capsule reads each tool call and tool result at the boundary and stops prompt injection, credential leakage, dangerous actions and external data exposure before they reach your systems, with policies that can be scoped to a single MCP server. When a trusted server starts answering with someone else's instructions, the control that holds is the one applied to what the agent does next.

Cite This Article

Kaduri, B.
(
2026
).
PHP2Shell May Reach Your Agents Through Their Tools
. Capsule Security. https://www.capsulesecurity.io/blog-post/
php2shell-may-reach-your-agents-through-their-tools

On this page

Section heading

Read more articles

Research

How Auto-steer keeps AI agents working after a block

Blocking a risky tool call stops the action, but it can also stop the work: in our survey of nearly 6,000 Claude Code sessions, a hard block left the rest of the request waiting for a person 75% of the time. Auto-steer holds only the risky call and reminds the agent what the user asked for, and 93% of agents finished the rest of the request with no one stepping in. In our attack simulation, steering got 90% of blocked sessions to finish the task and cut repeat blocked attempts from 48% to 10%. When steering stops helping, Auto-steer falls back to a hard stop.

Bar Kaduri
December 3, 2026
News

Steer, Don't Stop: The Next Phase of Agentic Security

Blocking an AI agent mid-task means a failed task. Why the next phase of agentic security is steering agents back on course, not shutting them down. (edited)

Naor Paz
November 26, 2026
Research

Inside the model flywheel: how we became an attack swarm's favorite model

Autonomous attack swarms run on the AI keys they steal. We fed one a bait key and became its double agent.

Bar Kaduri
November 24, 2026