Skip to content

Commit aecd76c

Browse files
authored
Merge branch 'main' into patch-1
2 parents da66fe3 + 93980ae commit aecd76c

File tree

2 files changed

+51
-7
lines changed

2 files changed

+51
-7
lines changed

docs/specification/draft/basic/authorization.mdx

Lines changed: 26 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -53,23 +53,23 @@ while maintaining simplicity:
5353
MCP clients **MUST** use the OAuth 2.0 Authorization Server Metadata.
5454

5555
### 2.2 Roles
56-
A protected MCP server acts as a [OAuth 2.1 resource server](https://www.ietf.org/archive/id/draft-ietf-oauth-v2-1-12.html#name-roles),
56+
A protected MCP server acts as an [OAuth 2.1 resource server](https://www.ietf.org/archive/id/draft-ietf-oauth-v2-1-12.html#name-roles),
5757
capable of accepting and responding to protected resource requests using access tokens.
5858

5959
An MCP client acts as an [OAuth 2.1 client](https://www.ietf.org/archive/id/draft-ietf-oauth-v2-1-12.html#name-roles),
6060
making protected resource requests on behalf of a resource owner.
6161

6262
The authorization server is responsible for interacting with the user (if necessary) and issuing access tokens for use at the MCP server.
6363
The implementation details of the authorization server are beyond the scope of this specification. It may be hosted with the
64-
resource server or a separate entity. Section [2.3 Authorization Server Discovery](#2-3-authorizaton-server-discovery)
64+
resource server or a separate entity. Section [2.3 Authorization Server Discovery](#2-3-authorization-server-discovery)
6565
specifies how an MCP server indicates the location of its corresponding authorization server to a client.
6666

6767
### 2.3 Authorization Server Discovery
6868
This section describes the mechanisms by which MCP servers advertise their associated
6969
authorization servers to MCP clients, as well as the discovery process through which MCP
7070
clients can determine authorization server endpoints and supported capabilities.
7171

72-
### 2.3.1 Authorization Server Location
72+
#### 2.3.1 Authorization Server Location
7373

7474
MCP servers **MUST** implement the OAuth 2.0 Protected Resource Metadata ([RFC9728](https://datatracker.ietf.org/doc/html/rfc9728))
7575
specification to indicate the locations of authorization servers. The Protected Resource Metadata document returned by the MCP server **MUST** include
@@ -92,7 +92,7 @@ MCP clients **MUST** be able to parse `WWW-Authenticate` headers and respond app
9292
MCP clients **MUST** follow the OAuth 2.0 Authorization Server Metadata [RFC8414](https://datatracker.ietf.org/doc/html/rfc8414)
9393
specification to obtain the information required to interact with the authorization server.
9494

95-
#### 2.3.4 Sequence Diagram
95+
#### 2.3.3 Sequence Diagram
9696
The following diagram outlines an example flow:
9797

9898
```mermaid
@@ -122,7 +122,7 @@ sequenceDiagram
122122
Note over C,M: MCP communication continues with valid token
123123
```
124124

125-
#### 2.4 MCP specific headers for discovery
125+
### 2.4 MCP specific headers for discovery
126126

127127
MCP clients **SHOULD** include the `MCP-Protocol-Version: <protocol-version>` HTTP header during
128128
any request to the MCP server allowing the MCP server to respond based on the MCP protocol version.
@@ -281,7 +281,7 @@ An attacker who has gained access to an authorization code contained in an autho
281281
To mitigate this, MCP clients **MUST** implement PKCE according to [OAuth 2.1 Section 7.5.2](https://datatracker.ietf.org/doc/html/draft-ietf-oauth-v2-1-12#section-7.5.2).
282282
PKCE helps prevent authorization code interception and injection attacks by requiring clients to create a secret verifier-challenge pair, ensuring that only the original requestor can exchange an authorization code for tokens.
283283

284-
### 3.3 Open Redirection
284+
### 3.4 Open Redirection
285285

286286
An attacker may craft malicious redirect URIs to direct users to phishing sites.
287287

@@ -296,11 +296,30 @@ Authorization servers **MUST** take precautions to prevent redirecting user agen
296296

297297
Authorization servers **SHOULD** only automatically redirect the user agent if it trusts the redirection URI. If the URI is not trusted, the authorization server MAY inform the user and rely on the user to make the correct decision.
298298

299-
### 3.4 Confused Deputy Problem
299+
### 3.5 Confused Deputy Problem
300300

301301
Attackers can exploit MCP servers acting as intermediaries to third-party APIs, leading to confused deputy vulnerabilities.
302302
By using stolen authorization codes, they can obtain access tokens without user consent.
303303
See [Security Best Practices 2.1](/specification/draft/basic/security_best_practices) for details.
304304

305305
MCP proxy servers using static client IDs **MUST** obtain user consent for each dynamically
306306
registered client before forwarding to third-party authorization servers (which may require additional consent).
307+
308+
### 3.5 Access Token Privilege Restriction
309+
310+
An attacker can gain unauthorized access or otherwise compromise a MCP server if the server accepts tokens issued for other resources.
311+
312+
This vulnerability has two critical dimensions:
313+
314+
1. **Audience validation failures.** When an MCP server doesn't verify that tokens were specifically intended for it (for example, via the audience claim, as mentioned in [RFC9068](https://www.rfc-editor.org/rfc/rfc9068.html)), it may accept tokens originally issued for other services. This breaks a fundamental OAuth security boundary, allowing attackers to reuse legitimate tokens across different services than intended.
315+
2. **Token passthrough.** If the MCP server not only accepts tokens with incorrect audiences but also forwards these unmodified tokens to downstream services, it can potentially cause the "confused deputy" problem, outlined in [Section 3.4](#34-confused-deputy-problem), where 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. See [Security Best Practices 2.2](/specification/draft/basic/security_best_practices) for additional details.
316+
317+
MCP servers **MUST** validate access tokens before processing the request, ensuring the access token is issued specifically for the MCP server, and take all necessary steps to ensure no data is returned to unauthorized parties.
318+
319+
A MCP server **MUST** follow the guidelines in [OAuth 2.1 - Section 5.2](https://www.ietf.org/archive/id/draft-ietf-oauth-v2-1-12.html#section-5.2) to validate inbound tokens.
320+
321+
MCP servers **MUST** only accept tokens specifically intended for themselves.
322+
323+
If the MCP server makes requests to upstream APIs, it may act as an OAuth client to them. The access token used at the upstream API is a seperate token, issued by the upstream authorization server. The MCP server **MUST NOT** pass through the token it received from the MCP client.
324+
325+
If the authorization server supports the `resource` parameter, it is recommended that implementers follow [RFC 8707](https://www.rfc-editor.org/rfc/rfc8707.html) to prevent token misuse.

docs/specification/draft/basic/security_best_practices.mdx

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -114,3 +114,28 @@ attack becomes possible:
114114

115115
MCP proxy servers using static client IDs **MUST** obtain user consent for each dynamically
116116
registered client before forwarding to third-party authorization servers (which may require additional consent).
117+
118+
### 2.2 Token Passthrough
119+
120+
"Token passthrough" is 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 "passing them through" to the downstream API.
121+
122+
#### 2.2.1 Risks
123+
124+
Token passthrough is explicitly forbidden in the [authorization specification](/specification/draft/basic/authorization) as it introduces a number of security risks, that include:
125+
126+
- **Security Control Circumvention**
127+
- The MCP Server or downstream APIs might implement important security controls like rate limiting, request validation, or traffic monitoring, that depend on the token audience or other credential constraints. If clients can obtain and use tokens directly with the downstream APIs without the MCP server validating them properly or ensuring that the tokens are issued for the right service, they bypass these controls.
128+
- **Accountability and Audit Trail Issues**
129+
- The MCP Server will be unable to identify or distinguish between MCP Clients when clients are calling with an upstream-issued access token which may be opaque to the MCP Server.
130+
- The downstream Resource Server’s logs may show requests that appear to come from a different source with a different identity, rather than the MCP server that is actually forwarding the tokens.
131+
- Both factors make incident investigation, controls, and auditing more difficult.
132+
- If the MCP Server passes tokens without validating their claims (e.g., roles, privileges, or audience) or other metadata, a malicious actor in possession of a stolen token can use the server as a proxy for data exfiltration.
133+
- **Trust Boundary Issues**
134+
- The downstream Resource Server grants trust to specific entities. This trust might include assumptions about origin or client behavior patterns. Breaking this trust boundary could lead to unexpected issues.
135+
- If the token is accepted by multiple services without proper validation, an attacker compromising one service can use the token to access other connected services.
136+
- **Future Compatibility Risk**
137+
- Even if an MCP Server starts as a "pure proxy" today, it might need to add security controls later. Starting with proper token audience separation makes it easier to evolve the security model.
138+
139+
#### 2.2.2 Mitigation
140+
141+
MCP servers **MUST NOT** accept any tokens that were not explicitly issued for the MCP server.

0 commit comments

Comments
 (0)