idnits 2.17.1 draft-ietf-httpauth-scram-auth-09.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 (November 13, 2015) is 3080 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 672, but no explicit reference was found in the text == Unused Reference: 'RFC4013' is defined on line 681, but no explicit reference was found in the text == Unused Reference: 'RFC5056' is defined on line 689, but no explicit reference was found in the text == Unused Reference: 'RFC5929' is defined on line 704, but no explicit reference was found in the text == Unused Reference: 'RFC4616' is defined on line 755, but no explicit reference was found in the text == Unused Reference: 'RFC5226' is defined on line 764, but no explicit reference was found in the text ** 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 (~~), 7 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 November 13, 2015 5 Expires: May 16, 2016 7 Salted Challenge Response (SCRAM) HTTP Authentication Mechanism 8 draft-ietf-httpauth-scram-auth-09.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 May 16, 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 . . . . . . . . . . . . . . . . . . . . . . . . . 3 66 2. Introduction . . . . . . . . . . . . . . . . . . . . . . . . 5 67 3. SCRAM Algorithm Overview . . . . . . . . . . . . . . . . . . 5 68 4. SCRAM Mechanism Names . . . . . . . . . . . . . . . . . . . . 6 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 . . . . . . . . . . . . . . . . . . . . . . . . 11 73 8. Security Considerations . . . . . . . . . . . . . . . . . . . 12 74 9. IANA Considerations . . . . . . . . . . . . . . . . . . . . . 13 75 10. Acknowledgements . . . . . . . . . . . . . . . . . . . . . . 14 76 11. Design Motivations . . . . . . . . . . . . . . . . . . . . . 14 77 12. References . . . . . . . . . . . . . . . . . . . . . . . . . 15 78 12.1. Normative References . . . . . . . . . . . . . . . . . . . 15 79 12.2. Informative References . . . . . . . . . . . . . . . . . . 16 80 Author's Address . . . . . . . . . . . . . . . . . . . . . . . . 17 82 1. Conventions Used in This Document 84 The key words "MUST", "MUST NOT", "REQUIRED", "SHALL", "SHALL NOT", 85 "SHOULD", "SHOULD NOT", "RECOMMENDED", "MAY", and "OPTIONAL" in this 86 document are to be interpreted as described in [RFC2119]. 88 Formal syntax is defined by [RFC5234] including the core rules 89 defined in Appendix B of [RFC5234]. 91 Example lines prefaced by "C:" are sent by the client and ones 92 prefaced by "S:" by the server. If a single "C:" or "S:" label 93 applies to multiple lines, then the line breaks between those lines 94 are for editorial clarity only, and are not part of the actual 95 protocol exchange. 97 1.1. Terminology 99 This document uses several terms defined in [RFC4949] ("Internet 100 Security Glossary") including the following: authentication, 101 authentication exchange, authentication information, brute force, 102 challenge-response, cryptographic hash function, dictionary attack, 103 eavesdropping, hash result, keyed hash, man-in-the-middle, nonce, 104 one-way encryption function, password, replay attack and salt. 105 Readers not familiar with these terms should use that glossary as a 106 reference. 108 Some clarifications and additional definitions follow: 110 o Authentication information: Information used to verify an identity 111 claimed by a SCRAM client. The authentication information for a 112 SCRAM identity consists of salt, iteration count, the "StoredKey" 113 and "ServerKey" (as defined in the algorithm overview) for each 114 supported cryptographic hash function. 116 o Authentication database: The database used to look up the 117 authentication information associated with a particular identity. 118 For application protocols, LDAPv3 (see [RFC4510]) is frequently 119 used as the authentication database. For network-level protocols 120 such as PPP or 802.11x, the use of RADIUS [RFC2865] is more 121 common. 123 o Base64: An encoding mechanism defined in Section 4 of [RFC4648] 124 which converts an octet string input to a textual output string 125 which can be easily displayed to a human. The use of base64 in 126 SCRAM is restricted to the canonical form with no whitespace. 128 o Octet: An 8-bit byte. 130 o Octet string: A sequence of 8-bit bytes. 132 o Salt: A random octet string that is combined with a password 133 before applying a one-way encryption function. This value is used 134 to protect passwords that are stored in an authentication 135 database. 137 1.2. Notation 139 The pseudocode description of the algorithm uses the following 140 notations: 142 o ":=": The variable on the left hand side represents the octet 143 string resulting from the expression on the right hand side. 145 o "+": Octet string concatenation. 147 o "[ ]": A portion of an expression enclosed in "[" and "]" may not 148 be included in the result under some circumstances. See the 149 associated text for a description of those circumstances. 151 o Normalize(str): Apply the Preparation and Enforcement steps 152 according to the OpaqueString profile (see [RFC7613]) to a UTF-8 153 [RFC3629] encoded "str". The resulting string is also in UTF-8. 154 Note that implementations MUST either implement OpaqueString 155 profile operations from [RFC7613], or disallow use of non US-ASCII 156 Unicode codepoints in "str". The latter is a particular case of 157 compliance with [RFC7613]. 159 o HMAC(key, str): Apply the HMAC keyed hash algorithm (defined in 160 [RFC2104]) using the octet string represented by "key" as the key 161 and the octet string "str" as the input string. The size of the 162 result is the hash result size for the hash function in use. For 163 example, it is 32 octets for SHA-256 and 20 octets for SHA-1 (see 164 [RFC3174]). 166 o H(str): Apply the cryptographic hash function to the octet string 167 "str", producing an octet string as a result. The size of the 168 result depends on the hash result size for the hash function in 169 use. 171 o XOR: Apply the exclusive-or operation to combine the octet string 172 on the left of this operator with the octet string on the right of 173 this operator. The length of the output and each of the two 174 inputs will be the same for this use. 176 o Hi(str, salt, i): 178 U1 := HMAC(str, salt + INT(1)) 179 U2 := HMAC(str, U1) 180 ... 181 Ui-1 := HMAC(str, Ui-2) 182 Ui := HMAC(str, Ui-1) 184 Hi := U1 XOR U2 XOR ... XOR Ui 186 where "i" is the iteration count, "+" is the string concatenation 187 operator and INT(g) is a four-octet encoding of the integer g, 188 most significant octet first. 190 Hi() is, essentially, PBKDF2 [RFC2898] with HMAC() as the PRF and 191 with dkLen == output length of HMAC() == output length of H(). 193 2. Introduction 195 This specification describes a family of authentication mechanisms 196 called the Salted Challenge Response Authentication Mechanism (SCRAM) 197 which addresses the requirements necessary to deploy a challenge- 198 response mechanism more widely than past attempts (see [RFC5802]). 199 When used in combination with Transport Layer Security (TLS, see 200 [RFC5246]) or an equivalent security layer, a mechanism from this 201 family could improve the status-quo for HTTP authentication. 203 HTTP SCRAM is adoptation of [RFC5802] for use in HTTP. (SCRAM data 204 exchanged is identical to what is defined in [RFC5802].) It also 205 adds 1 round trip reauthentication mode. 207 HTTP SCRAM provides the following protocol features: 209 o The authentication information stored in the authentication 210 database is not sufficient by itself (without a dictionary attack) 211 to impersonate the client. The information is salted to prevent a 212 pre-stored dictionary attack if the database is stolen. 214 o The server does not gain the ability to impersonate the client to 215 other servers (with an exception for server-authorized proxies). 217 o The mechanism permits the use of a server-authorized proxy without 218 requiring that proxy to have super-user rights with the back-end 219 server. 221 o Mutual authentication is supported, but only the client is named 222 (i.e., the server has no name). 224 3. SCRAM Algorithm Overview 226 The following is a description of a full HTTP SCRAM authentication 227 exchange. Note that this section omits some details, such as client 228 and server nonces. See Section 5 for more details. 230 To begin with, the SCRAM client is in possession of a username and 231 password (*) (or a ClientKey/ServerKey, or SaltedPassword). It sends 232 the username to the server, which retrieves the corresponding 233 authentication information, i.e. a salt, StoredKey, ServerKey and the 234 iteration count i. (Note that a server implementation may choose to 235 use the same iteration count for all accounts.) The server sends the 236 salt and the iteration count to the client, which then computes the 237 following values and sends a ClientProof to the server: 239 (*) - Note that both the username and the password MUST be encoded in 240 UTF-8 [RFC3629]. 242 Informative Note: Implementors are encouraged to create test cases 243 that use both username passwords with non-ASCII codepoints. In 244 particular, it's useful to test codepoints whose "Unicode 245 Normalization Form C" and "Unicode Normalization Form KC" are 246 different. Some examples of such codepoints include Vulgar Fraction 247 One Half (U+00BD) and Acute Accent (U+00B4). 249 SaltedPassword := Hi(Normalize(password), salt, i) 250 ClientKey := HMAC(SaltedPassword, "Client Key") 251 StoredKey := H(ClientKey) 252 AuthMessage := client-first-message-bare + "," + 253 server-first-message + "," + 254 client-final-message-without-proof 255 ClientSignature := HMAC(StoredKey, AuthMessage) 256 ClientProof := ClientKey XOR ClientSignature 257 ServerKey := HMAC(SaltedPassword, "Server Key") 258 ServerSignature := HMAC(ServerKey, AuthMessage) 260 The server authenticates the client by computing the ClientSignature, 261 exclusive-ORing that with the ClientProof to recover the ClientKey 262 and verifying the correctness of the ClientKey by applying the hash 263 function and comparing the result to the StoredKey. If the ClientKey 264 is correct, this proves that the client has access to the user's 265 password. 267 Similarly, the client authenticates the server by computing the 268 ServerSignature and comparing it to the value sent by the server. If 269 the two are equal, it proves that the server had access to the user's 270 ServerKey. 272 For initial authentication the AuthMessage is computed by 273 concatenating decoded "data" attribute values from the authentication 274 exchange. The format of these messages is defined in [RFC5802]. 276 4. SCRAM Mechanism Names 278 A SCRAM mechanism name (authentication scheme) is a string "SCRAM-" 279 followed by the uppercased name of the underlying hash function taken 280 from the IANA "Hash Function Textual Names" registry (see 281 http://www.iana.org) . 283 For interoperability, all HTTP clients and servers supporting SCRAM 284 MUST implement the SCRAM-SHA-256 authentication mechanism, i.e. an 285 authentication mechanism from the SCRAM family that uses the SHA-256 286 hash function as defined in [RFC7677]. 288 5. SCRAM Authentication Exchange 290 HTTP SCRAM is a HTTP Authentication mechanism whose client response 291 () and server challenge () 292 messages are text-based messages containing one or more attribute- 293 value pairs separated by commas. The messages and their attributes 294 are described below and defined in Section 7. 296 challenge-scram = scram-name [1*SP 1#auth-param] 297 ; Complies with ABNF from RFC 7235. 298 ; Included in the WWW-Authenticate header field. 300 credentials-scram = scram-name [1*SP 1#auth-param] 301 ; Complies with from RFC 7235. 302 ; Included in the Authorization header field. 304 scram-name = "SCRAM-SHA-256" / "SCRAM-SHA-1" / other-scram-name 305 ; SCRAM-SHA-256 and SCRAM-SHA-1 are registered by this RFC. 306 ; 307 ; SCRAM-SHA-1 is registered for database compatibility 308 ; with implementations of RFC 5802 (such as IMAP or XMPP 309 ; servers), but it is not recommended for new deployments. 311 other-scram-name = "SCRAM-" hash-name 312 ; hash-name is a capitalized form of names from IANA 313 ; "Hash Function Textual Names" registry. 314 ; Additional SCRAM names must be registered in both 315 ; the IANA "SASL mechanisms" registry 316 ; and the IANA "authentication scheme" registry. 318 This is a simple example of a SCRAM-SHA-256 authentication exchange 319 (no support for channel bindings, as this feature is not currently 320 supported by HTTP). Username 'user' and password 'pencil' are used. 321 Note that long lines are folded for readability. 323 C: GET /resource HTTP/1.1 324 C: Host: server.example.com 325 C: [...] 327 S: HTTP/1.1 401 Unauthorized 328 S: WWW-Authenticate: Digest realm="realm1@host.com", 329 Digest realm="realm2@host.com", 330 Digest realm="realm3@host.com", 331 SCRAM-SHA-256 realm="realm3@host.com", 332 SCRAM-SHA-256 realm="testrealm@host.com" 333 S: [...] 335 C: GET /resource HTTP/1.1 336 C: Host: server.example.com 337 C: Authorization: SCRAM-SHA-256 realm="testrealm@host.com", 338 data=biwsbj11c2VyLHI9ck9wck5HZndFYmVSV2diTkVrcU8K 339 C: [...] 341 S: HTTP/1.1 401 Unauthorized 342 S: WWW-Authenticate: SCRAM-SHA-256 343 sid=AAAABBBBCCCCDDDD, 344 data=cj1yT3ByTkdmd0ViZVJXZ2JORWtxTyVodllEcFdVYTJSYVRDQWZ1eEZJbGo 345 paE5sRixzPVcyMlphSjBTTlk3c29Fc1VFamI2Z1E9PSxpPTQwOTYK 346 S: [...] 348 C: GET /resource HTTP/1.1 349 C: Host: server.example.com 350 C: Authorization: SCRAM-SHA-256 sid=AAAABBBBCCCCDDDD, 351 data=Yz1iaXdzLHI9ck9wck5HZndFYmVSV2diTkVrcU8laHZZRHBXVWEyUmFUQ0FmdXhG 352 SWxqKWhObEYscD1kSHpiWmFwV0lrNGpVaE4rVXRlOXl0YWc5empmTUhnc3FtbWl6 353 N0FuZFZRPQo= 354 C: [...] 356 S: HTTP/1.1 200 Ok 357 S: Authentication-Info: sid=AAAABBBBCCCCDDDD, 358 data=dj02cnJpVFJCaTIzV3BSUi93dHVwK21NaFVaVW4vZEI1bkxUSlJzamw5NUc0PQo= 359 S: [...Other header fields and resource body...] 361 In the above example the first client request contains data attribute 362 which base64 decodes as follows: "n,,n=user,r=rOprNGfwEbeRWgbNEkqO" 363 (with no quotes). Server then responds with data attribute which 364 base64 decodes as follows: "r=rOprNGfwEbeRWgbNEkqO%hvYDpWUa2RaTCAfuxF 365 Ilj)hNlF$k0,s=W22ZaJ0SNY7soEsUEjb6gQ==,i=4096". The next client 366 request contains data attribute which base64 decodes as follows: "c=b 367 iws,r=rOprNGfwEbeRWgbNEkqO%hvYDpWUa2RaTCAfuxFIlj)hNlF$k0,p=dHzbZapWIk 368 4jUhN+Ute9ytag9zjfMHgsqmmiz7AndVQ=". An the final server response 369 contains data attribute which base64 decodes as follows: 371 "v=6rriTRBi23WpRR/wtup+mMhUZUn/dB5nLTJRsjl95G4=". 373 Note that in the example above the client can also initiate SCRAM 374 authentication without first being prompted by the server. 376 Initial "SCRAM-SHA-256" authentication starts with sending the 377 "Authorization" request header field defined by HTTP/1.1, Part 7 378 [RFC7235] containing "SCRAM-SHA-256" authentication scheme and the 379 following attributes: 381 o A "realm" attribute MAY be included to indicate the scope of 382 protection in the manner described in HTTP/1.1, Part 7 [RFC7235]. 383 As specified in [RFC7235], the "realm" attribute MUST NOT appear 384 more than once. The realm attribute only appears in the first 385 SCRAM message to the server and in the first SCRAM response from 386 the server. 388 o The client also includes the data attribute that contains base64 389 encoded "client-first-message" [RFC5802] containing: 391 * a header consisting of a flag indicating whether channel 392 binding is supported-but-not-used, not supported, or used . 393 Note that version of SCRAM doesn't support HTTP channel 394 bindings, so this header always starts with "n", otherwise the 395 message is invalid and authentication MUST fail. 397 * SCRAM username and a random, unique nonce attributes. 399 In HTTP response, the server sends WWW-Authenticate header field 400 containing: a unique session identifier (the "sid" attribute) plus 401 the "data" attribute containing base64-encoded "server-first-message" 402 [RFC5802]. The "server-first-message" contains the user's iteration 403 count i, the user's salt, and the nonce with a concatenation of the 404 client-specified one with a server nonce. 406 The client then responds with another HTTP request with the 407 Authorization header field, which includes the "sid" attribute 408 received in the previous server response, together with the "data" 409 attribute containing base64-encoded "client-final-message" data. The 410 latter has the same nonce and a ClientProof computed using the 411 selected hash function (e.g. SHA-256) as explained earlier. 413 The server verifies the nonce and the proof, and, finally, it 414 responds with a 200 HTTP response with the Authentication-Info header 415 field [RFC7615] containing the "sid" attribute (as received from the 416 client) and the "data" attribute containing base64-encoded "server- 417 final-message", concluding the authentication exchange. 419 The client then authenticates the server by computing the 420 ServerSignature and comparing it to the value sent by the server. If 421 the two are different, the client MUST consider the authentication 422 exchange to be unsuccessful and it might have to drop the connection. 424 5.1. One round trip reauthentication 426 If the server supports SCRAM reauthentication, the server sends in 427 its initial HTTP response a WWW-Authenticate header field containing: 428 the "realm" attribute (as defined earlier), the "sr" attribute that 429 contains the server part of the "r" attribute (see [RFC5802] and 430 optional "ttl" attribute (which contains the "sr" value validity in 431 seconds). 433 If the client has authenticated to the same realm before (i.e. it 434 remembers "i" and "s" attributes for the user from earlies 435 authentication exchanges with the server), it can respond to that 436 with "client-final-message". [[CREF1: Should some counter be added 437 to make "sr" unique for each reauth?]] 439 If the server considers the server part of the nonce (the "r" 440 attribute) to be still valid, it will provide access to the requested 441 resource (assuming the client hash verifies correctly, of course). 442 However if the server considers that the server part of the nonce is 443 stale (for example if the "sr" value is used after the "ttl" 444 seconds), the server returns "401 Unauthorized" containing the SCRAM 445 mechanism name with the following attributes: a new "sr", 446 "stale=true" and an optional "ttl". The "stale" attribute signals to 447 the client that there is no need to ask user for the password. 449 Formally, the "stale" attribute is defined as follows: A flag, 450 indicating that the previous request from the client was rejected 451 because the nonce value was stale. If stale is TRUE (case- 452 insensitive), the client may wish to simply retry the request with 453 a new encrypted response, without reprompting the user for a new 454 username and password. The server should only set stale to TRUE 455 if it receives a request for which the nonce is invalid but with a 456 valid digest for that nonce (indicating that the client knows the 457 correct username/password). If stale is FALSE, or anything other 458 than TRUE, or the stale directive is not present, the username 459 and/or password are invalid, and new values must be obtained. 461 When constructing AuthMessage Section 3 to be used for calculating 462 client and server proofs, "client-first-message-bare" and "server- 463 first-message" are reconstructed from data known to the client and 464 the server. 466 Reauthentication can look like this: 468 C: GET /resource HTTP/1.1 469 C: Host: server.example.com 470 C: [...] 472 S: HTTP/1.1 401 Unauthorized 473 S: WWW-Authenticate: Digest realm="realm1@host.com", 474 Digest realm="realm2@host.com", 475 Digest realm="realm3@host.com", 476 SCRAM-SHA-256 realm="realm3@host.com", 477 SCRAM-SHA-256 realm="testrealm@host.com", sr=pWUa2RaTCAfuxFIlj)hNlF$k0 478 SCRAM-SHA-256 realm="testrealm2@host.com", sr=AAABBBCCCDDD, ttl=120 479 S: [...] 481 [Client authenticates as usual to realm "testrealm@host.com"] 483 [Some time later client decides to reauthenticate. 484 It will use the cached "i" (4096) and "s" (W22ZaJ0SNY7soEsUEjb6gQ==) from earlies exchanges. 485 It will use the server advertised "sr" value as the server part of the "r".] 487 C: GET /resource HTTP/1.1 488 C: Host: server.example.com 489 C: Authorization: SCRAM-SHA-256 realm="testrealm@host.com", 490 data=Yz1iaXdzLHI9ck9wck5HZndFYmVSV2diTkVrcU8laHZZRHBXVWEyUmFUQ0FmdXhG 491 SWxqKWhObEYscD1kSHpiWmFwV0lrNGpVaE4rVXRlOXl0YWc5empmTUhnc3FtbWl6 492 N0FuZFZRPQo= 493 C: [...] 495 S: HTTP/1.1 200 Ok 496 S: Authentication-Info: sid=AAAABBBBCCCCDDDD, 497 data=dj02cnJpVFJCaTIzV3BSUi93dHVwK21NaFVaVW4vZEI1bkxUSlJzamw5NUc0PQo= 498 S: [...Other header fields and resource body...] 500 6. Use of Authentication-Info header field with SCRAM 502 When used with SCRAM, the Authentication-Info header field is allowed 503 in the trailer of an HTTP message transferred via chunked transfer- 504 coding. 506 7. Formal Syntax 508 The following syntax specification uses the Augmented Backus-Naur 509 Form (ABNF) notation as specified in [RFC5234]. The "UTF8-2", 510 "UTF8-3" and "UTF8-4" non-terminals are defined in [RFC3629]. 512 ALPHA = 513 DIGIT = 515 base64-char = ALPHA / DIGIT / "/" / "+" 517 base64-4 = 4base64-char 519 base64-3 = 3base64-char "=" 521 base64-2 = 2base64-char "==" 523 base64 = *base64-4 [base64-3 / base64-2] 525 sr = "sr=" s-nonce 526 ;; s-nonce is defined in RFC 5802. 528 data = "data=" base64 529 ;; The data attribute value is base64 encoded 530 ;; SCRAM challenge or response defined in 531 ;; RFC 5802. 533 ttl = "ttl" = 1*DIGIT 534 ;; "sr" value validity in seconds. 535 ;; No leading 0s. 537 sid = "sid=" token 538 ;; See token definition in RFC 7235. 540 stale = "stale=" ( "true" / "false" ) 542 realm = "realm=" 544 8. Security Considerations 546 If the authentication exchange is performed without a strong security 547 layer (such as TLS with data confidentiality), then a passive 548 eavesdropper can gain sufficient information to mount an offline 549 dictionary or brute-force attack which can be used to recover the 550 user's password. The amount of time necessary for this attack 551 depends on the cryptographic hash function selected, the strength of 552 the password and the iteration count supplied by the server. SCRAM 553 allows to increase the iteration count over time in order to slow 554 down the above attacks. (Note that a server that is only in 555 posession of "StoredKey" and "ServerKey" can't automatic increase the 556 iteration count upon successful authentication. Such increase would 557 require resetting user's password.) An external security layer with 558 strong encryption will prevent these attack. 560 If the authentication information is stolen from the authentication 561 database, then an offline dictionary or brute-force attack can be 562 used to recover the user's password. The use of salt mitigates this 563 attack somewhat by requiring a separate attack on each password. 564 Authentication mechanisms which protect against this attack are 565 available (e.g., the EKE class of mechanisms). RFC 2945 [RFC2945] is 566 an example of such technology. 568 If an attacker obtains the authentication information from the 569 authentication repository and either eavesdrops on one authentication 570 exchange or impersonates a server, the attacker gains the ability to 571 impersonate that user to all servers providing SCRAM access using the 572 same hash function, password, iteration count and salt. For this 573 reason, it is important to use randomly-generated salt values. 575 SCRAM does not negotiate a hash function to use. Hash function 576 negotiation is left to the HTTP authentication mechanism negotiation. 577 It is important that clients be able to sort a locally available list 578 of mechanisms by preference so that the client may pick the most 579 preferred of a server's advertised mechanism list. This preference 580 order is not specified here as it is a local matter. The preference 581 order should include objective and subjective notions of mechanism 582 cryptographic strength (e.g., SCRAM with a successor to SHA-1 may be 583 preferred over SCRAM with SHA-1). 585 SCRAM does not protect against downgrade attacks of channel binding 586 types. The complexities of negotiation a channel binding type, and 587 handling down-grade attacks in that negotiation, was intentionally 588 left out of scope for this document. 590 A hostile server can perform a computational denial-of-service attack 591 on clients by sending a big iteration count value. 593 See [RFC4086] for more information about generating randomness. 595 9. IANA Considerations 597 New mechanisms in the SCRAM- family are registered according to the 598 IANA procedure specified in [RFC5802]. 600 Note to future SCRAM- mechanism designers: each new SCRAM- HTTP 601 authentication mechanism MUST be explicitly registered with IANA and 602 MUST comply with SCRAM- mechanism naming convention defined in 603 Section 4 of this document. 605 IANA is requested to add the following entry to the Authentication 606 Scheme Registry defined in HTTP/1.1, Part 7 [RFC7235]: 608 Authentication Scheme Name: SCRAM-SHA-256 609 Pointer to specification text: [[ this document ]] 610 Notes (optional): (none) 612 Authentication Scheme Name: SCRAM-SHA-1 613 Pointer to specification text: [[ this document ]] 614 Notes (optional): (none) 616 10. Acknowledgements 618 This document benefited from discussions on the HTTPAuth, SASL and 619 Kitten WG mailing lists. The authors would like to specially thank 620 co-authors of [RFC5802] from which lots of text was copied. 622 Thank you to Martin Thomson for the idea of adding "ttl" attribute. 624 Thank you to Julian F. Reschke for corrections regarding use of 625 Authentication-Info header field. 627 Special thank you to Tony Hansen for doing an early implementation 628 and providing extensive comments on the draft. 630 11. Design Motivations 632 The following design goals shaped this document. Note that some of 633 the goals have changed since the initial version of the document. 635 o The HTTP authentication mechanism has all modern features: support 636 for internationalized usernames and passwords, support for channel 637 bindings. 639 o The protocol supports mutual authentication. 641 o The authentication information stored in the authentication 642 database is not sufficient by itself to impersonate the client. 644 o The server does not gain the ability to impersonate the client to 645 other servers (with an exception for server-authorized proxies), 646 unless such other servers allow SCRAM authentication and use the 647 same salt and iteration count for the user. 649 o The mechanism is extensible, but [hopefully] not overengineered in 650 this respect. 652 o Easier to implement than HTTP Digest in both clients and servers. 654 12. References 656 12.1. Normative References 658 [RFC2104] Krawczyk, H., Bellare, M., and R. Canetti, "HMAC: Keyed- 659 Hashing for Message Authentication", RFC 2104, 660 DOI 10.17487/RFC2104, February 1997, 661 . 663 [RFC2119] Bradner, S., "Key words for use in RFCs to Indicate 664 Requirement Levels", BCP 14, RFC 2119, 665 DOI 10.17487/RFC2119, March 1997, 666 . 668 [RFC3174] Eastlake 3rd, D. and P. Jones, "US Secure Hash Algorithm 1 669 (SHA1)", RFC 3174, DOI 10.17487/RFC3174, September 2001, 670 . 672 [RFC3454] Hoffman, P. and M. Blanchet, "Preparation of 673 Internationalized Strings ("stringprep")", RFC 3454, 674 DOI 10.17487/RFC3454, December 2002, 675 . 677 [RFC3629] Yergeau, F., "UTF-8, a transformation format of ISO 678 10646", STD 63, RFC 3629, DOI 10.17487/RFC3629, November 679 2003, . 681 [RFC4013] Zeilenga, K., "SASLprep: Stringprep Profile for User Names 682 and Passwords", RFC 4013, DOI 10.17487/RFC4013, February 683 2005, . 685 [RFC4648] Josefsson, S., "The Base16, Base32, and Base64 Data 686 Encodings", RFC 4648, DOI 10.17487/RFC4648, October 2006, 687 . 689 [RFC5056] Williams, N., "On the Use of Channel Bindings to Secure 690 Channels", RFC 5056, DOI 10.17487/RFC5056, November 2007, 691 . 693 [RFC5234] Crocker, D., Ed. and P. Overell, "Augmented BNF for Syntax 694 Specifications: ABNF", STD 68, RFC 5234, 695 DOI 10.17487/RFC5234, January 2008, 696 . 698 [RFC5802] Newman, C., Menon-Sen, A., Melnikov, A., and N. Williams, 699 "Salted Challenge Response Authentication Mechanism 700 (SCRAM) SASL and GSS-API Mechanisms", RFC 5802, 701 DOI 10.17487/RFC5802, July 2010, 702 . 704 [RFC5929] Altman, J., Williams, N., and L. Zhu, "Channel Bindings 705 for TLS", RFC 5929, DOI 10.17487/RFC5929, July 2010, 706 . 708 [RFC7235] Fielding, R., Ed. and J. Reschke, Ed., "Hypertext Transfer 709 Protocol (HTTP/1.1): Authentication", RFC 7235, 710 DOI 10.17487/RFC7235, June 2014, 711 . 713 [RFC7613] Saint-Andre, P. and A. Melnikov, "Preparation, 714 Enforcement, and Comparison of Internationalized Strings 715 Representing Usernames and Passwords", RFC 7613, 716 DOI 10.17487/RFC7613, August 2015, 717 . 719 [RFC7615] Reschke, J., "HTTP Authentication-Info and Proxy- 720 Authentication-Info Response Header Fields", RFC 7615, 721 DOI 10.17487/RFC7615, September 2015, 722 . 724 [RFC7677] Hansen, T., "SCRAM-SHA-256 and SCRAM-SHA-256-PLUS Simple 725 Authentication and Security Layer (SASL) Mechanisms", 726 RFC 7677, DOI 10.17487/RFC7677, November 2015, 727 . 729 12.2. Informative References 731 [RFC2865] Rigney, C., Willens, S., Rubens, A., and W. Simpson, 732 "Remote Authentication Dial In User Service (RADIUS)", 733 RFC 2865, DOI 10.17487/RFC2865, June 2000, 734 . 736 [RFC2898] Kaliski, B., "PKCS #5: Password-Based Cryptography 737 Specification Version 2.0", RFC 2898, 738 DOI 10.17487/RFC2898, September 2000, 739 . 741 [RFC2945] Wu, T., "The SRP Authentication and Key Exchange System", 742 RFC 2945, DOI 10.17487/RFC2945, September 2000, 743 . 745 [RFC4086] Eastlake 3rd, D., Schiller, J., and S. Crocker, 746 "Randomness Requirements for Security", BCP 106, RFC 4086, 747 DOI 10.17487/RFC4086, June 2005, 748 . 750 [RFC4510] Zeilenga, K., Ed., "Lightweight Directory Access Protocol 751 (LDAP): Technical Specification Road Map", RFC 4510, 752 DOI 10.17487/RFC4510, June 2006, 753 . 755 [RFC4616] Zeilenga, K., Ed., "The PLAIN Simple Authentication and 756 Security Layer (SASL) Mechanism", RFC 4616, 757 DOI 10.17487/RFC4616, August 2006, 758 . 760 [RFC4949] Shirey, R., "Internet Security Glossary, Version 2", 761 FYI 36, RFC 4949, DOI 10.17487/RFC4949, August 2007, 762 . 764 [RFC5226] Narten, T. and H. Alvestrand, "Guidelines for Writing an 765 IANA Considerations Section in RFCs", BCP 26, RFC 5226, 766 DOI 10.17487/RFC5226, May 2008, 767 . 769 [RFC5246] Dierks, T. and E. Rescorla, "The Transport Layer Security 770 (TLS) Protocol Version 1.2", RFC 5246, 771 DOI 10.17487/RFC5246, August 2008, 772 . 774 [tls-server-end-point] 775 Zhu, L., , "Registration of TLS server end-point channel 776 bindings", IANA http://www.iana.org/assignments/ 777 channel-binding-types/tls-server-end-point, July 2008. 779 Author's Address 781 Alexey Melnikov 782 Isode Ltd 784 Email: Alexey.Melnikov@isode.com