idnits 2.17.1 draft-ietf-httpauth-digest-10.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 10, 2015) is 3393 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 14, 2015 S. Bremer 7 Netzkonform 8 January 10, 2015 10 HTTP Digest Access Authentication 11 draft-ietf-httpauth-digest-10 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 14, 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 Header . . . . . . . . . . . . . 13 89 3.5.1. Digest Usage of Authentication-Info . . . . . . . . . 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 . . . 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 Header Registration . . . . . . . . . 27 115 7. Acknowledgments . . . . . . . . . . . . . . . . . . . . . . . 27 116 8. References . . . . . . . . . . . . . . . . . . . . . . . . . 28 117 8.1. Normative References . . . . . . . . . . . . . . . . . . 28 118 8.2. Informative References . . . . . . . . . . . . . . . . . 29 120 1. Introduction 122 HTTP provides a simple challenge-response authentication mechanism 123 that may be used by a server to challenge a client request and by a 124 client to provide authentication information. This document defines 125 the HTTP Digest Authentication scheme that can be used with the HTTP 126 authentication mechanism. 128 The details of the challenge-response authentication mechanism are 129 specified in the "Hypertext Transfer Protocol (HTTP/1.1): 130 Authentication" [RFC7235]. 132 The combination of this document with the definition of the "Basic" 133 authentication scheme [BASIC] and [RFC7235] obsolete RFC 2617. 135 1.1. Terminology 137 The key words "MUST", "MUST NOT", "REQUIRED", "SHALL", "SHALL NOT", 138 "SHOULD", "SHOULD NOT", "RECOMMENDED", "MAY", and "OPTIONAL" in this 139 document are to be interpreted as described in RFC 2119 [RFC2119]. 141 2. Syntax Convention 143 2.1. Examples 145 In the interest of clarity and readability, the extended parameters 146 or the header fields and parameters in the examples in this document 147 might be broken into multiple lines. Any line that is indented in 148 this document is a continuation of the preceding line. 150 2.2. ABNF 152 This specification uses the Augmented Backus-Naur Form (ABNF) 153 notation of [RFC5234], and the ABNF List Extension of [RFC7230]. 155 3. Digest Access Authentication Scheme 157 3.1. Overall Operation 159 The Digest scheme is based on a simple challenge-response paradigm. 160 The Digest scheme challenges using a nonce value, and might indicate 161 that username hashing is supported. A valid response contains a 162 checksum of the username, the password, the given nonce value, the 163 HTTP method, and the requested URI. In this way, the password is 164 never sent in the clear, and the username can be hashed, depending on 165 the indication received from the server. The username and password 166 must be prearranged in some fashion not addressed by this document. 168 The security of this protocol is critically dependent on the 169 randomness of the randomly chosen parameters, such as client and 170 server nonces. These should be generated by a strong random or 171 properly seeded pseudorandom source (see [RFC4086]). 173 Some or all of the parameters used in the various headers fields used 174 by this document can be sent using the [RFC5987] encoding. 176 3.2. Representation of Digest Values 178 An optional header field allows the server to specify the algorithm 179 used to create the checksum or digest. This documents adds SHA-256 180 and SHA-512/256 algorithms. To maintain backwards compatibility with 181 [RFC2617], the MD5 algorithm is still supported but NOT RECOMMENDED. 183 The size of the digest depends on the algorithm used. The bits in 184 the digest are converted from the most significant to the least 185 significant bit, four bits at a time to the ASCII representation as 186 follows. Each four bits is represented by its familiar hexadecimal 187 notation from the characters 0123456789abcdef, that is binary 0000 is 188 represented by the character '0', 0001 by '1' and so on up to the 189 representation of 1111 as 'f'. If the MD5 algorithm is used to 190 calculate the digest, then the MD5 digest will be represented as 32 191 hexadecimal characters, while SHA-256 and SHA-512/256 are represented 192 as 64 hexadecimal characters. 194 3.3. The WWW-Authenticate Response Header 196 If a server receives a request for an access-protected object, and an 197 acceptable Authorization header field is not sent, the server 198 responds with a "401 Unauthorized" status code and a WWW-Authenticate 199 header field with Digest scheme as per the framework defined above. 200 The value of the header field can include parameters from the 201 following list: 203 realm 205 A string to be displayed to users so they know which username and 206 password to use. This string should contain at least the name of 207 the host performing the authentication and might additionally 208 indicate the collection of users who might have access. An 209 example might be "registered_users@gotham.news.com". (See 210 Section 2.2 of [RFC7235] for more details). 212 domain 214 A quoted, space-separated list of URIs, as specified in RFC 3986 215 [RFC3986], that define the protection space. If a URI is an 216 abs_path, it is relative to the canonical root URL (See 217 Section 2.2 of [RFC7235]) of the web-origin [RFC6454]. An 218 absolute-URI in this list may refer to a different server than the 219 web-origin. The client can use this list to determine the set of 220 URIs for which the same authentication information may be sent: 221 any URI that has a URI in this list as a prefix (after both have 222 been made absolute) MAY be assumed to be in the same protection 223 space. If this parameter is omitted or its value is empty, the 224 client SHOULD assume that the protection space consists of all 225 URIs on the web-origin. All URIs in this list SHOULD use the same 226 scheme (https or http); mixing them is a bad idea. 228 This parameter is not meaningful in Proxy-Authenticate header 229 fields, for which the protection space is always the entire proxy; 230 if present it MUST be ignored. 232 nonce 234 A server-specified data string which should be uniquely generated 235 each time a 401 response is made. It is advised that this string 236 be base64 or hexadecimal data. Specifically, since the string is 237 passed in the header field lines as a quoted string, the double- 238 quote character is not allowed, unless suitably escaped. 240 The contents of the nonce are implementation dependent. The 241 quality of the implementation depends on a good choice. A nonce 242 might, for example, be constructed as the base 64 encoding of 244 time-stamp H(time-stamp ":" ETag ":" secret-data) 246 where time-stamp is a server-generated time, which preferably 247 includes micro or nano seconds, or other non-repeating values, 248 ETag is the value of the HTTP ETag header field associated with 249 the requested entity, and secret-data is data known only to the 250 server. With a nonce of this form a server would recalculate the 251 hash portion after receiving the client authentication header 252 field and reject the request if it did not match the nonce from 253 that header field or if the time-stamp value is not recent enough. 254 In this way the server can limit the time of the nonce's validity. 255 The inclusion of the ETag prevents a replay request for an updated 256 version of the resource. Including the IP address of the client 257 in the nonce would appear to offer the server the ability to limit 258 the reuse of the nonce to the same client that originally got it. 259 However, that would break when requests from a single user often 260 go through different proxies. Also, IP address spoofing is not 261 that hard. 263 An implementation might choose not to accept a previously used 264 nonce or a previously used digest, in order to protect against a 265 replay attack. Or, an implementation might choose to use one-time 266 nonces or digests for POST or PUT requests and a time-stamp for 267 GET requests. For more details on the issues involved see 268 Section 5 of this document. 270 The nonce is opaque to the client. 272 opaque 274 A string of data, specified by the server, which SHOULD be 275 returned by the client unchanged in the Authorization header field 276 of subsequent requests with URIs in the same protection space. It 277 is RECOMMENDED that this string be base64 or hexadecimal data. 279 stale 281 A case-insensitive flag indicating that the previous request from 282 the client was rejected because the nonce value was stale. If 283 stale is TRUE, the client may wish to simply retry the request 284 with a new encrypted response, without re-prompting the user for a 285 new username and password. The server SHOULD only set stale to 286 TRUE if it receives a request for which the nonce is invalid. If 287 stale is FALSE, or anything other than TRUE, or the stale 288 parameter is not present, the username and/or password are 289 invalid, and new values MUST be obtained. 291 algorithm 293 A string indicating a pair of algorithms used to produce the 294 digest and a checksum. If this is not present it is assumed to be 295 "MD5". If the algorithm is not understood, the challenge SHOULD 296 be ignored (and a different one used, if there is more than one). 298 When used with the Digest mechanism, each one of the algorithms 299 has two variants: Session variant and non-Session variant. The 300 non-Session variant is denoted by "", e.g. "SHA-256", 301 and the Session variant is denoted by "-sess", e.g. 302 "SHA-256-sess". 304 In this document the string obtained by applying the digest 305 algorithm to the data "data" with secret "secret" will be denoted 306 by KD(secret, data), and the string obtained by applying the 307 checksum algorithm to the data "data" will be denoted H(data). 308 The notation unq(X) means the value of the quoted-string X without 309 the surrounding quotes and with quoting slashes removed. 311 For "" and "-sess" 313 H(data) = (data) 315 and 317 KD(secret, data) = H(concat(secret, ":", data)) 319 For example: 321 For the "SHA-256" and "SHA-256-sess" algorithms 323 H(data) = SHA-256(data) 325 i.e., the digest is the "" of the secret concatenated 326 with a colon concatenated with the data. The "-sess" 327 algorithm is intended to allow efficient 3rd party authentication 328 servers; for the difference in usage, see the description in 329 section 3.4.2. 331 qop 332 This parameter MUST be used by all implementations. It is a 333 quoted string of one or more tokens indicating the "quality of 334 protection" values supported by the server. The value "auth" 335 indicates authentication; the value "auth-int" indicates 336 authentication with integrity protection; see the descriptions 337 below for calculating the response parameter value for the 338 application of this choice. Unrecognized options MUST be ignored. 340 charset 342 This is an OPTIONAL parameter that is used by the server to 343 indicate the encoding scheme it supports. 345 userhash 347 This is an OPTIONAL parameter that is used by the server to 348 indicate that it supports username hashing. Valid values are: 349 "true" or "false". Default value is "false". 351 For historical reasons, a sender MUST only generate the quoted-string 352 syntax values for the following parameters: realm, domain, nonce, 353 opaque, and qop. 355 For historical reasons, a sender MUST NOT generate the quoted-string 356 syntax values for the following parameters: stale and algorithm. 358 3.4. The Authorization Request Header Field 360 The client is expected to retry the request, passing an Authorization 361 header field line with Digest scheme, which is defined according to 362 the framework above. The values of the opaque and algorithm fields 363 must be those supplied in the WWW-Authenticate response header field 364 for the entity being requested. 366 The request can include parameters from the following list: 368 response 370 A string of the hex digits computed as defined below, which proves 371 that the user knows a password. 373 username 375 The user's name in the specified realm. 377 uri 378 The Effective Request URI [RFC7230] from request-target of the 379 Request-Line; duplicated here because proxies are allowed to 380 change the Request-Line in transit. 382 qop 384 Indicates what "quality of protection" the client has applied to 385 the message. Its value MUST be one of the alternatives the server 386 indicated it supports in the WWW-Authenticate header field. These 387 values affect the computation of the response. Note that this is 388 a single token, not a quoted list of alternatives as in WWW- 389 Authenticate. 391 cnonce 393 This parameter MUST be used by all implementations. The cnonce 394 value is an opaque quoted ASCII-only string value provided by the 395 client and used by both client and server to avoid chosen 396 plaintext attacks, to provide mutual authentication, and to 397 provide some message integrity protection. See the descriptions 398 below of the calculation of the rspauth and response values. 400 nc 402 This parameter MUST be used by all implementations. The "nc" 403 parameter stands for "nonce count". The nc value is the 404 hexadecimal count of the number of requests (including the current 405 request) that the client has sent with the nonce value in this 406 request. For example, in the first request sent in response to a 407 given nonce value, the client sends "nc=00000001". The purpose of 408 this parameter is to allow the server to detect request replays by 409 maintaining its own copy of this count - if the same nc value is 410 seen twice, then the request is a replay. See the description 411 below of the construction of the response value. 413 userhash 415 This OPTIONAL parameter is used by the client to indicate that the 416 username has been hashed. Valid values are: "true" or "false". 417 Default value is "false". 419 For historical reasons, a sender MUST only generate the quoted-string 420 syntax for the following parameters: username, realm, nonce, uri, 421 response, cnonce, and opaque. 423 For historical reasons, a sender MUST NOT generate the quoted-string 424 syntax for the following parameters: algorithm, qop, and nc. 426 If a parameter or its value is improper, or required parameters are 427 missing, the proper response is a 4xx error code. If the response is 428 invalid, then a login failure SHOULD be logged, since repeated login 429 failures from a single client may indicate an attacker attempting to 430 guess passwords. The server implementation SHOULD be careful with 431 the information being logged so that it won't put a cleartext 432 password (e.g. entered into the username field) into the log. 434 The definition of the response above indicates the encoding for its 435 value. The following definitions show how the value is computed. 437 3.4.1. Response 439 If the "qop" value is "auth" or "auth-int": 441 response = <"> < KD ( H(A1), unq(nonce) 442 ":" nc 443 ":" unq(cnonce) 444 ":" unq(qop) 445 ":" H(A2) 446 ) <"> 448 See below for the definitions for A1 and A2. 450 3.4.2. A1 452 If the "algorithm" parameter's value is "", e.g. "SHA- 453 256", then A1 is: 455 A1 = unq(username) ":" unq(realm) ":" passwd 457 where 459 passwd = < user's password > 461 If the "algorithm" parameter's value is "-sess", e.g. 462 "SHA-256-sess", then A1 is calculated using the nonce value provided 463 in the challenge from the server, and cnounce value from the request 464 by the client following receipt of a WWW-Authenticate challenge from 465 the server. It uses the server nonce from that challenge, herein 466 called nonce-prime, and the client nonce value from the response, 467 herein called cnonce-prime, to construct A1 as follows: 469 A1 = H( unq(username) ":" unq(realm) 470 ":" passwd ) 471 ":" unq(nonce-prime) ":" unq(cnonce-prime) 473 This creates a "session key" for the authentication of subsequent 474 requests and responses which is different for each "authentication 475 session", thus limiting the amount of material hashed with any one 476 key. (Note: see further discussion of the authentication session in 477 section 3.6.) Because the server need only use the hash of the user 478 credentials in order to create the A1 value, this construction could 479 be used in conjunction with a third party authentication service so 480 that the web server would not need the actual password value. The 481 specification of such a protocol is beyond the scope of this 482 specification. 484 3.4.3. A2 486 If the "qop" parameter's value is "auth" or is unspecified, then A2 487 is: 489 A2 = Method ":" request-uri 491 If the "qop" value is "auth-int", then A2 is: 493 A2 = Method ":" request-uri ":" H(entity-body) 495 3.4.4. Username Hashing 497 To protect the transport of the username from the client to the 498 server, the server SHOULD set the "userhash" parameter with the value 499 of "true" in the WWW-Authentication header field. 501 If the client supports the "userhash" parameter, and the "userhash" 502 parameter value in the WWW-Authentication header field is set to 503 "true", then the client MUST calculate a hash of the username after 504 any other hash calculation and include the "userhash" parameter with 505 the value of "true" in the Authorization Request Header field. If 506 the client does not provide the "username" as a hash value or the 507 "userhash" parameter with the value of "true", the server MAY reject 508 the request. 510 The following is the operation that the client will take to hash the 511 username, using the same algorithm used to hash the credentials: 513 username = H( unq(username) ":" unq(realm) ) 515 3.4.5. Parameter Values and Quoted-String 517 Note that the value of many of the parameters, such as "username" 518 value, are defined as a "quoted-string". However, the "unq" notation 519 indicates that surrounding quotation marks are removed in forming the 520 string A1. Thus if the Authorization header field includes the 521 fields 523 username="Mufasa", realm=myhost@testrealm.com 525 and the user Mufasa has password "Circle Of Life" then H(A1) would be 526 H(Mufasa:myhost@testrealm.com:Circle Of Life) with no quotation marks 527 in the digested string. 529 No white space is allowed in any of the strings to which the digest 530 function H() is applied unless that white space exists in the quoted 531 strings or entity body whose contents make up the string to be 532 digested. For example, the string A1 illustrated above must be 534 Mufasa:myhost@testrealm.com:Circle Of Life 536 with no white space on either side of the colons, but with the white 537 space between the words used in the password value. Likewise, the 538 other strings digested by H() must not have white space on either 539 side of the colons which delimit their fields unless that white space 540 was in the quoted strings or entity body being digested. 542 Also note that if integrity protection is applied (qop=auth-int), the 543 H(entity-body) is the hash of the entity body, not the message body - 544 it is computed before any transfer encoding is applied by the sender 545 and after it has been removed by the recipient. Note that this 546 includes multipart boundaries and embedded header fields in each part 547 of any multipart content-type. 549 3.4.6. Various Considerations 551 The "Method" value is the HTTP request method, in US-ASCII letters, 552 as specified in section 3.1.1 of [RFC7230]. The "request-target" 553 value is the request-target from the request line as specified in 554 section 3.1.1 of [RFC7230]. This MAY be "*", an "absolute-URI" or an 555 "absolute-path" as specified in section 2.7 of [RFC7230], but it MUST 556 agree with the request-target. In particular, it MUST be an 557 "absolute-URI" if the request-target is an "absolute-URI". The 558 "cnonce" value is a client-chosen value whose purpose is to foil 559 chosen plaintext attacks. 561 The authenticating server MUST assure that the resource designated by 562 the "uri" parameter is the same as the resource specified in the 563 Request-Line; if they are not, the server SHOULD return a 400 Bad 564 Request error. (Since this may be a symptom of an attack, server 565 implementers may want to consider logging such errors.) The purpose 566 of duplicating information from the request URL in this field is to 567 deal with the possibility that an intermediate proxy may alter the 568 client's Request-Line. This altered (but presumably semantically 569 equivalent) request would not result in the same digest as that 570 calculated by the client. 572 Implementers should be aware of how authenticated transactions need 573 to interact with shared caches. The HTTP protocol specifies that 574 when a shared cache (see [RFC7234]) has received a request containing 575 an Authorization header field and a response from relaying that 576 request, it MUST NOT return that response as a reply to any other 577 request, unless one of two Cache-Control (see section 3.2 of 578 [RFC7234]) directive was present in the response. If the original 579 response included the "must-revalidate" Cache-Control directive, the 580 cache MAY use the entity of that response in replying to a subsequent 581 request, but MUST first revalidate it with the origin server, using 582 the request header fields from the new request to allow the origin 583 server to authenticate the new request. Alternatively, if the 584 original response included the "public" Cache-Control directive, the 585 response entity MAY be returned in reply to any subsequent request. 587 3.5. The Authentication-Info Header 589 The Authentication-Info header field is a generic field that MAY be 590 used by a server to communicate some information regarding the 591 successful authentication of a client response. The following is the 592 syntax of the header: 594 Authentication-Info = auth-info 596 auth-info = #auth-param 598 The auth-param is defined in [RFC7235]. 600 3.5.1. Digest Usage of Authentication-Info 602 The Digest authentication scheme MAY add the Authentication-Info 603 header field in the confirmation request and include parameters from 604 the following list: 606 nextnonce 608 The value of the nextnonce parameter is the nonce the server 609 wishes the client to use for a future authentication response. 610 The server MAY send the Authentication-Info header field with a 611 nextnonce field as a means of implementing one-time or otherwise 612 changing nonces. If the nextnonce field is present the client 613 SHOULD use it when constructing the Authorization header field for 614 its next request. Failure of the client to do so MAY result in a 615 request to re-authenticate from the server with the "stale=TRUE". 617 Server implementations SHOULD carefully consider the 618 performance implications of the use of this mechanism; 619 pipelined requests will not be possible if every response 620 includes a nextnonce parameter that MUST be used on the next 621 request received by the server. Consideration SHOULD be given 622 to the performance vs. security tradeoffs of allowing an old 623 nonce value to be used for a limited time to permit request 624 pipelining. Use of the "nc" parameter can retain most of the 625 security advantages of a new server nonce without the 626 deleterious affects on pipelining. 628 qop 630 Indicates the "quality of protection" options applied to the 631 response by the server. The value "auth" indicates 632 authentication; the value "auth-int" indicates authentication with 633 integrity protection. The server SHOULD use the same value for 634 the qop parameter in the response as was sent by the client in the 635 corresponding request. 637 rspauth 639 The optional response digest in the "rspauth" parameter supports 640 mutual authentication -- the server proves that it knows the 641 user's secret, and with qop=auth-int also provides limited 642 integrity protection of the response. The "rspauth" value is 643 calculated as for the response in the Authorization header field, 644 except that if "qop=auth" or is not specified in the Authorization 645 header field for the request, A2 is 647 A2 = ":" request-uri 649 and if "qop=auth-int", then A2 is 651 A2 = ":" request-uri ":" H(entity-body) 653 cnonce and nc 655 The "cnonce" value and "nc" value MUST be the ones for the client 656 request to which this message is the response. The "rspauth", 657 "cnonce", and "nc" parameters MUST be present if "qop=auth" or 658 "qop=auth-int" is specified. 660 The Authentication-Info header field is allowed in the trailer of an 661 HTTP message transferred via chunked transfer-coding. 663 For historical reasons, a sender MUST only generate the quoted-string 664 syntax for the following parameters: nextnonce, rspauth, and cnonce. 666 For historical reasons, a sender MUST NOT generate the quoted-string 667 syntax for the following parameters: qop and nc. 669 For historical reasons, the nc value MUST be exactly 8 hexadecimal 670 digits. 672 3.6. Digest Operation 674 Upon receiving the Authorization header field, the server MAY check 675 its validity by looking up the password that corresponds to the 676 submitted username. Then, the server MUST perform the same digest 677 operation (e.g. MD5, SHA-256) performed by the client, and compare 678 the result to the given response value. 680 Note that the HTTP server does not actually need to know the user's 681 cleartext password. As long as H(A1) is available to the server, the 682 validity of an Authorization header field can be verified. 684 The client response to a WWW-Authenticate challenge for a protection 685 space starts an authentication session with that protection space. 686 The authentication session lasts until the client receives another 687 WWW-Authenticate challenge from any server in the protection space. 688 A client SHOULD remember the username, password, nonce, nonce count 689 and opaque values associated with an authentication session to use to 690 construct the Authorization header field in future requests within 691 that protection space. The Authorization header field MAY be 692 included preemptively; doing so improves server efficiency and avoids 693 extra round trips for authentication challenges. The server MAY 694 choose to accept the old Authorization header field information, even 695 though the nonce value included might not be fresh. Alternatively, 696 the server MAY return a 401 response with a new nonce value, causing 697 the client to retry the request; by specifying stale=TRUE with this 698 response, the server tells the client to retry with the new nonce, 699 but without prompting for a new username and password. 701 Because the client is REQUIRED to return the value of the opaque 702 parameter given to it by the server for the duration of a session, 703 the opaque data can be used to transport authentication session state 704 information. (Note that any such use can also be accomplished more 705 easily and safely by including the state in the nonce.) For example, 706 a server could be responsible for authenticating content that 707 actually sits on another server. It would achieve this by having the 708 first 401 response include a domain parameter whose value includes a 709 URI on the second server, and an opaque parameter whose value 710 contains the state information. The client will retry the request, 711 at which time the server might respond with "HTTP Redirection 712 (Section 6.4 of [RFC7231]), pointing to the URI on the second server. 714 The client will follow the redirection, and pass an Authorization 715 header field, including the data. 717 Proxies MUST be completely transparent in the Digest access 718 authentication scheme. That is, they MUST forward the WWW- 719 Authenticate, Authentication-Info and Authorization header fields 720 untouched. If a proxy wants to authenticate a client before a 721 request is forwarded to the server, it can be done using the Proxy- 722 Authenticate and Proxy-Authorization header fields described in 723 section 3.8 below. 725 3.7. Security Protocol Negotiation 727 It is useful for a server to be able to know which security schemes a 728 client is capable of handling. 730 It is possible that a server wants to require Digest as its 731 authentication method, even if the server does not know that the 732 client supports it. A client is encouraged to fail gracefully if the 733 server specifies only authentication schemes it cannot handle. 735 When a server receives a request to access a resource, the server 736 might challenge the client by responding with "401 Unauthorized" 737 response, and include one or more WWW-Authenticate header fields. If 738 the server responds with multiple challenges, then each one of these 739 challenges MUST use a different digest algorithm. The server MUST 740 add these challenges to the response in order of preference, starting 741 with the most preferred algorithm, followed by the less preferred 742 algorithm. 744 This specification defines the following algorithms: 746 o SHA2-256 (mandatory to implement) 748 o SHA2-512/256 (as a backup algorithm) 750 o MD5 (for backward compatibility). 752 When the client receives the first challenge it SHOULD use the 753 topmost header field that it supports, unless a local policy dictates 754 otherwise. The client MUST ignore any challenge it does not 755 understand. 757 3.8. Proxy-Authenticate and Proxy-Authorization 759 The digest authentication scheme can also be used for authenticating 760 users to proxies, proxies to proxies, or proxies to origin servers by 761 use of the Proxy-Authenticate and Proxy-Authorization header fields. 763 These header fields are instances of the Proxy-Authenticate and 764 Proxy-Authorization header fields specified in sections 4.2 and 4.3 765 of the HTTP/1.1 specification [RFC7235] and their behavior is subject 766 to restrictions described there. The transactions for proxy 767 authentication are very similar to those already described. Upon 768 receiving a request which requires authentication, the proxy/server 769 MUST issue the "407 Proxy Authentication Required" response with a 770 "Proxy-Authenticate" header field. The digest-challenge used in the 771 Proxy-Authenticate header field is the same as that for the WWW- 772 Authenticate header field as defined above in Section 3.3. 774 The client/proxy MUST then re-issue the request with a Proxy- 775 Authorization header field, with parameters as specified for the 776 Authorization header field in section 3.4 above. 778 On subsequent responses, the server sends Proxy-Authenticate-Info 779 with parameters the same as those for the Authentication-Info header 780 field. 782 Note that in principle a client could be asked to authenticate itself 783 to both a proxy and an end-server, but never in the same response. 785 3.9. Examples 787 3.9.1. Example with SHA-256 and MD5 789 The following example assumes that an access protected document is 790 being requested from the server via a GET request. The URI of the 791 document is http://www.example.org/dir/index.html". Both client and 792 server know that the username for this document is "Mufasa" and the 793 password is "Circle of Life" ( with one space between each of the 794 three words). 796 The first time the client requests the document, no Authorization 797 header field is sent, so the server responds with: 799 HTTP/1.1 401 Unauthorized 800 WWW-Authenticate: Digest 801 realm="http-auth@example.org", 802 qop="auth, auth-int", 803 algorithm=SHA-256, 804 nonce="7ypf/xlj9XXwfDPEoM4URrv/xwf94BcCAzFZH4GiTo0v", 805 opaque="FQhe/qaU925kfnzjCev0ciny7QMkPqMAFRtzCUYo5tdS", 806 WWW-Authenticate: Digest 807 realm="http-auth@example.org", 808 qop="auth, auth-int", 809 algorithm=MD5, 810 nonce="7ypf/xlj9XXwfDPEoM4URrv/xwf94BcCAzFZH4GiTo0v", 811 opaque="FQhe/qaU925kfnzjCev0ciny7QMkPqMAFRtzCUYo5tdS" 813 The client can prompt the user for their username and password, after 814 which it will respond with a new request, including the following 815 Authorization header field if the client chooses MD5 digest: 817 Authorization: Digest username="Mufasa", 818 realm="http-auth@example.org", 819 uri=/dir/index.html, 820 algorithm=MD5, 821 nonce="7ypf/xlj9XXwfDPEoM4URrv/xwf94BcCAzFZH4GiTo0v", 822 nc=00000001, 823 cnonce="f2/wE4q74E6zIJEtWaHKaf5wv/H5QzzpXusqGemxURZJ", 824 qop=auth, 825 response="8ca523f5e9506fed4657c9700eebdbec", 826 opaque="FQhe/qaU925kfnzjCev0ciny7QMkPqMAFRtzCUYo5tdS" 828 If the client chooses to use the SHA-256 algorithm for calculating 829 the response, the client responds with a new request including the 830 following Authorization header field: 832 Authorization: Digest username="Mufasa", 833 realm="http-auth@example.org", 834 uri="/dir/index.html", 835 algorithm=SHA-256, 836 nonce="7ypf/xlj9XXwfDPEoM4URrv/xwf94BcCAzFZH4GiTo0v", 837 nc=00000001, 838 cnonce="f2/wE4q74E6zIJEtWaHKaf5wv/H5QzzpXusqGemxURZJ", 839 qop=auth, 840 response="753927fa0e85d155564e2e272a28d1802ca10daf449 841 6794697cf8db5856cb6c1", 842 opaque="FQhe/qaU925kfnzjCev0ciny7QMkPqMAFRtzCUYo5tdS" 844 3.9.2. Example with SHA-512-256, Charset, and Userhash 846 The following example assumes that an access protected document is 847 being requested from the server via a GET request. The URI for the 848 request is "http://api.example.org/doe.json". Both client and server 849 know the userhash of the username, support the UTF-8 character 850 encoding scheme, and use the SHA-512-256 algorithm. The username for 851 the request is "Jaesoen Doe" and the password is "Secret, or not?". 853 The first time the client requests the document, no Authorization 854 header field is sent, so the server responds with: 856 HTTP/1.1 401 Unauthorized 857 WWW-Authenticate: Digest 858 realm="api@example.org", 859 qop=auth, 860 algorithm=SHA-512-256, 861 nonce="5TsQWLVdgBdmrQ0XsxbDODV+57QdFR34I9HAbC/RVvkK", 862 opaque="HRPCssKJSGjCrkzDg8OhwpzCiGPChXYjwrI2QmXDnsOS", 863 charset=UTF-8, 864 userhash=true 866 The client can prompt the user for the required credentials and send 867 a new request with following Authorization header field: 869 Authorization: Digest 870 username="488869477bf257147b804c45308cd62ac4e25eb717 871 b12b298c79e62dcea254ec", 872 realm="api@example.org", 873 uri="/doe.json", 874 algorithm=SHA-512-256, 875 nonce="5TsQWLVdgBdmrQ0XsxbDODV+57QdFR34I9HAbC/RVvkK", 876 nc=00000001, 877 cnonce="NTg6RKcb9boFIAS3KrFK9BGeh+iDa/sm6jUMp2wds69v", 878 qop=auth, 879 response="ae66e67d6b427bd3f120414a82e4acff38e8ecd9101d 880 6c861229025f607a79dd", 881 opaque="HRPCssKJSGjCrkzDg8OhwpzCiGPChXYjwrI2QmXDnsOS", 882 userhash=true 884 If the client can not provide a hashed username for any reason, the 885 client can try a request with this Authorization header field: 887 Authorization: Digest 888 username*=UTF-8''J%C3%A4s%C3%B8n%20Doe, 889 realm="api@example.org", 890 uri="/doe.json", 891 algorithm=SHA-512-256, 892 nonce="5TsQWLVdgBdmrQ0XsxbDODV+57QdFR34I9HAbC/RVvkK", 893 nc=00000001, 894 cnonce="NTg6RKcb9boFIAS3KrFK9BGeh+iDa/sm6jUMp2wds69v", 895 qop=auth, 896 response="ae66e67d6b427bd3f120414a82e4acff38e8ecd9101d6 897 c861229025f607a79dd", 898 opaque="HRPCssKJSGjCrkzDg8OhwpzCiGPChXYjwrI2QmXDnsOS", 899 userhash=false 901 4. Internationalization 903 In challenges, servers SHOULD use the "charset" authentication 904 parameter (case-insensitive) to express the character encoding they 905 expect the user agent to use when generating A1 (see section 3.4.2) 906 and username hashing (see section 3.4.4). 908 The only allowed value is "UTF-8", to be matched case-insensitively 909 (see [RFC2978], Section 2.3). It indicates that the server expects 910 user name and password to be converted to Unicode Normalization Form 911 C ("NFC", see Section 3 of [RFC5198]) and to be encoded into octets 912 using the UTF-8 character encoding scheme ([RFC3629]), ), and percent 913 escaped in extended notation ([RFC5987]). 915 For the username, recipients MUST support all characters defined in 916 the "UsernameCasePreserved" profile defined in in Section 3.3 of 917 [PRECIS], with the exception of the colon (":") character. 919 For the password, recipients MUST support all characters defined in 920 the "OpaqueString" profile defined in in Section 4.2 of [PRECIS]. 922 If the user agent does not support the encoding indicated by the 923 server, it can fail the request. 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 983 [RFC2195]). It was intended to replace the much weaker and even more 984 dangerous Basic mechanism. 986 Digest Authentication offers no confidentiality protection beyond 987 protecting the actual username and password. All of the rest of the 988 request and response are available to an eavesdropper. 990 Digest Authentication offers only limited integrity protection for 991 the messages in either direction. If qop=auth-int mechanism is used, 992 those parts of the message used in the calculation of the WWW- 993 Authenticate and Authorization header field response parameter values 994 (see section 3.2 above) are protected. Most header fields and their 995 values could be modified as a part of a man-in-the-middle attack. 997 Many needs for secure HTTP transactions cannot be met by Digest 998 Authentication. For those needs TLS is more appropriate protocol. 999 In particular Digest authentication cannot be used for any 1000 transaction requiring confidentiality protection. Nevertheless many 1001 functions remain for which Digest authentication is both useful and 1002 appropriate. 1004 5.4. Limited Use Nonce Values 1006 The Digest scheme uses a server-specified nonce to seed the 1007 generation of the response value (as specified in section 3.4.1 1008 above). As shown in the example nonce in section 3.3, the server is 1009 free to construct the nonce such that it MAY only be used from a 1010 particular client, for a particular resource, for a limited period of 1011 time or number of uses, or any other restrictions. Doing so 1012 strengthens the protection provided against, for example, replay 1013 attacks (see 4.5). However, it should be noted that the method 1014 chosen for generating and checking the nonce also has performance and 1015 resource implications. For example, a server MAY choose to allow 1016 each nonce value to be used only once by maintaining a record of 1017 whether or not each recently issued nonce has been returned and 1018 sending a next-nonce parameter in the Authentication-Info header 1019 field of every response. This protects against even an immediate 1020 replay attack, but has a high cost checking nonce values, and perhaps 1021 more important will cause authentication failures for any pipelined 1022 requests (presumably returning a stale nonce indication). Similarly, 1023 incorporating a request-specific element such as the Etag value for a 1024 resource limits the use of the nonce to that version of the resource 1025 and also defeats pipelining. Thus it MAY be useful to do so for 1026 methods with side effects but have unacceptable performance for those 1027 that do not. 1029 5.5. Replay Attacks 1031 A replay attack against Digest authentication would usually be 1032 pointless for a simple GET request since an eavesdropper would 1033 already have seen the only document he could obtain with a replay. 1034 This is because the URI of the requested document is digested in the 1035 client request and the server will only deliver that document. By 1036 contrast under Basic Authentication once the eavesdropper has the 1037 user's password, any document protected by that password is open to 1038 him. 1040 Thus, for some purposes, it is necessary to protect against replay 1041 attacks. A good Digest implementation can do this in various ways. 1042 The server created "nonce" value is implementation dependent, but if 1043 it contains a digest of the client IP, a time-stamp, the resource 1044 ETag, and a private server key (as recommended above) then a replay 1045 attack is not simple. An attacker must convince the server that the 1046 request is coming from a false IP address and must cause the server 1047 to deliver the document to an IP address different from the address 1048 to which it believes it is sending the document. An attack can only 1049 succeed in the period before the time-stamp expires. Digesting the 1050 client IP and time-stamp in the nonce permits an implementation which 1051 does not maintain state between transactions. 1053 For applications where no possibility of replay attack can be 1054 tolerated the server can use one-time nonce values which will not be 1055 honored for a second use. This requires the overhead of the server 1056 remembering which nonce values have been used until the nonce time- 1057 stamp (and hence the digest built with it) has expired, but it 1058 effectively protects against replay attacks. 1060 An implementation must give special attention to the possibility of 1061 replay attacks with POST and PUT requests. Unless the server employs 1062 one-time or otherwise limited-use nonces and/or insists on the use of 1063 the integrity protection of qop=auth-int, an attacker could replay 1064 valid credentials from a successful request with counterfeit form 1065 data or other message body. Even with the use of integrity 1066 protection most metadata in header fields is not protected. Proper 1067 nonce generation and checking provides some protection against replay 1068 of previously used valid credentials, but see 4.8. 1070 5.6. Weakness Created by Multiple Authentication Schemes 1072 An HTTP/1.1 server MAY return multiple challenges with a 401 1073 (Authenticate) response, and each challenge MAY use a different auth- 1074 scheme. A user agent MUST choose to use the strongest auth-scheme it 1075 understands and request credentials from the user based upon that 1076 challenge. 1078 Note that many browsers will only recognize Basic and will require 1079 that it be the first auth-scheme presented. Servers SHOULD only 1080 include Basic if it is minimally acceptable. 1082 When the server offers choices of authentication schemes using the 1083 WWW-Authenticate header field, the strength of the resulting 1084 authentication is only as good as that of the of the weakest of the 1085 authentication schemes. See Section 5.7 below for discussion of 1086 particular attack scenarios that exploit multiple authentication 1087 schemes. 1089 5.7. Online dictionary attacks 1091 If the attacker can eavesdrop, then it can test any overheard nonce/ 1092 response pairs against a list of common words. Such a list is 1093 usually much smaller than the total number of possible passwords. 1094 The cost of computing the response for each password on the list is 1095 paid once for each challenge. 1097 The server can mitigate this attack by not allowing users to select 1098 passwords that are in a dictionary. 1100 5.8. Man in the Middle 1102 Digest authentication is vulnerable to "man in the middle" (MITM) 1103 attacks, for example, from a hostile or compromised proxy. Clearly, 1104 this would present all the problems of eavesdropping. But it also 1105 offers some additional opportunities to the attacker. 1107 A possible man-in-the-middle attack would be to add a weak 1108 authentication scheme to the set of choices, hoping that the client 1109 will use one that exposes the user's credentials (e.g. password). 1110 For this reason, the client SHOULD always use the strongest scheme 1111 that it understands from the choices offered. 1113 An even better MITM attack would be to remove all offered choices, 1114 replacing them with a challenge that requests only Basic 1115 authentication, then uses the cleartext credentials from the Basic 1116 authentication to authenticate to the origin server using the 1117 stronger scheme it requested. A particularly insidious way to mount 1118 such a MITM attack would be to offer a "free" proxy caching service 1119 to gullible users. 1121 User agents should consider measures such as presenting a visual 1122 indication at the time of the credentials request of what 1123 authentication scheme is to be used, or remembering the strongest 1124 authentication scheme ever requested by a server and produce a 1125 warning message before using a weaker one. It might also be a good 1126 idea for the user agent to be configured to demand Digest 1127 authentication in general, or from specific sites. 1129 Or, a hostile proxy might spoof the client into making a request the 1130 attacker wanted rather than one the client wanted. Of course, this 1131 is still much harder than a comparable attack against Basic 1132 Authentication. 1134 5.9. Chosen plaintext attacks 1136 With Digest authentication, a MITM or a malicious server can 1137 arbitrarily choose the nonce that the client will use to compute the 1138 response. This is called a "chosen plaintext" attack. The ability 1139 to choose the nonce is known to make cryptanalysis much easier. 1141 However, no way to analyze the one-way functions used by Digest using 1142 chosen plaintext is currently known. 1144 The countermeasure against this attack is for clients to use the 1145 "cnonce" parameter; this allows the client to vary the input to the 1146 hash in a way not chosen by the attacker. 1148 5.10. Precomputed dictionary attacks 1150 With Digest authentication, if the attacker can execute a chosen 1151 plaintext attack, the attacker can precompute the response for many 1152 common words to a nonce of its choice, and store a dictionary of 1153 (response, password) pairs. Such precomputation can often be done in 1154 parallel on many machines. It can then use the chosen plaintext 1155 attack to acquire a response corresponding to that challenge, and 1156 just look up the password in the dictionary. Even if most passwords 1157 are not in the dictionary, some might be. Since the attacker gets to 1158 pick the challenge, the cost of computing the response for each 1159 password on the list can be amortized over finding many passwords. A 1160 dictionary with 100 million password/response pairs would take about 1161 3.2 gigabytes of disk storage. 1163 The countermeasure against this attack is to for clients to use the 1164 "cnonce" parameter. 1166 5.11. Batch brute force attacks 1168 With Digest authentication, a MITM can execute a chosen plaintext 1169 attack, and can gather responses from many users to the same nonce. 1170 It can then find all the passwords within any subset of password 1171 space that would generate one of the nonce/response pairs in a single 1172 pass over that space. It also reduces the time to find the first 1173 password by a factor equal to the number of nonce/response pairs 1174 gathered. This search of the password space can often be done in 1175 parallel on many machines, and even a single machine can search large 1176 subsets of the password space very quickly -- reports exist of 1177 searching all passwords with six or fewer letters in a few hours. 1179 The countermeasure against this attack is to for clients to use of 1180 the "cnonce" parameter. 1182 5.12. Summary 1184 By modern cryptographic standards Digest Authentication is weak. But 1185 for a large range of purposes it is valuable as a replacement for 1186 Basic Authentication. It remedies some, but not all, weaknesses of 1187 Basic Authentication. Its strength may vary depending on the 1188 implementation. In particular the structure of the nonce (which is 1189 dependent on the server implementation) may affect the ease of 1190 mounting a replay attack. A range of server options is appropriate 1191 since, for example, some implementations may be willing to accept the 1192 server overhead of one-time nonces or digests to eliminate the 1193 possibility of replay. Others may satisfied with a nonce like the 1194 one recommended above restricted to a single IP address and a single 1195 ETag or with a limited lifetime. 1197 The bottom line is that *any* compliant implementation will be 1198 relatively weak by cryptographic standards, but *any* compliant 1199 implementation will be far superior to Basic Authentication. 1201 6. IANA Considerations 1203 6.1. HTTP Digest Hash Algorithms Registry 1205 This specification creates a new IANA registry named "HTTP Digest 1206 Hash Algorithms". When registering a new hash algorithm, the 1207 following information MUST be provided: 1209 Hash Algorithm 1211 The textual name of the hash algorithm. 1213 Digest Size 1215 The size of the algorithm's output in bits. 1217 Reference 1219 A reference to the specification that describes the new algorithm. 1221 The update policy for this registry shall be Specification Required. 1223 The initial registry will contain the following entries: 1225 +----------------+-------------+-----------+ 1226 | Hash Algorithm | Digest Size | Reference | 1227 +----------------+-------------+-----------+ 1228 | "MD5" | 128 | RFC XXXX | 1229 | "SHA-512-256" | 256 | RFC XXXX | 1230 | "SHA-256" | 256 | RFC XXXX | 1231 +----------------+-------------+-----------+ 1233 Each one of the algorithms defined in the registry might have a -sess 1234 variant, e.g. MD5-sess, SHA-256-sess, etc. 1236 6.2. Digest Scheme Registration 1238 This specification registers the Digest scheme with the 1239 Authentication Scheme Registry. 1241 Authentication Scheme Name: Digest 1243 Pointer to specification text: this specification 1245 6.3. Authentication-Info Header Registration 1247 This specification registers the Authentication-Info Header field 1248 with the Message Header Field Registry. 1250 Header Field Name: Authentication-Info 1252 Protocol: http 1254 Status: standard 1256 Reference: RFCXXXX, Section 3.5 1258 7. Acknowledgments 1260 The authors of this document would like to thank the authors of 1261 [RFC2617], as this document heavily borrows text from their document 1262 to provide a complete description of the digest scheme and its 1263 operations. 1265 Special thanks to Julian Reschke for his reviews, comments, 1266 suggestions, and text provided to various areas in this document. 1268 The authors would like to thank Stephen Farrell, Yoav Nir, Phillip 1269 Hallam-Baker, Manu Sporny, Paul Hoffman, Yaron Sheffer, Sean Turner, 1270 Geoff Baskwill, Eric Cooper, Bjoern Hoehrmann, Martin Durst, Peter 1271 Saint-Andre, Michael Sweet, Daniel Stenberg, Brett Tate, Paul Leach, 1272 Ilari Liusvaara, and Gary Mort, Alexey Melnikov, and Benjamin Kaduk 1273 for their careful review and comments. 1275 The authors would like to thank Jonathan Stoke, Nico Williams, Harry 1276 Halpin, and Phil Hunt for their comments on the mailing list when 1277 discussing various aspects of this document. 1279 The authors would like to thank Paul Kyzivat and Dale Worley for 1280 their careful review and feedback on some aspects of this document. 1282 8. References 1284 8.1. Normative References 1286 [PRECIS] Saint-Andre, P. and A. Melnikov, "Preparation, 1287 Enforcement, and Comparison of Internationalized Strings 1288 Representing Usernames and Passwords", draft-ietf-precis- 1289 saslprepbis-12 (work in progress), December 2014. 1291 [RFC2119] Bradner, S., "Key words for use in RFCs to Indicate 1292 Requirement Levels", BCP 14, RFC 2119, March 1997. 1294 [RFC2978] Freed, N. and J. Postel, "IANA Charset Registration 1295 Procedures", BCP 19, RFC 2978, October 2000. 1297 [RFC3629] Yergeau, F., "UTF-8, a transformation format of ISO 1298 10646", STD 63, RFC 3629, November 2003. 1300 [RFC3986] Berners-Lee, T., Fielding, R., and L. Masinter, "Uniform 1301 Resource Identifier (URI): Generic Syntax", STD 66, RFC 1302 3986, January 2005. 1304 [RFC4086] Eastlake, D., Schiller, J., and S. Crocker, "Randomness 1305 Requirements for Security", BCP 106, RFC 4086, June 2005. 1307 [RFC5198] Klensin, J. and M. Padlipsky, "Unicode Format for Network 1308 Interchange", RFC 5198, March 2008. 1310 [RFC5234] Crocker, D., Ed. and P. Overell, "Augmented BNF for Syntax 1311 Specifications: ABNF", STD 68, RFC 5234, January 2008. 1313 [RFC5987] Reschke, J., "Character Set and Language Encoding for 1314 Hypertext Transfer Protocol (HTTP) Header Field 1315 Parameters", RFC 5987, August 2010. 1317 [RFC6454] Barth, A., "The Web Origin Concept", RFC 6454, December 1318 2011. 1320 [RFC7230] Fielding, R., Ed. and J. Reschke, Ed., "Hypertext Transfer 1321 Protocol (HTTP/1.1): Message Syntax and Routing", RFC 1322 7230, June 2014. 1324 [RFC7231] Fielding, R., Ed. and J. Reschke, Ed., "Hypertext Transfer 1325 Protocol (HTTP/1.1): Semantics and Content", RFC 7231, 1326 June 2014. 1328 [RFC7234] Fielding, R., Ed., Nottingham, M., Ed., and J. Reschke, 1329 Ed., "Hypertext Transfer Protocol (HTTP/1.1): Caching", 1330 RFC 7234, June 2014. 1332 [RFC7235] Fielding, R., Ed. and J. Reschke, Ed., "Hypertext Transfer 1333 Protocol (HTTP/1.1): Authentication", RFC 7235, June 2014. 1335 8.2. Informative References 1337 [BASIC] Reschke, J., "The 'Basic' HTTP Authentication Scheme", 1338 draft-ietf-httpauth-basicauth-update-04 (work in 1339 progress), December 2014. 1341 [RFC2195] Klensin, J., Catoe, R., and P. Krumviede, "IMAP/POP 1342 AUTHorize Extension for Simple Challenge/Response", RFC 1343 2195, September 1997. 1345 [RFC2617] Franks, J., Hallam-Baker, P., Hostetler, J., Lawrence, S., 1346 Leach, P., Luotonen, A., and L. Stewart, "HTTP 1347 Authentication: Basic and Digest Access Authentication", 1348 RFC 2617, June 1999. 1350 [RFC2818] Rescorla, E., "HTTP Over TLS", RFC 2818, May 2000. 1352 [RFC4513] Harrison, R., "Lightweight Directory Access Protocol 1353 (LDAP): Authentication Methods and Security Mechanisms", 1354 RFC 4513, June 2006. 1356 Authors' Addresses 1358 Rifaat Shekh-Yusef (editor) 1359 Avaya 1360 250 Sidney Street 1361 Belleville, Ontario 1362 Canada 1364 Phone: +1-613-967-5267 1365 EMail: rifaat.ietf@gmail.com 1366 David Ahrens 1367 Independent 1368 California 1369 USA 1371 EMail: ahrensdc@gmail.com 1373 Sophie Bremer 1374 Netzkonform 1375 Germany 1377 EMail: sophie.bremer@netzkonform.de