idnits 2.17.1 draft-ietf-httpauth-digest-12.txt: Checking boilerplate required by RFC 5378 and the IETF Trust (see https://trustee.ietf.org/license-info): ---------------------------------------------------------------------------- No issues found here. Checking nits according to https://www.ietf.org/id-info/1id-guidelines.txt: ---------------------------------------------------------------------------- No issues found here. Checking nits according to https://www.ietf.org/id-info/checklist : ---------------------------------------------------------------------------- ** 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 (January 22, 2015) is 3381 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 (-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 (~~), 5 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: July 26, 2015 S. Bremer 7 Netzkonform 8 January 22, 2015 10 HTTP Digest Access Authentication 11 draft-ietf-httpauth-digest-12 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 July 26, 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 . . . . . . . . . . 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 Headers . . . . . . . . . . . . . . . . . . . . . . . . . 13 90 3.5.1. Digest Usage of Authentication-Info . . . . . . . . . 13 91 3.6. Digest Operation . . . . . . . . . . . . . . . . . . . . 15 92 3.7. Security Protocol Negotiation . . . . . . . . . . . . . . 16 93 3.8. Proxy-Authenticate and Proxy-Authorization . . . . . . . 17 94 3.9. Examples . . . . . . . . . . . . . . . . . . . . . . . . 17 95 3.9.1. Example with SHA-256 and MD5 . . . . . . . . . . . . 17 96 3.9.2. Example with SHA-512-256, Charset, and Userhash . . . 19 97 4. Internationalization . . . . . . . . . . . . . . . . . . . . 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 . . . . . . . . . . . . . . . . . . . . . 23 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 6.3. Authentication-Info and Proxy-Authentication-Info Headers 115 Registration . . . . . . . . . . . . . . . . . . . . . . 27 116 7. Acknowledgments . . . . . . . . . . . . . . . . . . . . . . . 28 117 8. References . . . . . . . . . . . . . . . . . . . . . . . . . 28 118 8.1. Normative References . . . . . . . . . . . . . . . . . . 28 119 8.2. Informative References . . . . . . . . . . . . . . . . . 29 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] and [RFC7235] obsolete [RFC2617]. 136 1.1. Terminology 138 The key words "MUST", "MUST NOT", "REQUIRED", "SHALL", "SHALL NOT", 139 "SHOULD", "SHOULD NOT", "RECOMMENDED", "MAY", and "OPTIONAL" in this 140 document are to be interpreted as described in [RFC2119]. 142 2. Syntax Convention 144 2.1. Examples 146 In the interest of clarity and readability, the extended parameters 147 or the header fields and parameters in the examples in this document 148 might be broken into multiple lines. Any line that is indented in 149 this document is a continuation of the preceding line. 151 2.2. ABNF 153 This specification uses the Augmented Backus-Naur Form (ABNF) 154 notation of [RFC5234], and the ABNF List Extension of [RFC7230]. 156 3. Digest Access Authentication Scheme 158 3.1. Overall Operation 160 The Digest scheme is based on a simple challenge-response paradigm. 161 The Digest scheme challenges using a nonce value, and might indicate 162 that username hashing is supported. A valid response contains a 163 checksum of the username, the password, the given nonce value, the 164 HTTP method, and the requested URI. In this way, the password is 165 never sent in the clear, and the username can be hashed, depending on 166 the indication received from the server. The username and password 167 must be prearranged in some fashion not addressed by this document. 169 The security of this protocol is critically dependent on the 170 randomness of the randomly chosen parameters, such as client and 171 server nonces. These should be generated by a strong random or 172 properly seeded pseudorandom source (see [RFC4086]). 174 For the following parameters, the value can be encoded using 175 [RFC5987] encoding: username. 177 3.2. Representation of Digest Values 179 An optional header field allows the server to specify the algorithm 180 used to create the checksum or digest. This documents adds SHA-256 181 and SHA-512/256 algorithms. To maintain backwards compatibility with 182 [RFC2617], the MD5 algorithm is still supported but NOT RECOMMENDED. 184 The size of the digest depends on the algorithm used. The bits in 185 the digest are converted from the most significant to the least 186 significant bit, four bits at a time to the ASCII representation as 187 follows. Each four bits is represented by its familiar hexadecimal 188 notation from the characters 0123456789abcdef, that is binary 0000 is 189 represented by the character '0', 0001 by '1' and so on up to the 190 representation of 1111 as 'f'. If the MD5 algorithm is used to 191 calculate the digest, then the MD5 digest will be represented as 32 192 hexadecimal characters, while SHA-256 and SHA-512/256 are represented 193 as 64 hexadecimal characters. 195 3.3. The WWW-Authenticate Response Header 197 If a server receives a request for an access-protected object, and an 198 acceptable Authorization header field is not sent, the server 199 responds with a "401 Unauthorized" status code and a WWW-Authenticate 200 header field with Digest scheme as per the framework defined above. 201 The value of the header field can include parameters from the 202 following list: 204 realm 206 A string to be displayed to users so they know which username and 207 password to use. This string should contain at least the name of 208 the host performing the authentication and might additionally 209 indicate the collection of users who might have access. An 210 example might be "registered_users@gotham.news.com". (See 211 Section 2.2 of [RFC7235] for more details). 213 domain 215 A quoted, space-separated list of URIs, as specified in [RFC3986], 216 that define the protection space. If a URI is an abs_path, it is 217 relative to the canonical root URL (See Section 2.2 of [RFC7235]) 218 of the web-origin [RFC6454]. An absolute-URI in this list may 219 refer to a different server than the web-origin. The client can 220 use this list to determine the set of URIs for which the same 221 authentication information may be sent: any URI that has a URI in 222 this list as a prefix (after both have been made absolute) MAY be 223 assumed to be in the same protection space. If this parameter is 224 omitted or its value is empty, the client SHOULD assume that the 225 protection space consists of all URIs on the web-origin. All URIs 226 in this list SHOULD use the same scheme (https or http); mixing 227 them is a bad idea. 229 This parameter is not meaningful in Proxy-Authenticate header 230 fields, for which the protection space is always the entire proxy; 231 if present it MUST be ignored. 233 nonce 235 A server-specified data string which should be uniquely generated 236 each time a 401 response is made. It is advised that this string 237 be base64 or hexadecimal data. Specifically, since the string is 238 passed in the header field lines as a quoted string, the double- 239 quote character is not allowed, unless suitably escaped. 241 The contents of the nonce are implementation dependent. The 242 quality of the implementation depends on a good choice. A nonce 243 might, for example, be constructed as the base 64 encoding of 245 time-stamp H(time-stamp ":" ETag ":" secret-data) 247 where time-stamp is a server-generated time, which preferably 248 includes micro or nano seconds, or other non-repeating values, 249 ETag is the value of the HTTP ETag header field associated with 250 the requested entity, and secret-data is data known only to the 251 server. With a nonce of this form a server would recalculate the 252 hash portion after receiving the client authentication header 253 field and reject the request if it did not match the nonce from 254 that header field or if the time-stamp value is not recent enough. 255 In this way the server can limit the time of the nonce's validity. 256 The inclusion of the ETag prevents a replay request for an updated 257 version of the resource. Including the IP address of the client 258 in the nonce would appear to offer the server the ability to limit 259 the reuse of the nonce to the same client that originally got it. 260 However, that would break when requests from a single user often 261 go through different proxies. Also, IP address spoofing is not 262 that hard. 264 An implementation might choose not to accept a previously used 265 nonce or a previously used digest, in order to protect against a 266 replay attack. Or, an implementation might choose to use one-time 267 nonces or digests for POST or PUT requests and a time-stamp for 268 GET requests. For more details on the issues involved see 269 Section 5 of this document. 271 The nonce is opaque to the client. 273 opaque 275 A string of data, specified by the server, which SHOULD be 276 returned by the client unchanged in the Authorization header field 277 of subsequent requests with URIs in the same protection space. It 278 is RECOMMENDED that this string be base64 or hexadecimal data. 280 stale 282 A case-insensitive flag indicating that the previous request from 283 the client was rejected because the nonce value was stale. If 284 stale is TRUE, the client may wish to simply retry the request 285 with a new encrypted response, without re-prompting the user for a 286 new username and password. The server SHOULD only set stale to 287 TRUE if it receives a request for which the nonce is invalid. If 288 stale is FALSE, or anything other than TRUE, or the stale 289 parameter is not present, the username and/or password are 290 invalid, and new values MUST be obtained. 292 algorithm 294 A string indicating a pair of algorithms used to produce the 295 digest and a checksum. If this is not present it is assumed to be 296 "MD5". If the algorithm is not understood, the challenge SHOULD 297 be ignored (and a different one used, if there is more than one). 299 When used with the Digest mechanism, each one of the algorithms 300 has two variants: Session variant and non-Session variant. The 301 non-Session variant is denoted by "", e.g. "SHA-256", 302 and the Session variant is denoted by "-sess", e.g. 303 "SHA-256-sess". 305 In this document the string obtained by applying the digest 306 algorithm to the data "data" with secret "secret" will be denoted 307 by KD(secret, data), and the string obtained by applying the 308 checksum algorithm to the data "data" will be denoted H(data). 309 The notation unq(X) means the value of the quoted-string X without 310 the surrounding quotes and with quoting slashes removed. 312 For "" and "-sess" 314 H(data) = (data) 316 and 318 KD(secret, data) = H(concat(secret, ":", data)) 320 For example: 322 For the "SHA-256" and "SHA-256-sess" algorithms 324 H(data) = SHA-256(data) 326 i.e., the digest is the "" of the secret concatenated 327 with a colon concatenated with the data. The "-sess" 328 algorithm is intended to allow efficient 3rd party authentication 329 servers; for the difference in usage, see the description in 330 Section 3.4.2. 332 qop 333 This parameter MUST be used by all implementations. It is a 334 quoted string of one or more tokens indicating the "quality of 335 protection" values supported by the server. The value "auth" 336 indicates authentication; the value "auth-int" indicates 337 authentication with integrity protection; see the descriptions 338 below for calculating the response parameter value for the 339 application of this choice. Unrecognized options MUST be ignored. 341 charset 343 This is an OPTIONAL parameter that is used by the server to 344 indicate the encoding scheme it supports. 346 userhash 348 This is an OPTIONAL parameter that is used by the server to 349 indicate that it supports username hashing. Valid values are: 350 "true" or "false". Default value is "false". 352 For historical reasons, a sender MUST only generate the quoted-string 353 syntax values for the following parameters: realm, domain, nonce, 354 opaque, and qop. 356 For historical reasons, a sender MUST NOT generate the quoted-string 357 syntax values for the following parameters: stale and algorithm. 359 3.4. The Authorization Request Header Field 361 The client is expected to retry the request, passing an Authorization 362 header field line with Digest scheme, which is defined according to 363 the framework above. The values of the opaque and algorithm fields 364 must be those supplied in the WWW-Authenticate response header field 365 for the entity being requested. 367 The request can include parameters from the following list: 369 response 371 A string of the hex digits computed as defined below, which proves 372 that the user knows a password. 374 username 376 The user's name in the specified realm. 378 uri 379 The Effective Request URI [RFC7230] from request-target of the 380 Request-Line; duplicated here because proxies are allowed to 381 change the Request-Line in transit. 383 qop 385 Indicates what "quality of protection" the client has applied to 386 the message. Its value MUST be one of the alternatives the server 387 indicated it supports in the WWW-Authenticate header field. These 388 values affect the computation of the response. Note that this is 389 a single token, not a quoted list of alternatives as in WWW- 390 Authenticate. 392 cnonce 394 This parameter MUST be used by all implementations. The cnonce 395 value is an opaque quoted ASCII-only string value provided by the 396 client and used by both client and server to avoid chosen 397 plaintext attacks, to provide mutual authentication, and to 398 provide some message integrity protection. See the descriptions 399 below of the calculation of the rspauth and response values. 401 nc 403 This parameter MUST be used by all implementations. The "nc" 404 parameter stands for "nonce count". The nc value is the 405 hexadecimal count of the number of requests (including the current 406 request) that the client has sent with the nonce value in this 407 request. For example, in the first request sent in response to a 408 given nonce value, the client sends "nc=00000001". The purpose of 409 this parameter is to allow the server to detect request replays by 410 maintaining its own copy of this count - if the same nc value is 411 seen twice, then the request is a replay. See the description 412 below of the construction of the response value. 414 userhash 416 This OPTIONAL parameter is used by the client to indicate that the 417 username has been hashed. Valid values are: "true" or "false". 418 Default value is "false". 420 For historical reasons, a sender MUST only generate the quoted-string 421 syntax for the following parameters: username, realm, nonce, uri, 422 response, cnonce, and opaque. 424 For historical reasons, a sender MUST NOT generate the quoted-string 425 syntax for the following parameters: algorithm, qop, and nc. 427 If a parameter or its value is improper, or required parameters are 428 missing, the proper response is a 4xx error code. If the response is 429 invalid, then a login failure SHOULD be logged, since repeated login 430 failures from a single client may indicate an attacker attempting to 431 guess passwords. The server implementation SHOULD be careful with 432 the information being logged so that it won't put a cleartext 433 password (e.g. entered into the username field) into the log. 435 The definition of the response above indicates the encoding for its 436 value. The following definitions show how the value is computed. 438 3.4.1. Response 440 If the "qop" value is "auth" or "auth-int": 442 response = <"> < KD ( H(A1), unq(nonce) 443 ":" nc 444 ":" unq(cnonce) 445 ":" unq(qop) 446 ":" H(A2) 447 ) <"> 449 See below for the definitions for A1 and A2. 451 3.4.2. A1 453 If the "algorithm" parameter's value is "", e.g. "SHA- 454 256", then A1 is: 456 A1 = unq(username) ":" unq(realm) ":" passwd 458 where 460 passwd = < user's password > 462 If the "algorithm" parameter's value is "-sess", e.g. 463 "SHA-256-sess", then A1 is calculated using the nonce value provided 464 in the challenge from the server, and cnounce value from the request 465 by the client following receipt of a WWW-Authenticate challenge from 466 the server. It uses the server nonce from that challenge, herein 467 called nonce-prime, and the client nonce value from the response, 468 herein called cnonce-prime, to construct A1 as follows: 470 A1 = H( unq(username) ":" unq(realm) 471 ":" passwd ) 472 ":" unq(nonce-prime) ":" unq(cnonce-prime) 474 This creates a "session key" for the authentication of subsequent 475 requests and responses which is different for each "authentication 476 session", thus limiting the amount of material hashed with any one 477 key. (Note: see further discussion of the authentication session in 478 Section 3.6.) Because the server need only use the hash of the user 479 credentials in order to create the A1 value, this construction could 480 be used in conjunction with a third party authentication service so 481 that the web server would not need the actual password value. The 482 specification of such a protocol is beyond the scope of this 483 specification. 485 3.4.3. A2 487 If the "qop" parameter's value is "auth" or is unspecified, then A2 488 is: 490 A2 = Method ":" request-uri 492 If the "qop" value is "auth-int", then A2 is: 494 A2 = Method ":" request-uri ":" H(entity-body) 496 3.4.4. Username Hashing 498 To protect the transport of the username from the client to the 499 server, the server SHOULD set the "userhash" parameter with the value 500 of "true" in the WWW-Authentication header field. 502 If the client supports the "userhash" parameter, and the "userhash" 503 parameter value in the WWW-Authentication header field is set to 504 "true", then the client MUST calculate a hash of the username after 505 any other hash calculation and include the "userhash" parameter with 506 the value of "true" in the Authorization Request Header field. If 507 the client does not provide the "username" as a hash value or the 508 "userhash" parameter with the value of "true", the server MAY reject 509 the request. 511 The following is the operation that the client will take to hash the 512 username, using the same algorithm used to hash the credentials: 514 username = H( unq(username) ":" unq(realm) ) 516 3.4.5. Parameter Values and Quoted-String 518 Note that the value of many of the parameters, such as "username" 519 value, are defined as a "quoted-string". However, the "unq" notation 520 indicates that surrounding quotation marks are removed in forming the 521 string A1. Thus if the Authorization header field includes the 522 fields 524 username="Mufasa", realm=myhost@testrealm.com 526 and the user Mufasa has password "Circle Of Life" then H(A1) would be 527 H(Mufasa:myhost@testrealm.com:Circle Of Life) with no quotation marks 528 in the digested string. 530 No white space is allowed in any of the strings to which the digest 531 function H() is applied unless that white space exists in the quoted 532 strings or entity body whose contents make up the string to be 533 digested. For example, the string A1 illustrated above must be 535 Mufasa:myhost@testrealm.com:Circle Of Life 537 with no white space on either side of the colons, but with the white 538 space between the words used in the password value. Likewise, the 539 other strings digested by H() must not have white space on either 540 side of the colons which delimit their fields unless that white space 541 was in the quoted strings or entity body being digested. 543 Also note that if integrity protection is applied (qop=auth-int), the 544 H(entity-body) is the hash of the entity body, not the message body - 545 it is computed before any transfer encoding is applied by the sender 546 and after it has been removed by the recipient. Note that this 547 includes multipart boundaries and embedded header fields in each part 548 of any multipart content-type. 550 3.4.6. Various Considerations 552 The "Method" value is the HTTP request method, in US-ASCII letters, 553 as specified in Section 3.1.1 of [RFC7230]. The "request-target" 554 value is the request-target from the request line as specified in 555 Section 3.1.1 of [RFC7230]. This MAY be "*", an "absolute-URI" or an 556 "absolute-path" as specified in Section 2.7 of [RFC7230], but it MUST 557 agree with the request-target. In particular, it MUST be an 558 "absolute-URI" if the request-target is an "absolute-URI". The 559 "cnonce" value is a client-chosen value whose purpose is to foil 560 chosen plaintext attacks. 562 The authenticating server MUST assure that the resource designated by 563 the "uri" parameter is the same as the resource specified in the 564 Request-Line; if they are not, the server SHOULD return a 400 Bad 565 Request error. (Since this may be a symptom of an attack, server 566 implementers may want to consider logging such errors.) The purpose 567 of duplicating information from the request URL in this field is to 568 deal with the possibility that an intermediate proxy may alter the 569 client's Request-Line. This altered (but presumably semantically 570 equivalent) request would not result in the same digest as that 571 calculated by the client. 573 Implementers should be aware of how authenticated transactions need 574 to interact with shared caches. The HTTP protocol specifies that 575 when a shared cache (see [RFC7234]) has received a request containing 576 an Authorization header field and a response from relaying that 577 request, it MUST NOT return that response as a reply to any other 578 request, unless one of two Cache-Control (see Section 3.2 of 579 [RFC7234]) directive was present in the response. If the original 580 response included the "must-revalidate" Cache-Control directive, the 581 cache MAY use the entity of that response in replying to a subsequent 582 request, but MUST first revalidate it with the origin server, using 583 the request header fields from the new request to allow the origin 584 server to authenticate the new request. Alternatively, if the 585 original response included the "public" Cache-Control directive, the 586 response entity MAY be returned in reply to any subsequent request. 588 3.5. The Authentication-Info and Proxy-Authentication-Info Headers 590 The Authentication-Info header field and the Proxy-Authentication- 591 Info header field are generic fields that MAY be used by a server to 592 communicate some information regarding the successful authentication 593 of a client response. The following is the syntax of the headers: 595 Authentication-Info = auth-info 596 auth-info = #auth-param 598 Proxy-Authentication-Info = proxy-auth-info 599 proxy-auth-info = #auth-param 601 The auth-param is defined in [RFC7235]. 603 3.5.1. Digest Usage of Authentication-Info 605 The Digest authentication scheme MAY add the Authentication-Info 606 header field in the confirmation request and include parameters from 607 the following list: 609 nextnonce 611 The value of the nextnonce parameter is the nonce the server 612 wishes the client to use for a future authentication response. 613 The server MAY send the Authentication-Info header field with a 614 nextnonce field as a means of implementing one-time or otherwise 615 changing nonces. If the nextnonce field is present the client 616 SHOULD use it when constructing the Authorization header field for 617 its next request. Failure of the client to do so MAY result in a 618 request to re-authenticate from the server with the "stale=TRUE". 620 Server implementations SHOULD carefully consider the 621 performance implications of the use of this mechanism; 622 pipelined requests will not be possible if every response 623 includes a nextnonce parameter that MUST be used on the next 624 request received by the server. Consideration SHOULD be given 625 to the performance vs. security tradeoffs of allowing an old 626 nonce value to be used for a limited time to permit request 627 pipelining. Use of the "nc" parameter can retain most of the 628 security advantages of a new server nonce without the 629 deleterious affects on pipelining. 631 qop 633 Indicates the "quality of protection" options applied to the 634 response by the server. The value "auth" indicates 635 authentication; the value "auth-int" indicates authentication with 636 integrity protection. The server SHOULD use the same value for 637 the qop parameter in the response as was sent by the client in the 638 corresponding request. 640 rspauth 642 The optional response digest in the "rspauth" parameter supports 643 mutual authentication -- the server proves that it knows the 644 user's secret, and with qop=auth-int also provides limited 645 integrity protection of the response. The "rspauth" value is 646 calculated as for the response in the Authorization header field, 647 except that if "qop=auth" or is not specified in the Authorization 648 header field for the request, A2 is 650 A2 = ":" request-uri 652 and if "qop=auth-int", then A2 is 654 A2 = ":" request-uri ":" H(entity-body) 656 cnonce and nc 658 The "cnonce" value and "nc" value MUST be the ones for the client 659 request to which this message is the response. The "rspauth", 660 "cnonce", and "nc" parameters MUST be present if "qop=auth" or 661 "qop=auth-int" is specified. 663 The Authentication-Info header field is allowed in the trailer of an 664 HTTP message transferred via chunked transfer-coding. 666 For historical reasons, a sender MUST only generate the quoted-string 667 syntax for the following parameters: nextnonce, rspauth, and cnonce. 669 For historical reasons, a sender MUST NOT generate the quoted-string 670 syntax for the following parameters: qop and nc. 672 For historical reasons, the nc value MUST be exactly 8 hexadecimal 673 digits. 675 3.6. Digest Operation 677 Upon receiving the Authorization header field, the server MAY check 678 its validity by looking up the password that corresponds to the 679 submitted username. Then, the server MUST perform the same digest 680 operation (e.g. MD5, SHA-256) performed by the client, and compare 681 the result to the given response value. 683 Note that the HTTP server does not actually need to know the user's 684 cleartext password. As long as H(A1) is available to the server, the 685 validity of an Authorization header field can be verified. 687 The client response to a WWW-Authenticate challenge for a protection 688 space starts an authentication session with that protection space. 689 The authentication session lasts until the client receives another 690 WWW-Authenticate challenge from any server in the protection space. 691 A client SHOULD remember the username, password, nonce, nonce count 692 and opaque values associated with an authentication session to use to 693 construct the Authorization header field in future requests within 694 that protection space. The Authorization header field MAY be 695 included preemptively; doing so improves server efficiency and avoids 696 extra round trips for authentication challenges. The server MAY 697 choose to accept the old Authorization header field information, even 698 though the nonce value included might not be fresh. Alternatively, 699 the server MAY return a 401 response with a new nonce value, causing 700 the client to retry the request; by specifying stale=TRUE with this 701 response, the server tells the client to retry with the new nonce, 702 but without prompting for a new username and password. 704 Because the client is REQUIRED to return the value of the opaque 705 parameter given to it by the server for the duration of a session, 706 the opaque data can be used to transport authentication session state 707 information. (Note that any such use can also be accomplished more 708 easily and safely by including the state in the nonce.) For example, 709 a server could be responsible for authenticating content that 710 actually sits on another server. It would achieve this by having the 711 first 401 response include a domain parameter whose value includes a 712 URI on the second server, and an opaque parameter whose value 713 contains the state information. The client will retry the request, 714 at which time the server might respond with "HTTP Redirection 715 (Section 6.4 of [RFC7231]), pointing to the URI on the second server. 716 The client will follow the redirection, and pass an Authorization 717 header field, including the data. 719 Proxies MUST be completely transparent in the Digest access 720 authentication scheme. That is, they MUST forward the WWW- 721 Authenticate, Authentication-Info and Authorization header fields 722 untouched. If a proxy wants to authenticate a client before a 723 request is forwarded to the server, it can be done using the Proxy- 724 Authenticate and Proxy-Authorization header fields described in 725 Section 3.8 below. 727 3.7. Security Protocol Negotiation 729 It is useful for a server to be able to know which security schemes a 730 client is capable of handling. 732 It is possible that a server wants to require Digest as its 733 authentication method, even if the server does not know that the 734 client supports it. A client is encouraged to fail gracefully if the 735 server specifies only authentication schemes it cannot handle. 737 When a server receives a request to access a resource, the server 738 might challenge the client by responding with "401 Unauthorized" 739 response, and include one or more WWW-Authenticate header fields. If 740 the server responds with multiple challenges, then each one of these 741 challenges MUST use a different digest algorithm. The server MUST 742 add these challenges to the response in order of preference, starting 743 with the most preferred algorithm, followed by the less preferred 744 algorithm. 746 This specification defines the following algorithms: 748 o SHA2-256 (mandatory to implement) 750 o SHA2-512/256 (as a backup algorithm) 752 o MD5 (for backward compatibility). 754 When the client receives the first challenge it SHOULD use the 755 topmost header field that it supports, unless a local policy dictates 756 otherwise. The client MUST ignore any challenge it does not 757 understand. 759 3.8. Proxy-Authenticate and Proxy-Authorization 761 The digest authentication scheme can also be used for authenticating 762 users to proxies, proxies to proxies, or proxies to origin servers by 763 use of the Proxy-Authenticate and Proxy-Authorization header fields. 764 These header fields are instances of the Proxy-Authenticate and 765 Proxy-Authorization header fields specified in Sections 4.2 and 4.3 766 of the HTTP/1.1 specification [RFC7235] and their behavior is subject 767 to restrictions described there. The transactions for proxy 768 authentication are very similar to those already described. Upon 769 receiving a request which requires authentication, the proxy/server 770 MUST issue the "407 Proxy Authentication Required" response with a 771 "Proxy-Authenticate" header field. The digest-challenge used in the 772 Proxy-Authenticate header field is the same as that for the WWW- 773 Authenticate header field as defined above in Section 3.3. 775 The client/proxy MUST then re-issue the request with a Proxy- 776 Authorization header field, with parameters as specified for the 777 Authorization header field in Section 3.4 above. 779 On subsequent responses, the server sends Proxy-Authentication-Info 780 with parameters the same as those for the Authentication-Info header 781 field. 783 Note that in principle a client could be asked to authenticate itself 784 to both a proxy and an end-server, but never in the same response. 786 3.9. Examples 788 3.9.1. Example with SHA-256 and MD5 790 The following example assumes that an access protected document is 791 being requested from the server via a GET request. The URI of the 792 document is http://www.example.org/dir/index.html". Both client and 793 server know that the username for this document is "Mufasa" and the 794 password is "Circle of Life" ( with one space between each of the 795 three words). 797 The first time the client requests the document, no Authorization 798 header field is sent, so the server responds with: 800 HTTP/1.1 401 Unauthorized 801 WWW-Authenticate: Digest 802 realm="http-auth@example.org", 803 qop="auth, auth-int", 804 algorithm=SHA-256, 805 nonce="7ypf/xlj9XXwfDPEoM4URrv/xwf94BcCAzFZH4GiTo0v", 806 opaque="FQhe/qaU925kfnzjCev0ciny7QMkPqMAFRtzCUYo5tdS" 807 WWW-Authenticate: Digest 808 realm="http-auth@example.org", 809 qop="auth, auth-int", 810 algorithm=MD5, 811 nonce="7ypf/xlj9XXwfDPEoM4URrv/xwf94BcCAzFZH4GiTo0v", 812 opaque="FQhe/qaU925kfnzjCev0ciny7QMkPqMAFRtzCUYo5tdS" 814 The client can prompt the user for their username and password, after 815 which it will respond with a new request, including the following 816 Authorization header field if the client chooses MD5 digest: 818 Authorization: Digest username="Mufasa", 819 realm="http-auth@example.org", 820 uri=/dir/index.html, 821 algorithm=MD5, 822 nonce="7ypf/xlj9XXwfDPEoM4URrv/xwf94BcCAzFZH4GiTo0v", 823 nc=00000001, 824 cnonce="f2/wE4q74E6zIJEtWaHKaf5wv/H5QzzpXusqGemxURZJ", 825 qop=auth, 826 response="8ca523f5e9506fed4657c9700eebdbec", 827 opaque="FQhe/qaU925kfnzjCev0ciny7QMkPqMAFRtzCUYo5tdS" 829 If the client chooses to use the SHA-256 algorithm for calculating 830 the response, the client responds with a new request including the 831 following Authorization header field: 833 Authorization: Digest username="Mufasa", 834 realm="http-auth@example.org", 835 uri="/dir/index.html", 836 algorithm=SHA-256, 837 nonce="7ypf/xlj9XXwfDPEoM4URrv/xwf94BcCAzFZH4GiTo0v", 838 nc=00000001, 839 cnonce="f2/wE4q74E6zIJEtWaHKaf5wv/H5QzzpXusqGemxURZJ", 840 qop=auth, 841 response="753927fa0e85d155564e2e272a28d1802ca10daf449 842 6794697cf8db5856cb6c1", 843 opaque="FQhe/qaU925kfnzjCev0ciny7QMkPqMAFRtzCUYo5tdS" 845 3.9.2. Example with SHA-512-256, Charset, and Userhash 847 The following example assumes that an access protected document is 848 being requested from the server via a GET request. The URI for the 849 request is "http://api.example.org/doe.json". Both client and server 850 know the userhash of the username, support the UTF-8 character 851 encoding scheme, and use the SHA-512-256 algorithm. The username for 852 the request is a variation of "Jason Doe" and has the byte sequence 853 4A C3 A4 73 C3 B8 6E 20 44 6F 65. The password is "Secret, or not?". 855 The first time the client requests the document, no Authorization 856 header field is sent, so the server responds with: 858 HTTP/1.1 401 Unauthorized 859 WWW-Authenticate: Digest 860 realm="api@example.org", 861 qop=auth, 862 algorithm=SHA-512-256, 863 nonce="5TsQWLVdgBdmrQ0XsxbDODV+57QdFR34I9HAbC/RVvkK", 864 opaque="HRPCssKJSGjCrkzDg8OhwpzCiGPChXYjwrI2QmXDnsOS", 865 charset=UTF-8, 866 userhash=true 868 The client can prompt the user for the required credentials and send 869 a new request with following Authorization header field: 871 Authorization: Digest 872 username="488869477bf257147b804c45308cd62ac4e25eb717 873 b12b298c79e62dcea254ec", 874 realm="api@example.org", 875 uri="/doe.json", 876 algorithm=SHA-512-256, 877 nonce="5TsQWLVdgBdmrQ0XsxbDODV+57QdFR34I9HAbC/RVvkK", 878 nc=00000001, 879 cnonce="NTg6RKcb9boFIAS3KrFK9BGeh+iDa/sm6jUMp2wds69v", 880 qop=auth, 881 response="ae66e67d6b427bd3f120414a82e4acff38e8ecd9101d 882 6c861229025f607a79dd", 883 opaque="HRPCssKJSGjCrkzDg8OhwpzCiGPChXYjwrI2QmXDnsOS", 884 userhash=true 886 If the client can not provide a hashed username for any reason, the 887 client can try a request with this Authorization header field: 889 Authorization: Digest 890 username*=UTF-8''J%C3%A4s%C3%B8n%20Doe, 891 realm="api@example.org", 892 uri="/doe.json", 893 algorithm=SHA-512-256, 894 nonce="5TsQWLVdgBdmrQ0XsxbDODV+57QdFR34I9HAbC/RVvkK", 895 nc=00000001, 896 cnonce="NTg6RKcb9boFIAS3KrFK9BGeh+iDa/sm6jUMp2wds69v", 897 qop=auth, 898 response="ae66e67d6b427bd3f120414a82e4acff38e8ecd9101d6 899 c861229025f607a79dd", 900 opaque="HRPCssKJSGjCrkzDg8OhwpzCiGPChXYjwrI2QmXDnsOS", 901 userhash=false 903 4. Internationalization 905 In challenges, servers SHOULD use the "charset" authentication 906 parameter (case-insensitive) to express the character encoding they 907 expect the user agent to use when generating A1 (see Section 3.4.2) 908 and username hashing (see Section 3.4.4). 910 The only allowed value is "UTF-8", to be matched case-insensitively 911 (see [RFC2978], Section 2.3). It indicates that the server expects 912 user name and password to be converted to Unicode Normalization Form 913 C ("NFC", see Section 3 of [RFC5198]) and to be encoded into octets 914 using the UTF-8 character encoding scheme [RFC3629]. 916 For the username, recipients MUST support all characters defined in 917 the "UsernameCasePreserved" profile defined in in Section 3.3 of 918 [PRECIS], with the exception of the colon (":") character. 920 For the password, recipients MUST support all characters defined in 921 the "OpaqueString" profile defined in in Section 4.2 of [PRECIS]. 923 If the user agent does not support the encoding indicated by the 924 server, it can fail the request. 926 5. Security Considerations 928 5.1. Limitations 930 HTTP Digest authentication, when used with human-memorable passwords, 931 is vulnerable to dictionary attacks. Such attacks are much easier 932 than cryptographic attacks on any widely used algorithm, including 933 those that are no longer considered secure. In other words, 934 algorithm agility does not make this usage any more secure. 936 As a result, Digest authentication SHOULD be used only with passwords 937 that have a reasonable amount of entropy, e.g. 128-bit or more. Such 938 passwords typically cannot be memorized by humans but can be used for 939 automated web services. 941 Digest authentication SHOULD be used over a secure channel like HTTPS 942 [RFC2818]. 944 5.2. Storing passwords 946 Digest authentication requires that the authenticating agent (usually 947 the server) store some data derived from the user's name and password 948 in a "password file" associated with a given realm. Normally this 949 might contain pairs consisting of username and H(A1), where H(A1) is 950 the digested value of the username, realm, and password as described 951 above. 953 The security implications of this are that if this password file is 954 compromised, then an attacker gains immediate access to documents on 955 the server using this realm. Unlike, say a standard UNIX password 956 file, this information need not be decrypted in order to access 957 documents in the server realm associated with this file. On the 958 other hand, decryption, or more likely a brute force attack, would be 959 necessary to obtain the user's password. This is the reason that the 960 realm is part of the digested data stored in the password file. It 961 means that if one Digest authentication password file is compromised, 962 it does not automatically compromise others with the same username 963 and password (though it does expose them to brute force attack). 965 There are two important security consequences of this. First the 966 password file must be protected as if it contained unencrypted 967 passwords, because for the purpose of accessing documents in its 968 realm, it effectively does. 970 A second consequence of this is that the realm string SHOULD be 971 unique among all realms which any single user is likely to use. In 972 particular a realm string SHOULD include the name of the host doing 973 the authentication. The inability of the client to authenticate the 974 server is a weakness of Digest Authentication. 976 5.3. Authentication of Clients using Digest Authentication 978 Digest Authentication does not provide a strong authentication 979 mechanism, when compared to public key based mechanisms, for example. 981 However, it is significantly stronger than (e.g.) CRAM-MD5, which 982 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 6.3. Authentication-Info and Proxy-Authentication-Info Headers 1247 Registration 1249 This specification registers the Authentication-Info and the Proxy- 1250 Authentication-Info Header fields with the Message Header Field 1251 Registry. 1253 Header Field Name: Authentication-Info 1255 Protocol: http 1257 Status: standard 1259 Reference: RFCXXXX, Section 3.5 1261 Header Field Name: Proxy-Authentication-Info 1263 Protocol: http 1265 Status: standard 1267 Reference: RFCXXXX, Section 3.5 1269 7. Acknowledgments 1271 The authors of this document would like to thank the authors of 1272 [RFC2617], as this document heavily borrows text from their document 1273 to provide a complete description of the digest scheme and its 1274 operations. 1276 Special thanks to Julian Reschke for his reviews, comments, 1277 suggestions, and text provided to various areas in this document. 1279 The authors would like to thank Stephen Farrell, Yoav Nir, Phillip 1280 Hallam-Baker, Manu Sporny, Paul Hoffman, Yaron Sheffer, Sean Turner, 1281 Geoff Baskwill, Eric Cooper, Bjoern Hoehrmann, Martin Durst, Peter 1282 Saint-Andre, Michael Sweet, Daniel Stenberg, Brett Tate, Paul Leach, 1283 Ilari Liusvaara, and Gary Mort, Alexey Melnikov, and Benjamin Kaduk 1284 for their careful review and comments. 1286 The authors would like to thank Jonathan Stoke, Nico Williams, Harry 1287 Halpin, and Phil Hunt for their comments on the mailing list when 1288 discussing various aspects of this document. 1290 The authors would like to thank Paul Kyzivat and Dale Worley for 1291 their careful review and feedback on some aspects of this document. 1293 8. References 1295 8.1. Normative References 1297 [PRECIS] Saint-Andre, P. and A. Melnikov, "Preparation, 1298 Enforcement, and Comparison of Internationalized Strings 1299 Representing Usernames and Passwords", draft-ietf-precis- 1300 saslprepbis-12 (work in progress), December 2014. 1302 [RFC2119] Bradner, S., "Key words for use in RFCs to Indicate 1303 Requirement Levels", BCP 14, RFC 2119, March 1997. 1305 [RFC2978] Freed, N. and J. Postel, "IANA Charset Registration 1306 Procedures", BCP 19, RFC 2978, October 2000. 1308 [RFC3629] Yergeau, F., "UTF-8, a transformation format of ISO 1309 10646", STD 63, RFC 3629, November 2003. 1311 [RFC3986] Berners-Lee, T., Fielding, R., and L. Masinter, "Uniform 1312 Resource Identifier (URI): Generic Syntax", STD 66, RFC 1313 3986, January 2005. 1315 [RFC4086] Eastlake, D., Schiller, J., and S. Crocker, "Randomness 1316 Requirements for Security", BCP 106, RFC 4086, June 2005. 1318 [RFC5198] Klensin, J. and M. Padlipsky, "Unicode Format for Network 1319 Interchange", RFC 5198, March 2008. 1321 [RFC5234] Crocker, D., Ed. and P. Overell, "Augmented BNF for Syntax 1322 Specifications: ABNF", STD 68, RFC 5234, January 2008. 1324 [RFC5987] Reschke, J., "Character Set and Language Encoding for 1325 Hypertext Transfer Protocol (HTTP) Header Field 1326 Parameters", RFC 5987, August 2010. 1328 [RFC6454] Barth, A., "The Web Origin Concept", RFC 6454, December 1329 2011. 1331 [RFC7230] Fielding, R., Ed. and J. Reschke, Ed., "Hypertext Transfer 1332 Protocol (HTTP/1.1): Message Syntax and Routing", RFC 1333 7230, June 2014. 1335 [RFC7231] Fielding, R., Ed. and J. Reschke, Ed., "Hypertext Transfer 1336 Protocol (HTTP/1.1): Semantics and Content", RFC 7231, 1337 June 2014. 1339 [RFC7234] Fielding, R., Ed., Nottingham, M., Ed., and J. Reschke, 1340 Ed., "Hypertext Transfer Protocol (HTTP/1.1): Caching", 1341 RFC 7234, June 2014. 1343 [RFC7235] Fielding, R., Ed. and J. Reschke, Ed., "Hypertext Transfer 1344 Protocol (HTTP/1.1): Authentication", RFC 7235, June 2014. 1346 8.2. Informative References 1348 [BASIC] Reschke, J., "The 'Basic' HTTP Authentication Scheme", 1349 draft-ietf-httpauth-basicauth-update-04 (work in 1350 progress), December 2014. 1352 [RFC2195] Klensin, J., Catoe, R., and P. Krumviede, "IMAP/POP 1353 AUTHorize Extension for Simple Challenge/Response", RFC 1354 2195, September 1997. 1356 [RFC2617] Franks, J., Hallam-Baker, P., Hostetler, J., Lawrence, S., 1357 Leach, P., Luotonen, A., and L. Stewart, "HTTP 1358 Authentication: Basic and Digest Access Authentication", 1359 RFC 2617, June 1999. 1361 [RFC2818] Rescorla, E., "HTTP Over TLS", RFC 2818, May 2000. 1363 [RFC4513] Harrison, R., "Lightweight Directory Access Protocol 1364 (LDAP): Authentication Methods and Security Mechanisms", 1365 RFC 4513, June 2006. 1367 Authors' Addresses 1369 Rifaat Shekh-Yusef (editor) 1370 Avaya 1371 250 Sidney Street 1372 Belleville, Ontario 1373 Canada 1375 Phone: +1-613-967-5267 1376 EMail: rifaat.ietf@gmail.com 1378 David Ahrens 1379 Independent 1380 California 1381 USA 1383 EMail: ahrensdc@gmail.com 1385 Sophie Bremer 1386 Netzkonform 1387 Germany 1389 EMail: sophie.bremer@netzkonform.de