draft-ietf-websec-key-pinning-04.txt   draft-ietf-websec-key-pinning-05.txt 
Web Security C. Evans Web Security C. Evans
Internet-Draft C. Palmer Internet-Draft C. Palmer
Intended status: Standards Track R. Sleevi Intended status: Standards Track R. Sleevi
Expires: June 10, 2013 Google, Inc. Expires: December 09, 2013 Google, Inc.
December 7, 2012 June 07, 2013
Public Key Pinning Extension for HTTP Public Key Pinning Extension for HTTP
draft-ietf-websec-key-pinning-04 draft-ietf-websec-key-pinning-05
Abstract Abstract
This memo describes an extension to the HTTP protocol allowing web This memo describes an extension to the HTTP protocol allowing web
host operators to instruct user agents (UAs) to remember ("pin") the host operators to instruct user agents (UAs) to remember ("pin") the
hosts' cryptographic identities for a given period of time. During hosts' cryptographic identities for a given period of time. During
that time, UAs will require that the host present a certificate chain that time, UAs will require that the host present a certificate chain
including at least one Subject Public Key Info structure whose including at least one Subject Public Key Info structure whose
fingerprint matches one of the pinned fingerprints for that host. By fingerprint matches one of the pinned fingerprints for that host. By
effectively reducing the number of authorities who can authenticate effectively reducing the number of authorities who can authenticate
the domain during the lifetime of the pin, pinning may reduce the the domain during the lifetime of the pin, pinning may reduce the
incidence of man-in-the-middle attacks due to compromised incidence of man-in-the-middle attacks due to compromised
Certification Authorities. Certification Authorities.
Status of this Memo Status of This Memo
This Internet-Draft is submitted in full conformance with the This Internet-Draft is submitted in full conformance with the
provisions of BCP 78 and BCP 79. provisions of BCP 78 and BCP 79.
Internet-Drafts are working documents of the Internet Engineering Internet-Drafts are working documents of the Internet Engineering
Task Force (IETF). Note that other groups may also distribute Task Force (IETF). Note that other groups may also distribute
working documents as Internet-Drafts. The list of current Internet- working documents as Internet-Drafts. The list of current Internet-
Drafts is at http://datatracker.ietf.org/drafts/current/. Drafts is at http://datatracker.ietf.org/drafts/current/.
Internet-Drafts are draft documents valid for a maximum of six months Internet-Drafts are draft documents valid for a maximum of six months
and may be updated, replaced, or obsoleted by other documents at any and may be updated, replaced, or obsoleted by other documents at any
time. It is inappropriate to use Internet-Drafts as reference time. It is inappropriate to use Internet-Drafts as reference
material or to cite them other than as "work in progress." material or to cite them other than as "work in progress."
This Internet-Draft will expire on June 10, 2013. This Internet-Draft will expire on December 09, 2013.
Copyright Notice Copyright Notice
Copyright (c) 2012 IETF Trust and the persons identified as the Copyright (c) 2013 IETF Trust and the persons identified as the
document authors. All rights reserved. document authors. All rights reserved.
This document is subject to BCP 78 and the IETF Trust's Legal This document is subject to BCP 78 and the IETF Trust's Legal
Provisions Relating to IETF Documents Provisions Relating to IETF Documents
(http://trustee.ietf.org/license-info) in effect on the date of (http://trustee.ietf.org/license-info) in effect on the date of
publication of this document. Please review these documents publication of this document. Please review these documents
carefully, as they describe your rights and restrictions with respect carefully, as they describe your rights and restrictions with respect
to this document. Code Components extracted from this document must to this document. Code Components extracted from this document must
include Simplified BSD License text as described in Section 4.e of include Simplified BSD License text as described in Section 4.e of
the Trust Legal Provisions and are provided without warranty as the Trust Legal Provisions and are provided without warranty as
described in the Simplified BSD License. described in the Simplified BSD License.
Table of Contents Table of Contents
1. Introduction . . . . . . . . . . . . . . . . . . . . . . . . . 3 1. Introduction . . . . . . . . . . . . . . . . . . . . . . . . 3
1.1. Requirements Language . . . . . . . . . . . . . . . . . . 3 1.1. Requirements Language . . . . . . . . . . . . . . . . . . 3
2. Server and Client Behavior . . . . . . . . . . . . . . . . . . 3 2. Server and Client Behavior . . . . . . . . . . . . . . . . . 3
2.1. Response Header Field Syntax . . . . . . . . . . . . . . . 3 2.1. Response Header Field Syntax . . . . . . . . . . . . . . 3
2.1.1. The max-age Directive . . . . . . . . . . . . . . . . 5 2.1.1. The max-age Directive . . . . . . . . . . . . . . . . 5
2.1.2. The includeSubDomains Directive . . . . . . . . . . . 5 2.1.2. The includeSubDomains Directive . . . . . . . . . . . 5
2.1.3. The report-uri Directive . . . . . . . . . . . . . . . 5 2.1.3. The report-uri Directive . . . . . . . . . . . . . . 5
2.1.4. The strict Directive . . . . . . . . . . . . . . . . . 6 2.1.4. The strict Directive . . . . . . . . . . . . . . . . 6
2.1.5. Examples . . . . . . . . . . . . . . . . . . . . . . . 6 2.1.5. Examples . . . . . . . . . . . . . . . . . . . . . . 6
2.2. Server Processing Model . . . . . . . . . . . . . . . . . 6 2.2. Server Processing Model . . . . . . . . . . . . . . . . . 7
2.2.1. HTTP-over-Secure-Transport Request Type . . . . . . . 6 2.2.1. HTTP-over-Secure-Transport Request Type . . . . . . . 7
2.2.2. HTTP Request Type . . . . . . . . . . . . . . . . . . 7 2.2.2. HTTP Request Type . . . . . . . . . . . . . . . . . . 7
2.3. User Agent Processing Model . . . . . . . . . . . . . . . 7 2.3. User Agent Processing Model . . . . . . . . . . . . . . . 8
2.3.1. Public-Key-Pins Response Header Field Processing . . . 7 2.3.1. Public-Key-Pins Response Header Field Processing . . 8
2.3.2. Noting a Pinned Host - Storage Model . . . . . . . . . 8 2.3.2. Noting a Pinned Host - Storage Model . . . . . . . . 9
2.3.3. HTTP-Equiv <Meta> Element Attribute . . . . . . . . . 8 2.3.3. HTTP-Equiv <Meta> Element Attribute . . . . . . . . . 9
2.3.4. UA Processing Examples . . . . . . . . . . . . . . . . 8 2.3.4. UA Processing Examples . . . . . . . . . . . . . . . 9
2.4. Semantics of Pins . . . . . . . . . . . . . . . . . . . . 9 2.4. Semantics of Pins . . . . . . . . . . . . . . . . . . . . 10
2.5. Noting Pins . . . . . . . . . . . . . . . . . . . . . . . 9 2.5. Noting Pins . . . . . . . . . . . . . . . . . . . . . . . 11
2.6. Validating Pinned Connections . . . . . . . . . . . . . . 11 2.6. Validating Pinned Connections . . . . . . . . . . . . . . 11
2.7. Interactions With Preloaded Pin Lists . . . . . . . . . . 11 2.7. Interactions With Preloaded Pin Lists . . . . . . . . . . 12
2.8. Pinning Self-Signed End Entities . . . . . . . . . . . . . 12 2.8. Pinning Self-Signed End Entities . . . . . . . . . . . . 13
3. Reporting Pin Validation Failure . . . . . . . . . . . . . . . 12 3. Reporting Pin Validation Failure . . . . . . . . . . . . . . 13
4. Security Considerations . . . . . . . . . . . . . . . . . . . 13 4. Security Considerations . . . . . . . . . . . . . . . . . . . 14
4.1. Backup Pins . . . . . . . . . . . . . . . . . . . . . . . 14 4.1. Maximum max-age . . . . . . . . . . . . . . . . . . . . . 15
5. IANA Considerations . . . . . . . . . . . . . . . . . . . . . 14 4.2. Using includeSubdomains Safely . . . . . . . . . . . . . 16
6. Usability Considerations . . . . . . . . . . . . . . . . . . . 14 4.3. Backup Pins . . . . . . . . . . . . . . . . . . . . . . . 16
7. Acknowledgements . . . . . . . . . . . . . . . . . . . . . . . 14 5. IANA Considerations . . . . . . . . . . . . . . . . . . . . . 17
8. What's Changed . . . . . . . . . . . . . . . . . . . . . . . . 14 6. Usability Considerations . . . . . . . . . . . . . . . . . . 17
9. References . . . . . . . . . . . . . . . . . . . . . . . . . . 15 7. Acknowledgements . . . . . . . . . . . . . . . . . . . . . . 17
9.1. Normative References . . . . . . . . . . . . . . . . . . . 15 8. What's Changed . . . . . . . . . . . . . . . . . . . . . . . 17
9.2. Informative References . . . . . . . . . . . . . . . . . . 16 9. References . . . . . . . . . . . . . . . . . . . . . . . . . 18
Appendix A. Fingerprint Generation . . . . . . . . . . . . . . . 16 9.1. Normative References . . . . . . . . . . . . . . . . . . 18
Appendix B. Deployment Guidance . . . . . . . . . . . . . . . . . 17 9.2. Informative References . . . . . . . . . . . . . . . . . 19
Authors' Addresses . . . . . . . . . . . . . . . . . . . . . . . . 18 Appendix A. Fingerprint Generation . . . . . . . . . . . . . . . 19
Appendix B. Deployment Guidance . . . . . . . . . . . . . . . . 20
Authors' Addresses . . . . . . . . . . . . . . . . . . . . . . . 21
1. Introduction 1. Introduction
We propose a new HTTP header to enable a web host to express to user We propose a new HTTP header to enable a web host to express to user
agents (UAs) which Subject Public Key Info (SPKI) structure(s) UAs agents (UAs) which Subject Public Key Info (SPKI) structure(s) UAs
SHOULD expect to be present in the host's certificate chain in future SHOULD expect to be present in the host's certificate chain in future
connections using TLS (see [RFC5246]). We call this "public key connections using TLS (see [RFC5246]). We call this "public key
pinning". At least one UA (Google Chrome) has experimented with pinning". At least one UA (Google Chrome) has experimented with
shipping with a user-extensible embedded set of pins. Although shipping with a user-extensible embedded set of pins. Although
effective, this does not scale. This proposal addresses the scale effective, this does not scale. This proposal addresses the scale
skipping to change at page 4, line 5 skipping to change at page 3, line 50
indicates to a UA that it SHOULD perform Pin Validation (Section 2.6) indicates to a UA that it SHOULD perform Pin Validation (Section 2.6)
in regards to the host emitting the response message containing this in regards to the host emitting the response message containing this
header field, and provides the necessary information for the UA to do header field, and provides the necessary information for the UA to do
so. so.
Figure 1 describes the ABNF (Augmented Backus-Naur Form) syntax of Figure 1 describes the ABNF (Augmented Backus-Naur Form) syntax of
the header field. It is based on the Generic Grammar defined in the header field. It is based on the Generic Grammar defined in
Section 2 of [RFC2616] (which includes a notion of "implied linear Section 2 of [RFC2616] (which includes a notion of "implied linear
whitespace", also known as "implied *LWS"). whitespace", also known as "implied *LWS").
Public-Key-Pins = Public-Key-Pins =
"Public-Key-Pins" ":" [ directive ] *( ";" [ directive ] ) "Public-Key-Pins" ":" [ directive ] *( ";" [ directive ] )
Public-Key-Pins-Report-Only = Public-Key-Pins-Report-Only =
"Public-Key-Pins-Report-Only" ":" [ directive ] *( ";" [ directive ] ) "Public-Key-Pins-Report-Only" ":" [ directive ] *( ";" [ directive ] )
directive = simple-directive directive = simple-directive
/ pin-directive / pin-directive
simple-directive = directive-name [ "=" directive-value ] simple-directive = directive-name [ "=" directive-value ]
directive-name = token directive-name = token
directive-value = token directive-value = token
/ quoted-string / quoted-string
pin-directive = "pin-" token "=" quoted-string pin-directive = "pin-" token "=" quoted-string
Figure 1: HPKP Header Syntax Figure 1: HPKP Header Syntax
token and quoted-string are used as defined in [RFC2616], Section token and quoted-string are used as defined in [RFC2616],
2.2. Section 2.2.
The directives defined in this specification are described below. The directives defined in this specification are described below.
The overall requirements for directives are: The overall requirements for directives are:
1. The order of appearance of directives is not significant. 1. The order of appearance of directives is not significant.
2. All simple-directives MUST appear only once in a PKP header 2. All simple-directives MUST appear only once in a PKP header
field. Directives are either optional or required, as stipulated field. Directives are either optional or required, as stipulated
in their definitions. in their definitions.
skipping to change at page 5, line 46 skipping to change at page 5, line 43
which, if present (i.e., it is "asserted"), signals to the UA that which, if present (i.e., it is "asserted"), signals to the UA that
the Pinning Policy applies to this Pinned Host as well as any the Pinning Policy applies to this Pinned Host as well as any
subdomains of the host's domain name. subdomains of the host's domain name.
2.1.3. The report-uri Directive 2.1.3. The report-uri Directive
The OPTIONAL "report-uri" directive indicates the URI to which the UA The OPTIONAL "report-uri" directive indicates the URI to which the UA
SHOULD report Pin Validation failures (Section 2.6). The UA POSTs SHOULD report Pin Validation failures (Section 2.6). The UA POSTs
the reports to the given URI as described in Section 3. the reports to the given URI as described in Section 3.
TODO: Describe the meaning of Public-Key-Pins-Report-Only and the When used in the Public-Key-Pins-Report-Only header, the UA SHOULD
interaction between it and report-uri. In particular, describe how POST reports for Pin Validation failures to the indicated report-uri,
it is possible to be in enforcement mode (i.e. not -Report-Only) and although the UA MUST NOT enforce Pin Validation. That is, in the
still POST reports to the report-uri. event of Pin Validation failure when the host has set the Public-Key-
Pins-Report-Only header, the UA performs Pin Validation only to check
whether or not it should POST a report, but not for causing
connection failure.
If a Host sets both the Public-Key-Pins header and the Public-Key-
Pins-Report-Only header, the UA MUST NOT enforce Pin Validation, and
MUST note only the pins and directives given in the Public-Key-Pins-
Report-Only header.
When used in the Public-Key-Pins header, the presence of a report-uri
directive indicates to the UA that the UA MUST enforce Pin
Validation, and the UA SHOULD also, in the event of Pin Validation
failure, POST a report to the report-uri.
Note that the report-uri need not necessarily be in the same Internet
domain or web origin as the Known Pinned Host.
Hosts may set report-uris that use HTTP, HTTPS, or other schemes. If
the scheme in the report-uri is HTTPS, UAs MUST perform Pinning
Validation when the host in the report-uri is a Known Pinned Host;
similarly, UAs MUST apply HSTS if the host in the report-uri is a
Known HSTS Host.
UAs SHOULD make their best effort to report Pin Validation failures
to the report-uri, but MAY fail to report in exceptional conditions.
For example, if connecting the report-uri itself incurs a Pinning
Validation failure or other certificate validation failure, the UA
MUST cancel the connection (and MAY attempt to re-send the report
later). Similarly, if Known Pinned Host A sets a report-uri
referring to Known Pinned Host B, and if B sets a report-uri
referring to A, and if both hosts fail Pin Validation, the UA SHOULD
detect and break the loop by failing to send reports to and about
those hosts.
UAs SHOULD limit the rate at which they send reports. For example,
it is unnecessary to send the same report to the same report-uri more
than once.
2.1.4. The strict Directive 2.1.4. The strict Directive
The OPTIONAL "strict" directive is a valueless directive which, if The OPTIONAL "strict" directive is a valueless directive which, if
present (i.e., it is "asserted"), signals to the UA that the Pinning present (i.e., it is "asserted"), signals to the UA that the Pinning
Policy contained should be applied to the Pinned Host exactly as Policy contained should be applied to the Pinned Host exactly as
specified, ignoring local client policy. specified, ignoring local client policy.
2.1.5. Examples 2.1.5. Examples
skipping to change at page 6, line 41 skipping to change at page 7, line 26
pin-sha1="qvTGHdzF6KLavt4PO0gs2a6pQ00="; pin-sha1="qvTGHdzF6KLavt4PO0gs2a6pQ00=";
pin-sha256="LPJNul+wow4m6DsqxbninhsWHlwfp0JecwQzYpOLmCQ="; pin-sha256="LPJNul+wow4m6DsqxbninhsWHlwfp0JecwQzYpOLmCQ=";
max-age=2592000; includeSubDomains max-age=2592000; includeSubDomains
Figure 3: HPKP Header Examples Figure 3: HPKP Header Examples
2.2. Server Processing Model 2.2. Server Processing Model
This section describes the processing model that Pinned Hosts This section describes the processing model that Pinned Hosts
implement. The model comprises two facets: the processing rules for implement. The model comprises two facets: the processing rules for
HTTP request messages received over a secure transport (e.g. TLS HTTP request messages received over a secure transport (e.g. TLS
[RFC5246]); and the processing rules for HTTP request messages [RFC5246]); and the processing rules for HTTP request messages
received over non-secure transports, such as TCP. received over non-secure transports, such as TCP.
2.2.1. HTTP-over-Secure-Transport Request Type 2.2.1. HTTP-over-Secure-Transport Request Type
When replying to an HTTP request that was conveyed over a secure When replying to an HTTP request that was conveyed over a secure
transport, a Pinned Host SHOULD include in its response exactly one transport, a Pinned Host SHOULD include in its response exactly one
PKP header field that MUST satisfy the grammar specified above in PKP header field that MUST satisfy the grammar specified above in
Section 2.1. If the Pinned Host does not include the PKP header Section 2.1. If the Pinned Host does not include the PKP header
field, and if the connection passed Pin Validation, UAs MUST treat field, and if the connection passed Pin Validation, UAs MUST treat
skipping to change at page 7, line 24 skipping to change at page 8, line 10
Pinned Hosts SHOULD NOT include the PKP header field in HTTP Pinned Hosts SHOULD NOT include the PKP header field in HTTP
responses conveyed over non-secure transport. UAs MUST ignore any responses conveyed over non-secure transport. UAs MUST ignore any
PKP header received in an HTTP response conveyed over non-secure PKP header received in an HTTP response conveyed over non-secure
transport. transport.
2.3. User Agent Processing Model 2.3. User Agent Processing Model
This section describes the HTTP Public Key Pinning processing model This section describes the HTTP Public Key Pinning processing model
for UAs. for UAs.
TODO: Add a note referring to the HSTS RFC's discussion of IDNs. The UA processing model relies on parsing domain names. Note that
internationalized domain names SHALL be canonicalized according to
the scheme in Section 10 of [RFC6797].
2.3.1. Public-Key-Pins Response Header Field Processing 2.3.1. Public-Key-Pins Response Header Field Processing
If the UA receives, over a secure transport, an HTTP response that If the UA receives, over a secure transport, an HTTP response that
includes a PKP header field conforming to the grammar specified in includes a PKP header field conforming to the grammar specified in
Section 2.1, and there are no underlying secure transport errors or Section 2.1, and there are no underlying secure transport errors or
warnings (see Section 2.5), the UA MUST either: warnings (see Section 2.5), the UA MUST either:
o Note the host as a Known HSTS Host if it is not already so noted o Note the host as a Known HSTS Host if it is not already so noted
(see Section 2.3.2), (see Section 2.3.2),
skipping to change at page 8, line 27 skipping to change at page 9, line 14
2.3.2. Noting a Pinned Host - Storage Model 2.3.2. Noting a Pinned Host - Storage Model
If the substring matching the host production from the Request-URI If the substring matching the host production from the Request-URI
(of the message to which the host responded) syntactically matches (of the message to which the host responded) syntactically matches
the IP-literal or IPv4address productions from Section 3.2.2 of the IP-literal or IPv4address productions from Section 3.2.2 of
[RFC3986], then the UA MUST NOT note this host as a Known Pinned [RFC3986], then the UA MUST NOT note this host as a Known Pinned
Host. Host.
Otherwise, if the substring does not congruently match a Known Pinned Otherwise, if the substring does not congruently match a Known Pinned
Host's domain name, per the matching procedure specified in Section Host's domain name, per the matching procedure specified in
8.2 of [RFC6797], then the UA MUST note this host as a Known Pinned Section 8.2 of [RFC6797], then the UA MUST note this host as a Known
Host, caching the Pinned Host's domain name and noting along with it Pinned Host, caching the Pinned Host's domain name and noting along
the expiry time of this information, as effectively stipulated per with it the time of the observation (also known as the Effective Pin
the given max-age value, as well as whether or not the Date), the value of the max-age directive, whether or not the
includeSubDomains or strict directives are asserted, the value of the includeSubDomains or strict directives are asserted, the value of the
report-uri directive (if present), and any other metadata from report-uri directive (if present), and any other metadata from
optional or future PKP header directives. optional or future PKP header directives.
The UA MUST NOT modify the expiry time nor the includeSubDomains UAs SHOULD set an upper limit on the value of max-age, so that UAs
directive of any superdomain matched Known Pinned Host. that have noted erroneous pins (whether by accident or due to attack)
have some chance of recovering over time. If the server sets a max-
age greater than the UA's upper limit, the UA SHOULD behave as if the
server set the max-age to the UA's upper limit. For example, if the
UA caps max-age at 2592000 seconds (30 days), and a Pinned Host sets
a max-age directive of 60 days in its Valid Pinning Header, the UA
SHOULD behave as if the max-age were effectively 30 days. (One way
to achieve this behavior is for the UA to simply store a value of 30
days instead of the 60 day value provided by the Pinned Host.) For
UA implementation guidance on how to select a maximum max-age, see
Section 4.1.
A Known Pinned Host is "expired" if its cache entry has an expiry The UA MUST NOT modify any pinning metadata of any superdomain
date in the past. The UA MUST evict all expired Known Pinned Hosts matched Known Pinned Host.
from its cache, if at any time, an expired Known Pinned Host exists
in the cache. A Known Pinned Host is "expired" if the Effective Pin Date plus the
max-age refers to a date in the past. The UA MUST ignore all expired
Known Pinned Hosts from its cache, if at any time, an expired Known
Pinned Host exists in the cache.
2.3.3. HTTP-Equiv <Meta> Element Attribute 2.3.3. HTTP-Equiv <Meta> Element Attribute
UAs MUST NOT heed http-equiv="Public-Key-Pins" attribute settings on UAs MUST NOT heed http-equiv="Public-Key-Pins" attribute settings on
<meta> elements [W3C.REC-html401-19991224] in received content. <meta> elements [W3C.REC-html401-19991224] in received content.
2.3.4. UA Processing Examples 2.3.4. UA Processing Examples
TODO. TODO.
skipping to change at page 10, line 22 skipping to change at page 11, line 28
in Section 2.6. in Section 2.6.
o The UA MUST note the Pins if and only if the TLS connection was o The UA MUST note the Pins if and only if the TLS connection was
authenticated with a certificate chain containing at least one of authenticated with a certificate chain containing at least one of
the SPKI structures indicated by at least one of the given SPKI the SPKI structures indicated by at least one of the given SPKI
Fingerprints. (See Section 2.6.) Fingerprints. (See Section 2.6.)
o The UA MUST note the Pins if and only if the given set of Pins o The UA MUST note the Pins if and only if the given set of Pins
contains at least one Pin that does NOT refer to an SPKI in the contains at least one Pin that does NOT refer to an SPKI in the
certificate chain. (That is, the host must set a Backup Pin; see certificate chain. (That is, the host must set a Backup Pin; see
Section 4.1.) Section 4.3.)
If the Public-Key-Pins response header field does not meet all three If the Public-Key-Pins response header field does not meet all three
of these criteria, the UA MUST NOT note the host as a Pinned Host. A of these criteria, the UA MUST NOT note the host as a Pinned Host. A
Public-Key-Pins response header field that meets all these critera is Public-Key-Pins response header field that meets all these critera is
known as a Valid Pinning Header. known as a Valid Pinning Header.
The UA MUST ignore Public-Key-Pins response header fields received on The UA MUST ignore Public-Key-Pins response header fields received on
connections that do not meet the first criterion. connections that do not meet the first criterion.
TODO: Consider whether or not this requirement makes sense: If the UA
receives a Public-Key-Pins header from a Pinned Host that meets the
first criterion, but not the following two, the UA MUST discard any
previously set Pinning Metadata for that host in its non-volatile
store. Whether or not the Known Pinned Host is in strict mode,
should the UA note new pins when Pin Validation is disabled per local
policy?
Whenever a UA receives a Valid Pinning Header, it MUST set its Whenever a UA receives a Valid Pinning Header, it MUST set its
Pinning Metadata to the exact Pins, max-age, and (if any) report-uri Pinning Metadata to the exact Pins, max-age, and (if any) report-uri
and strict mode given in the most recently received Valid Pinning and strict mode given in the most recently received Valid Pinning
Header. Header.
For forward compatibility, the UA MUST ignore any unrecognized For forward compatibility, the UA MUST ignore any unrecognized
Public-Key-Pins header directives, while still processing those Public-Key-Pins header directives, while still processing those
directives it does recognize. Section 2.1 specifies the directives directives it does recognize. Section 2.1 specifies the directives
max-age, pins, includeSubDomains, report-uri, and strict, but future max-age, pins, includeSubDomains, report-uri, and strict, but future
specifications and implementations might use additional directives. specifications and implementations might use additional directives.
skipping to change at page 11, line 46 skipping to change at page 12, line 41
Note that, although the UA has previously received Pins at the HTTP Note that, although the UA has previously received Pins at the HTTP
layer, it can and MUST perform Pin Validation at the TLS layer, layer, it can and MUST perform Pin Validation at the TLS layer,
before beginning an HTTP conversation over the TLS channel. The TLS before beginning an HTTP conversation over the TLS channel. The TLS
layer thus evaluates TLS connections with pinning information the UA layer thus evaluates TLS connections with pinning information the UA
received previously, regardless of mechanism: statically preloaded, received previously, regardless of mechanism: statically preloaded,
via HTTP header, or some other means (possibly in the TLS layer via HTTP header, or some other means (possibly in the TLS layer
itself). itself).
2.7. Interactions With Preloaded Pin Lists 2.7. Interactions With Preloaded Pin Lists
UAs MAY choose to implement built-in public key pins, alongside any UAs MAY choose to implement additional sources of pinning
built-in HSTS opt-in list. UAs MUST allow users to override a information, such as through built-in lists of pinning information.
built-in pin list, including turning it off. Such UAs SHOULD allow users to override such additional sources,
including disabling them from consideration.
UAs MUST use the newest information -- built-in or set via Valid UAs that support additional sources of pinning information MUST use
Pinning Header -- when performing Pin Validation for the host. If the most recently observed pinning information when performing Pin
the result of noting a Valid Pinning Header is to disable pinning for Validation for a host. The most recently observed pinning
the host (such as because the host set a max-age directive with a information is determined based upon the most recent Effective Pin
value of 0), UAs MUST allow this new information to override any Date, as described in Section 2.3.2.
built-in pins. That is, a host must be able to un-pin itself even
from built-in pins. If the result of noting a Valid Pinning Header is to disable pinning
for the host, such as through supplying a max-age directive with a
value of 0, UAs MUST allow this new information to override any other
pinning data. That is, a host must be able to un-pin itself, even in
the presence of built-in pins.
Example: A UA may ship with a pre-configured list of pins that are
collected from past observations of Valid Pinning Headers supplied by
hosts. In such a solution, the pre-configured list should track when
the Valid Pinning Header was last observed, in order to permit site
operators to later update the value by supplying a new Valid Pinning
Header. Updates to such a pre-configured list should not update the
Effective Pin Dates for each host unless the list vendor has actually
observed a more recent header. This is to prevent situations where
updating the Effective Pin Date on a pre-configured list of pins may
effectively extend the max-age beyond the site operator's stated
policy.
Example: An alternative example would be a UA that ships with a pre-
configured list of pins that are collected through out-of-band means,
such as direct contact with the site operator. In such a solution,
the site operator accepts responsibility for keeping the configured
Valid Pinning Header in sync with the vendor's list, allowing the UA
vendor to have each update to the list be treated as as an update of
the Effective Pin Date.
2.8. Pinning Self-Signed End Entities 2.8. Pinning Self-Signed End Entities
If UAs accept hosts that authenticate themselves with self-signed end If UAs accept hosts that authenticate themselves with self-signed end
entity certificates, they MAY also allow hosts to pin the public keys entity certificates, they MAY also allow hosts to pin the public keys
in such certificates. The usability and security implications of in such certificates. The usability and security implications of
this practice are outside the scope of this specification. this practice are outside the scope of this specification.
3. Reporting Pin Validation Failure 3. Reporting Pin Validation Failure
skipping to change at page 12, line 42 skipping to change at page 14, line 15
] ]
} }
Figure 5: JSON Report Format Figure 5: JSON Report Format
Whitespace outside of quoted strings is not significant. The key/ Whitespace outside of quoted strings is not significant. The key/
value pairs may appear in any order, but each SHOULD appear only value pairs may appear in any order, but each SHOULD appear only
once. once.
The date-time indicates the time the UA observed the Pin Validation The date-time indicates the time the UA observed the Pin Validation
failure. It is provided as a string formatted according to Section failure. It is provided as a string formatted according to
5.6, "Internet Date/Time Format", of [RFC3339]. Section 5.6, "Internet Date/Time Format", of [RFC3339].
The hostname is the hostname to which the UA made the original The hostname is the hostname to which the UA made the original
request that failed Pin Validation. It is provided as a string. request that failed Pin Validation. It is provided as a string.
The port is the port to which the UA made the original request that The port is the port to which the UA made the original request that
failed Pin Validation. It is provided either as a string or as an failed Pin Validation. It is provided either as a string or as an
integer. integer.
The certificate-chain is the certificate chain, as constructed by the The certificate-chain is the certificate chain, as constructed by the
UA during certificate chain verification. (This may differ from the UA during certificate chain verification. (This may differ from the
skipping to change at page 14, line 5 skipping to change at page 15, line 23
chain will have at least two certificates above the end entity chain will have at least two certificates above the end entity
certificate: the intermediate issuer, and the trust anchor. certificate: the intermediate issuer, and the trust anchor.
Operators can pin any one or more of the public keys in this chain, Operators can pin any one or more of the public keys in this chain,
and indeed could pin to issuers not in the chain (as, for example, a and indeed could pin to issuers not in the chain (as, for example, a
Backup Pin). Pinning to an intermediate issuer, or even to a trust Backup Pin). Pinning to an intermediate issuer, or even to a trust
anchor or root, still significantly reduces the number of issuers who anchor or root, still significantly reduces the number of issuers who
can issue end entity certificates for the Known Pinned Host, while can issue end entity certificates for the Known Pinned Host, while
still giving that host flexibility to change keys without a still giving that host flexibility to change keys without a
disruption of service. disruption of service.
4.1. Backup Pins 4.1. Maximum max-age
As mentioned in Section 2.3.2, UAs SHOULD cap the max-age value at
some upper limit. There is a security trade-off in that low maximum
values provide a narrow window of protection for users who visit the
Known Pinned Host only infrequently, while high maximum values might
potentially result in a UA's inability to successfully perform Pin
Validation for a Known Pinned Host if the UA's noted pins and the
Host's true pins diverge.
Such divergence could occur for several reasons, including: UA error;
Host operator error; network attack; or a Known Pinned Host that
intentionally migrates all pinned keys, combined with a UA that has
noted true pins with a high max-age value and has not had a chance to
observe the new true pins for the Host. (This last example
underscores the importance for Host operators to phase in new keys
gradually, and to set the max-age value in accordance with their
planned key migration schedule.)
There is probably no ideal upper limit to the max-age directive that
would satisfy all use cases. However, a value on the order of 30
days (2592000 seconds) may be considered a balance between the two
competing security concerns.
4.2. Using includeSubdomains Safely
It may happen that Pinned Hosts whose hostnames share a parent domain
use different Valid Pinning Headers. If a Host whose hostname is a
parent domain for another Host sets the includeSubdomains directive,
the Hosts' pins may conflict with each other. For example, consider
two Known Pinned Hosts, example.com and subdomain.example.com.
Assume example.com sets a Valid Pinning Header such as this:
Public-Key-Pins: pin-sha1="ABC..."; pin-sha1="DEF..."; includeSubdomains
Figure 7: example.com Valid Pinning Header
Assume subdomain.example.com sets a Valid Pinning Header such as
this:
Public-Key-Pins: pin-sha1="GHI..."; pin-sha1="JKL..."
Figure 8: subdomain.example.com Valid Pinning Header
Assume a UA that has not previously noted any pins for either of
these Hosts. If the UA first contacts subdomain.example.com, it will
note the pins in the Valid Pinning Header, and perform Pin Validation
as normal on subsequent conections. If the UA then contacts
example.com, again it will note the pins and perform Pin Validation
on future connections. However, if the UA happened to first
example.com before subdomain.example.com, the UA would, due to
example.com's use of the includeSubdomains directive, attempt to
perform Pin Validation for subdomain.example.com using the SPKI
hashes ABC... and DEF..., which are not valid for the certificate
chains subdomain.example.com (which uses certificates with SPKIs
GHI... and JLK...). Thus, depending on the order in which the UA
observes the Valid Pinning Headers for hosts example.com and
subdomain.example.com, Pin Validation might or might not fail for
subdomain.example.com, even if the certificate chain the UA receives
for subdomain.example.com is perfectly valid.
Thus, Pinned Host operators must take care that they use the
includeSubdomains directive with care. For example, they may choose
to use overlapping pin sets for hosts under a parent domain that uses
includeSubdomains, or to not use the includeSubdomains directive in
their effective-second-level domains, or to simply use the same pin
set for all hosts under a given parent domain.
4.3. Backup Pins
The primary way to cope with the risk of inadvertant Pin Failure is The primary way to cope with the risk of inadvertant Pin Failure is
to keep a Backup Pin. A Backup Pin is a fingerprint for the public to keep a Backup Pin. A Backup Pin is a fingerprint for the public
key of a secondary, not-yet-deployed key pair. The operator keeps key of a secondary, not-yet-deployed key pair. The operator keeps
the backup key pair offline, and sets a pin for it in the Public-Key- the backup key pair offline, and sets a pin for it in the Public-Key-
Pins header. Then, in case the operator loses control of their Pins header. Then, in case the operator loses control of their
primary private key, they can deploy the backup key pair. UAs, who primary private key, they can deploy the backup key pair. UAs, who
have had the backup key pair pinned (when it was set in previous have had the backup key pair pinned (when it was set in previous
Valid Pinning Headers), can connect to the host without error. Valid Pinning Headers), can connect to the host without error.
skipping to change at page 14, line 37 skipping to change at page 17, line 32
that it was impossible to verify the confirmed cryptographic identity that it was impossible to verify the confirmed cryptographic identity
of the host. of the host.
UAs MUST have a way for users to clear current pins for Pinned Hosts. UAs MUST have a way for users to clear current pins for Pinned Hosts.
UAs SHOULD have a way for users to query the current state of Pinned UAs SHOULD have a way for users to query the current state of Pinned
Hosts. Hosts.
7. Acknowledgements 7. Acknowledgements
Thanks to Tobias Gondrom, Jeff Hodges, Adam Langley, Nicolas Thanks to Tobias Gondrom, Jeff Hodges, Adam Langley, Nicolas
Lidzborski, SM, James Manger, and Yoav Nir for suggestions and edits Lidzborski, SM, James Manger, Eric Rescorla, Paul Hoffman, and Yoav
that clarified the text. Thanks to Trevor Perrin for suggesting a Nir for suggestions and edits that clarified the text. Thanks to
mechanism to affirmatively break pins ([pin-break-codes]). Adam Trevor Perrin for suggesting a mechanism to affirmatively break pins
Langley provided the SPKI fingerprint generation code. ([pin-break-codes]). Adam Langley provided the SPKI fingerprint
generation code.
8. What's Changed 8. What's Changed
Removed the section "Pin Validity Times", which was intended to be in Removed the section "Pin Validity Times", which was intended to be in
harmony with [I-D.perrin-tls-tack]. Now using max-age purely as harmony with [I-D.perrin-tls-tack]. Now using max-age purely as
specified in [RFC6797]. specified in [RFC6797].
Added new directives: includeSubDomains, report-uri and strict. Added new directives: includeSubDomains, report-uri and strict.
Added, but have not yet described, a new variant of the PKP Header: Added a new variant of the PKP Header: Public-Key-Pins-Report-Only.
Public-Key-Pins-Report-Only.
Removed the section on pin break codes and verifiers, in favor the of Removed the section on pin break codes and verifiers, in favor the of
most-recently-received policy (Section 2.5). most-recently-received policy (Section 2.5).
Now using a new header field, Public-Key-Pins, separate from HSTS. Now using a new header field, Public-Key-Pins, separate from HSTS.
This allows hosts to use pinning separately from Strict Transport This allows hosts to use pinning separately from Strict Transport
Security. Security.
Explicitly requiring that UAs perform Pin Validation before the HTTP Explicitly requiring that UAs perform Pin Validation before the HTTP
conversation begins. conversation begins.
skipping to change at page 15, line 43 skipping to change at page 18, line 37
Requirement Levels", BCP 14, RFC 2119, March 1997. Requirement Levels", BCP 14, RFC 2119, March 1997.
[RFC2616] Fielding, R., Gettys, J., Mogul, J., Frystyk, H., [RFC2616] Fielding, R., Gettys, J., Mogul, J., Frystyk, H.,
Masinter, L., Leach, P., and T. Berners-Lee, "Hypertext Masinter, L., Leach, P., and T. Berners-Lee, "Hypertext
Transfer Protocol -- HTTP/1.1", RFC 2616, June 1999. Transfer Protocol -- HTTP/1.1", RFC 2616, June 1999.
[RFC3339] Klyne, G., Ed. and C. Newman, "Date and Time on the [RFC3339] Klyne, G., Ed. and C. Newman, "Date and Time on the
Internet: Timestamps", RFC 3339, July 2002. Internet: Timestamps", RFC 3339, July 2002.
[RFC3986] Berners-Lee, T., Fielding, R., and L. Masinter, "Uniform [RFC3986] Berners-Lee, T., Fielding, R., and L. Masinter, "Uniform
Resource Identifier (URI): Generic Syntax", STD 66, Resource Identifier (URI): Generic Syntax", STD 66, RFC
RFC 3986, January 2005. 3986, January 2005.
[RFC4648] Josefsson, S., "The Base16, Base32, and Base64 Data [RFC4648] Josefsson, S., "The Base16, Base32, and Base64 Data
Encodings", RFC 4648, October 2006. Encodings", RFC 4648, October 2006.
[RFC5226] Narten, T. and H. Alvestrand, "Guidelines for Writing an [RFC5226] Narten, T. and H. Alvestrand, "Guidelines for Writing an
IANA Considerations Section in RFCs", BCP 26, RFC 5226, IANA Considerations Section in RFCs", BCP 26, RFC 5226,
May 2008. May 2008.
[RFC5246] Dierks, T. and E. Rescorla, "The Transport Layer Security [RFC5246] Dierks, T. and E. Rescorla, "The Transport Layer Security
(TLS) Protocol Version 1.2", RFC 5246, August 2008. (TLS) Protocol Version 1.2", RFC 5246, August 2008.
skipping to change at page 16, line 18 skipping to change at page 19, line 15
[RFC5280] Cooper, D., Santesson, S., Farrell, S., Boeyen, S., [RFC5280] Cooper, D., Santesson, S., Farrell, S., Boeyen, S.,
Housley, R., and W. Polk, "Internet X.509 Public Key Housley, R., and W. Polk, "Internet X.509 Public Key
Infrastructure Certificate and Certificate Revocation List Infrastructure Certificate and Certificate Revocation List
(CRL) Profile", RFC 5280, May 2008. (CRL) Profile", RFC 5280, May 2008.
[RFC6797] Hodges, J., Jackson, C., and A. Barth, "HTTP Strict [RFC6797] Hodges, J., Jackson, C., and A. Barth, "HTTP Strict
Transport Security (HSTS)", RFC 6797, November 2012. Transport Security (HSTS)", RFC 6797, November 2012.
[W3C.REC-html401-19991224] [W3C.REC-html401-19991224]
Hors, A., Raggett, D., and I. Jacobs, "HTML 4.01 Hors, A., Raggett, D., and I. Jacobs, "HTML 4.01
Specification", World Wide Web Consortium Specification", World Wide Web Consortium Recommendation
Recommendation REC-html401-19991224, December 1999, REC-html401-19991224, December 1999,
<http://www.w3.org/TR/1999/REC-html401-19991224>. <http://www.w3.org/TR/1999/REC-html401-19991224>.
9.2. Informative References 9.2. Informative References
[I-D.perrin-tls-tack] [I-D.perrin-tls-tack]
Marlinspike, M., "Trust Assertions for Certificate Keys", Marlinspike, M., "Trust Assertions for Certificate Keys",
draft-perrin-tls-tack-01 (work in progress), draft-perrin-tls-tack-02 (work in progress), January 2013.
September 2012.
[pin-break-codes] [pin-break-codes]
Perrin, T., "Self-Asserted Key Pinning", September 2011, Perrin, T., "Self-Asserted Key Pinning", September 2011,
<http://trevp.net/SAKP/>. <http://trevp.net/SAKP/>.
[why-pin-key] [why-pin-key]
Langley, A., "Public Key Pinning", May 2011, Langley, A., "Public Key Pinning", May 2011,
<http://www.imperialviolet.org/2011/05/04/pinning.html>. <http://www.imperialviolet.org/2011/05/04/pinning.html>.
Appendix A. Fingerprint Generation Appendix A. Fingerprint Generation
skipping to change at page 17, line 44 skipping to change at page 20, line 28
} }
cert := certs[0] cert := certs[0]
h := sha1.New() h := sha1.New()
h.Write(cert.RawSubjectPublicKeyInfo) h.Write(cert.RawSubjectPublicKeyInfo)
digest := h.Sum() digest := h.Sum()
fmt.Printf("Hex: %x\nBase64: %s\n", digest, fmt.Printf("Hex: %x\nBase64: %s\n", digest,
base64.StdEncoding.EncodeToString(digest)) base64.StdEncoding.EncodeToString(digest))
} }
Figure 7: Example SPKI Fingerprint Generation Code Figure 9: Example SPKI Fingerprint Generation Code
Appendix B. Deployment Guidance Appendix B. Deployment Guidance
This section is non-normative guidance which may smooth the adoption This section is non-normative guidance which may smooth the adoption
of public key pinning. of public key pinning.
o Operators SHOULD get the backup public key signed by a different o Operators SHOULD get the backup public key signed by a different
(root and/or intermediary) CA than their primary certificate, and (root and/or intermediary) CA than their primary certificate, and
store the backup key pair safely offline. The semantics of an store the backup key pair safely offline. The semantics of an
SPKI Fingerprint do not require the issuance of a certificate to SPKI Fingerprint do not require the issuance of a certificate to
skipping to change at page 18, line 23 skipping to change at page 21, line 5
that recognize the site as a Known Pinned Host unable to that recognize the site as a Known Pinned Host unable to
successfully perform Pin Validation until such a time as the successfully perform Pin Validation until such a time as the
operator can obtain a new certificate from their desired operator can obtain a new certificate from their desired
certificate issuer. certificate issuer.
o It is most economical to have the backup certificate signed by a o It is most economical to have the backup certificate signed by a
completely different signature chain than the live certificate, to completely different signature chain than the live certificate, to
maximize recoverability in the event of either root or maximize recoverability in the event of either root or
intermediary signer compromise. intermediary signer compromise.
o Operators SHOULD periodically exercise their Backup Pin plan -- an o Operators SHOULD periodically exercise their Backup Pin plan
untested backup is no backup at all. -\u002D an untested backup is no backup at all.
o Operators SHOULD start small. Operators SHOULD first deploy o Operators SHOULD start small. Operators SHOULD first deploy
public key pinning by using the report-only mode together with a public key pinning by using the report-only mode together with a
report-uri directive that points to a reliable report collection report-uri directive that points to a reliable report collection
endpoint. When moving out of report-only mode, operators should endpoint. When moving out of report-only mode, operators should
start by setting a max-age of minutes or a few hours, and start by setting a max-age of minutes or a few hours, and
gradually increase max-age as they gain confidence in their gradually increase max-age as they gain confidence in their
operational capability. operational capability.
Authors' Addresses Authors' Addresses
 End of changes. 30 change blocks. 
108 lines changed or deleted 246 lines changed or added

This html diff was produced by rfcdiff 1.41. The latest version is available from http://tools.ietf.org/tools/rfcdiff/