Skip to content

Phishing/Audience Mix-Up Mitigation for Resources #215

@mcguinness

Description

@mcguinness

A client currently has no way to detect whether an authorization server supports the RFC 8707 Resource Indicators for OAuth 2.0 extension. An authorization server that implements support for RFC 8707 would process a requested resource and audience-restrict the issued access token if the resource was valid or return an invalid_target error code if the requested resource is not valid for the authorization server. If the authorization server doesn't support RFC 8707 it would silently ignore the resource parameter and issue an access token to its default audience for the request (e.g client+scopes requested).

Since the access_token in the token response is opaque to the client, the client has no way to know the value of the issued token's audience. This is especially problematic when using metadata to dynamically discover an authorization server such as with OAuth 2.0 Protected Resource Metadata (RFC 9728).

For example resource.example could publish https://resource.example as the resource identifier but specify https://accounts.google.com/o/oauth2/v2/auth as the authorization server as a phishing attack. A client would then attempt to obtain an access token from the specified authorization server with the dynamically discovered resource

https://accounts.google.com/o/oauth2/v2/auth?client_id=...&scope=...&resource=https://resource.example.

If the authorization doesn't support RFC 8707 then it would just process this as a normal authorization request, ignore the invalid resource, and issue a default access token (assuming user consented). This is the exact scenario that Model Context Protocol (MCP) project is vulnerable to which has taken a dependency on OAuth 2.1

While this security risk is explicitly called out in the security considerations of RFC 9728, the interoperability gap still exists for an OAuth 2.1.

Secure determination of appropriate authorization servers to use with a protected resource for all use cases is out of scope for this specification. This specification assumes that the client has a means of determining appropriate authorization servers to use with a protected resource and that the client is using the correct metadata for each protected resource. Implementers need to be aware that if an inappropriate authorization server is used by the client, an attacker may be able to act as an adversary-in-the-middle proxy to a valid authorization server without it being detected by the authorization server or the client.

If OAuth 2.1 included the RFC 8707 Resource Indicators for OAuth 2.0 extension, clients could expect an authorization server to process the resource or return invalid_target error code. This would help projects like MCP mitigate risks of using metadata based discovery. An authorization doesn't need to support resource indicators to be complaint. It just needs to return invalid_target if a resource is specified. . This is small lift for an authorization (support an error code) has a ton a value for dynamic discovery scenarios.

Alternatively, OAuth 2.1 could specify a new token response field for audience. This would push validation to the client to ensure the that issued token was for an audience it wanted and prevent forwarding a token to a resource server with a mismatched audience. Since audience doesn't need to be 1:1 to a resource's url this is problematic but could be profiled.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions