idnits 2.17.1 draft-ietf-httpauth-digest-15.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 abstract seems to contain references ([1]), which it shouldn't. Please replace those with straight textual mentions of the documents in question. -- The draft header indicates that this document obsoletes RFC2617, 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 seems to use 'NOT RECOMMENDED' as an RFC 2119 keyword, but does not include the phrase in its RFC 2119 key words list. == The document seems to contain a disclaimer for pre-RFC5378 work, but was first submitted on or after 10 November 2008. The disclaimer is usually necessary only for documents that revise or obsolete older RFCs, and that take significant amounts of text from those RFCs. If you can contact all authors of the source material and they are willing to grant the BCP78 rights to the IETF Trust, you can and should remove the disclaimer. Otherwise, the disclaimer is needed and you can ignore this comment. (See the Legal Provisions document at https://trustee.ietf.org/license-info for more information.) -- The document date (March 5, 2015) is 3334 days in the past. Is this intentional? Checking references for intended status: Proposed Standard ---------------------------------------------------------------------------- (See RFCs 3967 and 4897 for information about using normative references to lower-maturity documents in RFCs) -- Looks like a reference, but probably isn't: '1' on line 24 == Outdated reference: A later version (-05) exists of draft-ietf-httpbis-auth-info-02 == Outdated reference: A later version (-18) exists of draft-ietf-precis-saslprepbis-12 ** Obsolete normative reference: RFC 5987 (Obsoleted by RFC 8187) ** Obsolete normative reference: RFC 7230 (Obsoleted by RFC 9110, RFC 9112) ** Obsolete normative reference: RFC 7231 (Obsoleted by RFC 9110) ** Obsolete normative reference: RFC 7234 (Obsoleted by RFC 9111) ** Obsolete normative reference: RFC 7235 (Obsoleted by RFC 9110) == Outdated reference: A later version (-07) exists of draft-ietf-httpauth-basicauth-update-04 -- Obsolete informational reference (is this intentional?): RFC 2617 (Obsoleted by RFC 7235, RFC 7615, RFC 7616, RFC 7617) -- Obsolete informational reference (is this intentional?): RFC 2818 (Obsoleted by RFC 9110) Summary: 6 errors (**), 0 flaws (~~), 6 warnings (==), 5 comments (--). Run idnits with the --verbose option for more detailed information about the items above. -------------------------------------------------------------------------------- 2 HTTPAuth R. Shekh-Yusef, Ed. 3 Internet-Draft Avaya 4 Obsoletes: 2617 (if approved) D. Ahrens 5 Intended status: Standards Track Independent 6 Expires: September 6, 2015 S. Bremer 7 Netzkonform 8 March 5, 2015 10 HTTP Digest Access Authentication 11 draft-ietf-httpauth-digest-15 13 Abstract 15 HTTP provides a simple challenge-response authentication mechanism 16 that may be used by a server to challenge a client request and by a 17 client to provide authentication information. This document defines 18 the HTTP Digest Authentication scheme that can be used with the HTTP 19 authentication mechanism. 21 Editorial Note (To be removed by RFC Editor before publication) 23 Discussion of this draft takes place on the HTTPAuth working group 24 mailing list (http-auth@ietf.org), which is archived at [1]. 26 Status of This Memo 28 This Internet-Draft is submitted in full conformance with the 29 provisions of BCP 78 and BCP 79. 31 Internet-Drafts are working documents of the Internet Engineering 32 Task Force (IETF). Note that other groups may also distribute 33 working documents as Internet-Drafts. The list of current Internet- 34 Drafts is at http://datatracker.ietf.org/drafts/current/. 36 Internet-Drafts are draft documents valid for a maximum of six months 37 and may be updated, replaced, or obsoleted by other documents at any 38 time. It is inappropriate to use Internet-Drafts as reference 39 material or to cite them other than as "work in progress." 41 This Internet-Draft will expire on September 6, 2015. 43 Copyright Notice 45 Copyright (c) 2015 IETF Trust and the persons identified as the 46 document authors. All rights reserved. 48 This document is subject to BCP 78 and the IETF Trust's Legal 49 Provisions Relating to IETF Documents 50 (http://trustee.ietf.org/license-info) in effect on the date of 51 publication of this document. Please review these documents 52 carefully, as they describe your rights and restrictions with respect 53 to this document. Code Components extracted from this document must 54 include Simplified BSD License text as described in Section 4.e of 55 the Trust Legal Provisions and are provided without warranty as 56 described in the Simplified BSD License. 58 This document may contain material from IETF Documents or IETF 59 Contributions published or made publicly available before November 60 10, 2008. The person(s) controlling the copyright in some of this 61 material may not have granted the IETF Trust the right to allow 62 modifications of such material outside the IETF Standards Process. 63 Without obtaining an adequate license from the person(s) controlling 64 the copyright in such materials, this document may not be modified 65 outside the IETF Standards Process, and derivative works of it may 66 not be created outside the IETF Standards Process, except to format 67 it for publication as an RFC or to translate it into languages other 68 than English. 70 Table of Contents 72 1. Introduction . . . . . . . . . . . . . . . . . . . . . . . . 3 73 1.1. Terminology . . . . . . . . . . . . . . . . . . . . . . . 3 74 2. Syntax Convention . . . . . . . . . . . . . . . . . . . . . . 4 75 2.1. Examples . . . . . . . . . . . . . . . . . . . . . . . . 4 76 2.2. ABNF . . . . . . . . . . . . . . . . . . . . . . . . . . 4 77 3. Digest Access Authentication Scheme . . . . . . . . . . . . . 4 78 3.1. Overall Operation . . . . . . . . . . . . . . . . . . . . 4 79 3.2. Representation of Digest Values . . . . . . . . . . . . . 4 80 3.3. The WWW-Authenticate Response Header Field . . . . . . . 5 81 3.4. The Authorization Request Header Field . . . . . . . . . 8 82 3.4.1. Response . . . . . . . . . . . . . . . . . . . . . . 10 83 3.4.2. A1 . . . . . . . . . . . . . . . . . . . . . . . . . 10 84 3.4.3. A2 . . . . . . . . . . . . . . . . . . . . . . . . . 11 85 3.4.4. Username Hashing . . . . . . . . . . . . . . . . . . 11 86 3.4.5. Parameter Values and Quoted-String . . . . . . . . . 12 87 3.4.6. Various Considerations . . . . . . . . . . . . . . . 12 88 3.5. The Authentication-Info and Proxy-Authentication-Info 89 Header Fields . . . . . . . . . . . . . . . . . . . . . . 13 90 3.6. Digest Operation . . . . . . . . . . . . . . . . . . . . 15 91 3.7. Security Protocol Negotiation . . . . . . . . . . . . . . 16 92 3.8. Proxy-Authenticate and Proxy-Authorization . . . . . . . 16 93 3.9. Examples . . . . . . . . . . . . . . . . . . . . . . . . 17 94 3.9.1. Example with SHA-256 and MD5 . . . . . . . . . . . . 17 95 3.9.2. Example with SHA-512-256, Charset, and Userhash . . . 18 97 4. Internationalization Considerations . . . . . . . . . . . . . 20 98 5. Security Considerations . . . . . . . . . . . . . . . . . . . 20 99 5.1. Limitations . . . . . . . . . . . . . . . . . . . . . . . 20 100 5.2. Storing passwords . . . . . . . . . . . . . . . . . . . . 21 101 5.3. Authentication of Clients using Digest Authentication . . 21 102 5.4. Limited Use Nonce Values . . . . . . . . . . . . . . . . 22 103 5.5. Replay Attacks . . . . . . . . . . . . . . . . . . . . . 22 104 5.6. Weakness Created by Multiple Authentication Schemes . . . 23 105 5.7. Online dictionary attacks . . . . . . . . . . . . . . . . 24 106 5.8. Man in the Middle . . . . . . . . . . . . . . . . . . . . 24 107 5.9. Chosen plaintext attacks . . . . . . . . . . . . . . . . 25 108 5.10. Precomputed dictionary attacks . . . . . . . . . . . . . 25 109 5.11. Batch brute force attacks . . . . . . . . . . . . . . . . 25 110 5.12. Summary . . . . . . . . . . . . . . . . . . . . . . . . . 26 111 6. IANA Considerations . . . . . . . . . . . . . . . . . . . . . 26 112 6.1. HTTP Digest Hash Algorithms Registry . . . . . . . . . . 26 113 6.2. Digest Scheme Registration . . . . . . . . . . . . . . . 27 114 7. Acknowledgments . . . . . . . . . . . . . . . . . . . . . . . 27 115 8. References . . . . . . . . . . . . . . . . . . . . . . . . . 28 116 8.1. Normative References . . . . . . . . . . . . . . . . . . 28 117 8.2. Informative References . . . . . . . . . . . . . . . . . 29 118 Appendix A. Changes from RFC 2617 . . . . . . . . . . . . . . . 30 119 Authors' Addresses . . . . . . . . . . . . . . . . . . . . . . . 30 121 1. Introduction 123 HTTP provides a simple challenge-response authentication mechanism 124 that may be used by a server to challenge a client request and by a 125 client to provide authentication information. This document defines 126 the HTTP Digest Authentication scheme that can be used with the HTTP 127 authentication mechanism. 129 The details of the challenge-response authentication mechanism are 130 specified in the "Hypertext Transfer Protocol (HTTP/1.1): 131 Authentication" [RFC7235]. 133 The combination of this document with the definition of the "Basic" 134 authentication scheme [BASIC], "The Hypertext Transfer Protocol 135 (HTTP) Authentication-Info and Proxy-Authentication-Info Response 136 Header Fields" [AUTHINFO], and [RFC7235] obsolete [RFC2617]. 138 1.1. Terminology 140 The key words "MUST", "MUST NOT", "REQUIRED", "SHALL", "SHALL NOT", 141 "SHOULD", "SHOULD NOT", "RECOMMENDED", "MAY", and "OPTIONAL" in this 142 document are to be interpreted as described in [RFC2119]. 144 2. Syntax Convention 146 2.1. Examples 148 In the interest of clarity and readability, the extended parameters 149 or the header fields and parameters in the examples in this document 150 might be broken into multiple lines. Any line that is indented in 151 this document is a continuation of the preceding line. 153 2.2. ABNF 155 This specification uses the Augmented Backus-Naur Form (ABNF) 156 notation of [RFC5234], and the ABNF List Extension of [RFC7230]. 158 3. Digest Access Authentication Scheme 160 3.1. Overall Operation 162 The Digest scheme is based on a simple challenge-response paradigm. 163 The Digest scheme challenges using a nonce value, and might indicate 164 that username hashing is supported. A valid response contains a 165 checksum of the username, the password, the given nonce value, the 166 HTTP method, and the requested URI. In this way, the password is 167 never sent in the clear, and the username can be hashed, depending on 168 the indication received from the server. The username and password 169 must be prearranged in some fashion not addressed by this document. 171 The security of this protocol is critically dependent on the 172 randomness of the randomly chosen parameters, such as client and 173 server nonces. These should be generated by a strong random or 174 properly seeded pseudorandom source (see [RFC4086]). 176 3.2. Representation of Digest Values 178 An optional header field allows the server to specify the algorithm 179 used to create the checksum or digest. This documents adds SHA-256 180 and SHA-512/256 algorithms. To maintain backwards compatibility with 181 [RFC2617], the MD5 algorithm is still supported but NOT RECOMMENDED. 183 The size of the digest depends on the algorithm used. The bits in 184 the digest are converted from the most significant to the least 185 significant bit, four bits at a time to the ASCII representation as 186 follows. Each four bits is represented by its familiar hexadecimal 187 notation from the characters 0123456789abcdef, that is binary 0000 is 188 represented by the character '0', 0001 by '1' and so on up to the 189 representation of 1111 as 'f'. If the MD5 algorithm is used to 190 calculate the digest, then the MD5 digest will be represented as 32 191 hexadecimal characters, while SHA-256 and SHA-512/256 are represented 192 as 64 hexadecimal characters. 194 3.3. The WWW-Authenticate Response Header Field 196 If a server receives a request for an access-protected object, and an 197 acceptable Authorization header field is not sent, the server 198 responds with a "401 Unauthorized" status code and a WWW-Authenticate 199 header field with Digest scheme as per the framework defined above. 200 The value of the header field can include parameters from the 201 following list: 203 realm 205 A string to be displayed to users so they know which username and 206 password to use. This string should contain at least the name of 207 the host performing the authentication and might additionally 208 indicate the collection of users who might have access. An 209 example might be "registered_users@gotham.news.com". (See 210 Section 2.2 of [RFC7235] for more details). 212 domain 214 A quoted, space-separated list of URIs, as specified in [RFC3986], 215 that define the protection space. If a URI is an abs_path, it is 216 relative to the canonical root URL (See Section 2.2 of [RFC7235]). 217 An absolute-URI in this list may refer to a different server than 218 the web-origin [RFC6454]. The client can use this list to 219 determine the set of URIs for which the same authentication 220 information may be sent: any URI that has a URI in this list as a 221 prefix (after both have been made absolute) MAY be assumed to be 222 in the same protection space. If this parameter is omitted or its 223 value is empty, the client SHOULD assume that the protection space 224 consists of all URIs on the web-origin. 226 This parameter is not meaningful in Proxy-Authenticate header 227 fields, for which the protection space is always the entire proxy; 228 if present it MUST be ignored. 230 nonce 232 A server-specified data string which should be uniquely generated 233 each time a 401 response is made. It is advised that this string 234 be base64 or hexadecimal data. Specifically, since the string is 235 passed in the header field lines as a quoted string, the double- 236 quote character is not allowed, unless suitably escaped. 238 The contents of the nonce are implementation dependent. The 239 quality of the implementation depends on a good choice. A nonce 240 might, for example, be constructed as the base 64 encoding of 242 time-stamp H(time-stamp ":" ETag ":" secret-data) 244 where time-stamp is a server-generated time, which preferably 245 includes micro or nano seconds, or other non-repeating values, 246 ETag is the value of the HTTP ETag header field associated with 247 the requested entity, and secret-data is data known only to the 248 server. With a nonce of this form a server would recalculate the 249 hash portion after receiving the client authentication header 250 field and reject the request if it did not match the nonce from 251 that header field or if the time-stamp value is not recent enough. 252 In this way the server can limit the time of the nonce's validity. 253 The inclusion of the ETag prevents a replay request for an updated 254 version of the resource. Including the IP address of the client 255 in the nonce would appear to offer the server the ability to limit 256 the reuse of the nonce to the same client that originally got it. 257 However, that would break when requests from a single user often 258 go through different proxies. Also, IP address spoofing is not 259 that hard. 261 An implementation might choose not to accept a previously used 262 nonce or a previously used digest, in order to protect against a 263 replay attack. Or, an implementation might choose to use one-time 264 nonces or digests for POST or PUT requests and a time-stamp for 265 GET requests. For more details on the issues involved see 266 Section 5 of this document. 268 The nonce is opaque to the client. 270 opaque 272 A string of data, specified by the server, which SHOULD be 273 returned by the client unchanged in the Authorization header field 274 of subsequent requests with URIs in the same protection space. It 275 is RECOMMENDED that this string be base64 or hexadecimal data. 277 stale 279 A case-insensitive flag indicating that the previous request from 280 the client was rejected because the nonce value was stale. If 281 stale is TRUE, the client may wish to simply retry the request 282 with a new encrypted response, without re-prompting the user for a 283 new username and password. The server SHOULD only set stale to 284 TRUE if it receives a request for which the nonce is invalid. If 285 stale is FALSE, or anything other than TRUE, or the stale 286 parameter is not present, the username and/or password are 287 invalid, and new values MUST be obtained. 289 algorithm 291 A string indicating a pair of algorithms used to produce the 292 digest and a checksum. If this is not present it is assumed to be 293 "MD5". If the algorithm is not understood, the challenge SHOULD 294 be ignored (and a different one used, if there is more than one). 296 When used with the Digest mechanism, each one of the algorithms 297 has two variants: Session variant and non-Session variant. The 298 non-Session variant is denoted by "", e.g. "SHA-256", 299 and the Session variant is denoted by "-sess", e.g. 300 "SHA-256-sess". 302 In this document the string obtained by applying the digest 303 algorithm to the data "data" with secret "secret" will be denoted 304 by KD(secret, data), and the string obtained by applying the 305 checksum algorithm to the data "data" will be denoted H(data). 306 The notation unq(X) means the value of the quoted-string X without 307 the surrounding quotes and with quoting slashes removed. 309 For "" and "-sess" 311 H(data) = (data) 313 and 315 KD(secret, data) = H(concat(secret, ":", data)) 317 For example: 319 For the "SHA-256" and "SHA-256-sess" algorithms 321 H(data) = SHA-256(data) 323 i.e., the digest is the "" of the secret concatenated 324 with a colon concatenated with the data. The "-sess" 325 algorithm is intended to allow efficient 3rd party authentication 326 servers; for the difference in usage, see the description in 327 Section 3.4.2. 329 qop 331 This parameter MUST be used by all implementations. It is a 332 quoted string of one or more tokens indicating the "quality of 333 protection" values supported by the server. The value "auth" 334 indicates authentication; the value "auth-int" indicates 335 authentication with integrity protection; see the descriptions 336 below for calculating the response parameter value for the 337 application of this choice. Unrecognized options MUST be ignored. 339 charset 341 This is an OPTIONAL parameter that is used by the server to 342 indicate the encoding scheme it supports. 344 userhash 346 This is an OPTIONAL parameter that is used by the server to 347 indicate that it supports username hashing. Valid values are: 348 "true" or "false". Default value is "false". 350 For historical reasons, a sender MUST only generate the quoted-string 351 syntax values for the following parameters: realm, domain, nonce, 352 opaque, and qop. 354 For historical reasons, a sender MUST NOT generate the quoted-string 355 syntax values for the following parameters: stale and algorithm. 357 3.4. The Authorization Request Header Field 359 The client is expected to retry the request, passing an Authorization 360 header field line with Digest scheme, which is defined according to 361 the framework above. The values of the opaque and algorithm fields 362 must be those supplied in the WWW-Authenticate response header field 363 for the entity being requested. 365 The request can include parameters from the following list: 367 response 369 A string of the hex digits computed as defined below, which proves 370 that the user knows a password. 372 username 374 The user's name in the specified realm. The quoted string 375 contains the name in plain text or the hash code in hexadecimal 376 notation. If the username contains characters not allowed inside 377 the ABNF quoted-string production, the "username*" parameter can 378 be used. Sending both "username" and "username*" in the same 379 header option MUST be treated as error. 381 username* 383 If the "userhash" parameter value is set "false" and the username 384 contains characters not allowed inside the ABNF quoted-string 385 production, the user's name can be sent with this parameter, using 386 the extended notation defined in [RFC5987]. 388 uri 390 The Effective Request URI (Section 5.5 of [RFC7230]) of the HTTP 391 request; duplicated here because proxies are allowed to change the 392 request target ("request-target", Section 3.1.1 of [RFC7230]) in 393 transit. 395 qop 397 Indicates what "quality of protection" the client has applied to 398 the message. Its value MUST be one of the alternatives the server 399 indicated it supports in the WWW-Authenticate header field. These 400 values affect the computation of the response. Note that this is 401 a single token, not a quoted list of alternatives as in WWW- 402 Authenticate. 404 cnonce 406 This parameter MUST be used by all implementations. The cnonce 407 value is an opaque quoted ASCII-only string value provided by the 408 client and used by both client and server to avoid chosen 409 plaintext attacks, to provide mutual authentication, and to 410 provide some message integrity protection. See the descriptions 411 below of the calculation of the rspauth and response values. 413 nc 415 This parameter MUST be used by all implementations. The "nc" 416 parameter stands for "nonce count". The nc value is the 417 hexadecimal count of the number of requests (including the current 418 request) that the client has sent with the nonce value in this 419 request. For example, in the first request sent in response to a 420 given nonce value, the client sends "nc=00000001". The purpose of 421 this parameter is to allow the server to detect request replays by 422 maintaining its own copy of this count - if the same nc value is 423 seen twice, then the request is a replay. See the description 424 below of the construction of the response value. 426 userhash 428 This OPTIONAL parameter is used by the client to indicate that the 429 username has been hashed. Valid values are: "true" or "false". 430 Default value is "false". 432 For historical reasons, a sender MUST only generate the quoted-string 433 syntax for the following parameters: username, realm, nonce, uri, 434 response, cnonce, and opaque. 436 For historical reasons, a sender MUST NOT generate the quoted-string 437 syntax for the following parameters: algorithm, qop, and nc. 439 If a parameter or its value is improper, or required parameters are 440 missing, the proper response is a 4xx error code. If the response is 441 invalid, then a login failure SHOULD be logged, since repeated login 442 failures from a single client may indicate an attacker attempting to 443 guess passwords. The server implementation SHOULD be careful with 444 the information being logged so that it won't put a cleartext 445 password (e.g. entered into the username field) into the log. 447 The definition of the response above indicates the encoding for its 448 value. The following definitions show how the value is computed. 450 3.4.1. Response 452 If the "qop" value is "auth" or "auth-int": 454 response = <"> < KD ( H(A1), unq(nonce) 455 ":" nc 456 ":" unq(cnonce) 457 ":" unq(qop) 458 ":" H(A2) 459 ) <"> 461 See below for the definitions for A1 and A2. 463 3.4.2. A1 465 If the "algorithm" parameter's value is "", e.g. "SHA- 466 256", then A1 is: 468 A1 = unq(username) ":" unq(realm) ":" passwd 470 where 472 passwd = < user's password > 474 If the "algorithm" parameter's value is "-sess", e.g. 475 "SHA-256-sess", then A1 is calculated using the nonce value provided 476 in the challenge from the server, and cnounce value from the request 477 by the client following receipt of a WWW-Authenticate challenge from 478 the server. It uses the server nonce from that challenge, herein 479 called nonce-prime, and the client nonce value from the response, 480 herein called cnonce-prime, to construct A1 as follows: 482 A1 = H( unq(username) ":" unq(realm) 483 ":" passwd ) 484 ":" unq(nonce-prime) ":" unq(cnonce-prime) 486 This creates a "session key" for the authentication of subsequent 487 requests and responses which is different for each "authentication 488 session", thus limiting the amount of material hashed with any one 489 key. (Note: see further discussion of the authentication session in 490 Section 3.6.) Because the server need only use the hash of the user 491 credentials in order to create the A1 value, this construction could 492 be used in conjunction with a third party authentication service so 493 that the web server would not need the actual password value. The 494 specification of such a protocol is beyond the scope of this 495 specification. 497 3.4.3. A2 499 If the "qop" parameter's value is "auth" or is unspecified, then A2 500 is: 502 A2 = Method ":" request-uri 504 If the "qop" value is "auth-int", then A2 is: 506 A2 = Method ":" request-uri ":" H(entity-body) 508 3.4.4. Username Hashing 510 To protect the transport of the username from the client to the 511 server, the server SHOULD set the "userhash" parameter with the value 512 of "true" in the WWW-Authentication header field. 514 If the client supports the "userhash" parameter, and the "userhash" 515 parameter value in the WWW-Authentication header field is set to 516 "true", then the client MUST calculate a hash of the username after 517 any other hash calculation and include the "userhash" parameter with 518 the value of "true" in the Authorization Request Header field. If 519 the client does not provide the "username" as a hash value or the 520 "userhash" parameter with the value of "true", the server MAY reject 521 the request. 523 The following is the operation that the client will take to hash the 524 username, using the same algorithm used to hash the credentials: 526 username = H( unq(username) ":" unq(realm) ) 528 3.4.5. Parameter Values and Quoted-String 530 Note that the value of many of the parameters, such as "username" 531 value, are defined as a "quoted-string". However, the "unq" notation 532 indicates that surrounding quotation marks are removed in forming the 533 string A1. Thus if the Authorization header field includes the 534 fields 536 username="Mufasa", realm="myhost@testrealm.com" 538 and the user Mufasa has password "Circle Of Life" then H(A1) would be 539 H(Mufasa:myhost@testrealm.com:Circle Of Life) with no quotation marks 540 in the digested string. 542 No white space is allowed in any of the strings to which the digest 543 function H() is applied unless that white space exists in the quoted 544 strings or entity body whose contents make up the string to be 545 digested. For example, the string A1 illustrated above must be 547 Mufasa:myhost@testrealm.com:Circle Of Life 549 with no white space on either side of the colons, but with the white 550 space between the words used in the password value. Likewise, the 551 other strings digested by H() must not have white space on either 552 side of the colons which delimit their fields unless that white space 553 was in the quoted strings or entity body being digested. 555 Also note that if integrity protection is applied (qop=auth-int), the 556 H(entity-body) is the hash of the entity body, not the message body - 557 it is computed before any transfer encoding is applied by the sender 558 and after it has been removed by the recipient. Note that this 559 includes multipart boundaries and embedded header fields in each part 560 of any multipart content-type. 562 3.4.6. Various Considerations 564 The "Method" value is the HTTP request method, in US-ASCII letters, 565 as specified in Section 3.1.1 of [RFC7230]. The "request-target" 566 value is the request-target from the request line as specified in 567 Section 3.1.1 of [RFC7230]. This MAY be "*", an "absolute-URI" or an 568 "absolute-path" as specified in Section 2.7 of [RFC7230], but it MUST 569 agree with the request-target. In particular, it MUST be an 570 "absolute-URI" if the request-target is an "absolute-URI". The 571 "cnonce" value is a client-chosen value whose purpose is to foil 572 chosen plaintext attacks. 574 The authenticating server MUST assure that the resource designated by 575 the "uri" parameter is the same as the resource specified in the 576 Request-Line; if they are not, the server SHOULD return a 400 Bad 577 Request error. (Since this may be a symptom of an attack, server 578 implementers may want to consider logging such errors.) The purpose 579 of duplicating information from the request URL in this field is to 580 deal with the possibility that an intermediate proxy may alter the 581 client's Request-Line. This altered (but presumably semantically 582 equivalent) request would not result in the same digest as that 583 calculated by the client. 585 Implementers should be aware of how authenticated transactions need 586 to interact with shared caches (see [RFC7234]). 588 3.5. The Authentication-Info and Proxy-Authentication-Info Header 589 Fields 591 The Authentication-Info header field and the Proxy-Authentication- 592 Info header field [AUTHINFO] are generic fields that MAY be used by a 593 server to communicate some information regarding the successful 594 authentication of a client response. 596 The Digest authentication scheme MAY add the Authentication-Info 597 header field in the confirmation request and include parameters from 598 the following list: 600 nextnonce 602 The value of the nextnonce parameter is the nonce the server 603 wishes the client to use for a future authentication response. 604 The server MAY send the Authentication-Info header field with a 605 nextnonce field as a means of implementing one-time or otherwise 606 changing nonces. If the nextnonce field is present the client 607 SHOULD use it when constructing the Authorization header field for 608 its next request. Failure of the client to do so MAY result in a 609 request to re-authenticate from the server with the "stale=TRUE". 611 Server implementations SHOULD carefully consider the 612 performance implications of the use of this mechanism; 613 pipelined requests will not be possible if every response 614 includes a nextnonce parameter that MUST be used on the next 615 request received by the server. Consideration SHOULD be given 616 to the performance vs. security tradeoffs of allowing an old 617 nonce value to be used for a limited time to permit request 618 pipelining. Use of the "nc" parameter can retain most of the 619 security advantages of a new server nonce without the 620 deleterious affects on pipelining. 622 qop 624 Indicates the "quality of protection" options applied to the 625 response by the server. The value "auth" indicates 626 authentication; the value "auth-int" indicates authentication with 627 integrity protection. The server SHOULD use the same value for 628 the qop parameter in the response as was sent by the client in the 629 corresponding request. 631 rspauth 633 The optional response digest in the "rspauth" parameter supports 634 mutual authentication -- the server proves that it knows the 635 user's secret, and with qop=auth-int also provides limited 636 integrity protection of the response. The "rspauth" value is 637 calculated as for the response in the Authorization header field, 638 except that if "qop=auth" or is not specified in the Authorization 639 header field for the request, A2 is 641 A2 = ":" request-uri 643 and if "qop=auth-int", then A2 is 645 A2 = ":" request-uri ":" H(entity-body) 647 cnonce and nc 649 The "cnonce" value and "nc" value MUST be the ones for the client 650 request to which this message is the response. The "rspauth", 651 "cnonce", and "nc" parameters MUST be present if "qop=auth" or 652 "qop=auth-int" is specified. 654 The Authentication-Info header field is allowed in the trailer of an 655 HTTP message transferred via chunked transfer-coding. 657 For historical reasons, a sender MUST only generate the quoted-string 658 syntax for the following parameters: nextnonce, rspauth, and cnonce. 660 For historical reasons, a sender MUST NOT generate the quoted-string 661 syntax for the following parameters: qop and nc. 663 For historical reasons, the nc value MUST be exactly 8 hexadecimal 664 digits. 666 3.6. Digest Operation 668 Upon receiving the Authorization header field, the server MAY check 669 its validity by looking up the password that corresponds to the 670 submitted username. Then, the server MUST perform the same digest 671 operation (e.g. MD5, SHA-256) performed by the client, and compare 672 the result to the given response value. 674 Note that the HTTP server does not actually need to know the user's 675 cleartext password. As long as H(A1) is available to the server, the 676 validity of an Authorization header field can be verified. 678 The client response to a WWW-Authenticate challenge for a protection 679 space starts an authentication session with that protection space. 680 The authentication session lasts until the client receives another 681 WWW-Authenticate challenge from any server in the protection space. 682 A client SHOULD remember the username, password, nonce, nonce count 683 and opaque values associated with an authentication session to use to 684 construct the Authorization header field in future requests within 685 that protection space. The Authorization header field MAY be 686 included preemptively; doing so improves server efficiency and avoids 687 extra round trips for authentication challenges. The server MAY 688 choose to accept the old Authorization header field information, even 689 though the nonce value included might not be fresh. Alternatively, 690 the server MAY return a 401 response with a new nonce value, causing 691 the client to retry the request; by specifying stale=TRUE with this 692 response, the server tells the client to retry with the new nonce, 693 but without prompting for a new username and password. 695 Because the client is REQUIRED to return the value of the opaque 696 parameter given to it by the server for the duration of a session, 697 the opaque data can be used to transport authentication session state 698 information. (Note that any such use can also be accomplished more 699 easily and safely by including the state in the nonce.) For example, 700 a server could be responsible for authenticating content that 701 actually sits on another server. It would achieve this by having the 702 first 401 response include a domain parameter whose value includes a 703 URI on the second server, and an opaque parameter whose value 704 contains the state information. The client will retry the request, 705 at which time the server might respond with "HTTP Redirection" 706 (Section 6.4 of [RFC7231]), pointing to the URI on the second server. 707 The client will follow the redirection, and pass an Authorization 708 header field, including the data. 710 Proxies MUST be completely transparent in the Digest access 711 authentication scheme. That is, they MUST forward the WWW- 712 Authenticate, Authentication-Info and Authorization header fields 713 untouched. If a proxy wants to authenticate a client before a 714 request is forwarded to the server, it can be done using the Proxy- 715 Authenticate and Proxy-Authorization header fields described in 716 Section 3.8 below. 718 3.7. Security Protocol Negotiation 720 It is useful for a server to be able to know which security schemes a 721 client is capable of handling. 723 It is possible that a server wants to require Digest as its 724 authentication method, even if the server does not know that the 725 client supports it. A client is encouraged to fail gracefully if the 726 server specifies only authentication schemes it cannot handle. 728 When a server receives a request to access a resource, the server 729 might challenge the client by responding with "401 Unauthorized" 730 response, and include one or more WWW-Authenticate header fields. If 731 the server responds with multiple challenges, then each one of these 732 challenges MUST use a different digest algorithm. The server MUST 733 add these challenges to the response in order of preference, starting 734 with the most preferred algorithm, followed by the less preferred 735 algorithm. 737 This specification defines the following algorithms: 739 o SHA2-256 (mandatory to implement) 741 o SHA2-512/256 (as a backup algorithm) 743 o MD5 (for backward compatibility). 745 When the client receives the first challenge it SHOULD use the first 746 challenge it supports, unless a local policy dictates otherwise. 748 3.8. Proxy-Authenticate and Proxy-Authorization 750 The digest authentication scheme can also be used for authenticating 751 users to proxies, proxies to proxies, or proxies to origin servers by 752 use of the Proxy-Authenticate and Proxy-Authorization header fields. 753 These header fields are instances of the Proxy-Authenticate and 754 Proxy-Authorization header fields specified in Sections 4.2 and 4.3 755 of the HTTP/1.1 specification [RFC7235] and their behavior is subject 756 to restrictions described there. The transactions for proxy 757 authentication are very similar to those already described. Upon 758 receiving a request which requires authentication, the proxy/server 759 MUST issue the "407 Proxy Authentication Required" response with a 760 "Proxy-Authenticate" header field. The digest-challenge used in the 761 Proxy-Authenticate header field is the same as that for the WWW- 762 Authenticate header field as defined above in Section 3.3. 764 The client/proxy MUST then re-issue the request with a Proxy- 765 Authorization header field, with parameters as specified for the 766 Authorization header field in Section 3.4 above. 768 On subsequent responses, the server sends Proxy-Authentication-Info 769 with parameters the same as those for the Authentication-Info header 770 field. 772 Note that in principle a client could be asked to authenticate itself 773 to both a proxy and an end-server, but never in the same response. 775 3.9. Examples 777 3.9.1. Example with SHA-256 and MD5 779 The following example assumes that an access protected document is 780 being requested from the server via a GET request. The URI of the 781 document is "http://www.example.org/dir/index.html". Both client and 782 server know that the username for this document is "Mufasa" and the 783 password is "Circle of Life" ( with one space between each of the 784 three words). 786 The first time the client requests the document, no Authorization 787 header field is sent, so the server responds with: 789 HTTP/1.1 401 Unauthorized 790 WWW-Authenticate: Digest 791 realm="http-auth@example.org", 792 qop="auth, auth-int", 793 algorithm=SHA-256, 794 nonce="7ypf/xlj9XXwfDPEoM4URrv/xwf94BcCAzFZH4GiTo0v", 795 opaque="FQhe/qaU925kfnzjCev0ciny7QMkPqMAFRtzCUYo5tdS" 796 WWW-Authenticate: Digest 797 realm="http-auth@example.org", 798 qop="auth, auth-int", 799 algorithm=MD5, 800 nonce="7ypf/xlj9XXwfDPEoM4URrv/xwf94BcCAzFZH4GiTo0v", 801 opaque="FQhe/qaU925kfnzjCev0ciny7QMkPqMAFRtzCUYo5tdS" 803 The client can prompt the user for their username and password, after 804 which it will respond with a new request, including the following 805 Authorization header field if the client chooses MD5 digest: 807 Authorization: Digest username="Mufasa", 808 realm="http-auth@example.org", 809 uri="/dir/index.html", 810 algorithm=MD5, 811 nonce="7ypf/xlj9XXwfDPEoM4URrv/xwf94BcCAzFZH4GiTo0v", 812 nc=00000001, 813 cnonce="f2/wE4q74E6zIJEtWaHKaf5wv/H5QzzpXusqGemxURZJ", 814 qop=auth, 815 response="8ca523f5e9506fed4657c9700eebdbec", 816 opaque="FQhe/qaU925kfnzjCev0ciny7QMkPqMAFRtzCUYo5tdS" 818 If the client chooses to use the SHA-256 algorithm for calculating 819 the response, the client responds with a new request including the 820 following Authorization header field: 822 Authorization: Digest username="Mufasa", 823 realm="http-auth@example.org", 824 uri="/dir/index.html", 825 algorithm=SHA-256, 826 nonce="7ypf/xlj9XXwfDPEoM4URrv/xwf94BcCAzFZH4GiTo0v", 827 nc=00000001, 828 cnonce="f2/wE4q74E6zIJEtWaHKaf5wv/H5QzzpXusqGemxURZJ", 829 qop=auth, 830 response="753927fa0e85d155564e2e272a28d1802ca10daf449 831 6794697cf8db5856cb6c1", 832 opaque="FQhe/qaU925kfnzjCev0ciny7QMkPqMAFRtzCUYo5tdS" 834 3.9.2. Example with SHA-512-256, Charset, and Userhash 836 The following example assumes that an access protected document is 837 being requested from the server via a GET request. The URI for the 838 request is "http://api.example.org/doe.json". Both client and server 839 know the userhash of the username, support the UTF-8 character 840 encoding scheme, and use the SHA-512-256 algorithm. The username for 841 the request is a variation of "Jason Doe", where the the 'a' actually 842 is Unicode code point U+00E4 ("LATIN SMALL LETTER A WITH DIAERES"), 843 and the first 'o' is Unicode code point U+00F8 ("LATIN SMALL LETTER O 844 WITH STROKE"), leading to the octet sequence using the UTF-8 encoding 845 scheme: 847 J U+00E4 s U+00F8 n D o e 848 4A C3A4 73 C3B8 6E 20 44 6F 65 850 The password is "Secret, or not?". 852 The first time the client requests the document, no Authorization 853 header field is sent, so the server responds with: 855 HTTP/1.1 401 Unauthorized 856 WWW-Authenticate: Digest 857 realm="api@example.org", 858 qop="auth", 859 algorithm=SHA-512-256, 860 nonce="5TsQWLVdgBdmrQ0XsxbDODV+57QdFR34I9HAbC/RVvkK", 861 opaque="HRPCssKJSGjCrkzDg8OhwpzCiGPChXYjwrI2QmXDnsOS", 862 charset=UTF-8, 863 userhash=true 865 The client can prompt the user for the required credentials and send 866 a new request with following Authorization header field: 868 Authorization: Digest 869 username="488869477bf257147b804c45308cd62ac4e25eb717 870 b12b298c79e62dcea254ec", 871 realm="api@example.org", 872 uri="/doe.json", 873 algorithm=SHA-512-256, 874 nonce="5TsQWLVdgBdmrQ0XsxbDODV+57QdFR34I9HAbC/RVvkK", 875 nc=00000001, 876 cnonce="NTg6RKcb9boFIAS3KrFK9BGeh+iDa/sm6jUMp2wds69v", 877 qop=auth, 878 response="ae66e67d6b427bd3f120414a82e4acff38e8ecd9101d 879 6c861229025f607a79dd", 880 opaque="HRPCssKJSGjCrkzDg8OhwpzCiGPChXYjwrI2QmXDnsOS", 881 userhash=true 883 If the client can not provide a hashed username for any reason, the 884 client can try a request with this Authorization header field: 886 Authorization: Digest 887 username*=UTF-8''J%C3%A4s%C3%B8n%20Doe, 888 realm="api@example.org", 889 uri="/doe.json", 890 algorithm=SHA-512-256, 891 nonce="5TsQWLVdgBdmrQ0XsxbDODV+57QdFR34I9HAbC/RVvkK", 892 nc=00000001, 893 cnonce="NTg6RKcb9boFIAS3KrFK9BGeh+iDa/sm6jUMp2wds69v", 894 qop=auth, 895 response="ae66e67d6b427bd3f120414a82e4acff38e8ecd9101d6 896 c861229025f607a79dd", 897 opaque="HRPCssKJSGjCrkzDg8OhwpzCiGPChXYjwrI2QmXDnsOS", 898 userhash=false 900 4. Internationalization Considerations 902 In challenges, servers SHOULD use the "charset" authentication 903 parameter (case-insensitive) to express the character encoding they 904 expect the user agent to use when generating A1 (see Section 3.4.2) 905 and username hashing (see Section 3.4.4). 907 The only allowed value is "UTF-8", to be matched case-insensitively 908 (see [RFC2978], Section 2.3). It indicates that the server expects 909 user name and password to be converted to Unicode Normalization Form 910 C ("NFC", see Section 3 of [RFC5198]) and to be encoded into octets 911 using the UTF-8 character encoding scheme [RFC3629]. 913 For the username, recipients MUST support all characters defined in 914 the "UsernameCasePreserved" profile defined in in Section 3.3 of 915 [PRECIS], with the exception of the colon (":") character. 917 For the password, recipients MUST support all characters defined in 918 the "OpaqueString" profile defined in in Section 4.2 of [PRECIS]. 920 If the user agent does not support the encoding indicated by the 921 server, it can fail the request. 923 When usernames can not be sent hashed and include non-ASCII 924 characters, clients can include the "username*" parameter instead 925 (using the value encoding defined in [RFC5987]). 927 5. Security Considerations 929 5.1. Limitations 931 HTTP Digest authentication, when used with human-memorable passwords, 932 is vulnerable to dictionary attacks. Such attacks are much easier 933 than cryptographic attacks on any widely used algorithm, including 934 those that are no longer considered secure. In other words, 935 algorithm agility does not make this usage any more secure. 937 As a result, Digest authentication SHOULD be used only with passwords 938 that have a reasonable amount of entropy, e.g. 128-bit or more. Such 939 passwords typically cannot be memorized by humans but can be used for 940 automated web services. 942 Digest authentication SHOULD be used over a secure channel like HTTPS 943 [RFC2818]. 945 5.2. Storing passwords 947 Digest authentication requires that the authenticating agent (usually 948 the server) store some data derived from the user's name and password 949 in a "password file" associated with a given realm. Normally this 950 might contain pairs consisting of username and H(A1), where H(A1) is 951 the digested value of the username, realm, and password as described 952 above. 954 The security implications of this are that if this password file is 955 compromised, then an attacker gains immediate access to documents on 956 the server using this realm. Unlike, say a standard UNIX password 957 file, this information need not be decrypted in order to access 958 documents in the server realm associated with this file. On the 959 other hand, decryption, or more likely a brute force attack, would be 960 necessary to obtain the user's password. This is the reason that the 961 realm is part of the digested data stored in the password file. It 962 means that if one Digest authentication password file is compromised, 963 it does not automatically compromise others with the same username 964 and password (though it does expose them to brute force attack). 966 There are two important security consequences of this. First the 967 password file must be protected as if it contained unencrypted 968 passwords, because for the purpose of accessing documents in its 969 realm, it effectively does. 971 A second consequence of this is that the realm string SHOULD be 972 unique among all realms which any single user is likely to use. In 973 particular a realm string SHOULD include the name of the host doing 974 the authentication. The inability of the client to authenticate the 975 server is a weakness of Digest Authentication. 977 5.3. Authentication of Clients using Digest Authentication 979 Digest Authentication does not provide a strong authentication 980 mechanism, when compared to public key based mechanisms, for example. 982 However, it is significantly stronger than (e.g.) CRAM-MD5, which 983 has been proposed for use with LDAP [RFC4513], POP and IMAP (see 984 [RFC2195]). It was intended to replace the much weaker and even more 985 dangerous Basic mechanism. 987 Digest Authentication offers no confidentiality protection beyond 988 protecting the actual username and password. All of the rest of the 989 request and response are available to an eavesdropper. 991 Digest Authentication offers only limited integrity protection for 992 the messages in either direction. If qop=auth-int mechanism is used, 993 those parts of the message used in the calculation of the WWW- 994 Authenticate and Authorization header field response parameter values 995 (see Section 3.2 above) are protected. Most header fields and their 996 values could be modified as a part of a man-in-the-middle attack. 998 Many needs for secure HTTP transactions cannot be met by Digest 999 Authentication. For those needs TLS is more appropriate protocol. 1000 In particular Digest authentication cannot be used for any 1001 transaction requiring confidentiality protection. Nevertheless many 1002 functions remain for which Digest authentication is both useful and 1003 appropriate. 1005 5.4. Limited Use Nonce Values 1007 The Digest scheme uses a server-specified nonce to seed the 1008 generation of the response value (as specified in Section 3.4.1 1009 above). As shown in the example nonce in Section 3.3, the server is 1010 free to construct the nonce such that it MAY only be used from a 1011 particular client, for a particular resource, for a limited period of 1012 time or number of uses, or any other restrictions. Doing so 1013 strengthens the protection provided against, for example, replay 1014 attacks (see 4.5). However, it should be noted that the method 1015 chosen for generating and checking the nonce also has performance and 1016 resource implications. For example, a server MAY choose to allow 1017 each nonce value to be used only once by maintaining a record of 1018 whether or not each recently issued nonce has been returned and 1019 sending a next-nonce parameter in the Authentication-Info header 1020 field of every response. This protects against even an immediate 1021 replay attack, but has a high cost checking nonce values, and perhaps 1022 more important will cause authentication failures for any pipelined 1023 requests (presumably returning a stale nonce indication). Similarly, 1024 incorporating a request-specific element such as the Etag value for a 1025 resource limits the use of the nonce to that version of the resource 1026 and also defeats pipelining. Thus it MAY be useful to do so for 1027 methods with side effects but have unacceptable performance for those 1028 that do not. 1030 5.5. Replay Attacks 1032 A replay attack against Digest authentication would usually be 1033 pointless for a simple GET request since an eavesdropper would 1034 already have seen the only document he could obtain with a replay. 1035 This is because the URI of the requested document is digested in the 1036 client request and the server will only deliver that document. By 1037 contrast under Basic Authentication once the eavesdropper has the 1038 user's password, any document protected by that password is open to 1039 him. 1041 Thus, for some purposes, it is necessary to protect against replay 1042 attacks. A good Digest implementation can do this in various ways. 1043 The server created "nonce" value is implementation dependent, but if 1044 it contains a digest of the client IP, a time-stamp, the resource 1045 ETag, and a private server key (as recommended above) then a replay 1046 attack is not simple. An attacker must convince the server that the 1047 request is coming from a false IP address and must cause the server 1048 to deliver the document to an IP address different from the address 1049 to which it believes it is sending the document. An attack can only 1050 succeed in the period before the time-stamp expires. Digesting the 1051 client IP and time-stamp in the nonce permits an implementation which 1052 does not maintain state between transactions. 1054 For applications where no possibility of replay attack can be 1055 tolerated the server can use one-time nonce values which will not be 1056 honored for a second use. This requires the overhead of the server 1057 remembering which nonce values have been used until the nonce time- 1058 stamp (and hence the digest built with it) has expired, but it 1059 effectively protects against replay attacks. 1061 An implementation must give special attention to the possibility of 1062 replay attacks with POST and PUT requests. Unless the server employs 1063 one-time or otherwise limited-use nonces and/or insists on the use of 1064 the integrity protection of qop=auth-int, an attacker could replay 1065 valid credentials from a successful request with counterfeit form 1066 data or other message body. Even with the use of integrity 1067 protection most metadata in header fields is not protected. Proper 1068 nonce generation and checking provides some protection against replay 1069 of previously used valid credentials, but see 4.8. 1071 5.6. Weakness Created by Multiple Authentication Schemes 1073 An HTTP/1.1 server MAY return multiple challenges with a 401 1074 (Authenticate) response, and each challenge MAY use a different auth- 1075 scheme. A user agent MUST choose to use the strongest auth-scheme it 1076 understands and request credentials from the user based upon that 1077 challenge. 1079 Note that many browsers will only recognize Basic and will require 1080 that it be the first auth-scheme presented. Servers SHOULD only 1081 include Basic if it is minimally acceptable. 1083 When the server offers choices of authentication schemes using the 1084 WWW-Authenticate header field, the strength of the resulting 1085 authentication is only as good as that of the of the weakest of the 1086 authentication schemes. See Section 5.7 below for discussion of 1087 particular attack scenarios that exploit multiple authentication 1088 schemes. 1090 5.7. Online dictionary attacks 1092 If the attacker can eavesdrop, then it can test any overheard nonce/ 1093 response pairs against a list of common words. Such a list is 1094 usually much smaller than the total number of possible passwords. 1095 The cost of computing the response for each password on the list is 1096 paid once for each challenge. 1098 The server can mitigate this attack by not allowing users to select 1099 passwords that are in a dictionary. 1101 5.8. Man in the Middle 1103 Digest authentication is vulnerable to "man in the middle" (MITM) 1104 attacks, for example, from a hostile or compromised proxy. Clearly, 1105 this would present all the problems of eavesdropping. But it also 1106 offers some additional opportunities to the attacker. 1108 A possible man-in-the-middle attack would be to add a weak 1109 authentication scheme to the set of choices, hoping that the client 1110 will use one that exposes the user's credentials (e.g. password). 1111 For this reason, the client SHOULD always use the strongest scheme 1112 that it understands from the choices offered. 1114 An even better MITM attack would be to remove all offered choices, 1115 replacing them with a challenge that requests only Basic 1116 authentication, then uses the cleartext credentials from the Basic 1117 authentication to authenticate to the origin server using the 1118 stronger scheme it requested. A particularly insidious way to mount 1119 such a MITM attack would be to offer a "free" proxy caching service 1120 to gullible users. 1122 User agents should consider measures such as presenting a visual 1123 indication at the time of the credentials request of what 1124 authentication scheme is to be used, or remembering the strongest 1125 authentication scheme ever requested by a server and produce a 1126 warning message before using a weaker one. It might also be a good 1127 idea for the user agent to be configured to demand Digest 1128 authentication in general, or from specific sites. 1130 Or, a hostile proxy might spoof the client into making a request the 1131 attacker wanted rather than one the client wanted. Of course, this 1132 is still much harder than a comparable attack against Basic 1133 Authentication. 1135 5.9. Chosen plaintext attacks 1137 With Digest authentication, a MITM or a malicious server can 1138 arbitrarily choose the nonce that the client will use to compute the 1139 response. This is called a "chosen plaintext" attack. The ability 1140 to choose the nonce is known to make cryptanalysis much easier. 1142 However, no way to analyze the one-way functions used by Digest using 1143 chosen plaintext is currently known. 1145 The countermeasure against this attack is for clients to use the 1146 "cnonce" parameter; this allows the client to vary the input to the 1147 hash in a way not chosen by the attacker. 1149 5.10. Precomputed dictionary attacks 1151 With Digest authentication, if the attacker can execute a chosen 1152 plaintext attack, the attacker can precompute the response for many 1153 common words to a nonce of its choice, and store a dictionary of 1154 (response, password) pairs. Such precomputation can often be done in 1155 parallel on many machines. It can then use the chosen plaintext 1156 attack to acquire a response corresponding to that challenge, and 1157 just look up the password in the dictionary. Even if most passwords 1158 are not in the dictionary, some might be. Since the attacker gets to 1159 pick the challenge, the cost of computing the response for each 1160 password on the list can be amortized over finding many passwords. A 1161 dictionary with 100 million password/response pairs would take about 1162 3.2 gigabytes of disk storage. 1164 The countermeasure against this attack is to for clients to use the 1165 "cnonce" parameter. 1167 5.11. Batch brute force attacks 1169 With Digest authentication, a MITM can execute a chosen plaintext 1170 attack, and can gather responses from many users to the same nonce. 1171 It can then find all the passwords within any subset of password 1172 space that would generate one of the nonce/response pairs in a single 1173 pass over that space. It also reduces the time to find the first 1174 password by a factor equal to the number of nonce/response pairs 1175 gathered. This search of the password space can often be done in 1176 parallel on many machines, and even a single machine can search large 1177 subsets of the password space very quickly -- reports exist of 1178 searching all passwords with six or fewer letters in a few hours. 1180 The countermeasure against this attack is to for clients to use of 1181 the "cnonce" parameter. 1183 5.12. Summary 1185 By modern cryptographic standards Digest Authentication is weak. But 1186 for a large range of purposes it is valuable as a replacement for 1187 Basic Authentication. It remedies some, but not all, weaknesses of 1188 Basic Authentication. Its strength may vary depending on the 1189 implementation. In particular the structure of the nonce (which is 1190 dependent on the server implementation) may affect the ease of 1191 mounting a replay attack. A range of server options is appropriate 1192 since, for example, some implementations may be willing to accept the 1193 server overhead of one-time nonces or digests to eliminate the 1194 possibility of replay. Others may satisfied with a nonce like the 1195 one recommended above restricted to a single IP address and a single 1196 ETag or with a limited lifetime. 1198 The bottom line is that *any* compliant implementation will be 1199 relatively weak by cryptographic standards, but *any* compliant 1200 implementation will be far superior to Basic Authentication. 1202 6. IANA Considerations 1204 6.1. HTTP Digest Hash Algorithms Registry 1206 This specification creates a new IANA registry named "HTTP Digest 1207 Hash Algorithms". When registering a new hash algorithm, the 1208 following information MUST be provided: 1210 Hash Algorithm 1212 The textual name of the hash algorithm. 1214 Digest Size 1216 The size of the algorithm's output in bits. 1218 Reference 1220 A reference to the specification that describes the new algorithm. 1222 The update policy for this registry shall be Specification Required. 1224 The initial registry will contain the following entries: 1226 +----------------+-------------+-----------+ 1227 | Hash Algorithm | Digest Size | Reference | 1228 +----------------+-------------+-----------+ 1229 | "MD5" | 128 | RFC XXXX | 1230 | "SHA-512-256" | 256 | RFC XXXX | 1231 | "SHA-256" | 256 | RFC XXXX | 1232 +----------------+-------------+-----------+ 1234 Each one of the algorithms defined in the registry might have a -sess 1235 variant, e.g. MD5-sess, SHA-256-sess, etc. 1237 6.2. Digest Scheme Registration 1239 This specification registers the Digest scheme with the 1240 Authentication Scheme Registry. 1242 Authentication Scheme Name: Digest 1244 Pointer to specification text: this specification 1246 7. Acknowledgments 1248 The authors of this document would like to thank the authors of 1249 [RFC2617], as this document heavily borrows text from their document 1250 to provide a complete description of the digest scheme and its 1251 operations. 1253 Special thanks to Julian Reschke for his many reviews, comments, 1254 suggestions, and text provided to various areas in this document. 1256 The authors would like to thank Stephen Farrell, Yoav Nir, Phillip 1257 Hallam-Baker, Manu Sporny, Paul Hoffman, Yaron Sheffer, Sean Turner, 1258 Geoff Baskwill, Eric Cooper, Bjoern Hoehrmann, Martin Durst, Peter 1259 Saint-Andre, Michael Sweet, Daniel Stenberg, Brett Tate, Paul Leach, 1260 Ilari Liusvaara, and Gary Mort, Alexey Melnikov, and Benjamin Kaduk 1261 for their careful review and comments. 1263 The authors would like to thank Jonathan Stoke, Nico Williams, Harry 1264 Halpin, and Phil Hunt for their comments on the mailing list when 1265 discussing various aspects of this document. 1267 The authors would like to thank Paul Kyzivat and Dale Worley for 1268 their careful review and feedback on some aspects of this document. 1270 8. References 1272 8.1. Normative References 1274 [AUTHINFO] 1275 Reschke, J., "The Hypertext Transfer Protocol (HTTP) 1276 Authentication-Info and Proxy-Authentication-Info Response 1277 Header Fields", draft-ietf-httpbis-auth-info-02 (work in 1278 progress), February 2015. 1280 [PRECIS] Saint-Andre, P. and A. Melnikov, "Preparation, 1281 Enforcement, and Comparison of Internationalized Strings 1282 Representing Usernames and Passwords", draft-ietf-precis- 1283 saslprepbis-12 (work in progress), December 2014. 1285 [RFC2119] Bradner, S., "Key words for use in RFCs to Indicate 1286 Requirement Levels", BCP 14, RFC 2119, March 1997. 1288 [RFC2978] Freed, N. and J. Postel, "IANA Charset Registration 1289 Procedures", BCP 19, RFC 2978, October 2000. 1291 [RFC3629] Yergeau, F., "UTF-8, a transformation format of ISO 1292 10646", STD 63, RFC 3629, November 2003. 1294 [RFC3986] Berners-Lee, T., Fielding, R., and L. Masinter, "Uniform 1295 Resource Identifier (URI): Generic Syntax", STD 66, RFC 1296 3986, January 2005. 1298 [RFC4086] Eastlake, D., Schiller, J., and S. Crocker, "Randomness 1299 Requirements for Security", BCP 106, RFC 4086, June 2005. 1301 [RFC5198] Klensin, J. and M. Padlipsky, "Unicode Format for Network 1302 Interchange", RFC 5198, March 2008. 1304 [RFC5234] Crocker, D., Ed. and P. Overell, "Augmented BNF for Syntax 1305 Specifications: ABNF", STD 68, RFC 5234, January 2008. 1307 [RFC5987] Reschke, J., "Character Set and Language Encoding for 1308 Hypertext Transfer Protocol (HTTP) Header Field 1309 Parameters", RFC 5987, August 2010. 1311 [RFC6454] Barth, A., "The Web Origin Concept", RFC 6454, December 1312 2011. 1314 [RFC7230] Fielding, R., Ed. and J. Reschke, Ed., "Hypertext Transfer 1315 Protocol (HTTP/1.1): Message Syntax and Routing", RFC 1316 7230, June 2014. 1318 [RFC7231] Fielding, R., Ed. and J. Reschke, Ed., "Hypertext Transfer 1319 Protocol (HTTP/1.1): Semantics and Content", RFC 7231, 1320 June 2014. 1322 [RFC7234] Fielding, R., Ed., Nottingham, M., Ed., and J. Reschke, 1323 Ed., "Hypertext Transfer Protocol (HTTP/1.1): Caching", 1324 RFC 7234, June 2014. 1326 [RFC7235] Fielding, R., Ed. and J. Reschke, Ed., "Hypertext Transfer 1327 Protocol (HTTP/1.1): Authentication", RFC 7235, June 2014. 1329 8.2. Informative References 1331 [BASIC] Reschke, J., "The 'Basic' HTTP Authentication Scheme", 1332 draft-ietf-httpauth-basicauth-update-04 (work in 1333 progress), December 2014. 1335 [RFC2195] Klensin, J., Catoe, R., and P. Krumviede, "IMAP/POP 1336 AUTHorize Extension for Simple Challenge/Response", RFC 1337 2195, September 1997. 1339 [RFC2617] Franks, J., Hallam-Baker, P., Hostetler, J., Lawrence, S., 1340 Leach, P., Luotonen, A., and L. Stewart, "HTTP 1341 Authentication: Basic and Digest Access Authentication", 1342 RFC 2617, June 1999. 1344 [RFC2818] Rescorla, E., "HTTP Over TLS", RFC 2818, May 2000. 1346 [RFC4513] Harrison, R., "Lightweight Directory Access Protocol 1347 (LDAP): Authentication Methods and Security Mechanisms", 1348 RFC 4513, June 2006. 1350 Appendix A. Changes from RFC 2617 1352 This document introduces the following changes: 1354 o Adds support for two new algorithms, SHA2-256 as mandatory and 1355 SHA2-512/256 as a backup, and defines the proper algorithm 1356 negotitation. The document keeps the MD5 algorithm support but 1357 only for backward compatibility. 1359 o Introduces the username hashing capability and the parameter 1360 associated with that, mainly for privacy reasons. 1362 o Adds various internationalization considerations that impact the 1363 A1 calculation and username and password encoding. 1365 Authors' Addresses 1367 Rifaat Shekh-Yusef (editor) 1368 Avaya 1369 250 Sidney Street 1370 Belleville, Ontario 1371 Canada 1373 Phone: +1-613-967-5267 1374 EMail: rifaat.ietf@gmail.com 1376 David Ahrens 1377 Independent 1378 California 1379 USA 1381 EMail: ahrensdc@gmail.com 1383 Sophie Bremer 1384 Netzkonform 1385 Germany 1387 EMail: sophie.bremer@netzkonform.de