Open Authentication Protocol | T. Lodderstedt, Ed. |
Internet-Draft | Deutsche Telekom AG |
Intended status: Experimental Protocol | M. McGloin |
Expires: October 02, 2011 | IBM |
P. Hunt | |
Oracle Corporation | |
A. Nadalin | |
Microsoft Corporation | |
March 31, 2011 |
OAuth 2.0 Security Considerations
draft-lodderstedt-oauth-securityconsiderations-00
This document gives security considerations for the OAuth 2.0 protocol. The proposed text is intended to be included into [I-D.ietf-oauth-v2].
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 RFC 2119 [RFC2119].
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 October 02, 2011.
Copyright (c) 2011 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.
This document considers the following clients categories:
Note: This section focuses on the security principles implementors of the protocol MUST consider. These principles have been derived based on the comprehensive security analysis of the OAuth 2.0 protocol given in [I-D.lodderstedt-oauth-security].
Authorization servers can issue client secrets to web applications. Application developers MUST ensure confidentiality of client secrets.
Authorization server MUST NOT issue client secrets to native or JavaScript applications. Instead authorization servers shall utilize other means than client authentication to achieve their security objectives. Authorization servers can issue client secrets to native applications on a per installation base.
Authorization servers MUST NOT automatic repeat approvals for clients without secrets.
Authorization servers may issue refresh tokens to web and native applications.
Refresh tokens should only be accessible to the authorization server and the client the token has been issued to. The authorization server MUST maintain the link between a refresh token and the client it has been issued to. This relation MUST be validated on every token refreshment request.
Authorization server as well as application developers MUST ensure confidentiality of refresh tokens, on transit and storage. Authorization servers should implement means to detect abuse of refresh tokens.
(what about revocation?)
Access tokens should only be accessible to the authorization server, the target resource servers and the client the token has been issued to. The only exception is the implicit grant where the user agent gets access to the access token that is transmitted in the URI fragment.
Application developers MUST NOT store access tokens in non-transient memory.
Application developers should only acquire access tokens with the minimal scope they need in order to implement the respective application function.
Application developers should, when possible, use external browsers instead of browsers embedded in the application for performing the end-user authorization process.
Authorization servers MUST ensure authenticity of the endpoint in order to prevent phishing attacks. For example, they can utilize HTTPS server authentication for that purpose. Moreover, service Providers should attempt to educate users about the risks phishing attacks pose, and should provide mechanisms that make it easy for Users to confirm the authenticity of their sites. e.g. extended validation certificates.
The following data MUST be transmitted over secure transport (such as TLS) only: access tokens, refresh tokens, resource owner passwords, authorization codes, and client secrets.
Authorization servers MUST prevent guessing attacks on the following credentials: authorization codes, refresh tokens, resource owner passwords, and client secrets.
When creating token handles or other secrets not intended for usage by human users, the authorization server MUST include a reasonable level of entropy in order to mitigate the risk of guessing attacks.
Confidentiality of authorization codes MUST be ensured on transport, even considering browser histories and HTTP referer headers.
Authorization server as well as the client MUST ensure that authorization code transmission is protected by using transport-layer mechanisms such as TLS and that the duration of an authorization code is limited.
For web applications, authorization servers MUST authenticate the client and validate that the authorization code had been issued to the same client.
For native applications, authorization servers MUST enforce one time usage of the authorization code. Moreover, if an Authorization Server observes multiple attempts to redeem an authorization code, the Authorization Server MAY want to revoke all tokens granted based on the authorization code.
The session fixation attack leverages the authorization code flow in an attempt to get another user to log-in and authorize access on behalf of the attacker. The victim, seeing only a normal request from an expected application, approves the request. The attacker then uses the victim's authorization to gain access to the information unknowingly authorized by the victim.
In order to prevent such an attack, authorization servers MUST ensure that the redirect_uri used in the authorization flow is the same as the redirect_uri used to exchange the respective authorization code into tokens. Authorization servers SHOULD require clients to pre-register their redirect_uri's and validate the actual redirect_uri against the pre-registered value.
A malicious client could impersonate a valid client and obtain an access authorization that way.
Assumption: It is not the task of the authorization server to protect the end-user's device from malicious software. This is the responsibility of the platform running on the particular device probably in cooperation with other components of the respective ecosystem (e.g. an application management infrastructure). The sole responsibility of the authorization server is to control access to the end-user's resources living in resource servers and to prevent unauthorized access to them. Based on this assumption, the following countermeasures are recommended.
If the impersonated client is a web application, the authorization server MUST authentication the client. The authorization server SHOULD require clients to pre-register their redirect_uri's and validate the actual redirect_uri against the pre-registered value.
If the impersonated client is an native or JavaScript application, the authorization server MUST utilize other means to achieve its security objectives. The authorization server may enforce explicit user authentication or ask the end-user for consent. In this context, the user shall be explained the purpose, scope, and duration of the authorization. The authorization server must make the metat-data available to the end-user it associates with the particular client. It is up to the user to validate the binding of this data to the particular application (e.g. Name) and to approve the authorization request.
The authorization server MAY also limit the scope of tokens.
The “Resource Owner Password Credentials” grant type is often used for legacy/migration reasons. It has higher risk because it maintains the uid/password anti-pattern and the client could abuse the user id and password. Additionally, because the user does not have control over the authorization process, clients using this grant type are not limited by scope, but instead have potentially the same capabilities as the user themselves. The client could also acquire long-living tokens and pass them up to a attacker web service for further abuse.
Authorization servers and application developers SHOULD minimize use of this grant types. Other flows which facilitate user control and transparency should be used instead.
The authorization server SHOULD generally restrict the scope of access tokens issued by this flow.
The authorization server MUST ensure the resource owners control and transparency with respect to all authorizations issued to clients.
Authorization servers MUST support validation of endpoint authenticity using HTTPS server authentication.
Application developers MUST validate the authorization server endpoint's authenticity and ensure proper handling of CA certificates as well as certificate chain validation.
[RFC2119] | Bradner, S., "Key words for use in RFCs to Indicate Requirement Levels", BCP 14, RFC 2119, March 1997. |
[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-22, September 2011. |
[I-D.lodderstedt-oauth-security] | Lodderstedt, T, McGloin, M and P Hunt, "OAuth 2.0 Threat Model and Security Considerations", Internet-Draft draft-lodderstedt-oauth-security-01, March 2011. |