Skip to content
Smartplane

How to Stop MCP Token Passthrough and Confused Deputy Attacks

How to stop MCP token passthrough and confused deputy attacks: accept only a token issued for this server, and call upstream with a separate credential.

By Smartplane team

Back to blog

MCP servers must reject token passthrough because an access token is a credential for one audience. A server that accepts a token issued for some other API, or that forwards the caller's token upstream, lets that token skip the rate limits and logs tied to the audience it was minted for, and a stolen copy then works at every service that will take it. Accept only a token that was issued for this server. When the server calls an upstream API, use a different credential, issued for that API. A proxy that uses one static OAuth client for every MCP client has a second duty: record that user's consent for each client before it sends the browser to the third-party authorization server. Skipping that consent is the confused deputy.

The protocol pages, the RFCs, and the OWASP pages cited here were read on 27 November 2026.

What is token passthrough?

Token passthrough, in the security best practices for the 28 July 2026 revision, is an MCP server accepting a token from a client without checking that the token was issued to this server, then passing that same token to a downstream API. The page splits the failure in two. The first is an audience check that never happens, so a token minted for one service is accepted at another. The second is the forward itself. The unmodified token arrives downstream, which may trust it as though the MCP server had presented its own credential, or may assume some earlier party already validated it.

The authorization specification states the same rule as token handling. The server, acting as the resource server, validates the access token and validates that it was issued for this server as the audience, following RFC 8707. An invalid or expired token gets an HTTP 401. Clients must not send a token from any authorization server other than this server's. The server accepts only tokens valid for its own resources, and it must not accept or transit any other token.

Authorization is optional, and the OAuth profile is for HTTP. A stdio server should take credentials from the environment instead. Passthrough still shows up as a secret in that config, forwarded by the process or read because a model was told to. The caller's credential and the upstream credential stay different.

Why must the server reject it?

The best practices page names the cost. Rate limits and traffic monitoring often key off the audience, and a forwarded token skips them. An upstream token may be opaque to the MCP server, so the server cannot tell its clients apart, while the downstream log names someone other than the server that forwarded it. A stolen token the server never inspected can be replayed through it. The downstream API trusted particular clients, and a token accepted at several services turns one compromise into a credential for the others.

RFC 9700, the OAuth 2.0 security best current practice, associates an access token with one resource server. That server verifies the audience and refuses a mismatch, which limits how far a leak travels. The audience should be the URL the client will actually call, so a token phished for a counterfeit URL fails at the real server. Each resource server needs its own token. Resource indicators are how the client names which one.

RFC 8707 defines resource as an absolute URI with no fragment. The authorization server can then restrict the audience so the token fails elsewhere. A token presented to one resource cannot be reused by that resource at another. Several audiences make the token valid at each, and any one of them can present it to the others, which is why the RFC asks for a high degree of trust first. One audience is the ordinary case.

For a JWT, RFC 9068 is the check. typ is at+jwt, iss matches the issuer exactly, and aud must contain an identifier the server expects for itself or the token is rejected. The signature uses the authorization server's keys, alg of none is rejected, and the current time is before exp. A failed check is invalid. When the client sent resource, aud should be that value. The client treats the token as opaque. The server validates it.

The OWASP MCP Security Cheat Sheet says to validate that audience, reject invalid tokens, and never pass an MCP access token upstream. Scope each server's credential, and do not share tokens across servers. The OAuth 2.0 cheat sheet says every resource server verifies, on every request, that the token was meant for it. How to secure an MCP server is the rest of that checklist.

What is the confused deputy?

The sources use the name for two failures with one shape. A component with authority acts for a caller who should not have received it. The mechanism differs, and so does the fix.

The security best practices describe a proxy that is one OAuth client of a third-party API, under a static client id. The attack needs that static id, clients that dynamically register with their own redirect URI, a consent cookie set after the first approval, and a proxy that forwards the user before recording consent for this client. Dynamic client registration is deprecated as of the 28 July 2026 revision. The page says the attack still applies to a proxy that supports it. The user approves once, the cookie is set, and a later link for a new client skips the third-party screen because the cookie is for the static id. The proxy's code then lands on the attacker's redirect, and the attacker calls the API as the user. The authorization security considerations require consent for each dynamically registered client before that forward.

The same best practices page uses the name on the passthrough path. Forwarding an unmodified token can leave the downstream API trusting it as if it came from the MCP server, or assuming it was already validated upstream. The OWASP cheat sheet widens the sentence: the server runs the action with its own privileges, often broad ones, rather than with the caller's. Per-client consent addresses the redirect. A separate, narrow upstream credential addresses the call.

How do you stop both?

Accept only a token issued for this server. Require a bearer token on every HTTP request, in the Authorization header, and keep tokens out of the query string. Compare the audience with the canonical URI you publish. Clients send that URI as resource on both the authorization request and the token request, whether or not the authorization server advertises support. Anything else is a 401, and the upstream connection stays closed. The specification's examples are https://mcp.example.com and https://mcp.example.com/mcp, and it prefers no trailing slash unless the slash identifies a different resource. A token for a host, path, or slash you did not publish is a rejection. Validate a JWT with the RFC 9068 checks above. Introspect an opaque token and read its audience. A token you cannot validate stays where it arrived.

Call upstream with a credential issued for that API. The security considerations say the upstream token is a separate token from the upstream authorization server, and that the MCP server must not pass through the token it got from the client. Store the upstream credential where the server runs. The client config holds the MCP server's URL. How to secure AI agent access in your company is the fleet of laptops that each keep a copy of the upstream secret.

When the call has to carry the user and the authorization server supports token exchange, ask for a new token. The RFC's example has the resource server authenticate to the token endpoint, send the inbound token as subject_token, and set resource to the upstream API. Send only the issued token upstream. The identity propagation patterns say the authorization server still authorizes the exchange and constrains what it issues. A request for a narrower token does not replace that decision. With neither exchange nor OAuth, use a credential you issued to this server, scoped to the tools you expose. A search tool does not need a scope that deletes the space.

Record consent per client before any third-party redirect. Keep approved client_id values per user, and check them before sending the browser onward. For a new client, show a page you host that names the client, the third-party scopes, and the registered redirect URI, with CSRF protection, and that refuses to be framed. Store the decision on the server, or in a cookie bound to that client_id. A cookie that only means the user has consented is the one the attack reuses. Match the redirect URI as an exact string. Generate state only after approval, store it on the server, accept it once, and keep it short-lived. The page's example is 10 minutes. A missing or mismatched state is a rejected callback.

Who may call the tool is a further decision, and it still applies once the audience check has passed.

What does this look like on one wiki?

A platform team exposes wiki.search and wiki.write from https://mcp.example.com. The wiki API is https://wiki.example.com. The wiki token stays out of the editor config. The client requests a token with resource set to https://mcp.example.com and sends it on tools/call.

A token whose audience is https://wiki.example.com is a wiki token at the wrong server. The response is 401, and nothing connects to the wiki. A token whose audience is https://mcp.example.com names the member. The server then uses a wiki credential issued to its own OAuth client, for the scopes behind those two tools, or a token exchanged for https://wiki.example.com. The wiki log shows the MCP server's client. The MCP log shows the member, the tool, and the decision. A write that leaves the company wiki waits for someone other than the requester. The audience check has already passed. Approval is the later hold.

inbound:
  issuer: https://login.example.com
  audience: https://mcp.example.com
  on_audience_mismatch: deny
  on_validation_error: deny

upstream:
  api: https://wiki.example.com
  credential: separate token issued for https://wiki.example.com
  passthrough: deny
  on_exchange_error: deny

consent:
  registry: approved client_id per user
  before_third_party_redirect: required
  redirect_match: exact
  state_before_consent: deny

The same week, a new client registers with redirect URI https://attacker.example/cb. The proxy finds no approval for that user and shows its own page: the client name, the wiki scopes, and that redirect. It does not send the browser to the wiki until that approval is stored.

Where does the check fail closed?

The failure that matters is a check that does not finish. Introspection times out, the JWT key set does not load, or the introspection response has no audience. Forwarding the inbound token until the check recovers is passthrough on the request where you know the least. Return 401, leave the upstream connection closed, and log the reason without the token value. An unverified signature, or an audience other than the URI you published, is a failed check.

A second gap opens after a valid inbound token. Exchange for the wiki audience times out, or the authorization server refuses the target. The identity propagation cheat sheet treats that outage as a reason to withhold a credential that did not pass. Deny the tool call. The client retries when exchange answers.

An aud list that names both this server and the wiki still contains this server, so the narrow RFC 9068 check passes. Deny it. RFC 8707 warns that any audience in the list can present the token to the others. Ask for a token whose only audience is this server.

The consent registry has the same shape. The proxy checks approved client ids before the third-party flow. An unreadable registry means there is no approval, so do not redirect. A redirect that is only a prefix of the registered URI, or a wildcard, fails the exact match. Reject it.

A tool description that tells the model to copy a token from the client config chases the same prize by another path. How to prevent MCP tool poisoning and rug pulls is that review. The model cannot copy an upstream token it was never given. The audience check still denies when it cannot finish.

Frequently asked questions

Is a gateway's token a passthrough token?

A token the gateway accepts for its own audience, with a different credential on the upstream call, is the split above. Copying the client's token into another header and sending it upstream is still the forward.

Is token exchange the same as forwarding?

Exchange returns a new token. The inbound token is the subject_token at the token endpoint, and the upstream API sees only the issued token. A timeout there leaves you without that token. The inbound token stays on the MCP server.

What if the upstream API only accepts a user's personal token?

Obtain it through a consent flow the server owns, and store it on the server. Accept a different token at the MCP edge, issued for this server. A personal token in the editor config is a second copy a tool description can ask the model to read.

Does dropping dynamic client registration remove the confused deputy?

The best practices page says the attack still applies where a proxy supports dynamic registration, which is deprecated as of the 28 July 2026 revision. A static client id plus a consent cookie is what skips the third-party screen. Forwarding a user with no approval stored for this client leaves the hole, including a client you registered by hand.

Where do you put the check?

Put the audience check and the upstream credential on the path every agent uses, before any connection upstream. One MCP endpoint can accept a token for itself, keep the upstream credential, and refuse the call when a check does not finish.

Smartplane is that endpoint. Administrators register each tool once and assign use to a role, a team, or a project, so a member's agent is offered only those tools. Credentials are injected on the call. The agent does not hold the upstream token, so the token in the client is a different credential from the one the upstream API sees. Sign-in is the company account, and SSO and SCIM offboarding ends the membership. Guard rules are plain English. A new rule starts in monitor mode, where a match is allowed and flagged, and you switch it to enforce when the matches are the ones you wanted. An enforcing rule fails closed: if the check does not answer, the action is denied. A call that should sometimes proceed waits for someone other than the requester. Calls, denials, approvals, and grant changes go to an append-only, hash-chained audit log.

That is the separate upstream credential, the grant around it, and the record. Smartplane does not run an RFC 8693 exchange against every API you connect, and it does not perform the audience check inside a third-party MCP server. A server you operate still rejects a token that was not issued for it. The security page lists the controls. The product is the URL you put in the client, in place of the upstream token.