draft-ietf-httpauth-scram-auth-09.txt   draft-ietf-httpauth-scram-auth-10.txt 
HTTPAUTH A. Melnikov HTTPAUTH A. Melnikov
Internet-Draft Isode Ltd Internet-Draft Isode Ltd
Intended status: Standards Track November 13, 2015 Intended status: Standards Track November 19, 2015
Expires: May 16, 2016 Expires: May 22, 2016
Salted Challenge Response (SCRAM) HTTP Authentication Mechanism Salted Challenge Response (SCRAM) HTTP Authentication Mechanism
draft-ietf-httpauth-scram-auth-09.txt draft-ietf-httpauth-scram-auth-10.txt
Abstract Abstract
The secure authentication mechanism most widely deployed and used by The secure authentication mechanism most widely deployed and used by
Internet application protocols is the transmission of clear-text Internet application protocols is the transmission of clear-text
passwords over a channel protected by Transport Layer Security (TLS). passwords over a channel protected by Transport Layer Security (TLS).
There are some significant security concerns with that mechanism, There are some significant security concerns with that mechanism,
which could be addressed by the use of a challenge response which could be addressed by the use of a challenge response
authentication mechanism protected by TLS. Unfortunately, the HTTP authentication mechanism protected by TLS. Unfortunately, the HTTP
Digest challenge response mechanism presently on the standards track Digest challenge response mechanism presently on the standards track
skipping to change at page 1, line 45 skipping to change at page 1, line 45
Internet-Drafts are working documents of the Internet Engineering Internet-Drafts are working documents of the Internet Engineering
Task Force (IETF). Note that other groups may also distribute Task Force (IETF). Note that other groups may also distribute
working documents as Internet-Drafts. The list of current Internet- working documents as Internet-Drafts. The list of current Internet-
Drafts is at http://datatracker.ietf.org/drafts/current/. Drafts is at http://datatracker.ietf.org/drafts/current/.
Internet-Drafts are draft documents valid for a maximum of six months Internet-Drafts are draft documents valid for a maximum of six months
and may be updated, replaced, or obsoleted by other documents at any and may be updated, replaced, or obsoleted by other documents at any
time. It is inappropriate to use Internet-Drafts as reference time. It is inappropriate to use Internet-Drafts as reference
material or to cite them other than as "work in progress." material or to cite them other than as "work in progress."
This Internet-Draft will expire on May 16, 2016. This Internet-Draft will expire on May 22, 2016.
Copyright Notice Copyright Notice
Copyright (c) 2015 IETF Trust and the persons identified as the Copyright (c) 2015 IETF Trust and the persons identified as the
document authors. All rights reserved. document authors. All rights reserved.
This document is subject to BCP 78 and the IETF Trust's Legal This document is subject to BCP 78 and the IETF Trust's Legal
Provisions Relating to IETF Documents Provisions Relating to IETF Documents
(http://trustee.ietf.org/license-info) in effect on the date of (http://trustee.ietf.org/license-info) in effect on the date of
publication of this document. Please review these documents publication of this document. Please review these documents
skipping to change at page 8, line 10 skipping to change at page 8, line 10
This is a simple example of a SCRAM-SHA-256 authentication exchange This is a simple example of a SCRAM-SHA-256 authentication exchange
(no support for channel bindings, as this feature is not currently (no support for channel bindings, as this feature is not currently
supported by HTTP). Username 'user' and password 'pencil' are used. supported by HTTP). Username 'user' and password 'pencil' are used.
Note that long lines are folded for readability. Note that long lines are folded for readability.
C: GET /resource HTTP/1.1 C: GET /resource HTTP/1.1
C: Host: server.example.com C: Host: server.example.com
C: [...] C: [...]
S: HTTP/1.1 401 Unauthorized S: HTTP/1.1 401 Unauthorized
S: WWW-Authenticate: Digest realm="realm1@host.com", S: WWW-Authenticate: Digest realm="realm1@example.com",
Digest realm="realm2@host.com", Digest realm="realm2@example.com",
Digest realm="realm3@host.com", Digest realm="realm3@example.com",
SCRAM-SHA-256 realm="realm3@host.com", SCRAM-SHA-256 realm="realm3@example.com",
SCRAM-SHA-256 realm="testrealm@host.com" SCRAM-SHA-256 realm="testrealm@example.com"
S: [...] S: [...]
C: GET /resource HTTP/1.1 C: GET /resource HTTP/1.1
C: Host: server.example.com C: Host: server.example.com
C: Authorization: SCRAM-SHA-256 realm="testrealm@host.com", C: Authorization: SCRAM-SHA-256 realm="testrealm@example.com",
data=biwsbj11c2VyLHI9ck9wck5HZndFYmVSV2diTkVrcU8K data=biwsbj11c2VyLHI9ck9wck5HZndFYmVSV2diTkVrcU8K
C: [...] C: [...]
S: HTTP/1.1 401 Unauthorized S: HTTP/1.1 401 Unauthorized
S: WWW-Authenticate: SCRAM-SHA-256 S: WWW-Authenticate: SCRAM-SHA-256
sid=AAAABBBBCCCCDDDD, sid=AAAABBBBCCCCDDDD,
data=cj1yT3ByTkdmd0ViZVJXZ2JORWtxTyVodllEcFdVYTJSYVRDQWZ1eEZJbGo data=cj1yT3ByTkdmd0ViZVJXZ2JORWtxTyVodllEcFdVYTJSYVRDQWZ1eEZJbGo
paE5sRixzPVcyMlphSjBTTlk3c29Fc1VFamI2Z1E9PSxpPTQwOTYK paE5sRixzPVcyMlphSjBTTlk3c29Fc1VFamI2Z1E9PSxpPTQwOTYK
S: [...] S: [...]
skipping to change at page 8, line 47 skipping to change at page 8, line 47
S: HTTP/1.1 200 Ok S: HTTP/1.1 200 Ok
S: Authentication-Info: sid=AAAABBBBCCCCDDDD, S: Authentication-Info: sid=AAAABBBBCCCCDDDD,
data=dj02cnJpVFJCaTIzV3BSUi93dHVwK21NaFVaVW4vZEI1bkxUSlJzamw5NUc0PQo= data=dj02cnJpVFJCaTIzV3BSUi93dHVwK21NaFVaVW4vZEI1bkxUSlJzamw5NUc0PQo=
S: [...Other header fields and resource body...] S: [...Other header fields and resource body...]
In the above example the first client request contains data attribute In the above example the first client request contains data attribute
which base64 decodes as follows: "n,,n=user,r=rOprNGfwEbeRWgbNEkqO" which base64 decodes as follows: "n,,n=user,r=rOprNGfwEbeRWgbNEkqO"
(with no quotes). Server then responds with data attribute which (with no quotes). Server then responds with data attribute which
base64 decodes as follows: "r=rOprNGfwEbeRWgbNEkqO%hvYDpWUa2RaTCAfuxF base64 decodes as follows: "r=rOprNGfwEbeRWgbNEkqO%hvYDpWUa2RaTCAfuxF
Ilj)hNlF$k0,s=W22ZaJ0SNY7soEsUEjb6gQ==,i=4096". The next client Ilj)hNlF,s=W22ZaJ0SNY7soEsUEjb6gQ==,i=4096". The next client request
request contains data attribute which base64 decodes as follows: "c=b contains data attribute which base64 decodes as follows: "c=biws,r=rO
iws,r=rOprNGfwEbeRWgbNEkqO%hvYDpWUa2RaTCAfuxFIlj)hNlF$k0,p=dHzbZapWIk prNGfwEbeRWgbNEkqO%hvYDpWUa2RaTCAfuxFIlj)hNlF,p=dHzbZapWIk4jUhN+Ute9y
4jUhN+Ute9ytag9zjfMHgsqmmiz7AndVQ=". An the final server response tag9zjfMHgsqmmiz7AndVQ=". An the final server response contains data
contains data attribute which base64 decodes as follows: attribute which base64 decodes as follows:
"v=6rriTRBi23WpRR/wtup+mMhUZUn/dB5nLTJRsjl95G4=". "v=6rriTRBi23WpRR/wtup+mMhUZUn/dB5nLTJRsjl95G4=".
Note that in the example above the client can also initiate SCRAM Note that in the example above the client can also initiate SCRAM
authentication without first being prompted by the server. authentication without first being prompted by the server.
Initial "SCRAM-SHA-256" authentication starts with sending the Initial "SCRAM-SHA-256" authentication starts with sending the
"Authorization" request header field defined by HTTP/1.1, Part 7 "Authorization" request header field defined by HTTP/1.1, Part 7
[RFC7235] containing "SCRAM-SHA-256" authentication scheme and the [RFC7235] containing "SCRAM-SHA-256" authentication scheme and the
following attributes: following attributes:
skipping to change at page 9, line 27 skipping to change at page 9, line 27
As specified in [RFC7235], the "realm" attribute MUST NOT appear As specified in [RFC7235], the "realm" attribute MUST NOT appear
more than once. The realm attribute only appears in the first more than once. The realm attribute only appears in the first
SCRAM message to the server and in the first SCRAM response from SCRAM message to the server and in the first SCRAM response from
the server. the server.
o The client also includes the data attribute that contains base64 o The client also includes the data attribute that contains base64
encoded "client-first-message" [RFC5802] containing: encoded "client-first-message" [RFC5802] containing:
* a header consisting of a flag indicating whether channel * a header consisting of a flag indicating whether channel
binding is supported-but-not-used, not supported, or used . binding is supported-but-not-used, not supported, or used .
Note that version of SCRAM doesn't support HTTP channel Note that this version of SCRAM doesn't support HTTP channel
bindings, so this header always starts with "n", otherwise the bindings, so this header always starts with "n"; otherwise the
message is invalid and authentication MUST fail. message is invalid and authentication MUST fail.
* SCRAM username and a random, unique nonce attributes. * SCRAM username and a random, unique nonce attributes.
In HTTP response, the server sends WWW-Authenticate header field In HTTP response, the server sends WWW-Authenticate header field
containing: a unique session identifier (the "sid" attribute) plus containing: a unique session identifier (the "sid" attribute) plus
the "data" attribute containing base64-encoded "server-first-message" the "data" attribute containing base64-encoded "server-first-message"
[RFC5802]. The "server-first-message" contains the user's iteration [RFC5802]. The "server-first-message" contains the user's iteration
count i, the user's salt, and the nonce with a concatenation of the count i, the user's salt, and the nonce with a concatenation of the
client-specified one with a server nonce. client-specified one with a server nonce.
skipping to change at page 10, line 15 skipping to change at page 10, line 15
The client then authenticates the server by computing the The client then authenticates the server by computing the
ServerSignature and comparing it to the value sent by the server. If ServerSignature and comparing it to the value sent by the server. If
the two are different, the client MUST consider the authentication the two are different, the client MUST consider the authentication
exchange to be unsuccessful and it might have to drop the connection. exchange to be unsuccessful and it might have to drop the connection.
5.1. One round trip reauthentication 5.1. One round trip reauthentication
If the server supports SCRAM reauthentication, the server sends in If the server supports SCRAM reauthentication, the server sends in
its initial HTTP response a WWW-Authenticate header field containing: its initial HTTP response a WWW-Authenticate header field containing:
the "realm" attribute (as defined earlier), the "sr" attribute that the "realm" attribute (as defined earlier), the "sr" attribute that
contains the server part of the "r" attribute (see [RFC5802] and contains the server part of the "r" attribute (see [RFC5802]) and
optional "ttl" attribute (which contains the "sr" value validity in optional "ttl" attribute (which contains the "sr" value validity in
seconds). seconds).
If the client has authenticated to the same realm before (i.e. it If the client has authenticated to the same realm before (i.e. it
remembers "i" and "s" attributes for the user from earlies remembers "i" and "s" attributes for the user from earlier
authentication exchanges with the server), it can respond to that authentication exchanges with the server), it can respond to that
with "client-final-message". [[CREF1: Should some counter be added with "client-final-message". [[CREF1: Should some counter be added
to make "sr" unique for each reauth?]] to make "sr" unique for each reauth?]]
If the server considers the server part of the nonce (the "r" If the server considers the server part of the nonce (the "r"
attribute) to be still valid, it will provide access to the requested attribute) to be still valid, it will provide access to the requested
resource (assuming the client hash verifies correctly, of course). resource (assuming the client hash verifies correctly, of course).
However if the server considers that the server part of the nonce is However if the server considers that the server part of the nonce is
stale (for example if the "sr" value is used after the "ttl" stale (for example if the "sr" value is used after the "ttl"
seconds), the server returns "401 Unauthorized" containing the SCRAM seconds), the server returns "401 Unauthorized" containing the SCRAM
skipping to change at page 11, line 10 skipping to change at page 11, line 10
first-message" are reconstructed from data known to the client and first-message" are reconstructed from data known to the client and
the server. the server.
Reauthentication can look like this: Reauthentication can look like this:
C: GET /resource HTTP/1.1 C: GET /resource HTTP/1.1
C: Host: server.example.com C: Host: server.example.com
C: [...] C: [...]
S: HTTP/1.1 401 Unauthorized S: HTTP/1.1 401 Unauthorized
S: WWW-Authenticate: Digest realm="realm1@host.com", S: WWW-Authenticate: Digest realm="realm1@example.com",
Digest realm="realm2@host.com", Digest realm="realm2@example.com",
Digest realm="realm3@host.com", Digest realm="realm3@example.com",
SCRAM-SHA-256 realm="realm3@host.com", SCRAM-SHA-256 realm="realm3@example.com",
SCRAM-SHA-256 realm="testrealm@host.com", sr=pWUa2RaTCAfuxFIlj)hNlF$k0 SCRAM-SHA-256 realm="testrealm@example.com", sr=%hvYDpWUa2RaTCAfuxFIlj)hNlF
SCRAM-SHA-256 realm="testrealm2@host.com", sr=AAABBBCCCDDD, ttl=120 SCRAM-SHA-256 realm="testrealm2@example.com", sr=AAABBBCCCDDD, ttl=120
S: [...] S: [...]
[Client authenticates as usual to realm "testrealm@host.com"] [Client authenticates as usual to realm "testrealm@example.com"]
[Some time later client decides to reauthenticate. [Some time later client decides to reauthenticate.
It will use the cached "i" (4096) and "s" (W22ZaJ0SNY7soEsUEjb6gQ==) from earlies exchanges. It will use the cached "i" (4096) and "s" (W22ZaJ0SNY7soEsUEjb6gQ==) from earlies exchanges.
It will use the server advertised "sr" value as the server part of the "r".] It will use the server advertised "sr" value as the server part of the "r".]
C: GET /resource HTTP/1.1 C: GET /resource HTTP/1.1
C: Host: server.example.com C: Host: server.example.com
C: Authorization: SCRAM-SHA-256 realm="testrealm@host.com", C: Authorization: SCRAM-SHA-256 realm="testrealm@example.com",
data=Yz1iaXdzLHI9ck9wck5HZndFYmVSV2diTkVrcU8laHZZRHBXVWEyUmFUQ0FmdXhG data=Yz1iaXdzLHI9ck9wck5HZndFYmVSV2diTkVrcU8laHZZRHBXVWEyUmFUQ0FmdXhG
SWxqKWhObEYscD1kSHpiWmFwV0lrNGpVaE4rVXRlOXl0YWc5empmTUhnc3FtbWl6 SWxqKWhObEYscD1kSHpiWmFwV0lrNGpVaE4rVXRlOXl0YWc5empmTUhnc3FtbWl6
N0FuZFZRPQo= N0FuZFZRPQo=
C: [...] C: [...]
S: HTTP/1.1 200 Ok S: HTTP/1.1 200 Ok
S: Authentication-Info: sid=AAAABBBBCCCCDDDD, S: Authentication-Info: sid=AAAABBBBCCCCDDDD,
data=dj02cnJpVFJCaTIzV3BSUi93dHVwK21NaFVaVW4vZEI1bkxUSlJzamw5NUc0PQo= data=dj02cnJpVFJCaTIzV3BSUi93dHVwK21NaFVaVW4vZEI1bkxUSlJzamw5NUc0PQo=
S: [...Other header fields and resource body...] S: [...Other header fields and resource body...]
skipping to change at page 12, line 46 skipping to change at page 12, line 46
8. Security Considerations 8. Security Considerations
If the authentication exchange is performed without a strong security If the authentication exchange is performed without a strong security
layer (such as TLS with data confidentiality), then a passive layer (such as TLS with data confidentiality), then a passive
eavesdropper can gain sufficient information to mount an offline eavesdropper can gain sufficient information to mount an offline
dictionary or brute-force attack which can be used to recover the dictionary or brute-force attack which can be used to recover the
user's password. The amount of time necessary for this attack user's password. The amount of time necessary for this attack
depends on the cryptographic hash function selected, the strength of depends on the cryptographic hash function selected, the strength of
the password and the iteration count supplied by the server. SCRAM the password and the iteration count supplied by the server. SCRAM
allows to increase the iteration count over time in order to slow allows the server/server administrator to increase the iteration
down the above attacks. (Note that a server that is only in count over time in order to slow down the above attacks. (Note that
posession of "StoredKey" and "ServerKey" can't automatic increase the a server that is only in posession of "StoredKey" and "ServerKey"
iteration count upon successful authentication. Such increase would can't automatic increase the iteration count upon successful
require resetting user's password.) An external security layer with authentication. Such increase would require resetting user's
strong encryption will prevent these attack. password.) An external security layer with strong encryption will
prevent these attack.
If the authentication information is stolen from the authentication If the authentication information is stolen from the authentication
database, then an offline dictionary or brute-force attack can be database, then an offline dictionary or brute-force attack can be
used to recover the user's password. The use of salt mitigates this used to recover the user's password. The use of salt mitigates this
attack somewhat by requiring a separate attack on each password. attack somewhat by requiring a separate attack on each password.
Authentication mechanisms which protect against this attack are Authentication mechanisms which protect against this attack are
available (e.g., the EKE class of mechanisms). RFC 2945 [RFC2945] is available (e.g., the EKE class of mechanisms). RFC 2945 [RFC2945] is
an example of such technology. an example of such technology.
If an attacker obtains the authentication information from the If an attacker obtains the authentication information from the
 End of changes. 13 change blocks. 
33 lines changed or deleted 34 lines changed or added

This html diff was produced by rfcdiff 1.42. The latest version is available from http://tools.ietf.org/tools/rfcdiff/