Authorization code injection
13An attacker injects a stolen code into their own app session so the legitimate app connects that session to the victim’s resources.
Related RFCs and changes
“Updates” changes part of an earlier RFC. “Obsoletes” replaces it. This list shows selected related documents.
DIAGRAM§ 4.5 ↗
RFC 9700 · § 4.5DEFENSE
3 / 3
03
Reject the code exchange.
The code’s stored challenge does not match the verifier supplied by this client transaction.
Protocol participantThreat or exceptionProtocol controlSimplified drawings · precise section references
RFC 6749 § 10.5RFC 9700 § 4.5.3
The later BCP details code injection into another client session and transaction binding through PKCE or, with extra precautions, OIDC nonce.
Read the updated RFC section ↗Bind codes to a client instance and transaction.
- PKCE rejects injected codes whose challenge does not match this transaction’s verifier.
- Confidential OIDC clients using nonce MUST verify it in the token-endpoint ID Token and disregard all tokens until the check succeeds.
- Keep preventing response leakage: modifying request challenges or nonces and stealing responses can undermine these defenses.
Client authentication alone does not stop injection because the legitimate app authenticates on the attacker’s behalf. Nonce alone does not protect public-client codes from direct redemption.
Read the RFC section ↗Diagrams simplify the RFC. Read the linked sections for complete requirements.
PrivacyAll chapters in this RFC
- OAuth overview
- Authorization code + PKCE
- Retire unsafe grants
- Prevent token replay
- Limit token privileges
- Authenticate the client
- Metadata, TLS & CORS
- The attacker model
- Redirect URI validation
- Referer header leakage
- Browser history leakage
- Authorization server mix-up
- Authorization code injection
- Access token injection
- Cross-site request forgery
- PKCE downgrade
- Leakage at resource servers
- Misuse of stolen tokens
- Open redirection
- 307 credential forwarding
- TLS termination & proxies
- Refresh token protection
- Client as resource owner
- Clickjacking
- In-browser messaging