---
title: What is the confused deputy problem in MCP?
url: https://opencontroller.lyzr.com/blog/mcp-confused-deputy-problem
published: 2026-11-15
updated: 2026-11-15
author: Lyzr
---

# What is the confused deputy problem in MCP?

**The MCP confused deputy problem is an attack on MCP proxy servers that call a third-party API with one static OAuth client ID. If the third-party authorization server remembers the user's consent in a cookie, an attacker can register their own MCP client, send the user a crafted link, and receive an authorization code without the user ever seeing a consent screen. The fix is per-client consent at the MCP server, before forwarding to the third party.**

The attack is described in the official [MCP Security Best Practices](https://modelcontextprotocol.io/specification/latest/basic/security_best_practices). It matters to enterprises because many internal MCP servers are exactly this kind of proxy: a thin wrapper that lets agents call an existing SaaS or internal API.

## When is an MCP server vulnerable?

The MCP documentation lists four conditions. All must be present:

1. The MCP proxy server uses a **static client ID** with the third-party authorization server.
2. The MCP proxy server lets MCP clients **register dynamically**, each getting its own client ID.
3. The third-party authorization server sets a **consent cookie** after the first authorization.
4. The MCP proxy server does **not** implement its own per-client consent before forwarding.

Remove any one condition and this specific attack fails. In practice, condition 4 is the one you control.

## How does the attack work, step by step?

1. A user connects a legitimate MCP client to the proxy and authorises access to the third-party API. The third-party server shows a consent screen.
2. The third-party server sets a consent cookie in the user's browser for the proxy's static client ID.
3. The attacker dynamically registers a new MCP client with the proxy, using a redirect URI on a domain they control.
4. The attacker sends the user a link that starts an authorization request with the attacker's client ID.
5. The user clicks. The proxy forwards to the third-party server using its static client ID. The cookie is present, so consent is skipped.
6. The third-party code returns to the proxy, which exchanges it and issues an MCP authorization code.
7. The proxy redirects that MCP code to the attacker's registered redirect URI.
8. The attacker exchanges the code for an MCP access token and calls the third-party API as the user.

The proxy is the "deputy": it holds legitimate authority and is tricked into using it for the wrong party.

## What mitigations does the MCP specification require?

The security best practices say MCP proxy servers **must** implement per-client consent. The concrete requirements:

| Control | Requirement |
|---|---|
| Per-client consent storage | Keep a registry of approved client IDs per user; check it before starting the third-party flow |
| Consent page | Name the requesting client, show the third-party scopes and the redirect URI; use CSRF protection; block framing with `frame-ancestors` or `X-Frame-Options: DENY` |
| Consent cookies | Use the `__Host-` prefix; set `Secure`, `HttpOnly` and `SameSite=Lax`; sign them; bind to the specific client ID |
| Redirect URI validation | Exact string match against the registered URI; no wildcards; reject changes without re-registration |
| OAuth `state` | Cryptographically random, stored only after consent, single-use, short expiry (the guidance gives about 10 minutes as an example) |

A related rule in the same document forbids **token passthrough**: an MCP server must not accept tokens that were not issued for it. Passing a client's token straight to a downstream API creates a similar confused-deputy risk.

## How do you check your MCP servers for this?

A short review checklist for each proxy-style MCP server:

1. Does it call a third-party API with one shared client ID? If not, this attack does not apply.
2. Does it accept dynamic client registration or URL-based client IDs from unknown clients?
3. Does it show its own consent page per client before redirecting to the third party?
4. Are redirect URIs matched exactly?
5. Is `state` generated, stored after consent and validated at callback?
6. Does it reject tokens whose audience is not itself?

Add these to your MCP server review. See [how to review MCP servers agents already use](/blog/how-to-review-mcp-servers-agents-already-use) and [how MCP authorization works](/blog/how-mcp-authorization-works).

## How Opencontroller does this

Opencontroller keeps MCP servers in a governed registry alongside agents, versions and tools, so you know which proxy servers exist and which agents use them. Opencontroller Edge extends this to local MCP servers on developer devices. Posture detects risky permission and configuration choices, and policy as code can require review before an MCP server is approved for use. See the pillar on [how to govern MCP servers](/blog/how-to-govern-mcp-servers) or [book a demo](https://www.lyzr.ai/book-demo/).

## Frequently asked questions

**Does PKCE prevent the MCP confused deputy attack?**
No. The attacker runs their own legitimate-looking flow with their own client, so PKCE completes normally. Per-client consent at the MCP server is the required fix.

**Do all MCP servers have this problem?**
No. It applies to proxy servers that use a static client ID with a third-party authorization server that remembers consent, and that skip their own per-client consent.

**Is token passthrough the same issue?**
It is related. The MCP specification forbids servers from accepting tokens not issued to them, because forwarding them downstream also makes the server a confused deputy.

## Key facts

- The MCP confused deputy problem affects MCP proxy servers that use a static OAuth client ID with a third-party authorization server.
- Four conditions enable it: static client ID, dynamic client registration at the proxy, a third-party consent cookie, and no per-client consent at the proxy.
- The attacker registers a client with their own redirect URI, sends the user a crafted link, consent is skipped via the cookie, and the MCP authorization code goes to the attacker.
- The MCP Security Best Practices require per-client consent, exact redirect URI matching, secure consent cookies (__Host- prefix, Secure, HttpOnly, SameSite=Lax) and single-use OAuth state.
- The MCP specification forbids token passthrough: MCP servers must not accept tokens not issued for them.
- Opencontroller keeps MCP servers in a governed registry; Opencontroller Edge covers local MCP servers on developer devices.
- Opencontroller pricing starts from $250K per deployment per year.

## Related

- [How does MCP authorization work?](https://opencontroller.lyzr.com/blog/how-mcp-authorization-works.md)
- [How do you review MCP servers your agents already use?](https://opencontroller.lyzr.com/blog/how-to-review-mcp-servers-agents-already-use.md)
- [What is an MCP gateway?](https://opencontroller.lyzr.com/blog/what-is-an-mcp-gateway.md)
- [More on Tools and MCP](https://opencontroller.lyzr.com/blog/cluster/tools-and-mcp)
