Network Working Group | N. Williams |
Internet-Draft | Cryptonector |
Intended status: Standards Track | January 02, 2013 |
Expires: July 06, 2013 |
Hypertext Transport Protocol (HTTP) Session Continuation Protocol
draft-williams-websec-session-continue-proto-00
One of the most often talked about problems in web security is “cookies”. Web cookies are a method of associating requests with “sessions” that may have been authenticated somehow. Cookies are a form of bearer token that leave much to be desired. This document proposes a session “continuation” protocol for HyperText Transport Protocol (HTTP).
This Internet-Draft is submitted in full conformance with the provisions of BCP 78 and BCP 79.
Internet-Drafts are working documents of the Internet Engineering Task Force (IETF). Note that other groups may also distribute working documents as Internet-Drafts. The list of current Internet- Drafts is at http:/⁠/⁠datatracker.ietf.org/⁠drafts/⁠current/⁠.
Internet-Drafts are draft documents valid for a maximum of six months and may be updated, replaced, or obsoleted by other documents at any time. It is inappropriate to use Internet-Drafts as reference material or to cite them other than as "work in progress."
This Internet-Draft will expire on July 06, 2013.
Copyright (c) 2013 IETF Trust and the persons identified as the document authors. All rights reserved.
This document is subject to BCP 78 and the IETF Trust's Legal Provisions Relating to IETF Documents (http:/⁠/⁠trustee.ietf.org/⁠license-⁠info) in effect on the date of publication of this document. Please review these documents carefully, as they describe your rights and restrictions with respect to this document. Code Components extracted from this document must include Simplified BSD License text as described in Section 4.e of the Trust Legal Provisions and are provided without warranty as described in the Simplified BSD License.
The motivation for this protocol is described in [I-D.williams-websec-session-continue-prob].
We define a protocol for cryptographic “session continuation” for HyperText Transport Protocol (HTTP) [RFC2616]. Session continuation is the act of binding an HTTP request to a “session”. A “session” consists of all the HTTP requests by a given user (possibly an authenticated user, or possibly an anonymous user). This protocol is a cryptographic protocol that aims to meet all the requirements given in [I-D.williams-websec-session-continue-prob].
The protocol consists of:
The key words "MUST", "MUST NOT", "REQUIRED", "SHALL", "SHALL NOT", "SHOULD", "SHOULD NOT", "RECOMMENDED", "MAY", and "OPTIONAL" in this document are to be interpreted as described in [RFC2119].
There are two methods for keying an HTTP session:
For the key assertion method TLS with confidentiality protection is clearly REQUIRED for security. We've considered the possibility of using Diffie-Hellman key agreement or RSA key transport, but as that would duplicate functionality that is in TLS we consider that out of scope for the time being.
In either case a single session key is produced, and that is the only key utilized. Having a single key helps reduce session state size and protocol complexity, but we must (and do) distinguish key usage by prefixing a purpose indicator to the MAC input.
When keys are output by HTTP authentication there may be a key length mismatch. In this case a Key Derivation Function (KDF) [RFC5869] is applied to generate the session key.
We expect that many sites will continue to mix HTTP and HTTPS for various reasons. To make this possible the MAC input will include a marker indicating HTTP or HTTPS.
When an HTTP client uses HTTP authentication, and the authentication mechanism used can establish a session key, then the client SHOULD request session initiation using a shared session key output by the HTTP authentication mechanism. The client MUST send the session initiation header concurrently with the last HTTP authentication message.
Sessions for unauthenticated users may appear to make little sense at first. This is useful, for example, and just as web cookies are, for tracking “shopping carts” when a user is window shopping, so to speak.
For unauthenticated session initiation the client merely requests the creation of a session with an asserted session key, for lack of a better choice.
Sessions are always initiated by the client by including a Session-Init header in the client's request carrying the client's proposal for a session.
Servers that support sessions will respond by creating a session and returning a session ID URI.
The Session-Init proposal header's value consists of a comma-separated list of proposal parameters:
session-param = token "=" ( token | quoted-string ) Session-Init = 1#session-param
Figure 1: Session-Init request header
The following session parameters are defined:
The server responds with a Session-Assign header:
session-params = 1#session-param Session-Init-Value = <the value of the Session-Init header> MAC-input = Session-Init-Value "," session-params MAC = <base64-encoding of MAC taken over the MAC-input> Session-Assign = session-params ["," MAC]
Figure 2: Session-Assign response header
The MAC is OPTIONAL when using HTTPS, REQUIRED otherwise.
The session-params for Session-Assign are:
A service might be composed of multiple related servers, each with a different hostname. As a result the service may require a client to use the same session across the service's component servers. We provide a mechanism by which the server may indicate a set of such servers to the client: the Host-Scope session-param in the server's Session-Assign response header.
[XXX We need a way to constrain this for privacy protection reasons. It's not yet clear how the client can judge which Host-Scope paramters to accept or ignore, only that must be allowed to do so.]
To facilitate interoperable session sharing across heterogeneous server implementations we define a session resource -named by its session URI- that can be obtained with a properly-authenticated GET by authorized entities. The session resource's representation is a application/json document type, containing a JSON-serialized associative array with the following REQUIRED keys:
A client might first establish an unauthenticated session then authenticate the user later. When authentication is done the client might wish to preserve any state associated with the preceding unauthenticated session. The client does this by sending a Session-Init at authentication time with a 'Previous-Session-URI' session-param and, if there was server-assigned session state, a 'Previous-Session-State' session-param.
Once a session is established the client binds requests to sessions as described here.
There are two cases: HTTPS and HTTP. In both cases the client adds a header
For the HTTPS case the client adds a “Session” header to its requests with the following content: the session identifier assigned by the server, a nonce generated by the client, and a MAC of the nonce and the TLS channel bindings.
The value of the Session header consists of a base64-encoded 128-bit nonce and a MAC, using the session's MAC algorithm, of the nonce and the channel binding, each base64-encoded then concatenated in that order:
CB = <base64-encoding of the channel bindings> nonce = <base64-encoded 128-bit nonce> new-state = ... direction = "c2s" | "s2c" prot-state = "protected" | "unprotected" response-status = "" | "Invalid-MAC" | | "Session-expired" "Session-unknown" MAC-input = direction "," prot-state "," nonce "," CB "," status "," [new-state] MAC = <base64encoded MAC taken over MAC-input> Session = nonce "," response-status "," [new-state] "," MAC
Figure 3: Session header
Where the response must carry a Session header, the form of the value is the same as for requests.
The MAC is taken over a direction indicator, an indicator of whether TLS is used, the nonce, the channel bindings, and so on, as shown in Figure 3. Only the server may assert new session state, and only the server indicates a response-status other than “” (empty string).
The receiver computes the same MAC using the sender's nonce (and new-state, if present, when the receiver is the client) and compares the resulting MAC to the MAC from the Session header.
If MAC validation of a request fails then the server MUST respond with a 403 status code with a non-empty response-status int he Session-header. Error responses MUST include a Session header. If 403 response's Session header indicates “Invalid-MAC” then if the client had used HTTPS then the client SHOULD warn the user, otherwise the client SHOULD retry. If the 403 response's Session header indicates “Session-expired” then the client SHOULD renew the session (see Section 6.2). Otherwise the client must assume that the old session has been destroyed (e.g., because of a logout or server state data loss) and may establish a new session.
If MAC validation of a response fails the the client MUST act as though a 400 (bad request) had been sent instead. If the request was idempotent the client SHOULD retry, otherwise recovery is not specified.
If the server decides that a session is no longer valid then the server should respond with a 401 status code. The client should then re-authenticate or establish a new unauthenticated session, using the Previous-Session-URI and Previous-Session-State session-params of the new Session-Init to indicate that the old session is being “renewed”.
One possibility that has some appeal would be to define a new HTTP authentication scheme called “Session” (say) and use that instead of the “Session” header defined above. The primary advantage to the WWW-Authenticate approach is that it fits the existing HTTP authentication framework, allowing a server to present to an application the user authentication information embedded in the session state as if the user were re-authenticated in each request. Session continuation can then be seen as a form of fast re-authentication.
To logout the client SHOULD perform a DELETE of the session URI.
The client MAY do a GET of the session URI. The semantics of the response body for this are not specified here. As explained in Section 4, servers also may GET a session URI; see Section 4 for more details.
Quite clearly this protocol meets requirements 1, 2, 3, 5, and 11 from [I-D.williams-websec-session-continue-prob].
The security requirements are also met:
This document creates a number of new HTTP request and response headers. These headers will need to be added to the HTTP header registry: <TBD>.
This session continuation protocol appears to meet the requirements outlined in [I-D.williams-websec-session-continue-prob]. [XXX Add analysis. In particular explain how MAC(CB + nonce) is sufficient to defeat BEAST and CRIME.]
This proposal meets security requirements from the problem statement [I-D.williams-websec-session-continue-prob]. See Section 9 for details.
[...]
[RFC2617] | Franks, J., Hallam-Baker, P.M., Hostetler, J.L., Lawrence, S.D., Leach, P.J., Luotonen, A. and L. Stewart, "HTTP Authentication: Basic and Digest Access Authentication", RFC 2617, June 1999. |
[RFC5849] | Hammer-Lahav, E., "The OAuth 1.0 Protocol", RFC 5849, April 2010. |
[I-D.ietf-oauth-v2] | Hammer-Lahav, E, Recordon, D and D Hardt, "The OAuth 2.0 Authorization Protocol", Internet-Draft draft-ietf-oauth-v2-25, March 2012. |
[I-D.hallambaker-httpintegrity] | Hallam-Baker, P, "HTTP Integrity Header", Internet-Draft draft-hallambaker-httpintegrity-02, November 2012. |