Lesson 4 of 610 minReviewed
MCP authorization: audience-bound tokens and the attacks around them
Read the MCP authorization model as a reviewer: who issues which token for whom, why token passthrough is forbidden, and which OAuth attacks the security best practices tell clients and servers to block.
Authorization in MCP is optional. When an implementation uses an HTTP transport it should follow the specification; a stdio server should not, and instead takes its credentials from the environment [1]. In the HTTP case the roles are plain OAuth: the MCP server is an OAuth 2.1 resource server, the MCP client is an OAuth client acting for the user, and a separate authorization server issues the tokens [1].
One token, one audience
The rule that matters most for a reviewer is audience binding. Clients must send the RFC 8707 resource parameter, set to the MCP server's canonical URI, in both the authorization and the token request [1, 2]. Servers must validate that a token was issued specifically for them and must not accept or transit any other token [1]. Tokens travel in the Authorization header on every request and never in a query string [1].
Token passthrough is the anti-pattern these rules forbid: a server accepts whatever token a client sends and forwards it to a downstream API. The best-practice guide lists what breaks: downstream rate limits and monitoring that depend on the token's audience are bypassed, the audit trail loses track of which client acted, and a stolen token can be relayed through the server to exfiltrate data [3]. A server that calls another API needs its own token for that API.
Attacks the best practices tell you to block
| Attack | Condition | Control |
|---|---|---|
| Confused deputy | An MCP proxy uses one static client ID with a third-party authorization server, allows dynamic client registration, and the third party remembers consent in a cookie, so an attacker's registered client receives a code without the user consenting [3] | Per-client consent at the MCP server before forwarding; exact redirect URI matching; single-use, short-lived state set only after consent [3] |
| SSRF during discovery | A malicious server points metadata URLs at internal hosts or the cloud metadata address 169.254.169.254 [3] | Require HTTPS, block private and link-local ranges, validate every redirect hop, route discovery through an egress proxy [3] |
| Authorization URL injection | A server supplies a javascript: URL or one with shell metacharacters as its authorization endpoint [3] | Allow only http(s), never open URLs through a shell [3] |
| Mix-up | An attacker-controlled authorization server receives a code issued by an honest one [3] | Record the expected issuer and validate the iss response parameter (RFC 9207) before redeeming the code [1, 3] |
| State handle hijacking | A guessed or leaked state handle, such as a cart ID, is treated as proof of identity [3] | Verify every request; bind handles to the authenticated user server-side [3] |
The authorization-URL row is not theoretical. CVE-2025-6514, covered in the previous lesson, was a local bridge passing a server-supplied authorization endpoint to the operating system.
Scopes: start small, step up
A broad token turns one leak into lateral access. The guide recommends a minimal initial scope set, incremental elevation through targeted WWW-Authenticate scope challenges when a privileged operation is first attempted, and logging of each elevation; it lists publishing every scope in scopes_supported and wildcard scopes such as * or full-access as common mistakes [3]. This matters because a client that receives no scope in the challenge falls back to requesting everything in scopes_supported, which the specification intends to be the minimal set [1].
- Does the server reject tokens whose audience is not its own URI?
- Does it call downstream APIs with its own tokens, never the client's?
- Is
scopes_supportedlimited to low-risk operations, with elevation on demand? - If it proxies a third-party API, does it show its own consent page per client?
- Do your clients block private address ranges and non-https URLs during discovery?
Try it on ThreatDeck
- Lock down MCP servers and clients Turn the review questions into checklist items for each remote server you approve.
- MCP allowlist generator Pin which remote server URLs your clients may connect to, so a lookalike endpoint is refused.
- MCP Server Watch Check whether a remote server you use is remote-only and whether advisories affect it.
Self-check
4 questionsPick an answer to see whether it is right and why. Only your score is saved, in this browser.
-
The resource parameter names the audience. Combined with the server-side rule to accept only tokens issued for itself, a token stolen from one server cannot be replayed against another.
-
The specification forbids accepting or transiting tokens not issued for the server. The server should obtain its own token for the downstream API so audience, scope and audit stay correct.
-
This is SSRF against the client's environment, here the cloud metadata service. The guide tells clients to require HTTPS, block private and link-local ranges and route discovery through an egress proxy.
-
The specification says stdio implementations should not follow the HTTP authorization flow and should retrieve credentials from the environment; the local-server guide adds per-server, narrow tokens.
References
- MCP specification: Authorization (2026-07-28). Model Context Protocol, 2026-07-28.
- RFC 8707: Resource Indicators for OAuth 2.0. IETF, 2020-02.
- MCP Security Best Practices (protocol version 2026-07-28). Model Context Protocol, 2026-07-28.
- RFC 9700: Best Current Practice for OAuth 2.0 Security. IETF, 2025-01.