draft-ietf-websec-x-frame-options-12.txt   rfc7034.txt 
WEBSEC D. Ross Internet Engineering Task Force (IETF) D. Ross
Internet-Draft Microsoft Request for Comments: 7034 Microsoft
Intended status: Informational T. Gondrom Category: Informational T. Gondrom
Expires: February 28, 2014 Thames Stanley ISSN: 2070-1721 Thames Stanley
August 27, 2013 October 2013
HTTP Header Field X-Frame-Options HTTP Header Field X-Frame-Options
draft-ietf-websec-x-frame-options-12
Abstract Abstract
To improve the protection of web applications against Clickjacking, To improve the protection of web applications against clickjacking,
this definition describes the X-Frame-Options HTTP response header this document describes the X-Frame-Options HTTP header field, which
field that declares a policy communicated from the server to the declares a policy, communicated from the server to the client
client browser on whether the browser may display the transmitted browser, regarding whether the browser may display the transmitted
content in frames that are part of other web pages. This content in frames that are part of other web pages.
informational document serves to document the existing use and
specification of this X-Frame-Options HTTP response header field.
Status of This Memo Status of This Memo
This Internet-Draft is submitted in full conformance with the This document is not an Internet Standards Track specification; it is
provisions of BCP 78 and BCP 79. published for informational purposes.
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 This document is a product of the Internet Engineering Task Force
and may be updated, replaced, or obsoleted by other documents at any (IETF). It represents the consensus of the IETF community. It has
time. It is inappropriate to use Internet-Drafts as reference received public review and has been approved for publication by the
material or to cite them other than as "work in progress." Internet Engineering Steering Group (IESG). Not all documents
approved by the IESG are a candidate for any level of Internet
Standard; see Section 2 of RFC 5741.
This Internet-Draft will expire on February 28, 2014. Information about the current status of this document, any errata,
and how to provide feedback on it may be obtained at
http://www.rfc-editor.org/info/rfc7034.
Copyright Notice Copyright Notice
Copyright (c) 2013 IETF Trust and the persons identified as the Copyright (c) 2013 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 . . . . . . . . . . . . . . . . . . . . . . . . 2 1. Introduction . . . . . . . . . . . . . . . . . . . . . . . . . 3
1.1. Requirements Language . . . . . . . . . . . . . . . . . . 3 1.1. Requirements Language . . . . . . . . . . . . . . . . . . 3
2. X-Frame-Options Header . . . . . . . . . . . . . . . . . . . 3 2. X-Frame-Options Header . . . . . . . . . . . . . . . . . . . . 4
2.1. Syntax . . . . . . . . . . . . . . . . . . . . . . . . . 3 2.1. Syntax . . . . . . . . . . . . . . . . . . . . . . . . . . 4
2.2. Augmented Backus-Naur Form (ABNF) . . . . . . . . . . . 5 2.2. Augmented Backus-Naur Form (ABNF) . . . . . . . . . . . . 5
2.2.1. Examples of X-Frame-Options . . . . . . . . . . . . . 5 2.2.1. Examples of X-Frame-Options . . . . . . . . . . . . . 6
2.3. Design Issues . . . . . . . . . . . . . . . . . . . . . . 5 2.3. Design Issues . . . . . . . . . . . . . . . . . . . . . . 6
2.3.1. Enable HTML content from other domains . . . . . . . 6 2.3.1. Enable HTML Content from Other Domains . . . . . . . . 6
2.3.2. Browser Behaviour and Processing . . . . . . . . . . 6 2.3.2. Browser Behavior and Processing . . . . . . . . . . . 6
2.3.2.1. Violation of X-Frame-Options . . . . . . . . . . 6 2.3.2.1. Violation of X-Frame-Options . . . . . . . . . . . 6
2.3.2.2. Variation in current browser behaviour . . . . . 6 2.3.2.2. Variation in Current Browser Behavior . . . . . . 7
2.3.2.3. Usage design pattern and example scenario for the 2.3.2.3. Usage Design Pattern and Example Scenario for
ALLOW-FROM parameter . . . . . . . . . . . . . . 8 the ALLOW-FROM Parameter . . . . . . . . . . . . . 8
2.3.2.4. No caching of the X-Frame-Options header . . . . 8 2.3.2.4. No Caching of the X-Frame-Options Header . . . . . 8
3. Acknowledgements . . . . . . . . . . . . . . . . . . . . . . 9 3. IANA Considerations . . . . . . . . . . . . . . . . . . . . . 9
4. IANA Considerations . . . . . . . . . . . . . . . . . . . . . 9 3.1. Registration Template . . . . . . . . . . . . . . . . . . 9
4.1. Registration Template . . . . . . . . . . . . . . . . . . 9 4. Security Considerations . . . . . . . . . . . . . . . . . . . 9
5. Security Considerations . . . . . . . . . . . . . . . . . . . 9 4.1. Privacy Considerations . . . . . . . . . . . . . . . . . . 10
5.1. Privacy Considerations . . . . . . . . . . . . . . . . . 10 5. References . . . . . . . . . . . . . . . . . . . . . . . . . . 10
6. References . . . . . . . . . . . . . . . . . . . . . . . . . 10 5.1. Normative References . . . . . . . . . . . . . . . . . . . 10
6.1. Normative References . . . . . . . . . . . . . . . . . . 10 5.2. Informative References . . . . . . . . . . . . . . . . . . 11
6.2. Informative References . . . . . . . . . . . . . . . . . 11 Appendix A. Browsers That Support X-Frame-Options . . . . . . . . 13
Appendix A. Browsers that support X-Frame-Options . . . . . . . 12 Appendix B. Description of a Clickjacking Attack . . . . . . . . 13
Appendix B. Description of a Clickjacking attack . . . . . . . . 12 B.1. Shop . . . . . . . . . . . . . . . . . . . . . . . . . . . 13
B.1. Shop . . . . . . . . . . . . . . . . . . . . . . . . . . 12 B.2. Online Shop Confirm Purchase Page . . . . . . . . . . . . 13
B.2. Online Shop Confirm Purchase Page . . . . . . . . . . . . 12 B.3. Flash Configuration . . . . . . . . . . . . . . . . . . . 13
B.3. Flash Configuration . . . . . . . . . . . . . . . . . . . 13 Appendix C. Acknowledgements . . . . . . . . . . . . . . . . . . 13
Authors' Addresses . . . . . . . . . . . . . . . . . . . . . . . 13
1. Introduction 1. Introduction
In 2009 and 2010 many browser vendors ([Microsoft-X-Frame-Options], In 2009 and 2010, many browser vendors ([Microsoft-X-Frame-Options],
[CLICK-DEFENSE-BLOG], [Mozilla-X-Frame-Options]) introduced the use [CLICK-DEFENSE-BLOG], and [Mozilla-X-Frame-Options]) introduced the
of a non-standard HTTP [RFC2616] header field "X-Frame-Options" to use of a non-standard HTTP [RFC2616] header field "X-Frame-Options"
protect against Clickjacking [Clickjacking]. HTML-based web to protect against clickjacking [Clickjacking]. HTML-based web
applications can embed or "frame" other web pages. Clickjacking is a applications can embed or "frame" other web pages. Clickjacking is a
type of attack that occurs when an attacker uses multiple transparent type of attack that occurs when an attacker uses multiple transparent
or opaque layers in the user interface to trick a user into clicking or opaque layers in the user interface to trick a user into clicking
on a button or link on another page from server B when they were on a button or link on another page from server B when they were
intending to click on the same place of the overlaying page from intending to click on the same place of the overlaying page from
server A. Thus, the attacker is "hijacking" clicks meant for their server A. Thus, the attacker is "hijacking" clicks meant for page A
page A and routing them to another page B. The attacker is tricking and routing them to page B. The attacker is tricking the user (who
the user (who sees the overlaying user interface content from page A) sees the overlaying user interface content from page A) into clicking
into clicking specific locations on the underlying page from server specific locations on the underlying page from server B, triggering
B, triggering some actions on server B and potentially using an some actions on server B and potentially using an existing session
existing session context in that step. This is an attack on both the context in that step. This is an attack on both the user and on
user and on server B. And server A may or may not be the attacker. server B. In addition, server A may or may not be the attacker.
This specification provides informational documentation about the This specification provides informational documentation about the
current use and definition of the X-Frame-Options HTTP header field. current use and definition of the X-Frame-Options HTTP header field.
As described in Section 2.3.2.2 not all browsers implement X-Frame- As described in Section 2.3.2.2, not all browsers implement
Options exactly in the sames way, which can lead to unintended X-Frame-Options in exactly the same way, which can lead to unintended
results. And given that the "X-" construction is deprecated results. And, given that the "X-" construction is deprecated
[RFC6648], the X-Frame-Options header field will in the future be [RFC6648], the X-Frame-Options header field will be replaced in the
replaced by the Frame-Options directive in the Content Security future by the Frame-Options directive in the Content Security Policy
Policy Version 1.1 [CSP-1-1]. (CSP) version 1.1 [CSP-1-1].
Existing anti-ClickJacking measures, e.g. Frame-breaking Javascript, A study [FRAME-BUSTING] demonstrated that existing anti-clickjacking
have weaknesses so that their protection can be circumvented as a measures, e.g., frame-breaking JavaScript, have weaknesses that allow
study [FRAME-BUSTING] demonstrated. their protection to be circumvented.
Short of configuring the browser to disable frames and script Short of configuring the browser to disable frames and scripts
entirely, which massively impairs browser utility, browser users are entirely, which massively impairs browser utility, browser users are
vulnerable to this type of attack. vulnerable to this type of attack.
"X-Frame-Options" allows a web page from host B to declare that its The use of "X-Frame-Options" allows a web page from host B to declare
content (for example a button, links, text, etc.) must not be that its content (for example, a button, links, text, etc.) must not
displayed in a frame (<frame> or <iframe>) of another page (e.g. from be displayed in a frame (<frame> or <iframe>) of another page (e.g.,
host A). This is done by a policy declared in the HTTP header and from host A). This is done by a policy declared in the HTTP header
enforced by browser implementations as documented here. and enforced by browser implementations as documented here.
1.1. Requirements Language 1.1. Requirements Language
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
document are to be interpreted as described in RFC 2119 [RFC2119]. document are to be interpreted as described in RFC 2119 [RFC2119].
2. X-Frame-Options Header 2. X-Frame-Options Header
The X-Frame-Options HTTP response header field indicates a policy on The X-Frame-Options HTTP header field indicates a policy that
whether the browser should render the transmitted resource within a specifies whether the browser should render the transmitted resource
<frame> or <iframe>. Servers can declare this policy in the header within a <frame> or an <iframe>. Servers can declare this policy in
of their HTTP responses to prevent clickjacking attacks, and by this the header of their HTTP responses to prevent clickjacking attacks,
ensuring that their content is not embedded into other pages or which ensures that their content is not embedded into other pages or
frames. frames.
2.1. Syntax 2.1. Syntax
The header field name is: The header field name is:
X-Frame-Options
X-Frame-Options
There are three different values for the header field. These values There are three different values for the header field. These values
are mutually exclusive, that is exactly one of the three values MUST are mutually exclusive; that is, the header field MUST be set to
be set. exactly one of the three values.
DENY DENY
A browser receiving content with this header MUST NOT display A browser receiving content with this header field MUST NOT
this content in any frame. display this content in any frame.
SAMEORIGIN SAMEORIGIN
A browser receiving content with this header field MUST NOT A browser receiving content with this header field MUST NOT
display this content in any frame from a page of different display this content in any frame from a page of different origin
origin than the content itself. than the content itself.
If a browser or plugin can not reliably determine whether the
origin of the content and the frame have the same origin, this If a browser or plugin cannot reliably determine whether or not
MUST be treated as "DENY". the origin of the content and the frame are the same, this MUST be
Please note that current implementations vary on the treated as "DENY".
interpretation of this criteria: In some it only allows a page
to be framed if the origin of the top-level browsing-context is Please note that current implementations vary on the
identical to the origin of the content using the X-FRAME- interpretation of this criteria. In some, it only allows a page
OPTIONS directive; in others it may consider the origin of the to be framed if the origin of the top-level browsing context is
framing page instead. See also section 2.3.2.2 for more identical to the origin of the content using the X-Frame-Options
details on the nesting of frames and variations in the handling directive; in others, it may consider the origin of the framing
of this header field by different browsers. And refer to page instead. Also see Section 2.3.2.2 for more details on the
section 5 paragraph 2 for the resulting potential security nesting of frames and variations in the handling of this header
problems. field by different browsers. In addition, refer to Section 4,
paragraph 2 for the resulting potential security problems.
ALLOW-FROM (followed by a serialized-origin [RFC6454]) ALLOW-FROM (followed by a serialized-origin [RFC6454])
A browser receiving content with this header MUST NOT display A browser receiving content with this header MUST NOT display this
this content in a frame from any page with a top-level browsing content in a frame from any page with a top-level browsing context
context of different origin than the specified origin. While of different origin than the specified origin. While this can
this can expose the page to risks by the trusted origin, in expose the page to risks by the trusted origin, in some cases, it
some cases it may be necessary to allow the framing by content may be necessary to allow the framing by content from other
from other domains. domains.
The meaning of the term "serialized-origin" is given in [RFC6454]. The meaning of the term "serialized-origin" is given in [RFC6454].
If the ALLOW-FROM value is used, it MUST be followed by a valid If the ALLOW-FROM value is used, it MUST be followed by a valid
origin [RFC6454] (as a subset of URI [RFC3986]) origin [RFC6454] (as a subset of the URI [RFC3986]).
Any data beyond the domain address (i.e. any data after the "/"
separator) is to be ignored. And the algorithm to compare origins Any data beyond the domain address (i.e., any data after the "/"
from [RFC6454] SHOULD be used to verify that a referring page is of separator) is to be ignored. The algorithm to compare origins from
the same origin as the content (in the case of SAMEORIGIN) or that [RFC6454] SHOULD be used to verify that a referring page is of the
the referring page's origin is identical with the ALLOW-FROM same origin as the content (in the case of SAMEORIGIN) or that the
serialized-origin (in the case of ALLOW-FROM). Though in conflict referring page's origin is identical with the ALLOW-FROM serialized-
with [RFC6454], current implementations do not consider the port as a origin (in the case of ALLOW-FROM). Though in conflict with
defining component of the origin. I.e. existing implementations [RFC6454], current implementations do not consider the port as a
defining component of the origin; i.e., existing implementations
differ with [RFC6454] in that origins with the same protocol but differ with [RFC6454] in that origins with the same protocol but
different port values are considered equivalent. different port values are considered equivalent.
Wildcards or lists to declare multiple domains in one ALLOW-FROM Wildcards or lists to declare multiple domains in one ALLOW-FROM
statement are not permitted (see Section 2.3.2.3). statement are not permitted (see Section 2.3.2.3).
2.2. Augmented Backus-Naur Form (ABNF) 2.2. Augmented Backus-Naur Form (ABNF)
The RFC 5234 [RFC5234] ABNF of the X-Frame-Options header field value The RFC 5234 [RFC5234] ABNF of the X-Frame-Options header field value
is the following. is the following:
X-Frame-Options = "DENY" X-Frame-Options = "DENY"
/ "SAMEORIGIN" / "SAMEORIGIN"
/ ( "ALLOW-FROM" RWS SERIALIZED-ORIGIN ) / ( "ALLOW-FROM" RWS SERIALIZED-ORIGIN )
RWS = 1*( SP / HTAB ) RWS = 1*( SP / HTAB )
; required whitespace ; required whitespace
With serialized-origin as defined in [RFC6454] and the definition of with serialized-origin as defined in [RFC6454] and required
RWS (required whitespace) is the same as in [HTTPbis-P1]. whitespace (RWS) as defined in [HTTPbis-P1].
RWS is used when at least one linear whitespace octet is required to RWS is used when at least one linear whitespace octet is required to
separate field tokens. RWS SHOULD be generated as a single space separate field tokens. RWS SHOULD be generated as a single space
(SP). Multiple RWS octets that occur within field-content SHOULD (SP). Multiple RWS octets that occur within field-content SHOULD
either be replaced with a single SP or transformed to all SP octets either be replaced with a SP or transformed to all SP octets before
before interpreting the field value or forwarding the message interpreting the field value or forwarding the message downstream.
downstream.
And SP (space) and HTAB (horizontal tab) are as defined in RFC 5234 SP and horizontal tab (HTAB) are as defined in Appendix B.1 of RFC
[RFC5234], Appendix B.1. 5234 [RFC5234].
The values are specified as ABNF strings, and therefore are case- The values are specified as ABNF strings; therefore, they are case-
insensitive. insensitive.
2.2.1. Examples of X-Frame-Options 2.2.1. Examples of X-Frame-Options
X-FRAME-OPTIONS: DENY X-Frame-Options: DENY
X-FRAME-OPTIONS: SAMEORIGIN X-Frame-Options: SAMEORIGIN
X-FRAME-OPTIONS: ALLOW-FROM https://example.com/ X-Frame-Options: ALLOW-FROM https://example.com/
2.3. Design Issues 2.3. Design Issues
2.3.1. Enable HTML content from other domains
2.3.1. Enable HTML Content from Other Domains
There are a number of main direct vectors that enable HTML content There are a number of main direct vectors that enable HTML content
from other domains and browser implementations of X-Frame-Options from other domains, and browser implementations of X-Frame-Options
cover all of them: cover all of them:
o IFRAME tag o IFRAME tag
o Frame tag o Frame tag
o The Object tag (requires a redirect) o Object tag (requires a redirect)
o Applet tag o Applet tag
o Embed tag o Embed tag
Besides these, other ways to host HTML content can be possible. For Besides these, other ways to host HTML content can be possible. For
example some plugins may host HTML views directly. If these plugins example, some plugins may host HTML views directly. If these plugins
appear essentially as frames (as opposed to top-level windows), the appear essentially as frames (as opposed to top-level windows), the
plugins must conform to the X-FRAME-OPTIONS policy as specified in plugins must conform to the X-Frame-Options policy as specified in
this document as well. this document as well.
2.3.2. Browser Behaviour and Processing 2.3.2. Browser Behavior and Processing
To allow secure implementations, browsers must behave in a consistent To allow secure implementations, browsers must behave in a consistent
and reliable way. and reliable way.
If an X-Frame-Options HTTP header field prohibits framing, the user- If an X-Frame-Options HTTP header field prohibits framing, the user
agent of the browser MAY immediately abort downloading or parsing of agent of the browser MAY immediately abort downloading or parsing of
the document. the document.
2.3.2.1. Violation of X-Frame-Options 2.3.2.1. Violation of X-Frame-Options
When a browser discovers that loaded content with the X-FRAME-OPTIONS When a browser discovers that loaded content with the X-Frame-Options
header field would be displayed in a frame against the specified header field would be displayed in a frame against the specified
orders of the header, the browser SHOULD redirect as soon as possible orders of the header, the browser SHOULD redirect to a "NOFRAME" page
to a "No-Frame" page. For example this can be a noframe.html page as soon as possible. For example, this can be a noframe.html page
that also states the full URL and hostname of the protected page. that also states the full URL and hostname of the protected page.
The NoFrame page could provide the user with an option to open the The NOFRAME page could provide the user with an option to open the
target URL in a new window. target URL in a new window.
Implementations of this vary, some browsers will show a message that Implementations of this vary: some browsers will show a message that
allows the user to safely open the target page in a new window. allows the user to safely open the target page in a new window,
Other implementations will simply render an empty frame. whereas other implementations will simply render an empty frame.
2.3.2.2. Variation in current browser behaviour 2.3.2.2. Variation in Current Browser Behavior
There are currently variations in the implementation of the X-FRAME-
OPTIONS header. For example not all browsers support the "ALLOW- There are currently variations in the implementation of the
FROM" option. "ALLOW-FROM" was initially an Internet Explorer X-Frame-Options header. For example, not all browsers support the
extension and at the time of writing has not been uniformly "ALLOW-FROM" option. "ALLOW-FROM" was initially an Internet Explorer
extension and, at the time of writing, has not been uniformly
implemented by other user agents. implemented by other user agents.
Furthermore the criteria for the SAMEORIGIN (and ALLOW-FROM) Furthermore, the criteria for the SAMEORIGIN (and ALLOW-FROM)
directive may not be evaluated unanimously either: The known directive may not be evaluated unanimously either: the known
implementations in Appendix A evaluate the SAMEORIGIN directive based implementations in Appendix A evaluate the SAMEORIGIN directive based
on the origin of the framed page and the top-level browsing-context, on the origin of the framed page and the top-level browsing context,
while other implementations might evaluate based on the framed page while other implementations might evaluate it based on the framed
and the framing page, or the whole chain of nested frames inbetween. page and the framing page, or the whole chain of nested frames in
between.
To illustrate the difference between the comparison with "framing To illustrate the difference between the comparison of the "framing
page" and the "top-level browsing-context" consider the following page" and the "top-level browsing context", consider the following
scenario: Web pages may embed frames with other pages which in turn scenario: web pages may embed frames with other pages that, in turn,
embed frames with other pages as well and so on. In theory this can embed frames with other pages as well, and so on. In theory, this
result in an infinite nesting of framed pages. For example web page can result in an infinite nesting of framed pages. For example, web
A may contain in a frame web page B, and web page B contains in a page A may contain web page B in a frame, and web page B may contain
frame web page C. web page C in a frame.
Web page A Web page A
<html> <html>
.... ....
<frame src="https://URI_of_web_page_B" /> <frame src="https://URI_of_web_page_B" />
</html> </html>
Web Page B Web page B
<html> <html>
.... ....
<frame src="https://URI_of_web_page_C" /> <frame src="https://URI_of_web_page_C" />
</html> </html>
And so forth... and so forth.
In this example, for the nested frames with the inner framed web page In this example, for the nested frames with the inner-framed web page
C, the most outer web page A would be the "top-level browsing- C, the most outer web page A would be the "top-level browsing
context" and web page B would be the "framing page" context", and web page B would be the "framing page".
These potential variations in the evaluation of the header by These potential variations in the evaluation of the header by
different implementations impair the useage and reliability of this different implementations impair the usage and reliability of this
http header and have security implications as described in section 5. HTTP header and have security implications as described in Section 4.
A revised version of x-frame-options in the form of a frame-options A revised version of X-Frame-Options in the form of a Frame-Options
directive in the CSP 1.1[CSP-1-1] will unify the behaviour and it is directive in CSP 1.1 [CSP-1-1] will unify the behavior, and it is
expected that newer implementations will use it rather than the expected that newer implementations will use it rather than the
mechanisms documented here. mechanisms documented here.
2.3.2.3. Usage design pattern and example scenario for the ALLOW-FROM 2.3.2.3. Usage Design Pattern and Example Scenario for the ALLOW-FROM
parameter Parameter
As the "ALLOW-FROM" field only supports one serialized-origin, in As the "ALLOW-FROM" field only supports one serialized-origin, in
cases when the server wishes to allow more than one resource to frame cases when the server wishes to allow more than one resource to frame
its content, the following design pattern can fulfil that need: its content, the following design pattern can fulfill that need:
1. A page that wants to render the requested content in a frame 1. A page that wants to render the requested content in a frame
supplies its own origin information to the server providing the supplies its own origin information to the server providing the
to-be-framed content via a querystring parameter. content to be framed via a query string parameter.
2. The Server verifies the hostname meets its criteria so that the 2. The server verifies that the hostname meets its criteria, so that
page can be allowed to be framed by the target resource. This the page is allowed to be framed by the target resource. This
may for example happen via a look-up of a white-list of trusted may, for example, happen via a lookup of a whitelist of trusted
domain names that are allowed to frame the page. For example, domain names that are allowed to frame the page. For example,
for a Facebook "Like" button, the server can check to see that for a Facebook "Like" button, the server can check to see that
the supplied hostname matches the hostname(s) expected for that the supplied hostname matches the hostname(s) expected for that
"Like" button. "Like" button.
3. The server returns the hostname in X-FRAME-OPTIONS: ALLOW-FROM if 3. The server returns the hostname in "X-Frame-Options: ALLOW-FROM"
the proper criteria was met in step #2. if the proper criteria was met in step #2.
4. The browser enforces the X-FRAME-OPTIONS: ALLOW-FROM header. 4. The browser enforces the "X-Frame-Options: ALLOW-FROM" header.
2.3.2.4. No caching of the X-Frame-Options header 2.3.2.4. No Caching of the X-Frame-Options Header
It is not recommended to cache the X-Frame-Options header for a Caching the X-Frame-Options header for a resource is not recommended.
resource. Caching the X-Frame-Options response could result in Caching the X-Frame-Options response could result in problems
problems because: because:
1. The browser has to check for every http-request of the resource 1. For every http-request of the resource, the browser has to check
whether the X-Frame-Options header has been set and then act whether the X-Frame-Options header has been set and then act
accordingly, as a resource itself might be created dynamically accordingly, as a resource itself might be created dynamically
and the header could change with it, too. and the header could change with it, too.
2. And also, as outlined in section 2.3.2.3., servers may generate X 2. Also, as outlined in Section 2.3.2.3, servers may generate
-Frame-Options header responses depending on the request. X-Frame-Options header responses depending on the request.
Example case: Considering that we have only one serialized-origin Example case: Considering that we have only one serialized-origin
in the ALLOW-FROM directive, imagine a user has multiple pages in the ALLOW-FROM directive, imagine a user has multiple pages
open in his browser tabs with one of web page 1 from domain A and open in his browser tabs with web page 1 from domain A and web
the second of web page 2 from domain B, both frame the same page page 2 from domain B, and both frame the same page from domain C
from domain C with the ALLOW-FROM directive. In that case the with the ALLOW-FROM directive. In that case, the page needs to
page needs to reply to both requests with different X-Frame- reply to both requests with different X-Frame-Options headers,
Options headers, the first pointing to origin A, the second to with the first pointing to origin A and the second pointing to
origin B. origin B.
However, we found that none of the major browsers listed in However, we found that none of the major browsers listed in
Appendix A cache the responses. Appendix A cache the responses.
3. Acknowledgements 3. IANA Considerations
This document was derived from input from specifications published by
various browser vendors such as Microsoft (Eric Lawrence, David
Ross), Mozilla, Google, Opera and Apple.
4. IANA Considerations
This memo is a request to IANA to include the specified HTTP header IANA has included the specified HTTP header in the "Permanent Message
in the registry as outlined in Registration Procedures for Message Header Field Name" registry as outlined in "Registration Procedures
Header Fields [RFC3864] for Message Header Fields" [RFC3864].
4.1. Registration Template 3.1. Registration Template
PERMANENT MESSAGE HEADER FIELD REGISTRATION TEMPLATE: Permanent Message Header Field Names Template:
Header field name: X-Frame-Options Header field name: X-Frame-Options
Applicable protocol: http [RFC2616] Applicable protocol: http [RFC2616]
Status: informational Status: Informational
Author/Change controller: IETF
Specification document(s): draft-ietf-websec-x-frame-options Author/change controller: IETF
Related information: Specification document(s): RFC 7034
Figure 1 Related information: None
5. Security Considerations 4. Security Considerations
The introduction of the X-FRAME-OPTIONS http header field does The introduction of the X-Frame-Options HTTP header field improves
improve the protection against Clickjacking. However, it is not the protection against clickjacking. However, it is not self-
self-sufficient on its own to protect against all kinds of these sufficient enough to protect against all kinds of these attack
attack vectors. It must be used in conjunction with other security vectors. It must be used in conjunction with other security measures
measures like secure coding (e.g. input validation, output encoding, like secure coding (e.g., input validation, output encoding, etc.)
...) and the Content Security Policy [CSP]. and the Content Security Policy version 1.0 [CSP].
It is important to note that current implementations do not check the It is important to note that current implementations do not check the
origins of the entire ancestor tree of frames of the framing origins of the framing resources' entire ancestor tree of frames, and
resources, and this may expose the resource to attack in multiple- this may expose the resource to attack in multiple-nested scenarios.
nested scenarios.
The browser implementations evaluate based on the origin of the The browser implementations evaluate based on the origin of the
framed page and the top-level browsing-context (i.e. most outer framed page and the top-level browsing context (i.e., the most outer
frame): frame):
If a resource from origin A embeds untrusted content from origin B, If a resource from origin A embeds untrusted content from origin B,
that untrusted content can embed another resource from origin A with that untrusted content can embed another resource from origin A with
an X-Frame-Options: SAMEORIGIN policy and that check would pass when an "X-Frame-Options: SAMEORIGIN" policy, and that check would pass
the user agent only verifies the top-level browsing context. when the user agent only verifies the top-level browsing context.
Therefore web developers should be aware that embedding content from Therefore, web developers should be aware that embedding content from
other sites can leave their web pages vulnerable to clickjacking even other sites can leave their web pages vulnerable to clickjacking even
if the X-Frame-Options header is used. if the X-Frame-Options header is used.
Furthermore, X-Frame-Options must be sent as an HTTP header field and Furthermore, X-Frame-Options must be sent as an HTTP header field and
is explicitly ignored by user agents when declared with a meta http- is explicitly ignored by user agents when declared with a meta
equiv tag. http-equiv tag.
5.1. Privacy Considerations 4.1. Privacy Considerations
There are two kinds of potential data leakage to consider: There are two kinds of potential data leakage to consider:
1. Using X-FRAME-OPTIONS with the parameter ALLOW-FROM allows a page 1. Using X-Frame-Options with the parameter ALLOW-FROM allows a page
to guess or infer information about who is framing it. A web to guess or infer information about who is framing it. A web
server may answer requests with the X-FRAME-OPTIONS ALLOW-FROM server may answer requests with the "X-Frame-Options: ALLOW-FROM"
header and by thus determine which other page is framing it. header and thus determine which other page is framing it. This
This is inherent by design, but may lead to data leakage or data is inherent by design, but it may lead to data-leakage or data-
protection concerns. protection concerns.
2. The web server using the ALLOW-FROM directive may disclose to 2. The web server using the ALLOW-FROM directive effectively
other parties who request the page in the header by which page it discloses the origin specified in the header. If a web server
is allowed to be framed. If a web server wishes to reduce this wishes to reduce this leakage, it is recommended to generate the
leakage, it is recommended to generate the ALLOW-FROM header for ALLOW-FROM header for each request based on the design pattern as
each request based on the design pattern as described in section described in Section 2.3.2.3.
2.3.2.3.
6. References 5. References
6.1. Normative References 5.1. Normative References
[RFC2119] Bradner, S., "Key words for use in RFCs to Indicate [RFC2119] Bradner, S., "Key words for use in RFCs to Indicate
Requirement Levels", BCP 14, RFC 2119, March 1997. Requirement Levels", BCP 14, RFC 2119, March 1997.
[RFC3986] Berners-Lee, T., Fielding, R., and L. Masinter, "Uniform [RFC3986] Berners-Lee, T., Fielding, R., and L. Masinter, "Uniform
Resource Identifier (URI): Generic Syntax", STD 66, RFC Resource Identifier (URI): Generic Syntax", STD 66,
3986, January 2005. RFC 3986, January 2005.
[RFC5234] Crocker, D. and P. Overell, "Augmented BNF for Syntax [RFC5234] Crocker, D. and P. Overell, "Augmented BNF for Syntax
Specifications: ABNF", STD 68, RFC 5234, January 2008. Specifications: ABNF", STD 68, RFC 5234, January 2008.
[RFC6454] Barth, A., "The Web Origin Concept", RFC 6454, December [RFC6454] Barth, A., "The Web Origin Concept", RFC 6454,
2011. December 2011.
6.2. Informative References 5.2. Informative References
[CLICK-DEFENSE-BLOG] [CLICK-DEFENSE-BLOG]
Microsoft, "Clickjacking Defense", 2009, <http:// Lawrence, E., "IE8 Security Part VII: Clickjacking
blogs.msdn.com/b/ie/archive/2009/01/27/ie8-security-part- Defenses", Microsoft Developer Network Blogs,
vii-clickjacking-defenses.aspx>. January 2009, <http://blogs.msdn.com/b/ie/archive/2009/01/
27/ie8-security-part-vii-clickjacking-defenses.aspx>.
[CSP] Sterne, B. and A. Barth, "Content Security Policy 1.0",
W3C Candidate Recommendation CR-CSP-20121115,
November 2012,
<http://www.w3.org/TR/2012/CR-CSP-20121115/>.
[CSP-1-1] Barth, A. and M. West, "Content Security Policy 1.1", W3C [CSP-1-1] Barth, A. and M. West, "Content Security Policy 1.1", W3C
Working Draft WD-CSP11-20130604, June 2013, Working Draft WD-CSP11-20130604, June 2013,
<http://www.w3.org/TR/2013/WD-CSP11-20130604/>. <http://www.w3.org/TR/2013/WD-CSP11-20130604/>.
Latest version available at [CSRF] OWASP (Open Web Application Security Project), "Top-10
2013-A8-Cross-Site Request Forgery (CSRF)", June 2013,
[CSP] Sterne, B. and A. Barth, "Content Security Policy 1.0", <https://www.owasp.org/index.php/
W3C Candidate Recommendation CR-CSP-20121115, November Top_10_2013-A8-Cross-Site_Request_Forgery_%28CSRF%29>.
2012, <http://www.w3.org/TR/2012/CR-CSP-20121115/>.
Latest version available at
[CSRF] OWASP (Open Web Application Security Project), "OWASP
Top-10: Cross-Site Request Forgery (CSRF)", 2010, <https:/
/www.owasp.org/index.php/Top_10_2013-A8-Cross-
Site_Request_Forgery_%28CSRF%29>.
[Clickjacking] [Clickjacking]
OWASP (Open Web Application Security Project), OWASP (Open Web Application Security Project),
"Clickjacking", 2010, "Clickjacking", April 2013,
<http://www.owasp.org/index.php/Clickjacking>. <http://www.owasp.org/index.php/Clickjacking>.
[FRAME-BUSTING] [FRAME-BUSTING]
Stanford Web Security Research, "Busting frame busting: a Stanford Web Security Research, "Busting frame busting: a
study of clickjacking vulnerabilities at popular sites", study of clickjacking vulnerabilities at popular sites",
2010, <http://seclab.stanford.edu/websec/framebusting/>. July 2010,
<http://seclab.stanford.edu/websec/framebusting/>.
[HTTPbis-P1] [HTTPbis-P1]
IETF, "Hypertext Transfer Protocol (HTTP/1.1): Message Fielding, R. and J. Reschke, "Hypertext Transfer Protocol
Syntax and Routing", 2013, <http://tools.ietf.org/html/ (HTTP/1.1): Message Syntax and Routing", Work in Progress,
draft-ietf-httpbis-p1-messaging-23>. September 2013.
[Microsoft-X-Frame-Options] [Microsoft-X-Frame-Options]
Microsoft, "Combating ClickJacking With X-Frame-Options", Lawrence, E., "Combating ClickJacking With X-Frame-
2010, <http://blogs.msdn.com/b/ieinternals/archive/2010/03 Options", Microsoft Developer Network Blogs, March 2010,
/30/combating-clickjacking-with-x-frame-options.aspx>. <http://blogs.msdn.com/b/ieinternals/archive/2010/03/30/
combating-clickjacking-with-x-frame-options.aspx>.
[Mozilla-X-Frame-Options] [Mozilla-X-Frame-Options]
Mozilla, "The X-Frame-Options response header", 2010, Mozilla Developer Network, "The X-Frame-Options response
<https://developer.mozilla.org/en-US/docs/The_X-FRAME- header", August 2013, <https://developer.mozilla.org/
OPTIONS_response_header>. en-US/docs/The_X-FRAME-OPTIONS_response_header>.
[RFC2616] Fielding, R., Gettys, J., Mogul, J., Frystyk, H., [RFC2616] Fielding, R., Gettys, J., Mogul, J., Frystyk, H.,
Masinter, L., Leach, P., and T. Berners-Lee, "Hypertext Masinter, L., Leach, P., and T. Berners-Lee, "Hypertext
Transfer Protocol -- HTTP/1.1", RFC 2616, June 1999. Transfer Protocol -- HTTP/1.1", RFC 2616, June 1999.
[RFC3864] Klyne, G., Nottingham, M., and J. Mogul, "Registration [RFC3864] Klyne, G., Nottingham, M., and J. Mogul, "Registration
Procedures for Message Header Fields", BCP 90, RFC 3864, Procedures for Message Header Fields", BCP 90, RFC 3864,
September 2004. September 2004.
[RFC6648] Saint-Andre, P., Crocker, D., and M. Nottingham, [RFC6648] Saint-Andre, P., Crocker, D., and M. Nottingham,
"Deprecating the "X-" Prefix and Similar Constructs in "Deprecating the "X-" Prefix and Similar Constructs in
Application Protocols", BCP 178, RFC 6648, June 2012. Application Protocols", BCP 178, RFC 6648, June 2012.
Appendix A. Browsers that support X-Frame-Options Appendix A. Browsers That Support X-Frame-Options
o Internet Explorer 8+ o Internet Explorer 8+
o Firefox 3.6.9+ o Firefox 3.6.9+
o Opera 10.5+ o Opera 10.5+
o Safari 4+ o Safari 4+
o Chrome 4.1+ o Chrome 4.1+
Appendix B. Description of a Clickjacking attack Appendix B. Description of a Clickjacking Attack
More detailed explanation of Clickjacking scenarios A more detailed explanation of clickjacking scenarios follows.
B.1. Shop B.1. Shop
An Internet Marketplace/Shop offering a feature with a link/button to An Internet marketplace/shop offering a feature with a link/button to
"Buy this" Gadget "Buy this" gadget wants their affiliates (who could be malicious
The marketplace wants their affiliates (who could be malicious attackers) to be able to stick the "Buy such and such from XYZ"
attackers) to be able to stick the "Buy such-and-such from XYZ" IFRAMES into their pages. There is a possible clickjacking threat
IFRAMES into their pages. There is a possible Clickjacking threat here, which is why the marketplace/online shop needs to then
here, which is why the marketplace/onlineshop needs to then
immediately navigate the main browsing context (or a new window) to a immediately navigate the main browsing context (or a new window) to a
confirmation page which is protected by anti-Clickjacking confirmation page that is protected by anti-clickjacking protections.
protections.
B.2. Online Shop Confirm Purchase Page B.2. Online Shop Confirm Purchase Page
The "Confirm Purchase" page of an online shop must be shown to the The "Confirm Purchase" page of an online shop must be shown to the
end user without the risk of an overlay or misuse by an attacker. end-user without the risk of an overlay or misuse by an attacker.
For that reason, the confirmation page uses a combination of anti- For that reason, the confirmation page uses a combination of
CSRF (Cross Site Request Forgery, [CSRF]) tokens and the X-FRAME- anti-CSRF (Cross Site Request Forgery [CSRF]) tokens and the
OPTIONS HTTP header field, mitigating ClickJacking attacks. X-Frame-Options HTTP header field, mitigating clickjacking attacks.
B.3. Flash Configuration B.3. Flash Configuration
Macromedia Flash configuration settings are set by a Flash object Macromedia Flash configuration settings are set by a Flash object
which can run only from a specific configuration page on Macromedia's that can run only from a specific configuration page on Macromedia's
site. The object runs inside the page and thus can be subject to a site. The object runs inside the page and thus can be subject to a
ClickJacking attack. In order to prevent ClickJacking attacks clickjacking attack. In order to prevent clickjacking attacks
against the security settings, the configuration page uses the X against the security settings, the configuration page uses the
-FRAME-OPTIONS directive. X-Frame-Options directive.
Appendix C. Acknowledgements
This document was derived from input from specifications published by
various browser vendors such as Microsoft (Eric Lawrence and David
Ross), Mozilla, Google, Opera, and Apple.
Authors' Addresses Authors' Addresses
David Ross David Ross
Microsoft Microsoft
U.S.
EMail: dross@microsoft.com
Tobias Gondrom Tobias Gondrom
Thames Stanley Thames Stanley
Kruegerstr. 5A
Unterschleissheim
Germany
Phone: +44 7521003005 EMail: tobias.gondrom@gondrom.org
Email: tobias.gondrom@gondrom.org
 End of changes. 100 change blocks. 
296 lines changed or deleted 289 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/