Skip to the content
AI and Cybersecurity Learning and Practice Center Test automation Open the Learning Center

IncidentMCP servers and tools

MCP Python SDK: a malicious server could steal the client's OAuth credentials

HighAnthropicCycode

Cycode reported that in the official MCP Python SDK a malicious MCP server could redirect the client's OAuth token exchange to an endpoint it controlled and capture the client secret, the authorization code and the PKCE proof key. Fixed in 1.30.0 and 2.2.0. No CVE had been assigned when it was reported.

Replay the attack step by step in the Learning Center

How it happened

  1. The client trusted the server's metadata for where to send the OAuth token exchange.
  2. A malicious server pointed that exchange at itself and collected the secret, code and PKCE verifier.
  3. With those, the attacker could obtain tokens for the services the client had been authorized for.

Impact

Connecting an agent to an MCP server you do not control carried credential risk, not only prompt injection risk.

The fix

Upgrade the mcp package to 1.30.0 or 2.2.0, clear stored OAuth registrations, and rotate secrets and tokens if you connected to servers you do not trust.

Lessons

  • The SDK is part of the supply chain: pin it and re-check it when advisories land.
  • OAuth metadata from a remote server is untrusted input.

Sources