Skip to content

Commit 9992fe6

Browse files
committed
add details
1 parent fdf53d5 commit 9992fe6

File tree

1 file changed

+82
-7
lines changed

1 file changed

+82
-7
lines changed

docs/specification/draft/basic/authorization.mdx

Lines changed: 82 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -299,13 +299,88 @@ Authorization servers **SHOULD** only automatically redirect the user agent if i
299299

300300
### 3.4 Confused Deputy Problem
301301

302-
An attacker can exploit OAuth proxy configurations that share third-party client credentials
303-
across multiple users.
302+
An attacker can exploit configurations where an MCP server operates as a proxy in front of a third party resource server, leading to the confused deputy problem.
304303

305-
When an MCP server fronts an authorization server that does not support dynamic client
306-
registration, the MCP server will use a static client ID to acquire credentials for the
307-
upstream API.
304+
#### 3.4.1 Terminology
308305

309-
If the the backing authorization server sets cookies after user consent, an attacker can craft malicious authorization requests that bypass consent flows for previously authorized applications.
306+
MCP Proxy Server
307+
: An MCP server that acts as an intermediary between MCP clients and a protected
308+
third-party API. The MCP proxy server provides MCP functionality while delegating
309+
API operations to a third-party API server. The MCP proxy server acts as a single OAuth client to the third-party API server.
310310

311-
MCP servers using a static client_id for a backing service MUST require explicit approval for each newly registered dynamic client prior to forwarding requests to the backing authorization server for user consent.
311+
Third-Party Authorization Server
312+
: The authorization server that protects access to the third-party API. This server may not
313+
support dynamic client registration, requiring the MCP proxy server to use a single static
314+
client ID for all requests.
315+
316+
Third-Party API
317+
: The protected resource server that provides the actual API functionality. Access to this
318+
API requires tokens issued by the third-party authorization server.
319+
320+
Static Client ID
321+
: A fixed OAuth 2.0 client identifier used by the MCP proxy server when communicating with
322+
the third-party authorization server, shared across all MCP clients.
323+
324+
#### 3.4.2 Architecture and Attack Flow
325+
326+
```mermaid
327+
sequenceDiagram
328+
participant UA as User-Agent (Browser)
329+
participant MC as MCP Client
330+
participant M as MCP Proxy Server
331+
participant TAS as Third-Party Authorization Server
332+
participant A as Attacker
333+
334+
Note over UA,M: Initial Auth flow completed
335+
336+
Note over UA,TAS: Step 1: Legitimate user consent for Third Party Server
337+
338+
M->>UA: Redirect to third party authorization server
339+
UA->>TAS: Authorization request (client_id: mcp-proxy)
340+
TAS->>UA: Authorization consent screen
341+
Note over UA: Review consent screen
342+
UA->>TAS: Approve
343+
TAS->>UA: Set consent cookie for client ID: mcp-proxy
344+
TAS->>UA: 3P Authorization code + redirect to mcp-proxy-server.com
345+
UA->>M: 3P Authorization code
346+
Note over M: Store 3rd party access token
347+
M->>UA: Redirect to MCP Client with MCP authorization code
348+
349+
Note over M,UA: Exchange code for token, use token
350+
351+
Note over UA,A: Step 2: Attack (leveraging existing cookie)
352+
A->>M: Dynamically register malicious client, redirect_uri: attacker.com
353+
A->>UA: Sends malicious link
354+
UA->>TAS: Authorization request (client_id: mcp-proxy) + consent cookie
355+
TAS->>TAS: Cookie present, consent skipped
356+
357+
TAS->>UA: 3P Authorization code + redirect to mcp-proxy-server.com
358+
UA->>M: 3P Authorization code
359+
Note over M: Store 3rd party access token
360+
M->>UA: Redirect to attacker.com with MCP Authorization code
361+
UA->>A: MCP Authorization code delivered to attacker.com
362+
Note over M,A: Attacker exchanges MCP code for MCP token
363+
A->>M: Attacker impersonates user to MCP server
364+
```
365+
366+
#### 3.4.3 Attack Description
367+
368+
When an MCP proxy server uses a static client ID to authenticate with a third-party
369+
authorization server that does not support dynamic client registration, the following
370+
attack becomes possible:
371+
372+
1. A user authenticates normally through the MCP proxy server to access the third-party API
373+
2. During this legitimate flow, the third-party authorization server sets a cookie on the user agent
374+
indicating consent for the static client ID
375+
3. An attacker later sends the user a malicious link containing a crafted authorization request
376+
4. When the user clicks the link, their browser still has the consent cookie from the previous legitimate request
377+
5. The third-party authorization server sees the cookie and skips the consent screen
378+
6. The MCP authorization code is redirected to the attacker's server (specified in the crafted redirect_uri during dynamic client registration)
379+
7. The attacker exchanges the stolen authorization code for access tokens without the user's explicit approval
380+
381+
#### 3.4.4 Mitigation
382+
383+
MCP proxy servers that use a static client ID for third-party services MUST require explicit
384+
approval for each newly registered dynamic client before forwarding requests to the
385+
third-party authorization server for user consent. This ensures that each MCP client's
386+
access is explicitly controlled at the proxy level.

0 commit comments

Comments
 (0)