Skip to content
Beta
All articles

mcp-go fixes a flaw that let MCP servers request tokens for other servers

Before v1.2.1, mcp-go's OAuth client trusted the resource a server declared in its metadata. What went wrong, why ratings range from 5.1 to 8.0, and what to do.

By The SpanDock team

5 min read

A diagram of an MCP client fetching a server's metadata, which names a different server as the resource; before the fix the client requests a token for that other server, after the fix it rejects the metadata

mcp-go, a Go library for building MCP clients and servers, has fixed a flaw in its OAuth client. Before version 1.2.1, a malicious or compromised MCP server could tell the client that it was a different MCP server, and the client would ask the authorisation server for a token meant for that other server. The malicious server could then pass the token on. The fix shipped on 9 October 2026; a CVE followed on 5 November. If you build or run Go-based MCP clients that sign in with OAuth, check the version.

What the flaw was

MCP's authorisation specification builds on two OAuth standards. With RFC 9728, a client discovers how to sign in to an MCP server by fetching that server's protected resource metadata, a small JSON document, usually from the path /.well-known/oauth-protected-resource. With RFC 8707 resource indicators, the client then names the server it wants a token for, so the token is bound to that one audience. The MCP specification says clients "MUST implement and use the resource parameter".

The metadata includes a resource field: the identifier of the server it describes. RFC 9728 section 3.3 is strict about it. The value "MUST be identical" to the identifier the client used to build the request, and if it is not, "the data contained in the response MUST NOT be used."

According to the advisory, GHSA-xf6j-693p-wqxx, mcp-go applied that check only to metadata found through a WWW-Authenticate header, not to metadata fetched from the well-known path. The declared resource was then used, unchecked, as the resource parameter in dynamic client registration, the authorisation request, the token exchange and token refresh. A server could therefore declare another MCP server as the resource. The client would request a token for that other server, and the hostile server could forward what it received.

Affected versions run from v0.48.0 to v1.2.0. The project's own issue says the gap was introduced when the well-known path was added, after the check had already been written for the header path. That is a common way for protocol bugs to happen: two discovery paths, and validation on only one.

What the fix changes

Pull request #1053, released as v1.2.1, now checks the declared resource on the well-known path too. It must use the same scheme and host as the server the client addressed, and its path must be the same or a prefix of it at a path-segment boundary. A mismatch is rejected and the metadata is ignored. The pull request notes that this prefix rule is deliberately looser than an exact match, so a server mounted at /mcp that declares its origin as the resource keeps working. That is a pragmatic choice; it is narrower than the RFC's "identical" wording, and worth knowing if you rely on path-level separation between servers on one host.

An empty resource still falls back to the server's own address, and the header path behaves as before.

Why the ratings differ

Three sources rate the same bug differently, and the difference is worth reading rather than averaging:

  • The maintainer's advisory rates it High.
  • The CVE record, as shown in the GitHub Advisory Database, scores it 5.1, Moderate, on CVSS 4.0. The vector assumes attack requirements are present and the user takes part, with no direct impact on the client itself but high confidentiality and integrity impact on a subsequent system.
  • The reporter proposed 8.0 on CVSS 3.1 in the public issue thread, with a changed scope, and said they would defer to the maintainer.

All three agree on the mechanism. They differ on how likely the setup is: the attacker needs a malicious or compromised MCP server that a user connects to, and an authorisation server that the hostile server and a valuable target share. In a company where many MCP servers sign in through one identity provider, that second condition is ordinary.

What it means for engineering and security leaders

This flaw sits in the client, which is the part of MCP that most companies don't write themselves. It ships inside agents, IDE extensions and internal tools, and the people running those tools rarely know which library they embed. Go-based MCP clients are only one slice; the lesson applies to every client that does OAuth discovery.

It also shows why token audience matters on both ends. RFC 9728's security considerations describe exactly this pattern, a malicious resource server getting a client to request a token for a legitimate one, and recommend audience-restricted tokens. The MCP specification requires servers to reject tokens not issued for them. That protects the target only if the token was minted for the right audience in the first place; here the client asked for the wrong one. We covered the server half in MCP SDKs can now check a token's audience, and a related client bug in the MCP TypeScript SDK flaw where credentials followed the wrong issuer.

Where SpanDock fits

One way to shrink this surface is to have fewer OAuth clients on developer computers. The SpanDock MCP gateway gives each computer's AI tools one MCP server and connects to the organisation's connectors from your server. Connector tokens and sign-ins stay in the server's credential store and are never sent to computers, and every call is recorded. The MCP gateway is on the Premium and Enterprise plans.

Practical takeaways

  • Upgrade mcp-go to v1.2.1 or later anywhere you build MCP clients with it, and rebuild the binaries that embed it.
  • Ask vendors of Go-based agents and MCP tools which mcp-go version they ship. Don't rely on alerts alone: the CVE's entry in the GitHub Advisory Database lists no package, and GitHub notes that Dependabot alerts are not supported for it.
  • Check your authorisation server issues audience-restricted tokens when a resource indicator is sent, and that your MCP servers reject tokens for other audiences.
  • Review which MCP servers people can add themselves. A malicious server only has to be connected once to try this.
  • Audit other OAuth clients for the same pattern: discovery through more than one path, with the resource check on only one of them.

Sources

  1. mark3labs/mcp-go advisory GHSA-xf6j-693p-wqxx
  2. mark3labs/mcp-go pull request #1053: validate resource in well-known protected resource metadata
  3. GitHub Advisory Database: CVE-2026-123272 (GHSA-h3x9-8c36-m89w)
  4. RFC 9728: OAuth 2.0 Protected Resource Metadata
  5. Model Context Protocol specification: Authorization (2025-06-18)
Cookie categories

Details: Cookie Policy.