idnits 2.17.1 draft-ietf-httpauth-scram-auth-12.txt: Checking boilerplate required by RFC 5378 and the IETF Trust (see https://trustee.ietf.org/license-info): ---------------------------------------------------------------------------- No issues found here. Checking nits according to https://www.ietf.org/id-info/1id-guidelines.txt: ---------------------------------------------------------------------------- No issues found here. Checking nits according to https://www.ietf.org/id-info/checklist : ---------------------------------------------------------------------------- ** There are 10 instances of too long lines in the document, the longest one being 13 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 28, 2015) is 3043 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 692, but no explicit reference was found in the text == Unused Reference: 'RFC4013' is defined on line 701, but no explicit reference was found in the text == Unused Reference: 'RFC5056' is defined on line 709, but no explicit reference was found in the text == Unused Reference: 'RFC5929' is defined on line 724, but no explicit reference was found in the text == Unused Reference: 'RFC4616' is defined on line 780, but no explicit reference was found in the text == Unused Reference: 'RFC5226' is defined on line 789, but no explicit reference was found in the text ** Downref: Normative reference to an Informational RFC: RFC 2104 ** Obsolete normative reference: RFC 3454 (Obsoleted by RFC 7564) ** Obsolete normative reference: RFC 4013 (Obsoleted by RFC 7613) ** Downref: Normative reference to an Informational RFC: RFC 6234 ** 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 28, 2015 5 Expires: May 31, 2016 7 Salted Challenge Response (SCRAM) HTTP Authentication Mechanism 8 draft-ietf-httpauth-scram-auth-12.txt 10 Abstract 12 The 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 31, 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 . . . . . 12 72 7. Formal Syntax . . . . . . . . . . . . . . . . . . . . . . . . 12 73 8. Security Considerations . . . . . . . . . . . . . . . . . . . 13 74 9. IANA Considerations . . . . . . . . . . . . . . . . . . . . . 15 75 10. Acknowledgements . . . . . . . . . . . . . . . . . . . . . . 15 76 11. Design Motivations . . . . . . . . . . . . . . . . . . . . . 15 77 12. References . . . . . . . . . . . . . . . . . . . . . . . . . 16 78 12.1. Normative References . . . . . . . . . . . . . . . . . . . 16 79 12.2. Informative References . . . . . . . . . . . . . . . . . . 18 80 Author's Address . . . . . . . . . . . . . . . . . . . . . . . . 19 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 [RFC6234]). 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@example.com", 329 Digest realm="realm2@example.com", 330 Digest realm="realm3@example.com", 331 SCRAM-SHA-256 realm="realm3@example.com", 332 SCRAM-SHA-256 realm="testrealm@example.com" 333 S: [...] 335 C: GET /resource HTTP/1.1 336 C: Host: server.example.com 337 C: Authorization: SCRAM-SHA-256 realm="testrealm@example.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,s=W22ZaJ0SNY7soEsUEjb6gQ==,i=4096". The next client request 366 contains data attribute which base64 decodes as follows: "c=biws,r=rO 367 prNGfwEbeRWgbNEkqO%hvYDpWUa2RaTCAfuxFIlj)hNlF,p=dHzbZapWIk4jUhN+Ute9y 368 tag9zjfMHgsqmmiz7AndVQ=". The final server response contains a data 369 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 this 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 s-nonce in 430 [RFC5802]) and optional "ttl" attribute (which contains the "sr" 431 value validity in 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 earlier 435 authentication exchanges with the server), it can respond to that 436 with "client-final-message". When constructing the "client-final- 437 message" the client constructs the c-nonce part of the "r" attribute 438 as on initial authentication and the s-nonce part as follows: s-nonce 439 is a concatenation of nonce-count and the "sr" attribute (in that 440 order). The nonce-count is a positive integer that that is equal to 441 the user's "i" attribute on first reauthentication and is incremented 442 by 1 on each successful re-authentication. 444 The purpose of the nonce-count is to allow the server to detect 445 request replays by maintaining its own copy of this count - if the 446 same nonce-count value is seen twice, then the request is a 447 replay. 449 If the server considers the s-nonce part of the nonce attribute (the 450 "r" attribute) to be still valid (i.e. the nonce-count part is as 451 expected (see above) and the "sr" part is still fresh), it will 452 provide access to the requested resource (assuming the client hash 453 verifies correctly, of course). However if the server considers that 454 the server part of the nonce is stale (for example if the "sr" value 455 is used after the "ttl" seconds), the server returns "401 456 Unauthorized" containing the SCRAM mechanism name with the following 457 attributes: a new "sr", "stale=true" and an optional "ttl". The 458 "stale" attribute signals to the client that there is no need to ask 459 user for the password. 461 Formally, the "stale" attribute is defined as follows: A flag, 462 indicating that the previous request from the client was rejected 463 because the nonce value was stale. If stale is TRUE (case- 464 insensitive), the client may wish to simply retry the request with 465 a new encrypted response, without reprompting the user for a new 466 username and password. The server should only set stale to TRUE 467 if it receives a request for which the nonce is invalid but with a 468 valid digest for that nonce (indicating that the client knows the 469 correct username/password). If stale is FALSE, or anything other 470 than TRUE, or the stale directive is not present, the username 471 and/or password are invalid, and new values must be obtained. 473 When constructing AuthMessage Section 3 to be used for calculating 474 client and server proofs, "client-first-message-bare" and "server- 475 first-message" are reconstructed from data known to the client and 476 the server. 478 Reauthentication can look like this: 480 C: GET /resource HTTP/1.1 481 C: Host: server.example.com 482 C: [...] 484 S: HTTP/1.1 401 Unauthorized 485 S: WWW-Authenticate: Digest realm="realm1@example.com", 486 Digest realm="realm2@example.com", 487 Digest realm="realm3@example.com", 488 SCRAM-SHA-256 realm="realm3@example.com", 489 SCRAM-SHA-256 realm="testrealm@example.com", sr=%hvYDpWUa2RaTCAfuxFIlj)hNlF 490 SCRAM-SHA-256 realm="testrealm2@example.com", sr=AAABBBCCCDDD, ttl=120 491 S: [...] 493 [Client authenticates as usual to realm "testrealm@example.com"] 495 [Some time later client decides to reauthenticate. 496 It will use the cached "i" (4096) and "s" (W22ZaJ0SNY7soEsUEjb6gQ==) 497 from earlier exchanges. It will use the nonce-value of 4096 together 498 with the server advertised "sr" value as the server part of the "r".] 500 C: GET /resource HTTP/1.1 501 C: Host: server.example.com 502 C: Authorization: SCRAM-SHA-256 realm="testrealm@example.com", 503 data=Yz1iaXdzLHI9ck9wck5HZndFYmVSV2diTkVrcU80MDk2JWh2WURwV1VhMlJhVENB 504 ZnV4RklsailoTmxGLHA9ZEh6YlphcFdJazRqVWhOK1V0ZTl5dGFnOXpqZk1IZ3Nx 505 bW1pejdBbmRWUT0K 507 C: [...] 509 S: HTTP/1.1 200 Ok 510 S: Authentication-Info: sid=AAAABBBBCCCCDDDD, 511 data=dj02cnJpVFJCaTIzV3BSUi93dHVwK21NaFVaVW4vZEI1bkxUSlJzamw5NUc0PQo= 512 S: [...Other header fields and resource body...] 514 6. Use of Authentication-Info header field with SCRAM 516 When used with SCRAM, the Authentication-Info header field is allowed 517 in the trailer of an HTTP message transferred via chunked transfer- 518 coding. 520 7. Formal Syntax 522 The following syntax specification uses the Augmented Backus-Naur 523 Form (ABNF) notation as specified in [RFC5234]. The "UTF8-2", 524 "UTF8-3" and "UTF8-4" non-terminals are defined in [RFC3629]. 526 ALPHA = 527 DIGIT = 529 base64-char = ALPHA / DIGIT / "/" / "+" 531 base64-4 = 4base64-char 533 base64-3 = 3base64-char "=" 535 base64-2 = 2base64-char "==" 537 base64 = *base64-4 [base64-3 / base64-2] 539 sr = "sr=" s-nonce 540 ;; s-nonce is defined in RFC 5802. 542 data = "data=" base64 543 ;; The data attribute value is base64 encoded 544 ;; SCRAM challenge or response defined in 545 ;; RFC 5802. 547 ttl = "ttl" = 1*DIGIT 548 ;; "sr" value validity in seconds. 549 ;; No leading 0s. 551 reauth-s-nonce = nonce-count s-nonce 553 nonce-count = posit-number 554 ;; posit-number is defined in RFC 5802. 555 ;; The initial value is taken from the "i" 556 ;; attribute for the user and is incremented 557 ;; by 1 on each successful re-authentication. 559 sid = "sid=" token 560 ;; See token definition in RFC 7235. 562 stale = "stale=" ( "true" / "false" ) 564 realm = "realm=" 566 8. Security Considerations 568 If the authentication exchange is performed without a strong session 569 encryption (such as TLS with data confidentiality), then a passive 570 eavesdropper can gain sufficient information to mount an offline 571 dictionary or brute-force attack which can be used to recover the 572 user's password. The amount of time necessary for this attack 573 depends on the cryptographic hash function selected, the strength of 574 the password and the iteration count supplied by the server. SCRAM 575 allows the server/server administrator to increase the iteration 576 count over time in order to slow down the above attacks. (Note that 577 a server that is only in posession of "StoredKey" and "ServerKey" 578 can't automatic increase the iteration count upon successful 579 authentication. Such increase would require resetting user's 580 password.) An external security layer with strong encryption will 581 prevent these attack. 583 If the authentication information is stolen from the authentication 584 database, then an offline dictionary or brute-force attack can be 585 used to recover the user's password. The use of salt mitigates this 586 attack somewhat by requiring a separate attack on each password. 587 Authentication mechanisms which protect against this attack are 588 available (e.g., the EKE class of mechanisms). RFC 2945 [RFC2945] is 589 an example of such technology. 591 If an attacker obtains the authentication information from the 592 authentication repository and either eavesdrops on one authentication 593 exchange or impersonates a server, the attacker gains the ability to 594 impersonate that user to all servers providing SCRAM access using the 595 same hash function, password, iteration count and salt. For this 596 reason, it is important to use randomly-generated salt values. 598 SCRAM does not negotiate a hash function to use. Hash function 599 negotiation is left to the HTTP authentication mechanism negotiation. 600 It is important that clients be able to sort a locally available list 601 of mechanisms by preference so that the client may pick the most 602 preferred of a server's advertised mechanism list. This preference 603 order is not specified here as it is a local matter. The preference 604 order should include objective and subjective notions of mechanism 605 cryptographic strength (e.g., SCRAM with a successor to SHA-1 may be 606 preferred over SCRAM with SHA-1). 608 A hostile server can perform a computational denial-of-service attack 609 on clients by sending a big iteration count value. 611 See [RFC4086] for more information about generating randomness. 613 This document recommends use of SCRAM with SHA-256 hash. SCRAM-SHA-1 614 is registered for database compatibility with implementations of RFC 615 5802 (such as IMAP or XMPP servers) which want to also expose HTTP 616 access to a related service, but it is not recommended for new 617 deployments. 619 9. IANA Considerations 621 New mechanisms in the SCRAM- family are registered according to the 622 IANA procedure specified in [RFC5802]. 624 Note to future SCRAM- mechanism designers: each new SCRAM- HTTP 625 authentication mechanism MUST be explicitly registered with IANA and 626 MUST comply with SCRAM- mechanism naming convention defined in 627 Section 4 of this document. 629 IANA is requested to add the following entry to the Authentication 630 Scheme Registry defined in HTTP/1.1, Part 7 [RFC7235]: 632 Authentication Scheme Name: SCRAM-SHA-256 633 Pointer to specification text: [[ this document ]] 634 Notes (optional): (none) 636 Authentication Scheme Name: SCRAM-SHA-1 637 Pointer to specification text: [[ this document ]] 638 Notes (optional): (none) 640 10. Acknowledgements 642 This document benefited from discussions on the HTTPAuth, SASL and 643 Kitten WG mailing lists. The authors would like to specially thank 644 co-authors of [RFC5802] from which lots of text was copied. 646 Thank you to Martin Thomson for the idea of adding "ttl" attribute. 648 Thank you to Julian F. Reschke for corrections regarding use of 649 Authentication-Info header field. 651 Special thank you to Tony Hansen for doing an early implementation 652 and providing extensive comments on the draft. 654 11. Design Motivations 656 The following design goals shaped this document. Note that some of 657 the goals have changed since the initial version of the document. 659 o The HTTP authentication mechanism has all modern features: support 660 for internationalized usernames and passwords, support for channel 661 bindings. 663 o The protocol supports mutual authentication. 665 o The authentication information stored in the authentication 666 database is not sufficient by itself to impersonate the client. 668 o The server does not gain the ability to impersonate the client to 669 other servers (with an exception for server-authorized proxies), 670 unless such other servers allow SCRAM authentication and use the 671 same salt and iteration count for the user. 673 o The mechanism is extensible, but [hopefully] not overengineered in 674 this respect. 676 o Easier to implement than HTTP Digest in both clients and servers. 678 12. References 680 12.1. Normative References 682 [RFC2104] Krawczyk, H., Bellare, M., and R. Canetti, "HMAC: Keyed- 683 Hashing for Message Authentication", RFC 2104, 684 DOI 10.17487/RFC2104, February 1997, 685 . 687 [RFC2119] Bradner, S., "Key words for use in RFCs to Indicate 688 Requirement Levels", BCP 14, RFC 2119, 689 DOI 10.17487/RFC2119, March 1997, 690 . 692 [RFC3454] Hoffman, P. and M. Blanchet, "Preparation of 693 Internationalized Strings ("stringprep")", RFC 3454, 694 DOI 10.17487/RFC3454, December 2002, 695 . 697 [RFC3629] Yergeau, F., "UTF-8, a transformation format of ISO 698 10646", STD 63, RFC 3629, DOI 10.17487/RFC3629, November 699 2003, . 701 [RFC4013] Zeilenga, K., "SASLprep: Stringprep Profile for User Names 702 and Passwords", RFC 4013, DOI 10.17487/RFC4013, February 703 2005, . 705 [RFC4648] Josefsson, S., "The Base16, Base32, and Base64 Data 706 Encodings", RFC 4648, DOI 10.17487/RFC4648, October 2006, 707 . 709 [RFC5056] Williams, N., "On the Use of Channel Bindings to Secure 710 Channels", RFC 5056, DOI 10.17487/RFC5056, November 2007, 711 . 713 [RFC5234] Crocker, D., Ed. and P. Overell, "Augmented BNF for Syntax 714 Specifications: ABNF", STD 68, RFC 5234, 715 DOI 10.17487/RFC5234, January 2008, 716 . 718 [RFC5802] Newman, C., Menon-Sen, A., Melnikov, A., and N. Williams, 719 "Salted Challenge Response Authentication Mechanism 720 (SCRAM) SASL and GSS-API Mechanisms", RFC 5802, 721 DOI 10.17487/RFC5802, July 2010, 722 . 724 [RFC5929] Altman, J., Williams, N., and L. Zhu, "Channel Bindings 725 for TLS", RFC 5929, DOI 10.17487/RFC5929, July 2010, 726 . 728 [RFC6234] Eastlake 3rd, D. and T. Hansen, "US Secure Hash Algorithms 729 (SHA and SHA-based HMAC and HKDF)", RFC 6234, 730 DOI 10.17487/RFC6234, May 2011, 731 . 733 [RFC7235] Fielding, R., Ed. and J. Reschke, Ed., "Hypertext Transfer 734 Protocol (HTTP/1.1): Authentication", RFC 7235, 735 DOI 10.17487/RFC7235, June 2014, 736 . 738 [RFC7613] Saint-Andre, P. and A. Melnikov, "Preparation, 739 Enforcement, and Comparison of Internationalized Strings 740 Representing Usernames and Passwords", RFC 7613, 741 DOI 10.17487/RFC7613, August 2015, 742 . 744 [RFC7615] Reschke, J., "HTTP Authentication-Info and Proxy- 745 Authentication-Info Response Header Fields", RFC 7615, 746 DOI 10.17487/RFC7615, September 2015, 747 . 749 [RFC7677] Hansen, T., "SCRAM-SHA-256 and SCRAM-SHA-256-PLUS Simple 750 Authentication and Security Layer (SASL) Mechanisms", 751 RFC 7677, DOI 10.17487/RFC7677, November 2015, 752 . 754 12.2. Informative References 756 [RFC2865] Rigney, C., Willens, S., Rubens, A., and W. Simpson, 757 "Remote Authentication Dial In User Service (RADIUS)", 758 RFC 2865, DOI 10.17487/RFC2865, June 2000, 759 . 761 [RFC2898] Kaliski, B., "PKCS #5: Password-Based Cryptography 762 Specification Version 2.0", RFC 2898, 763 DOI 10.17487/RFC2898, September 2000, 764 . 766 [RFC2945] Wu, T., "The SRP Authentication and Key Exchange System", 767 RFC 2945, DOI 10.17487/RFC2945, September 2000, 768 . 770 [RFC4086] Eastlake 3rd, D., Schiller, J., and S. Crocker, 771 "Randomness Requirements for Security", BCP 106, RFC 4086, 772 DOI 10.17487/RFC4086, June 2005, 773 . 775 [RFC4510] Zeilenga, K., Ed., "Lightweight Directory Access Protocol 776 (LDAP): Technical Specification Road Map", RFC 4510, 777 DOI 10.17487/RFC4510, June 2006, 778 . 780 [RFC4616] Zeilenga, K., Ed., "The PLAIN Simple Authentication and 781 Security Layer (SASL) Mechanism", RFC 4616, 782 DOI 10.17487/RFC4616, August 2006, 783 . 785 [RFC4949] Shirey, R., "Internet Security Glossary, Version 2", 786 FYI 36, RFC 4949, DOI 10.17487/RFC4949, August 2007, 787 . 789 [RFC5226] Narten, T. and H. Alvestrand, "Guidelines for Writing an 790 IANA Considerations Section in RFCs", BCP 26, RFC 5226, 791 DOI 10.17487/RFC5226, May 2008, 792 . 794 [RFC5246] Dierks, T. and E. Rescorla, "The Transport Layer Security 795 (TLS) Protocol Version 1.2", RFC 5246, 796 DOI 10.17487/RFC5246, August 2008, 797 . 799 [tls-server-end-point] 800 Zhu, L., , "Registration of TLS server end-point channel 801 bindings", IANA http://www.iana.org/assignments/ 802 channel-binding-types/tls-server-end-point, July 2008. 804 Author's Address 806 Alexey Melnikov 807 Isode Ltd 809 Email: Alexey.Melnikov@isode.com