Skip to content

auth: issuer mix-up mitigation - #859

Merged
guglielmo-san merged 4 commits into
modelcontextprotocol:mainfrom
max-stytch:max/SEP-2468
May 27, 2026
Merged

guglielmo-san merged 4 commits into
modelcontextprotocol:mainfrom
max-stytch:max/SEP-2468

Conversation

@max-stytch

@max-stytch max-stytch commented Mar 26, 2026 •

Copy link
Copy Markdown
Contributor

This PR functions as a Reference implementation of SEP-2468 / RFC9207.

This PR hardens the MCP OAuth Client functionality against Mix-Up attacks:

Mix-up attacks aim to steal an authorization code or access token by
tricking the client into sending the authorization code or access
token to the attacker instead of the honest authorization or resource
server

This PR hardens the client by adding support for a new iss parameter in authorization responses:

  • Authorization Servers broadcast support for the iss parameter via the authorization_response_iss_parameter_supported metadata parameter
  • If the parameter is supported, clients expect to receive the iss parameter in the authorization response
  • Clients compare the iss parameter in the authorization response to the Issuer parameter in the authorization metadata. The two must match exactly for the response to be processed.

Fixes #941

@maciej-kisiel

Copy link
Copy Markdown
Contributor

Hi @max-stytch, thanks for the PR. Is this planned to be used as a reference implementation in the official SEP process? If so, could you give me some background where in the process you are currently? More precisely:

Is it coming from some WG / IG? Did you reach out for core maintainer feedback already? Do you need this PR to be merged as part of the process or it can stay open until the SEP is accepted?

Thanks!

@max-stytch

Copy link
Copy Markdown
Contributor Author

Hey @maciej-kisiel -

Is this planned to be used as a reference implementation in the official SEP process?

Yes, that was my intention!

Is it coming from some WG / IG?

This is part of the auth-wg-mixup-protection WG.

Did you reach out for core maintainer feedback already?

I do not believe SEP-2468 has been reviewed yet. @EmLauber do you know who from core will sponsor?

Do you need this PR to be merged as part of the process or it can stay open until the SEP is accepted?

I believe the PR can stay open until the SEP is accepted based on the workflow steps.

I would be grateful for a review in the meantime of course :)

@maciej-kisiel

Copy link
Copy Markdown
Contributor

The PR is reasonable, I don't have any larger concerns.

guglielmo-san
guglielmo-san previously approved these changes May 25, 2026
@guglielmo-san

Copy link
Copy Markdown
Contributor

@max-stytch can you solve the conflict? Then we can merge this PR

@max-stytch

Copy link
Copy Markdown
Contributor Author

@guglielmo-san back to you!

@guglielmo-san

Copy link
Copy Markdown
Contributor

@max-stytch Thank you for the contribution!

@guglielmo-san
guglielmo-san merged commit 2d47cc9 into modelcontextprotocol:main May 27, 2026
10 checks passed
guglielmo-san added a commit that referenced this pull request Oct 26, 2026
`AuthorizationCodeHandler` validates the `iss` parameter of the
authorization response ([RFC
9207](https://www.rfc-editor.org/rfc/rfc9207)), the mitigation for
mix-up attacks added in #859. `extauth.PerformOIDCLogin`, which obtains
the ID token for Enterprise Managed Authorization, only compared the
`state`: the `Iss` reported by the `AuthorizationCodeFetcher` was
ignored. So a response naming another issuer, or one without `iss` from
an IdP that advertises `authorization_response_iss_parameter_supported`,
was accepted and its code exchanged at the IdP's token endpoint.

This checks `iss` right after the `state`, against the issuer and the
flag from the IdP metadata that `initiateOIDCLogin` already fetches:
- If the IdP advertises support, `iss` is required.
- A present `iss` must equal the metadata issuer, whether or not support
is advertised (RFC 9207 §2.4 asks clients to compare it).
- A missing `iss` from an IdP that does not advertise support is
accepted, as before.

Unlike `AuthorizationCodeHandler`, a matching but unadvertised `iss` is
accepted (what `AcceptUnadvertisedIss` opts into there):
`PerformOIDCLogin` never rejected it, so refusing it now would break
IdPs that send `iss` without advertising it, and RFC 9207 §2.4 asks for
validation rather than rejection (see #1152).

Tests:
- `internal/oauthtest`: the fake IdP gets an `IssParameterSupported`
option that advertises support and adds `iss` to its redirects.
- `TestPerformOIDCLogin_Issuer`: advertised and not advertised, each
with a missing, matching and foreign `iss`. The three rejected cases
fail without the change; the existing `TestPerformOIDCLogin` cases are
unchanged.

_AI assistance: prepared with Claude Code._

Co-authored-by: Guglielmo Colombo <guglielmoc@google.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Implement SEP-2468: Recommend Issuer (iss) Parameter in MCP Auth Responses

3 participants