threatdeck
Live 13:45 UTC ·

Learn / Agents, tools and MCP

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

From the MCP Security Best Practices (2026-07-28)
AttackConditionControl
Confused deputyAn 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 discoveryA 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 injectionA 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-upAn 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 hijackingA 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].

  1. Does the server reject tokens whose audience is not its own URI?
  2. Does it call downstream APIs with its own tokens, never the client's?
  3. Is scopes_supported limited to low-risk operations, with elevation on demand?
  4. If it proxies a third-party API, does it show its own consent page per client?
  5. Do your clients block private address ranges and non-https URLs during discovery?

Try it on ThreatDeck

Self-check

4 questions

Pick an answer to see whether it is right and why. Only your score is saved, in this browser.

  1. What does the RFC 8707 resource parameter do in MCP authorization?
  2. An MCP server forwards the client's bearer token unchanged to a downstream SaaS API. What is wrong?
  3. During discovery, a server's metadata points the client at http://169.254.169.254/. Which control applies?
  4. How should a local stdio MCP server get its credentials?

References

  1. MCP specification: Authorization (2026-07-28). Model Context Protocol, 2026-07-28.
  2. RFC 8707: Resource Indicators for OAuth 2.0. IETF, 2020-02.
  3. MCP Security Best Practices (protocol version 2026-07-28). Model Context Protocol, 2026-07-28.
  4. RFC 9700: Best Current Practice for OAuth 2.0 Security. IETF, 2025-01.
Completing the self-check also marks the lesson complete. Saved in this browser only.

Following

Follow the vendors, products, AI tools, techniques and actors you care about. Matching stories, CVEs and exploited bugs are marked, a Following tab appears in the feed, and returning visits show what changed. Saved only in this browser.

Presets

Get updates

A personal RSS feed of new stories on everything you follow. Paste it into any feed reader, Slack or Teams RSS app.