WEBSEC                                                           D. Ross
Internet-Draft                                                 Microsoft
Intended status: Informational                                T. Gondrom
Expires: January 4, 2013                                    July 3, 2012


                      HTTP Header X-Frame-Options
                  draft-ietf-websec-x-frame-options-00

Abstract

   To improve the protection of web applications against Clickjacking
   this standards defines a http response header that declares a policy
   communicated from a host to the client browser whether the
   transmitted content MUST NOT be displayed in frames of other pages
   from different origins which are allowed to frame the content.  This
   drafts serves to document the existing use and specification of
   X-Frame-Options.

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 January 4, 2013.

Copyright Notice

   Copyright (c) 2012 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



Ross & Gondrom           Expires January 4, 2013                [Page 1]


Internet-Draft               X-Frame-Options                   July 2012


   the Trust Legal Provisions and are provided without warranty as
   described in the Simplified BSD License.


Table of Contents

   1.  Introduction  . . . . . . . . . . . . . . . . . . . . . . . . . 3
     1.1.  Requirements Language . . . . . . . . . . . . . . . . . . . 3
   2.  X-Frame-Options Header  . . . . . . . . . . . . . . . . . . . . 3
     2.1.  Syntax  . . . . . . . . . . . . . . . . . . . . . . . . . . 3
     2.2.  Backus-Naur Form (BNF)  . . . . . . . . . . . . . . . . . . 4
     2.3.  Design Issues . . . . . . . . . . . . . . . . . . . . . . . 5
       2.3.1.  Enable HTML content from other domains  . . . . . . . . 5
       2.3.2.  Browser Behaviour and Processing  . . . . . . . . . . . 5
     2.4.  Examples of X-Frame-Options Headers . . . . . . . . . . . . 5
       2.4.1.  Example scenario for the ALLOW-FROM parameter . . . . . 6
   3.  Acknowledgements  . . . . . . . . . . . . . . . . . . . . . . . 6
   4.  IANA Considerations . . . . . . . . . . . . . . . . . . . . . . 6
     4.1.  Registration Template . . . . . . . . . . . . . . . . . . . 7
   5.  Security Considerations . . . . . . . . . . . . . . . . . . . . 7
   6.  References  . . . . . . . . . . . . . . . . . . . . . . . . . . 7
     6.1.  Normative References  . . . . . . . . . . . . . . . . . . . 7
     6.2.  Informative References  . . . . . . . . . . . . . . . . . . 7
   Appendix A.  Description of a Clickjacking attack . . . . . . . . . 8
     A.1.  Shop  . . . . . . . . . . . . . . . . . . . . . . . . . . . 8
     A.2.  Confirm Purchase Page . . . . . . . . . . . . . . . . . . . 8
     A.3.  Flash Configuration . . . . . . . . . . . . . . . . . . . . 9
   Authors' Addresses  . . . . . . . . . . . . . . . . . . . . . . . . 9























Ross & Gondrom           Expires January 4, 2013                [Page 2]


Internet-Draft               X-Frame-Options                   July 2012


1.  Introduction

   In 2009 and 2010 many browser vendors introduced the use of a non-
   standard http header RFC 2616 [RFC2616] "X-Frame-Options" to protect
   against Clickjacking [Clickjacking].  This draft is to document the
   current use of X-Frame-Options header and shall in the future be
   replaced by the Frame-Options (CSRF) [FRAME-OPTIONS] standard.

   Existing anti-ClickJacking measures, e.g.  Frame-breaking Javascript,
   have weaknesses so that their protection can be circumvented as a
   study [FRAME-BUSTING] demonstrated.

   Short of configuring the browser to disable frames and script
   entirely, which massively impairs browser utility, browser users are
   vulnerable to this type of attack.

   The "X-Frame-Options" allows a secure web page from host B to declare
   that its content (for example a button, links, text, etc.) must not
   be displayed in a frame of another page (e.g. from host A).  In
   principle this is done by a policy declared in the HTTP header and
   obeyed by conform browser implementations.

1.1.  Requirements Language

   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].


2.  X-Frame-Options Header

   The X-Frame-Options HTTP response header indicates a policy whether a
   browser MUST NOT allow to render a page in a <frame> or <iframe> .
   Hosts can declare this policy in the header of their HTTP responses
   to prevent clickjacking attacks, by ensuring that their content is
   not embedded into other pages or frames.

2.1.  Syntax

   The header field name is:
   X-Frame-Options

   There are three different values for the header field.  These values
   are exclusive, that is NOT more than one of the three values MUST be
   set.






Ross & Gondrom           Expires January 4, 2013                [Page 3]


Internet-Draft               X-Frame-Options                   July 2012


   DENY
         A browser receiving content with this header MUST NOT display
         this content in any frame.

   SAMEORIGIN
         A browser receiving content with this header MUST NOT display
         this content in any frame from a page of different origin 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
         MUST be treated as "DENY".
         [TBD]current implementations do not display if the origin of
         the top-level-browsing-context is different than the origin of
         the page containing the X-FRAME-OPTIONS header.

   ALLOW-FROM  (followed by a URI of trusted origins)
         A browser receiving content with this header MUST NOT display
         this content in any frame from a page of different origin than
         the listed origin.  While this can expose the page to risks by
         the trusted origin, in some cases it may be necessary to use
         content from other domains.
         For example: X-FRAME-OPTIONS: ALLOW-FROM
         https://www.domain.com/

   The URIs listed for ALLOW-FROM must be valid.
   Any data beyond the domain address (i.e. any data after the "/"
   separator) is to be ignored and to verify a referring page is of the
   same origin as the content or that the referring page is listed in
   the ALLOW-FROM list of URI, the algorithm to compare origins from
   [RFC6454] should be used.

   Wildcards to declare multiple domains in one statement are not
   permitted.

   [TBD] Current Implementations do not consider the port a component of
   the origin - conflicting with [RFC6454].

2.2.  Backus-Naur Form (BNF)

   The RFC 822 [RFC0822] EBNF of the X-Frame-Options header is:

         X-Frame-Options = "Frame-Options" ":" "DENY"/ "SAMEORIGIN" /
                                 ("ALLOW-FROM" ":" URI)



   [TBD] with URI as defined in the websec-origin draft
   [TBD] Or should we use the ABNF (RFC 2234) alternatively or in



Ross & Gondrom           Expires January 4, 2013                [Page 4]


Internet-Draft               X-Frame-Options                   July 2012


   addition?

2.3.  Design Issues

2.3.1.  Enable HTML content from other domains

   There are three main direct vectors that enable HTML content from
   other domains:

   o  IFRAME Tag

   o  Frame tag

   o  The Object tag (requires a redirect)

   Besides these other ways to host HTML content can be possible.  For
   example some plugins may host HTML views directly.  If these plugins
   appear essentially as frames (as opposed to top-level windows), the
   plugins MUST conform to the X-FRAME-OPTIONS directive as specified in
   this draft as well.

2.3.2.  Browser Behaviour and Processing

   To allow secure implementations browser implementations MUST behave
   in a consistent and reliable way.

   If a HTTP Header prohibits framing, the user-agent of the browser MAY
   immediately abort downloading or parsing of the document.

   When a browser discovers loaded content with the X-FRAME-OPTIONS
   header would be displayed in a frame against the specified origin
   orders of the header, the browser SHOULD redirect as soon as possible
   to a "No-Frame" page.

   "No-Frame" Page
   If the display of content is denied by the X-FRAME-OPTIONS header an
   error page SHOULD be displayed.  For example this can be a
   noframe.html page also stating the full URL of the protected page and
   the hostname of the protected page.

   The NoFrame page MAY provide the user with an option to open the
   target URL in a new window.

2.4.  Examples of X-Frame-Options Headers







Ross & Gondrom           Expires January 4, 2013                [Page 5]


Internet-Draft               X-Frame-Options                   July 2012


2.4.1.  Example scenario for the ALLOW-FROM parameter

   1.  Inner IFRAME suggests via a querystring parameter what site it
       wants to be hosted by.  This can obviously be specified by an
       attacker, but that's OK.

   2.  Server verifies the hostname meets whatever criteria.  For
       example, for a Facebook "Like" button, the server can check to
       see that the supplied hostname matches the hostname expected for
       that Like button.

   3.  Server serves up the hostname in X-FRAME-OPTIONS: ALLOW-FROM if
       the proper criteria was met in step #2.

   4.  Browser enforces the X-FRAME-OPTIONS: ALLOW-FROM domain.com
       header.


3.  Acknowledgements

   This document was derived from input from specifications published by
   various browser vendors like Microsoft (Eric Lawrence, David Ross),
   Mozilla, Google, Opera and Apple.


4.  IANA Considerations

   This memo a request to IANA to include the specified HTTP header in
   registry as outlined in Registration Procedures for Message Header
   Fields [RFC3864]





















Ross & Gondrom           Expires January 4, 2013                [Page 6]


Internet-Draft               X-Frame-Options                   July 2012


4.1.  Registration Template


   PERMANENT MESSAGE HEADER FIELD REGISTRATION TEMPLATE:

   Header field name: X-Frame-Option

   Applicable protocol: http [RFC2616]

   Status: Standard

   Author/Change controller: IETF

   Specification document(s): draft-ietf-websec-x-frame-options

   Related information:

                                 Figure 1


5.  Security Considerations

   The introduction of the http header X-FRAME-OPTIONS does improve the
   protection against Clickjacking, however it is not self-sufficient on
   its own but MUST be used in conjunction with other security measures
   like secure coding and Content Security Policy (CSP)

   The parameter ALLOW-FROM allows a page to guess who is framing it.
   This is by design, but may lead to data leakage or data protection
   concerns.


6.  References

6.1.  Normative References

   [RFC2119]  Bradner, S., "Key words for use in RFCs to Indicate
              Requirement Levels", BCP 14, RFC 2119, March 1997.

6.2.  Informative References

   [CLICK-DEFENSE-BLOG]
              Microsoft, "Clickjacking Defense", 2009, <http://
              blogs.msdn.com/b/ie/archive/2009/01/27/
              ie8-security-part-vii-clickjacking-defenses.aspx>.

   [Clickjacking]
              OWASP (Open Web Application Security Project),



Ross & Gondrom           Expires January 4, 2013                [Page 7]


Internet-Draft               X-Frame-Options                   July 2012


              "Clickjacking", 2010,
              <http://www.owasp.org/index.php/Clickjacking>.

   [FRAME-BUSTING]
              Stanford Web Security Research, "Busting frame busting: a
              study of clickjacking vulnerabilities at popular sites",
              2010, <http://seclab.stanford.edu/websec/framebusting/>.

   [FRAME-OPTIONS]
              IETF, "The Web Origin Concept", December 2010, <http://
              tools.ietf.org/id/draft-gondrom-frame-options-02.txt>.

   [RFC0822]  Crocker, D., "Standard for the format of ARPA Internet
              text messages", STD 11, RFC 822, August 1982.

   [RFC2616]  Fielding, R., Gettys, J., Mogul, J., Frystyk, H.,
              Masinter, L., Leach, P., and T. Berners-Lee, "Hypertext
              Transfer Protocol -- HTTP/1.1", RFC 2616, June 1999.

   [RFC3864]  Klyne, G., Nottingham, M., and J. Mogul, "Registration
              Procedures for Message Header Fields", BCP 90, RFC 3864,
              September 2004.

   [RFC6454]  Barth, A., "The Web Origin Concept", RFC 6454,
              December 2011.


Appendix A.  Description of a Clickjacking attack

   More detailed explanation of Clickjacking scenarios

A.1.  Shop

   An Internet Marketplace/Shop offering a feature with a link/button to
   "Buy this" Gadget
   The marketplace wants their affiliates (who could be bad guys) to be
   able to stick the "Buy such-and-such from XYZ" IFRAMES into their
   pages.  There is a ClickJack possibility here, which is why the
   marketplace/onlineshop needs to then immediately navigate the main
   browsing context (or a new window) to a confirmation page which is
   protected by anti-CJ protections.

A.2.  Confirm Purchase Page

   Onlineshop "Confirm purchase" anti-CSRF page
   The Confirm Purchase page must be shown to the end user without
   possibility of overlay or misuse by an attacker.  For that reason,
   the confirmation page uses anti-CSRF tokens and contains the X-FRAME-



Ross & Gondrom           Expires January 4, 2013                [Page 8]


Internet-Draft               X-Frame-Options                   July 2012


   OPTIONS directive, mitigating ClickJack attacks.

A.3.  Flash Configuration

   Macromedia Flash configuration page
   Macromedia Flash configuration settings are set by a Flash object
   which 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
   ClickJacking attack.  In order to prevent ClickJacking attacks
   against the security settings, the configuration page uses the
   X-FRAME-OPTIONS directive.


Authors' Addresses

   David Ross
   Microsoft
   U.S.

   Phone:
   Email:


   Tobias Gondrom
   Kruegerstr. 5A
   Unterschleissheim,
   Germany

   Phone: +44 7521003005
   Email: tobias.gondrom@gondrom.org





















Ross & Gondrom           Expires January 4, 2013                [Page 9]