HTTP Working Group                                         M. Nottingham
Intended status: Experimental                                 M. Thomson
Expires: April 7, May 4, 2017                                             Mozilla
                                                        October 4, 31, 2016

                    Opportunistic Security for HTTP


   This document describes how "http" URIs can be accessed using
   Transport Layer Security (TLS) to mitigate pervasive monitoring

Note to Readers

   Discussion of this draft takes place on the HTTP working group
   mailing list (, which is archived at .

   Working Group information can be found at ;
   source code and issues list for this draft can be found at .

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

   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 April 7, May 4, 2017.

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
   ( 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  . . . . . . . . . . . . . . . . . . . . . . . .   2
     1.1.  Goals and Non-Goals . . . . . . . . . . . . . . . . . . .   3
     1.2.  Notational Conventions  . . . . . . . . . . . . . . . . .   3
   2.  Using HTTP URIs over TLS  . . . . . . . . . . . . . . . . . .   3
     2.1.  Alternative Server Opt-In . . . . . . . . . . . . . . . .   4
     2.2.  Interaction with "https" URIs . . . . . . . . . . . . . .   5   4
     2.3.  The "http-opportunistic" well-known URI . . . . . . . . .   5
   3.  IANA Considerations . . . . . . . . . . . . . . . . . . . . .   6   5
   4.  Security Considerations . . . . . . . . . . . . . . . . . . .   6   5
     4.1.  Security Indicators . . . . . . . . . . . . . . . . . . .   6
     4.2.  Downgrade Attacks . . . . . . . . . . . . . . . . . . . .   6
     4.3.  Privacy Considerations  . . . . . . . . . . . . . . . . .   6
     4.4.  Confusion Regarding Request Scheme  . . . . . . . . . . .   7   6
     4.5.  Server Controls . . . . . . . . . . . . . . . . . . . . .   7
   5.  References  . . . . . . . . . . . . . . . . . . . . . . . . .   7
     5.1.  Normative References  . . . . . . . . . . . . . . . . . .   7
     5.2.  Informative References  . . . . . . . . . . . . . . . . .   8
   Appendix A.  Acknowledgements . . . . . . . . . . . . . . . . . .   9   8
   Authors' Addresses  . . . . . . . . . . . . . . . . . . . . . . .   9

1.  Introduction

   This document describes a use of HTTP Alternative Services [RFC7838]
   to decouple the URI scheme from the use and configuration of
   underlying encryption, allowing a "http" URI [RFC7230] to be accessed
   using Transport Layer Security (TLS) [RFC5246] opportunistically.

   Serving "https" URIs requires avoiding Mixed Content
   [W3C.CR-mixed-content-20160802], which is problematic in many
   deployments.  This document describes a usage model whereby sites can
   serve "http" URIs over TLS, thereby avoiding these issues, while
   still providing protection against passive attacks.

   Opportunistic Security [RFC7435] does not provide the same guarantees
   as using TLS with "https" URIs; it is vulnerable to active attacks,
   and does not change the security context of the connection.

   Normally, users will not be able to tell that it is in use (i.e.,
   there will be no "lock icon").

1.1.  Goals and Non-Goals

   The immediate goal is to make the use of HTTP more robust in the face
   of pervasive passive monitoring [RFC7258].

   A secondary (but significant) goal is to provide for ease of
   implementation, deployment and operation.  This mechanism is expected
   to have a minimal impact upon performance, and require a trivial
   administrative effort to configure.

   Preventing active attacks (such as a Man-in-the-Middle) is a non-goal
   for this specification.  Furthermore, this specification is not
   intended to replace or offer an alternative to "https", since it both
   prevents active attacks and invokes a more stringent security model
   in most clients.

1.2.  Notational Conventions

   The key words "MUST", "MUST NOT", "REQUIRED", "SHALL", "SHALL NOT",
   document are to be interpreted as described in [RFC2119].

2.  Using HTTP URIs over TLS

   An origin server that supports the resolution of "http" URIs can
   indicate support for this specification by providing an alternative
   service advertisement [RFC7838] for a protocol identifier that uses
   TLS, such as "h2" [RFC7540]. [RFC7540], or "http/1.1" [RFC7301].  Note that
   HTTP/1.1 requests MUST use the absolute form (see Section 5.3.2 of

   A client that receives such an advertisement MAY make future requests
   intended for the associated origin ([RFC6454]) to the identified
   service (as specified by [RFC7838]), provided that the alternative
   service opts in as described in Section 2.1.

   A client that places the importance of protection against passive
   attacks over performance might choose to withhold requests until an
   encrypted connection is available.  However, if such a connection
   cannot be successfully established, the client can resume its use of
   the cleartext connection.

   A client can also explicitly probe for an alternative service
   advertisement by sending a request that bears little or no sensitive
   information, such as one with the OPTIONS method.  Likewise, clients
   with existing alternative services information could make such a
   request before they expire, in order minimize the delays that might
   be incurred.

   Client certificates are not meaningful for URLs with the "http"
   scheme, and therefore clients creating new TLS connections to
   alternative services for the purposes of this specification MUST NOT
   present them.  Established connections with  Connections that use client certificates for other
   reasons MAY be reused, however. though client certificates MUST NOT affect the
   responses to requests for "http" resources.

2.1.  Alternative Server Opt-In

   It is possible that the server might become confused about whether
   requests' URLs have a "http" or "https" scheme, for various reasons;
   see Section 4.4.  To ensure that the alternative service has opted
   into serving "http" URLs over TLS, clients are required to perform
   additional checks before directing "http" requests to it.

   Clients MUST NOT send "http" requests over a connection with the "h2"
   protocol identifier, secured connection,
   unless they have obtained a valid http-
   opportunistic response for an origin (as per Section 2.3), and:

   o  The the chosen alternative service presents a certificate that is
   valid for the origin, origin - as per [RFC2818] (this also establishes
   "reasonable assurances" for the purposes of {RFC7838}}), {RFC7838}}) - and

   o  The origin object of the they
   have obtained a valid http-opportunistic response has a `tls-
      ports' member, whose value is for an array of numbers, one of which
      matches the port of the alternative service in question, and

   o  The chosen alternative service returns the same representation as
      the origin did for the http-opportunistic resource. (as
   per Section 2.3).

   For example, this assuming the following request is made over a TLS
   connection that is successfully authenticated for those origins, the
   following request/response pair would allow reqeusts requests for the
   origin origins
   "" or "" to be sent to an alternative service
   on port 443 or 8000 of the host "": using a
   secured connection:

   GET /.well-known/http-opportunistic HTTP/1.1

   HTTP/1.1 200 OK
   Content-Type: application/json
   Connection: close

     "": {
       "tls-ports": [443, 8000],
       "lifetime": 2592000

   [ "", "" ]

2.2.  Interaction with "https" URIs

   When using alternative services, requests for resources identified by
   both "http" and "https" URIs might use the same connection, because
   HTTP/2 permits requests for multiple origins on the same connection.

   Because of the risk of potential for server confusion about individual requests'
   schemes the scheme of
   requests (see Section 4.4), clients MUST NOT send "http" requests on
   a connection prior to successfully retrieving a valid http-
   opportunistic resource that has previously been used for "https" requests, unless contains the http-opportunistic origin object (see Section 2.3 fetched over 2.3).
   The primary purpose of this check is to provide a client with some
   assurance that
   connection has a "mixed-scheme" member whose value is "true". server understands this specification and has taken
   steps to avoid being confused about request scheme.

2.3.  The "http-opportunistic" well-known URI

   This specification defines the "http-opportunistic" well-known URI
   [RFC5785].  A client is said to have a valid http-opportunistic
   response for a given origin when:

   o  The client has obtained a 200 (OK) response for the well-known URI
      from the origin, and it is fresh [RFC7234] (potentially through
      revalidation [RFC7232]), and

   o  That response has the media type "application/json", and

   o  That response's payload, when parsed as JSON [RFC7159], contains
      an object array as the root, and

   o  The root object array contains a member whose name string that is a case-insensitive
      character-for-character character-
      for-character match for the origin in question, serialised into
      Unicode as per Section 6.1 of [RFC6454], and whose
      value is [RFC6454].

   A client MAY treat an object (hereafter, the "origin object"),

   o  The origin object has a "lifetime" member, whose value is a number
      indicating the number of seconds which the origin object is valid
      for (hereafter, the "origin object lifetime"), and

   o  The origin object lifetime is greater than "http-opportunistic" resource as invalid if the "current_age" (as
      per [RFC7234], Section 4.2.3).

   contains values that origin object lifetime might differ from the freshness
   lifetime of the response. are not strings.

3.  IANA Considerations

   This specification registers a Well-Known URI [RFC5785]:

   o  URI Suffix: http-opportunistic

   o  Change Controller: IETF

   o  Specification Document(s): Section 2.3 of [this specification]

   o  Related Information:

4.  Security Considerations
4.1.  Security Indicators

   User Agents MUST NOT provide any special security indicia when an
   "http" resource is acquired using TLS.  In particular, indicators
   that might suggest the same level of security as "https" MUST NOT be
   used (e.g., a "lock device").

4.2.  Downgrade Attacks

   A downgrade attack against the negotiation for TLS is possible.

   For example, because the "Alt-Svc" header field [RFC7838] likely
   appears in an unauthenticated and unencrypted channel, it is subject
   to downgrade by network attackers.  In its simplest form, an attacker
   that wants the connection to remain in the clear need only strip the
   "Alt-Svc" header field from responses.

4.3.  Privacy Considerations

   Cached alternative services can be used to track clients over time;
   e.g., using a user-specific hostname.  Clearing the cache reduces the
   ability of servers to track clients; therefore clients MUST clear
   cached alternative service information when clearing other origin-
   based state (i.e., cookies).

4.4.  Confusion Regarding Request Scheme

   HTTP implementations and applications sometimes use ambient signals
   to determine if a request is for an "https" resource; for example,
   they might look for TLS on the stack, or a server port number of 443.

   This might be due to limitations in the protocol (the most common
   HTTP/1.1 request form does not carry an explicit indication of the
   URI scheme), or it may be because how the server and application are
   implemented (often, they are two separate entities, with a variety of
   possible interfaces between them).

   Any security decisions based upon this information could be misled by
   the deployment of this specification, because it violates the
   assumption that the use of TLS (or port 443) means that the client is
   accessing a HTTPS URI, and operating in the security context implied
   by HTTPS.

   Therefore, servers need to carefully examine the use of such signals
   before deploying this specification.

4.5.  Server Controls

   This specification requires that a server send both an Alternative
   Service advertisement and host content in a well-known location to
   send HTTP requests over TLS.  Servers SHOULD take suitable measures
   to ensure that the content of the well-known resource remains under
   their control.  Likewise, because the Alt-Svc header field is used to
   describe policies across an entire origin, servers SHOULD NOT permit
   user content to set or modify the value of this header.

5.  References

5.1.  Normative References

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

   [RFC2818]  Rescorla, E., "HTTP Over TLS", RFC 2818,
              DOI 10.17487/RFC2818, May 2000,

   [RFC5246]  Dierks, T. and E. Rescorla, "The Transport Layer Security
              (TLS) Protocol Version 1.2", RFC 5246,
              DOI 10.17487/RFC5246, August 2008,

   [RFC5785]  Nottingham, M. and E. Hammer-Lahav, "Defining Well-Known
              Uniform Resource Identifiers (URIs)", RFC 5785,
              DOI 10.17487/RFC5785, April 2010,

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

   [RFC7159]  Bray, T., Ed., "The JavaScript Object Notation (JSON) Data
              Interchange Format", RFC 7159, DOI 10.17487/RFC7159, March
              2014, <>.

   [RFC7230]  Fielding, R., Ed. and J. Reschke, Ed., "Hypertext Transfer
              Protocol (HTTP/1.1): Message Syntax and Routing",
              RFC 7230, DOI 10.17487/RFC7230, June 2014,

   [RFC7232]  Fielding, R., Ed. and J. Reschke, Ed., "Hypertext Transfer
              Protocol (HTTP/1.1): Conditional Requests", RFC 7232,
              DOI 10.17487/RFC7232, June 2014,

   [RFC7234]  Fielding, R., Ed., Nottingham, M., Ed., and J. Reschke,
              Ed., "Hypertext Transfer Protocol (HTTP/1.1): Caching",
              RFC 7234, DOI 10.17487/RFC7234, June 2014,

   [RFC7540]  Belshe, M., Peon, R., and M. Thomson, Ed., "Hypertext
              Transfer Protocol Version 2 (HTTP/2)", RFC 7540,
              DOI 10.17487/RFC7540, May 2015,

   [RFC7838]  Nottingham, M., McManus, P., and J. Reschke, "HTTP
              Alternative Services", RFC 7838, DOI 10.17487/RFC7838,
              April 2016, <>.

5.2.  Informative References

   [RFC7258]  Farrell, S. and H. Tschofenig, "Pervasive Monitoring Is an
              Attack", BCP 188, RFC 7258, DOI 10.17487/RFC7258, May
              2014, <>.

   [RFC7301]  Friedl, S., Popov, A., Langley, A., and E. Stephan,
              "Transport Layer Security (TLS) Application-Layer Protocol
              Negotiation Extension", RFC 7301, DOI 10.17487/RFC7301,
              July 2014, <>.

   [RFC7435]  Dukhovni, V., "Opportunistic Security: Some Protection
              Most of the Time", RFC 7435, DOI 10.17487/RFC7435,
              December 2014, <>.

   [RFC7469]  Evans, C., Palmer, C., and R. Sleevi, "Public Key Pinning
              Extension for HTTP", RFC 7469, DOI 10.17487/RFC7469, April
              2015, <>.

              West, M., "Mixed Content", World Wide Web Consortium CR
              CR-mixed-content-20160802, August 2016,

Appendix A.  Acknowledgements

   Mike Bishop contributed significant text to this document.

   Thanks to Patrick McManus, Stefan Eissing, Eliot Lear, Stephen
   Farrell, Guy Podjarny, Stephen Ludin, Erik Nygren, Paul Hoffman, Adam
   Langley, Eric Rescorla, Julian Reschke, Kari Hurtta, and Richard
   Barnes for their feedback and suggestions.

Authors' Addresses

   Mark Nottingham


   Martin Thomson