idnits 2.17.00 (12 Aug 2021) /tmp/idnits19722/draft-ietf-oauth-jwt-bcp-07.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 : ---------------------------------------------------------------------------- == The 'Updates: ' line in the draft header should list only the _numbers_ of the RFCs which will be updated by this document (if approved); it should not include the word 'RFC' in the list. -- The draft header indicates that this document updates RFC7519, but the abstract doesn't seem to mention this, which it should. Miscellaneous warnings: ---------------------------------------------------------------------------- == The copyright year in the IETF Trust and authors Copyright Line does not match the current year -- The document date (October 13, 2019) is 944 days in the past. Is this intentional? 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) ** Downref: Normative reference to an Informational RFC: RFC 6979 ** Downref: Normative reference to an Informational RFC: RFC 8017 -- Obsolete informational reference (is this intentional?): RFC 7159 (Obsoleted by RFC 8259) Summary: 2 errors (**), 0 flaws (~~), 2 warnings (==), 3 comments (--). Run idnits with the --verbose option for more detailed information about the items above. -------------------------------------------------------------------------------- 2 OAuth Working Group Y. Sheffer 3 Internet-Draft Intuit 4 Updates: RFC 7519 (if approved) D. Hardt 5 Intended status: Best Current Practice 6 Expires: April 15, 2020 M. Jones 7 Microsoft 8 October 13, 2019 10 JSON Web Token Best Current Practices 11 draft-ietf-oauth-jwt-bcp-07 13 Abstract 15 JSON Web Tokens, also known as JWTs, are URL-safe JSON-based security 16 tokens that contain a set of claims that can be signed and/or 17 encrypted. JWTs are being widely used and deployed as a simple 18 security token format in numerous protocols and applications, both in 19 the area of digital identity, and in other application areas. The 20 goal of this Best Current Practices document is to provide actionable 21 guidance leading to secure implementation and deployment of JWTs. 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 April 15, 2020. 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. Target Audience . . . . . . . . . . . . . . . . . . . . . 4 59 1.2. Conventions used in this document . . . . . . . . . . . . 4 60 2. Threats and Vulnerabilities . . . . . . . . . . . . . . . . . 4 61 2.1. Weak Signatures and Insufficient Signature Validation . . 4 62 2.2. Weak Symmetric Keys . . . . . . . . . . . . . . . . . . . 5 63 2.3. Incorrect Composition of Encryption and Signature . . . . 5 64 2.4. Plaintext Leakage through Analysis of Ciphertext Length . 5 65 2.5. Insecure Use of Elliptic Curve Encryption . . . . . . . . 5 66 2.6. Multiplicity of JSON Encodings . . . . . . . . . . . . . 6 67 2.7. Substitution Attacks . . . . . . . . . . . . . . . . . . 6 68 2.8. Cross-JWT Confusion . . . . . . . . . . . . . . . . . . . 6 69 2.9. Indirect Attacks on the Server . . . . . . . . . . . . . 6 70 3. Best Practices . . . . . . . . . . . . . . . . . . . . . . . 7 71 3.1. Perform Algorithm Verification . . . . . . . . . . . . . 7 72 3.2. Use Appropriate Algorithms . . . . . . . . . . . . . . . 7 73 3.3. Validate All Cryptographic Operations . . . . . . . . . . 8 74 3.4. Validate Cryptographic Inputs . . . . . . . . . . . . . . 8 75 3.5. Ensure Cryptographic Keys have Sufficient Entropy . . . . 8 76 3.6. Avoid Length-Dependent Encryption Inputs . . . . . . . . 9 77 3.7. Use UTF-8 . . . . . . . . . . . . . . . . . . . . . . . . 9 78 3.8. Validate Issuer and Subject . . . . . . . . . . . . . . . 9 79 3.9. Use and Validate Audience . . . . . . . . . . . . . . . . 9 80 3.10. Do Not Trust Received Claims . . . . . . . . . . . . . . 10 81 3.11. Use Explicit Typing . . . . . . . . . . . . . . . . . . . 10 82 3.12. Use Mutually Exclusive Validation Rules for Different 83 Kinds of JWTs . . . . . . . . . . . . . . . . . . . . . . 11 84 4. Security Considerations . . . . . . . . . . . . . . . . . . . 11 85 5. IANA Considerations . . . . . . . . . . . . . . . . . . . . . 12 86 6. Acknowledgements . . . . . . . . . . . . . . . . . . . . . . 12 87 7. References . . . . . . . . . . . . . . . . . . . . . . . . . 12 88 7.1. Normative References . . . . . . . . . . . . . . . . . . 12 89 7.2. Informative References . . . . . . . . . . . . . . . . . 13 90 Appendix A. Document History . . . . . . . . . . . . . . . . . . 15 91 A.1. draft-ietf-oauth-jwt-bcp-07 . . . . . . . . . . . . . . . 15 92 A.2. draft-ietf-oauth-jwt-bcp-06 . . . . . . . . . . . . . . . 15 93 A.3. draft-ietf-oauth-jwt-bcp-05 . . . . . . . . . . . . . . . 15 94 A.4. draft-ietf-oauth-jwt-bcp-04 . . . . . . . . . . . . . . . 15 95 A.5. draft-ietf-oauth-jwt-bcp-03 . . . . . . . . . . . . . . . 15 96 A.6. draft-ietf-oauth-jwt-bcp-02 . . . . . . . . . . . . . . . 15 97 A.7. draft-ietf-oauth-jwt-bcp-01 . . . . . . . . . . . . . . . 15 98 A.8. draft-ietf-oauth-jwt-bcp-00 . . . . . . . . . . . . . . . 15 99 A.9. draft-sheffer-oauth-jwt-bcp-01 . . . . . . . . . . . . . 15 100 A.10. draft-sheffer-oauth-jwt-bcp-00 . . . . . . . . . . . . . 15 101 Authors' Addresses . . . . . . . . . . . . . . . . . . . . . . . 16 103 1. Introduction 105 JSON Web Tokens, also known as JWTs [RFC7519], are URL-safe JSON- 106 based security tokens that contain a set of claims that can be signed 107 and/or encrypted. The JWT specification has seen rapid adoption 108 because it encapsulates security-relevant information in one easy-to- 109 protect location, and because it is easy to implement using widely- 110 available tools. One application area in which JWTs are commonly 111 used is representing digital identity information, such as OpenID 112 Connect ID Tokens [OpenID.Core] and OAuth 2.0 [RFC6749] access tokens 113 and refresh tokens, the details of which are deployment-specific. 115 Since the JWT specification was published, there have been several 116 widely published attacks on implementations and deployments. Such 117 attacks are the result of under-specified security mechanisms, as 118 well as incomplete implementations and incorrect usage by 119 applications. 121 The goal of this document is to facilitate secure implementation and 122 deployment of JWTs. Many of the recommendations in this document are 123 about implementation and use of the cryptographic mechanisms 124 underlying JWTs that are defined by JSON Web Signature (JWS) 125 [RFC7515], JSON Web Encryption (JWE) [RFC7516], and JSON Web 126 Algorithms (JWA) [RFC7518]. Others are about use of the JWT claims 127 themselves. 129 These are intended to be minimum recommendations for the use of JWTs 130 in the vast majority of implementation and deployment scenarios. 131 Other specifications that reference this document can have stricter 132 requirements related to one or more aspects of the format, based on 133 their particular circumstances; when that is the case, implementers 134 are advised to adhere to those stricter requirements. Furthermore, 135 this document provides a floor, not a ceiling, so stronger options 136 are always allowed (e.g., depending on differing evaluations of the 137 importance of cryptographic strength vs. computational load). 139 Community knowledge about the strength of various algorithms and 140 feasible attacks can change quickly, and experience shows that a Best 141 Current Practice (BCP) document about security is a point-in-time 142 statement. Readers are advised to seek out any errata or updates 143 that apply to this document. 145 1.1. Target Audience 147 The intended audience of this document is: 149 - Implementers of JWT libraries (and the JWS and JWE libraries used 150 by those libraries), 152 - Implementers of code that uses such libraries (to the extent that 153 some mechanisms may not be provided by libraries, or until they 154 are), and 156 - Developers of specifications that rely on JWTs, both inside and 157 outside the IETF. 159 1.2. Conventions used in this document 161 The key words "MUST", "MUST NOT", "REQUIRED", "SHALL", "SHALL NOT", 162 "SHOULD", "SHOULD NOT", "RECOMMENDED", "NOT RECOMMENDED", "MAY", and 163 "OPTIONAL" in this document are to be interpreted as described in 164 BCP 14 [RFC2119] [RFC8174] when, and only when, they appear in all 165 capitals, as shown here. 167 2. Threats and Vulnerabilities 169 This section lists some known and possible problems with JWT 170 implementations and deployments. Each problem description is 171 followed by references to one or more mitigations to those problems. 173 2.1. Weak Signatures and Insufficient Signature Validation 175 Signed JSON Web Tokens carry an explicit indication of the signing 176 algorithm, in the form of the "alg" header parameter, to facilitate 177 cryptographic agility. This, in conjunction with design flaws in 178 some libraries and applications, have led to several attacks: 180 - The algorithm can be changed to "none" by an attacker, and some 181 libraries would trust this value and "validate" the JWT without 182 checking any signature. 184 - An "RS256" (RSA, 2048 bit) parameter value can be changed into 185 "HS256" (HMAC, SHA-256), and some libraries would try to validate 186 the signature using HMAC-SHA256 and using the RSA public key as 187 the HMAC shared secret (see [McLean] and CVE-2015-9235). 189 For mitigations, see Section 3.1 and Section 3.2. 191 2.2. Weak Symmetric Keys 193 In addition, some applications use a keyed MAC algorithm such as 194 "HS256" to sign tokens, but supply a weak symmetric key with 195 insufficient entropy (such as a human memorable password). Such keys 196 are vulnerable to offline brute-force or dictionary attacks once an 197 attacker gets hold of such a token [Langkemper]. 199 For mitigations, see Section 3.5. 201 2.3. Incorrect Composition of Encryption and Signature 203 Some libraries that decrypt a JWE-encrypted JWT to obtain a JWS- 204 signed object do not always validate the internal signature. 206 For mitigations, see Section 3.3. 208 2.4. Plaintext Leakage through Analysis of Ciphertext Length 210 Many encryption algorithms leak information about the length of the 211 plaintext, with a varying amount of leakage depending on the 212 algorithm and mode of operation. This problem is exacerbated when 213 the plaintext is initially compressed, because the length of the 214 compressed plaintext and, thus, the ciphertext depend not only on the 215 length of the original plaintext but also on its content. 216 Compression attacks are particularly powerful when there is attacker- 217 controlled data in the same compression space as secret data, as is 218 the case for some attacks on HTTPS. 220 See [Kelsey] for general background on compression and encryption, 221 and [Alawatugoda] for a specific example of attacks on HTTP cookies. 223 For mitigations, see Section 3.6. 225 2.5. Insecure Use of Elliptic Curve Encryption 227 Per [Sanso], several JOSE libraries fail to validate their inputs 228 correctly when performing elliptic curve key agreement (the "ECDH-ES" 229 algorithm). An attacker that is able to send JWEs of its choosing 230 that use invalid curve points and observe the cleartext outputs 231 resulting from decryption with the invalid curve points can use this 232 vulnerability to recover the recipient's private key. 234 For mitigations, see Section 3.4. 236 2.6. Multiplicity of JSON Encodings 238 Previous versions of the JSON format such as the obsoleted [RFC7159] 239 allowed several different character encodings: UTF-8, UTF-16 and UTF- 240 32. This is not the case anymore, with the latest standard [RFC8259] 241 only allowing UTF-8 except for internal use within a "closed 242 ecosystem". This ambiguity where older implementations and those 243 used within closed environments may generate non-standard encodings, 244 may result in the JWT being misinterpreted by its recipient. This in 245 turn could be used by a malicious sender to bypass the recipient's 246 validation checks. 248 For mitigations, see Section 3.7. 250 2.7. Substitution Attacks 252 There are attacks in which one recipient will be given a JWT that was 253 intended for it, and will attempt to use it at a different recipient 254 for which that JWT was not intended. For instance, if an OAuth 2.0 255 [RFC6749] access token is legitimately presented to an OAuth 2.0 256 protected resource for which it is intended, that protected resource 257 might then present that same access token to a different protected 258 resource for which the access token is not intended, in an attempt to 259 gain access. If such situations are not caught, this can result in 260 the attacker gaining access to resources that it is not entitled to 261 access. 263 For mitigations, see Section 3.8 and Section 3.9. 265 2.8. Cross-JWT Confusion 267 As JWTs are being used by more different protocols in diverse 268 application areas, it becomes increasingly important to prevent cases 269 of JWT tokens that have been issued for one purpose being subverted 270 and used for another. Note that this is a specific type of 271 substitution attack. If the JWT could be used in an application 272 context in which it could be confused with other kinds of JWTs, then 273 mitigations MUST be employed to prevent these substitution attacks. 275 For mitigations, see Section 3.8, Section 3.9, Section 3.11, and 276 Section 3.12. 278 2.9. Indirect Attacks on the Server 280 Various JWT claims are used by the recipient to perform lookup 281 operations, such as database and LDAP searches. Others include URLs 282 that are similarly looked up by the server. Any of these claims can 283 be used by an attacker as vectors for injection attacks or server- 284 side request forgery (SSRF) attacks. 286 For mitigations, see Section 3.10. 288 3. Best Practices 290 The best practices listed below should be applied by practitioners to 291 mitigate the threats listed in the preceding section. 293 3.1. Perform Algorithm Verification 295 Libraries MUST enable the caller to specify a supported set of 296 algorithms and MUST NOT use any other algorithms when performing 297 cryptographic operations. The library MUST ensure that the "alg" or 298 "enc" header specifies the same algorithm that is used for the 299 cryptographic operation. Moreover, each key MUST be used with 300 exactly one algorithm, and this MUST be checked when the 301 cryptographic operation is performed. 303 3.2. Use Appropriate Algorithms 305 As Section 5.2 of [RFC7515] says, "it is an application decision 306 which algorithms may be used in a given context. Even if a JWS can 307 be successfully validated, unless the algorithm(s) used in the JWS 308 are acceptable to the application, it SHOULD consider the JWS to be 309 invalid." 311 Therefore, applications MUST only allow the use of cryptographically 312 current algorithms that meet the security requirements of the 313 application. This set will vary over time as new algorithms are 314 introduced and existing algorithms are deprecated due to discovered 315 cryptographic weaknesses. Applications MUST therefore be designed to 316 enable cryptographic agility. 318 That said, if a JWT is cryptographically protected end-to-end by a 319 transport layer, such as TLS using cryptographically current 320 algorithms, there may be no need to apply another layer of 321 cryptographic protections to the JWT. In such cases, the use of the 322 "none" algorithm can be perfectly acceptable. The "none" algorithm 323 should only be used when the JWT is cryptographically protected by 324 other means. JWTs using "none" are often used in application 325 contexts in which the content is optionally signed; then the URL-safe 326 claims representation and processing can be the same in both the 327 signed and unsigned cases. JWT libraries SHOULD NOT generate JWTs 328 using "none" unless explicitly requested to do by the caller. 329 Similarly, JWT libraries SHOULD NOT consume JWTs using "none" unless 330 explicitly requested by the caller. 332 Applications SHOULD follow these algorithm-specific recommendations: 334 - Avoid all RSA-PKCS1 v1.5 encryption algorithms ([RFC8017], Sec. 335 7.2}, preferring RSA-OAEP ([RFC8017], Sec. 7.1). 337 - ECDSA signatures [ANSI-X962-2005] require a unique random value 338 for every message that is signed. If even just a few bits of the 339 random value are predictable across multiple messages then the 340 security of the signature scheme may be compromised. In the worst 341 case, the private key may be recoverable by an attacker. To 342 counter these attacks, JWT libraries SHOULD implement ECDSA using 343 the deterministic approach defined in [RFC6979]. This approach is 344 completely compatible with existing ECDSA verifiers and so can be 345 implemented without new algorithm identifiers being required. 347 3.3. Validate All Cryptographic Operations 349 All cryptographic operations used in the JWT MUST be validated and 350 the entire JWT MUST be rejected if any of them fail to validate. 351 This is true not only of JWTs with a single set of Header Parameters 352 but also for Nested JWTs, in which both outer and inner operations 353 MUST be validated using the keys and algorithms supplied by the 354 application. 356 3.4. Validate Cryptographic Inputs 358 Some cryptographic operations, such as Elliptic Curve Diffie-Hellman 359 key agreement ("ECDH-ES") take inputs that may contain invalid 360 values, such as points not on the specified elliptic curve or other 361 invalid points (see, e.g. [Valenta], Sec. 7.1). The JWS/JWE library 362 itself must validate these inputs before using them or it must use 363 underlying cryptographic libraries that do so (or both!). 365 ECDH-ES ephemeral public key (epk) inputs should be validated 366 according to the recipient's chosen elliptic curve. For the NIST 367 prime-order curves P-256, P-384 and P-521, validation MUST be 368 performed according to Section 5.6.2.3.4 "ECC Partial Public-Key 369 Validation Routine" of NIST Special Publication 800-56A revision 3 370 [nist-sp-800-56a-r3]. Likewise, if the "X25519" or "X448" [RFC8037] 371 algorithms are used, then the security considerations in [RFC8037] 372 apply. 374 3.5. Ensure Cryptographic Keys have Sufficient Entropy 376 The Key Entropy and Random Values advice in Section 10.1 of [RFC7515] 377 and the Password Considerations in Section 8.8 of [RFC7518] MUST be 378 followed. In particular, human-memorizable passwords MUST NOT be 379 directly used as the key to a keyed-MAC algorithm such as "HS256". 381 In particular, passwords should only be used to perform key 382 encryption, rather than content encryption, as described in 383 Section 4.8 of [RFC7518]. Note that even when used for key 384 encryption, password-based encryption is still subject to brute-force 385 attacks. 387 3.6. Avoid Length-Dependent Encryption Inputs 389 Compression of data SHOULD NOT be done before encryption, because 390 such compressed data often reveals information about the plaintext. 392 3.7. Use UTF-8 394 [RFC7515], [RFC7516], and [RFC7519] all specify that UTF-8 be used 395 for encoding and decoding JSON used in Header Parameters and JWT 396 Claims Sets. This is also in line with the latest JSON specification 397 [RFC8259]. Implementations and applications MUST do this, and not 398 use or admit the use of other Unicode encodings for these purposes. 400 3.8. Validate Issuer and Subject 402 When a JWT contains an "iss" (issuer) claim, the application MUST 403 validate that the cryptographic keys used for the cryptographic 404 operations in the JWT belong to the issuer. If they do not, the 405 application MUST reject the JWT. 407 The means of determining the keys owned by an issuer is application- 408 specific. As one example, OpenID Connect [OpenID.Core] issuer values 409 are "https" URLs that reference a JSON metadata document that 410 contains a "jwks_uri" value that is an "https" URL from which the 411 issuer's keys are retrieved as a JWK Set [RFC7517]. This same 412 mechanism is used by [RFC8414]. Other applications may use different 413 means of binding keys to issuers. 415 Similarly, when the JWT contains a "sub" (subject) claim, the 416 application MUST validate that the subject value corresponds to a 417 valid subject and/or issuer/subject pair at the application. This 418 may include confirming that the issuer is trusted by the application. 419 If the issuer, subject, or the pair are invalid, the application MUST 420 reject the JWT. 422 3.9. Use and Validate Audience 424 If the same issuer can issue JWTs that are intended for use by more 425 than one relying party or application, the JWT MUST contain an "aud" 426 (audience) claim that can be used to determine whether the JWT is 427 being used by an intended party or was substituted by an attacker at 428 an unintended party. 430 In such cases, the relying party or application MUST validate the 431 audience value and if the audience value is not present or not 432 associated with the recipient, it MUST reject the JWT. 434 3.10. Do Not Trust Received Claims 436 The "kid" (key ID) header is used by the relying application to 437 perform key lookup. Applications should ensure that this does not 438 create SQL or LDAP injection vulnerabilities, by validating and/or 439 sanitizing the received value. 441 Similarly, blindly following a "jku" (JWK set URL) or "x5u" (X.509 442 URL) header, which may contain an arbitrary URL, could result in 443 server-side request forgery (SSRF) attacks. Applications SHOULD 444 protect against such attacks, e.g., by matching the URL to a 445 whitelist of allowed locations, and ensuring no cookies are sent in 446 the GET request. 448 3.11. Use Explicit Typing 450 Sometimes, one kind of JWT can be confused for another. If a 451 particular kind of JWT is subject to such confusion, that JWT can 452 include an explicit JWT type value, and the validation rules can 453 specify checking the type. This mechanism can prevent such 454 confusion. Explicit JWT typing is accomplished by using the "typ" 455 header parameter. For instance, the [RFC8417] specification uses the 456 "application/secevent+jwt" media type to perform explicit typing of 457 Security Event Tokens (SETs). 459 Per the definition of "typ" in Section 4.1.9 of [RFC7515], it is 460 RECOMMENDED that the "application/" prefix be omitted from the "typ" 461 value. Therefore, for example, the "typ" value used to explicitly 462 include a type for a SET SHOULD be "secevent+jwt". When explicit 463 typing is employed for a JWT, it is RECOMMENDED that a media type 464 name of the format "application/example+jwt" be used, where "example" 465 is replaced by the identifier for the specific kind of JWT. 467 When applying explicit typing to a Nested JWT, the "typ" header 468 parameter containing the explicit type value MUST be present in the 469 inner JWT of the Nested JWT (the JWT whose payload is the JWT Claims 470 Set). In some cases the same "typ" header parameter value will be 471 present in the outer JWT as well, to explicitly type the entire 472 Nested JWT. 474 Note that the use of explicit typing may not achieve disambiguation 475 from existing kinds of JWTs, as the validation rules for existing 476 kinds JWTs often do not use the "typ" header parameter value. 477 Explicit typing is RECOMMENDED for new uses of JWTs. 479 3.12. Use Mutually Exclusive Validation Rules for Different Kinds of 480 JWTs 482 Each application of JWTs defines a profile specifying the required 483 and optional JWT claims and the validation rules associated with 484 them. If more than one kind of JWT can be issued by the same issuer, 485 the validation rules for those JWTs MUST be written such that they 486 are mutually exclusive, rejecting JWTs of the wrong kind. To prevent 487 substitution of JWTs from one context into another, application 488 developers may employ a number of strategies: 490 - Use explicit typing for different kinds of JWTs. Then the 491 distinct "typ" values can be used to differentiate between the 492 different kinds of JWTs. 494 - Use different sets of required claims or different required claim 495 values. Then the validation rules for one kind of JWT will reject 496 those with different claims or values. 498 - Use different sets of required header parameters or different 499 required header parameter values. Then the validation rules for 500 one kind of JWT will reject those with different header parameters 501 or values. 503 - Use different keys for different kinds of JWTs. Then the keys 504 used to validate one kind of JWT will fail to validate other kinds 505 of JWTs. 507 - Use different "aud" values for different uses of JWTs from the 508 same issuer. Then audience validation will reject JWTs 509 substituted into inappropriate contexts. 511 - Use different issuers for different kinds of JWTs. Then the 512 distinct "iss" values can be used to segregate the different kinds 513 of JWTs. 515 Given the broad diversity of JWT usage and applications, the best 516 combination of types, required claims, values, header parameters, key 517 usages, and issuers to differentiate among different kinds of JWTs 518 will, in general, be application specific. As discussed in 519 Section 3.11, for new JWT applications, the use of explicit typing is 520 RECOMMENDED. 522 4. Security Considerations 524 This entire document is about security considerations when 525 implementing and deploying JSON Web Tokens. 527 5. IANA Considerations 529 This document requires no IANA actions. 531 6. Acknowledgements 533 Thanks to Antonio Sanso for bringing the "ECDH-ES" invalid point 534 attack to the attention of JWE and JWT implementers. Tim McLean 535 [McLean] published the RSA/HMAC confusion attack. Thanks to Nat 536 Sakimura for advocating the use of explicit typing. Thanks to Neil 537 Madden for his numerous comments, and to Carsten Bormann, Brian 538 Campbell, Brian Carpenter, Alissa Cooper, Roman Danyliw, Ben Kaduk, 539 Mirja Kuehlewind, Barry Leiba, Eric Rescorla, Adam Roach, Martin 540 Vigoureux, and Eric Vyncke for their reviews. 542 7. References 544 7.1. Normative References 546 [nist-sp-800-56a-r3] 547 Barker, E., Chen, L., Keller, S., Roginsky, A., Vassilev, 548 A., and R. Davis, "Recommendation for Pair-Wise Key 549 Establishment Schemes Using Discrete Logarithm 550 Cryptography, Draft NIST Special Publication 800-56A 551 Revision 3", April 2018, 552 . 554 [RFC2119] Bradner, S., "Key words for use in RFCs to Indicate 555 Requirement Levels", BCP 14, RFC 2119, 556 DOI 10.17487/RFC2119, March 1997, 557 . 559 [RFC6979] Pornin, T., "Deterministic Usage of the Digital Signature 560 Algorithm (DSA) and Elliptic Curve Digital Signature 561 Algorithm (ECDSA)", RFC 6979, DOI 10.17487/RFC6979, August 562 2013, . 564 [RFC7515] Jones, M., Bradley, J., and N. Sakimura, "JSON Web 565 Signature (JWS)", RFC 7515, DOI 10.17487/RFC7515, May 566 2015, . 568 [RFC7516] Jones, M. and J. Hildebrand, "JSON Web Encryption (JWE)", 569 RFC 7516, DOI 10.17487/RFC7516, May 2015, 570 . 572 [RFC7518] Jones, M., "JSON Web Algorithms (JWA)", RFC 7518, 573 DOI 10.17487/RFC7518, May 2015, 574 . 576 [RFC7519] Jones, M., Bradley, J., and N. Sakimura, "JSON Web Token 577 (JWT)", RFC 7519, DOI 10.17487/RFC7519, May 2015, 578 . 580 [RFC8017] Moriarty, K., Ed., Kaliski, B., Jonsson, J., and A. Rusch, 581 "PKCS #1: RSA Cryptography Specifications Version 2.2", 582 RFC 8017, DOI 10.17487/RFC8017, November 2016, 583 . 585 [RFC8037] Liusvaara, I., "CFRG Elliptic Curve Diffie-Hellman (ECDH) 586 and Signatures in JSON Object Signing and Encryption 587 (JOSE)", RFC 8037, DOI 10.17487/RFC8037, January 2017, 588 . 590 [RFC8174] Leiba, B., "Ambiguity of Uppercase vs Lowercase in RFC 591 2119 Key Words", BCP 14, RFC 8174, DOI 10.17487/RFC8174, 592 May 2017, . 594 [RFC8259] Bray, T., Ed., "The JavaScript Object Notation (JSON) Data 595 Interchange Format", STD 90, RFC 8259, 596 DOI 10.17487/RFC8259, December 2017, 597 . 599 7.2. Informative References 601 [Alawatugoda] 602 Alawatugoda, J., Stebila, D., and C. Boyd, "Protecting 603 Encrypted Cookies from Compression Side-Channel Attacks", 604 Financial Cryptography and Data Security pp. 86-106, 605 DOI 10.1007/978-3-662-47854-7_6, 2015. 607 [ANSI-X962-2005] 608 "American National Standard X9.62: The Elliptic Curve 609 Digital Signature Algorithm (ECDSA)", November 2005. 611 [Kelsey] Kelsey, J., "Compression and Information Leakage of 612 Plaintext", Fast Software Encryption pp. 263-276, 613 DOI 10.1007/3-540-45661-9_21, 2002. 615 [Langkemper] 616 Langkemper, S., "Attacking JWT Authentication", September 617 2016, . 620 [McLean] McLean, T., "Critical vulnerabilities in JSON Web Token 621 libraries", March 2015, . 624 [OpenID.Core] 625 Sakimura, N., Bradley, J., Jones, M., Medeiros, B., and C. 626 Mortimore, "OpenID Connect Core 1.0", November 2014, 627 . 629 [RFC6749] Hardt, D., Ed., "The OAuth 2.0 Authorization Framework", 630 RFC 6749, DOI 10.17487/RFC6749, October 2012, 631 . 633 [RFC7159] Bray, T., Ed., "The JavaScript Object Notation (JSON) Data 634 Interchange Format", RFC 7159, DOI 10.17487/RFC7159, March 635 2014, . 637 [RFC7517] Jones, M., "JSON Web Key (JWK)", RFC 7517, 638 DOI 10.17487/RFC7517, May 2015, 639 . 641 [RFC8414] Jones, M., Sakimura, N., and J. Bradley, "OAuth 2.0 642 Authorization Server Metadata", RFC 8414, 643 DOI 10.17487/RFC8414, June 2018, 644 . 646 [RFC8417] Hunt, P., Ed., Jones, M., Denniss, W., and M. Ansari, 647 "Security Event Token (SET)", RFC 8417, 648 DOI 10.17487/RFC8417, July 2018, 649 . 651 [Sanso] Sanso, A., "Critical Vulnerability Uncovered in JSON 652 Encryption", March 2017, 653 . 656 [Valenta] Valenta, L., Sullivan, N., Sanso, A., and N. Heninger, "In 657 search of CurveSwap: Measuring elliptic curve 658 implementations in the wild", March 2018, 659 . 661 Appendix A. Document History 663 [[ to be removed by the RFC editor before publication as an RFC ]] 665 A.1. draft-ietf-oauth-jwt-bcp-07 667 - IESG review comments. 669 A.2. draft-ietf-oauth-jwt-bcp-06 671 - Second AD review. 673 - Removed unworkable recommendation to pad encrypted passwords. 675 A.3. draft-ietf-oauth-jwt-bcp-05 677 - Genart review comments. 679 A.4. draft-ietf-oauth-jwt-bcp-04 681 - AD review comments. 683 A.5. draft-ietf-oauth-jwt-bcp-03 685 - Acknowledgements. 687 A.6. draft-ietf-oauth-jwt-bcp-02 689 - Implemented WGLC feedback. 691 A.7. draft-ietf-oauth-jwt-bcp-01 693 - Feedback from Brian Campbell. 695 A.8. draft-ietf-oauth-jwt-bcp-00 697 - Initial WG draft. No change from the latest individual version. 699 A.9. draft-sheffer-oauth-jwt-bcp-01 701 - Added explicit typing. 703 A.10. draft-sheffer-oauth-jwt-bcp-00 705 - Initial version. 707 Authors' Addresses 709 Yaron Sheffer 710 Intuit 712 EMail: yaronf.ietf@gmail.com 714 Dick Hardt 716 EMail: dick.hardt@gmail.com 718 Michael B. Jones 719 Microsoft 721 EMail: mbj@microsoft.com 722 URI: http://self-issued.info/