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