The Model Context Protocol (MCP) standardized how AI agents discover and call external tools — and immediately created one of the highest-impact attack surfaces in enterprise software. Unlike a conventional web API where deterministic application code decides which endpoint to call, an MCP client lets a non-deterministic model read untrusted tool descriptions, choose tools dynamically, and assemble arguments from external context. When an MCP server also runs locally over stdio or holds broad SaaS credentials, a single poisoned document or misconfigured server becomes remote code execution or silent data exfiltration.

This field guide breaks down the six MCP vulnerability classes driving 2026 security incidents, shows concrete vulnerable and hardened configuration patterns, and maps each failure mode to verifiable controls. Before deploying any server config, you can scan mcp.json or tools/list payloads locally in your browser with the free MCP config security checker.

The six MCP vulnerability classes in 2026

The MCP security best practices and the OWASP MCP Security Cheat Sheet highlight a consistent pattern: most real-world MCP compromises exploit trust boundaries around execution, tool metadata, and token audience rather than exotic cryptographic breaks.

Vulnerability class Root mechanism Typical impact Primary runtime defense
1. STDIO shell & command injection Launching local servers via sh -c / bash -c or passing unsanitized tool args to a subprocess Host remote code execution (RCE) under the developer's OS account Avoid shell wrappers, invoke pinned binaries directly, isolate in containers
2. Tool poisoning & rug pulls Hidden directives in tool descriptions or post-approval schema mutation Model silently reads .env / ~/.ssh or invokes unauthorized tools Inspect source before install, fingerprint approved tool schemas, alert on drift
3. Token passthrough Server accepts tokens minted for another audience and forwards them downstream Bypassed rate limits, broken audit attribution, confused-deputy replay Validate RFC 9068 aud strictly; exchange via RFC 8693 or broker downstream secrets
4. Unauthenticated remote exposure HTTP/SSE MCP server exposed without OAuth 2.1 or bound to 0.0.0.0 Unauthenticated tool execution against internal databases or terminals Mandate TLS + OAuth 2.1 with RFC 9728 protected-resource metadata
5. Ambient host secret & path access Broad filesystem mounts (/, ~) or static API keys in client env blocks Credential theft via path traversal or leaked IDE config files Restrict mount scope to one workspace dir; hold downstream credentials server-side
6. Indirect prompt injection in tool outputs Untrusted data returned by a read tool steers the agent's next write tool call Cross-tool data exfiltration (the lethal trifecta) Inspect tool arguments and results with bidirectional guardrails; require step-up approval on sensitive writes

1. STDIO command execution and unpinned packages

Local MCP servers typically run over stdio as child processes spawned by the IDE or agent runtime. Two configuration shortcuts repeatedly turn local convenience into host compromise:

  1. Wrapping commands in sh -c, bash -c, or cmd /c, which exposes arguments to shell metacharacter expansion.
  2. Launching servers through unpinned npx -y or uvx runners, which silently pulls newer upstream versions on future launches — a direct supply-chain rug-pull vector if a maintainer account is compromised.
// Fragile: shell wrapper, unpinned package runner, broad home mount, hardcoded secret
{
  "mcpServers": {
    "workspace": {
      "command": "sh",
      "args": ["-c", "npx -y @modelcontextprotocol/server-filesystem ~/"],
      "env": {
        "CRM_API_KEY": "sk_live_example_static_secret"
      }
    }
  }
}
// Hardened pattern: direct container or pinned remote gateway, no raw secrets in client config
{
  "mcpServers": {
    "workspace-readonly": {
      "url": "https://mcp-gateway.example.com/connections/workspace-readonly",
      "headers": {
        "Authorization": "Bearer ${AGENT_SESSION_TOKEN}"
      }
    }
  }
}

Illustrative configuration shapes. Never store production secrets inside .mcp.json or claude_desktop_config.json, which frequently end up in git history, backups, or support bundles.

2. Tool poisoning and post-approval rug pulls

In MCP, a tool's description and parameter descriptions are injected straight into the model's context window as behavioral guidance. A malicious or compromised server can embed hidden instructions (for example inside <IMPORTANT> tags or invisible zero-width Unicode characters) instructing the model to read local credentials and smuggle them inside an optional tool argument.

Even more subtle is a rug pull: a server presents clean, benign tool descriptions during initial security review, then dynamically swaps a tool's description after approval. Static scanning at install time cannot catch a post-approval mutation; the enforcement layer must fingerprint every approved tool definition and flag drift the moment a schema changes. See what is tool poisoning in MCP for a full walkthrough.

3. Token passthrough and broken audience checks

When an MCP server wraps an internal API, forwarding the caller's inbound Authorization header downstream looks tempting — and is explicitly forbidden by the MCP specification. Without strict audience validation per RFC 9068, a token minted for one service replays against another, downstream logs attribute the call to the wrong actor, and server-side policy is bypassed. Use two separate tokens: validate the inbound token for the MCP server's own resource identifier, then obtain a narrower downstream token via RFC 8693 or a credential broker. See why MCP token passthrough is forbidden for code examples.

4. Unauthenticated remote MCP servers

Because authentication is optional in the base transport, internet scans have uncovered exposed HTTP and SSE MCP servers accepting unauthenticated requests to internal databases, issue trackers, and shell tools. Every remote MCP endpoint must sit behind HTTPS, refuse unauthenticated requests with a 401 Unauthorized challenge carrying RFC 9728 resource_metadata, and verify short-lived audience-bound tokens on every request. For concrete 401 and 403 diagnostics, see MCP OAuth troubleshooting.

5. Ambient host credentials and path traversal

Coding agents and local MCP servers inherit the OS permissions of the developer who launched them. If a filesystem or database MCP server can traverse outside its intended directory, indirect prompt injection in a GitHub issue, email, or web page can coerce the agent into reading ~/.aws/credentials, ~/.ssh/id_rsa, or .env files. Mitigate at two layers: isolate local servers inside containers with narrow read-only mounts and restricted egress, and move downstream API keys out of developer machines into a central gateway.

6. Indirect prompt injection across chained tools

Even a cleanly authenticated MCP server becomes an exfiltration channel when an agent can read untrusted external input (support tickets, emails, web pages) and call an outbound or state-mutating tool in the same turn — the exact lethal trifecta seen in real-world exploits like EchoLeak (CVE-2025-32711). Breaking the chain requires per-connection tool authorization (read-only connections separated from write tools), argument constraints (such as numeric thresholds or allow-listed domains), output/argument guardrails, and human step-up approvals for high-impact calls.

Pre-deployment MCP defense checklist

Where Praesidia fits

Praesidia does not replace container sandboxing on developer laptops or patch third-party MCP server source code. It sits between your agents and the MCP servers you register through Praesidia's MCP gateway and runtime security:

  • Baseline inventory and drift flags: each registered server's tools are inventoried against an approved baseline, and definition changes are flagged rather than silently absorbed.
  • Per-connection tool and argument rules: allow or deny individual tools per agent-to-server connection, constrain argument values, set hourly rate limits, and hold high-impact calls for human approval once policies are set to enforce.
  • Server-side credential custody: registered server credentials are encrypted at rest and attached after policy evaluation, so agents never hold raw downstream secrets.
  • Verifiable decision trail: Praesidia records the decisions it makes on tool calls that pass through it in an append-only, hash-chained audit trail, signed under the default configuration (see offline-verifiable proof). Calls that bypass Praesidia are not recorded.

For the complete end-to-end architecture, read the MCP server governance guide.

Common questions

What is the single most common MCP security mistake in production? Exposing an entire MCP server's tool catalog to an agent with broad, hardcoded credentials in a local client config. Separating downstream secrets from the agent and allow-listing only the exact tools and argument ranges each connection needs eliminates the largest share of blast radius.

Does OAuth 2.1 alone prevent MCP tool poisoning? No. OAuth 2.1 proves who is calling the MCP server and binds the token to the right audience, but it does not inspect whether a tool's description contains hidden prompt-injection instructions or changed after initial approval. You need source vetting, schema fingerprinting, and argument/result inspection alongside OAuth.

Can I run untrusted third-party MCP servers safely over stdio? Only inside an isolated container or sandbox with no host credential mounts, no access to .env or ~/.ssh, pinned package digests, and restricted network egress. Never run unreviewed community stdio servers directly under a privileged developer shell.

How do I audit existing MCP configurations across my engineering team? Start by collecting .mcp.json, .cursor/mcp.json, and claude_desktop_config.json files from repositories and developer guidelines, scan them with static checks (such as the MCP config security checker), then route approved servers through a central MCP gateway so every connection shares one policy and audit point.