$HEADLESS SYSTEMS
$ cat /blog/php2shell-agent-security-tools

After php2shell: let a coding agent run your incident response

Petr Pátek··7 min·systems
After php2shell: let a coding agent run your incident response

The attacker’s advantage in a disclosure week is speed, and the cheapest way for a defender to take it back is to stop doing the response by hand. A coding agent such as Claude Code can read an advisory, scan your estate, search your logs and open the patch, but only against systems that answer a program: a CLI, an API or an MCP server. This post walks the response to the php2shell PHP flaws and the Node.js Brotli flaw as one loop, names the headless tool for each step, and says what each tool’s own documentation claims, no more.

None of this is Bitvea experience. The facts about the vulnerabilities and the tools are from public sources, named inline, and the reasoning that connects them is ours.

What the week handed defenders

php2shell is two CVEs in the PHP engine, CVE-2026-109618 and CVE-2026-109619. The php.net release notice calls it “a security release fixing two critical vulnerabilities” that can allow unauthenticated remote code execution. According to Help Net Security, the fixes are in PHP 8.5.12, 8.4.27, 8.3.36 and 8.2.35, and the PHP project no longer supports 8.1 and earlier.

Corgea’s analysis says an out-of-memory bailout during multipart parsing “can leave half-initialized request state”. The same week brought CVE-2026-111497 in Node.js. Rescana states the exposure condition: a Node.js service is exposed only if it, or a library it uses, decompresses Brotli data that an attacker controls.

Reports of active exploitation and exposure counts circulate. We could not confirm them on a page we read, and we could not confirm the fixed Node.js versions on the Node.js project’s own pages either, so this post states none of them. That gap is the first job for the agent: read the project’s advisory and report the versions, with the page quoted.

Step one: intel arrives as data, so the agent can read it

A person learns about a disclosure from a chat message. An agent should learn from a feed it can query. The OSV API is one: its documentation describes it as a way to “Batched query vulnerabilities for given package versions and commit hashes.” Give the agent your package list and it gets back the vulnerabilities per version, as rows.

The vendor advisory is still the authority on a fix. Tell the agent to quote the project’s page and flag any version it could not read, the way this post flags its own gap.

Step two: find what you run, with scanners that print rows

The exposure question has two halves, and they need different tools.

For Node.js and library dependencies, OSV-Scanner says it exists to “find existing vulnerabilities affecting your project’s dependencies.” Trivy describes itself in terms of “scanners that look for security issues, and targets where it can find those issues”, and its trivy-mcp plugin “starts a Model Context Protocol (MCP) server that integrates Trivy’s security scanning capabilities”. Both run from a terminal, which is all a coding agent needs.

The PHP half is plainer. The flaw is in the engine, not in a library, so our reading is that a dependency lockfile will not show it, and the question becomes which hosts and images run a PHP below the fixed versions. That is a loop over php -v or an image tag, and an agent can write and run it in a minute. The Node.js half is the code-path question Rescana poses: does any of our code, or a library it uses, decompress Brotli from untrusted input. An agent that already holds the repository can search for exactly that, which a scanner’s version match cannot do.

Step three: search the logs and metrics in plain language

Once you know what is exposed, you need to know what it has been doing. This is where observability platforms earn their place, and where the surface differs from tool to tool.

  • Mezmo. Its documentation says “Authenticate once, then script Log Analysis and Pipeline workflows.” That is a scripting surface an agent can drive. We did not confirm from Mezmo’s pages whether it also ships an MCP server.
  • Grafana. mcp-grafana is described as “A Model Context Protocol (MCP) server for Grafana.” We did not confirm which data sources it can query. The Headless Index tracks MCP posture for observability vendors, Grafana among them.
  • Prometheus. The Prometheus MCP server will “allow LLMs to interact with a running Prometheus instance via the API to do things like generate and execute promql queries”.
  • Sentry. Its repository “contains the Sentry CLI, the Sentry MCP server, and shared packages.” We could not confirm what the server exposes.

An agent connected to these can turn “show me multipart uploads that ended in a memory error since the 21st” into a query, run it, and return the rows. Claude Code’s MCP documentation says “MCP servers give Claude Code access to your tools, databases, and APIs”, which is the mechanism. We could not read Codex’s MCP page, so we make no claim about it here.

Step four: monitor, then patch with the agent

Monitoring after a disclosure is a standing query. The agent writes the alert condition from the advisory’s mechanism, for example PHP workers that exit after an out-of-memory error, and a person reviews it before it pages anyone. The same agent that found the exposure can bump the pinned version, run the test suite and open a pull request that cites the advisory and the scanner output. Keep a person on the merge. The agent is fast at the diff, and a person owns the decision to deploy.

Step five: ask whether you were already compromised

This is where an agent changes the economics most, because it is the slowest step by hand. A patch closes the door, and says nothing about who came through it before.

Start from the window: the first moment a vulnerable version faced the internet until the moment the fixed one replaced it. Then have the agent query the logs and telemetry above for what the mechanism would leave behind. From Corgea’s description, that means multipart requests to PHP endpoints, followed by memory errors, worker crashes or restarts, and anything unusual afterward: new files in web directories, new outbound connections, unexpected child processes. That list is our reading of the mechanism, not an indicator list from a vendor, so treat it as where to look first.

Two limits matter. Logs only show what you collected, and for how long, so the agent should report the retention it found before it reports “nothing found”. An empty result over a short window is not a clean bill, and the report should say so.

Guardrails for letting an agent near your logs

An MCP server is code and text your agent trusts. Snyk Labs describes tool poisoning as a tool description written “to steer the model to perform further actions”. Run read-only credentials, pin the servers you reviewed, and keep patching and deploying behind a human approval. The audit trail of what the agent queried belongs in the incident record, as we argued in our post on agent audit trails.

What this changes for your architecture

The time to safety after php2shell is the time to run a handful of queries and apply one version bump. Every system in that chain that only a person can operate is a point where the agent stops and waits. So the question for the next scanner or observability contract is whether it has a CLI, an API or an MCP server, whether it returns rows, and whether you can give an agent a read-only key. A team that has that answer for intel, inventory, logs and patching can respond in the time the attacker needs to scan, and a team that does not will be reading dashboards.