Skip to content
Back to Blog

MCP tool security: when the AI is the attacker

In an MCP system the attacker isn't a user at a login form: it's the AI assistant, acting on injected instructions.

SecurityAIArchitecture
MCP tool security: when the AI is the attacker

When you wire an AI assistant up to execute tools, the threat model flips. The attacker isn't a user at a login form — it's the assistant itself, acting on injected instructions.

The setup

An internal operations platform exposed a set of tools the AI could call: read notifications, list sites, fetch share tokens. Four of them shipped without access control. That's a critical gap on its own, but the more interesting failure is structural.

When the tool is the attacker

Prompt injection turns the assistant into the attack vector. A third party can poison the context and make the assistant call a sensitive tool on their behalf. The fix has to assume the trusted tool is compromised.

We applied two layers: a role gate on sensitive tools, plus per-organization scope so every call only touches data the caller owns. One tool had no organization key, so it became admin-only instead of scoped.

The lesson that surprised me

A static list of "sensitive tools" produced false positives. One tool was already scoped to the caller ID, so the global gate blocked harmless calls. The real mechanism is per-handler scope, not a constant list.

Defense in depth: unprivileged callers self-scope to their own data; sensitive tools require a role; everything else inherits organization bounds. See the V5 Hub case study.

See also: How I tested a calculator engine with 965 automated tests and From 12% to 55% test coverage without breaking the suite.