draft-ietf-oauth-v2-http-mac-00.txt   draft-ietf-oauth-v2-http-mac-01.txt 
Network Working Group E. Hammer-Lahav, Ed. Network Working Group E. Hammer-Lahav, Ed.
Internet-Draft Yahoo! Internet-Draft February 8, 2012
Intended status: Standards Track A. Barth Intended status: Standards Track
Expires: November 12, 2011 Google Expires: August 11, 2012
B. Adida
Mozilla
May 11, 2011
HTTP Authentication: MAC Access Authentication HTTP Authentication: MAC Access Authentication
draft-ietf-oauth-v2-http-mac-00 draft-ietf-oauth-v2-http-mac-01
Abstract Abstract
This document specifies the HTTP MAC access authentication scheme, an This document specifies the HTTP MAC access authentication scheme, an
HTTP authentication method using a message authentication code (MAC) HTTP authentication method using a message authentication code (MAC)
algorithm to provide cryptographic verification of portions of HTTP algorithm to provide cryptographic verification of portions of HTTP
requests. The document also defines an OAuth 2.0 binding for use as requests. The document also defines an OAuth 2.0 binding for use as
an access-token type, as well as an extension attribute to the HTTP an access-token type.
Set-Cookie response header field.
Status of this Memo Status of this Memo
This Internet-Draft is submitted in full conformance with the This Internet-Draft is submitted in full conformance with the
provisions of BCP 78 and BCP 79. provisions of BCP 78 and BCP 79.
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 November 12, 2011. This Internet-Draft will expire on August 11, 2012.
Copyright Notice Copyright Notice
Copyright (c) 2011 IETF Trust and the persons identified as the Copyright (c) 2012 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
carefully, as they describe your rights and restrictions with respect carefully, as they describe your rights and restrictions with respect
to this document. Code Components extracted from this document must to this document. Code Components extracted from this document must
include Simplified BSD License text as described in Section 4.e of include Simplified BSD License text as described in Section 4.e of
the Trust Legal Provisions and are provided without warranty as the Trust Legal Provisions and are provided without warranty as
described in the Simplified BSD License. described in the Simplified BSD License.
Table of Contents Table of Contents
1. Introduction . . . . . . . . . . . . . . . . . . . . . . . . . 4 1. Introduction . . . . . . . . . . . . . . . . . . . . . . . . . 3
1.1. Design Constraints . . . . . . . . . . . . . . . . . . . . 4 1.1. Example . . . . . . . . . . . . . . . . . . . . . . . . . 4
1.2. Example . . . . . . . . . . . . . . . . . . . . . . . . . 5 1.2. Notational Conventions . . . . . . . . . . . . . . . . . . 5
1.3. Notational Conventions . . . . . . . . . . . . . . . . . . 6 2. Issuing MAC Credentials . . . . . . . . . . . . . . . . . . . 5
2. Issuing MAC Credentials . . . . . . . . . . . . . . . . . . . 6 3. Making Requests . . . . . . . . . . . . . . . . . . . . . . . 6
3. Making Requests . . . . . . . . . . . . . . . . . . . . . . . 7 3.1. The "Authorization" Request Header . . . . . . . . . . . . 6
3.1. The "Authorization" Request Header . . . . . . . . . . . . 8 3.2. Request MAC . . . . . . . . . . . . . . . . . . . . . . . 7
3.2. Body Hash . . . . . . . . . . . . . . . . . . . . . . . . 9 3.2.1. Normalized Request String . . . . . . . . . . . . . . 8
3.3. Request MAC . . . . . . . . . . . . . . . . . . . . . . . 10 3.2.2. hmac-sha-1 . . . . . . . . . . . . . . . . . . . . . . 9
3.3.1. Normalized Request String . . . . . . . . . . . . . . 11 3.2.3. hmac-sha-256 . . . . . . . . . . . . . . . . . . . . . 9
3.3.2. hmac-sha-1 . . . . . . . . . . . . . . . . . . . . . . 12 4. Verifying Requests . . . . . . . . . . . . . . . . . . . . . . 10
3.3.3. hmac-sha-256 . . . . . . . . . . . . . . . . . . . . . 12 4.1. Timestamp Verification . . . . . . . . . . . . . . . . . . 10
4. Verifying Requests . . . . . . . . . . . . . . . . . . . . . . 13 4.2. The "WWW-Authenticate" Response Header Field . . . . . . . 11
4.1. The "WWW-Authenticate" Response Header Field . . . . . . . 14 5. Use with OAuth 2.0 . . . . . . . . . . . . . . . . . . . . . . 12
5. Use with OAuth 2.0 . . . . . . . . . . . . . . . . . . . . . . 14 5.1. Issuing MAC-Type Access Tokens . . . . . . . . . . . . . . 12
5.1. Issuing MAC-Type Access Tokens . . . . . . . . . . . . . . 15 6. Security Considerations . . . . . . . . . . . . . . . . . . . 13
6. Use with Set-Cookie . . . . . . . . . . . . . . . . . . . . . 16 6.1. MAC Keys Transmission . . . . . . . . . . . . . . . . . . 13
6.1. User Agent Requirements . . . . . . . . . . . . . . . . . 16 6.2. Confidentiality of Requests . . . . . . . . . . . . . . . 13
6.1.1. The Set-Cookie Header . . . . . . . . . . . . . . . . 16 6.3. Spoofing by Counterfeit Servers . . . . . . . . . . . . . 13
6.1.2. Storage Model . . . . . . . . . . . . . . . . . . . . 17 6.4. Plaintext Storage of Credentials . . . . . . . . . . . . . 13
6.1.3. The Authorization Header . . . . . . . . . . . . . . . 17 6.5. Entropy of MAC Keys . . . . . . . . . . . . . . . . . . . 14
7. Security Considerations . . . . . . . . . . . . . . . . . . . 18 6.6. Denial of Service / Resource Exhaustion Attacks . . . . . 14
7.1. MAC Keys Transmission . . . . . . . . . . . . . . . . . . 18 6.7. Timing Attacks . . . . . . . . . . . . . . . . . . . . . . 15
7.2. Confidentiality of Requests . . . . . . . . . . . . . . . 18 6.8. CSRF Attacks . . . . . . . . . . . . . . . . . . . . . . . 15
7.3. Spoofing by Counterfeit Servers . . . . . . . . . . . . . 19 6.9. Coverage Limitations . . . . . . . . . . . . . . . . . . . 15
7.4. Plaintext Storage of Credentials . . . . . . . . . . . . . 19 7. IANA Considerations . . . . . . . . . . . . . . . . . . . . . 16
7.5. Entropy of MAC Keys . . . . . . . . . . . . . . . . . . . 19 7.1. The HTTP MAC Authentication Scheme Algorithm Registry . . 16
7.6. Denial of Service / Resource Exhaustion Attacks . . . . . 20 7.1.1. Registration Template . . . . . . . . . . . . . . . . 17
7.7. Timing Attacks . . . . . . . . . . . . . . . . . . . . . . 20 7.1.2. Initial Registry Contents . . . . . . . . . . . . . . 17
7.8. CSRF Attacks . . . . . . . . . . . . . . . . . . . . . . . 20 7.2. OAuth Access Token Type Registration . . . . . . . . . . . 17
7.9. Coverage Limitations . . . . . . . . . . . . . . . . . . . 21 7.2.1. The "mac" OAuth Access Token Type . . . . . . . . . . 17
7.10. Version Rollback Attack . . . . . . . . . . . . . . . . . 21 7.3. OAuth Parameters Registration . . . . . . . . . . . . . . 18
8. IANA Considerations . . . . . . . . . . . . . . . . . . . . . 21 7.3.1. The "mac_key" OAuth Parameter . . . . . . . . . . . . 18
8.1. The HTTP MAC Authentication Scheme Algorithm Registry . . 21 7.3.2. The "mac_algorithm" OAuth Parameter . . . . . . . . . 18
8.1.1. Registration Template . . . . . . . . . . . . . . . . 22 8. Acknowledgments . . . . . . . . . . . . . . . . . . . . . . . 18
8.1.2. Initial Registry Contents . . . . . . . . . . . . . . 22 9. References . . . . . . . . . . . . . . . . . . . . . . . . . . 18
8.2. OAuth Access Token Type Registration . . . . . . . . . . . 23 9.1. Normative References . . . . . . . . . . . . . . . . . . . 18
8.2.1. The "mac" OAuth Access Token Type . . . . . . . . . . 23 9.2. Informative References . . . . . . . . . . . . . . . . . . 19
8.3. OAuth Parameters Registration . . . . . . . . . . . . . . 23 Author's Address . . . . . . . . . . . . . . . . . . . . . . . . . 20
8.3.1. The "mac_key" OAuth Parameter . . . . . . . . . . . . 23
8.3.2. The "mac_algorithm" OAuth Parameter . . . . . . . . . 23
9. Acknowledgments . . . . . . . . . . . . . . . . . . . . . . . 24
Appendix A. Document History . . . . . . . . . . . . . . . . . . 24
10. References . . . . . . . . . . . . . . . . . . . . . . . . . . 24
10.1. Normative References . . . . . . . . . . . . . . . . . . . 24
10.2. Informative References . . . . . . . . . . . . . . . . . . 25
Authors' Addresses . . . . . . . . . . . . . . . . . . . . . . . . 25
1. Introduction 1. Introduction
This specification defines the HTTP MAC access authentication scheme, This specification defines the HTTP MAC access authentication scheme,
providing a method for making authenticated HTTP requests with providing a method for making authenticated HTTP requests with
partial cryptographic verification of the request, covering the HTTP partial cryptographic verification of the request, covering the HTTP
method, request URI, host, and in some cases the request body. method, request URI, and host.
Similar to the HTTP Basic access authentication scheme [RFC2617], the Similar to the HTTP Basic access authentication scheme [RFC2617], the
MAC scheme utilizes a set of client credentials which include an MAC scheme utilizes a set of client credentials which include an
identifier and key. However, in contrast with the Basic scheme, the identifier and key. However, in contrast with the Basic scheme, the
key is never included in authenticated requests but is used to key is never included in authenticated requests but is used to
calculate the request MAC value which is included instead. calculate the request MAC value which is included instead.
The MAC scheme requires the establishment of a shared symmetric key The MAC scheme requires the establishment of a shared symmetric key
between the client and the server. This is often accomplished between the client and the server. This specification offers one
through a manual process such as client registration. This such method for issuing a set of MAC credentials to the client using
specification offers two methods for issuing a set of MAC credentials OAuth 2.0 in the form of a MAC-type access token.
to the client using:
o OAuth 2.0 in the form of a MAC-type access token, using any
supported OAuth grant type.
o The HTTP "Set-Cookie" response header field via an extension
attribute.
1.1. Design Constraints
The primary design goal of this mechanism is to improve HTTP state The primary design goal of this mechanism is to simplify and improve
management for services that are unwilling or unable to employ TLS HTTP authentication for services that are unwilling or unable to
for every request. In particular, this mechanism leverage an initial employ TLS for every request. In particular, this mechanism leverage
TLS setup phase (e.g., when the server receives the user's primary an initial TLS setup phase to establish a shared secret between the
credentials, such as a TLS client certificate or a password) to client and the server. The shared secret is then used over an
establish a shared secret between the client and the server. The insecure channel to provide protection against a passive network
shared secret is then used over an insecure channel to provide attacker.
protection against a passive network attacker.
In particular, when a server uses this mechanism, a passive network In particular, when a server uses this mechanism, a passive network
attacker will be unable to "steal" the user's session token, as is attacker will be unable to "steal" the user's session token, as is
possible today with cookies and other bearer tokens. In addition, possible today with cookies and other bearer tokens. In addition,
this mechanism helps secure the session token against leakage when this mechanism helps secure the session token against leakage when
sent over a secure channel to the wrong server (e.g., when the client sent over a secure channel to the wrong server. For example, when
uses some form of dynamic configuration to determine where to send an the client uses some form of dynamic configuration to determine where
authenticated request). to send an authenticated request, or when the client fails to
properly validate the server's identity as part of its TLS handshake.
Unlike the HTTP Digest authentication scheme, this mechanism does not Unlike the HTTP Digest authentication scheme, this mechanism does not
require interacting with the server to prevent replay attacks. require interacting with the server to prevent replay attacks.
Instead, the client provides both a nonce and a timestamp, which the Instead, the client provides both a nonce and a timestamp, which the
server can use to prevent replay attacks using a bounded amount of server can use to prevent replay attacks using a bounded amount of
storage. Also unlike Digest, this mechanism is not intended to storage. Also unlike Digest, this mechanism is not intended to
protect the user's password itself because the client and server both protect the user's password itself because the client and server both
have access to the key material in the clear. Instead, servers have access to the key material in the clear. Instead, servers
should issue a short-lived derivative credential for this mechanism should issue a short-lived derivative credential for this mechanism
during the initial TLS setup phase. during the initial TLS setup phase.
1.2. Example 1.1. Example
The client attempts to access a protected resource without The client attempts to access a protected resource without
authentication, making the following HTTP request to the resource authentication, making the following HTTP request to the resource
server: server:
GET /resource/1?b=1&a=2 HTTP/1.1 GET /resource/1?b=1&a=2 HTTP/1.1
Host: example.com Host: example.com
The resource server returns the following authentication challenge: The resource server returns the following authentication challenge:
HTTP/1.1 401 Unauthorized HTTP/1.1 401 Unauthorized
WWW-Authenticate: MAC WWW-Authenticate: MAC
The client has previously obtained a set of MAC credentials for The client has previously obtained a set of MAC credentials for
accessing resources on the "http://example.com/" server. The MAC accessing resources on the "http://example.com/" server. The MAC
credentials issued to the client include the following attributes: credentials issued to the client include the following attributes:
MAC key identifier: h480djs93hd8 MAC key identifier: h480djs93hd8
MAC key: 489dks293j39 MAC key: 489dks293j39
MAC algorithm: hmac-sha-1 MAC algorithm: hmac-sha-1
Issue time: Thu, 02 Dec 2010 21:39:45 GMT
The client constructs the authentication header by calculating the The client constructs the authentication header by calculating a
credentials' age (number of seconds since the credentials were timestamp (e.g. the number of seconds since January 1, 1970 00:00:00
issued) and generating a random string used to construct a nonce: GMT) and generating a random string used as a nonce:
Age: 264095 Timestamp: 1336363200
Random string: dj83hs9s Nonce: dj83hs9s
Nonce: 264095:dj83hs9s
The client constructs the normalized request string (the new line The client constructs the normalized request string (the new line
separator character is represented by "\n" for display purposes only; separator character is represented by "\n" for display purposes only;
the two trailing new line separators signify that no body hash or the trailing new line separator signify that no extension value is
extension value are included with the request, explained below): included with the request, explained below):
264095:dj83hs9s\n 1336363200\n
dj83hs9s\n
GET\n GET\n
/resource/1?b=1&a=2\n /resource/1?b=1&a=2\n
example.com\n example.com\n
80\n 80\n
\n \n
\n
The request MAC is calculated using the specified MAC algorithm The request MAC is calculated using the specified MAC algorithm
"hmac-sha-1" and the MAC key over the normalized request string. The "hmac-sha-1" and the MAC key over the normalized request string. The
result is base64-encoded to produce the request MAC: result is base64-encoded to produce the request MAC:
SLDJd4mg43cjQfElUs3Qub4L6xE= bhCQXTVyfj5cmA9uKkPFx1zeOXM=
The client includes the MAC key identifier, nonce, and request MAC The client includes the MAC key identifier, nonce, and request MAC
with the request using the "Authorization" request header field: with the request using the "Authorization" request header field:
GET /resource/1?b=1&a=2 HTTP/1.1 GET /resource/1?b=1&a=2 HTTP/1.1
Host: example.com Host: example.com
Authorization: MAC id="h480djs93hd8", Authorization: MAC id="h480djs93hd8",
nonce="264095:dj83hs9s", ts="1336363200",
mac="SLDJd4mg43cjQfElUs3Qub4L6xE=" nonce="dj83hs9s",
mac="bhCQXTVyfj5cmA9uKkPFx1zeOXM="
The server validates the request by calculating the request MAC again The server validates the request by calculating the request MAC again
based on the request received and verifies the validity and scope of based on the request received and verifies the validity and scope of
the MAC credentials. If valid, the server responds with the the MAC credentials. If valid, the server responds with the
requested resource representation. requested resource representation.
1.3. Notational Conventions 1.2. Notational Conventions
The key words 'MUST', 'MUST NOT', 'REQUIRED', 'SHALL', 'SHALL NOT', The key words 'MUST', 'MUST NOT', 'REQUIRED', 'SHALL', 'SHALL NOT',
'SHOULD', 'SHOULD NOT', 'RECOMMENDED', 'MAY', and 'OPTIONAL' in this 'SHOULD', 'SHOULD NOT', 'RECOMMENDED', 'MAY', and 'OPTIONAL' in this
specification are to be interpreted as described in [RFC2119]. specification are to be interpreted as described in [RFC2119].
This specification uses the Augmented Backus-Naur Form (ABNF) This specification uses the Augmented Backus-Naur Form (ABNF)
notation of [I-D.ietf-httpbis-p1-messaging]. Additionally, the notation of [I-D.ietf-httpbis-p1-messaging]. Additionally, the
following rules are included from [RFC2617]: auth-param. following rules are included from [RFC2617]: auth-param.
2. Issuing MAC Credentials 2. Issuing MAC Credentials
This specification defines two method for issuing MAC credentials This specification provides one method for issuing MAC credentials
using OAuth 2.0 as described in Section 5 and using the HTTP using OAuth 2.0 as described in Section 5. This specification does
"Set-Cookie" response header field as described in Section 6. not mandate servers to support any particular method for issuing MAC
credentials, and other methods MAY be defined and used. Whenever MAC
This specification does not mandate servers to support any particular credentials are issued, the credentials MUST include the following
method for issuing MAC credentials, and other methods MAY be defined attributes:
and used. Whenever MAC credentials are issued, the credentials MUST
include the following attributes:
MAC key identifier MAC key identifier
A string identifying the MAC key used to calculate the request A string identifying the MAC key used to calculate the request
MAC. The string is usually opaque to the client. The server MAC. The string is usually opaque to the client. The server
typically assigns a specific scope and lifetime to each set of typically assigns a specific scope and lifetime to each set of
MAC credentials. The identifier MAY denote a unique value used MAC credentials. The identifier MAY denote a unique value used
to retrieve the authorization information (e.g. from a to retrieve the authorization information (e.g. from a
database), or self-contain the authorization information in a database), or self-contain the authorization information in a
verifiable manner (i.e. a string consisting of some data and a verifiable manner (i.e. a string consisting of some data and a
signature). signature).
MAC key MAC key
A shared symmetric secret used as the MAC algorithm key. The A shared symmetric secret used as the MAC algorithm key. The
server MUST NOT issue the same MAC key and MAC key identifier server MUST NOT reissue a previously issued MAC key and MAC key
combination. identifier combination.
MAC algorithm MAC algorithm
A MAC algorithm used to calculate the request MAC. Value MUST A MAC algorithm used to calculate the request MAC. Value MUST
be one of "hmac-sha-1", "hmac-sha-256", or a registered be one of "hmac-sha-1", "hmac-sha-256", or a registered
extension algorithm name as described in Section 8.1. extension algorithm name as described in Section 7.1.
Algorithm names are case-sensitive. If the MAC algorithm is Algorithm names are case-sensitive. If the MAC algorithm is
not understood by the client, the client MUST NOT use the MAC not understood by the client, the client MUST NOT use the MAC
credentials and continue as if no MAC credentials were issued. credentials and continue as if no MAC credentials were issued.
Issue time
The time when the credentials were issued, used to calculate
the credentials age when making requests. If the MAC
credentials were obtained via an HTTP response, the time of
issue is the time the response was received by the client.
The MAC key identifier, MAC key, MAC algorithm strings MUST NOT The MAC key identifier, MAC key, MAC algorithm strings MUST NOT
include characters other than: include characters other than:
%x20-21 / %x23-5B / %x5D-7E %x20-21 / %x23-5B / %x5D-7E
; Any printable ASCII character except for <"> and <\> ; Any printable ASCII character except for <"> and <\>
3. Making Requests 3. Making Requests
To make authenticated requests, the client must be in the possession To make authenticated requests, the client must be in the possession
of a valid set of MAC credentials accepted by the server. The client of a valid set of MAC credentials accepted by the server. The client
constructs the request by calculating a set of attributes, and adding constructs the request by calculating a set of attributes, and adding
them to the HTTP request using the "Authorization" request header them to the HTTP request using the "Authorization" request header
field as described in Section 3.1. field as described in Section 3.1.
3.1. The "Authorization" Request Header 3.1. The "Authorization" Request Header
The "Authorization" request header field uses the framework defined The "Authorization" request header field uses the framework defined
by [RFC2617] as follows: by [RFC2617] as follows:
credentials = "MAC" [ RWS 1#param ] credentials = "MAC" 1*SP #params
param = id / params = id / ts / nonce / ext / mac
nonce /
body-hash /
ext /
mac
id = "id" "=" <"> plain-string <"> id = "id" "=" string-value
nonce = "nonce" "=" <"> 1*DIGIT ":" plain-string <"> ts = "ts" "=" ( <"> timestamp <"> ) / timestamp
body-hash = "bodyhash" "=" <"> plain-string <"> nonce = "nonce" "=" string-value
ext = "ext" "=" <"> plain-string <"> ext = "ext" "=" string-value
mac = "mac" "=" <"> plain-string <"> mac = "mac" "=" string-value
timestamp = 1*DIGIT
string-value = ( <"> plain-string <"> ) / plain-string
plain-string = 1*( %x20-21 / %x23-5B / %x5D-7E ) plain-string = 1*( %x20-21 / %x23-5B / %x5D-7E )
The header attributes are set as follows: The header attributes are set as follows:
id id
REQUIRED. The MAC key identifier. REQUIRED. The MAC key identifier.
ts
REQUIRED. The request timestamp. The value MUST be a positive
integer set by the client when making each request to the
number of seconds elapsed from a fixed point in time (e.g.
January 1, 1970 00:00:00 GMT). The value MUST NOT include
leading zeros (e.g. "000273154346").
nonce nonce
REQUIRED. A unique string generated by the client to allow the REQUIRED. A unique string generated by the client. The value
server to verify that a request has never been made before and MUST be unique across all requests with the same timestamp and
helps prevent replay attacks when requests are made over an MAC key identifier combination.
insecure channel. The nonce value MUST be unique across all
requests with the same MAC key identifier.
The nonce value MUST consist of the age of the MAC credentials
expressed as the number of seconds since the credentials were
issued to the client, a colon character (%x25), and a unique
string (typically random). The age value MUST be a positive
integer and MUST NOT include leading zeros (e.g.
"000137131200"). For example: "273156:di3hvdf8".
To avoid the need to retain an infinite number of nonce values
for future checks, the server MAY choose to restrict the time
period after which a request with an old age is rejected. If
such a restriction is enforced, the server SHOULD allow for a
sufficiently large window to accommodate network delays which
will affect the credentials issue time used by the client to
calculate the credentials' age.
bodyhash
OPTIONAL. The HTTP request payload body hash as described in
Section 3.2.
ext ext
OPTIONAL. A string used to include additional information OPTIONAL. A string used to include additional information
which is covered by the request MAC. The content and format of which is covered by the request MAC. The content and format of
the string is beyond the scope of this specification. the string is beyond the scope of this specification.
mac mac
REQUIRED. The HTTP request MAC as described in Section 3.3. REQUIRED. The HTTP request MAC as described in Section 3.2.
Attributes MUST NOT appear more than once. Attribute values are Attributes MUST NOT appear more than once. Attribute values are
limited to a subset of ASCII, which does not require escaping, as limited to a subset of ASCII, which does not require escaping, as
defined by the plain-string ABNF. defined by the plain-string ABNF.
3.2. Body Hash 3.2. Request MAC
[[ Need to figure out exactly when body-hash is required ]]
The body hash is used to provide integrity verification of the HTTP
request payload body. The body hash value is calculated using a hash
algorithm over the entire HTTP request payload body.
The client MAY include the body hash with any request. The server
SHOULD require the calculation and inclusion of the body hash with
any request containing an payload body, or when the presence (or lack
of) of an payload body is of significance.
The body hash algorithm is determined by the MAC algorithm. The
SHA-1 hash algorithm as defined by [NIST FIPS-180-3] is used with the
"hmac-sha-1" MAC algorithm. The SHA-256 hash algorithm as defined by
[NIST FIPS-180-3] is used with the "hmac-sha-256" MAC algorithm.
Additional MAC algorithms MUST specify the corresponding body hash
algorithm.
The body hash is calculated as follows:
bodyhash = BASE64 ( HASH (text) )
Where:
HASH
is the hash algorithm function,
text
is the HTTP request payload body,
BASE64
is the base64-encoding function per [RFC2045] section 6.8,
applied to the hash result octet string, and
bodyhash
is the value used in the normalized request string and to set
the "bodyhash" attribute of the "Authorization" request header
field.
The body hash is calculated before the normalized request string is
constructed and the request MAC is calculated.
For example, the HTTP request:
POST /request HTTP/1.1
Host: example.net
Content-Type: application/x-www-form-urlencoded
hello=world%21
using MAC key identifier "jd93dh9dh39D", nonce "273156:di3hvdf8", MAC
algorithm "hmac-sha-1", and MAC key "8yfrufh348h", is transmitted as
(line breaks are for display purposes only):
POST /request HTTP/1.1
Host: example.com
Content-Type: application/x-www-form-urlencoded
Authorization: MAC id="jd93dh9dh39D",
nonce="273156:di3hvdf8",
bodyhash="k9kbtCIy0CkI3/FEfpS/oIDjk6k=",
mac="W7bdMZbv9UWOTadASIQHagZyirA="
hello=world%21
3.3. Request MAC
The client uses the MAC algorithm and the MAC key to calculate the The client uses the MAC algorithm and the MAC key to calculate the
request MAC. This specification defines two algorithms: "hmac-sha-1" request MAC. This specification defines two algorithms: "hmac-sha-1"
and "hmac-sha-256", and provides an extension registry for additional and "hmac-sha-256", and provides an extension registry for additional
algorithms. algorithms.
3.3.1. Normalized Request String 3.2.1. Normalized Request String
The normalized request string is a consistent, reproducible The normalized request string is a consistent, reproducible
concatenation of several of the HTTP request elements into a single concatenation of several of the HTTP request elements into a single
string. By normalizing the request into a reproducible string, the string. By normalizing the request into a reproducible string, the
client and server can both calculate the request MAC over the exact client and server can both calculate the request MAC over the exact
same value. same value.
The string is constructed by concatenating together, in order, the The string is constructed by concatenating together, in order, the
following HTTP request elements, each followed by a new line following HTTP request elements, each followed by a new line
character (%x0A): character (%x0A):
1. The nonce value generated for the request. 1. The timestamp value calculated for the request.
2. The HTTP request method in upper case. For example: "HEAD", 2. The nonce value generated for the request.
3. The HTTP request method in upper case. For example: "HEAD",
"GET", "POST", etc. "GET", "POST", etc.
3. The HTTP request-URI as defined by [RFC2616] section 5.1.2. 4. The HTTP request-URI as defined by [RFC2616] section 5.1.2.
4. The hostname included in the HTTP request using the "Host" 5. The hostname included in the HTTP request using the "Host"
request header field in lower case. request header field in lower case.
5. The port as included in the HTTP request using the "Host" request 6. The port as included in the HTTP request using the "Host" request
header field. If the header field does not include a port, the header field. If the header field does not include a port, the
default value for the scheme MUST be used (e.g. 80 for HTTP and default value for the scheme MUST be used (e.g. 80 for HTTP and
443 for HTTPS). 443 for HTTPS).
6. The request payload body hash as described in Section 3.2 if one
was calculated and included in the request, otherwise, an empty
string. Note that the body hash of an empty payload body is not
an empty string.
7. The value of the "ext" "Authorization" request header field 7. The value of the "ext" "Authorization" request header field
attribute if one was included in the request, otherwise, an empty attribute if one was included in the request, otherwise, an empty
string. string.
Each element is followed by a new line character (%x0A) including the Each element is followed by a new line character (%x0A) including the
last element and even when an element value is an empty string. last element and even when an element value is an empty string.
For example, the HTTP request: For example, the HTTP request:
POST /request?b5=%3D%253D&a3=a&c%40=&a2=r%20b&c2&a3=2+q HTTP/1.1 POST /request?b5=%3D%253D&a3=a&c%40=&a2=r%20b&c2&a3=2+q HTTP/1.1
Host: example.com Host: example.com
Hello World! Hello World!
using nonce "264095:7d8f3e4a", body hash using timestamp "264095:7d8f3e4a", nonce "7d8f3e4a", and extension
"Lve95gjOVATpfV8EL5X4nxwjKHE=", and extension string "a,b,c" is string "a,b,c" is normalized into the following string (the new line
normalized into the following string (the new line separator separator character is represented by "\n" for display purposes
character is represented by "\n" for display purposes only): only):
264095:7d8f3e4a\n 264095\n
7d8f3e4a\n
POST\n POST\n
/request?b5=%3D%253D&a3=a&c%40=&a2=r%20b&c2&a3=2+q\n /request?b5=%3D%253D&a3=a&c%40=&a2=r%20b&c2&a3=2+q\n
example.com\n example.com\n
80\n 80\n
Lve95gjOVATpfV8EL5X4nxwjKHE=\n
a,b,c\n a,b,c\n
3.3.2. hmac-sha-1 3.2.2. hmac-sha-1
"hmac-sha-1" uses the HMAC-SHA1 algorithm as defined in [RFC2104]: "hmac-sha-1" uses the HMAC-SHA1 algorithm as defined in [RFC2104]:
mac = HMAC-SHA1 (key, text) mac = HMAC-SHA1 (key, text)
Where: Where:
text text
is set to the value of the normalized request string as is set to the value of the normalized request string as
described in Section 3.3.1, described in Section 3.2.1,
key key
is set to the MAC key provided by the server, and is set to the MAC key provided by the server, and
mac mac
is used to set the value of the "mac" attribute, after the is used to set the value of the "mac" attribute, after the
result octet string is base64-encoded per [RFC2045] section result octet string is base64-encoded per [RFC2045] section
6.8. 6.8.
The SHA-1 hash algorithm as defined by [NIST FIPS-180-3] is used for 3.2.3. hmac-sha-256
generating the body hash attribute described in Section 3.2 when
using MAC credentials with the "hmac-sha-1" MAC algorithm.
3.3.3. hmac-sha-256
"hmac-sha-256" uses the HMAC algorithm as defined in [RFC2104] "hmac-sha-256" uses the HMAC algorithm as defined in [RFC2104]
together with the SHA-256 hash function defined in [NIST FIPS-180-3]: together with the SHA-256 hash function defined in [NIST FIPS-180-3]:
mac = HMAC-SHA256 (key, text) mac = HMAC-SHA256 (key, text)
Where: Where:
text text
is set to the value of the normalize request string as is set to the value of the normalize request string as
described in Section 3.3.1, described in Section 3.2.1,
key key
is set to the MAC key provided by the server, and is set to the MAC key provided by the server, and
mac mac
is used to set the value of the "mac" attribute, after the is used to set the value of the "mac" attribute, after the
result octet string is base64-encoded per [RFC2045] section result octet string is base64-encoded per [RFC2045] section
6.8. 6.8.
The SHA-256 hash algorithm as defined by [NIST FIPS-180-3] is used
for generating the body hash attribute described in Section 3.2 when
using MAC credentials with the "hmac-sha-256" MAC algorithm.
4. Verifying Requests 4. Verifying Requests
A server receiving an authenticated request validates it by A server receiving an authenticated request validates it by
performing the following REQUIRED steps: performing the following REQUIRED steps:
1. Recalculate the request body hash (if included in the request) as 1. Recalculate the request MAC as described in Section 3.2 and
described in Section 3.2 and request MAC as described in compare the request MAC to the value received from the client via
Section 3.3 and compare the request MAC to the value received the "mac" attribute.
from the client via the "mac" attribute. 2. Ensure that the combination of timestamp, nonce, and MAC key
2. Ensure that the combination of nonce and MAC key identifier identifier received from the client has not been received before
received from the client has not been used before in a previous in a previous request. The server MAY reject requests with stale
request (the server MAY reject requests with stale timestamps; timestamps as described in Section 4.1.
the determination of staleness is left up to the server to
define).
3. Verify the scope and validity of the MAC credentials. 3. Verify the scope and validity of the MAC credentials.
If the request fails verification, the server response includes the If the request fails verification, the server SHOULD respond using
"WWW-Authenticate" response header field as described in Section 4.1 the 401 (Unauthorized) HTTP status code and include the
and SHOULD include one of the following HTTP status codes: "WWW-Authenticate" response header field as described in Section 4.2.
401 (Unauthorized) 4.1. Timestamp Verification
The "Authorization" request header field is not included,
missing a required parameter, includes an unsupported parameter
or parameter value, repeats the same parameter, or is otherwise
malformed. The MAC credentials provided are expired, revoked,
malformed, or invalid. The body hash or request MAC provided
do not match the values calculated by the server, or a body
hash is required but missing.
307 (Temporary Redirect)
Same as 401, with the exception that a human intervention at
the destination URI (identified by the "Location" response
header field) MAY resolve the issue (e.g. provide a login page
which upon a successful authentication will issue the user-
agent a new set of MAC credentials using the "Set-Cookie"
response header field as described in Section 6.
4.1. The "WWW-Authenticate" Response Header Field The timestamp, nonce, and MAC key identifier combination provide a
unique identifier which enables the server to prevent replay attacks.
Without replay protection, an attacker can use a compromised (but
otherwise valid and authenticated) request more than once, gaining
long term access to a protected resource.
Including a timestamp with the nonce removes the need to retain an
infinite number of nonce values for future checks, by enabling the
server to restrict the time period after which a request with an old
timestamp is rejected. If such a restriction is enforced, the server
MUST:
o At the time the first request is received from the client for each
MAC key identifier, calculate the difference (in seconds) between
the request timestamp and the server's clock. The difference -
the request time delta - MUST be kept as long as the MAC key
credentials are valid.
o For each subsequent client request, apply the request time delta
to request timestamp to calculate the adjusted request time - the
time when the request MAC has been generated by the client,
adjusted to the server's clock.
o Verify that the adjusted request time is within the allowed time
period defined by the server. The server SHOULD allow for a
sufficiently large window to accommodate network delays (between
the time the request has been generated by the client to the time
it is received by the server and processed).
4.2. The "WWW-Authenticate" Response Header Field
If the protected resource request does not include authentication If the protected resource request does not include authentication
credentials, contains an invalid MAC key identifier, or is malformed, credentials, contains an invalid MAC key identifier, or is malformed,
the server SHOULD include the HTTP "WWW-Authenticate" response header the server SHOULD include the HTTP "WWW-Authenticate" response header
field. field.
For example: For example:
HTTP/1.1 401 Unauthorized HTTP/1.1 401 Unauthorized
WWW-Authenticate: MAC WWW-Authenticate: MAC
The "WWW-Authenticate" request header field uses the framework The "WWW-Authenticate" request header field uses the framework
defined by [RFC2617] as follows: defined by [RFC2617] as follows:
challenge = "MAC" [ RWS 1#param ] challenge = "MAC" [ 1*SP #param ]
param = error / auth-param param = error / auth-param
error = "error" "=" quoted-string error = "error" "=" ( token / quoted-string)
Each attribute MUST NOT appear more than once. Each attribute MUST NOT appear more than once.
If the protected resource request included a MAC "Authorization" If the protected resource request included a MAC "Authorization"
request header field and failed authentication, the server MAY request header field and failed authentication, the server MAY
include the "error" attribute to provide the client with a human- include the "error" attribute to provide the client with a human-
readable explanation why the access request was declined. readable explanation why the access request was declined to assist
the client developer in identifying the problem.
For example: For example:
HTTP/1.1 401 Unauthorized HTTP/1.1 401 Unauthorized
WWW-Authenticate: MAC error="The MAC credentials expired" WWW-Authenticate: MAC error="The MAC credentials expired"
5. Use with OAuth 2.0 5. Use with OAuth 2.0
OAuth 2.0 ([I-D.ietf-oauth-v2]) defines a token-based authentication OAuth 2.0 ([I-D.ietf-oauth-v2]) defines an extensible token-based
framework in which third-party applications (clients) access authentication framework. The MAC authentication scheme can be used
protected resources using access tokens. Access tokens are obtained to make OAuth-based requests by issuing MAC-type access tokens.
via the resource owners' authorization from an authorization server.
This specification defines the OAuth 2.0 MAC token type, as well as
type-specific token attributes.
This specification does not define methods for the client to This specification does not define methods for the client to
specifically request a MAC-type token from the authorization server. specifically request a MAC-type token from the authorization server.
Additionally, it does not include any discovery facilities for Additionally, it does not include any discovery facilities for
identifying which HMAC algorithms are supported by a resource server, identifying which HMAC algorithms are supported by a resource server,
or how the client may go about obtaining MAC access tokens for any or how the client may go about obtaining MAC access tokens for any
given protected resource. given protected resource.
The authorization server MUST require the use of a transport-layer
security mechanism when sending requests to the token endpoint to
obtain a MAC token.
5.1. Issuing MAC-Type Access Tokens 5.1. Issuing MAC-Type Access Tokens
Authorization servers issuing MAC-type access tokens MUST include the Authorization servers issuing MAC-type access tokens MUST include the
following parameters whenever a response includes the "access_token" following parameters whenever a response includes the "access_token"
parameter: parameter:
access_token access_token
REQUIRED. The MAC key identifier. REQUIRED. The MAC key identifier.
mac_key mac_key
REQUIRED. The MAC key. REQUIRED. The MAC key.
mac_algorithm mac_algorithm
REQUIRED. The MAC algorithm used to calculate the request MAC. REQUIRED. The MAC algorithm used to calculate the request MAC.
Value MUST be one of "hmac-sha-1", "hmac-sha-256", or a Value MUST be one of "hmac-sha-1", "hmac-sha-256", or a
registered extension algorithm name as described in registered extension algorithm name as described in
Section 8.1. Section 7.1.
For example: For example:
HTTP/1.1 200 OK HTTP/1.1 200 OK
Content-Type: application/json Content-Type: application/json
Cache-Control: no-store Cache-Control: no-store
{ {
"access_token":"SlAV32hkKG", "access_token":"SlAV32hkKG",
"token_type":"mac", "token_type":"mac",
"expires_in":3600, "expires_in":3600,
"refresh_token":"8xLOxBtZp8", "refresh_token":"8xLOxBtZp8",
"mac_key":"adijq39jdlaska9asud", "mac_key":"adijq39jdlaska9asud",
"mac_algorithm":"hmac-sha-256" "mac_algorithm":"hmac-sha-256"
} }
6. Use with Set-Cookie 6. Security Considerations
The HTTP "Set-Cookie " response header field defined in [RFC6265]
enables the server to set persistent information which the client
repeats back on follow-up requests. Each cookie includes a name-
value pair which is sent back to the server, and a set of attributes
which inform the client when to include the cookie in follow-up
requests. The attributes are never sent back to the server.
This specification defines the "MAC-Key" and "MAC-Algorithm" cookie
attributes, which are used by the server, together with the cookie
name which includes the MAC key identifier, to issue the client a set
of MAC credentials.
The server MUST only include the "MAC-Key" attribute in response to
requests made using a transport-layer security mechanism such as TLS
1.2 as defined in [RFC5246]. Clients MUST discard any MAC
credentials received over an insecure channel.
For example, after a successful end-user authentication, the server
includes the following response header field (line breaks are for
display purposes only):
Set-Cookie: SID=31d4d96e407aad42; Path=/; Domain=example.com;
MAC-Key=8yfrufh348h; MAC-Algorithm=hmac-sha-1
which provides the client with the necessary MAC credentials. The
cookie name "SID" is used as the MAC key identifier together with the
other MAC-specific attributes. The user-agent uses the MAC
credentials for subsequent HTTP requests that match the scope of the
cookie, in this case for "example.com" and all subdomains.
6.1. User Agent Requirements
This section updates [RFC6265], adding the ability to issue MAC
credentials using the "Set-Cookie " response header field.
6.1.1. The Set-Cookie Header
Add the following two subsections to the end of Section 5.2 (The Set-
Cookie Header) in [RFC6265]. These sections instruct the user-agent
how to parse the "MAC-Key" attribute and "MAC-Algorithm" attribute,
respectively.
6.1.1.1. The MAC-Key attribute
If the attribute-name case-insensitively matches the string
"MAC-Key", the user-agent MUST append an attribute to the cookie-
attribute-list with an attribute name of "MAC-Key" and a attribute-
value equal to the attribute-value.
6.1.1.2. The MAC-Algorithm attribute
If the attribute-name case-insensitively matches the string
"MAC-Algorithm", and if the attribute-value is either "hmac-sha-1",
"hmac-sha-256", or a registered extension value, the user-agent MUST
append an attribute to the cookie-attribute-list with an attribute
name of "MAC-Algorithm" and an attribute-value equal to the
attribute-value.
6.1.2. Storage Model
The storage model for cookies is extended with two additional fields:
"mac-key" and "mac-algorithm", all of which default to the empty
string.
The user-agent MUST perform the follow steps after Step 10 of the
algorithm in Section 5.3 of [RFC6265]:
1. If the cookie-attribute-list contains an attribute with an
attribute-name of "MAC-Key", set the cookie's "mac-key" field to
the attribute-value of the last such attribute.
2. If the cookie-attribute-list contains an attribute with an
attribute-name of "Mac-Algorithm", set the cookie's
"mac-algorithm" field to the attribute-value of the last such
attribute.
When the user agent removes excess cookies from the cookie store
because there are more than a predetermined number of cookies that
share a domain field, or the combined length of cookies sharing a
single domain field or being sent in a single request have exceeded a
predetermined length, the user agent MUST evict cookies with an empty
mac-key or an empty mac-algorithm field before cookies with both a
non-empty mac-key and a non-empty mac-algorithm field.
6.1.3. The Authorization Header
In addition to being sent to the server in the "Cookie" request
header field, cookies with "MAC-Key" and "MAC-Algorithm" attributes
are also used to compute the "Authorization" request header field as
described in Section 3.1.
The user-agent MAY ignore cookies for the purpose of generating the
"Authorization" request header field. For example, the user-agent
might wish to ignore cookies when issuing "third-party" requests or
use MAC credentials obtained via other means.
When issuing an HTTP request, let cookie-list be the set of cookies
defined in Section 5.4 of [RFC6265]. Further, let mac-cookie-list be
those cookies in the cookie-list that contain both a non-empty
"mac-key" and "mac-algorithm" fields.
Let the operative-cookie be the first cookie in the mac-cookie-list.
Include an "Authorization" request header field in the HTTP request
as described in Section 3.1 using the cookie's MAC credentials where:
MAC key identifier
is equal to the operative-cookie's name,
MAC key
is equal to the operative-cookie's "mac-key",
MAC algorithm
is equal to the operative-cookie's "mac-algorithm", and
Issue time
is equal to the operative-cookie's "creation-time".
7. Security Considerations
As stated in [RFC2617], the greatest sources of risks are usually As stated in [RFC2617], the greatest sources of risks are usually
found not in the core protocol itself but in policies and procedures found not in the core protocol itself but in policies and procedures
surrounding its use. Implementers are strongly encouraged to assess surrounding its use. Implementers are strongly encouraged to assess
how this protocol addresses their security requirements. how this protocol addresses their security requirements.
7.1. MAC Keys Transmission 6.1. MAC Keys Transmission
This specification describes two mechanism for obtaining or This specification describes two mechanism for obtaining or
transmitting MAC keys, both require the use of a transport-layer transmitting MAC keys, both require the use of a transport-layer
security mechanism when sending MAC keys to the client. Additional security mechanism when sending MAC keys to the client. Additional
methods used to obtain MAC credentials must ensure that these methods used to obtain MAC credentials must ensure that these
transmissions are protected using transport-layer mechanisms such as transmissions are protected using transport-layer mechanisms such as
TLS or SSL. TLS or SSL.
7.2. Confidentiality of Requests 6.2. Confidentiality of Requests
While this protocol provides a mechanism for verifying the integrity While this protocol provides a mechanism for verifying the integrity
of requests, it provides no guarantee of request confidentiality. of requests, it provides no guarantee of request confidentiality.
Unless further precautions are taken, eavesdroppers will have full Unless further precautions are taken, eavesdroppers will have full
access to request content. Servers should carefully consider the access to request content. Servers should carefully consider the
kinds of data likely to be sent as part of such requests, and should kinds of data likely to be sent as part of such requests, and should
employ transport-layer security mechanisms to protect sensitive employ transport-layer security mechanisms to protect sensitive
resources. resources.
7.3. Spoofing by Counterfeit Servers 6.3. Spoofing by Counterfeit Servers
This protocol makes no attempt to verify the authenticity of the This protocol makes no attempt to verify the authenticity of the
server. A hostile party could take advantage of this by intercepting server. A hostile party could take advantage of this by intercepting
the client's requests and returning misleading or otherwise incorrect the client's requests and returning misleading or otherwise incorrect
responses. Service providers should consider such attacks when responses. Service providers should consider such attacks when
developing services using this protocol, and should require developing services using this protocol, and should require
transport-layer security for any requests where the authenticity of transport-layer security for any requests where the authenticity of
the resource server or of request responses is an issue. the resource server or of request responses is an issue.
7.4. Plaintext Storage of Credentials 6.4. Plaintext Storage of Credentials
The MAC key functions the same way passwords do in traditional The MAC key functions the same way passwords do in traditional
authentication systems. In order to compute the request MAC, the authentication systems. In order to compute the request MAC, the
server must have access to the MAC key in plaintext form. This is in server must have access to the MAC key in plaintext form. This is in
contrast, for example, to modern operating systems, which store only contrast, for example, to modern operating systems, which store only
a one-way hash of user credentials. a one-way hash of user credentials.
If an attacker were to gain access to these MAC keys - or worse, to If an attacker were to gain access to these MAC keys - or worse, to
the server's database of all such MAC keys - he or she would be able the server's database of all such MAC keys - he or she would be able
to perform any action on behalf of any resource owner. Accordingly, to perform any action on behalf of any resource owner. Accordingly,
it is critical that servers protect these MAC keys from unauthorized it is critical that servers protect these MAC keys from unauthorized
access. access.
7.5. Entropy of MAC Keys 6.5. Entropy of MAC Keys
Unless a transport-layer security protocol is used, eavesdroppers Unless a transport-layer security protocol is used, eavesdroppers
will have full access to authenticated requests and request MAC will have full access to authenticated requests and request MAC
values, and will thus be able to mount offline brute-force attacks to values, and will thus be able to mount offline brute-force attacks to
recover the MAC key used. Servers should be careful to assign MAC recover the MAC key used. Servers should be careful to assign MAC
keys which are long enough, and random enough, to resist such attacks keys which are long enough, and random enough, to resist such attacks
for at least the length of time that the MAC credentials are valid. for at least the length of time that the MAC credentials are valid.
For example, if the MAC credentials are valid for two weeks, servers For example, if the MAC credentials are valid for two weeks, servers
should ensure that it is not possible to mount a brute force attack should ensure that it is not possible to mount a brute force attack
skipping to change at page 20, line 6 skipping to change at page 14, line 29
reasonable. reasonable.
It is equally important that the pseudo-random number generator It is equally important that the pseudo-random number generator
(PRNG) used to generate these MAC keys be of sufficiently high (PRNG) used to generate these MAC keys be of sufficiently high
quality. Many PRNG implementations generate number sequences that quality. Many PRNG implementations generate number sequences that
may appear to be random, but which nevertheless exhibit patterns or may appear to be random, but which nevertheless exhibit patterns or
other weaknesses which make cryptanalysis or brute force attacks other weaknesses which make cryptanalysis or brute force attacks
easier. Implementers should be careful to use cryptographically easier. Implementers should be careful to use cryptographically
secure PRNGs to avoid these problems. secure PRNGs to avoid these problems.
7.6. Denial of Service / Resource Exhaustion Attacks 6.6. Denial of Service / Resource Exhaustion Attacks
This specification includes a number of features which may make This specification includes a number of features which may make
resource exhaustion attacks against servers possible. For example, resource exhaustion attacks against servers possible. For example,
this protocol requires servers to track used nonces. If an attacker this protocol requires servers to track used nonces. If an attacker
is able to use many nonces quickly, the resources required to track is able to use many nonces quickly, the resources required to track
them may exhaust available capacity. And again, this protocol can them may exhaust available capacity. And again, this protocol can
require servers to perform potentially expensive computations in require servers to perform potentially expensive computations in
order to verify the request MAC on incoming requests. An attacker order to verify the request MAC on incoming requests. An attacker
may exploit this to perform a denial of service attack by sending a may exploit this to perform a denial of service attack by sending a
large number of invalid requests to the server. large number of invalid requests to the server.
skipping to change at page 20, line 28 skipping to change at page 15, line 5
Resource Exhaustion attacks are by no means specific to this Resource Exhaustion attacks are by no means specific to this
specification. However, implementers should be careful to consider specification. However, implementers should be careful to consider
the additional avenues of attack that this protocol exposes, and the additional avenues of attack that this protocol exposes, and
design their implementations accordingly. For example, entropy design their implementations accordingly. For example, entropy
starvation typically results in either a complete denial of service starvation typically results in either a complete denial of service
while the system waits for new entropy or else in weak (easily while the system waits for new entropy or else in weak (easily
guessable) MAC keys. When implementing this protocol, servers should guessable) MAC keys. When implementing this protocol, servers should
consider which of these presents a more serious risk for their consider which of these presents a more serious risk for their
application and design accordingly. application and design accordingly.
7.7. Timing Attacks 6.7. Timing Attacks
This specification makes use of HMACs, for which a signature This specification makes use of HMACs, for which a signature
verification involves comparing the received MAC string to the verification involves comparing the received MAC string to the
expected one. If the string comparison operator operates in expected one. If the string comparison operator operates in
observably different times depending on inputs, e.g. because it observably different times depending on inputs, e.g. because it
compares the strings character by character and returns a negative compares the strings character by character and returns a negative
result as soon as two characters fail to match, then it may be result as soon as two characters fail to match, then it may be
possible to use this timing information to determine the expected possible to use this timing information to determine the expected
MAC, character by character. MAC, character by character.
Service implementers are encouraged to use fixed-time string Service implementers are encouraged to use fixed-time string
comparators for MAC verification. comparators for MAC verification.
7.8. CSRF Attacks 6.8. CSRF Attacks
A Cross-Site Request Forgery attack occurs when a site, evil.com, A Cross-Site Request Forgery attack occurs when a site, evil.com,
initiates within the victim's browser the loading of a URL from or initiates within the victim's browser the loading of a URL from or
the posting of a form to a web site where a side-effect will occur, the posting of a form to a web site where a side-effect will occur,
e.g. transfer of money, change of status message, etc. To prevent e.g. transfer of money, change of status message, etc. To prevent
this kind of attack, web sites may use various techniques to this kind of attack, web sites may use various techniques to
determine that the originator of the request is indeed the site determine that the originator of the request is indeed the site
itself, rather than a third party. The classic approach is to itself, rather than a third party. The classic approach is to
include, in the set of URL parameters or form content, a nonce include, in the set of URL parameters or form content, a nonce
generated by the server and tied to the user's session, which generated by the server and tied to the user's session, which
skipping to change at page 21, line 20 skipping to change at page 15, line 45
Origin header as a defense against CSRF. Origin header as a defense against CSRF.
To keep this specification simple, HTTP headers are not part of the To keep this specification simple, HTTP headers are not part of the
string to be MAC'ed. As a result, MAC authentication cannot defend string to be MAC'ed. As a result, MAC authentication cannot defend
against header spoofing, and a web site that uses the Host header to against header spoofing, and a web site that uses the Host header to
defend against CSRF attacks cannot use MAC authentication to defend defend against CSRF attacks cannot use MAC authentication to defend
against active network attackers. Sites that want the full against active network attackers. Sites that want the full
protection of MAC Authentication should use traditional, cookie-tied protection of MAC Authentication should use traditional, cookie-tied
CSRF defenses. CSRF defenses.
7.9. Coverage Limitations 6.9. Coverage Limitations
The normalized request string has been designed to support the The normalized request string has been designed to support the
authentication methods defined in this specification. Those authentication methods defined in this specification. Those
designing additional methods, should evaluated the compatibility of designing additional methods, should evaluated the compatibility of
the normalized request string with their security requirements. the normalized request string with their security requirements.
Since the normalized request string does not cover the entire HTTP Since the normalized request string does not cover the entire HTTP
request, servers should employ additional mechanisms to protect such request, servers should employ additional mechanisms to protect such
elements. elements.
The request MAC does not cover entity-header fields which can often The request MAC does not cover entity-header fields which can often
affect how the request body is interpreted by the server (i.e. affect how the request body is interpreted by the server (i.e.
Content-Type). If the server behavior is influenced by the presence Content-Type). If the server behavior is influenced by the presence
or value of such header fields, an attacker can manipulate the or value of such header fields, an attacker can manipulate the
request header without being detected. This will alter the request request header without being detected.
even when using the body hash attribute.
7.10. Version Rollback Attack
[[ TODO ]]
8. IANA Considerations 7. IANA Considerations
8.1. The HTTP MAC Authentication Scheme Algorithm Registry 7.1. The HTTP MAC Authentication Scheme Algorithm Registry
This specification establishes the HTTP MAC authentication scheme This specification establishes the HTTP MAC authentication scheme
algorithm registry. algorithm registry.
Additional MAC algorithms are registered on the advice of one or more Additional MAC algorithms are registered on the advice of one or more
Designated Experts (appointed by the IESG or their delegate), with a Designated Experts (appointed by the IESG or their delegate), with a
Specification Required (using terminology from [RFC5226]). However, Specification Required (using terminology from [RFC5226]). However,
to allow for the allocation of values prior to publication, the to allow for the allocation of values prior to publication, the
Designated Expert(s) may approve registration once they are satisfied Designated Expert(s) may approve registration once they are satisfied
that such a specification will be published. that such a specification will be published.
skipping to change at page 22, line 31 skipping to change at page 17, line 5
first appealed to Application Area Directors (contactable using first appealed to Application Area Directors (contactable using
app-ads@tools.ietf.org email address or directly by looking up their app-ads@tools.ietf.org email address or directly by looking up their
email addresses on http://www.iesg.org/ website) and, if the email addresses on http://www.iesg.org/ website) and, if the
appellant is not satisfied with the response, to the full IESG (using appellant is not satisfied with the response, to the full IESG (using
the iesg@iesg.org mailing list). the iesg@iesg.org mailing list).
IANA should only accept registry updates from the Designated IANA should only accept registry updates from the Designated
Expert(s), and should direct all requests for registration to the Expert(s), and should direct all requests for registration to the
review mailing list. review mailing list.
8.1.1. Registration Template 7.1.1. Registration Template
Algorithm name: Algorithm name:
The name requested (e.g., "example"). The name requested (e.g., "example").
Body hash algorithm:
The corresponding algorithm used to calculate the payload body
hash.
Change controller: Change controller:
For standards-track RFCs, state "IETF". For others, give the name For standards-track RFCs, state "IETF". For others, give the name
of the responsible party. Other details (e.g., postal address, of the responsible party. Other details (e.g., postal address,
e-mail address, home page URI) may also be included. e-mail address, home page URI) may also be included.
Specification document(s): Specification document(s):
Reference to document that specifies the algorithm, preferably Reference to document that specifies the algorithm, preferably
including a URI that can be used to retrieve a copy of the including a URI that can be used to retrieve a copy of the
document. An indication of the relevant sections may also be document. An indication of the relevant sections may also be
included, but is not required. included, but is not required.
8.1.2. Initial Registry Contents 7.1.2. Initial Registry Contents
The HTTP MAC authentication scheme algorithm registry's initial The HTTP MAC authentication scheme algorithm registry's initial
contents are: contents are:
o Algorithm name: hmac-sha-1 o Algorithm name: hmac-sha-1
o Body hash algorithm: sha-1
o Change controller: IETF o Change controller: IETF
o Specification document(s): [[ this document ]] o Specification document(s): [[ this document ]]
o Algorithm name: hmac-sha-256 o Algorithm name: hmac-sha-256
o Body hash algorithm: sha-256
o Change controller: IETF o Change controller: IETF
o Specification document(s): [[ this document ]] o Specification document(s): [[ this document ]]
8.2. OAuth Access Token Type Registration 7.2. OAuth Access Token Type Registration
This specification registers the following access token type in the This specification registers the following access token type in the
OAuth Access Token Type Registry. OAuth Access Token Type Registry.
8.2.1. The "mac" OAuth Access Token Type 7.2.1. The "mac" OAuth Access Token Type
Type name: Type name:
mac mac
Additional Token Endpoint Response Parameters: Additional Token Endpoint Response Parameters:
secret, algorithm secret, algorithm
HTTP Authentication Scheme(s): HTTP Authentication Scheme(s):
MAC MAC
Change controller: Change controller:
IETF IETF
Specification document(s): Specification document(s):
[[ this document ]] [[ this document ]]
8.3. OAuth Parameters Registration 7.3. OAuth Parameters Registration
This specification registers the following parameters in the OAuth This specification registers the following parameters in the OAuth
Parameters Registry established by [I-D.ietf-oauth-v2]. Parameters Registry established by [I-D.ietf-oauth-v2].
8.3.1. The "mac_key" OAuth Parameter 7.3.1. The "mac_key" OAuth Parameter
Parameter name: mac_key Parameter name: mac_key
Parameter usage location: authorization response, token response Parameter usage location: authorization response, token response
Change controller: IETF Change controller: IETF
Specification document(s): [[ this document ]] Specification document(s): [[ this document ]]
Related information: None Related information: None
8.3.2. The "mac_algorithm" OAuth Parameter 7.3.2. The "mac_algorithm" OAuth Parameter
Parameter name: mac_algorithm Parameter name: mac_algorithm
Parameter usage location: authorization response, token response Parameter usage location: authorization response, token response
Change controller: IETF Change controller: IETF
Specification document(s): [[ this document ]] Specification document(s): [[ this document ]]
Related information: None Related information: None
9. Acknowledgments 8. Acknowledgments
The authors would like to thank Rasmus Lerdorf, James Manger, Scott
Renfro, Toby White, Peter Wolanin, and Skylar Woodward for their
suggestions and feedback.
Appendix A. Document History
[[ To be removed by the RFC editor before publication as an RFC. ]]
-00
o Initial working group document based on The author would like to thank Ben Adida, Adam Barth, Phil Hunt,
draft-hammer-oauth-v2-mac-token-05. Rasmus Lerdorf, James Manger, William Mills, Scott Renfro, Justin
Richer, Toby White, Peter Wolanin, and Skylar Woodward for their
contributions, suggestions, and feedback.
10. References 9. References
10.1. Normative References 9.1. Normative References
[I-D.ietf-httpbis-p1-messaging] [I-D.ietf-httpbis-p1-messaging]
Fielding, R., Gettys, J., Mogul, J., Nielsen, H., Fielding, R., Gettys, J., Mogul, J., Nielsen, H.,
Masinter, L., Leach, P., Berners-Lee, T., and J. Reschke, Masinter, L., Leach, P., Berners-Lee, T., and J. Reschke,
"HTTP/1.1, part 1: URIs, Connections, and Message "HTTP/1.1, part 1: URIs, Connections, and Message
Parsing", draft-ietf-httpbis-p1-messaging-13 (work in Parsing", draft-ietf-httpbis-p1-messaging-13 (work in
progress), March 2011. progress), March 2011.
[I-D.ietf-oauth-v2] [I-D.ietf-oauth-v2]
Hammer-Lahav, E., Recordon, D., and D. Hardt, "The OAuth Hammer-Lahav, E., Recordon, D., and D. Hardt, "The OAuth
skipping to change at page 25, line 39 skipping to change at page 19, line 46
[RFC6265] Barth, A., "HTTP State Management Mechanism", RFC 6265, [RFC6265] Barth, A., "HTTP State Management Mechanism", RFC 6265,
April 2011. April 2011.
[W3C.REC-html401-19991224] [W3C.REC-html401-19991224]
Hors, A., Raggett, D., and I. Jacobs, "HTML 4.01 Hors, A., Raggett, D., and I. Jacobs, "HTML 4.01
Specification", World Wide Web Consortium Specification", World Wide Web Consortium
Recommendation REC-html401-19991224, December 1999, Recommendation REC-html401-19991224, December 1999,
<http://www.w3.org/TR/1999/REC-html401-19991224>. <http://www.w3.org/TR/1999/REC-html401-19991224>.
10.2. Informative References 9.2. Informative References
[RFC5849] Hammer-Lahav, E., "The OAuth 1.0 Protocol", RFC 5849, [RFC5849] Hammer-Lahav, E., "The OAuth 1.0 Protocol", RFC 5849,
April 2010. April 2010.
Authors' Addresses Author's Address
Eran Hammer-Lahav (editor) Eran Hammer-Lahav (editor)
Yahoo!
Email: eran@hueniverse.com Email: eran@hueniverse.com
URI: http://hueniverse.com URI: http://hueniverse.com
Adam Barth
Google
Email: ietf@adambarth.com
URI: http://www.adambarth.com
Ben Adida
Mozilla
Email: ben@adida.net
URI: http://ben.adida.net
 End of changes. 87 change blocks. 
446 lines changed or deleted 200 lines changed or added

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