OAuth mix-up attacks: keep authorization server responses tied to the right issuer
An OAuth mix-up attack targets a client that supports multiple authorization servers (AS). The attacker confuses the client about which server produced a browser-delivered response, so the client may send an authorization code or token to the attacker's endpoint. Bind the AS selected for each login transaction to that transaction, then verify the response issuer before processing credentials. This article follows OAuth Security BCP RFC 9700 and issuer identification RFC 9207.
OAuth mix-up attacks: keep authorization server responses tied to the right issuer
An OAuth mix-up attack targets a client that supports multiple authorization servers (AS). The attacker confuses the client about which server produced a browser-delivered response, so the client may send an authorization code or token to the attacker's endpoint. Bind the AS selected for each login transaction to that transaction, then verify the response issuer before processing credentials. This article follows OAuth Security BCP RFC 9700 and issuer identification RFC 9207.
Simplified attack flow
The client stores the selected issuer and starts authorization.
An attacker-controlled AS steers the browser through a response flow that involves an honest AS.
The honest AS returns a code or token to the client's callback.
Without an issuer check, the client can associate that response with the wrong AS and send the code to the attacker's token endpoint.
The attacker may obtain the code or token. Details depend on the client, AS selection, and response path.
RFC 9700 describes a case where the same redirect URI is registered with both the honest and attacker AS. The risk applies to clients interacting with multiple AS; a client fixed to one AS is outside this mix-up threat until it adds another.
Bind and validate the issuer
At authorization start, store the selected issuer with the browser transaction. Use its trusted metadata to select both authorization and token endpoints. Storing only an authorization URL is insufficient because an attacker could pair an honest authorization endpoint with an attacker-controlled token endpoint.
If the response contains `iss`, decode its form-encoded value and compare it by exact string equality with the issuer saved for that transaction. On mismatch, stop before exchanging the code or accepting a token. RFC 9207 requires supporting AS to include `iss` in success and error responses; the client must follow its configured support policy for missing `iss`.
When supported and registered correctly, a distinct redirect URI per AS is another defense. RFC 9700 notes its registration and deployment constraints and recommends it only when other options are unavailable.
Apply `state`, PKCE, and OIDC `nonce` for their own purposes. They help bind requests, prevent CSRF, or resist code injection, but do not automatically identify the AS that produced a response.
Trust issuer and metadata configuration. Do not let arbitrary user input select endpoints; verify metadata's issuer and TLS.
Verification plan
In a test environment, confirm that a normal response is exchanged only at the selected AS token endpoint; a mismatched iss is rejected; missing iss follows the configured server policy; and expired or replayed callbacks are rejected. These are suggested checks, not tests performed on a particular product.
Sources
[RFC 9700 §4.4: Mix-Up Attacks](https://www.rfc-editor.org/rfc/rfc9700.html#section-4.4)
[RFC 9207: OAuth 2.0 Authorization Server Issuer Identification](https://www.rfc-editor.org/rfc/rfc9207.html)