Skip to content

Potential Attack Vector #340

@AxelNennker

Description

@AxelNennker

Problem Description

The CAMARA Security Interoperability Profile currently requires that the aud (audience) claim in JWT assertions should be set to the URL of the endpoint to which the request is sent. This requirement creates a security vulnerability known as "Audience Injection Attack" that has been identified by University of Stuttgart researchers and is being addressed by the IETF in draft-ietf-oauth-rfc7523bis-04.

This attack vector is then a problem IF metadata is retrieved. Hardcoded aud-values should be secure.

Affected Sections

  1. Signed Authentication Requests (OIDC Authorization Code Flow)

    • Current text: "It is RECOMMENDED that the value of the aud field of the signed authentication request is the URL of the Authorization Endpoint."
  2. Client-Initiated Backchannel Authentication Flow

    • Current text: "It is RECOMMENDED that the value of the aud field of the signed authentication request is the URL of the Backchannel Authentication Endpoint."
  3. JWT Bearer Flow

    • Current text: "The mandatory aud claim MUST be the URL of the endpoint this token request is sent to."
  4. Client Authentication

    • Current text: "This document RECOMMENDS that the aud (audience) claim in the client assertion SHOULD be the full URL of the specific endpoint at the Authorization Server to which the client is sending the request."

The Vulnerability

The attack works as follows:

  1. Attacker's Authorization Server (evil-as.example.com) publishes metadata claiming its token endpoint is at a different URL (e.g., https://honest-as.example.com/token)
  2. API Consumer creates a JWT with aud: https://honest-as.example.com/token (following current CAMARA guidance)
  3. Attacker captures this JWT and replays it at the honest authorization server
  4. Honest Authorization Server accepts the JWT because the audience matches its token endpoint URL

This attack is possible because:

  • Discovery metadata (RFC 8414) is typically served over TLS but only "issuer" is validated
  • A malicious authorization server can lie about its token_endpoint in its metadata
  • If the audience is the token endpoint URL, JWTs intended for one AS can be replayed at another AS that happens to have the same endpoint URL

The Solution (per draft-ietf-oauth-rfc7523bis-04)

The IETF working group has determined that the aud claim MUST be the issuer identifier of the authorization server (not the token endpoint URL) for client authentication JWTs.

This prevents the attack because:

  1. Clients MUST validate that the issuer field in metadata matches the URL from which the metadata was retrieved (RFC 8414 Section 3.3 requirement)
  2. Each authorization server only accepts JWTs with aud set to its own issuer identifier
  3. A JWT created for evil-as.example.com cannot be replayed at honest-as.example.com

The defense relies on proper client validation: if metadata is fetched from https://evil-as.example.com/.well-known/oauth-authorization-server, the issuer field MUST be https://evil-as.example.com or the metadata MUST be rejected.

Proposed Changes

1. Update "Signed Authentication Requests" Section

Current:

It is RECOMMENDED that the value of the `aud` field of the signed authentication request is the URL of the Authorization Endpoint.
The authorization server MAY accept different values of the `aud` field e.g. the `issuer` field of its OpenID Provider Metadata.

Proposed:

The value of the `aud` field of the signed authentication request MUST be the `issuer` identifier of the authorization server as defined in RFC 8414.

2. Update "CIBA Authentication Request" Section

Current:

It is RECOMMENDED that the value of the `aud` field of the signed authentication request is the URL of the Backchannel Authentication Endpoint.
The authorization server MAY accept different values of the `aud` field e.g. the `issuer` field of its OpenID Provider Metadata.

Proposed:

The value of the `aud` field of the signed authentication request MUST be the `issuer` identifier of the authorization server as defined in RFC 8414.

3. Update "JWT Bearer Flow" Section

Current:

- The mandatory `aud` claim MUST be the URL of the endpoint this token request is sent to.

Proposed:

- The mandatory `aud` claim MUST be the `issuer` identifier of the authorization server as defined in RFC 8414.

4. Update "Client Authentication" Section

Current:

This document RECOMMENDS that the `aud` (audience) claim in the client assertion SHOULD be the full URL of the specific endpoint at the Authorization Server to which the client is sending the request.

Proposed:

The `aud` (audience) claim in the client assertion MUST be the `issuer` identifier of the authorization server as defined in RFC 8414. The authorization server MUST reject any client authentication JWT that does not contain its own issuer identifier as the sole audience value.

Client authentication JWTs SHOULD be explicitly typed by using the `typ` header parameter value `client-authentication+jwt` as defined in draft-ietf-oauth-rfc7523bis.

5. Add Security Considerations

Add a new subsection under the relevant sections:

#### Audience Validation

API Consumers MUST validate that the `issuer` value in the authorization server metadata exactly matches the issuer identifier used to construct the metadata URL, as required by RFC 8414 Section 3.3. If these values do not match, the metadata MUST be rejected to prevent audience injection attacks.

Authorization servers MUST reject JWT assertions (for both client authentication and JWT bearer grants) if the `aud` claim does not exactly match the authorization server's own issuer identifier.

References

Priority

This is a security vulnerability that should be addressed in the next release of the CAMARA Security Interoperability Profile.

Metadata

Metadata

Assignees

No one assigned

    Labels

    correctionAPI specification needs correction

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions