The MCP confused-deputy problem and token passthrough, explained
A confused-deputy vulnerability happens when an MCP server with legitimate access to a third-party API can be tricked into misusing that access on an attacker's behalf. AdminKit explains the single most common way it happens in MCP deployments today: a server forwarding a client's access token straight through to a downstream API instead of validating and re-issuing its own.
By AdminKit team, Netbase JSC · Updated
Key takeaways
- An MCP server that holds credentials for a backend API is a “deputy”. It becomes confused when someone else gets it to spend that access on their behalf.
- Token passthrough is the common way in: the server accepts a token that wasn’t issued for it and forwards it unchanged to an upstream API. The MCP authorization specification forbids both halves.
- The fix has two parts: reject any token whose audience isn’t your server, and call upstream APIs with a separate token issued to your server.
- MCP proxy servers that use one static client ID with a third-party authorization server also need per-client consent, or a stolen authorization code can skip the user’s approval.
- A gateway can enforce the audience check and the no-passthrough rule in one place, but every server behind it still needs its direct path closed.
Why are MCP servers “deputies” in the first place?
Most useful MCP servers aren’t the final destination for a request — they’re a middle layer that holds its own credentials for a real backend: a ticketing API, a cloud account, an internal database. In classic computer-security terms, that makes the MCP server a deputy: a program acting with delegated authority on someone else’s behalf. The MCP Authorization specification’s security considerations describe exactly this scenario, warning that “attackers can exploit MCP servers acting as intermediaries to third-party APIs, leading to confused deputy vulnerabilities.” A deputy becomes “confused” when it can no longer tell a legitimate instruction from an attacker’s, and ends up spending its own privileged access on the attacker’s behalf — the term predates MCP by decades, but the pattern is a near-perfect fit for how agent tool-calling servers are built today. The glossary entry on the confused deputy problem covers the general idea.
What is token passthrough?
The spec names the concrete version of this problem that keeps showing up in real MCP deployments: token passthrough. The MCP security best practices define it as “an anti-pattern where an MCP server accepts tokens from an MCP client without validating that the tokens were properly issued to the MCP server and passes them through to the downstream API.” It happens in two steps that each look reasonable in isolation:
- An MCP server accepts an access token from a client without strictly checking that the token’s audience claim actually names this server as the intended recipient.
- The server then forwards that same, unmodified token to a downstream or upstream API, rather than using its own credentials to call that API.
The access token in question is very often a JWT — a compact, signed token format whose audience claim is exactly the field step 1 is supposed to check, and whose portability between services is exactly what makes forwarding it unmodified in step 2 so tempting to skip validating first.
The difference between the two designs is easiest to see side by side. In the diagram below, each arrow carries the token named on it:
Token passthrough (forbidden)
MCP client --[token A]--> MCP server --[token A, unchanged]--> upstream API
(audience not checked) (trusts token A)
Separate tokens per hop (what the spec requires)
MCP client --[token A, aud = MCP server]--> MCP server --[token B, issued to the MCP server]--> upstream API
(rejects A if aud doesn't match)
Why is token passthrough dangerous?
The spec is direct about why this is dangerous: “the downstream API may incorrectly trust the token as if it came from the MCP server or assume the token was validated by the upstream API.” The upstream has no way to distinguish a token that was properly checked from one that was just relayed, so a token obtained for one purpose — or stolen outright — can end up exercising access it was never meant to grant, with the MCP server as an unwitting accomplice.
The security best practices group the risks into four kinds:
| Risk named in the MCP security best practices | What goes wrong |
|---|---|
| Security control circumvention | Rate limits, request validation or monitoring that depend on the token’s audience are skipped when clients use tokens directly downstream |
| Accountability and audit trail issues | The MCP server can’t tell clients apart, and downstream logs show requests coming from a different identity; a stolen token turns the server into an exfiltration proxy |
| Trust boundary issues | If several services accept the same token without validating it, compromising one service gives access to the others |
| Future compatibility risk | A “pure proxy” that later needs security controls is harder to fix without proper token audience separation from the start |
Why is this easy to build by accident?
Token passthrough isn’t usually a deliberate shortcut; it’s often the first working implementation. A developer wires up an MCP server, sees that the client already has a valid-looking OAuth token, and forwards it to the backend API because the backend API also happens to speak OAuth — it “just works” in testing, often with a single client and a single backend, which hides the problem entirely. The failure only becomes visible once a second client, a different authorization server, or an attacker-controlled token enters the picture, by which point the pattern is already baked into the server’s integration code.
How do you fix it: validate the audience, then use your own credentials?
The spec’s prescribed fix has two parts, and both are necessary:
- Reject tokens that weren’t issued for you. Per the MCP Authorization specification, “MCP servers MUST only accept tokens specifically intended for themselves and MUST reject tokens that do not include them in the audience claim.” RFC 8707 (also on the IETF Datatracker) (Resource Indicators for OAuth 2.0) defines the
resourceparameter MCP clients use to request an audience-bound token in the first place, so this check has something concrete to validate against. The MCP specification makes that parameter mandatory: “MCP clients MUST implement and use the resource parameter.” - Never forward the client’s token to an upstream API. If your MCP server needs to call a third-party service on the client’s behalf, it should hold its own, separately issued OAuth credentials for that call. The spec states this plainly: “The MCP server MUST NOT pass through the token it received from the MCP client.” The client’s token authenticates the client to your server; it was never meant to authenticate your server to someone else’s API. The same section describes the upstream token as “a separate token, issued by the upstream authorization server”, with the MCP server acting as an OAuth client to that API.
Together these two rules mean every hop in the chain — client to MCP server, MCP server to upstream API — uses a token that was actually issued, and validated, for that specific hop.
When the token is a JWT, RFC 9068 gives the rules for the audience check. If the client asked for a token with a resource parameter, the token’s aud claim “SHOULD have the same value”, and the resource server “MUST validate that the ‘aud’ claim contains a resource indicator value corresponding to an identifier the resource server expects for itself.” A trimmed, illustrative token payload for a server at https://mcp.example.com/mcp looks like this:
{
"iss": "https://auth.example.com",
"sub": "user-1234",
"client_id": "agent-client-01",
"aud": "https://mcp.example.com/mcp",
"scope": "tickets:read",
"exp": 1767225600
}
Most JWT libraries do the check for you once you pass the expected audience. With PyJWT, for example, a token with the wrong audience raises jwt.InvalidAudienceError and one with the wrong issuer raises jwt.InvalidIssuerError. The names and key below are placeholders:
import jwt # PyJWT
claims = jwt.decode(
token,
signing_key, # your authorization server's public key
algorithms=["RS256"],
audience="https://mcp.example.com/mcp", # this server's own identifier
issuer="https://auth.example.com",
)
# Only after this succeeds: call the upstream API with the server's own token, never `token`.
What about static client IDs and proxy consent?
The spec also flags a related failure mode for MCP servers that act as OAuth proxies in front of a third-party authorization server using a single, static client ID shared across all of their own users, rather than relying on Dynamic Client Registration to give each client its own. In that setup, “attackers can exploit MCP servers acting as intermediaries to third-party APIs,” including by using stolen authorization codes to obtain access tokens without the real user’s consent. The mitigation is specific: MCP proxy servers using static client IDs must obtain user consent for each dynamically registered downstream client before forwarding to the third-party authorization server, not just once at initial setup.
The security best practices list the conditions under which this attack works. All four have to be true at once:
| Vulnerable condition | Why it matters |
|---|---|
| The MCP proxy uses a static client ID with a third-party authorization server | Every user’s consent is recorded against the same client |
The proxy lets MCP clients register dynamically, each with its own client_id | An attacker can register a client with their own redirect URI |
| The third-party authorization server sets a consent cookie after the first approval | A later request from the same browser skips the consent screen |
| The proxy doesn’t ask for per-client consent before forwarding | Nothing stops the attacker’s client from riding on the earlier approval |
The attack then runs in a few steps: the user signs in normally once, the attacker sends a crafted authorization link with a malicious redirect URI and a newly registered client ID, the consent cookie skips the approval screen, and the authorization code lands on the attacker’s server. The required protections include a per-user registry of approved client_id values, a consent page that names the client and shows the redirect URI, exact-match redirect URI validation, and a single-use state value set only after consent.
Where does this fit in the rest of your hardening work?
Fixing audience validation and token passthrough is one specific control among several an MCP deployment needs — our guide to securing an MCP server covers the fuller checklist, including OAuth setup end-to-end, tool allowlists, and treating tool responses as untrusted input. The OAuth for MCP glossary entry summarizes the flow, and the MCP server authentication checklist lists every authentication requirement, including this one, in a single review. If you’re routing MCP traffic through a reverse proxy or gateway as part of that hardening, confirm its TLS setup with SSL/TLS check and that the hostnames clients resolve actually point where you expect with DNS lookup — a confused-deputy fix doesn’t help if traffic is being intercepted or misrouted before it reaches your validation logic at all.
How can a gateway enforce this centrally?
The validation logic above is the fix inside each server. To enforce it centrally instead, Netbase deploys and runs the MCP & Agent Gateway in front of your MCP servers as a custom engagement: it checks the token audience and never passes the client’s token through, so individual MCP server implementations don’t each have to get this right independently — talk to our team about it. Concretely, the gateway rejects any bearer token whose audience isn’t the gateway’s own identifier, its connection to your server doesn’t forward the caller’s headers, and if your server needs a credential, the gateway presents its own, configured separately from anything a caller sends. A gateway only protects the path through it, so the engagement also closes the direct path to your server.
What are the other ways an MCP deployment gets tricked?
Token passthrough confuses the server itself about whose authority it’s using. Three related but distinct failure modes confuse the agent, or the server acting on its behalf, instead: prompt injection, where text the agent reads (including a tool’s own response) carries hidden instructions; tool poisoning, where a tool’s description or metadata — not its actual function — is crafted to manipulate the agent before it ever calls the tool; and SSRF, where a tool that fetches a URL on the agent’s behalf gets steered toward an internal destination instead of the intended one. All four are worth checking for in the same hardening pass.
This guide is general information, not a security audit of your specific network — see our disclaimer for what AdminKit's guidance does and does not commit to.
Frequently asked questions
What is the confused deputy problem, in plain terms?
A 'deputy' is a program that has more privilege than the party asking it to act — here, an MCP server that holds credentials for a third-party API. The deputy is 'confused' when it can't tell a legitimate request from an attacker's, and ends up using its own privileged access to do something the attacker wasn't authorized to do.
Isn't passing a client's token straight through the simplest way to build an MCP server?
It's simple, which is exactly why it's common — but the MCP specification explicitly forbids it. If a server accepts a token it wasn't the intended audience for and then forwards that same token unmodified to an upstream API, the upstream has no reliable way to know the token didn't come from a trusted, already-validated source.
What does 'audience binding' actually fix?
An audience-bound token is only valid for the specific server it names as the recipient. If your MCP server checks that it is the named audience on every inbound token, a token stolen from, or issued for, a different service simply won't validate — closing off the exact path a token-passthrough bug leaves open.
Does this only matter for public-facing MCP servers?
No. An internal MCP server that proxies to internal-only APIs is still a deputy with real privilege, and an internal attacker — or a compromised client application — can exploit the same passthrough flaw. Treat token validation as mandatory regardless of whether the server is public or internal-only.
What's the one-line fix if I'm already doing this wrong?
Stop forwarding the client's token to the upstream API. Validate the inbound token's audience against your own server identity, then use your server's own, separately issued credentials — not the client's token — to call the upstream API on the client's behalf.
Sources
- MCP Authorization specification — Security Considerations
- MCP Security Best Practices — Token Passthrough
- RFC 8707 — Resource Indicators for OAuth 2.0
- RFC 8707 — IETF Datatracker document record
- RFC 9068 — JSON Web Token (JWT) Profile for OAuth 2.0 Access Tokens
- PyJWT — Usage examples (audience and issuer validation)
Want AdminKit to watch this for you?
Free checks tell you the state today. Protective DNS and monitoring tell you when it changes.
Talk to an expert
Huy Nguyen (David), Founder & CEO, Netbase JSC
Ask whether this fix applies to your setup, or get a second pair of eyes on your DNS and mail records.