draft-ietf-oauth-security-topics-00.txt   draft-ietf-oauth-security-topics-01.txt 
Open Authentication Protocol T. Lodderstedt, Ed. Open Authentication Protocol T. Lodderstedt, Ed.
Internet-Draft YES Europe AG Internet-Draft YES Europe AG
Intended status: Best Current Practice J. Bradley Intended status: Best Current Practice J. Bradley
Expires: September 11, 2017 Ping Identity Expires: September 26, 2017 Ping Identity
A. Labunets A. Labunets
Facebook Facebook
March 12, 2017 March 27, 2017
OAuth Security Topics OAuth Security Topics
draft-ietf-oauth-security-topics-00 draft-ietf-oauth-security-topics-01
Abstract Abstract
This draft gives a comprehensive overview on open OAuth security This draft gives a comprehensive overview on open OAuth security
topics. It is intended to serve as a working document for the OAuth topics. It is intended to serve as a working document for the OAuth
working group to systematically capture and discuss these security working group to systematically capture and discuss these security
topics and respective mitigations and eventually recommend best topics and respective mitigations and eventually recommend best
current practice and also OAuth extensions needed to cope with the current practice and also OAuth extensions needed to cope with the
respective security threats. respective security threats.
skipping to change at line 37 skipping to change at page 1, line 38
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 September 11, 2017. This Internet-Draft will expire on September 26, 2017.
Copyright Notice Copyright Notice
Copyright (c) 2017 IETF Trust and the persons identified as the Copyright (c) 2017 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 (http://trustee.ietf.org/ Provisions Relating to IETF Documents (http://trustee.ietf.org/
license-info) in effect on the date of publication of this document. license-info) in effect on the date of publication of this document.
Please review these documents carefully, as they describe your rights Please review these documents carefully, as they describe your rights
and restrictions with respect to this document. Code Components and restrictions with respect to this document. Code Components
extracted from this document must include Simplified BSD License text extracted from this document must include Simplified BSD License text
as described in Section 4.e of the Trust Legal Provisions and are as described in Section 4.e of the Trust Legal Provisions and are
provided without warranty as described in the Simplified BSD License. provided without warranty as described in the Simplified BSD License.
Table of Contents Table of Contents
1. Introduction 1. Introduction . . . . . . . . . . . . . . . . . . . . . . . . . 2
2. OAuth Credentials Leakage 2. OAuth Credentials Leakage . . . . . . . . . . . . . . . . . . 3
2.1. Redirect URI validation of authorization requests 2.1. Insufficient redirect URI validation . . . . . . . . . . . 3
2.1.1. Authorization Code Grant 2.1.1. Attacks on Authorization Code Grant . . . . . . . . . 3
2.1.2. Implicit Grant 2.1.2. Attacks on Implicit Grant . . . . . . . . . . . . . . 4
2.1.3. Countermeasure: exact redirect URI matching 2.1.3. Proposed Countermeasures . . . . . . . . . . . . . . . 5
2.2. Authorization code leakage via referrer headers 2.2. Authorization code leakage via referrer headers . . . . . 7
2.2.1. Countermeasures 2.2.1. Proposed Countermeasures . . . . . . . . . . . . . . . 7
2.3. Code in browser history (TBD) 2.3. Code in browser history (TBD) . . . . . . . . . . . . . . 7
2.4. Access token in browser history (TBD) 2.4. Access token in browser history (TBD) . . . . . . . . . . 7
2.5. Access token on bad resource servers (TBD) 2.5. Access token on bad resource servers (TBD) . . . . . . . . 8
2.6. Mix-Up (TBD) 2.6. Mix-Up (TBD) . . . . . . . . . . . . . . . . . . . . . . . 8
3. OAuth Credentials Injection 3. OAuth Credentials Injection . . . . . . . . . . . . . . . . . 9
3.1. Code Injection 3.1. Code Injection . . . . . . . . . . . . . . . . . . . . . . 9
3.1.1. Proposed Counter Measures 3.1.1. Proposed Countermeasures . . . . . . . . . . . . . . . 11
3.1.2. Access Token Injection (TBD) 3.1.2. Access Token Injection (TBD) . . . . . . . . . . . . . 13
3.1.3. XSRF (TBD) 3.1.3. XSRF (TBD) . . . . . . . . . . . . . . . . . . . . . . 13
4. Other Attacks 4. Other Attacks . . . . . . . . . . . . . . . . . . . . . . . . 13
5. Other Topics 5. Other Topics . . . . . . . . . . . . . . . . . . . . . . . . . 13
6. Acknowledgements 6. Acknowledgements . . . . . . . . . . . . . . . . . . . . . . . 14
7. IANA Considerations 7. IANA Considerations . . . . . . . . . . . . . . . . . . . . . 14
8. Security Considerations 8. Security Considerations . . . . . . . . . . . . . . . . . . . 14
9. References 9. References . . . . . . . . . . . . . . . . . . . . . . . . . . 14
Appendix A. Document History Appendix A. Document History . . . . . . . . . . . . . . . . . . . 14
Authors' Addresses Authors' Addresses . . . . . . . . . . . . . . . . . . . . . . . . 15
Open Authentication Protocol T. Lodderstedt, Ed.
Internet-Draft YES Europe AG
Intended status: Best Current Practice J. Bradley
Expires: September 11, 2017 Ping Identity
A. Labunets
Facebook
March 12, 2017
OAuth Security Topics
draft-ietf-oauth-security-topics-00
Abstract
This draft gives a comprehensive overview on open OAuth security
topics. It is intended to serve as a working document for the OAuth
working group to systematically capture and discuss these security
topics and respective mitigations and eventually recommend best
current practice and also OAuth extensions needed to cope with the
respective security threats.
Status of this Memo
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 September 11, 2017.
Copyright Notice
Copyright (c) 2017 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.
1. Introduction 1. Introduction
It's been a while since OAuth has been published in RFC 6749 It's been a while since OAuth has been published in RFC 6749
[RFC6749] and RFC 6750 [RFC6750]. Since publication, OAuth 2.0 has [RFC6749] and RFC 6750 [RFC6750]. Since publication, OAuth 2.0 has
gotten massive traction in the market and became the standard for API gotten massive traction in the market and became the standard for API
protection and, as foundation of OpenID Connect, identity providing. protection and, as foundation of OpenID Connect, identity providing.
While OAuth was used in a variety of scenarios and different kinds of
deployments, the following challenges could be observed:
o OAuth implementations are being attacked through known o OAuth implementations are being attacked through known
implementation weaknesses and anti-patterns (XSRF, referrer implementation weaknesses and anti-patterns (XSRF, referrer
header). Although most of these threats are discussed in RFC 6819 header). Although most of these threats are discussed in RFC 6819
[RFC6819], continued exploitation demonstrates there may be a need [RFC6819], continued exploitation demonstrates there may be a need
for more specific recommendations or that the existing mitigations for more specific recommendations or that the existing mitigations
are too difficult to deploy. are too difficult to deploy.
o Technology has changed, e.g. the way browsers treat fragments in o Technology has changed, e.g. the way browsers treat fragments in
some situations, which may change the implicit grant's underlying some situations, which may change the implicit grant's underlying
skipping to change at line 164 skipping to change at page 3, line 17
The remainder of the document is organized as follows: The next The remainder of the document is organized as follows: The next
section describes various scenarios how OAuth credentials (namely section describes various scenarios how OAuth credentials (namely
access tokens and authorization codes) may be disclosed to attackers access tokens and authorization codes) may be disclosed to attackers
and proposes countermeasures. Afterwards, the document discusses and proposes countermeasures. Afterwards, the document discusses
attacks possible with captured credential and how they may be attacks possible with captured credential and how they may be
prevented. The last sections discuss additional threats. prevented. The last sections discuss additional threats.
2. OAuth Credentials Leakage 2. OAuth Credentials Leakage
2.1. Redirect URI validation of authorization requests This section describes a couple of different ways how OAuth
credentials, namely authorization codes and access tokens, can be
exposed to attackers.
The following implementation issue has been observed: Some 2.1. Insufficient redirect URI validation
authorization servers allow clients to register redirect URI patterns
instead of complete redirect URIs. In those cases, the authorization Some authorization servers allow clients to register redirect URI
servers, at runtime, match the actual redirect URI parameter value at patterns instead of complete redirect URIs. In those cases, the
the authorization endpoint against this pattern. This approach authorization server, at runtime, matches the actual redirect URI
allows clients to encode transaction state into additional redirect parameter value at the authorization endpoint against this pattern.
URI parameters or to register just a single pattern for multiple This approach allows clients to encode transaction state into
redirect URIs. As a downside, it turned out to be more complex to additional redirect URI parameters or to register just a single
implement and error prone to manage than exact redirect URI matching. pattern for multiple redirect URIs. As a downside, it turned out to
Several successful attacks have been observed in the wild, which be more complex to implement and error prone to manage than exact
utilized flaws in the pattern matching implementation or concrete redirect URI matching. Several successful attacks have been observed
configurations. Such a flaw effectively breaks client identification in the wild, which utilized flaws in the pattern matching
or authentication (depending on grant and client type) and allows the implementation or concrete configurations. Such a flaw effectively
attacker to obtain an authorization code or access token, either breaks client identification or authentication (depending on grant
and client type) and allows the attacker to obtain an authorization
code or access token, either
o by directly sending the user agent to a URI under the attackers o by directly sending the user agent to a URI under the attackers
control or control or
o usually via the client as open redirector in conjunction with o by exposing the OAuth credentials to an attacker by utilizing an
fragment handling (implicit grant) carrying the response including open redirector at the client in conjunction with the way user
the respective OAuth credentials. agents handle URL fragments.
2.1.1. Authorization Code Grant 2.1.1. Attacks on Authorization Code Grant
For a public client using the grant type code, an attack would look For a public client using the grant type code, an attack would look
as follows: as follows:
Let's assume the pattern "https://*.example.com/*" had been Let's assume the redirect URL pattern "https://*.example.com/*" had
registered for the client "s6BhdRkqt3". This pattern allows redirect been registered for the client "s6BhdRkqt3". This pattern allows
URI from any host residing in the domain example.com. So if an redirect URIs from any host residing in the domain example.com. So
attacker manager to establish a host or subdomain in "example.com" he if an attacker manager to establish a host or subdomain in
can impersonate the legitimate client. Assume the attacker sets up "example.com" he can impersonate the legitimate client. Assume the
the host "evil.example.com". attacker sets up the host "evil.example.com".
(6 )The attacker needs to trick the user into opening a tampered URL (1 )The attacker needs to trick the user into opening a tampered URL
in his browser, which launches a page under the attacker's in his browser, which launches a page under the attacker's
control, say "https://www.evil.com". control, say "https://www.evil.com".
(7 )This URL initiates an authorization request with the client id of (2 )This URL initiates an authorization request with the client id of
a legitimate client to the authorization endpoint. This is the a legitimate client to the authorization endpoint. This is the
example authorization request (line breaks are for display example authorization request (line breaks are for display
purposes only): purposes only):
GET /authorize?response_type=code&client_id=s6BhdRkqt3&state=xyz GET /authorize?response_type=code&client_id=s6BhdRkqt3&state=xyz
&redirect_uri=https%3A%2F%2Fevil.client.example.com%2Fcb HTTP/1.1 &redirect_uri=https%3A%2F%2Fevil.client.example.com%2Fcb HTTP/1.1
Host: server.example.com Host: server.example.com
(8 )The authorization validates the redirect URI in order to identify (4 )The authorization validates the redirect URI in order to identify
the client. Since the pattern allows arbitrary domains host names the client. Since the pattern allows arbitrary domains host names
in "example.com", the authorization request is processed under the in "example.com", the authorization request is processed under the
legitimate client's identity. This includes the way the request legitimate client's identity. This includes the way the request
for user consent is presented to the user. If auto-approval is for user consent is presented to the user. If auto-approval is
allowed (which is not recommended for public clients according to allowed (which is not recommended for public clients according to
RFC 6749), the attack can be performed even easier. RFC 6749), the attack can be performed even easier.
(9 )If the user does not recognize the attack, the code is issued and (5 )If the user does not recognize the attack, the code is issued and
directly sent to the attacker's client. directly sent to the attacker's client.
(10 )Since the attacker impersonated a public client, it can directly (6 )Since the attacker impersonated a public client, it can directly
exchange the code for tokens at the respective token endpoint. exchange the code for tokens at the respective token endpoint.
Note: This attack will not work for confidential clients, since the Note: This attack will not directly work for confidential clients,
code exchange requires authentication with the legitimate client's since the code exchange requires authentication with the legitimate
secret. The attacker will need to utilize the legitimate client to client's secret. The attacker will need to utilize the legitimate
redeem the code. This and other kinds of injections are covered in client to redeem the code (e.g. by mounting a code injection
Section OAuth Credentials Injection. attack). This and other kinds of injections are covered in Section
OAuth Credentials Injection.
2.1.2. Implicit Grant 2.1.2. Attacks on Implicit Grant
The attack described above for grant type authorization code works The attack described above works for the implicit grant as well. If
similarly for the implicit grant. If the attacker is able to send the attacker is able to send the authorization response to a URI
the authorization response to a URI under his control, he will under his control, he will directly get access to the fragment
directly get access to the fragment carrying the access token. carrying the access token.
Additionally, it is possible to conduct an attack utilizing the way Additionally, implicit clients can be subject to a further kind of
user agents treat fragments in case of redirects. User agents re- attacks. It utilizes the fact that user agents re-attach fragments
attach fragments to the destination URL of a redirect if the location to the destination URL of a redirect if the location header does not
header does not contain a fragment (see [RFC7231], section 9.5). In contain a fragment (see [RFC7231], section 9.5). The attack described
this attack this behavior is combined with the client as an open here combines this behavior with the client as an open redirector in
redirector in order to get access to access tokens. This allows order to get access to access tokens. This allows circumvention even
circumvention even of strict redirect URI patterns. of strict redirect URI patterns (but not strict URL matching!).
Assume the pattern for client "s6BhdRkqt3" is "https:// Assume the pattern for client "s6BhdRkqt3" is "https://
client.example.com/cb?*", i.e. any parameter is allowed for client.example.com/cb?*", i.e. any parameter is allowed for
redirects to "https://client.example.com/cb". Unfortunately, the redirects to "https://client.example.com/cb". Unfortunately, the
client exposes an open redirector. This endpoint supports a client exposes an open redirector. This endpoint supports a
parameter "redirect_to", which takes a target URL and will send the parameter "redirect_to", which takes a target URL and will send the
browser to this URL using a HTTP 302. browser to this URL using a HTTP 302.
(7 )Same as above, the attacker needs to trick the user into opening (1 )Same as above, the attacker needs to trick the user into opening
a tampered URL in his browser, which launches a page under the a tampered URL in his browser, which launches a page under the
attacker's control, say "https://www.evil.com". attacker's control, say "https://www.evil.com".
(8 )The URL initiates an authorization request, which is very similar (2 )The URL initiates an authorization request, which is very similar
to the attack on the code flow. As differences, it utilizes the to the attack on the code flow. As differences, it utilizes the
open redirector by encoding "redirect_to=https://client.evil.com" open redirector by encoding "redirect_to=https://client.evil.com"
into the redirect URI and it uses the response type "token" (line into the redirect URI and it uses the response type "token" (line
breaks are for display purposes only): breaks are for display purposes only):
GET /authorize?response_type=token&client_id=s6BhdRkqt3&state=xyz GET /authorize?response_type=token&client_id=s6BhdRkqt3&state=xyz
&redirect_uri=https%3A%2F%2Fclient.example.com%2Fcb%26redirect_to &redirect_uri=https%3A%2F%2Fclient.example.com%2Fcb%26redirect_to
%253Dhttps%253A%252F%252Fclient.evil.com%252Fcb HTTP/1.1 %253Dhttps%253A%252F%252Fclient.evil.com%252Fcb HTTP/1.1
Host: server.example.com Host: server.example.com
(9 )Since the redirect URI matches the registered pattern, the (5 )Since the redirect URI matches the registered pattern, the
authorization server allows the request and sends the resulting authorization server allows the request and sends the resulting
access token with a 302 redirect (some response parameters are access token with a 302 redirect (some response parameters are
omitted for better readability) omitted for better readability)
HTTP/1.1 302 Found HTTP/1.1 302 Found
Location: https://client.example.com/cb? Location: https://client.example.com/cb?
redirect_to%3Dhttps%3A%2F%2Fclient.evil.com%2Fcb redirect_to%3Dhttps%3A%2F%2Fclient.evil.com%2Fcb
#access_token=2YotnFZFEjr1zCsicMWpAA&... #access_token=2YotnFZFEjr1zCsicMWpAA&...
(10 )At the example.com, the request arrives at the open redirector. (6 )At the example.com, the request arrives at the open redirector.
It will read the redirect parameter and will issue a HTTP 302 to It will read the redirect parameter and will issue a HTTP 302 to
the URL "https://evil.example.com/cb". the URL "https://evil.example.com/cb".
HTTP/1.1 302 Found HTTP/1.1 302 Found
Location: https://client.evil.com/cb Location: https://client.evil.com/cb
(11 )Since the redirector at example.com does not include a fragment (7 )Since the redirector at example.com does not include a fragment
in the Location header, the user agent will re-attach the original in the Location header, the user agent will re-attach the original
fragment fragment
"#access_token=2YotnFZFEjr1zCsicMWpAA&..." to the URL and will "#access_token=2YotnFZFEjr1zCsicMWpAA&..." to the URL and will
navigate to the following URL: navigate to the following URL:
https://client.evil.com/cb#access_token=2YotnFZFEjr1zCsicMWpAA&... https://client.evil.com/cb#access_token=2YotnFZFEjr1zCsicMWpAA&...
(12 )The attacker's page at client.evil.com can access the fragment (8 )The attacker's page at client.evil.com can access the fragment
and obtain the access token. and obtain the access token.
2.1.3. Countermeasure: exact redirect URI matching 2.1.3. Proposed Countermeasures
The complexitity of implementing and managing pattern matching
Since the cause of the implementation and management issues is the correctly obviously causes security issues. This document therefore
complexity of the pattern matching, this document proposes to proposes to simplify the required logic and configuration by using
recommend general use of exact redirect URI matching instead, i.e. exact redirect URI matching only. This means the authorization
the authorization server shall compare the two URIs using simple server shall compare the two URIs using simple string comparison as
string comparison as defined in [RFC3986], Section 6.2.1.. defined in [RFC3986], Section 6.2.1..
This would cause the following impacts: This would cause the following impacts:
o This change will require all OAuth clients to maintain the o This change will require all OAuth clients to maintain the
transaction state (and XSRF tokens) in the "state" parameter. transaction state (and XSRF tokens) in the "state" parameter.
This is a normative change to RFC 6749 since section 3.1.2.2 This is a normative change to RFC 6749 since section 3.1.2.2
allows for dynamic URI query parameters in the redirect URI. In allows for dynamic URI query parameters in the redirect URI. In
order to assess the practical impact, the working group needs to order to assess the practical impact, the working group needs to
collect data whether this feature is used in deployed reality collect data whether this feature is used in deployed reality
today. today.
skipping to change at line 329 skipping to change at page 6, line 34
especially no rule for pattern matching. So one may assume all especially no rule for pattern matching. So one may assume all
clients utilizing pattern matching will do so in a deployment clients utilizing pattern matching will do so in a deployment
specific way. On the other hand, RFC 6749 already recommends specific way. On the other hand, RFC 6749 already recommends
exact matching if the full URL had been registered. exact matching if the full URL had been registered.
o Clients with multiple redirect URIs need to register all of them o Clients with multiple redirect URIs need to register all of them
explicitly. explicitly.
Note: clients with just a single redirect URI would not even need to Note: clients with just a single redirect URI would not even need to
send a redirect URI with the authorization request. Does it make send a redirect URI with the authorization request. Does it make
sense to emphasize this option? Would that further simplify use of sense to emphasize this option? Would that further simplify use of
the protocol? the protocol and foster security?
o Exact redirect matching does not work for native apps utilizing a o Exact redirect matching does not work for native apps utilizing a
local web server due to dynamic port numbers - at least wild cards local web server due to dynamic port numbers - at least wild cards
for port numbers are required. for port numbers are required.
Note: Does redirect uri validation solve any problem for native apps? Question: Does redirect uri validation solve any problem for native
Effective against impersonation when used in conjunction with claimed apps? Effective against impersonation when used in conjunction with
HTTPS redirect URIs only. claimed HTTPS redirect URIs only.
Additional recommendations: Additional recommendations:
o It is also advisable that the domains on which callbacks are o Servers on which callbacks are hosted must not expose open
hosted should not expose open redirectors (see respective redirectors (see respective section).
section).
o As a further recommendation, clients may drop fragments via o Clients may drop fragments via intermediary URLs with "fix
intermediary URL with fix fragment (e.g. https:// fragments" (e.g. https://developers.facebook.com/blog/post/552/)
developers.facebook.com/blog/post/552/) to prevent the user agent to prevent the user agent from appending any unintended fragments.
from appending any unintended fragments.
Alternatives to exact redirect URI matching: authenticate client Alternatives to exact redirect URI matching:
using digital signatures (JAR? https://tools.ietf.org/html/draft-
ietf-oauth-jwsreq-09), ... o authenticate client using digital signatures (JAR? https://
tools.ietf.org/html/draft-ietf-oauth-jwsreq-09)
2.2. Authorization code leakage via referrer headers 2.2. Authorization code leakage via referrer headers
The section above already discussed use of the referrer header for The section above already discussed use of the referrer header for
one kind of attack to obtain OAuth credentials. It is also possible one kind of attack to obtain OAuth credentials. It is also possible
authorization codes are unintentionally disclosed to attackers, if a authorization codes are unintentionally disclosed to attackers, if a
OAuth client renders a page containing links to other pages (ads, OAuth client renders a page containing links to other pages (ads,
faq, ...) as result of a successful authorization request. faq, ...) as result of a successful authorization request.
If the user clicks onto one of those links and the target is under If the user clicks onto one of those links and the target is under
the control of an attacker, it can get access to the response URL in the control of an attacker, it can get access to the response URL in
the referrer header. the referrer header.
It is also possible that an attacker injects cross-domain content It is also possible that an attacker injects cross-domain content
somehow into the page, such as <img> (f.e. if this is blog web site somehow into the page, such as <img> (f.e. if this is blog web site
etc.): the implication is obviously the same - loading this content etc.): the implication is obviously the same - loading this content
by browser results in leaking referrer with a code. by browser results in leaking referrer with a code.
2.2.1. Countermeasures 2.2.1. Proposed Countermeasures
There are some means to prevent leakage as described above: There are some means to prevent leakage as described above:
o Use of the HTML link attribute rel="noreferrer" (Chrome o Use of the HTML link attribute rel="noreferrer" (Chrome
52.0.2743.116, FF 49.0.1, Edge 38.14393.0.0, IE/Win10) 52.0.2743.116, FF 49.0.1, Edge 38.14393.0.0, IE/Win10)
o Use of the "referrer" meta link attribute (possible values e.g. o Use of the "referrer" meta link attribute (possible values e.g.
noreferrer, origin, ...) (cf. https://w3c.github.io/webappsec- noreferrer, origin, ...) (cf. https://w3c.github.io/webappsec-
referrer-policy/ - work in progress (seems Google, Chrome and Edge referrer-policy/ - work in progress (seems Google, Chrome and Edge
support it)) support it))
skipping to change at line 401 skipping to change at page 7, line 54
Note: This kind of attack is not applicable to the implicit grant Note: This kind of attack is not applicable to the implicit grant
since fragments are not be included in referrer headers (cf. https:/ since fragments are not be included in referrer headers (cf. https:/
/tools.ietf.org/html/rfc7231#section-5.5.2) /tools.ietf.org/html/rfc7231#section-5.5.2)
2.3. Code in browser history (TBD) 2.3. Code in browser history (TBD)
When browser navigates to "client.com/redirection_endpoint?code=abcd" When browser navigates to "client.com/redirection_endpoint?code=abcd"
as a result of a redirect from a provider's authorization endpoint. as a result of a redirect from a provider's authorization endpoint.
Proposal for counter-measures: code is one time use, has limited Proposed countermeasures: code is one time use, has limited duration,
duration, is bound to client id/secret (confidential clients only) is bound to client id/secret (confidential clients only)
2.4. Access token in browser history (TBD) 2.4. Access token in browser history (TBD)
When a client or just a web site which already has a token When a client or just a web site which already has a token
deliberately navigates to a page like provider.com/ deliberately navigates to a page like provider.com/
get_user_profile?access_token=abcdef.. Actually RFC6750 discourages get_user_profile?access_token=abcdef.. Actually RFC6750 discourages
this practice and asks to transfer tokens via a header, but in this practice and asks to transfer tokens via a header, but in
practice web sites often just pass access token in query practice web sites often just pass access token in query
When browser navigates to client.com/ When browser navigates to client.com/
redirection_endpoint#access_token=abcef as a result of a redirect redirection_endpoint#access_token=abcef as a result of a redirect
from a provider's authorization endpoint. from a provider's authorization endpoint.
skipping to change at line 459 skipping to change at page 9, line 4
o ... o ...
2.6. Mix-Up (TBD) 2.6. Mix-Up (TBD)
Mix-up is another kind of attack on more dynamic OAuth scenarios (or Mix-up is another kind of attack on more dynamic OAuth scenarios (or
at least scenarios where a OAuth client interacts with multiple at least scenarios where a OAuth client interacts with multiple
authorization servers). The goal of the attack is to obtain an authorization servers). The goal of the attack is to obtain an
authorization code or an access token by tricking the client into authorization code or an access token by tricking the client into
sending those credentials to the attacker (which acts as MITM between sending those credentials to the attacker (which acts as MITM between
client and authorization server) client and authorization server)
A detailed description of the attack and potential countermeasures is
A detailed description of the attack and potential counter-measures given in cf. https://tools.ietf.org/html/draft-ietf-oauth-mix-up-
is given in cf. https://tools.ietf.org/html/draft-ietf-oauth-mix-up-
mitigation-01. mitigation-01.
Potential mitigations: Potential mitigations:
o AS returns client_id and its iss in the response. Client compares o AS returns client_id and its iss in the response. Client compares
this data to AS it believed it sent the user agent to. this data to AS it believed it sent the user agent to.
o ID token (so requires OpenID Connect) carries client id and issuer o ID token (so requires OpenID Connect) carries client id and issuer
o register AS-specific redirect URIs, bind transaction to AS o register AS-specific redirect URIs, bind transaction to AS
skipping to change at line 579 skipping to change at page 11, line 24
It is also assumed that the requirements defined in [RFC6749], It is also assumed that the requirements defined in [RFC6749],
Section 4.1.3, increase client implementation complexity as clients Section 4.1.3, increase client implementation complexity as clients
need to memorize or re-construct the correct redirect URI for the need to memorize or re-construct the correct redirect URI for the
call to the tokens endpoint. call to the tokens endpoint.
The authors therefore propose to the working group to drop this The authors therefore propose to the working group to drop this
feature in favor of more effective and (hopefully) simpler approaches feature in favor of more effective and (hopefully) simpler approaches
to code injection prevention as described in the following section. to code injection prevention as described in the following section.
3.1.1. Proposed Counter Measures 3.1.1. Proposed Countermeasures
The general proposal is to bind every particular authorization code The general proposal is to bind every particular authorization code
to a certain client on a certain device (or in a certain user agent) to a certain client on a certain device (or in a certain user agent)
in the context of a certain transaction. There are multiple in the context of a certain transaction. There are multiple
technical solutions to achieve this goal: technical solutions to achieve this goal:
Nonce OpenID Connect's existing "nonce" parameter is used for this Nonce OpenID Connect's existing "nonce" parameter is used for this
purpose. The nonce value is one time use and created by the purpose. The nonce value is one time use and created by the
client. The client is supposed to bind it to the user agent client. The client is supposed to bind it to the user agent
session and sends it with the initial request to the OpenId session and sends it with the initial request to the OpenId
skipping to change at line 605 skipping to change at page 12, line 5
session and the nonce value in the ID token will not match session and the nonce value in the ID token will not match
and the attack is detected. assumption: attacker cannot get and the attack is detected. assumption: attacker cannot get
hold of the user agent state on the victims device, where he hold of the user agent state on the victims device, where he
has stolen the respective authorization code. has stolen the respective authorization code.
pro: pro:
- existing feature, used in the wild - existing feature, used in the wild
con: con:
- OAuth does not have an ID Token - would need to push that - OAuth does not have an ID Token - would need to push that
down the stack down the stack
State It has been discussed in the security workshop in December to Code-bound State It has been discussed in the security workshop in
use the OAuth state value much similar in the way as December to use the OAuth state value much similar in the way
described above. In the case of the state value, the idea is as described above. In the case of the state value, the idea
to add a further parameter state to the code exchange is to add a further parameter state to the code exchange
request. The authorization server then compares the state request. The authorization server then compares the state
value it associated with the code and the state value in the value it associated with the code and the state value in the
parameter. If those values do not match, it is considered an parameter. If those values do not match, it is considered an
attack and the request fails. Note: a variant of this attack and the request fails. Note: a variant of this
solution would be send a hash of the state (in order to solution would be send a hash of the state (in order to
prevent bulky requests and DoS). prevent bulky requests and DoS).
pro: pro:
- use existing concept - use existing concept
con: con:
- state needs to fulfil certain requirements (one time use, - state needs to fulfil certain requirements (one time use,
skipping to change at line 647 skipping to change at page 12, line 47
an option (https://tools.ietf.org/html/draft-campbell-oauth- an option (https://tools.ietf.org/html/draft-campbell-oauth-
tbpkce). tbpkce).
pro: pro:
- highly secure - highly secure
con: con:
- highly sophisticated, requires browser support, will it - highly sophisticated, requires browser support, will it
work for native apps? work for native apps?
per instance client id/secret ... per instance client id/secret ...
Note on pre-warmed secrets: An attacker can circumvent the counter- Note on pre-warmed secrets: An attacker can circumvent the
measures described above if he is able to create the respective countermeasures described above if he is able to create the
secret on a device under his control, which is then used in the respective secret on a device under his control, which is then used
victim's authorization request. in the victim's authorization request.
Exact redirect URI matching of authorization requests can prevent the Exact redirect URI matching of authorization requests can prevent the
attacker from using the pre-warmed secret in the faked authorization attacker from using the pre-warmed secret in the faked authorization
transaction on the victim's device. transaction on the victim's device.
Unfortunately it does not work for all kinds of OAuth clients. It is Unfortunately it does not work for all kinds of OAuth clients. It is
effective for web and JS apps, for native apps with claimed URLs. effective for web and JS apps, for native apps with claimed URLs.
What about other native apps? Treat nonce or PKCE challenge as What about other native apps? Treat nonce or PKCE challenge as
replay detection tokens (needs to ensure cluster-wide one-time use)? replay detection tokens (needs to ensure cluster-wide one-time use)?
3.1.2. Access Token Injection (TBD) 3.1.2. Access Token Injection (TBD)
skipping to change at line 714 skipping to change at page 14, line 7
differentiate native, JS and web clients differentiate native, JS and web clients
federated login to apps (code flow to own AS in browser and federated federated login to apps (code flow to own AS in browser and federated
login to 3rd party IDP in browser) login to 3rd party IDP in browser)
do not put sensitive data in URL/GET parameters (Jim Manico) do not put sensitive data in URL/GET parameters (Jim Manico)
6. Acknowledgements 6. Acknowledgements
We would like to thank Jim Manico for his valuable feedback. We would like to thank Jim Manico and Phil Hunt for their valuable
feedback.
7. IANA Considerations 7. IANA Considerations
This draft includes no request to IANA. This draft includes no request to IANA.
8. Security Considerations 8. Security Considerations
All relevant security considerations have been given in the All relevant security considerations have been given in the
functional specification. functional specification.
skipping to change at line 761 skipping to change at page 14, line 55
Appendix A. Document History Appendix A. Document History
[[ To be removed from the final specification ]] [[ To be removed from the final specification ]]
-01 -01
o Added references to mitigation methods for token leakage o Added references to mitigation methods for token leakage
o Added reference to Token Binding for Authorization Code o Added reference to Token Binding for Authorization Code
o incorporated feedback of Phil Hunt
o fixed numbering issue in attack descriptions in section 2
-00 (WG document) -00 (WG document)
o turned the ID into a WG document and a BCP o turned the ID into a WG document and a BCP
o Added federated app login as topic in Other Topics o Added federated app login as topic in Other Topics
Authors' Addresses Authors' Addresses
Torsten Lodderstedt, editor Torsten Lodderstedt, editor
YES Europe AG YES Europe AG
 End of changes. 41 change blocks. 
171 lines changed or deleted 128 lines changed or added

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