idnits 2.17.1 draft-ietf-httpauth-scram-auth-08.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 : ---------------------------------------------------------------------------- ** There are 11 instances of too long lines in the document, the longest one being 24 characters in excess of 72. Miscellaneous warnings: ---------------------------------------------------------------------------- == The copyright year in the IETF Trust and authors Copyright Line does not match the current year -- The document date (October 18, 2015) is 3113 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) == Unused Reference: 'RFC3454' is defined on line 689, but no explicit reference was found in the text == Unused Reference: 'RFC4013' is defined on line 698, but no explicit reference was found in the text == Unused Reference: 'RFC5056' is defined on line 706, but no explicit reference was found in the text == Unused Reference: 'RFC5929' is defined on line 721, but no explicit reference was found in the text == Unused Reference: 'RFC4616' is defined on line 767, but no explicit reference was found in the text == Unused Reference: 'RFC5226' is defined on line 776, but no explicit reference was found in the text == Outdated reference: A later version (-04) exists of draft-hansen-scram-sha256-02 ** Downref: Normative reference to an Informational RFC: RFC 2104 ** Downref: Normative reference to an Informational RFC: RFC 3174 ** Obsolete normative reference: RFC 3454 (Obsoleted by RFC 7564) ** Obsolete normative reference: RFC 4013 (Obsoleted by RFC 7613) ** Obsolete normative reference: RFC 7235 (Obsoleted by RFC 9110) ** Obsolete normative reference: RFC 7613 (Obsoleted by RFC 8265) ** Obsolete normative reference: RFC 7615 (Obsoleted by RFC 9110) -- Obsolete informational reference (is this intentional?): RFC 2898 (Obsoleted by RFC 8018) -- Obsolete informational reference (is this intentional?): RFC 5226 (Obsoleted by RFC 8126) -- Obsolete informational reference (is this intentional?): RFC 5246 (Obsoleted by RFC 8446) Summary: 8 errors (**), 0 flaws (~~), 8 warnings (==), 4 comments (--). Run idnits with the --verbose option for more detailed information about the items above. -------------------------------------------------------------------------------- 2 HTTPAUTH A. Melnikov 3 Internet-Draft Isode Ltd 4 Intended status: Standards Track October 18, 2015 5 Expires: April 20, 2016 7 Salted Challenge Response (SCRAM) HTTP Authentication Mechanism 8 draft-ietf-httpauth-scram-auth-08.txt 10 Abstract 12 The secure authentication mechanism most widely deployed and used by 13 Internet application protocols is the transmission of clear-text 14 passwords over a channel protected by Transport Layer Security (TLS). 15 There are some significant security concerns with that mechanism, 16 which could be addressed by the use of a challenge response 17 authentication mechanism protected by TLS. Unfortunately, the HTTP 18 Digest challenge response mechanism presently on the standards track 19 failed widespread deployment, and have had success only in limited 20 use. 22 This specification describes a family of HTTP authentication 23 mechanisms called the Salted Challenge Response Authentication 24 Mechanism (SCRAM), which addresses security concerns with HTTP Digest 25 and meets the deployability requirements. When used in combination 26 with TLS or an equivalent security layer, a mechanism from this 27 family could improve the status-quo for HTTP authentication. 29 Status of This Memo 31 This Internet-Draft is submitted in full conformance with the 32 provisions of BCP 78 and BCP 79. 34 Internet-Drafts are working documents of the Internet Engineering 35 Task Force (IETF). Note that other groups may also distribute 36 working documents as Internet-Drafts. The list of current Internet- 37 Drafts is at http://datatracker.ietf.org/drafts/current/. 39 Internet-Drafts are draft documents valid for a maximum of six months 40 and may be updated, replaced, or obsoleted by other documents at any 41 time. It is inappropriate to use Internet-Drafts as reference 42 material or to cite them other than as "work in progress." 44 This Internet-Draft will expire on April 20, 2016. 46 Copyright Notice 48 Copyright (c) 2015 IETF Trust and the persons identified as the 49 document authors. All rights reserved. 51 This document is subject to BCP 78 and the IETF Trust's Legal 52 Provisions Relating to IETF Documents 53 (http://trustee.ietf.org/license-info) in effect on the date of 54 publication of this document. Please review these documents 55 carefully, as they describe your rights and restrictions with respect 56 to this document. Code Components extracted from this document must 57 include Simplified BSD License text as described in Section 4.e of 58 the Trust Legal Provisions and are provided without warranty as 59 described in the Simplified BSD License. 61 Table of Contents 63 1. Conventions Used in This Document . . . . . . . . . . . . . . 2 64 1.1. Terminology . . . . . . . . . . . . . . . . . . . . . . . . 3 65 1.2. Notation . . . . . . . . . . . . . . . . . . . . . . . . . 4 66 2. Introduction . . . . . . . . . . . . . . . . . . . . . . . . 5 67 3. SCRAM Algorithm Overview . . . . . . . . . . . . . . . . . . 6 68 4. SCRAM Mechanism Names . . . . . . . . . . . . . . . . . . . . 7 69 5. SCRAM Authentication Exchange . . . . . . . . . . . . . . . . 7 70 5.1. One round trip reauthentication . . . . . . . . . . . . . . 10 71 6. Use of Authentication-Info header field with SCRAM . . . . . 11 72 7. Formal Syntax . . . . . . . . . . . . . . . . . . . . . . . . 12 73 8. Security Considerations . . . . . . . . . . . . . . . . . . . 12 74 9. IANA Considerations . . . . . . . . . . . . . . . . . . . . . 14 75 10. Acknowledgements . . . . . . . . . . . . . . . . . . . . . . 14 76 11. Design Motivations . . . . . . . . . . . . . . . . . . . . . 14 77 12. Open Issues . . . . . . . . . . . . . . . . . . . . . . . . . 15 78 13. References . . . . . . . . . . . . . . . . . . . . . . . . . 15 79 13.1. Normative References . . . . . . . . . . . . . . . . . . . 15 80 13.2. Informative References . . . . . . . . . . . . . . . . . . 17 81 Author's Address . . . . . . . . . . . . . . . . . . . . . . . . 18 83 1. Conventions Used in This Document 85 The key words "MUST", "MUST NOT", "REQUIRED", "SHALL", "SHALL NOT", 86 "SHOULD", "SHOULD NOT", "RECOMMENDED", "MAY", and "OPTIONAL" in this 87 document are to be interpreted as described in [RFC2119]. 89 Formal syntax is defined by [RFC5234] including the core rules 90 defined in Appendix B of [RFC5234]. 92 Example lines prefaced by "C:" are sent by the client and ones 93 prefaced by "S:" by the server. If a single "C:" or "S:" label 94 applies to multiple lines, then the line breaks between those lines 95 are for editorial clarity only, and are not part of the actual 96 protocol exchange. 98 1.1. Terminology 100 This document uses several terms defined in [RFC4949] ("Internet 101 Security Glossary") including the following: authentication, 102 authentication exchange, authentication information, brute force, 103 challenge-response, cryptographic hash function, dictionary attack, 104 eavesdropping, hash result, keyed hash, man-in-the-middle, nonce, 105 one-way encryption function, password, replay attack and salt. 106 Readers not familiar with these terms should use that glossary as a 107 reference. 109 Some clarifications and additional definitions follow: 111 o Authentication information: Information used to verify an identity 112 claimed by a SCRAM client. The authentication information for a 113 SCRAM identity consists of salt, iteration count, the "StoredKey" 114 and "ServerKey" (as defined in the algorithm overview) for each 115 supported cryptographic hash function. 117 o Authentication database: The database used to look up the 118 authentication information associated with a particular identity. 119 For application protocols, LDAPv3 (see [RFC4510]) is frequently 120 used as the authentication database. For network-level protocols 121 such as PPP or 802.11x, the use of RADIUS [RFC2865] is more 122 common. 124 o Base64: An encoding mechanism defined in Section 4 of [RFC4648] 125 which converts an octet string input to a textual output string 126 which can be easily displayed to a human. The use of base64 in 127 SCRAM is restricted to the canonical form with no whitespace. 129 o Octet: An 8-bit byte. 131 o Octet string: A sequence of 8-bit bytes. 133 o Salt: A random octet string that is combined with a password 134 before applying a one-way encryption function. This value is used 135 to protect passwords that are stored in an authentication 136 database. 138 1.2. Notation 140 The pseudocode description of the algorithm uses the following 141 notations: 143 o ":=": The variable on the left hand side represents the octet 144 string resulting from the expression on the right hand side. 146 o "+": Octet string concatenation. 148 o "[ ]": A portion of an expression enclosed in "[" and "]" may not 149 be included in the result under some circumstances. See the 150 associated text for a description of those circumstances. 152 o Normalize(str): Apply the Preparation and Enforcement steps 153 according to the OpaqueString profile (see [RFC7613]) to a UTF-8 154 [RFC3629] encoded "str". The resulting string is also in UTF-8. 155 Note that implementations MUST either implement OpaqueString 156 profile operations from [RFC7613], or disallow use of non US-ASCII 157 Unicode codepoints in "str". The latter is a particular case of 158 compliance with [RFC7613]. 160 o HMAC(key, str): Apply the HMAC keyed hash algorithm (defined in 161 [RFC2104]) using the octet string represented by "key" as the key 162 and the octet string "str" as the input string. The size of the 163 result is the hash result size for the hash function in use. For 164 example, it is 32 octets for SHA-256 and 20 octets for SHA-1 (see 165 [RFC3174]). 167 o H(str): Apply the cryptographic hash function to the octet string 168 "str", producing an octet string as a result. The size of the 169 result depends on the hash result size for the hash function in 170 use. 172 o XOR: Apply the exclusive-or operation to combine the octet string 173 on the left of this operator with the octet string on the right of 174 this operator. The length of the output and each of the two 175 inputs will be the same for this use. 177 o Hi(str, salt, i): 179 U1 := HMAC(str, salt + INT(1)) 180 U2 := HMAC(str, U1) 181 ... 182 Ui-1 := HMAC(str, Ui-2) 183 Ui := HMAC(str, Ui-1) 185 Hi := U1 XOR U2 XOR ... XOR Ui 187 where "i" is the iteration count, "+" is the string concatenation 188 operator and INT(g) is a four-octet encoding of the integer g, 189 most significant octet first. 191 Hi() is, essentially, PBKDF2 [RFC2898] with HMAC() as the PRF and 192 with dkLen == output length of HMAC() == output length of H(). 194 2. Introduction 196 This specification describes a family of authentication mechanisms 197 called the Salted Challenge Response Authentication Mechanism (SCRAM) 198 which addresses the requirements necessary to deploy a challenge- 199 response mechanism more widely than past attempts (see [RFC5802]). 200 When used in combination with Transport Layer Security (TLS, see 201 [RFC5246]) or an equivalent security layer, a mechanism from this 202 family could improve the status-quo for HTTP authentication. 204 HTTP SCRAM is adoptation of [RFC5802] for use in HTTP. (SCRAM data 205 exchanged is identical to what is defined in [RFC5802].) It also 206 adds 1 round trip reauthentication mode. 208 HTTP SCRAM provides the following protocol features: 210 o The authentication information stored in the authentication 211 database is not sufficient by itself (without a dictionary attack) 212 to impersonate the client. The information is salted to prevent a 213 pre-stored dictionary attack if the database is stolen. 215 o The server does not gain the ability to impersonate the client to 216 other servers (with an exception for server-authorized proxies). 218 o The mechanism permits the use of a server-authorized proxy without 219 requiring that proxy to have super-user rights with the back-end 220 server. 222 o Mutual authentication is supported, but only the client is named 223 (i.e., the server has no name). 225 3. SCRAM Algorithm Overview 227 The following is a description of a full HTTP SCRAM authentication 228 exchange. Note that this section omits some details, such as client 229 and server nonces. See Section 5 for more details. 231 To begin with, the SCRAM client is in possession of a username and 232 password (*) (or a ClientKey/ServerKey, or SaltedPassword). It sends 233 the username to the server, which retrieves the corresponding 234 authentication information, i.e. a salt, StoredKey, ServerKey and the 235 iteration count i. (Note that a server implementation may choose to 236 use the same iteration count for all accounts.) The server sends the 237 salt and the iteration count to the client, which then computes the 238 following values and sends a ClientProof to the server: 240 (*) - Note that both the username and the password MUST be encoded in 241 UTF-8 [RFC3629]. 243 Informative Note: Implementors are encouraged to create test cases 244 that use both username passwords with non-ASCII codepoints. In 245 particular, it's useful to test codepoints whose "Unicode 246 Normalization Form C" and "Unicode Normalization Form KC" are 247 different. Some examples of such codepoints include Vulgar Fraction 248 One Half (U+00BD) and Acute Accent (U+00B4). 250 SaltedPassword := Hi(Normalize(password), salt, i) 251 ClientKey := HMAC(SaltedPassword, "Client Key") 252 StoredKey := H(ClientKey) 253 AuthMessage := client-first-message-bare + "," + 254 server-first-message + "," + 255 client-final-message-without-proof 256 ClientSignature := HMAC(StoredKey, AuthMessage) 257 ClientProof := ClientKey XOR ClientSignature 258 ServerKey := HMAC(SaltedPassword, "Server Key") 259 ServerSignature := HMAC(ServerKey, AuthMessage) 261 The server authenticates the client by computing the ClientSignature, 262 exclusive-ORing that with the ClientProof to recover the ClientKey 263 and verifying the correctness of the ClientKey by applying the hash 264 function and comparing the result to the StoredKey. If the ClientKey 265 is correct, this proves that the client has access to the user's 266 password. 268 Similarly, the client authenticates the server by computing the 269 ServerSignature and comparing it to the value sent by the server. If 270 the two are equal, it proves that the server had access to the user's 271 ServerKey. 273 For initial authentication the AuthMessage is computed by 274 concatenating decoded "data" attribute values from the authentication 275 exchange. The format of these messages is defined in [RFC5802]. 277 4. SCRAM Mechanism Names 279 A SCRAM mechanism name (authentication scheme) is a string "SCRAM-" 280 followed by the uppercased name of the underlying hash function taken 281 from the IANA "Hash Function Textual Names" registry (see 282 http://www.iana.org) . 284 For interoperability, all HTTP clients and servers supporting SCRAM 285 MUST implement the SCRAM-SHA-256 authentication mechanism, i.e. an 286 authentication mechanism from the SCRAM family that uses the SHA-256 287 hash function as defined in [I-D.hansen-scram-sha256]. 289 5. SCRAM Authentication Exchange 291 HTTP SCRAM is a HTTP Authentication mechanism whose client response 292 () and server challenge () 293 messages are text-based messages containing one or more attribute- 294 value pairs separated by commas. The messages and their attributes 295 are described below and defined in Section 7. 297 challenge-scram = scram-name [1*SP 1#auth-param] 298 ; Complies with ABNF from RFC 7235. 299 ; Included in the WWW-Authenticate header field. 301 credentials-scram = scram-name [1*SP 1#auth-param] 302 ; Complies with from RFC 7235. 303 ; Included in the Authorization header field. 305 scram-name = "SCRAM-SHA-256" / "SCRAM-SHA-1" / other-scram-name 306 ; SCRAM-SHA-256 and SCRAM-SHA-1 are registered by this RFC 307 other-scram-name = "SCRAM-" hash-name 308 ; hash-name is a capitalized form of names from IANA 309 ; "Hash Function Textual Names" registry. 310 ; Additional SCRAM names must be registered in both 311 ; the IANA "SASL mechanisms" registry 312 ; and the IANA "authentication scheme" registry. 314 This is a simple example of a SCRAM-SHA-256 authentication exchange 315 (no support for channel bindings, as this feature is not currently 316 supported by HTTP). Username 'user' and password 'pencil' are used. 318 Note that long lines are folded for readability. 320 C: GET /resource HTTP/1.1 321 C: Host: server.example.com 322 C: [...] 324 S: HTTP/1.1 401 Unauthorized 325 S: WWW-Authenticate: Digest realm="realm1@host.com", 326 Digest realm="realm2@host.com", 327 Digest realm="realm3@host.com", 328 SCRAM-SHA-1 realm="realm3@host.com", 329 SCRAM-SHA-1 realm="testrealm@host.com" 330 S: [...] 332 C: GET /resource HTTP/1.1 333 C: Host: server.example.com 334 C: Authorization: SCRAM-SHA-1 realm="testrealm@host.com", 335 data=biwsbj11c2VyLHI9ck9wck5HZndFYmVSV2diTkVrcU8K 336 C: [...] 338 S: HTTP/1.1 401 Unauthorized 339 S: WWW-Authenticate: SCRAM-SHA-1 340 sid=AAAABBBBCCCCDDDD, 341 data=cj1yT3ByTkdmd0ViZVJXZ2JORWtxTyVodllEcFdVYTJSYVRDQWZ1eEZJbGo 342 paE5sRixzPVcyMlphSjBTTlk3c29Fc1VFamI2Z1E9PSxpPTQwOTYK 343 S: [...] 345 C: GET /resource HTTP/1.1 346 C: Host: server.example.com 347 C: Authorization: SCRAM-SHA-1 sid=AAAABBBBCCCCDDDD, 348 data=Yz1iaXdzLHI9ck9wck5HZndFYmVSV2diTkVrcU8laHZZRHBXVWEyUmFUQ0FmdXhG 349 SWxqKWhObEYscD1kSHpiWmFwV0lrNGpVaE4rVXRlOXl0YWc5empmTUhnc3FtbWl6 350 N0FuZFZRPQo= 351 C: [...] 353 S: HTTP/1.1 200 Ok 354 S: Authentication-Info: sid=AAAABBBBCCCCDDDD, 355 data=dj02cnJpVFJCaTIzV3BSUi93dHVwK21NaFVaVW4vZEI1bkxUSlJzamw5NUc0PQo= 356 S: [...Other header fields and resource body...] 358 In the above example the first client request contains data attribute 359 which base64 decodes as follows: "n,,n=user,r=rOprNGfwEbeRWgbNEkqO" 360 (with no quotes). Server then responds with data attribute which 361 base64 decodes as follows: "r=rOprNGfwEbeRWgbNEkqO%hvYDpWUa2RaTCAfuxF 362 Ilj)hNlF$k0,s=W22ZaJ0SNY7soEsUEjb6gQ==,i=4096". The next client 363 request contains data attribute which base64 decodes as follows: "c=b 364 iws,r=rOprNGfwEbeRWgbNEkqO%hvYDpWUa2RaTCAfuxFIlj)hNlF$k0,p=dHzbZapWIk 365 4jUhN+Ute9ytag9zjfMHgsqmmiz7AndVQ=". An the final server response 366 contains data attribute which base64 decodes as follows: 367 "v=6rriTRBi23WpRR/wtup+mMhUZUn/dB5nLTJRsjl95G4=". 369 Note that in the example above the client can also initiate SCRAM 370 authentication without first being prompted by the server. 372 Initial "SCRAM-SHA-256" authentication starts with sending the 373 "Authorization" request header field defined by HTTP/1.1, Part 7 374 [RFC7235] containing "SCRAM-SHA-256" authentication scheme and the 375 following attributes: 377 o A "realm" attribute MAY be included to indicate the scope of 378 protection in the manner described in HTTP/1.1, Part 7 [RFC7235]. 379 As specified in [RFC7235], the "realm" attribute MUST NOT appear 380 more than once. The realm attribute only appears in the first 381 SCRAM message to the server and in the first SCRAM response from 382 the server. 384 o The client also includes the data attribute that contains base64 385 encoded "client-first-message" [RFC5802] containing: 387 * a header consisting of a flag indicating whether channel 388 binding is supported-but-not-used, not supported, or used . 389 Note that the header always starts with "n", "y" or "p", 390 otherwise the message is invalid and authentication MUST fail. 392 * SCRAM username and a random, unique nonce attributes. 394 In HTTP response, the server sends WWW-Authenticate header field 395 containing: a unique session identifier (the "sid" attribute) plus 396 the "data" attribute containing base64-encoded "server-first-message" 397 [RFC5802]. The "server-first-message" contains the user's iteration 398 count i, the user's salt, and the nonce with a concatenation of the 399 client-specified one with a server nonce. [[CREF1: OPEN ISSUE: 400 Alternatively, the "sid" attribute can be another header field.]] 402 The client then responds with another HTTP request with the 403 Authorization header field, which includes the "sid" attribute 404 received in the previous server response, together with the "data" 405 attribute containing base64-encoded "client-final-message" data. The 406 latter has the same nonce and a ClientProof computed using the 407 selected hash function (e.g. SHA-256) as explained earlier. 409 The server verifies the nonce and the proof, and, finally, it 410 responds with a 200 HTTP response with the Authentication-Info header 411 field [RFC7615] containing the "sid" attribute (as received from the 412 client) and the "data" attribute containing base64-encoded "server- 413 final-message", concluding the authentication exchange. 415 The client then authenticates the server by computing the 416 ServerSignature and comparing it to the value sent by the server. If 417 the two are different, the client MUST consider the authentication 418 exchange to be unsuccessful and it might have to drop the connection. 420 5.1. One round trip reauthentication 422 If the server supports SCRAM reauthentication, the server sends in 423 its initial HTTP response a WWW-Authenticate header field containing: 424 the "realm" attribute (as defined earlier), the "sr" attribute that 425 contains the server part of the "r" attribute (see [RFC5802] and 426 optional "ttl" attribute (which contains the "sr" value validity in 427 seconds). 429 If the client has authenticated to the same realm before (i.e. it 430 remembers "i" and "s" attributes for the user from earlies 431 authentication exchanges with the server), it can respond to that 432 with "client-final-message". [[CREF2: Should some counter be added 433 to make "sr" unique for each reauth?]] 435 If the server considers the server part of the nonce (the "r" 436 attribute) to be still valid, it will provide access to the requested 437 resource (assuming the client hash verifies correctly, of course). 438 However if the server considers that the server part of the nonce is 439 stale (for example if the "sr" value is used after the "ttl" 440 seconds), the server returns "401 Unauthorized" containing the SCRAM 441 mechanism name with the following attributes: a new "sr", 442 "stale=true" and an optional "ttl". The "stale" attribute signals to 443 the client that there is no need to ask user for the password. 445 Formally, the "stale" attribute is defined as follows: A flag, 446 indicating that the previous request from the client was rejected 447 because the nonce value was stale. If stale is TRUE (case- 448 insensitive), the client may wish to simply retry the request with 449 a new encrypted response, without reprompting the user for a new 450 username and password. The server should only set stale to TRUE 451 if it receives a request for which the nonce is invalid but with a 452 valid digest for that nonce (indicating that the client knows the 453 correct username/password). If stale is FALSE, or anything other 454 than TRUE, or the stale directive is not present, the username 455 and/or password are invalid, and new values must be obtained. 457 When constructing AuthMessage Section 3 to be used for calculating 458 client and server proofs, "client-first-message-bare" and "server- 459 first-message" are reconstructed from data known to the client and 460 the server. 462 Reauthentication can look like this: 464 C: GET /resource HTTP/1.1 465 C: Host: server.example.com 466 C: [...] 468 S: HTTP/1.1 401 Unauthorized 469 S: WWW-Authenticate: Digest realm="realm1@host.com", 470 Digest realm="realm2@host.com", 471 Digest realm="realm3@host.com", 472 SCRAM-SHA-1 realm="realm3@host.com", 473 SCRAM-SHA-1 realm="testrealm@host.com", sr=pWUa2RaTCAfuxFIlj)hNlF$k0 474 SCRAM-SHA-1 realm="testrealm2@host.com", sr=AAABBBCCCDDD, ttl=120 475 S: [...] 477 [Client authenticates as usual to realm "testrealm@host.com"] 479 [Some time later client decides to reauthenticate. 480 It will use the cached "i" (4096) and "s" (W22ZaJ0SNY7soEsUEjb6gQ==) from earlies exchanges. 481 It will use the server advertised "sr" value as the server part of the "r".] 483 C: GET /resource HTTP/1.1 484 C: Host: server.example.com 485 C: Authorization: SCRAM-SHA-1 realm="testrealm@host.com", 486 data=Yz1iaXdzLHI9ck9wck5HZndFYmVSV2diTkVrcU8laHZZRHBXVWEyUmFUQ0FmdXhG 487 SWxqKWhObEYscD1kSHpiWmFwV0lrNGpVaE4rVXRlOXl0YWc5empmTUhnc3FtbWl6 488 N0FuZFZRPQo= 489 C: [...] 491 S: HTTP/1.1 200 Ok 492 S: Authentication-Info: sid=AAAABBBBCCCCDDDD, 493 data=dj02cnJpVFJCaTIzV3BSUi93dHVwK21NaFVaVW4vZEI1bkxUSlJzamw5NUc0PQo= 494 S: [...Other header fields and resource body...] 496 6. Use of Authentication-Info header field with SCRAM 498 When used with SCRAM, the Authentication-Info header field is allowed 499 in the trailer of an HTTP message transferred via chunked transfer- 500 coding. 502 7. Formal Syntax 504 The following syntax specification uses the Augmented Backus-Naur 505 Form (ABNF) notation as specified in [RFC5234]. "UTF8-2", "UTF8-3" 506 and "UTF8-4" non-terminal are defined in [RFC3629]. 508 ALPHA = 509 DIGIT = 511 base64-char = ALPHA / DIGIT / "/" / "+" 513 base64-4 = 4base64-char 515 base64-3 = 3base64-char "=" 517 base64-2 = 2base64-char "==" 519 base64 = *base64-4 [base64-3 / base64-2] 521 sr = "sr=" s-nonce 522 ;; s-nonce is defined in RFC 5802. 524 data = "data=" base64 525 ;; The data attribute value is base64 encoded 526 ;; SCRAM challenge or response defined in 527 ;; RFC 5802. 529 ttl = "ttl" = 1*DIGIT 530 ;; "sr" value validity in seconds. 531 ;; No leading 0s. 533 sid = "sid=" token 534 ;; See token definition in RFC 7235. 536 stale = "stale=" ( "true" / "false" ) 538 realm = "realm=" 540 8. Security Considerations 542 If the authentication exchange is performed without a strong security 543 layer (such as TLS with data confidentiality), then a passive 544 eavesdropper can gain sufficient information to mount an offline 545 dictionary or brute-force attack which can be used to recover the 546 user's password. The amount of time necessary for this attack 547 depends on the cryptographic hash function selected, the strength of 548 the password and the iteration count supplied by the server. An 549 external security layer with strong encryption will prevent this 550 attack. 552 If the external security layer used to protect the SCRAM exchange 553 uses an anonymous key exchange, then the SCRAM channel binding 554 mechanism can be used to detect a man-in-the-middle attack on the 555 security layer and cause the authentication to fail as a result. 556 However, the man-in-the-middle attacker will have gained sufficient 557 information to mount an offline dictionary or brute-force attack. 558 For this reason, SCRAM allows to increase the iteration count over 559 time. (Note that a server that is only in posession of "StoredKey" 560 and "ServerKey" can't automatic increase the iteration count upon 561 successful authentication. Such increase would require resetting 562 user's password.) 564 If the authentication information is stolen from the authentication 565 database, then an offline dictionary or brute-force attack can be 566 used to recover the user's password. The use of salt mitigates this 567 attack somewhat by requiring a separate attack on each password. 568 Authentication mechanisms which protect against this attack are 569 available (e.g., the EKE class of mechanisms). RFC 2945 [RFC2945] is 570 an example of such technology. 572 If an attacker obtains the authentication information from the 573 authentication repository and either eavesdrops on one authentication 574 exchange or impersonates a server, the attacker gains the ability to 575 impersonate that user to all servers providing SCRAM access using the 576 same hash function, password, iteration count and salt. For this 577 reason, it is important to use randomly-generated salt values. 579 SCRAM does not negotiate a hash function to use. Hash function 580 negotiation is left to the HTTP authentication mechanism negotiation. 581 It is important that clients be able to sort a locally available list 582 of mechanisms by preference so that the client may pick the most 583 preferred of a server's advertised mechanism list. This preference 584 order is not specified here as it is a local matter. The preference 585 order should include objective and subjective notions of mechanism 586 cryptographic strength (e.g., SCRAM with a successor to SHA-1 may be 587 preferred over SCRAM with SHA-1). 589 SCRAM does not protect against downgrade attacks of channel binding 590 types. The complexities of negotiation a channel binding type, and 591 handling down-grade attacks in that negotiation, was intentionally 592 left out of scope for this document. 594 A hostile server can perform a computational denial-of-service attack 595 on clients by sending a big iteration count value. 597 See [RFC4086] for more information about generating randomness. 599 9. IANA Considerations 601 New mechanisms in the SCRAM- family are registered according to the 602 IANA procedure specified in [RFC5802]. 604 Note to future SCRAM- mechanism designers: each new SCRAM- HTTP 605 authentication mechanism MUST be explicitly registered with IANA and 606 MUST comply with SCRAM- mechanism naming convention defined in 607 Section 4 of this document. 609 IANA is requested to add the following entry to the Authentication 610 Scheme Registry defined in HTTP/1.1, Part 7 [RFC7235]: 612 Authentication Scheme Name: SCRAM-SHA-256 613 Pointer to specification text: [[ this document ]] 614 Notes (optional): (none) 616 Authentication Scheme Name: SCRAM-SHA-1 617 Pointer to specification text: [[ this document ]] 618 Notes (optional): (none) 620 10. Acknowledgements 622 This document benefited from discussions on the HTTPAuth, SASL and 623 Kitten WG mailing lists. The authors would like to specially thank 624 co-authors of [RFC5802] from which lots of text was copied. 626 Thank you to Martin Thomson for the idea of adding "ttl" attribute. 628 Thank you to Julian F. Reschke for corrections regarding use of 629 Authentication-Info header field. 631 Special thank you to Tony Hansen for doing an early implementation 632 and providing extensive comments on the draft. 634 11. Design Motivations 636 The following design goals shaped this document. Note that some of 637 the goals have changed since the initial version of the document. 639 o The HTTP authentication mechanism has all modern features: support 640 for internationalized usernames and passwords, support for channel 641 bindings. 643 o The protocol supports mutual authentication. 645 o The authentication information stored in the authentication 646 database is not sufficient by itself to impersonate the client. 648 o The server does not gain the ability to impersonate the client to 649 other servers (with an exception for server-authorized proxies), 650 unless such other servers allow SCRAM authentication and use the 651 same salt and iteration count for the user. 653 o The mechanism is extensible, but [hopefully] not overengineered in 654 this respect. 656 o Easier to implement than HTTP Digest in both clients and servers. 658 12. Open Issues 660 Should "sid" directive be an attribute or a new HTTP header field 661 shared with other HTTP authentication mechanisms? 663 Username/password normalization algorithm needs to be picked, once 664 Precis WG concludes its work. 666 13. References 668 13.1. Normative References 670 [I-D.hansen-scram-sha256] 671 Hansen, T., "SCRAM-SHA-256 and SCRAM-SHA-256-PLUS SASL 672 Mechanisms", draft-hansen-scram-sha256-02 (work in 673 progress), October 2014. 675 [RFC2104] Krawczyk, H., Bellare, M., and R. Canetti, "HMAC: Keyed- 676 Hashing for Message Authentication", RFC 2104, 677 DOI 10.17487/RFC2104, February 1997, 678 . 680 [RFC2119] Bradner, S., "Key words for use in RFCs to Indicate 681 Requirement Levels", BCP 14, RFC 2119, 682 DOI 10.17487/RFC2119, March 1997, 683 . 685 [RFC3174] Eastlake 3rd, D. and P. Jones, "US Secure Hash Algorithm 1 686 (SHA1)", RFC 3174, DOI 10.17487/RFC3174, September 2001, 687 . 689 [RFC3454] Hoffman, P. and M. Blanchet, "Preparation of 690 Internationalized Strings ("stringprep")", RFC 3454, 691 DOI 10.17487/RFC3454, December 2002, 692 . 694 [RFC3629] Yergeau, F., "UTF-8, a transformation format of ISO 695 10646", STD 63, RFC 3629, DOI 10.17487/RFC3629, November 696 2003, . 698 [RFC4013] Zeilenga, K., "SASLprep: Stringprep Profile for User Names 699 and Passwords", RFC 4013, DOI 10.17487/RFC4013, February 700 2005, . 702 [RFC4648] Josefsson, S., "The Base16, Base32, and Base64 Data 703 Encodings", RFC 4648, DOI 10.17487/RFC4648, October 2006, 704 . 706 [RFC5056] Williams, N., "On the Use of Channel Bindings to Secure 707 Channels", RFC 5056, DOI 10.17487/RFC5056, November 2007, 708 . 710 [RFC5234] Crocker, D., Ed. and P. Overell, "Augmented BNF for Syntax 711 Specifications: ABNF", STD 68, RFC 5234, 712 DOI 10.17487/RFC5234, January 2008, 713 . 715 [RFC5802] Newman, C., Menon-Sen, A., Melnikov, A., and N. Williams, 716 "Salted Challenge Response Authentication Mechanism 717 (SCRAM) SASL and GSS-API Mechanisms", RFC 5802, 718 DOI 10.17487/RFC5802, July 2010, 719 . 721 [RFC5929] Altman, J., Williams, N., and L. Zhu, "Channel Bindings 722 for TLS", RFC 5929, DOI 10.17487/RFC5929, July 2010, 723 . 725 [RFC7235] Fielding, R., Ed. and J. Reschke, Ed., "Hypertext Transfer 726 Protocol (HTTP/1.1): Authentication", RFC 7235, 727 DOI 10.17487/RFC7235, June 2014, 728 . 730 [RFC7613] Saint-Andre, P. and A. Melnikov, "Preparation, 731 Enforcement, and Comparison of Internationalized Strings 732 Representing Usernames and Passwords", RFC 7613, 733 DOI 10.17487/RFC7613, August 2015, 734 . 736 [RFC7615] Reschke, J., "HTTP Authentication-Info and Proxy- 737 Authentication-Info Response Header Fields", RFC 7615, 738 DOI 10.17487/RFC7615, September 2015, 739 . 741 13.2. Informative References 743 [RFC2865] Rigney, C., Willens, S., Rubens, A., and W. Simpson, 744 "Remote Authentication Dial In User Service (RADIUS)", 745 RFC 2865, DOI 10.17487/RFC2865, June 2000, 746 . 748 [RFC2898] Kaliski, B., "PKCS #5: Password-Based Cryptography 749 Specification Version 2.0", RFC 2898, 750 DOI 10.17487/RFC2898, September 2000, 751 . 753 [RFC2945] Wu, T., "The SRP Authentication and Key Exchange System", 754 RFC 2945, DOI 10.17487/RFC2945, September 2000, 755 . 757 [RFC4086] Eastlake 3rd, D., Schiller, J., and S. Crocker, 758 "Randomness Requirements for Security", BCP 106, RFC 4086, 759 DOI 10.17487/RFC4086, June 2005, 760 . 762 [RFC4510] Zeilenga, K., Ed., "Lightweight Directory Access Protocol 763 (LDAP): Technical Specification Road Map", RFC 4510, 764 DOI 10.17487/RFC4510, June 2006, 765 . 767 [RFC4616] Zeilenga, K., Ed., "The PLAIN Simple Authentication and 768 Security Layer (SASL) Mechanism", RFC 4616, 769 DOI 10.17487/RFC4616, August 2006, 770 . 772 [RFC4949] Shirey, R., "Internet Security Glossary, Version 2", 773 FYI 36, RFC 4949, DOI 10.17487/RFC4949, August 2007, 774 . 776 [RFC5226] Narten, T. and H. Alvestrand, "Guidelines for Writing an 777 IANA Considerations Section in RFCs", BCP 26, RFC 5226, 778 DOI 10.17487/RFC5226, May 2008, 779 . 781 [RFC5246] Dierks, T. and E. Rescorla, "The Transport Layer Security 782 (TLS) Protocol Version 1.2", RFC 5246, 783 DOI 10.17487/RFC5246, August 2008, 784 . 786 [tls-server-end-point] 787 Zhu, L., , "Registration of TLS server end-point channel 788 bindings", IANA http://www.iana.org/assignments/ 789 channel-binding-types/tls-server-end-point, July 2008. 791 Author's Address 793 Alexey Melnikov 794 Isode Ltd 796 Email: Alexey.Melnikov@isode.com