Menu

AI

The Confused Deputy Problem in MCP

How a confused deputy attack lets an attacker reuse a user's consent on an MCP proxy server, who is at risk, and the per-client consent the spec requires.

By: Irina ShvayaOctober 28, 2026

The Confused Deputy Problem in MCP

This page is part of our MCP Security Center, within The MCP Guide. Want a second opinion on your setup? Request a free MCP readiness review.

The confused deputy problem in MCP is an attack where a malicious client hijacks a user's existing consent. It tricks an MCP proxy server into acting for the attacker. The proxy is the "deputy." It holds legitimate authority, but it gets confused about who it is acting for.

The result can be serious. According to the MCP spec, the attacker can end up with "access to the third-party API as the compromised user." The user may never see a consent screen.

This page explains the conditions that make the attack possible, a plain example, and the controls the spec requires. It is mainly a concern for teams that build or run MCP servers. Sources were checked on 28 October 2026.

Key Takeaways

  • The attack targets MCP proxy servers that connect clients to a third-party API using one static OAuth client ID.
  • It needs four conditions together: a static client ID, dynamic client registration, a consent cookie and no per-client consent.
  • An attacker can receive an authorization code at their own redirect URI without the user approving that client.
  • The MCP spec says proxy servers MUST implement per-client consent and exact redirect URI matching.
  • The spec's consent page rules include naming the client, showing scopes and redirect URI, and blocking iframes.
  • If you only use MCP servers rather than build them, ask vendors how they handle per-client consent.

What a confused deputy is

"Confused deputy" is an old security term. A program with real authority is tricked into using it for someone who should not have it.

In MCP, the deputy is an MCP proxy server. The MCP Security Best Practices page defines this as a server that connects MCP clients to third-party APIs while "acting as a single OAuth client to the third-party API server." Think of a server that gives AI apps access to a SaaS tool on your behalf.

Because the proxy uses one static client ID with the third-party service, that service sees every request as coming from the same app. It cannot tell which MCP client started the request.

When the attack is possible

The spec lists four conditions that must all be present:

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

Remove any one, and this specific attack fails. Most fixes target the fourth condition.

How the attack works

The spec walks through the steps. In plain English:

  1. A user signs in through the proxy normally. The third-party service remembers this with a consent cookie.
  2. An attacker registers a new client with the proxy, using their own redirect URI.
  3. The attacker sends the user a crafted link.
  4. The user clicks. The third-party service sees the cookie and skips the consent screen.
  5. The proxy sends the resulting authorization code to the attacker's redirect URI.
  6. The attacker exchanges the code for tokens and acts as the user.

The key flaw is that consent was given to the proxy, not to the attacker's client. The proxy never asked, "Do you want this new client to have access?"

An illustrative scenario

This example is illustrative. It is not a real incident.

A startup builds an MCP server that lets AI apps read customers' project-management boards. It uses one OAuth app with the project tool and accepts dynamic registration from any MCP client.

A customer connects through Claude in the morning. That afternoon, she clicks a link in a phishing email. No consent screen appears, because her browser still has the project tool's cookie. The attacker's client now holds a token to her boards.

Who is at risk

  • Builders of MCP proxy servers that wrap third-party APIs, especially those accepting dynamic client registration.
  • Users of those servers, whose accounts are what the attacker reaches.
  • Organizations that host internal proxies in front of SaaS tools with a single shared OAuth app.

If you only use MCP clients and well-known servers, your main job is asking vendors the right questions. Our MCP vendor security questionnaire includes them.

How to detect it

  • Authorization logs. Look for authorization codes issued to newly registered clients soon after their registration.
  • Unfamiliar redirect URIs. Flag redirect URIs on unknown domains, especially from clients registered once and used once.
  • Missing consent events. If a client received a code without a matching consent record for that user, investigate.
  • User reports. Users seeing connected apps they do not recognize in a third-party account is a late but real signal.

How to reduce the risk

On the server side (where the fix lives)

The spec says MCP proxy servers "MUST implement per-client consent." That means:

  • Keep a registry of approved client_id values per user, and check it before starting the third-party flow.
  • Show a consent page owned by the MCP server.
  • Validate that the redirect URI "exactly matches the registered URI," using exact string matching, not wildcards.
  • Generate a random, single-use state value and validate it at the callback.

The consent page itself MUST, per the spec:

RequirementWhy it matters
Name the requesting MCP clientThe user knows who is asking
Show the third-party scopes requestedThe user knows what is being shared
Show the registered redirect URIThe user can spot an odd destination
Use CSRF protectionStops forged approvals
Block iframing with frame-ancestors or X-Frame-Options: DENYStops clickjacking

If consent is tracked in cookies, the spec says they MUST use the __Host- prefix, be Secure, HttpOnly and SameSite=Lax, and be bound to the specific client ID.

On the client side

  • Use pre-registered or metadata-document client IDs where the server supports them.
  • Do not open authorization links from untrusted sources.

At the organization level

  • Review any internal proxy that wraps SaaS tools before it goes live.
  • Ask vendors whether they implement per-client consent and exact redirect URI matching.

What the MCP spec says

The authorization specification lists confused deputy attacks among the security considerations implementations MUST follow. It also notes that dynamic client registration is "deprecated and retained for backwards compatibility." That change reduces one of the four conditions over time.

A closely related rule bans token passthrough. The best practices page says passthrough "can potentially cause the confused deputy problem" downstream. For the OAuth basics, see MCP authentication and OAuth, and for common setup errors see MCP OAuth misconfigurations.

Next step

If you are building an MCP server that connects to a third-party API, get the consent flow reviewed before launch. Our MCP development team builds servers with per-client consent and exact redirect matching from the start. More threats are covered in the MCP Security Center.

Frequently asked questions

Does the confused deputy problem affect every MCP server?

No. It applies to MCP proxy servers that use a static client ID with a third-party API and allow dynamic client registration. A server that issues its own tokens and does not proxy a third-party OAuth app is not exposed to this specific attack.

Is PKCE enough to stop it?

No. PKCE protects the code exchange between a client and the authorization server. In this attack, the attacker is a registered client that legitimately completes its own flow. Per-client consent at the proxy is the control the spec requires.

Why does the third-party service skip the consent screen?

Because the user already approved the proxy's static client ID, and a cookie records that. The third-party service cannot see which MCP client is behind the proxy. That is why the proxy must ask for consent itself.

Can users protect themselves?

Partly. Avoid clicking authorization links from emails or messages, and review connected apps in your accounts. The real fix has to be built into the server.

Is dynamic client registration still allowed?

Yes, but the 2026-07-28 client registration page marks it deprecated. It says new implementations should use Client ID Metadata Documents instead, and keeps registration only for backwards compatibility.

You Might Also like to Read

Get a FREE Website Audit

Enter your website and get a 20–30 page SEO, GEO, AEO & CRO audit within 24 hours. Completely free.

Don't have a site yet? Get in touch →

Ready to speak with a marketing expert?
Give us a call! (916) 866-7893

Websites Launched
1407
Websites Launched
Marketing Experts
29
Marketing Experts
Hours of Dedicated Work
204533
Hours of Dedicated Work
Irina S.Benjamin G.Jeanette M.David G.