Opportunistic Security for HTTPmnot@mnot.nethttp://www.mnot.net/Mozillamartin.thomson@gmail.com
Applications and Real-Time
HTTPInternet-DraftThis document describes how http URIs can be accessed using Transport Layer Security (TLS) to
mitigate pervasive monitoring attacks.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/opp-sec.This document describes a use of HTTP Alternative Services to decouple
the URI scheme from the use and configuration of underlying encryption, allowing a http URI
to be accessed using Transport Layer Security (TLS) opportunistically.Serving https URIs require acquiring and configuring a valid certificate, which means that some
deployments find supporting TLS difficult. This document describes a usage model whereby sites can
serve http URIs over TLS without being required to support strong server authentication.Opportunistic Security 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”).A mechanism for partially mitigating active attacks is described in .The immediate goal is to make the use of HTTP more robust in the face of pervasive passive
monitoring .A secondary goal is to limit the potential for active attacks. It is not intended to offer the same
level of protection as afforded to https URIs, but instead to increase the likelihood that an
active attack can be detected.A final (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.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
.An origin server that supports the resolution of http URIs can indicate support for this
specification by providing an alternative service advertisement for a protocol
identifier that uses TLS, such as h2.A client that receives such an advertisement MAY make future requests intended for the associated
origin () to the identified service (as specified by ).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. requires that an alternative service only be used when there are “reasonable
assurances” that it is under control of and valid for the whole origin.As defined in that specification, a client can establish reasonable assurances when using a
TLS-based protocol with the certificate checks defined in .For the purposes of this specification, an additional way of establishing reasonable assurances is
available when the alternative is on the same host as the origin, using the “http-opportunistic”
well-known URI defined in .This allows deployment without the use of valid certificates, to encourage deployment of
opportunistic security. When it is in use, the alternative service can provide any certificate, or
even select TLS cipher suites that do not include authentication.When a client has a valid http-opportunistic response for an origin (as per ), it MAY
consider there to be reasonable assurances as long as:The origin and alternative service’s hostnames are the same when compared in a case-insensitive
fashion, andThe origin object of the http-opportunistic response has a `tls-ports’ member, whose value is an
array of numbers, one of which matches the port of the alternative service in question, andThe chosen alternative service returns the same representation as the origin did for the
http-opportunistic resource.For example, this request/response pair would constitute reasonable assurances for the origin
“http://www.example.com” for an alternative service on port 443 or 8000 of the host
“www.example.com”:Note that this mechanism is only defined to establish reasonable assurances for the purposes of this
specification; it does not apply to other uses of alternative services unless they explicitly invoke
it.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.Since https URIs rely on server authentication, a connection that is initially created for http
URIs without authenticating the server cannot be used for https URIs until the server certificate
is successfully authenticated. Section 3.1 of describes the basic mechanism, though the
authentication considerations in Section 2.1 of also apply.Connections that are established without any means of server authentication (for instance, the
purely anonymous TLS cipher suites) cannot be used for https URIs.Even when the alternative service is strongly authenticated, opportunistically upgrading cleartext
HTTP connections to use TLS is subject to active attacks. In particular:Because the original HTTP connection is in cleartext, it is vulnerable to man-in-the-middle
attacks, andBy default, if clients cannot reach the alternative service, they will fall back to using the
original cleartext origin.Given that the primary goal of this specification is to prevent passive attacks, these are not
critical failings (especially considering the alternative - HTTP over cleartext). However, a modest
form of protection against active attacks can be provided for clients on subsequent connections.When an origin is able to commit to providing service for a particular origin over TLS for a bounded
period of time, clients can choose to rely upon its availability, failing when it cannot be
contacted. Effectively, this makes the choice to use a secured protocol “sticky”.An origin can reduce the risk of attacks on opportunistically secured connections by committing to
provide a secured, authenticated alternative service. This is done by including the optional
tls-commit member in the origin object of the http-opportunistic well-known response (see
).This feature is optional due to the requirement for server authentication and the potential risk
entailed (see ).The value of the tls-commit member is a number (, Section 6) indicating the duration
of the commitment interval in seconds.Including tls-commit creates a commitment to provide a secured alternative service for the
advertised period. Clients that receive this commitment can assume that a secured alternative
service will be available for the indicated period. Clients might however choose to limit this time
(see ).The value of the tls-commit member MUST be ignored unless the alternative service can be strongly
authenticated. The same authentication requirements that apply to https:// resources SHOULD be
applied to authenticating the alternative. Minimum authentication requirements for HTTP over TLS
are described in Section 2.1 of and Section 3.1 of . As noted in
, clients can impose other checks in addition to this minimum set. For instance, a
client might choose to apply key pinning .A client that receives a commitment and that successfully authenticates the alternative service can
assume that a secured alternative will remain available for the commitment interval. The commitment
interval starts when the commitment is received and authenticated and runs for a number of seconds
equal to value of the tls-commit member, less the current age of the http-opportunistic response
(as defined in Section 4.2.3 of ). Note that the commitment interval MAY exceed the
freshness lifetime of the “http-opportunistic” resource.A client SHOULD avoid sending requests via cleartext protocols or to unauthenticated alternative
services for the duration of the commitment interval, except to discover new potential alternatives.A commitment is not bound to a particular alternative service. Clients are able to use alternative
services that they become aware of. However, once a valid and authenticated commitment has been
received, clients SHOULD NOT use an unauthenticated alternative service. Where there is an active
commitment, clients SHOULD ignore advertisements for unsecured alternative services. A client MAY
send requests to an unauthenticated origin in an attempt to discover potential alternative services,
but these requests SHOULD be entirely generic and avoid including credentials.Errors in configuration of commitments has the potential to render even the unsecured origin
inaccessible for the duration of a commitment. Initial deployments are encouraged to use short
duration commitments so that errors can be detected without causing the origin to become
inaccessible to clients for extended periods.To avoid situations where a commitment causes errors, clients MAY limit the time over which a
commitment is respected for a given origin. A lower limit might be appropriate for initial
commitments; the certainty that a site has set a correct value - and the corresponding limit on
persistence - might increase as a commitment is renewed multiple times.This specification defines the “http-opportunistic” well-known URI . A client is said
to have a valid http-opportunistic response for a given origin when:The client has obtained a 200 (OK) response for the well-known URI from the origin, and it is fresh (potentially through revalidation ), andThat response has the media type “application/json”, andThat response’s payload, when parsed as JSON , contains an object as the root.The root object contains a member whose name is a case-insensitive
character-for-character match for the origin in question, serialised into Unicode as per Section
6.1 of , and whose value is an object (hereafter, the “origin object”).This specification registers a Well-Known URI :URI Suffix: http-opportunisticChange Controller: IETFSpecification Document(s): of [this specification]Related Information: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”).A downgrade attack against the negotiation for TLS is possible. With commitment (see ),
this is limited to occasions where clients have no prior information (see ), or when
persisted commitments have expired.For example, because the Alt-Svc header field 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.Downgrade attacks can be partially mitigated using the tls-commit member of the
http-opportunistic well-known resource, because when it is used, a client can avoid using cleartext
to contact a supporting server. However, this only works when a previous connection has been
established without an active attacker present; a continuously present active attacker can either
prevent the client from ever using TLS, or offer its own certificate.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).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.Because this specification allows “reasonable assurances” to be established by the content of a
well-known URI, servers SHOULD take suitable measures to assure that its content 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.Key words for use in RFCs to Indicate Requirement LevelsIn many standards track documents several words are used to signify the requirements in the specification. These words are often capitalized. This document defines these words as they should be interpreted in IETF documents. This document specifies an Internet Best Current Practices for the Internet Community, and requests discussion and suggestions for improvements.HTTP Over TLSThis memo describes how to use Transport Layer Security (TLS) to secure Hypertext Transfer Protocol (HTTP) connections over the Internet. This memo provides information for the Internet community.The Transport Layer Security (TLS) Protocol Version 1.2This document specifies Version 1.2 of the Transport Layer Security (TLS) protocol. The TLS protocol provides communications security over the Internet. The protocol allows client/server applications to communicate in a way that is designed to prevent eavesdropping, tampering, or message forgery. [STANDARDS-TRACK]Defining Well-Known Uniform Resource Identifiers (URIs)This memo defines a path prefix for "well-known locations", "/.well-known/", in selected Uniform Resource Identifier (URI) schemes. [STANDARDS-TRACK]The Web Origin ConceptThis document defines the concept of an "origin", which is often used as the scope of authority or privilege by user agents. Typically, user agents isolate content retrieved from different origins to prevent malicious web site operators from interfering with the operation of benign web sites. In addition to outlining the principles that underlie the concept of origin, this document details how to determine the origin of a URI and how to serialize an origin into a string. It also defines an HTTP header field, named "Origin", that indicates which origins are associated with an HTTP request. [STANDARDS-TRACK]The JavaScript Object Notation (JSON) Data Interchange FormatJavaScript Object Notation (JSON) is a lightweight, text-based, language-independent data interchange format. It was derived from the ECMAScript Programming Language Standard. JSON defines a small set of formatting rules for the portable representation of structured data.This document removes inconsistencies with other specifications of JSON, repairs specification errors, and offers experience-based interoperability guidance.Hypertext Transfer Protocol (HTTP/1.1): Message Syntax and RoutingThe Hypertext Transfer Protocol (HTTP) is a stateless application-level protocol for distributed, collaborative, hypertext information systems. This document provides an overview of HTTP architecture and its associated terminology, defines the "http" and "https" Uniform Resource Identifier (URI) schemes, defines the HTTP/1.1 message syntax and parsing requirements, and describes related security concerns for implementations.Hypertext Transfer Protocol (HTTP/1.1): Conditional RequestsThe Hypertext Transfer Protocol (HTTP) is a stateless application- level protocol for distributed, collaborative, hypertext information systems. This document defines HTTP/1.1 conditional requests, including metadata header fields for indicating state changes, request header fields for making preconditions on such state, and rules for constructing the responses to a conditional request when one or more preconditions evaluate to false.Hypertext Transfer Protocol (HTTP/1.1): CachingThe Hypertext Transfer Protocol (HTTP) is a stateless \%application- level protocol for distributed, collaborative, hypertext information systems. This document defines HTTP caches and the associated header fields that control cache behavior or indicate cacheable response messages.Hypertext Transfer Protocol Version 2 (HTTP/2)This specification describes an optimized expression of the semantics of the Hypertext Transfer Protocol (HTTP), referred to as HTTP version 2 (HTTP/2). HTTP/2 enables a more efficient use of network resources and a reduced perception of latency by introducing header field compression and allowing multiple concurrent exchanges on the same connection. It also introduces unsolicited push of representations from servers to clients.This specification is an alternative to, but does not obsolete, the HTTP/1.1 message syntax. HTTP's existing semantics remain unchanged.HTTP Alternative ServicesThis document specifies "Alternative Services" for HTTP, which allow an origin's resources to be authoritatively available at a separate network location, possibly accessed with a different protocol configuration.Pervasive Monitoring Is an AttackPervasive monitoring is a technical attack that should be mitigated in the design of IETF protocols, where possible.Opportunistic Security: Some Protection Most of the TimeThis document defines the concept "Opportunistic Security" in the context of communications protocols. Protocol designs based on Opportunistic Security use encryption even when authentication is not available, and use authentication when possible, thereby removing barriers to the widespread use of encryption on the Internet.Public Key Pinning Extension for HTTPThis document defines a new HTTP header that allows web host operators to instruct user agents to remember ("pin") the hosts' cryptographic identities over a period of time. During that time, user agents (UAs) will require that the host presents a certificate chain including at least one Subject Public Key Info structure whose fingerprint matches one of the pinned fingerprints for that host. By effectively reducing the number of trusted authorities who can authenticate the domain during the lifetime of the pin, pinning may reduce the incidence of man-in-the-middle attacks due to compromised Certification Authorities.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.