HTTP Working Group M. West Internet-Draft Google, Inc Updates: 6265 (if approved) M. Goodwin Intended status: Standards Track Mozilla Expires: December 22, 2016 June 20, 2016 Same-Site Cookies draft-ietf-httpbis-cookie-same-site-00 Abstract This document updates RFC6265 by defining a "SameSite" attribute which allows servers to assert that a cookie ought not to be sent along with cross-site requests. This assertion allows user agents to mitigate the risk of cross-origin information leakage, and provides some protection against cross-site request forgery attacks. Note to Readers Discussion of this draft takes place on the HTTP working group mailing list (ietf-http-wg@w3.org), which is archived at https://lists.w3.org/Archives/Public/ietf-http-wg/ . Working Group information can be found at http://httpwg.github.io/ ; source code and issues list for this draft can be found at https://github.com/httpwg/http-extensions/labels/cookie-same-site . 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 December 22, 2016. West & Goodwin Expires December 22, 2016 [Page 1] Internet-Draft Same-Site Cookies June 2016 Copyright Notice Copyright (c) 2016 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. Table of Contents 1. Introduction . . . . . . . . . . . . . . . . . . . . . . . . 3 1.1. Goals . . . . . . . . . . . . . . . . . . . . . . . . . . 3 1.2. Examples . . . . . . . . . . . . . . . . . . . . . . . . 4 2. Terminology and notation . . . . . . . . . . . . . . . . . . 4 2.1. "Same-site" and "cross-site" Requests . . . . . . . . . . 5 2.1.1. Document-based requests . . . . . . . . . . . . . . . 5 2.1.2. Worker-based requests . . . . . . . . . . . . . . . . 6 3. Server Requirements . . . . . . . . . . . . . . . . . . . . . 7 3.1. Grammar . . . . . . . . . . . . . . . . . . . . . . . . . 7 3.2. Semantics of the "SameSite" Attribute (Non-Normative) . . 8 4. User Agent Requirements . . . . . . . . . . . . . . . . . . . 8 4.1. The "SameSite" attribute . . . . . . . . . . . . . . . . 8 4.1.1. "Strict" and "Lax" enforcement . . . . . . . . . . . 9 4.2. Monkey-patching the Storage Model . . . . . . . . . . . . 9 4.3. Monkey-patching the "Cookie" header . . . . . . . . . . . 10 5. Authoring Considerations . . . . . . . . . . . . . . . . . . 10 5.1. Defense in depth . . . . . . . . . . . . . . . . . . . . 10 5.2. Top-level Navigations . . . . . . . . . . . . . . . . . . 10 5.3. Mashups and Widgets . . . . . . . . . . . . . . . . . . . 11 6. Privacy Considerations . . . . . . . . . . . . . . . . . . . 11 6.1. Server-controlled . . . . . . . . . . . . . . . . . . . . 11 6.2. Pervasive Monitoring . . . . . . . . . . . . . . . . . . 12 7. References . . . . . . . . . . . . . . . . . . . . . . . . . 12 7.1. Normative References . . . . . . . . . . . . . . . . . . 12 7.2. Informative References . . . . . . . . . . . . . . . . . 13 Appendix A. Acknowledgements . . . . . . . . . . . . . . . . . . 14 Authors' Addresses . . . . . . . . . . . . . . . . . . . . . . . 14 West & Goodwin Expires December 22, 2016 [Page 2] Internet-Draft Same-Site Cookies June 2016 1. Introduction Section 8.2 of [RFC6265] eloquently notes that cookies are a form of ambient authority, attached by default to requests the user agent sends on a user's behalf. Even when an attacker doesn't know the contents of a user's cookies, she can still execute commands on the user's behalf (and with the user's authority) by asking the user agent to send HTTP requests to unwary servers. Here, we update [RFC6265] with a simple mitigation strategy that allows servers to declare certain cookies as "same-site", meaning they should not be attached to "cross-site" requests (as defined in section 2.1). Note that the mechanism outlined here is backwards compatible with the existing cookie syntax. Servers may serve these cookies to all user agents; those that do not support the "SameSite" attribute will simply store a cookie which is attached to all relevant requests, just as they do today. 1.1. Goals These cookies are intended to provide a solid layer of defense-in- depth against attacks which require embedding an authenticated request into an attacker-controlled context: 1. Timing attacks which yield cross-origin information leakage (such as those detailed in [pixel-perfect]) can be substantially mitigated by setting the "SameSite" attribute on authentication cookies. The attacker will only be able to embed unauthenticated resources, as embedding mechanisms such as "