HTTPbis M. West Internet-Draft Google, Inc Updates: 6265 (if approved) May 13, 2015 Intended status: Standards Track Expires: November 14, 2015 First-Party-Only Cookies draft-west-first-party-cookies-03 Abstract This document updates RFC6265 by defining a "First-Party-Only" attribute which allows servers to assert that a cookie ought to be sent only in a "first-party" context. This assertion allows user agents to mitigate the risk of cross-origin information leakage, and provides some minimal protection against cross-site request forgery attacks. 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 November 14, 2015. Copyright Notice Copyright (c) 2015 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 West Expires November 14, 2015 [Page 1] Internet-Draft first-party-cookies May 2015 the Trust Legal Provisions and are provided without warranty as described in the Simplified BSD License. Table of Contents 1. Introduction . . . . . . . . . . . . . . . . . . . . . . . . 2 1.1. Goals . . . . . . . . . . . . . . . . . . . . . . . . . . 3 1.2. Limitations . . . . . . . . . . . . . . . . . . . . . . . 3 1.3. Examples . . . . . . . . . . . . . . . . . . . . . . . . 4 2. Terminology and notation . . . . . . . . . . . . . . . . . . 4 2.1. First-party and Third-party Requests . . . . . . . . . . 5 2.1.1. Document-based requests . . . . . . . . . . . . . . . 5 2.1.2. Worker-based requests . . . . . . . . . . . . . . . . 7 3. Server Requirements . . . . . . . . . . . . . . . . . . . . . 8 3.1. Grammar . . . . . . . . . . . . . . . . . . . . . . . . . 8 3.2. Semantics of the "First-Party-Only" Attribute (Non- Normative) . . . . . . . . . . . . . . . . . . . . . . . 9 4. User Agent Requirements . . . . . . . . . . . . . . . . . . . 9 4.1. The "First-Party-Only" attribute . . . . . . . . . . . . 9 4.2. Monkey-patching the Storage Model . . . . . . . . . . . . 9 4.3. Monkey-patching the "Cookie" header . . . . . . . . . . . 10 5. Authoring Considerations . . . . . . . . . . . . . . . . . . 10 5.1. Mashups and Widgets . . . . . . . . . . . . . . . . . . . 10 6. Privacy Considerations . . . . . . . . . . . . . . . . . . . 10 7. References . . . . . . . . . . . . . . . . . . . . . . . . . 11 7.1. Normative References . . . . . . . . . . . . . . . . . . 11 7.2. Informative References . . . . . . . . . . . . . . . . . 12 Appendix A. Acknowledgements . . . . . . . . . . . . . . . . . . 12 Author's Address . . . . . . . . . . . . . . . . . . . . . . . . 12 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 "First-party-only", meaning they should be attached to requests if and only if those requests occur in a first-party context (as defined in section 2.1). Note that the mechanism outlined here is backwards compatible with the existing cookie syntax. Servers may serve first-party cookies to all user agents; those that do not support the "First-Party-Only" West Expires November 14, 2015 [Page 2] Internet-Draft first-party-cookies May 2015 attribute will simply store a cookie which is returned in all applicable contexts, just as they do today. 1.1. Goals These first-party-only 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 "First-Party-Only" attribute on authentication cookies. The attacker will only be able to embed unauthenticated resources, as embedding mechanisms such as "