idnits 2.17.1 draft-ietf-httpauth-digest-13.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 (February 2, 2015) is 3371 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-00 == 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: August 6, 2015 S. Bremer 7 Netzkonform 8 February 2, 2015 10 HTTP Digest Access Authentication 11 draft-ietf-httpauth-digest-13 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 August 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 . . . . . . . . . . . . . . . . . . . . . . 3 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 . . . . . . . . . 11 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 . . . . . . . . . . . . . . . . . . . . 14 91 3.7. Security Protocol Negotiation . . . . . . . . . . . . . . 15 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 . . . . . . . . . . . . . 19 98 5. Security Considerations . . . . . . . . . . . . . . . . . . . 20 99 5.1. Limitations . . . . . . . . . . . . . . . . . . . . . . . 20 100 5.2. Storing passwords . . . . . . . . . . . . . . . . . . . . 20 101 5.3. Authentication of Clients using Digest Authentication . . 21 102 5.4. Limited Use Nonce Values . . . . . . . . . . . . . . . . 21 103 5.5. Replay Attacks . . . . . . . . . . . . . . . . . . . . . 22 104 5.6. Weakness Created by Multiple Authentication Schemes . . . 23 105 5.7. Online dictionary attacks . . . . . . . . . . . . . . . . 23 106 5.8. Man in the Middle . . . . . . . . . . . . . . . . . . . . 23 107 5.9. Chosen plaintext attacks . . . . . . . . . . . . . . . . 24 108 5.10. Precomputed dictionary attacks . . . . . . . . . . . . . 24 109 5.11. Batch brute force attacks . . . . . . . . . . . . . . . . 25 110 5.12. Summary . . . . . . . . . . . . . . . . . . . . . . . . . 25 111 6. IANA Considerations . . . . . . . . . . . . . . . . . . . . . 26 112 6.1. HTTP Digest Hash Algorithms Registry . . . . . . . . . . 26 113 6.2. Digest Scheme Registration . . . . . . . . . . . . . . . 26 114 7. Acknowledgments . . . . . . . . . . . . . . . . . . . . . . . 27 115 8. References . . . . . . . . . . . . . . . . . . . . . . . . . 27 116 8.1. Normative References . . . . . . . . . . . . . . . . . . 27 117 8.2. Informative References . . . . . . . . . . . . . . . . . 28 119 1. Introduction 121 HTTP provides a simple challenge-response authentication mechanism 122 that may be used by a server to challenge a client request and by a 123 client to provide authentication information. This document defines 124 the HTTP Digest Authentication scheme that can be used with the HTTP 125 authentication mechanism. 127 The details of the challenge-response authentication mechanism are 128 specified in the "Hypertext Transfer Protocol (HTTP/1.1): 129 Authentication" [RFC7235]. 131 The combination of this document with the definition of the "Basic" 132 authentication scheme [BASIC] and [RFC7235] obsolete [RFC2617]. 134 1.1. Terminology 136 The key words "MUST", "MUST NOT", "REQUIRED", "SHALL", "SHALL NOT", 137 "SHOULD", "SHOULD NOT", "RECOMMENDED", "MAY", and "OPTIONAL" in this 138 document are to be interpreted as described in [RFC2119]. 140 2. Syntax Convention 141 2.1. Examples 143 In the interest of clarity and readability, the extended parameters 144 or the header fields and parameters in the examples in this document 145 might be broken into multiple lines. Any line that is indented in 146 this document is a continuation of the preceding line. 148 2.2. ABNF 150 This specification uses the Augmented Backus-Naur Form (ABNF) 151 notation of [RFC5234], and the ABNF List Extension of [RFC7230]. 153 3. Digest Access Authentication Scheme 155 3.1. Overall Operation 157 The Digest scheme is based on a simple challenge-response paradigm. 158 The Digest scheme challenges using a nonce value, and might indicate 159 that username hashing is supported. A valid response contains a 160 checksum of the username, the password, the given nonce value, the 161 HTTP method, and the requested URI. In this way, the password is 162 never sent in the clear, and the username can be hashed, depending on 163 the indication received from the server. The username and password 164 must be prearranged in some fashion not addressed by this document. 166 The security of this protocol is critically dependent on the 167 randomness of the randomly chosen parameters, such as client and 168 server nonces. These should be generated by a strong random or 169 properly seeded pseudorandom source (see [RFC4086]). 171 3.2. Representation of Digest Values 173 An optional header field allows the server to specify the algorithm 174 used to create the checksum or digest. This documents adds SHA-256 175 and SHA-512/256 algorithms. To maintain backwards compatibility with 176 [RFC2617], the MD5 algorithm is still supported but NOT RECOMMENDED. 178 The size of the digest depends on the algorithm used. The bits in 179 the digest are converted from the most significant to the least 180 significant bit, four bits at a time to the ASCII representation as 181 follows. Each four bits is represented by its familiar hexadecimal 182 notation from the characters 0123456789abcdef, that is binary 0000 is 183 represented by the character '0', 0001 by '1' and so on up to the 184 representation of 1111 as 'f'. If the MD5 algorithm is used to 185 calculate the digest, then the MD5 digest will be represented as 32 186 hexadecimal characters, while SHA-256 and SHA-512/256 are represented 187 as 64 hexadecimal characters. 189 3.3. The WWW-Authenticate Response Header Field 191 If a server receives a request for an access-protected object, and an 192 acceptable Authorization header field is not sent, the server 193 responds with a "401 Unauthorized" status code and a WWW-Authenticate 194 header field with Digest scheme as per the framework defined above. 195 The value of the header field can include parameters from the 196 following list: 198 realm 200 A string to be displayed to users so they know which username and 201 password to use. This string should contain at least the name of 202 the host performing the authentication and might additionally 203 indicate the collection of users who might have access. An 204 example might be "registered_users@gotham.news.com". (See 205 Section 2.2 of [RFC7235] for more details). 207 domain 209 A quoted, space-separated list of URIs, as specified in [RFC3986], 210 that define the protection space. If a URI is an abs_path, it is 211 relative to the canonical root URL (See Section 2.2 of [RFC7235]). 212 An absolute-URI in this list may refer to a different server than 213 the web-origin [RFC6454]. The client can use this list to 214 determine the set of URIs for which the same authentication 215 information may be sent: any URI that has a URI in this list as a 216 prefix (after both have been made absolute) MAY be assumed to be 217 in the same protection space. If this parameter is omitted or its 218 value is empty, the client SHOULD assume that the protection space 219 consists of all URIs on the web-origin. 221 This parameter is not meaningful in Proxy-Authenticate header 222 fields, for which the protection space is always the entire proxy; 223 if present it MUST be ignored. 225 nonce 227 A server-specified data string which should be uniquely generated 228 each time a 401 response is made. It is advised that this string 229 be base64 or hexadecimal data. Specifically, since the string is 230 passed in the header field lines as a quoted string, the double- 231 quote character is not allowed, unless suitably escaped. 233 The contents of the nonce are implementation dependent. The 234 quality of the implementation depends on a good choice. A nonce 235 might, for example, be constructed as the base 64 encoding of 236 time-stamp H(time-stamp ":" ETag ":" secret-data) 238 where time-stamp is a server-generated time, which preferably 239 includes micro or nano seconds, or other non-repeating values, 240 ETag is the value of the HTTP ETag header field associated with 241 the requested entity, and secret-data is data known only to the 242 server. With a nonce of this form a server would recalculate the 243 hash portion after receiving the client authentication header 244 field and reject the request if it did not match the nonce from 245 that header field or if the time-stamp value is not recent enough. 246 In this way the server can limit the time of the nonce's validity. 247 The inclusion of the ETag prevents a replay request for an updated 248 version of the resource. Including the IP address of the client 249 in the nonce would appear to offer the server the ability to limit 250 the reuse of the nonce to the same client that originally got it. 251 However, that would break when requests from a single user often 252 go through different proxies. Also, IP address spoofing is not 253 that hard. 255 An implementation might choose not to accept a previously used 256 nonce or a previously used digest, in order to protect against a 257 replay attack. Or, an implementation might choose to use one-time 258 nonces or digests for POST or PUT requests and a time-stamp for 259 GET requests. For more details on the issues involved see 260 Section 5 of this document. 262 The nonce is opaque to the client. 264 opaque 266 A string of data, specified by the server, which SHOULD be 267 returned by the client unchanged in the Authorization header field 268 of subsequent requests with URIs in the same protection space. It 269 is RECOMMENDED that this string be base64 or hexadecimal data. 271 stale 273 A case-insensitive flag indicating that the previous request from 274 the client was rejected because the nonce value was stale. If 275 stale is TRUE, the client may wish to simply retry the request 276 with a new encrypted response, without re-prompting the user for a 277 new username and password. The server SHOULD only set stale to 278 TRUE if it receives a request for which the nonce is invalid. If 279 stale is FALSE, or anything other than TRUE, or the stale 280 parameter is not present, the username and/or password are 281 invalid, and new values MUST be obtained. 283 algorithm 284 A string indicating a pair of algorithms used to produce the 285 digest and a checksum. If this is not present it is assumed to be 286 "MD5". If the algorithm is not understood, the challenge SHOULD 287 be ignored (and a different one used, if there is more than one). 289 When used with the Digest mechanism, each one of the algorithms 290 has two variants: Session variant and non-Session variant. The 291 non-Session variant is denoted by "", e.g. "SHA-256", 292 and the Session variant is denoted by "-sess", e.g. 293 "SHA-256-sess". 295 In this document the string obtained by applying the digest 296 algorithm to the data "data" with secret "secret" will be denoted 297 by KD(secret, data), and the string obtained by applying the 298 checksum algorithm to the data "data" will be denoted H(data). 299 The notation unq(X) means the value of the quoted-string X without 300 the surrounding quotes and with quoting slashes removed. 302 For "" and "-sess" 304 H(data) = (data) 306 and 308 KD(secret, data) = H(concat(secret, ":", data)) 310 For example: 312 For the "SHA-256" and "SHA-256-sess" algorithms 314 H(data) = SHA-256(data) 316 i.e., the digest is the "" of the secret concatenated 317 with a colon concatenated with the data. The "-sess" 318 algorithm is intended to allow efficient 3rd party authentication 319 servers; for the difference in usage, see the description in 320 Section 3.4.2. 322 qop 324 This parameter MUST be used by all implementations. It is a 325 quoted string of one or more tokens indicating the "quality of 326 protection" values supported by the server. The value "auth" 327 indicates authentication; the value "auth-int" indicates 328 authentication with integrity protection; see the descriptions 329 below for calculating the response parameter value for the 330 application of this choice. Unrecognized options MUST be ignored. 332 charset 334 This is an OPTIONAL parameter that is used by the server to 335 indicate the encoding scheme it supports. 337 userhash 339 This is an OPTIONAL parameter that is used by the server to 340 indicate that it supports username hashing. Valid values are: 341 "true" or "false". Default value is "false". 343 For historical reasons, a sender MUST only generate the quoted-string 344 syntax values for the following parameters: realm, domain, nonce, 345 opaque, and qop. 347 For historical reasons, a sender MUST NOT generate the quoted-string 348 syntax values for the following parameters: stale and algorithm. 350 3.4. The Authorization Request Header Field 352 The client is expected to retry the request, passing an Authorization 353 header field line with Digest scheme, which is defined according to 354 the framework above. The values of the opaque and algorithm fields 355 must be those supplied in the WWW-Authenticate response header field 356 for the entity being requested. 358 The request can include parameters from the following list: 360 response 362 A string of the hex digits computed as defined below, which proves 363 that the user knows a password. 365 username 367 The user's name in the specified realm. If the username contains 368 characters not allowed inside the ABNF token or quoted-string 369 forms, it can be sent in a "username*" parameter instead, using 370 the encoding defined in [RFC5987]. Sending both "username" and 371 "username*" MUST be treated as error. 373 uri 375 The Effective Request URI (Section 5.5 of [RFC7230]) of the HTTP 376 request; duplicated here because proxies are allowed to change the 377 request target ("request-target", Section 3.1.1 of [RFC7230]) in 378 transit. 380 qop 382 Indicates what "quality of protection" the client has applied to 383 the message. Its value MUST be one of the alternatives the server 384 indicated it supports in the WWW-Authenticate header field. These 385 values affect the computation of the response. Note that this is 386 a single token, not a quoted list of alternatives as in WWW- 387 Authenticate. 389 cnonce 391 This parameter MUST be used by all implementations. The cnonce 392 value is an opaque quoted ASCII-only string value provided by the 393 client and used by both client and server to avoid chosen 394 plaintext attacks, to provide mutual authentication, and to 395 provide some message integrity protection. See the descriptions 396 below of the calculation of the rspauth and response values. 398 nc 400 This parameter MUST be used by all implementations. The "nc" 401 parameter stands for "nonce count". The nc value is the 402 hexadecimal count of the number of requests (including the current 403 request) that the client has sent with the nonce value in this 404 request. For example, in the first request sent in response to a 405 given nonce value, the client sends "nc=00000001". The purpose of 406 this parameter is to allow the server to detect request replays by 407 maintaining its own copy of this count - if the same nc value is 408 seen twice, then the request is a replay. See the description 409 below of the construction of the response value. 411 userhash 413 This OPTIONAL parameter is used by the client to indicate that the 414 username has been hashed. Valid values are: "true" or "false". 415 Default value is "false". 417 For historical reasons, a sender MUST only generate the quoted-string 418 syntax for the following parameters: username, realm, nonce, uri, 419 response, cnonce, and opaque. 421 For historical reasons, a sender MUST NOT generate the quoted-string 422 syntax for the following parameters: algorithm, qop, and nc. 424 If a parameter or its value is improper, or required parameters are 425 missing, the proper response is a 4xx error code. If the response is 426 invalid, then a login failure SHOULD be logged, since repeated login 427 failures from a single client may indicate an attacker attempting to 428 guess passwords. The server implementation SHOULD be careful with 429 the information being logged so that it won't put a cleartext 430 password (e.g. entered into the username field) into the log. 432 The definition of the response above indicates the encoding for its 433 value. The following definitions show how the value is computed. 435 3.4.1. Response 437 If the "qop" value is "auth" or "auth-int": 439 response = <"> < KD ( H(A1), unq(nonce) 440 ":" nc 441 ":" unq(cnonce) 442 ":" unq(qop) 443 ":" H(A2) 444 ) <"> 446 See below for the definitions for A1 and A2. 448 3.4.2. A1 450 If the "algorithm" parameter's value is "", e.g. "SHA- 451 256", then A1 is: 453 A1 = unq(username) ":" unq(realm) ":" passwd 455 where 457 passwd = < user's password > 459 If the "algorithm" parameter's value is "-sess", e.g. 460 "SHA-256-sess", then A1 is calculated using the nonce value provided 461 in the challenge from the server, and cnounce value from the request 462 by the client following receipt of a WWW-Authenticate challenge from 463 the server. It uses the server nonce from that challenge, herein 464 called nonce-prime, and the client nonce value from the response, 465 herein called cnonce-prime, to construct A1 as follows: 467 A1 = H( unq(username) ":" unq(realm) 468 ":" passwd ) 469 ":" unq(nonce-prime) ":" unq(cnonce-prime) 471 This creates a "session key" for the authentication of subsequent 472 requests and responses which is different for each "authentication 473 session", thus limiting the amount of material hashed with any one 474 key. (Note: see further discussion of the authentication session in 475 Section 3.6.) Because the server need only use the hash of the user 476 credentials in order to create the A1 value, this construction could 477 be used in conjunction with a third party authentication service so 478 that the web server would not need the actual password value. The 479 specification of such a protocol is beyond the scope of this 480 specification. 482 3.4.3. A2 484 If the "qop" parameter's value is "auth" or is unspecified, then A2 485 is: 487 A2 = Method ":" request-uri 489 If the "qop" value is "auth-int", then A2 is: 491 A2 = Method ":" request-uri ":" H(entity-body) 493 3.4.4. Username Hashing 495 To protect the transport of the username from the client to the 496 server, the server SHOULD set the "userhash" parameter with the value 497 of "true" in the WWW-Authentication header field. 499 If the client supports the "userhash" parameter, and the "userhash" 500 parameter value in the WWW-Authentication header field is set to 501 "true", then the client MUST calculate a hash of the username after 502 any other hash calculation and include the "userhash" parameter with 503 the value of "true" in the Authorization Request Header field. If 504 the client does not provide the "username" as a hash value or the 505 "userhash" parameter with the value of "true", the server MAY reject 506 the request. 508 The following is the operation that the client will take to hash the 509 username, using the same algorithm used to hash the credentials: 511 username = H( unq(username) ":" unq(realm) ) 513 3.4.5. Parameter Values and Quoted-String 515 Note that the value of many of the parameters, such as "username" 516 value, are defined as a "quoted-string". However, the "unq" notation 517 indicates that surrounding quotation marks are removed in forming the 518 string A1. Thus if the Authorization header field includes the 519 fields 521 username="Mufasa", realm=myhost@testrealm.com 523 and the user Mufasa has password "Circle Of Life" then H(A1) would be 524 H(Mufasa:myhost@testrealm.com:Circle Of Life) with no quotation marks 525 in the digested string. 527 No white space is allowed in any of the strings to which the digest 528 function H() is applied unless that white space exists in the quoted 529 strings or entity body whose contents make up the string to be 530 digested. For example, the string A1 illustrated above must be 532 Mufasa:myhost@testrealm.com:Circle Of Life 534 with no white space on either side of the colons, but with the white 535 space between the words used in the password value. Likewise, the 536 other strings digested by H() must not have white space on either 537 side of the colons which delimit their fields unless that white space 538 was in the quoted strings or entity body being digested. 540 Also note that if integrity protection is applied (qop=auth-int), the 541 H(entity-body) is the hash of the entity body, not the message body - 542 it is computed before any transfer encoding is applied by the sender 543 and after it has been removed by the recipient. Note that this 544 includes multipart boundaries and embedded header fields in each part 545 of any multipart content-type. 547 3.4.6. Various Considerations 549 The "Method" value is the HTTP request method, in US-ASCII letters, 550 as specified in Section 3.1.1 of [RFC7230]. The "request-target" 551 value is the request-target from the request line as specified in 552 Section 3.1.1 of [RFC7230]. This MAY be "*", an "absolute-URI" or an 553 "absolute-path" as specified in Section 2.7 of [RFC7230], but it MUST 554 agree with the request-target. In particular, it MUST be an 555 "absolute-URI" if the request-target is an "absolute-URI". The 556 "cnonce" value is a client-chosen value whose purpose is to foil 557 chosen plaintext attacks. 559 The authenticating server MUST assure that the resource designated by 560 the "uri" parameter is the same as the resource specified in the 561 Request-Line; if they are not, the server SHOULD return a 400 Bad 562 Request error. (Since this may be a symptom of an attack, server 563 implementers may want to consider logging such errors.) The purpose 564 of duplicating information from the request URL in this field is to 565 deal with the possibility that an intermediate proxy may alter the 566 client's Request-Line. This altered (but presumably semantically 567 equivalent) request would not result in the same digest as that 568 calculated by the client. 570 Implementers should be aware of how authenticated transactions need 571 to interact with shared caches (see [RFC7234]). 573 3.5. The Authentication-Info and Proxy-Authentication-Info Header 574 Fields 576 The Authentication-Info header field and the Proxy-Authentication- 577 Info header field [AUTHINFO] are generic fields that MAY be used by a 578 server to communicate some information regarding the successful 579 authentication of a client response. 581 The Digest authentication scheme MAY add the Authentication-Info 582 header field in the confirmation request and include parameters from 583 the following list: 585 nextnonce 587 The value of the nextnonce parameter is the nonce the server 588 wishes the client to use for a future authentication response. 589 The server MAY send the Authentication-Info header field with a 590 nextnonce field as a means of implementing one-time or otherwise 591 changing nonces. If the nextnonce field is present the client 592 SHOULD use it when constructing the Authorization header field for 593 its next request. Failure of the client to do so MAY result in a 594 request to re-authenticate from the server with the "stale=TRUE". 596 Server implementations SHOULD carefully consider the 597 performance implications of the use of this mechanism; 598 pipelined requests will not be possible if every response 599 includes a nextnonce parameter that MUST be used on the next 600 request received by the server. Consideration SHOULD be given 601 to the performance vs. security tradeoffs of allowing an old 602 nonce value to be used for a limited time to permit request 603 pipelining. Use of the "nc" parameter can retain most of the 604 security advantages of a new server nonce without the 605 deleterious affects on pipelining. 607 qop 609 Indicates the "quality of protection" options applied to the 610 response by the server. The value "auth" indicates 611 authentication; the value "auth-int" indicates authentication with 612 integrity protection. The server SHOULD use the same value for 613 the qop parameter in the response as was sent by the client in the 614 corresponding request. 616 rspauth 617 The optional response digest in the "rspauth" parameter supports 618 mutual authentication -- the server proves that it knows the 619 user's secret, and with qop=auth-int also provides limited 620 integrity protection of the response. The "rspauth" value is 621 calculated as for the response in the Authorization header field, 622 except that if "qop=auth" or is not specified in the Authorization 623 header field for the request, A2 is 625 A2 = ":" request-uri 627 and if "qop=auth-int", then A2 is 629 A2 = ":" request-uri ":" H(entity-body) 631 cnonce and nc 633 The "cnonce" value and "nc" value MUST be the ones for the client 634 request to which this message is the response. The "rspauth", 635 "cnonce", and "nc" parameters MUST be present if "qop=auth" or 636 "qop=auth-int" is specified. 638 The Authentication-Info header field is allowed in the trailer of an 639 HTTP message transferred via chunked transfer-coding. 641 For historical reasons, a sender MUST only generate the quoted-string 642 syntax for the following parameters: nextnonce, rspauth, and cnonce. 644 For historical reasons, a sender MUST NOT generate the quoted-string 645 syntax for the following parameters: qop and nc. 647 For historical reasons, the nc value MUST be exactly 8 hexadecimal 648 digits. 650 3.6. Digest Operation 652 Upon receiving the Authorization header field, the server MAY check 653 its validity by looking up the password that corresponds to the 654 submitted username. Then, the server MUST perform the same digest 655 operation (e.g. MD5, SHA-256) performed by the client, and compare 656 the result to the given response value. 658 Note that the HTTP server does not actually need to know the user's 659 cleartext password. As long as H(A1) is available to the server, the 660 validity of an Authorization header field can be verified. 662 The client response to a WWW-Authenticate challenge for a protection 663 space starts an authentication session with that protection space. 664 The authentication session lasts until the client receives another 665 WWW-Authenticate challenge from any server in the protection space. 666 A client SHOULD remember the username, password, nonce, nonce count 667 and opaque values associated with an authentication session to use to 668 construct the Authorization header field in future requests within 669 that protection space. The Authorization header field MAY be 670 included preemptively; doing so improves server efficiency and avoids 671 extra round trips for authentication challenges. The server MAY 672 choose to accept the old Authorization header field information, even 673 though the nonce value included might not be fresh. Alternatively, 674 the server MAY return a 401 response with a new nonce value, causing 675 the client to retry the request; by specifying stale=TRUE with this 676 response, the server tells the client to retry with the new nonce, 677 but without prompting for a new username and password. 679 Because the client is REQUIRED to return the value of the opaque 680 parameter given to it by the server for the duration of a session, 681 the opaque data can be used to transport authentication session state 682 information. (Note that any such use can also be accomplished more 683 easily and safely by including the state in the nonce.) For example, 684 a server could be responsible for authenticating content that 685 actually sits on another server. It would achieve this by having the 686 first 401 response include a domain parameter whose value includes a 687 URI on the second server, and an opaque parameter whose value 688 contains the state information. The client will retry the request, 689 at which time the server might respond with "HTTP Redirection" 690 (Section 6.4 of [RFC7231]), pointing to the URI on the second server. 691 The client will follow the redirection, and pass an Authorization 692 header field, including the data. 694 Proxies MUST be completely transparent in the Digest access 695 authentication scheme. That is, they MUST forward the WWW- 696 Authenticate, Authentication-Info and Authorization header fields 697 untouched. If a proxy wants to authenticate a client before a 698 request is forwarded to the server, it can be done using the Proxy- 699 Authenticate and Proxy-Authorization header fields described in 700 Section 3.8 below. 702 3.7. Security Protocol Negotiation 704 It is useful for a server to be able to know which security schemes a 705 client is capable of handling. 707 It is possible that a server wants to require Digest as its 708 authentication method, even if the server does not know that the 709 client supports it. A client is encouraged to fail gracefully if the 710 server specifies only authentication schemes it cannot handle. 712 When a server receives a request to access a resource, the server 713 might challenge the client by responding with "401 Unauthorized" 714 response, and include one or more WWW-Authenticate header fields. If 715 the server responds with multiple challenges, then each one of these 716 challenges MUST use a different digest algorithm. The server MUST 717 add these challenges to the response in order of preference, starting 718 with the most preferred algorithm, followed by the less preferred 719 algorithm. 721 This specification defines the following algorithms: 723 o SHA2-256 (mandatory to implement) 725 o SHA2-512/256 (as a backup algorithm) 727 o MD5 (for backward compatibility). 729 When the client receives the first challenge it SHOULD use the first 730 challenge it supports, unless a local policy dictates otherwise. 732 3.8. Proxy-Authenticate and Proxy-Authorization 734 The digest authentication scheme can also be used for authenticating 735 users to proxies, proxies to proxies, or proxies to origin servers by 736 use of the Proxy-Authenticate and Proxy-Authorization header fields. 737 These header fields are instances of the Proxy-Authenticate and 738 Proxy-Authorization header fields specified in Sections 4.2 and 4.3 739 of the HTTP/1.1 specification [RFC7235] and their behavior is subject 740 to restrictions described there. The transactions for proxy 741 authentication are very similar to those already described. Upon 742 receiving a request which requires authentication, the proxy/server 743 MUST issue the "407 Proxy Authentication Required" response with a 744 "Proxy-Authenticate" header field. The digest-challenge used in the 745 Proxy-Authenticate header field is the same as that for the WWW- 746 Authenticate header field as defined above in Section 3.3. 748 The client/proxy MUST then re-issue the request with a Proxy- 749 Authorization header field, with parameters as specified for the 750 Authorization header field in Section 3.4 above. 752 On subsequent responses, the server sends Proxy-Authentication-Info 753 with parameters the same as those for the Authentication-Info header 754 field. 756 Note that in principle a client could be asked to authenticate itself 757 to both a proxy and an end-server, but never in the same response. 759 3.9. Examples 761 3.9.1. Example with SHA-256 and MD5 763 The following example assumes that an access protected document is 764 being requested from the server via a GET request. The URI of the 765 document is http://www.example.org/dir/index.html". Both client and 766 server know that the username for this document is "Mufasa" and the 767 password is "Circle of Life" ( with one space between each of the 768 three words). 770 The first time the client requests the document, no Authorization 771 header field is sent, so the server responds with: 773 HTTP/1.1 401 Unauthorized 774 WWW-Authenticate: Digest 775 realm="http-auth@example.org", 776 qop="auth, auth-int", 777 algorithm=SHA-256, 778 nonce="7ypf/xlj9XXwfDPEoM4URrv/xwf94BcCAzFZH4GiTo0v", 779 opaque="FQhe/qaU925kfnzjCev0ciny7QMkPqMAFRtzCUYo5tdS" 780 WWW-Authenticate: Digest 781 realm="http-auth@example.org", 782 qop="auth, auth-int", 783 algorithm=MD5, 784 nonce="7ypf/xlj9XXwfDPEoM4URrv/xwf94BcCAzFZH4GiTo0v", 785 opaque="FQhe/qaU925kfnzjCev0ciny7QMkPqMAFRtzCUYo5tdS" 787 The client can prompt the user for their username and password, after 788 which it will respond with a new request, including the following 789 Authorization header field if the client chooses MD5 digest: 791 Authorization: Digest username="Mufasa", 792 realm="http-auth@example.org", 793 uri=/dir/index.html, 794 algorithm=MD5, 795 nonce="7ypf/xlj9XXwfDPEoM4URrv/xwf94BcCAzFZH4GiTo0v", 796 nc=00000001, 797 cnonce="f2/wE4q74E6zIJEtWaHKaf5wv/H5QzzpXusqGemxURZJ", 798 qop=auth, 799 response="8ca523f5e9506fed4657c9700eebdbec", 800 opaque="FQhe/qaU925kfnzjCev0ciny7QMkPqMAFRtzCUYo5tdS" 802 If the client chooses to use the SHA-256 algorithm for calculating 803 the response, the client responds with a new request including the 804 following Authorization header field: 806 Authorization: Digest username="Mufasa", 807 realm="http-auth@example.org", 808 uri="/dir/index.html", 809 algorithm=SHA-256, 810 nonce="7ypf/xlj9XXwfDPEoM4URrv/xwf94BcCAzFZH4GiTo0v", 811 nc=00000001, 812 cnonce="f2/wE4q74E6zIJEtWaHKaf5wv/H5QzzpXusqGemxURZJ", 813 qop=auth, 814 response="753927fa0e85d155564e2e272a28d1802ca10daf449 815 6794697cf8db5856cb6c1", 816 opaque="FQhe/qaU925kfnzjCev0ciny7QMkPqMAFRtzCUYo5tdS" 818 3.9.2. Example with SHA-512-256, Charset, and Userhash 820 The following example assumes that an access protected document is 821 being requested from the server via a GET request. The URI for the 822 request is "http://api.example.org/doe.json". Both client and server 823 know the userhash of the username, support the UTF-8 character 824 encoding scheme, and use the SHA-512-256 algorithm. The username for 825 the request is a variation of "Jason Doe", where the the 'a' actually 826 is Unicode code point U+00E4 ("LATIN SMALL LETTER A WITH DIAERES"), 827 and the first 'o' is Unicode code point U+00F8 ("LATIN SMALL LETTER O 828 WITH STROKE"), leading to the octet sequence using the UTF-8 encoding 829 scheme: 831 J U+00E4 s U+00F8 n D o e 832 4A C3A4 73 C3B8 6E 20 44 6F 65 834 The password is "Secret, or not?". 836 The first time the client requests the document, no Authorization 837 header field is sent, so the server responds with: 839 HTTP/1.1 401 Unauthorized 840 WWW-Authenticate: Digest 841 realm="api@example.org", 842 qop=auth, 843 algorithm=SHA-512-256, 844 nonce="5TsQWLVdgBdmrQ0XsxbDODV+57QdFR34I9HAbC/RVvkK", 845 opaque="HRPCssKJSGjCrkzDg8OhwpzCiGPChXYjwrI2QmXDnsOS", 846 charset=UTF-8, 847 userhash=true 849 The client can prompt the user for the required credentials and send 850 a new request with following Authorization header field: 852 Authorization: Digest 853 username="488869477bf257147b804c45308cd62ac4e25eb717 854 b12b298c79e62dcea254ec", 855 realm="api@example.org", 856 uri="/doe.json", 857 algorithm=SHA-512-256, 858 nonce="5TsQWLVdgBdmrQ0XsxbDODV+57QdFR34I9HAbC/RVvkK", 859 nc=00000001, 860 cnonce="NTg6RKcb9boFIAS3KrFK9BGeh+iDa/sm6jUMp2wds69v", 861 qop=auth, 862 response="ae66e67d6b427bd3f120414a82e4acff38e8ecd9101d 863 6c861229025f607a79dd", 864 opaque="HRPCssKJSGjCrkzDg8OhwpzCiGPChXYjwrI2QmXDnsOS", 865 userhash=true 867 If the client can not provide a hashed username for any reason, the 868 client can try a request with this Authorization header field: 870 Authorization: Digest 871 username*=UTF-8''J%C3%A4s%C3%B8n%20Doe, 872 realm="api@example.org", 873 uri="/doe.json", 874 algorithm=SHA-512-256, 875 nonce="5TsQWLVdgBdmrQ0XsxbDODV+57QdFR34I9HAbC/RVvkK", 876 nc=00000001, 877 cnonce="NTg6RKcb9boFIAS3KrFK9BGeh+iDa/sm6jUMp2wds69v", 878 qop=auth, 879 response="ae66e67d6b427bd3f120414a82e4acff38e8ecd9101d6 880 c861229025f607a79dd", 881 opaque="HRPCssKJSGjCrkzDg8OhwpzCiGPChXYjwrI2QmXDnsOS", 882 userhash=false 884 4. Internationalization Considerations 886 In challenges, servers SHOULD use the "charset" authentication 887 parameter (case-insensitive) to express the character encoding they 888 expect the user agent to use when generating A1 (see Section 3.4.2) 889 and username hashing (see Section 3.4.4). 891 The only allowed value is "UTF-8", to be matched case-insensitively 892 (see [RFC2978], Section 2.3). It indicates that the server expects 893 user name and password to be converted to Unicode Normalization Form 894 C ("NFC", see Section 3 of [RFC5198]) and to be encoded into octets 895 using the UTF-8 character encoding scheme [RFC3629]. 897 For the username, recipients MUST support all characters defined in 898 the "UsernameCasePreserved" profile defined in in Section 3.3 of 899 [PRECIS], with the exception of the colon (":") character. 901 For the password, recipients MUST support all characters defined in 902 the "OpaqueString" profile defined in in Section 4.2 of [PRECIS]. 904 If the user agent does not support the encoding indicated by the 905 server, it can fail the request. 907 When usernames can not be sent hashed and include non-ASCII 908 characters, clients can include the "username*" parameter instead 909 (using the value encoding defined in [RFC5987]). 911 5. Security Considerations 913 5.1. Limitations 915 HTTP Digest authentication, when used with human-memorable passwords, 916 is vulnerable to dictionary attacks. Such attacks are much easier 917 than cryptographic attacks on any widely used algorithm, including 918 those that are no longer considered secure. In other words, 919 algorithm agility does not make this usage any more secure. 921 As a result, Digest authentication SHOULD be used only with passwords 922 that have a reasonable amount of entropy, e.g. 128-bit or more. Such 923 passwords typically cannot be memorized by humans but can be used for 924 automated web services. 926 Digest authentication SHOULD be used over a secure channel like HTTPS 927 [RFC2818]. 929 5.2. Storing passwords 931 Digest authentication requires that the authenticating agent (usually 932 the server) store some data derived from the user's name and password 933 in a "password file" associated with a given realm. Normally this 934 might contain pairs consisting of username and H(A1), where H(A1) is 935 the digested value of the username, realm, and password as described 936 above. 938 The security implications of this are that if this password file is 939 compromised, then an attacker gains immediate access to documents on 940 the server using this realm. Unlike, say a standard UNIX password 941 file, this information need not be decrypted in order to access 942 documents in the server realm associated with this file. On the 943 other hand, decryption, or more likely a brute force attack, would be 944 necessary to obtain the user's password. This is the reason that the 945 realm is part of the digested data stored in the password file. It 946 means that if one Digest authentication password file is compromised, 947 it does not automatically compromise others with the same username 948 and password (though it does expose them to brute force attack). 950 There are two important security consequences of this. First the 951 password file must be protected as if it contained unencrypted 952 passwords, because for the purpose of accessing documents in its 953 realm, it effectively does. 955 A second consequence of this is that the realm string SHOULD be 956 unique among all realms which any single user is likely to use. In 957 particular a realm string SHOULD include the name of the host doing 958 the authentication. The inability of the client to authenticate the 959 server is a weakness of Digest Authentication. 961 5.3. Authentication of Clients using Digest Authentication 963 Digest Authentication does not provide a strong authentication 964 mechanism, when compared to public key based mechanisms, for example. 966 However, it is significantly stronger than (e.g.) CRAM-MD5, which 967 has been proposed for use with LDAP [RFC4513], POP and IMAP (see 968 [RFC2195]). It was intended to replace the much weaker and even more 969 dangerous Basic mechanism. 971 Digest Authentication offers no confidentiality protection beyond 972 protecting the actual username and password. All of the rest of the 973 request and response are available to an eavesdropper. 975 Digest Authentication offers only limited integrity protection for 976 the messages in either direction. If qop=auth-int mechanism is used, 977 those parts of the message used in the calculation of the WWW- 978 Authenticate and Authorization header field response parameter values 979 (see Section 3.2 above) are protected. Most header fields and their 980 values could be modified as a part of a man-in-the-middle attack. 982 Many needs for secure HTTP transactions cannot be met by Digest 983 Authentication. For those needs TLS is more appropriate protocol. 984 In particular Digest authentication cannot be used for any 985 transaction requiring confidentiality protection. Nevertheless many 986 functions remain for which Digest authentication is both useful and 987 appropriate. 989 5.4. Limited Use Nonce Values 991 The Digest scheme uses a server-specified nonce to seed the 992 generation of the response value (as specified in Section 3.4.1 993 above). As shown in the example nonce in Section 3.3, the server is 994 free to construct the nonce such that it MAY only be used from a 995 particular client, for a particular resource, for a limited period of 996 time or number of uses, or any other restrictions. Doing so 997 strengthens the protection provided against, for example, replay 998 attacks (see 4.5). However, it should be noted that the method 999 chosen for generating and checking the nonce also has performance and 1000 resource implications. For example, a server MAY choose to allow 1001 each nonce value to be used only once by maintaining a record of 1002 whether or not each recently issued nonce has been returned and 1003 sending a next-nonce parameter in the Authentication-Info header 1004 field of every response. This protects against even an immediate 1005 replay attack, but has a high cost checking nonce values, and perhaps 1006 more important will cause authentication failures for any pipelined 1007 requests (presumably returning a stale nonce indication). Similarly, 1008 incorporating a request-specific element such as the Etag value for a 1009 resource limits the use of the nonce to that version of the resource 1010 and also defeats pipelining. Thus it MAY be useful to do so for 1011 methods with side effects but have unacceptable performance for those 1012 that do not. 1014 5.5. Replay Attacks 1016 A replay attack against Digest authentication would usually be 1017 pointless for a simple GET request since an eavesdropper would 1018 already have seen the only document he could obtain with a replay. 1019 This is because the URI of the requested document is digested in the 1020 client request and the server will only deliver that document. By 1021 contrast under Basic Authentication once the eavesdropper has the 1022 user's password, any document protected by that password is open to 1023 him. 1025 Thus, for some purposes, it is necessary to protect against replay 1026 attacks. A good Digest implementation can do this in various ways. 1027 The server created "nonce" value is implementation dependent, but if 1028 it contains a digest of the client IP, a time-stamp, the resource 1029 ETag, and a private server key (as recommended above) then a replay 1030 attack is not simple. An attacker must convince the server that the 1031 request is coming from a false IP address and must cause the server 1032 to deliver the document to an IP address different from the address 1033 to which it believes it is sending the document. An attack can only 1034 succeed in the period before the time-stamp expires. Digesting the 1035 client IP and time-stamp in the nonce permits an implementation which 1036 does not maintain state between transactions. 1038 For applications where no possibility of replay attack can be 1039 tolerated the server can use one-time nonce values which will not be 1040 honored for a second use. This requires the overhead of the server 1041 remembering which nonce values have been used until the nonce time- 1042 stamp (and hence the digest built with it) has expired, but it 1043 effectively protects against replay attacks. 1045 An implementation must give special attention to the possibility of 1046 replay attacks with POST and PUT requests. Unless the server employs 1047 one-time or otherwise limited-use nonces and/or insists on the use of 1048 the integrity protection of qop=auth-int, an attacker could replay 1049 valid credentials from a successful request with counterfeit form 1050 data or other message body. Even with the use of integrity 1051 protection most metadata in header fields is not protected. Proper 1052 nonce generation and checking provides some protection against replay 1053 of previously used valid credentials, but see 4.8. 1055 5.6. Weakness Created by Multiple Authentication Schemes 1057 An HTTP/1.1 server MAY return multiple challenges with a 401 1058 (Authenticate) response, and each challenge MAY use a different auth- 1059 scheme. A user agent MUST choose to use the strongest auth-scheme it 1060 understands and request credentials from the user based upon that 1061 challenge. 1063 Note that many browsers will only recognize Basic and will require 1064 that it be the first auth-scheme presented. Servers SHOULD only 1065 include Basic if it is minimally acceptable. 1067 When the server offers choices of authentication schemes using the 1068 WWW-Authenticate header field, the strength of the resulting 1069 authentication is only as good as that of the of the weakest of the 1070 authentication schemes. See Section 5.7 below for discussion of 1071 particular attack scenarios that exploit multiple authentication 1072 schemes. 1074 5.7. Online dictionary attacks 1076 If the attacker can eavesdrop, then it can test any overheard nonce/ 1077 response pairs against a list of common words. Such a list is 1078 usually much smaller than the total number of possible passwords. 1079 The cost of computing the response for each password on the list is 1080 paid once for each challenge. 1082 The server can mitigate this attack by not allowing users to select 1083 passwords that are in a dictionary. 1085 5.8. Man in the Middle 1087 Digest authentication is vulnerable to "man in the middle" (MITM) 1088 attacks, for example, from a hostile or compromised proxy. Clearly, 1089 this would present all the problems of eavesdropping. But it also 1090 offers some additional opportunities to the attacker. 1092 A possible man-in-the-middle attack would be to add a weak 1093 authentication scheme to the set of choices, hoping that the client 1094 will use one that exposes the user's credentials (e.g. password). 1095 For this reason, the client SHOULD always use the strongest scheme 1096 that it understands from the choices offered. 1098 An even better MITM attack would be to remove all offered choices, 1099 replacing them with a challenge that requests only Basic 1100 authentication, then uses the cleartext credentials from the Basic 1101 authentication to authenticate to the origin server using the 1102 stronger scheme it requested. A particularly insidious way to mount 1103 such a MITM attack would be to offer a "free" proxy caching service 1104 to gullible users. 1106 User agents should consider measures such as presenting a visual 1107 indication at the time of the credentials request of what 1108 authentication scheme is to be used, or remembering the strongest 1109 authentication scheme ever requested by a server and produce a 1110 warning message before using a weaker one. It might also be a good 1111 idea for the user agent to be configured to demand Digest 1112 authentication in general, or from specific sites. 1114 Or, a hostile proxy might spoof the client into making a request the 1115 attacker wanted rather than one the client wanted. Of course, this 1116 is still much harder than a comparable attack against Basic 1117 Authentication. 1119 5.9. Chosen plaintext attacks 1121 With Digest authentication, a MITM or a malicious server can 1122 arbitrarily choose the nonce that the client will use to compute the 1123 response. This is called a "chosen plaintext" attack. The ability 1124 to choose the nonce is known to make cryptanalysis much easier. 1126 However, no way to analyze the one-way functions used by Digest using 1127 chosen plaintext is currently known. 1129 The countermeasure against this attack is for clients to use the 1130 "cnonce" parameter; this allows the client to vary the input to the 1131 hash in a way not chosen by the attacker. 1133 5.10. Precomputed dictionary attacks 1135 With Digest authentication, if the attacker can execute a chosen 1136 plaintext attack, the attacker can precompute the response for many 1137 common words to a nonce of its choice, and store a dictionary of 1138 (response, password) pairs. Such precomputation can often be done in 1139 parallel on many machines. It can then use the chosen plaintext 1140 attack to acquire a response corresponding to that challenge, and 1141 just look up the password in the dictionary. Even if most passwords 1142 are not in the dictionary, some might be. Since the attacker gets to 1143 pick the challenge, the cost of computing the response for each 1144 password on the list can be amortized over finding many passwords. A 1145 dictionary with 100 million password/response pairs would take about 1146 3.2 gigabytes of disk storage. 1148 The countermeasure against this attack is to for clients to use the 1149 "cnonce" parameter. 1151 5.11. Batch brute force attacks 1153 With Digest authentication, a MITM can execute a chosen plaintext 1154 attack, and can gather responses from many users to the same nonce. 1155 It can then find all the passwords within any subset of password 1156 space that would generate one of the nonce/response pairs in a single 1157 pass over that space. It also reduces the time to find the first 1158 password by a factor equal to the number of nonce/response pairs 1159 gathered. This search of the password space can often be done in 1160 parallel on many machines, and even a single machine can search large 1161 subsets of the password space very quickly -- reports exist of 1162 searching all passwords with six or fewer letters in a few hours. 1164 The countermeasure against this attack is to for clients to use of 1165 the "cnonce" parameter. 1167 5.12. Summary 1169 By modern cryptographic standards Digest Authentication is weak. But 1170 for a large range of purposes it is valuable as a replacement for 1171 Basic Authentication. It remedies some, but not all, weaknesses of 1172 Basic Authentication. Its strength may vary depending on the 1173 implementation. In particular the structure of the nonce (which is 1174 dependent on the server implementation) may affect the ease of 1175 mounting a replay attack. A range of server options is appropriate 1176 since, for example, some implementations may be willing to accept the 1177 server overhead of one-time nonces or digests to eliminate the 1178 possibility of replay. Others may satisfied with a nonce like the 1179 one recommended above restricted to a single IP address and a single 1180 ETag or with a limited lifetime. 1182 The bottom line is that *any* compliant implementation will be 1183 relatively weak by cryptographic standards, but *any* compliant 1184 implementation will be far superior to Basic Authentication. 1186 6. IANA Considerations 1188 6.1. HTTP Digest Hash Algorithms Registry 1190 This specification creates a new IANA registry named "HTTP Digest 1191 Hash Algorithms". When registering a new hash algorithm, the 1192 following information MUST be provided: 1194 Hash Algorithm 1196 The textual name of the hash algorithm. 1198 Digest Size 1200 The size of the algorithm's output in bits. 1202 Reference 1204 A reference to the specification that describes the new algorithm. 1206 The update policy for this registry shall be Specification Required. 1208 The initial registry will contain the following entries: 1210 +----------------+-------------+-----------+ 1211 | Hash Algorithm | Digest Size | Reference | 1212 +----------------+-------------+-----------+ 1213 | "MD5" | 128 | RFC XXXX | 1214 | "SHA-512-256" | 256 | RFC XXXX | 1215 | "SHA-256" | 256 | RFC XXXX | 1216 +----------------+-------------+-----------+ 1218 Each one of the algorithms defined in the registry might have a -sess 1219 variant, e.g. MD5-sess, SHA-256-sess, etc. 1221 6.2. Digest Scheme Registration 1223 This specification registers the Digest scheme with the 1224 Authentication Scheme Registry. 1226 Authentication Scheme Name: Digest 1228 Pointer to specification text: this specification 1230 7. Acknowledgments 1232 The authors of this document would like to thank the authors of 1233 [RFC2617], as this document heavily borrows text from their document 1234 to provide a complete description of the digest scheme and its 1235 operations. 1237 Special thanks to Julian Reschke for his many reviews, comments, 1238 suggestions, and text provided to various areas in this document. 1240 The authors would like to thank Stephen Farrell, Yoav Nir, Phillip 1241 Hallam-Baker, Manu Sporny, Paul Hoffman, Yaron Sheffer, Sean Turner, 1242 Geoff Baskwill, Eric Cooper, Bjoern Hoehrmann, Martin Durst, Peter 1243 Saint-Andre, Michael Sweet, Daniel Stenberg, Brett Tate, Paul Leach, 1244 Ilari Liusvaara, and Gary Mort, Alexey Melnikov, and Benjamin Kaduk 1245 for their careful review and comments. 1247 The authors would like to thank Jonathan Stoke, Nico Williams, Harry 1248 Halpin, and Phil Hunt for their comments on the mailing list when 1249 discussing various aspects of this document. 1251 The authors would like to thank Paul Kyzivat and Dale Worley for 1252 their careful review and feedback on some aspects of this document. 1254 8. References 1256 8.1. Normative References 1258 [AUTHINFO] 1259 Reschke, J., "The Hypertext Transfer Protocol (HTTP) 1260 Authentication-Info and Proxy-Authentication-Info Response 1261 Header Fields", draft-ietf-httpbis-auth-info-00 (work in 1262 progress), January 2015. 1264 [PRECIS] Saint-Andre, P. and A. Melnikov, "Preparation, 1265 Enforcement, and Comparison of Internationalized Strings 1266 Representing Usernames and Passwords", draft-ietf-precis- 1267 saslprepbis-12 (work in progress), December 2014. 1269 [RFC2119] Bradner, S., "Key words for use in RFCs to Indicate 1270 Requirement Levels", BCP 14, RFC 2119, March 1997. 1272 [RFC2978] Freed, N. and J. Postel, "IANA Charset Registration 1273 Procedures", BCP 19, RFC 2978, October 2000. 1275 [RFC3629] Yergeau, F., "UTF-8, a transformation format of ISO 1276 10646", STD 63, RFC 3629, November 2003. 1278 [RFC3986] Berners-Lee, T., Fielding, R., and L. Masinter, "Uniform 1279 Resource Identifier (URI): Generic Syntax", STD 66, RFC 1280 3986, January 2005. 1282 [RFC4086] Eastlake, D., Schiller, J., and S. Crocker, "Randomness 1283 Requirements for Security", BCP 106, RFC 4086, June 2005. 1285 [RFC5198] Klensin, J. and M. Padlipsky, "Unicode Format for Network 1286 Interchange", RFC 5198, March 2008. 1288 [RFC5234] Crocker, D., Ed. and P. Overell, "Augmented BNF for Syntax 1289 Specifications: ABNF", STD 68, RFC 5234, January 2008. 1291 [RFC5987] Reschke, J., "Character Set and Language Encoding for 1292 Hypertext Transfer Protocol (HTTP) Header Field 1293 Parameters", RFC 5987, August 2010. 1295 [RFC6454] Barth, A., "The Web Origin Concept", RFC 6454, December 1296 2011. 1298 [RFC7230] Fielding, R., Ed. and J. Reschke, Ed., "Hypertext Transfer 1299 Protocol (HTTP/1.1): Message Syntax and Routing", RFC 1300 7230, June 2014. 1302 [RFC7231] Fielding, R., Ed. and J. Reschke, Ed., "Hypertext Transfer 1303 Protocol (HTTP/1.1): Semantics and Content", RFC 7231, 1304 June 2014. 1306 [RFC7234] Fielding, R., Ed., Nottingham, M., Ed., and J. Reschke, 1307 Ed., "Hypertext Transfer Protocol (HTTP/1.1): Caching", 1308 RFC 7234, June 2014. 1310 [RFC7235] Fielding, R., Ed. and J. Reschke, Ed., "Hypertext Transfer 1311 Protocol (HTTP/1.1): Authentication", RFC 7235, June 2014. 1313 8.2. Informative References 1315 [BASIC] Reschke, J., "The 'Basic' HTTP Authentication Scheme", 1316 draft-ietf-httpauth-basicauth-update-04 (work in 1317 progress), December 2014. 1319 [RFC2195] Klensin, J., Catoe, R., and P. Krumviede, "IMAP/POP 1320 AUTHorize Extension for Simple Challenge/Response", RFC 1321 2195, September 1997. 1323 [RFC2617] Franks, J., Hallam-Baker, P., Hostetler, J., Lawrence, S., 1324 Leach, P., Luotonen, A., and L. Stewart, "HTTP 1325 Authentication: Basic and Digest Access Authentication", 1326 RFC 2617, June 1999. 1328 [RFC2818] Rescorla, E., "HTTP Over TLS", RFC 2818, May 2000. 1330 [RFC4513] Harrison, R., "Lightweight Directory Access Protocol 1331 (LDAP): Authentication Methods and Security Mechanisms", 1332 RFC 4513, June 2006. 1334 Authors' Addresses 1336 Rifaat Shekh-Yusef (editor) 1337 Avaya 1338 250 Sidney Street 1339 Belleville, Ontario 1340 Canada 1342 Phone: +1-613-967-5267 1343 EMail: rifaat.ietf@gmail.com 1345 David Ahrens 1346 Independent 1347 California 1348 USA 1350 EMail: ahrensdc@gmail.com 1352 Sophie Bremer 1353 Netzkonform 1354 Germany 1356 EMail: sophie.bremer@netzkonform.de