Risk & Safety Controls
Common attack vectors
Section titled “Common attack vectors”| Attack | Description | Primary mitigation |
|---|---|---|
| Prompt injection | Malicious instructions embedded in content (web pages, docs, tool results, injected notifications) that the model then follows | Treat all external content as untrusted; consent gates on consequential actions; output filtering |
| Tool poisoning | Malicious instructions hidden in a tool’s description/schema that manipulate the model — tool descriptions are untrusted unless from a trusted server | Review/pin tool definitions; show full descriptions to users; registry vetting |
| Rug pull | A server changes its tool definitions after initial approval | Re-prompt consent when definitions change; pin versions |
| Confused deputy | An MCP proxy server using a static client ID with a third-party authorization server is tricked into forwarding authorization for an attacker (consent-cookie skip) | Per-client user consent before forwarding; exact redirect URI validation; single-use state values |
| Token passthrough | A server accepts tokens not issued to it and forwards them downstream — an explicitly forbidden anti-pattern | Servers MUST NOT accept tokens that were not explicitly issued for them; audience validation (RFC 8707) |
| Token theft | Stolen access or refresh tokens grant access to downstream APIs | Secure token storage; short-lived access tokens; refresh token rotation for public clients |
| Session / state-handle hijacking | An attacker guesses or reuses a session ID (legacy) or state handle to inject events or impersonate a user | Never use sessions/handles as authentication; secure non-deterministic IDs; bind them to the verified user |
| SSRF via discovery | A malicious server points OAuth discovery URLs at internal or cloud-metadata addresses (e.g. 169.254.169.254) | Enforce HTTPS; block private/link-local IP ranges; validate redirect targets; egress proxies |
| Local server compromise | One-click install flows run malicious local server commands | Show the exact command and require explicit approval; sandbox local servers; prefer stdio locally |
| Excessive permission scope | Server requests broader access than needed | Least privilege; incremental step-up scopes; read-only credentials |
| Supply chain | Malicious or compromised server packages | Install from trusted registries; verify publishers; sandbox local servers |
| Data exfiltration | Sensitive context leaked through tool arguments or other server interactions | Minimize context sent to servers; egress controls; DLP monitoring |
The confused deputy attack, step by step
Section titled “The confused deputy attack, step by step”sequenceDiagram participant U as User participant P as MCP proxy (static client ID) participant AS as Third-party auth server participant A as Attacker U->>P: Legitimate first use P->>AS: Authorization request AS->>U: Consent screen (approved, cookie set) A->>U: Crafted link (malicious redirect_uri) U->>AS: Follows link — cookie skips consent AS->>A: Authorization code delivered to attacker A->>P: Exchanges code, impersonates user
The mitigation the spec requires: proxy servers using static client IDs MUST obtain user consent for each dynamically registered client before forwarding to the third-party authorization server.
Safety controls checklist
Section titled “Safety controls checklist”- Human-in-the-loop approval for destructive or irreversible actions — users should always be able to deny a tool invocation
- Input validation on the server (schema validation, sanitization, path traversal checks)
- Sandboxing local servers (containers, restricted users, no unnecessary network)
- Rate limiting on tools and log output
- Version pinning of server packages and re-consent on definition changes
- Token hygiene — audience-bound tokens, short lifetimes, no passthrough, tokens never in URL query strings
- Safe URL handling — clients only open
http(s)authorization URLs, neverjavascript:,data:, orfile:schemes, and never via shell commands
Defense in depth
Section titled “Defense in depth”No single control suffices. A robust deployment combines: vetted servers (supply chain) + least privilege (blast radius) + consent gates (authorization) + monitoring (detection) + audit logs (forensics).
Key exam points
Section titled “Key exam points”- Prompt injection and tool poisoning both exploit the fact that the model follows text — descriptions and content are attack surfaces
- “Rug pull” specifically refers to post-approval changes in tool definitions
- Token passthrough is an explicit anti-pattern: servers MUST NOT accept tokens not issued for them; downstream calls use the server’s own separately obtained token
- Confused deputy in MCP targets proxy servers with static client IDs; the fix is per-client user consent plus strict redirect URI and
statevalidation - Sessions and state handles are never a substitute for authentication
Check your knowledge
Section titled “Check your knowledge”📝 Check your knowledge