system: OPERATIONAL
← back to all hacks
DATA LEAK MEDIUM NEW

MCP SDK OAuth flaw let a server redirect client credentials

The official MCP Python and TypeScript SDKs let a malicious MCP server choose where a client's OAuth secrets were sent. Patches shipped, but upgrading alone does not close the gap.

2026-11-19 // 6 min affects: mcp-clients, modelcontextprotocol-sdk, llm-agents, mcp-servers

What is this?

Between September 28 and October 5, 2026, the maintainers of the official Model Context Protocol SDKs published three related security advisories. Two of them, for the Python SDK (September 28) and the TypeScript SDK (September 30), describe the same flaw: an MCP client using the SDK’s OAuth support could be told by the MCP server where to send its OAuth credentials. A malicious or compromised server could name an authorization server it controls and collect secrets meant for the real one. Both are rated High (CVSS 7.5).

A third advisory (October 5) covers the other side of the connection: the TypeScript SDK’s server-side bearer authentication could not check that a token was issued for that server.

On November 9, 2026, the Cloud Security Alliance published a research note grouping these advisories with earlier DNS rebinding and cross-client leak flaws under one label it coins, the “transport trust gap”: the SDK trusted an unverified signal to decide who it was talking to. The point that matters for defenders is in the advisories themselves: upgrading does not fully fix this.

How it works

In MCP’s OAuth flow, a client connecting to a protected HTTP server first discovers which authorization server to use, partly from metadata the MCP server itself publishes. That is the weak link. According to the advisories:

  • The authorization server metadata issuer was not validated on every discovery path.
  • Stored or pre-provisioned client credentials were not bound to the authorization server they belong to.

So a hostile MCP server could point the client to a token endpoint under its control, either by naming its own authorization server or by presenting the user’s real authorization server as the issuer. Schematically:

client  --connect-->  MCP server (malicious)
client  <--"use auth server X"--  (X = attacker-controlled)
client  --client_secret / refresh token / signed assertion-->  X

This is a classic OAuth “mix-up” pattern. RFC 9207 (2022) defines the iss response parameter precisely so clients can detect it.

What leaks depends on the SDK and provider. The Python advisory lists the client_secret, authorization code and PKCE code_verifier, or a signed client assertion with private-key JWT. The TypeScript advisory lists the stored refresh token and client secret, plus the configured secret or signed assertion of bundled providers, with no user interaction needed.

The server-side flaw is simpler. If one authorization server issues tokens for several services, an affected MCP server accepted a valid token meant for a different service.

Why it matters

MCP clients are often agents and gateways that connect to many servers, some found in public registries. One untrusted server in that list could harvest credentials that unlock the user’s other, legitimate services.

Three details make this harder to clean up than a normal patch:

  1. Old credentials stay unbound. Registrations stored before the fix carry no issuer, so they remain exposed until cleared or re-bound.
  2. The safe setting is opt-in. For client-credentials and private-key JWT providers, you must pass the expected issuer yourself. In Python 1.30.0, omitting it only raises a DeprecationWarning, which Python hides by default.
  3. Interactive sign-ins are not covered. The TypeScript advisory states that new interactive sign-ins still go to whichever authorization server the MCP server names. The audience check on the server side is also off by default after upgrading.

Defenses

  1. Inventory and upgrade. Find every app, gateway and agent framework that uses the official SDKs, including transitive dependencies. Move to Python mcp 1.30.0 or 2.2.0, TypeScript @modelcontextprotocol/sdk 1.31.0 or later (1.32.0 for the audience fix), or @modelcontextprotocol/client 2.2.0.
  2. Pin the issuer. Pass issuer= (Python) or expectedIssuer (TypeScript) on every provider that holds a client secret or signing key.
  3. Clear or re-bind stored credentials. Force re-registration, or add issuer to pre-provisioned records. Custom providers must persist the issuer the SDK passes to them.
  4. Rotate after exposure. If a client may have connected to an untrusted server while holding credentials, rotate the client secret or signing key and revoke its tokens.
  5. Only sign in to trusted servers. Until the interactive flow is covered, treat a sign-in prompt from an unknown MCP server as untrusted.
  6. Enforce token audience on servers. Set expectedResource and return the token audience from verifyAccessToken(), or simply reject tokens whose aud does not name your server, which works on every version.
  7. Keep trust outside the protocol. As the CSA note suggests, keep an allowlist mapping each approved MCP server to the authorization servers it may name, enforce it at a gateway, and log unexpected issuers.

Status

AdvisoryPackageSeverityFixed in
GHSA-qx49-fqc8-xw99 (2026-09-28)Python mcpHigh, 7.51.30.0 / 2.2.0
GHSA-6qxp-vccf-f47h (2026-09-30)TS @modelcontextprotocol/sdk, clientHigh, 7.5sdk 1.31.0 / client 2.2.0
GHSA-rvq5-wwqv-78pq (2026-10-05)TS sdk, server, express, server-legacyModerate, 6.8sdk 1.32.0 / server 2.3.0 / express 2.0.2 / server-legacy 2.3.1
CSA research note (2026-11-09)All official SDKsAnalysisUpgrade plus configuration changes

Not affected: MCP servers built with the SDKs (for the client flaws), stdio clients, and clients that attach their own tokens or headers.

Sources