idnits 2.17.1 draft-ietf-oauth-security-topics-12.txt: Checking boilerplate required by RFC 5378 and the IETF Trust (see https://trustee.ietf.org/license-info): ---------------------------------------------------------------------------- No issues found here. Checking nits according to https://www.ietf.org/id-info/1id-guidelines.txt: ---------------------------------------------------------------------------- No issues found here. Checking nits according to https://www.ietf.org/id-info/checklist : ---------------------------------------------------------------------------- No issues found here. Miscellaneous warnings: ---------------------------------------------------------------------------- == The copyright year in the IETF Trust and authors Copyright Line does not match the current year -- The document date (March 8, 2019) is 1876 days in the past. Is this intentional? -- Found something which looks like a code comment -- if you have code sections in the document, please surround them with '' and '' lines. Checking references for intended status: Best Current Practice ---------------------------------------------------------------------------- (See RFCs 3967 and 4897 for information about using normative references to lower-maturity documents in RFCs) -- Possible downref: Non-RFC (?) normative reference: ref. 'OpenID' ** Downref: Normative reference to an Informational RFC: RFC 6819 == Outdated reference: A later version (-34) exists of draft-ietf-oauth-jwsreq-17 == Outdated reference: A later version (-17) exists of draft-ietf-oauth-mtls-13 == Outdated reference: A later version (-07) exists of draft-ietf-oauth-pop-key-distribution-04 == Outdated reference: A later version (-08) exists of draft-ietf-oauth-resource-indicators-02 == Outdated reference: A later version (-05) exists of draft-sakimura-oauth-jpop-04 -- Obsolete informational reference (is this intentional?): RFC 7231 (Obsoleted by RFC 9110) Summary: 1 error (**), 0 flaws (~~), 6 warnings (==), 4 comments (--). Run idnits with the --verbose option for more detailed information about the items above. -------------------------------------------------------------------------------- 2 Web Authorization Protocol T. Lodderstedt 3 Internet-Draft yes.com 4 Intended status: Best Current Practice J. Bradley 5 Expires: September 9, 2019 Yubico 6 A. Labunets 7 Facebook 8 D. Fett 9 yes.com 10 March 8, 2019 12 OAuth 2.0 Security Best Current Practice 13 draft-ietf-oauth-security-topics-12 15 Abstract 17 This document describes best current security practice for OAuth 2.0. 18 It updates and extends the OAuth 2.0 Security Threat Model to 19 incorporate practical experiences gathered since OAuth 2.0 was 20 published and covers new threats relevant due to the broader 21 application of OAuth 2.0. 23 Status of This Memo 25 This Internet-Draft is submitted in full conformance with the 26 provisions of BCP 78 and BCP 79. 28 Internet-Drafts are working documents of the Internet Engineering 29 Task Force (IETF). Note that other groups may also distribute 30 working documents as Internet-Drafts. The list of current Internet- 31 Drafts is at https://datatracker.ietf.org/drafts/current/. 33 Internet-Drafts are draft documents valid for a maximum of six months 34 and may be updated, replaced, or obsoleted by other documents at any 35 time. It is inappropriate to use Internet-Drafts as reference 36 material or to cite them other than as "work in progress." 38 This Internet-Draft will expire on September 9, 2019. 40 Copyright Notice 42 Copyright (c) 2019 IETF Trust and the persons identified as the 43 document authors. All rights reserved. 45 This document is subject to BCP 78 and the IETF Trust's Legal 46 Provisions Relating to IETF Documents 47 (https://trustee.ietf.org/license-info) in effect on the date of 48 publication of this document. Please review these documents 49 carefully, as they describe your rights and restrictions with respect 50 to this document. Code Components extracted from this document must 51 include Simplified BSD License text as described in Section 4.e of 52 the Trust Legal Provisions and are provided without warranty as 53 described in the Simplified BSD License. 55 Table of Contents 57 1. Introduction . . . . . . . . . . . . . . . . . . . . . . . . 3 58 1.1. Structure . . . . . . . . . . . . . . . . . . . . . . . . 4 59 1.2. Conventions and Terminology . . . . . . . . . . . . . . . 4 60 2. The Updated OAuth 2.0 Attacker Model . . . . . . . . . . . . 4 61 3. Recommendations . . . . . . . . . . . . . . . . . . . . . . . 6 62 3.1. Protecting Redirect-Based Flows . . . . . . . . . . . . . 6 63 3.1.1. Authorization Code Grant . . . . . . . . . . . . . . 7 64 3.1.2. Implicit Grant . . . . . . . . . . . . . . . . . . . 7 65 3.2. Token Replay Prevention . . . . . . . . . . . . . . . . . 8 66 3.3. Access Token Privilege Restriction . . . . . . . . . . . 8 67 4. Attacks and Mitigations . . . . . . . . . . . . . . . . . . . 9 68 4.1. Insufficient Redirect URI Validation . . . . . . . . . . 9 69 4.1.1. Redirect URI Validation Attacks on Authorization Code 70 Grant . . . . . . . . . . . . . . . . . . . . . . . . 9 71 4.1.2. Redirect URI Validation Attacks on Implicit Grant . . 10 72 4.1.3. Proposed Countermeasures . . . . . . . . . . . . . . 12 73 4.2. Credential Leakage via Referrer Headers . . . . . . . . . 12 74 4.2.1. Leakage from the OAuth Client . . . . . . . . . . . . 13 75 4.2.2. Leakage from the Authorization Server . . . . . . . . 13 76 4.2.3. Consequences . . . . . . . . . . . . . . . . . . . . 13 77 4.2.4. Proposed Countermeasures . . . . . . . . . . . . . . 13 78 4.3. Attacks through the Browser History . . . . . . . . . . . 14 79 4.3.1. Code in Browser History . . . . . . . . . . . . . . . 14 80 4.3.2. Access Token in Browser History . . . . . . . . . . . 15 81 4.4. Mix-Up . . . . . . . . . . . . . . . . . . . . . . . . . 15 82 4.4.1. Attack Description . . . . . . . . . . . . . . . . . 15 83 4.4.2. Countermeasures . . . . . . . . . . . . . . . . . . . 17 84 4.5. Authorization Code Injection . . . . . . . . . . . . . . 18 85 4.5.1. Attack Description . . . . . . . . . . . . . . . . . 18 86 4.5.2. Discussion . . . . . . . . . . . . . . . . . . . . . 19 87 4.5.3. Proposed Countermeasures . . . . . . . . . . . . . . 20 88 4.6. Access Token Injection . . . . . . . . . . . . . . . . . 21 89 4.6.1. Proposed Countermeasures . . . . . . . . . . . . . . 22 90 4.7. Cross Site Request Forgery . . . . . . . . . . . . . . . 22 91 4.7.1. Proposed Countermeasures . . . . . . . . . . . . . . 22 92 4.8. Access Token Leakage at the Resource Server . . . . . . . 22 93 4.8.1. Access Token Phishing by Counterfeit Resource Server 22 94 4.8.2. Compromised Resource Server . . . . . . . . . . . . . 28 95 4.9. Open Redirection . . . . . . . . . . . . . . . . . . . . 28 96 4.9.1. Authorization Server as Open Redirector . . . . . . . 29 97 4.9.2. Clients as Open Redirector . . . . . . . . . . . . . 29 98 4.10. 307 Redirect . . . . . . . . . . . . . . . . . . . . . . 29 99 4.11. TLS Terminating Reverse Proxies . . . . . . . . . . . . . 30 100 4.12. Refresh Token Protection . . . . . . . . . . . . . . . . 31 101 5. Acknowledgements . . . . . . . . . . . . . . . . . . . . . . 33 102 6. IANA Considerations . . . . . . . . . . . . . . . . . . . . . 33 103 7. Security Considerations . . . . . . . . . . . . . . . . . . . 33 104 8. References . . . . . . . . . . . . . . . . . . . . . . . . . 33 105 8.1. Normative References . . . . . . . . . . . . . . . . . . 33 106 8.2. Informative References . . . . . . . . . . . . . . . . . 34 107 Appendix A. Document History . . . . . . . . . . . . . . . . . . 37 108 Authors' Addresses . . . . . . . . . . . . . . . . . . . . . . . 39 110 1. Introduction 112 Since its publication in [RFC6749] and [RFC6750], OAuth 2.0 has 113 gotten massive traction in the market and became the standard for API 114 protection and, as foundation of OpenID Connect [OpenID], identity 115 providing. While OAuth was used in a variety of scenarios and 116 different kinds of deployments, the following challenges could be 117 observed: 119 o OAuth implementations are being attacked through known 120 implementation weaknesses and anti-patterns (CSRF, referrer 121 header). Although most of these threats are discussed in the 122 OAuth 2.0 Threat Model and Security Considerations [RFC6819], 123 continued exploitation demonstrates there may be a need for more 124 specific recommendations or that the existing mitigations are too 125 difficult to deploy. 127 o Technology has changed, e.g., the way browsers treat fragments in 128 some situations, which may change the implicit grant's underlying 129 security model. 131 o OAuth is used in much more dynamic setups than originally 132 anticipated, creating new challenges with respect to security. 133 Those challenges go beyond the original scope of [RFC6749], 134 [RFC6749], and [RFC6819]. 136 Moreover, OAuth is being adopted in use cases with higher security 137 requirements than considered initially, such as Open Banking, 138 eHealth, eGovernment, and Electronic Signatures. Those use cases 139 call for stricter guidelines and additional protection. 141 OAuth initially assumed a static relationship between client, 142 authorization server and resource servers. The URLs of AS and RS 143 were known to the client at deployment time and built an anchor for 144 the trust relationship among those parties. The validation whether 145 the client talks to a legitimate server was based on TLS server 146 authentication (see [RFC6819], Section 4.5.4). With the increasing 147 adoption of OAuth, this simple model dissolved and, in several 148 scenarios, was replaced by a dynamic establishment of the 149 relationship between clients on one side and the authorization and 150 resource servers of a particular deployment on the other side. This 151 way the same client could be used to access services of different 152 providers (in case of standard APIs, such as e-Mail or OpenID 153 Connect) or serves as a frontend to a particular tenant in a multi- 154 tenancy. Extensions of OAuth, such as [RFC7591] and [RFC8414] were 155 developed in order to support the usage of OAuth in dynamic 156 scenarios. As a challenge to the community, such usage scenarios 157 open up new attack angles, which are discussed in this document. 159 1.1. Structure 161 The remainder of the document is organized as follows: The next 162 section updates the OAuth attacker model. Afterwards, the most 163 important recommendations of the OAuth working group for every OAuth 164 implementor are summarized. Subsequently, a detailed analysis of the 165 threats and implementation issues which can be found in the wild 166 today is given along with a discussion of potential countermeasures. 168 1.2. Conventions and Terminology 170 The key words "MUST", "MUST NOT", "REQUIRED", "SHALL", "SHALL NOT", 171 "SHOULD", "SHOULD NOT", "RECOMMENDED", "NOT RECOMMENDED", "MAY", and 172 "OPTIONAL" in this document are to be interpreted as described in BCP 173 14 [RFC2119] [RFC8174] when, and only when, they appear in all 174 capitals, as shown here. 176 2. The Updated OAuth 2.0 Attacker Model 178 In [RFC6819], an attacker model was laid out that described the 179 capabilities of attackers against which OAuth deployments must 180 defend. In the following, this attacker model is updated to account 181 for the potentially dynamic relationships involving multiple parties 182 (as described above), to include new types of attackers, and to make 183 it more clearly defined. 185 OAuth 2.0 aims to ensure that the authorization of the resource owner 186 (RO) (with a user agent) at an authorization server (AS) and the 187 subsequent usage of the access token at the resource server (RS) is 188 protected at least against the following attackers: 190 o (A1) Web Attackers that control an arbitrary number of network 191 endpoints (except for RO, AS, and RS). Web attackers may set up 192 web sites that are visited by the RO, operate their own user 193 agents, participate in the protocol using their own user 194 credentials, etc. 195 Web attackers may, in particular, operate OAuth clients that are 196 registered at AS, and operate their own authorization and resource 197 servers that can be used (in parallel) by ROs. 198 It must also be assumed that web attackers can lure the user to 199 open arbitrary attacker-chosen URIs at any time. This can be 200 achieved through many ways, for example, by injecting malicious 201 advertisements into advertisement networks, or by sending legit- 202 looking emails. 204 o (A2) Network Attackers that additionally have full control over 205 the network over which protocol participants communicate. They 206 can eavesdrop on, manipulate, and spoof messages, except when 207 these are properly protected by cryptographic methods (e.g., TLS). 208 Network attacker can also block specific messages. 210 These attackers conform to the attacker model that was used in formal 211 analysis efforts for OAuth [arXiv.1601.01229]. Previous attacks on 212 OAuth have shown that OAuth deployments should protect against an 213 even strong attacker model that is described as follows: 215 o (A3) Attackers that can read, but not modify, the contents of the 216 authorization response (i.e., the authorization response can leak 217 to an attacker). 218 Examples for such attacks include open redirector attacks, 219 problems existing on mobile operating systems (where different 220 apps can register themselves on the same URI), so-called mix-up 221 attacks, where the client is tricked into sending credentials to a 222 attacker-controlled AS, and the fact that URLs are often stored/ 223 logged by browsers (history), proxy servers, and operating 224 systems. 226 o (A4) Attackers that can read, but not modify, the contents of the 227 authorization request (i.e., the authorization request can leak, 228 in the same manner as above, to an attacker). 230 o (A5) Attackers that control a resource server used by RO with an 231 access token issued by AS. For example, a resource server can be 232 compromised by an attacker, an access token may be sent to an 233 attacker-controlled resource server due to a misconfiguration, or 234 an RO is social-engineered into using a attacker-controlled RS. 236 Note that in this attacker model, an attacker can be a RO or act as 237 one (see A1). For example, an attacker can use his own browser to 238 replay tokens or authorization codes obtained by any of the attacks 239 described above at the client or RS. 241 This document discusses the additional threats resulting from these 242 attackers in detail and recommends suitable mitigations. 244 This is a minimal attacker model. Implementers MUST take into 245 account all possible attackers in the environment in which their 246 OAuth implementations are expected to run. 248 3. Recommendations 250 This section describes the set of security mechanisms the OAuth 251 working group recommends to OAuth implementers. 253 3.1. Protecting Redirect-Based Flows 255 Authorization servers MUST utilize exact matching of client redirect 256 URIs against pre-registered URIs. This measure contributes to the 257 prevention of leakage of authorization codes and access tokens 258 (depending on the grant type). It also helps to detect mix-up 259 attacks. 261 Clients SHOULD avoid forwarding the user's browser to a URI obtained 262 from a query parameter since such a function could be utilized to 263 exfiltrate authorization codes and access tokens. If there is a 264 strong need for this kind of redirects, clients are advised to 265 implement appropriate countermeasures against open redirection, e.g., 266 as described by the OWASP [owasp]. 268 Clients MUST prevent CSRF and ensure that each authorization response 269 is only accepted once. One-time use CSRF tokens carried in the 270 "state" parameter, which are securely bound to the user agent, SHOULD 271 be used for that purpose. 273 In order to prevent mix-up attacks, clients MUST only process 274 redirect responses of the OAuth authorization server they sent the 275 respective request to and from the same user agent this authorization 276 request was initiated with. Clients MUST memorize which 277 authorization server they sent an authorization request to and bind 278 this information to the user agent and ensure any sub-sequent 279 messages are sent to the same authorization server. Clients SHOULD 280 use AS-specific redirect URIs as a means to identify the AS a 281 particular response came from. 283 Note: [I-D.bradley-oauth-jwt-encoded-state] gives advice on how to 284 implement CSRF prevention and AS matching using signed JWTs in the 285 "state" parameter. 287 AS which redirect a request that potentially contains user 288 credentials MUST avoid forwarding these user credentials accidentally 289 (see Section 4.10). 291 3.1.1. Authorization Code Grant 293 Clients utilizing the authorization grant type MUST use PKCE 294 [RFC7636] in order to (with the help of the authorization server) 295 detect and prevent attempts to inject (replay) authorization codes 296 into the authorization response. The PKCE challenges must be 297 transaction-specific and securely bound to the user agent in which 298 the transaction was started and the respective client. OpenID 299 Connect clients MAY use the "nonce" parameter of the OpenID Connect 300 authentication request as specified in [OpenID] in conjunction with 301 the corresponding ID Token claim for the same purpose. 303 Note: although PKCE so far was recommended as a mechanism to protect 304 native apps, this advice applies to all kinds of OAuth clients, 305 including web applications. 307 Authorization servers SHOULD use client authentication if possible. 309 Authorization servers SHOULD furthermore consider the recommendations 310 given in [RFC6819], Section 4.4.1.1, on authorization code replay 311 prevention. 313 3.1.2. Implicit Grant 315 The implicit grant (response type "token") and other response types 316 causing the authorization server to issue access tokens in the 317 authorization response are vulnerable to access token leakage and 318 access token replay as described in Section 4.1, Section 4.2, 319 Section 4.3, and Section 4.6. 321 Moreover, no viable mechanism exists to cryptographically bind access 322 tokens issued in the authorization response to a certain client as it 323 is recommended in Section 3.2. This makes replay detection for such 324 access tokens at resource servers impossible. 326 In order to avoid these issues, clients SHOULD NOT use the implicit 327 grant (response type "token") or any other response type issuing 328 access tokens in the authorization response, such as "token id_token" 329 and "code token id_token", unless the issued access tokens are 330 sender-constrained and access token injection in the authorization 331 response is prevented. 333 A sender constrained access token scopes the applicability of an 334 access token to a certain sender. This sender is obliged to 335 demonstrate knowledge of a certain secret as prerequisite for the 336 acceptance of that token at the recipient (e.g., a resource server). 338 Clients SHOULD instead use the response type "code" (aka 339 authorization code grant type) as specified in Section 3.1.1 or any 340 other response type that causes the authorization server to issue 341 access tokens in the token response. This allows the authorization 342 server to detect replay attempts and generally reduces the attack 343 surface since access tokens are not exposed in URLs. It also allows 344 the authorization server to sender-constrain the issued tokens. 346 3.2. Token Replay Prevention 348 Authorization servers SHOULD use TLS-based methods for sender- 349 constrained access tokens as described in Section 4.8.1.2, such as 350 token binding [I-D.ietf-oauth-token-binding] or Mutual TLS for OAuth 351 2.0 [I-D.ietf-oauth-mtls] in order to prevent token replay. Refresh 352 tokens MUST be sender-constrained or use refresh token rotation as 353 described in Section 4.12. It is also recommended to use end-to-end 354 TLS whenever possible. 356 3.3. Access Token Privilege Restriction 358 The privileges associated with an access token SHOULD be restricted 359 to the minimum required for the particular application or use case. 360 This prevents clients from exceeding the privileges authorized by the 361 resource owner. It also prevents users from exceeding their 362 privileges authorized by the respective security policy. Privilege 363 restrictions also limit the impact of token leakage although more 364 effective counter-measures are described in Section 3.2. 366 In particular, access tokens SHOULD be restricted to certain resource 367 servers, preferably to a single resource server. To put this into 368 effect, the authorization server associates the access token with 369 certain resource servers and every resource server is obliged to 370 verify for every request, whether the access token sent with that 371 request was meant to be used for that particular resource server. If 372 not, the resource server MUST refuse to serve the respective request. 373 Clients and authorization servers MAY utilize the parameters "scope" 374 or "resource" as specified in [RFC6749] and 375 [I-D.ietf-oauth-resource-indicators], respectively, to determine the 376 resource server they want to access. 378 Additionally, access tokens SHOULD be restricted to certain resources 379 and actions on resource servers or resources. To put this into 380 effect, the authorization server associates the access token with the 381 respective resource and actions and every resource server is obliged 382 to verify for every request, whether the access token sent with that 383 request was meant to be used for that particular action on the 384 particular resource. If not, the resource server must refuse to 385 serve the respective request. Clients and authorization servers MAY 386 utilize the parameter "scope" as specified in [RFC6749] to determine 387 those resources and/or actions. 389 4. Attacks and Mitigations 391 This section gives a detailed description of attacks on OAuth 392 implementations, along with potential countermeasures. This section 393 complements and enhances the description given in [RFC6819]. 395 4.1. Insufficient Redirect URI Validation 397 Some authorization servers allow clients to register redirect URI 398 patterns instead of complete redirect URIs. In those cases, the 399 authorization server, at runtime, matches the actual redirect URI 400 parameter value at the authorization endpoint against this pattern. 401 This approach allows clients to encode transaction state into 402 additional redirect URI parameters or to register just a single 403 pattern for multiple redirect URIs. As a downside, it turned out to 404 be more complex to implement and error prone to manage than exact 405 redirect URI matching. Several successful attacks, utilizing flaws 406 in the pattern matching implementation or concrete configurations, 407 have been observed in the wild. Insufficient validation of the 408 redirect URI effectively breaks client identification or 409 authentication (depending on grant and client type) and allows the 410 attacker to obtain an authorization code or access token, either 412 o by directly sending the user agent to a URI under the attackers 413 control, or 415 o by exposing the OAuth credentials to an attacker by utilizing an 416 open redirector at the client in conjunction with the way user 417 agents handle URL fragments. 419 4.1.1. Redirect URI Validation Attacks on Authorization Code Grant 421 For a public client using the grant type code, an attack would look 422 as follows: 424 Let's assume the redirect URL pattern "https://*.somesite.example/*" 425 had been registered for the client "s6BhdRkqt3". This pattern allows 426 redirect URIs pointing to any host residing in the domain 427 somesite.example. So if an attacker manages to establish a host or 428 subdomain in somesite.example he can impersonate the legitimate 429 client. Assume the attacker sets up the host 430 "evil.somesite.example". 432 The attack can then be conducted as follows: 434 First, the attacker needs to trick the user into opening a tampered 435 URL in his browser, which launches a page under the attacker's 436 control, say "https://www.evil.example". (See Attacker A1.) 438 This URL initiates an authorization request with the client id of a 439 legitimate client to the authorization endpoint. This is the example 440 authorization request (line breaks are for display purposes only): 442 GET /authorize?response_type=code&client_id=s6BhdRkqt3&state=9ad67f13 443 &redirect_uri=https%3A%2F%2Fevil.somesite.example%2Fcb HTTP/1.1 444 Host: server.somesite.example 446 Afterwards, the authorization server validates the redirect URI in 447 order to identify the client. Since the pattern allows arbitrary 448 domains host names in "somesite.example", the authorization request 449 is processed under the legitimate client's identity. This includes 450 the way the request for user consent is presented to the user. If 451 auto-approval is allowed (which is not recommended for public clients 452 according to [RFC6749]), the attack can be performed even easier. 454 If the user does not recognize the attack, the code is issued and 455 immediately sent to the attacker's client. 457 Since the attacker impersonated a public client, it can exchange the 458 code for tokens at the respective token endpoint. 460 Note: This attack will not work as easily for confidential clients, 461 since the code exchange requires authentication with the legitimate 462 client's secret. The attacker will need to impersonate or utilize 463 the legitimate client to redeem the code (e.g., by performing a code 464 injection attack). This kind of injections is covered in 465 Section 4.5. 467 4.1.2. Redirect URI Validation Attacks on Implicit Grant 469 The attack described above works for the implicit grant as well. If 470 the attacker is able to send the authorization response to a URI 471 under his control, he will directly get access to the fragment 472 carrying the access token. 474 Additionally, implicit clients can be subject to a further kind of 475 attack. It utilizes the fact that user agents re-attach fragments to 476 the destination URL of a redirect if the location header does not 477 contain a fragment (see [RFC7231], Section 9.5). The attack 478 described here combines this behavior with the client as an open 479 redirector in order to get access to access tokens. This allows 480 circumvention even of very narrow redirect URI patterns (but not 481 strict URL matching!). 483 Assume the pattern for client "s6BhdRkqt3" is 484 "https://client.somesite.example/cb?*", i.e., any parameter is 485 allowed for redirects to "https://client.somesite.example/cb". 486 Unfortunately, the client exposes an open redirector. This endpoint 487 supports a parameter "redirect_to" which takes a target URL and will 488 send the browser to this URL using an HTTP Location header redirect 489 303. 491 The attack can now be conducted as follows: 493 First, and as above, the attacker needs to trick the user into 494 opening a tampered URL in his browser, which launches a page under 495 the attacker's control, say "https://www.evil.example". 497 Afterwards, the website initiates an authorization request, which is 498 very similar to the one in the attack on the code flow. Different to 499 above, it utilizes the open redirector by encoding 500 "redirect_to=https://client.evil.example" into the redirect URI and 501 it uses the response type "token" (line breaks are for display 502 purposes only): 504 GET /authorize?response_type=token&state=9ad67f13 505 &client_id=s6BhdRkqt3 506 &redirect_uri=https%3A%2F%2Fclient.somesite.example 507 %2Fcb%26redirect_to%253Dhttps%253A%252F 508 %252Fclient.evil.example%252Fcb HTTP/1.1 509 Host: server.somesite.example 511 Now, since the redirect URI matches the registered pattern, the 512 authorization server allows the request and sends the resulting 513 access token with a 303 redirect (some response parameters are 514 omitted for better readability) 516 HTTP/1.1 303 See Other 517 Location: https://client.somesite.example/cb? 518 redirect_to%3Dhttps%3A%2F%2Fclient.evil.example%2Fcb 519 #access_token=2YotnFZFEjr1zCsicMWpAA&... 521 At example.com, the request arrives at the open redirector. It will 522 read the redirect parameter and will issue an HTTP 303 Location 523 header redirect to the URL "https://client.evil.example/cb". 525 HTTP/1.1 303 See Other 526 Location: https://client.evil.example/cb 527 Since the redirector at client.somesite.example does not include a 528 fragment in the Location header, the user agent will re-attach the 529 original fragment "#access_token=2YotnFZFEjr1zCsicMWpAA&..." to 530 the URL and will navigate to the following URL: 532 https://client.evil.example/cb#access_token=2YotnFZFEjr1z... 534 The attacker's page at "client.evil.example" can now access the 535 fragment and obtain the access token. 537 4.1.3. Proposed Countermeasures 539 The complexity of implementing and managing pattern matching 540 correctly obviously causes security issues. This document therefore 541 proposes to simplify the required logic and configuration by using 542 exact redirect URI matching only. This means the authorization 543 server must compare the two URIs using simple string comparison as 544 defined in [RFC3986], Section 6.2.1. 546 Additional recommendations: 548 o Servers on which callbacks are hosted must not expose open 549 redirectors (see Section 4.9). 551 o Clients MAY drop fragments via intermediary URLs with "fix 552 fragments" (see [fb_fragments]) to prevent the user agent from 553 appending any unintended fragments. 555 o Clients SHOULD use the authorization code response type instead of 556 response types causing access token issuance at the authorization 557 endpoint. This offers countermeasures against reuse of leaked 558 credentials through the exchange process with the authorization 559 server and token replay through certificate binding of the access 560 tokens. 562 As an alternative to exact redirect URI matching, the AS could also 563 authenticate clients, e.g., using [I-D.ietf-oauth-jwsreq]. 565 4.2. Credential Leakage via Referrer Headers 567 Authorization codes or values of "state" can unintentionally be 568 disclosed to attackers through the referrer header, by leaking either 569 from a client's web site or from an AS's web site. Note: even if 570 specified otherwise in [RFC7231], Section 5.5.2, the same may happen 571 to access tokens conveyed in URI fragments due to browser 572 implementation issues as illustrated by Chromium Issue 168213 573 [bug.chromium]. 575 4.2.1. Leakage from the OAuth Client 577 Leakage from the OAuth client requires that the client, as a result 578 of a successful authorization request, renders a page that 580 o contains links to other pages under the attacker's control (ads, 581 faq, ...) and a user clicks on such a link, or 583 o includes third-party content (iframes, images, etc.), for example 584 if the page contains user-generated content (blog). 586 As soon as the browser navigates to the attacker's page or loads the 587 third-party content, the attacker receives the authorization response 588 URL and can extract "code", "access token", or "state". 590 4.2.2. Leakage from the Authorization Server 592 In a similar way, an attacker can learn "state" if the authorization 593 endpoint at the authorization server contains links or third-party 594 content as above. 596 4.2.3. Consequences 598 An attacker that learns a valid code or access token through a 599 referrer header can perform the attacks as described in 600 Section 4.1.1, Section 4.5, and Section 4.6. If the attacker learns 601 "state", the CSRF protection achieved by using "state" is lost, 602 resulting in CSRF attacks as described in [RFC6819], Section 4.4.1.8. 604 4.2.4. Proposed Countermeasures 606 The page rendered as a result of the OAuth authorization response and 607 the authorization endpoint SHOULD NOT include third-party resources 608 or links to external sites. 610 The following measures further reduce the chances of a successful 611 attack: 613 o Bind authorization code to a confidential client or PKCE 614 challenge. In this case, the attacker lacks the secret to request 615 the code exchange. 617 o As described in [RFC6749], Section 4.1.2, authorization codes MUST 618 be invalidated by the AS after their first use at the token 619 endpoint. For example, if an AS invalidated the code after the 620 legitimate client redeemed it, the attacker would fail exchanging 621 this code later. 623 This does not mitigate the attack if the attacker manages to 624 exchange the code for a token before the legitimate client does 625 so. Therefore, [RFC6749] further recommends that, when an attempt 626 is made to redeem a code twice, the AS SHOULD revoke all tokens 627 issued previously based on that code. 629 o The "state" value SHOULD be invalidated by the client after its 630 first use at the redirection endpoint. If this is implemented, 631 and an attacker receives a token through the referrer header from 632 the client's web site, the "state" was already used, invalidated 633 by the client and cannot be used again by the attacker. (This 634 does not help if the "state" leaks from the AS's web site, since 635 then the "state" has not been used at the redirection endpoint at 636 the client yet.) 638 o Suppress the referrer header by adding the attribute 639 "rel="noreferrer"" to HTML links or by applying an appropriate 640 Referrer Policy [webappsec-referrer-policy] to the document 641 (either as part of the "referrer" meta attribute or by setting a 642 Referrer-Policy header). 644 o Use authorization code instead of response types causing access 645 token issuance from the authorization endpoint. This provides 646 countermeasures against leakage on the OAuth protocol level 647 through the code exchange process with the authorization server. 649 o Additionally, one might use the form post response mode instead of 650 redirect for authorization response (see 651 [oauth-v2-form-post-response-mode]). 653 4.3. Attacks through the Browser History 655 Authorization codes and access tokens can end up in the browser's 656 history of visited URLs, enabling the attacks described in the 657 following. 659 4.3.1. Code in Browser History 661 When a browser navigates to "client.example/ 662 redirection_endpoint?code=abcd" as a result of a redirect from a 663 provider's authorization endpoint, the URL including the 664 authorization code may end up in the browser's history. An attacker 665 with access to the device could obtain the code and try to replay it. 667 Proposed countermeasures: 669 o Authorization code replay prevention as described in [RFC6819], 670 Section 4.4.1.1, and Section 4.5 672 o Use form post response mode instead of redirect for authorization 673 response (see [oauth-v2-form-post-response-mode]) 675 4.3.2. Access Token in Browser History 677 An access token may end up in the browser history if a a client or 678 just a web site, which already has a token, deliberately navigates to 679 a page like "provider.com/get_user_profile?access_token=abcdef.". 680 Actually [RFC6750] discourages this practice and asks to transfer 681 tokens via a header, but in practice web sites often just pass access 682 token in query parameters. 684 In case of implicit grant, a URL like "client.example/ 685 redirection_endpoint#access_token=abcdef" may also end up in the 686 browser history as a result of a redirect from a provider's 687 authorization endpoint. 689 Proposed countermeasures: 691 o Replace implicit flow with postmessage communication or the 692 authorization code grant 694 o Never pass access tokens in URL query parameters 696 4.4. Mix-Up 698 Mix-up is an attack on scenarios where an OAuth client interacts with 699 multiple authorization servers, as is usually the case when dynamic 700 registration is used. The goal of the attack is to obtain an 701 authorization code or an access token by tricking the client into 702 sending those credentials to the attacker instead of using them at 703 the respective endpoint at the authorization/resource server. 705 4.4.1. Attack Description 707 For a detailed attack description, refer to [arXiv.1601.01229] and 708 [I-D.ietf-oauth-mix-up-mitigation]. The description here closely 709 follows [arXiv.1601.01229], with variants of the attack outlined 710 below. 712 Preconditions: For the attack to work, we assume that 714 o the implicit or authorization code grant are used with multiple AS 715 of which one is considered "honest" (H-AS) and one is operated by 716 the attacker (A-AS), 718 o the client stores the AS chosen by the user in a session bound to 719 the user's browser and uses the same redirection endpoint URI for 720 each AS, and 722 o the attacker can manipulate the first request/response pair from a 723 user's browser to the client (in which the user selects a certain 724 AS and is then redirected by the client to that AS), as in 725 Attacker A2. 727 Some of the attack variants described below require different 728 preconditions. 730 In the following, we assume that the client is registered with H-AS 731 (URI: "https://honest.as.example", client id: "7ZGZldHQ") and with 732 A-AS (URI: "https://attacker.example", client id: "666RVZJTA"). 734 Attack on the authorization code grant: 736 1. The user selects to start the grant using H-AS (e.g., by clicking 737 on a button at the client's website). 739 2. The attacker intercepts this request and changes the user's 740 selection to "A-AS". 742 3. The client stores in the user's session that the user selected 743 "A-AS" and redirects the user to A-AS's authorization endpoint by 744 sending the response code "303 See Other" with a Location header 745 containing the URL "https://attacker.example/ 746 authorize?response_type=code&client_id=666RVZJTA". 748 4. Now the attacker intercepts this response and changes the 749 redirection such that the user is being redirected to H-AS. The 750 attacker also replaces the client id of the client at A-AS with 751 the client's id at H-AS. Therefore, the browser receives a 752 redirection ("303 See Other") with a Location header pointing to 753 "https://honest.as.example/ 754 authorize?response_type=code&client_id=7ZGZldHQ" 756 5. Now, the user authorizes the client to access her resources at 757 H-AS. H-AS issues a code and sends it (via the browser) back to 758 the client. 760 6. Since the client still assumes that the code was issued by A-AS, 761 it will try to redeem the code at A-AS's token endpoint. 763 7. The attacker therefore obtains code and can either exchange the 764 code for an access token (for public clients) or perform a code 765 injection attack as described in Section 4.5. 767 Variants: 769 o *Implicit Grant*: In the implicit grant, the attacker receives an 770 access token instead of the code; the rest of the attack works as 771 above. 773 o *Mix-Up Without Interception*: A variant of the above attack works 774 even if the first request/response pair cannot be intercepted (for 775 example, because TLS is used to protect these messages): Here, we 776 assume that the user wants to start the grant using A-AS (and not 777 H-AS, see Attacker A1). After the client redirected the user to 778 the authorization endpoint at A-AS, the attacker immediately 779 redirects the user to H-AS (changing the client id to "7ZGZldHQ"). 780 (A vigilant user might at this point detect that she intended to 781 use A-AS instead of H-AS.) The attack now proceeds exactly as in 782 Steps 3ff. of the attack description above. 784 o *Per-AS Redirect URIs*: If clients use different redirect URIs for 785 different ASs, do not store the selected AS in the user's session, 786 and ASs do not check the redirect URIs properly, attackers can 787 mount an attack called "Cross-Social Network Request Forgery". 788 Refer to [oauth_security_jcs_14] for details. 790 o *OpenID Connect*: There are several variants that can be used to 791 attack OpenID Connect. They are described in detail in 792 [arXiv.1704.08539], Appendix A, and [arXiv.1508.04324v2], 793 Section 6 ("Malicious Endpoints Attacks"). 795 4.4.2. Countermeasures 797 In scenarios where an OAuth client interacts with multiple 798 authorization servers, clients MUST prevent mix-up attacks. 800 Potential countermeasures: 802 o Configure authorization servers to return an AS identitifier 803 ("iss") and the "client_id" for which a code or token was issued 804 in the authorization response. This enables clients to compare 805 this data to their own client id and the "iss" identifier of the 806 AS it believed it sent the user agent to. This mitigation is 807 discussed in detail in [I-D.ietf-oauth-mix-up-mitigation]. In 808 OpenID Connect, if an ID token is returned in the authorization 809 response, it carries client id and issuer. It can be used for 810 this mitigation. 812 o As it can be seen in the preconditions of the attacks above, 813 clients can prevent mix-up attack by (1) using AS-specific 814 redirect URIs with exact redirect URI matching, (2) storing, for 815 each authorization request, the intended AS, and (3) comparing the 816 intended AS with the actual redirect URI where the authorization 817 response was received. 819 4.5. Authorization Code Injection 821 In such an attack, the adversary attempts to inject a stolen 822 authorization code into a legitimate client on a device under his 823 control. In the simplest case, the attacker would want to use the 824 code in his own client. But there are situations where this might 825 not be possible or intended. Examples are: 827 o The attacker wants to access certain functions in this particular 828 client. As an example, the attacker wants to impersonate his 829 victim in a certain app or on a certain web site. 831 o The code is bound to a particular confidential client and the 832 attacker is unable to obtain the required client credentials to 833 redeem the code himself. 835 o The authorization or resource servers are limited to certain 836 networks that the attacker is unable to access directly. 838 4.5.1. Attack Description 840 The attack works as follows: 842 1. The attacker obtains an authorization code by performing any of 843 the attacks described above. 845 2. It performs a regular OAuth authorization process with the 846 legitimate client on his device. 848 3. The attacker injects the stolen authorization code in the 849 response of the authorization server to the legitimate client. 851 4. The client sends the code to the authorization server's token 852 endpoint, along with client id, client secret and actual 853 "redirect_uri". 855 5. The authorization server checks the client secret, whether the 856 code was issued to the particular client and whether the actual 857 redirect URI matches the "redirect_uri" parameter (see 858 [RFC6749]). 860 6. If all checks succeed, the authorization server issues access and 861 other tokens to the client, so now the attacker is able to 862 impersonate the legitimate user. 864 4.5.2. Discussion 866 Obviously, the check in step (5.) will fail if the code was issued to 867 another client id, e.g., a client set up by the attacker. The check 868 will also fail if the authorization code was already redeemed by the 869 legitimate user and was one-time use only. 871 An attempt to inject a code obtained via a malware pretending to be 872 the legitimate client should also be detected, if the authorization 873 server stored the complete redirect URI used in the authorization 874 request and compares it with the redirect_uri parameter. 876 [RFC6749], Section 4.1.3, requires the AS to "... ensure that the 877 "redirect_uri" parameter is present if the "redirect_uri" parameter 878 was included in the initial authorization request as described in 879 Section 4.1.1, and if included ensure that their values are 880 identical.". In the attack scenario described above, the legitimate 881 client would use the correct redirect URI it always uses for 882 authorization requests. But this URI would not match the tampered 883 redirect URI used by the attacker (otherwise, the redirect would not 884 land at the attackers page). So the authorization server would 885 detect the attack and refuse to exchange the code. 887 Note: this check could also detect attempts to inject a code which 888 had been obtained from another instance of the same client on another 889 device, if certain conditions are fulfilled: 891 o the redirect URI itself needs to contain a nonce or another kind 892 of one-time use, secret data and 894 o the client has bound this data to this particular instance. 896 But this approach conflicts with the idea to enforce exact redirect 897 URI matching at the authorization endpoint. Moreover, it has been 898 observed that providers very often ignore the "redirect_uri" check 899 requirement at this stage, maybe because it doesn't seem to be 900 security-critical from reading the specification. 902 Other providers just pattern match the "redirect_uri" parameter 903 against the registered redirect URI pattern. This saves the 904 authorization server from storing the link between the actual 905 redirect URI and the respective authorization code for every 906 transaction. But this kind of check obviously does not fulfill the 907 intent of the spec, since the tampered redirect URI is not 908 considered. So any attempt to inject a code obtained using the 909 "client_id" of a legitimate client or by utilizing the legitimate 910 client on another device won't be detected in the respective 911 deployments. 913 It is also assumed that the requirements defined in [RFC6749], 914 Section 4.1.3, increase client implementation complexity as clients 915 need to memorize or re-construct the correct redirect URI for the 916 call to the tokens endpoint. 918 This document therefore recommends to instead bind every 919 authorization code to a certain client instance on a certain device 920 (or in a certain user agent) in the context of a certain transaction. 922 4.5.3. Proposed Countermeasures 924 There are multiple technical solutions to achieve this goal: 926 o *Nonce*: OpenID Connect's existing "nonce" parameter can be used 927 for the purpose of detecting authorization code injection attacks. 928 The "nonce" value is one-time use and created by the client. The 929 client is supposed to bind it to the user agent session and sends 930 it with the initial request to the OpenId Provider (OP). The OP 931 binds "nonce" to the authorization code and attests this binding 932 in the ID token, which is issued as part of the code exchange at 933 the token endpoint. If an attacker injected an authorization code 934 in the authorization response, the nonce value in the client 935 session and the nonce value in the ID token will not match and the 936 attack is detected. The assumption is that an attacker cannot get 937 hold of the user agent state on the victim's device, where he has 938 stolen the respective authorization code. The main advantage of 939 this option is that "nonce" is an existing feature used in the 940 wild. On the other hand, leveraging "nonce" by the broader OAuth 941 community would require AS and clients to adopt ID Tokens. 943 o *Code-bound State*: The "state" parameter as specified in 944 [RFC6749] could be used similarly to what is described above. 945 This would require to add a further parameter "state" to the code 946 exchange token endpoint request. The authorization server would 947 then compare the "state" value it associated with the code and the 948 "state" value in the parameter. If those values do not match, it 949 is considered an attack and the request fails. The advantage of 950 this approach would be to utilize an existing OAuth parameter. 951 But it would also mean to re-interpret the purpose of "state" and 952 to extend the token endpoint request. 954 o *PKCE*: The PKCE parameter "code_challenge" along with the 955 corresponding "code_verifier" as specified in [RFC7636] could be 956 used in the same way as "nonce" or "state". In contrast to its 957 original intention, the verifier check would fail although the 958 client uses its correct verifier but the code is associated with a 959 challenge, which does not match. PKCE is a deployed OAuth 960 feature, even though it is used today to secure native apps only. 962 o *Token Binding*: Token binding [I-D.ietf-oauth-token-binding] 963 could also be used. In this case, the code would need to be bound 964 to two legs, between user agent and AS and the user agent and the 965 client. This requires further data (extension to response) to 966 manifest binding id for particular code. Token binding is 967 promising as a secure and convenient mechanism (due to its browser 968 integration). As a challenge, it requires broad browser support 969 and use with native apps is still under discussion. 971 o *Per-instance client id/secret*: One could use per instance 972 "client_id" and secrets and bind the code to the respective 973 "client_id". Unfortunately, this does not fit into the web 974 application programming model (would need to use per-user client 975 IDs). 977 PKCE seems to be the most obvious solution for OAuth clients as it 978 available and effectively used today for similar purposes for OAuth 979 native apps whereas "nonce" is appropriate for OpenId Connect 980 clients. 982 Note on pre-warmed secrets: An attacker can circumvent the 983 countermeasures described above if he is able to create or capture 984 the respective secret or code_challenge on a device under his 985 control, which is then used in the victim's authorization request. 987 Exact redirect URI matching of authorization requests can prevent the 988 attacker from using the pre-warmed secret in the faked authorization 989 transaction on the victim's device. 991 Unfortunately, it does not work for all kinds of OAuth clients. It 992 is effective for web and JS apps and for native apps with claimed 993 URLs. Attacks on native apps using custom schemes or redirect URIs 994 on localhost cannot be prevented this way, except if the AS enforces 995 one-time use for PKCE verifier or "nonce" values. 997 4.6. Access Token Injection 999 In such an attack, the adversary attempts to inject a stolen access 1000 token into a legitimate client on a device under his control. This 1001 will typically happen if the attacker wants to utilize a leaked 1002 access token to impersonate a user in a certain client. 1004 To conduct the attack, the adversary starts an OAuth flow with the 1005 client and modifies the authorization response by replacing the 1006 access token issued by the authorization server or directly makes up 1007 an authorization server response including the leaked access token. 1008 Since the response includes the state value generated by the client 1009 for this particular transaction, the client does not treat the 1010 response as a CSRF and will use the access token injected by the 1011 attacker. 1013 4.6.1. Proposed Countermeasures 1015 There is no way to detect such an injection attack on the OAuth 1016 protocol level, since the token is issued without any binding to the 1017 transaction or the particular user agent. 1019 The recommendation is therefore to use the authorization code grant 1020 type instead of relying on response types issuing acess tokens at the 1021 authorization endpoint. Code injection can be detected using one of 1022 the countermeasures discussed in Section 4.5. 1024 4.7. Cross Site Request Forgery 1026 An attacker might attempt to inject a request to the redirect URI of 1027 the legitimate client on the victim's device, e.g., to cause the 1028 client to access resources under the attacker's control. 1030 4.7.1. Proposed Countermeasures 1032 Standard CSRF defenses should be used to protect the redirection 1033 endpoint, for example: 1035 o *CSRF Tokens*: Use of CSRF tokens which are bound to the user 1036 agent and passed in the "state" parameter to the authorization 1037 server. 1039 o *Origin Header*: The Origin header can be used to detect and 1040 prevent CSRF attacks. Since this feature, at the time of writing, 1041 is not consistently supported by all browsers, CSRF tokens should 1042 be used in addition to Origin header checking. 1044 For more details see [owasp_csrf]. 1046 4.8. Access Token Leakage at the Resource Server 1048 Access tokens can leak from a resource server under certain 1049 circumstances. 1051 4.8.1. Access Token Phishing by Counterfeit Resource Server 1053 An attacker may setup his own resource server and trick a client into 1054 sending access tokens to it that are valid for other resource servers 1055 (see Attackers A1 and A5). If the client sends a valid access token 1056 to this counterfeit resource server, the attacker in turn may use 1057 that token to access other services on behalf of the resource owner. 1059 This attack assumes the client is not bound to one specific resource 1060 server (and its URL) at development time, but client instances are 1061 provided with the resource server URL at runtime. This kind of late 1062 binding is typical in situations where the client uses a service 1063 implementing a standardized API (e.g., for e-Mail, calendar, health, 1064 or banking) and where the client is configured by a user or 1065 administrator for a service which this user or company uses. 1067 There are several potential mitigation strategies, which will be 1068 discussed in the following sections. 1070 4.8.1.1. Metadata 1072 An authorization server could provide the client with additional 1073 information about the location where it is safe to use its access 1074 tokens. 1076 In the simplest form, this would require the AS to publish a list of 1077 its known resource servers, illustrated in the following example 1078 using a metadata parameter "resource_servers": 1080 HTTP/1.1 200 OK 1081 Content-Type: application/json 1083 { 1084 "issuer":"https://server.somesite.example", 1085 "authorization_endpoint": 1086 "https://server.somesite.example/authorize", 1087 "resource_servers":[ 1088 "email.somesite.example", 1089 "storage.somesite.example", 1090 "video.somesite.example" 1091 ] 1092 ... 1093 } 1095 The AS could also return the URL(s) an access token is good for in 1096 the token response, illustrated by the example return parameter 1097 "access_token_resource_server": 1099 HTTP/1.1 200 OK 1100 Content-Type: application/json;charset=UTF-8 1101 Cache-Control: no-store 1102 Pragma: no-cache 1104 { 1105 "access_token":"2YotnFZFEjr1zCsicMWpAA", 1106 "access_token_resource_server": 1107 "https://hostedresource.somesite.example/path1", 1108 ... 1109 } 1111 This mitigation strategy would rely on the client to enforce the 1112 security policy and to only send access tokens to legitimate 1113 destinations. Results of OAuth related security research (see for 1114 example [oauth_security_ubc] and [oauth_security_cmu]) indicate a 1115 large portion of client implementations do not or fail to properly 1116 implement security controls, like "state" checks. So relying on 1117 clients to prevent access token phishing is likely to fail as well. 1118 Moreover given the ratio of clients to authorization and resource 1119 servers, it is considered the more viable approach to move as much as 1120 possible security-related logic to those entities. Clearly, the 1121 client has to contribute to the overall security. But there are 1122 alternative countermeasures, as described in the next sections, which 1123 provide a better balance between the involved parties. 1125 4.8.1.2. Sender-Constrained Access Tokens 1127 As the name suggests, sender-constrained access token scope the 1128 applicability of an access token to a certain sender. This sender is 1129 obliged to demonstrate knowledge of a certain secret as prerequisite 1130 for the acceptance of that token at a resource server. 1132 A typical flow looks like this: 1134 1. The authorization server associates data with the access token 1135 which binds this particular token to a certain client. The 1136 binding can utilize the client identity, but in most cases the AS 1137 utilizes key material (or data derived from the key material) 1138 known to the client. 1140 2. This key material must be distributed somehow. Either the key 1141 material already exists before the AS creates the binding or the 1142 AS creates ephemeral keys. The way pre-existing key material is 1143 distributed varies among the different approaches. For example, 1144 X.509 Certificates can be used in which case the distribution 1145 happens explicitly during the enrollment process. Or the key 1146 material is created and distributed at the TLS layer, in which 1147 case it might automatically happens during the setup of a TLS 1148 connection. 1150 3. The RS must implement the actual proof of possession check. This 1151 is typically done on the application level, it may utilize 1152 capabilities of the transport layer (e.g., TLS). Note: replay 1153 prevention is required as well! 1155 There exists several proposals to demonstrate the proof of possession 1156 in the scope of the OAuth working group: 1158 o *OAuth Token Binding* ([I-D.ietf-oauth-token-binding]): In this 1159 approach, an access token is, via the so-called token binding id, 1160 bound to key material representing a long term association between 1161 a client and a certain TLS host. Negotiation of the key material 1162 and proof of possession in the context of a TLS handshake is taken 1163 care of by the TLS stack. The client needs to determine the token 1164 binding id of the target resource server and pass this data to the 1165 access token request. The authorization server than associates 1166 the access token with this id. The resource server checks on 1167 every invocation that the token binding id of the active TLS 1168 connection and the token binding id of associated with the access 1169 token match. Since all crypto-related functions are covered by 1170 the TLS stack, this approach is very client developer friendly. 1171 As a prerequisite, token binding as described in [RFC8473] 1172 (including federated token bindings) must be supported on all ends 1173 (client, authorization server, resource server). 1175 o *OAuth Mutual TLS* ([I-D.ietf-oauth-mtls]): The approach as 1176 specified in this document allows the use of mutual TLS (mTLS) for 1177 both client authentication and sender-constrained access tokens. 1178 For the purpose of sender-constrained access tokens, the client is 1179 identified towards the resource server by the fingerprint of its 1180 public key. During processing of an access token request, the 1181 authorization server obtains the client's public key from the TLS 1182 stack and associates its fingerprint with the respective access 1183 tokens. The resource server in the same way obtains the public 1184 key from the TLS stack and compares its fingerprint with the 1185 fingerprint associated with the access token. 1187 o *Signed HTTP Requests* ([I-D.ietf-oauth-signed-http-request]): 1188 This approach utilizes [I-D.ietf-oauth-pop-key-distribution] and 1189 represents the elements of the signature in a JSON object. The 1190 signature is built using JWS. The mechanism has built-in support 1191 for signing of HTTP method, query parameters and headers. It also 1192 incorporates a timestamp as basis for replay prevention. 1194 o *JWT Pop Tokens* ([I-D.sakimura-oauth-jpop]): This draft describes 1195 different ways to constrain access token usage, namely TLS or 1196 request signing. Note: Since the authors of this draft 1197 contributed the TLS-related proposal to [I-D.ietf-oauth-mtls], 1198 this document only considers the request signing part. For 1199 request signing, the draft utilizes 1200 [I-D.ietf-oauth-pop-key-distribution] and [RFC7800]. The 1201 signature data is represented in a JWT and JWS is used for 1202 signing. Replay prevention is provided by building the signature 1203 over a server-provided nonce, client-provided nonce and a nonce 1204 counter. 1206 Mutual TLS and OAuth Token Binding are built on top of TLS and this 1207 way continue the successful OAuth 2.0 philosophy to leverage TLS to 1208 secure OAuth wherever possible. Both mechanisms allow prevention of 1209 access token leakage in a fairly client developer friendly way. 1211 There are some differences between both approaches: To start with, 1212 for OAuth Token Binding, all key material is automatically managed by 1213 the TLS stack whereas mTLS requires the developer to create and 1214 maintain the key pairs and respective certificates. Use of self- 1215 signed certificates, which is supported by the draft, significantly 1216 reduces the complexity of this task. Furthermore, OAuth Token 1217 Binding allows to use different key pairs for different resource 1218 servers, which is a privacy benefit. On the other hand, 1219 [I-D.ietf-oauth-mtls] only requires widely deployed TLS features, 1220 which means it might be easier to adopt in the short term. 1222 Application level signing approaches, like 1223 [I-D.ietf-oauth-signed-http-request] and [I-D.sakimura-oauth-jpop] 1224 have been debated for a long time in the OAuth working group without 1225 a clear outcome. 1227 As one advantage, application-level signing allows for end-to-end 1228 protection including non-repudiation even if the TLS connection is 1229 terminated between client and resource server. But deployment 1230 experiences have revealed challenges regarding robustness (e.g., 1231 reproduction of the signature base string including correct URL) as 1232 well as state management (e.g., replay prevention). 1234 This document therefore recommends implementors to consider one of 1235 TLS-based approaches wherever possible. 1237 4.8.1.3. Audience Restricted Access Tokens 1239 An audience restriction essentially restricts the resource server a 1240 particular access token can be used at. The authorization server 1241 associates the access token with a certain resource server and every 1242 resource server is obliged to verify for every request, whether the 1243 access token sent with that request was meant to be used at the 1244 particular resource server. If not, the resource server must refuse 1245 to serve the respective request. In the general case, audience 1246 restrictions limit the impact of a token leakage. In the case of a 1247 counterfeit resource server, it may (as described see below) also 1248 prevent abuse of the phished access token at the legitimate resource 1249 server. 1251 The audience can basically be expressed using logical names or 1252 physical addresses (like URLs). In order to prevent phishing, it is 1253 necessary to use the actual URL the client will send requests to. In 1254 the phishing case, this URL will point to the counterfeit resource 1255 server. If the attacker tries to use the access token at the 1256 legitimate resource server (which has a different URL), the resource 1257 server will detect the mismatch (wrong audience) and refuse to serve 1258 the request. 1260 In deployments where the authorization server knows the URLs of all 1261 resource servers, the authorization server may just refuse to issue 1262 access tokens for unknown resource server URLs. 1264 The client needs to tell the authorization server, at which URL it 1265 will use the access token it is requesting. It could use the 1266 mechanism proposed [I-D.ietf-oauth-resource-indicators] or encode the 1267 information in the scope value. 1269 Instead of the URL, it is also possible to utilize the fingerprint of 1270 the resource server's X.509 certificate as audience value. This 1271 variant would also allow to detect an attempt to spoof the legit 1272 resource server's URL by using a valid TLS certificate obtained from 1273 a different CA. It might also be considered a privacy benefit to 1274 hide the resource server URL from the authorization server. 1276 Audience restriction seems easy to use since it does not require any 1277 crypto on the client side. But since every access token is bound to 1278 a certain resource server, the client also needs to obtain different 1279 RS-specific access tokens, if it wants to access several resource 1280 services. [I-D.ietf-oauth-token-binding] has the same property, 1281 since different token binding ids must be associated with the access 1282 token. [I-D.ietf-oauth-mtls] on the other hand allows a client to 1283 use the access token at multiple resource servers. 1285 It shall be noted that audience restrictions, or generally speaking 1286 an indication by the client to the authorization server where it 1287 wants to use the access token, has additional benefits beyond the 1288 scope of token leakage prevention. It allows the authorization 1289 server to create different access token whose format and content is 1290 specifically minted for the respective server. This has huge 1291 functional and privacy advantages in deployments using structured 1292 access tokens. 1294 4.8.2. Compromised Resource Server 1296 An attacker may compromise a resource server in order to get access 1297 to its resources and other resources of the respective deployment. 1298 Such a compromise may range from partial access to the system, e.g., 1299 its logfiles, to full control of the respective server. 1301 If the attacker was able to take over full control including shell 1302 access it will be able to circumvent all controls in place and access 1303 resources without access control. It will also get access to access 1304 tokens, which are sent to the compromised system and which 1305 potentially are valid for access to other resource servers as well. 1306 Even if the attacker "only" is able to access logfiles or databases 1307 of the server system, it may get access to valid access tokens. 1309 Preventing server breaches by way of hardening and monitoring server 1310 systems is considered a standard operational procedure and therefore 1311 out of scope of this document. This section will focus on the impact 1312 of such breaches on OAuth-related parts of the ecosystem, which is 1313 the replay of captured access tokens on the compromised resource 1314 server and other resource servers of the respective deployment. 1316 The following measures should be taken into account by implementors 1317 in order to cope with access token replay: 1319 o The resource server must treat access tokens like any other 1320 credentials. It is considered good practice to not log them and 1321 not to store them in plain text. 1323 o Sender-constrained access tokens as described in Section 4.8.1.2 1324 will prevent the attacker from replaying the access tokens on 1325 other resource servers. Depending on the severity of the 1326 penetration, it will also prevent replay on the compromised 1327 system. 1329 o Audience restriction as described in Section 4.8.1.3 may be used 1330 to prevent replay of captured access tokens on other resource 1331 servers. 1333 4.9. Open Redirection 1335 The following attacks can occur when an AS or client has an open 1336 redirector, i.e., a URL which causes an HTTP redirect to an attacker- 1337 controlled web site. 1339 4.9.1. Authorization Server as Open Redirector 1341 Attackers could try to utilize a user's trust in the authorization 1342 server (and its URL in particular) for performing phishing attacks. 1344 [RFC6749], Section 4.1.2.1, already prevents open redirects by 1345 stating the AS MUST NOT automatically redirect the user agent in case 1346 of an invalid combination of client_id and redirect_uri. 1348 However, as described in [I-D.ietf-oauth-closing-redirectors], an 1349 attacker could also utilize a correctly registered redirect URI to 1350 perform phishing attacks. It could for example register a client via 1351 dynamic client registration [RFC7591] and intentionally send an 1352 erroneous authorization request, e.g., by using an invalid scope 1353 value, to cause the AS to automatically redirect the user agent to 1354 its phishing site. 1356 The AS MUST take precautions to prevent this threat. Based on its 1357 risk assessment the AS needs to decide whether it can trust the 1358 redirect URI or not and SHOULD only automatically redirect the user 1359 agent, if it trusts the redirect URI. If not, it MAY inform the user 1360 that it is about to redirect her to the another site and rely on the 1361 user to decide or MAY just inform the user about the error. 1363 4.9.2. Clients as Open Redirector 1365 Client MUST NOT expose URLs which could be utilized as open 1366 redirector. Attackers may use an open redirector to produce URLs 1367 which appear to point to the client, which might trick users to trust 1368 the URL and follow it in her browser. Another abuse case is to 1369 produce URLs pointing to the client and utilize them to impersonate a 1370 client with an authorization server. 1372 In order to prevent open redirection, clients should only expose such 1373 a function, if the target URLs are whitelisted or if the origin of a 1374 request can be authenticated. 1376 4.10. 307 Redirect 1378 At the authorization endpoint, a typical protocol flow is that the AS 1379 prompts the user to enter her credentials in a form that is then 1380 submitted (using the HTTP POST method) back to the authorization 1381 server. The AS checks the credentials and, if successful, redirects 1382 the user agent to the client's redirection endpoint. 1384 In [RFC6749], the HTTP status code 302 is used for this purpose, but 1385 "any other method available via the user-agent to accomplish this 1386 redirection is allowed". However, when the status code 307 is used 1387 for redirection, the user agent will send the form data (user 1388 credentials) via HTTP POST to the client since this status code does 1389 not require the user agent to rewrite the POST request to a GET 1390 request (and thereby dropping the form data in the POST request 1391 body). If the relying party is malicious, it can use the credentials 1392 to impersonate the user at the AS. 1394 In the HTTP standard [RFC6749], only the status code 303 1395 unambigiously enforces rewriting the HTTP POST request to an HTTP GET 1396 request. For all other status codes, including the popular 302, user 1397 agents can opt not to rewrite POST to GET requests and therefore to 1398 reveal the user credentials to the client. (In practice, however, 1399 most user agents will only show this behaviour for 307 redirects.) 1401 AS which redirect a request that potentially contains user 1402 credentials therefore MUST NOT use the HTTP 307 status code for 1403 redirection. If an HTTP redirection (and not, for example, 1404 JavaScript) is used for such a request, AS SHOULD use HTTP status 1405 code 303 "See Other". 1407 4.11. TLS Terminating Reverse Proxies 1409 A common deployment architecture for HTTP applications is to have the 1410 application server sitting behind a reverse proxy, which terminates 1411 the TLS connection and dispatches the incoming requests to the 1412 respective application server nodes. 1414 This section highlights some attack angles of this deployment 1415 architecture, which are relevant to OAuth, and give recommendations 1416 for security controls. 1418 In some situations, the reverse proxy needs to pass security-related 1419 data to the upstream application servers for further processing. 1420 Examples include the IP address of the request originator, token 1421 binding ids and authenticated TLS client certificates. 1423 If the reverse proxy would pass through any header sent from the 1424 outside, an attacker could try to directly send the faked header 1425 values through the proxy to the application server in order to 1426 circumvent security controls that way. For example, it is standard 1427 practice of reverse proxies to accept "forwarded_for" headers and 1428 just add the origin of the inbound request (making it a list). 1429 Depending on the logic performed in the application server, the 1430 attacker could simply add a whitelisted IP address to the header and 1431 render a IP whitelist useless. A reverse proxy must therefore 1432 sanitize any inbound requests to ensure the authenticity and 1433 integrity of all header values relevant for the security of the 1434 application servers. 1436 If an attacker would be able to get access to the internal network 1437 between proxy and application server, it could also try to circumvent 1438 security controls in place. It is therefore important to ensure the 1439 authenticity of the communicating entities. Furthermore, the 1440 communication link between reverse proxy and application server must 1441 therefore be protected against tapping and injection (including 1442 replay prevention). 1444 4.12. Refresh Token Protection 1446 Refresh tokens are a convenient and UX-friendly way to obtain new 1447 access tokens after the expiration of older access tokens. Refresh 1448 tokens also add to the security of OAuth since they allow the 1449 authorization server to issue access tokens with a short lifetime and 1450 reduced scope thus reducing the potential impact of access token 1451 leakage. 1453 Refresh tokens are an attractive target for attackers since they 1454 represent the overall grant a resource owner delegated to a certain 1455 client. If an attacker is able to exfiltrate and successfully replay 1456 a refresh token, the attacker will be able to mint access tokens and 1457 use them to access resource servers on behalf of the resource owner. 1459 [RFC6749] already provides a robust baseline protection by requiring 1461 o confidentiality of the refresh tokens in transit and storage, 1463 o the transmission of refresh tokens over TLS-protected connections 1464 between authorization server and client, 1466 o the authorization server to maintain and check the binding of a 1467 refresh token to a certain client (i.e., "client_id"), 1469 o authentication of this client during token refresh, if possible, 1470 and 1472 o that refresh tokens cannot be generated, modified, or guessed. 1474 [RFC6749] also lays the foundation for further (implementation 1475 specific) security measures, such as refresh token expiration and 1476 revocation as well as refresh token rotation by defining respective 1477 error codes and response behavior. 1479 This draft gives recommendations beyond the scope of [RFC6749] and 1480 clarifications. 1482 Authorization servers MUST determine based on their risk assessment 1483 whether to issue refresh tokens to a certain client. If the 1484 authorization server decides not to issue refresh tokens, the client 1485 may refresh access tokens by utilizing other grant types, such as the 1486 authorization code grant type. In such a case, the authorization 1487 server may utilize cookies and persistent grants to optimize the user 1488 experience. 1490 If refresh tokens are issued, those refresh tokens MUST be bound to 1491 the scope and resource servers as consented by the resource owner. 1492 This is to prevent privilege escalation by the legit client and 1493 reduce the impact of refresh token leakage. 1495 Authorization server MUST utilize one of these methods to detect 1496 refresh token replay for public clients: 1498 o *Sender-constrained refresh tokens:* the authorization server 1499 cryptographically binds the refresh token to a certain client 1500 instance by utilizing [I-D.ietf-oauth-token-binding] or 1501 [I-D.ietf-oauth-mtls]. 1503 o *Refresh token rotation:* the authorization server issues a new 1504 refresh token with every access token refresh response. The 1505 previous refresh token is invalidated but information about the 1506 relationship is retained by the authorization server. If a 1507 refresh token is compromised and subsequently used by both the 1508 attacker and the legitimate client, one of them will present an 1509 invalidated refresh token, which will inform the authorization 1510 server of the breach. The authorization server cannot determine 1511 which party submitted the invalid refresh token, but it can revoke 1512 the active refresh token. This stops the attack at the cost of 1513 forcing the legit client to obtain a fresh authorization grant. 1514 Implementation note: refresh tokens belonging to the same grant 1515 may share a common id. If any of those refresh tokens is used at 1516 the authorization server, the authorization server uses this 1517 common id to look up the currently active refresh token and can 1518 revoke it. 1520 Authorization servers may revoke refresh tokens automatically in case 1521 of a security event, such as: 1523 o password change 1525 o logout at the authorization server 1527 Refresh tokens SHOULD expire if the client has been inactive for some 1528 time, i.e., the refresh token has not been used to obtain fresh 1529 access tokens for some time. The expiration time is at the 1530 discretion of the authorization server. It might be a global value 1531 or determined based on the client policy or the grant associated with 1532 the refresh token (and its sensitivity). 1534 5. Acknowledgements 1536 We would like to thank Jim Manico, Phil Hunt, Nat Sakimura, Christian 1537 Mainka, Doug McDorman, Johan Peeters, Joseph Heenan, Brock Allen, 1538 Vittorio Bertocci, David Waite, Nov Matake, Tomek Stojecki, Dominick 1539 Baier, Neil Madden, William Dennis, Dick Hardt, Petteri Stenius, 1540 Annabelle Richard Backman, Aaron Parecki, George Fletscher, and Brian 1541 Campbell for their valuable feedback. 1543 6. IANA Considerations 1545 This draft includes no request to IANA. 1547 7. Security Considerations 1549 All relevant security considerations have been given in the 1550 functional specification. 1552 8. References 1554 8.1. Normative References 1556 [oauth-v2-form-post-response-mode] 1557 Jones, M. and B. Campbell, "OAuth 2.0 Form Post Response 1558 Mode", April 2015, . 1561 [OpenID] Sakimura, N., Bradley, J., Jones, M., de Medeiros, B., and 1562 C. Mortimore, "OpenID Connect Core 1.0 incorporating 1563 errata set 1", Nov 2014, 1564 . 1566 [RFC3986] Berners-Lee, T., Fielding, R., and L. Masinter, "Uniform 1567 Resource Identifier (URI): Generic Syntax", STD 66, 1568 RFC 3986, DOI 10.17487/RFC3986, January 2005, 1569 . 1571 [RFC6749] Hardt, D., Ed., "The OAuth 2.0 Authorization Framework", 1572 RFC 6749, DOI 10.17487/RFC6749, October 2012, 1573 . 1575 [RFC6750] Jones, M. and D. Hardt, "The OAuth 2.0 Authorization 1576 Framework: Bearer Token Usage", RFC 6750, 1577 DOI 10.17487/RFC6750, October 2012, 1578 . 1580 [RFC6819] Lodderstedt, T., Ed., McGloin, M., and P. Hunt, "OAuth 2.0 1581 Threat Model and Security Considerations", RFC 6819, 1582 DOI 10.17487/RFC6819, January 2013, 1583 . 1585 [RFC7636] Sakimura, N., Ed., Bradley, J., and N. Agarwal, "Proof Key 1586 for Code Exchange by OAuth Public Clients", RFC 7636, 1587 DOI 10.17487/RFC7636, September 2015, 1588 . 1590 8.2. Informative References 1592 [arXiv.1508.04324v2] 1593 Mladenov, V., Mainka, C., and J. Schwenk, "On the security 1594 of modern Single Sign-On Protocols: Second-Order 1595 Vulnerabilities in OpenID Connect", January 2016, 1596 . 1598 [arXiv.1601.01229] 1599 Fett, D., Kuesters, R., and G. Schmitz, "A Comprehensive 1600 Formal Security Analysis of OAuth 2.0", January 2016, 1601 . 1603 [arXiv.1704.08539] 1604 Fett, D., Kuesters, R., and G. Schmitz, "The Web SSO 1605 Standard OpenID Connect: In-Depth Formal Security Analysis 1606 and Security Guidelines", April 2017, 1607 . 1609 [bug.chromium] 1610 "Referer header includes URL fragment when opening link 1611 using New Tab", 1612 . 1615 [fb_fragments] 1616 "Facebook Developer Blog", 1617 . 1619 [I-D.bradley-oauth-jwt-encoded-state] 1620 Bradley, J., Lodderstedt, T., and H. Zandbelt, "Encoding 1621 claims in the OAuth 2 state parameter using a JWT", draft- 1622 bradley-oauth-jwt-encoded-state-09 (work in progress), 1623 November 2018. 1625 [I-D.ietf-oauth-closing-redirectors] 1626 Bradley, J., Sanso, A., and H. Tschofenig, "OAuth 2.0 1627 Security: Closing Open Redirectors in OAuth", draft-ietf- 1628 oauth-closing-redirectors-00 (work in progress), February 1629 2016. 1631 [I-D.ietf-oauth-jwsreq] 1632 Sakimura, N. and J. Bradley, "The OAuth 2.0 Authorization 1633 Framework: JWT Secured Authorization Request (JAR)", 1634 draft-ietf-oauth-jwsreq-17 (work in progress), October 1635 2018. 1637 [I-D.ietf-oauth-mix-up-mitigation] 1638 Jones, M., Bradley, J., and N. Sakimura, "OAuth 2.0 Mix-Up 1639 Mitigation", draft-ietf-oauth-mix-up-mitigation-01 (work 1640 in progress), July 2016. 1642 [I-D.ietf-oauth-mtls] 1643 Campbell, B., Bradley, J., Sakimura, N., and T. 1644 Lodderstedt, "OAuth 2.0 Mutual TLS Client Authentication 1645 and Certificate-Bound Access Tokens", draft-ietf-oauth- 1646 mtls-13 (work in progress), February 2019. 1648 [I-D.ietf-oauth-pop-key-distribution] 1649 Bradley, J., Hunt, P., Jones, M., Tschofenig, H., and M. 1650 Mihaly, "OAuth 2.0 Proof-of-Possession: Authorization 1651 Server to Client Key Distribution", draft-ietf-oauth-pop- 1652 key-distribution-04 (work in progress), October 2018. 1654 [I-D.ietf-oauth-resource-indicators] 1655 Campbell, B., Bradley, J., and H. Tschofenig, "Resource 1656 Indicators for OAuth 2.0", draft-ietf-oauth-resource- 1657 indicators-02 (work in progress), January 2019. 1659 [I-D.ietf-oauth-signed-http-request] 1660 Richer, J., Bradley, J., and H. Tschofenig, "A Method for 1661 Signing HTTP Requests for OAuth", draft-ietf-oauth-signed- 1662 http-request-03 (work in progress), August 2016. 1664 [I-D.ietf-oauth-token-binding] 1665 Jones, M., Campbell, B., Bradley, J., and W. Denniss, 1666 "OAuth 2.0 Token Binding", draft-ietf-oauth-token- 1667 binding-08 (work in progress), October 2018. 1669 [I-D.sakimura-oauth-jpop] 1670 Sakimura, N., Li, K., and J. Bradley, "The OAuth 2.0 1671 Authorization Framework: JWT Pop Token Usage", draft- 1672 sakimura-oauth-jpop-04 (work in progress), March 2017. 1674 [oauth_security_cmu] 1675 Chen, E., Pei, Y., Chen, S., Tian, Y., Kotcher, R., and P. 1676 Tague, "OAuth Demystified for Mobile Application 1677 Developers", November 2014. 1679 [oauth_security_jcs_14] 1680 Bansal, C., Bhargavan, K., Delignat-Lavaud, A., and S. 1681 Maffeis, "Discovering concrete attacks on website 1682 authorization by formal analysis", April 2014. 1684 [oauth_security_ubc] 1685 Sun, S. and K. Beznosov, "The Devil is in the 1686 (Implementation) Details: An Empirical Analysis of OAuth 1687 SSO Systems", October 2012, 1688 . 1690 [owasp] "Open Web Application Security Project Home Page", 1691 . 1693 [owasp_csrf] 1694 "Cross-Site Request Forgery (CSRF) Prevention Cheat 1695 Sheet", . 1698 [RFC2119] Bradner, S., "Key words for use in RFCs to Indicate 1699 Requirement Levels", BCP 14, RFC 2119, 1700 DOI 10.17487/RFC2119, March 1997, 1701 . 1703 [RFC7231] Fielding, R., Ed. and J. Reschke, Ed., "Hypertext Transfer 1704 Protocol (HTTP/1.1): Semantics and Content", RFC 7231, 1705 DOI 10.17487/RFC7231, June 2014, 1706 . 1708 [RFC7591] Richer, J., Ed., Jones, M., Bradley, J., Machulak, M., and 1709 P. Hunt, "OAuth 2.0 Dynamic Client Registration Protocol", 1710 RFC 7591, DOI 10.17487/RFC7591, July 2015, 1711 . 1713 [RFC7800] Jones, M., Bradley, J., and H. Tschofenig, "Proof-of- 1714 Possession Key Semantics for JSON Web Tokens (JWTs)", 1715 RFC 7800, DOI 10.17487/RFC7800, April 2016, 1716 . 1718 [RFC8174] Leiba, B., "Ambiguity of Uppercase vs Lowercase in RFC 1719 2119 Key Words", BCP 14, RFC 8174, DOI 10.17487/RFC8174, 1720 May 2017, . 1722 [RFC8414] Jones, M., Sakimura, N., and J. Bradley, "OAuth 2.0 1723 Authorization Server Metadata", RFC 8414, 1724 DOI 10.17487/RFC8414, June 2018, 1725 . 1727 [RFC8473] Popov, A., Nystroem, M., Balfanz, D., Ed., Harper, N., and 1728 J. Hodges, "Token Binding over HTTP", RFC 8473, 1729 DOI 10.17487/RFC8473, October 2018, 1730 . 1732 [webappsec-referrer-policy] 1733 Eisinger, J. and E. Stark, "Referrer Policy", April 2017, 1734 . 1736 Appendix A. Document History 1738 [[ To be removed from the final specification ]] 1740 -12 1742 o Added updated attacker model 1744 -11 1746 o Adapted section 2.1.2 to outcome of consensus call 1748 o more text on refresh token inactivity and implementation note on 1749 refresh token replay detection via refresh token rotation 1751 -10 1753 o incorporated feedback by Joseph Heenan 1755 o changed occurrences of SHALL to MUST 1757 o added text on lack of token/cert binding support tokens issued in 1758 the authorization response as justification to not recommend 1759 issuing tokens there at all 1761 o added requirement to authenticate clients during code exchange 1762 (PKCE or client credential) to 2.1.1. 1764 o added section on refresh tokens 1766 o editorial enhancements to 2.1.2 based on feedback 1768 -09 1769 o changed text to recommend not to use implicit but code 1771 o added section on access token injection 1773 o reworked sections 3.1 through 3.3 to be more specific on implicit 1774 grant issues 1776 -08 1778 o added recommendations re implicit and token injection 1780 o uppercased key words in Section 2 according to RFC 2119 1782 -07 1784 o incorporated findings of Doug McDorman 1786 o added section on HTTP status codes for redirects 1788 o added new section on access token privilege restriction based on 1789 comments from Johan Peeters 1791 -06 1793 o reworked section 3.8.1 1795 o incorporated Phil Hunt's feedback 1797 o reworked section on mix-up 1799 o extended section on code leakage via referrer header to also cover 1800 state leakage 1802 o added Daniel Fett as author 1804 o replaced text intended to inform WG discussion by recommendations 1805 to implementors 1807 o modified example URLs to conform to RFC 2606 1809 -05 1811 o Completed sections on code leakage via referrer header, attacks in 1812 browser, mix-up, and CSRF 1814 o Reworked Code Injection Section 1816 o Added reference to OpenID Connect spec 1817 o removed refresh token leakage as respective considerations have 1818 been given in section 10.4 of RFC 6749 1820 o first version on open redirection 1822 o incorporated Christian Mainka's review feedback 1824 -04 1826 o Restructured document for better readability 1828 o Added best practices on Token Leakage prevention 1830 -03 1832 o Added section on Access Token Leakage at Resource Server 1834 o incorporated Brian Campbell's findings 1836 -02 1838 o Folded Mix up and Access Token leakage through a bad AS into new 1839 section for dynamic OAuth threats 1841 o reworked dynamic OAuth section 1843 -01 1845 o Added references to mitigation methods for token leakage 1847 o Added reference to Token Binding for Authorization Code 1849 o incorporated feedback of Phil Hunt 1851 o fixed numbering issue in attack descriptions in section 2 1853 -00 (WG document) 1855 o turned the ID into a WG document and a BCP 1857 o Added federated app login as topic in Other Topics 1859 Authors' Addresses 1861 Torsten Lodderstedt 1862 yes.com 1864 Email: torsten@lodderstedt.net 1865 John Bradley 1866 Yubico 1868 Email: ve7jtb@ve7jtb.com 1870 Andrey Labunets 1871 Facebook 1873 Email: isciurus@fb.com 1875 Daniel Fett 1876 yes.com 1878 Email: mail@danielfett.de