draft-ietf-websec-key-pinning-13.txt   draft-ietf-websec-key-pinning-14.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: November 14, 2014 Google, Inc. Expires: December 14, 2014 Google, Inc.
May 13, 2014 June 12, 2014
Public Key Pinning Extension for HTTP Public Key Pinning Extension for HTTP
draft-ietf-websec-key-pinning-13 draft-ietf-websec-key-pinning-14
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 to remember ("pin") the hosts'
hosts' cryptographic identities for a given period of time. During cryptographic identities for a given period of time. During that
that time, UAs will require that the host present a certificate chain 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
skipping to change at page 1, line 40 skipping to change at page 1, line 40
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 November 14, 2014. This Internet-Draft will expire on December 14, 2014.
Copyright Notice Copyright Notice
Copyright (c) 2014 IETF Trust and the persons identified as the Copyright (c) 2014 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
skipping to change at page 2, line 19 skipping to change at page 2, line 19
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 . . . . . . . . . . . . . . 6 2.1.3. The report-uri Directive . . . . . . . . . . . . . . 5
2.1.4. Examples . . . . . . . . . . . . . . . . . . . . . . 6 2.1.4. Examples . . . . . . . . . . . . . . . . . . . . . . 6
2.2. Server Processing Model . . . . . . . . . . . . . . . . . 7 2.2. Server Processing Model . . . . . . . . . . . . . . . . . 7
2.2.1. HTTP-over-Secure-Transport Request Type . . . . . . . 7 2.2.1. HTTP-over-Secure-Transport Request Type . . . . . . . 7
2.2.2. HTTP Request Type . . . . . . . . . . . . . . . . . . 8 2.2.2. HTTP Request Type . . . . . . . . . . . . . . . . . . 8
2.3. User Agent Processing Model . . . . . . . . . . . . . . . 8 2.3. User Agent Processing Model . . . . . . . . . . . . . . . 8
2.3.1. Public-Key-Pins Response Header Field Processing . . 8 2.3.1. Public-Key-Pins Response Header Field Processing . . 8
2.3.2. Interaction of Public-Key-Pins and Public-Key-Pins- 2.3.2. Interaction of Public-Key-Pins and Public-Key-Pins-
Report-Only . . . . . . . . . . . . . . . . . . . . . 9 Report-Only . . . . . . . . . . . . . . . . . . . . . 9
2.3.3. Noting a Pinned Host - Storage Model . . . . . . . . 10 2.3.3. Noting a Pinned Host - Storage Model . . . . . . . . 10
2.3.4. HTTP-Equiv <Meta> Element Attribute . . . . . . . . . 11 2.3.4. HTTP-Equiv <Meta> Element Attribute . . . . . . . . . 11
2.4. Semantics of Pins . . . . . . . . . . . . . . . . . . . . 11 2.4. Semantics of Pins . . . . . . . . . . . . . . . . . . . . 11
2.5. Noting Pins . . . . . . . . . . . . . . . . . . . . . . . 12 2.5. Noting Pins . . . . . . . . . . . . . . . . . . . . . . . 12
2.6. Validating Pinned Connections . . . . . . . . . . . . . . 13 2.6. Validating Pinned Connections . . . . . . . . . . . . . . 13
2.7. Interactions With Preloaded Pin Lists . . . . . . . . . . 13 2.7. Interactions With Preloaded Pin Lists . . . . . . . . . . 14
2.8. Pinning Self-Signed End Entities . . . . . . . . . . . . 14 2.8. Pinning Self-Signed End Entities . . . . . . . . . . . . 14
3. Reporting Pin Validation Failure . . . . . . . . . . . . . . 14 3. Reporting Pin Validation Failure . . . . . . . . . . . . . . 14
4. Security Considerations . . . . . . . . . . . . . . . . . . . 16 4. Security Considerations . . . . . . . . . . . . . . . . . . . 16
4.1. Maximum max-age . . . . . . . . . . . . . . . . . . . . . 17 4.1. Maximum max-age . . . . . . . . . . . . . . . . . . . . . 17
4.2. Using includeSubDomains Safely . . . . . . . . . . . . . 17 4.2. Using includeSubDomains Safely . . . . . . . . . . . . . 17
4.3. Backup Pins . . . . . . . . . . . . . . . . . . . . . . . 18 4.3. Backup Pins . . . . . . . . . . . . . . . . . . . . . . . 18
4.4. Interactions With Cookie Scoping . . . . . . . . . . . . 19 4.4. Interactions With Cookie Scoping . . . . . . . . . . . . 19
5. Privacy Considerations . . . . . . . . . . . . . . . . . . . 19 5. Privacy Considerations . . . . . . . . . . . . . . . . . . . 19
6. IANA Considerations . . . . . . . . . . . . . . . . . . . . . 20 6. IANA Considerations . . . . . . . . . . . . . . . . . . . . . 20
7. Usability Considerations . . . . . . . . . . . . . . . . . . 21 7. Usability Considerations . . . . . . . . . . . . . . . . . . 21
8. Acknowledgements . . . . . . . . . . . . . . . . . . . . . . 21 8. Acknowledgements . . . . . . . . . . . . . . . . . . . . . . 21
9. What's Changed . . . . . . . . . . . . . . . . . . . . . . . 21 9. What's Changed . . . . . . . . . . . . . . . . . . . . . . . 21
10. References . . . . . . . . . . . . . . . . . . . . . . . . . 22 10. References . . . . . . . . . . . . . . . . . . . . . . . . . 22
10.1. Normative References . . . . . . . . . . . . . . . . . . 22 10.1. Normative References . . . . . . . . . . . . . . . . . . 22
10.2. Informative References . . . . . . . . . . . . . . . . . 23 10.2. Informative References . . . . . . . . . . . . . . . . . 23
Appendix A. Fingerprint Generation . . . . . . . . . . . . . . . 23 Appendix A. Fingerprint Generation . . . . . . . . . . . . . . . 23
Appendix B. Deployment Guidance . . . . . . . . . . . . . . . . 24 Appendix B. Deployment Guidance . . . . . . . . . . . . . . . . 23
Authors' Addresses . . . . . . . . . . . . . . . . . . . . . . . 24 Authors' Addresses . . . . . . . . . . . . . . . . . . . . . . . 24
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 the pinning" (PKP). At least one UA (Google Chrome) has experimented
idea by shipping with a user-extensible embedded set of Pins. with the idea by shipping with a user-extensible embedded set of
Although effective, this does not scale. This proposal addresses the Pins. Although effective, this does not scale. This proposal
scale problem. addresses the scale problem.
Deploying public key pinning safely will require operational and Deploying PKP safely will require operational and organizational
organizational maturity due to the risk that hosts may make maturity due to the risk that hosts may make themselves unavailable
themselves unavailable by pinning to a SPKI that becomes invalid. by pinning to a (set of) SPKI(s) that becomes invalid. (See
(See Section 4.) We believe that, with care, host operators can Section 4.) We believe that, with care, host operators can greatly
greatly reduce the risk of MITM attacks and other false- reduce the risk of main-in-the-middle (MITM) attacks and other false-
authentication problems for their users without incurring undue risk. authentication problems for their users without incurring undue risk.
We intend for hosts to use public key pinning together with HSTS We intend for hosts to use PKP together with HSTS ([RFC6797]), but is
([RFC6797]), but is possible to pin keys without requiring HSTS. possible to pin keys without requiring HSTS.
This draft is being discussed on the WebSec Working Group mailing This draft is being discussed on the WebSec Working Group mailing
list, websec@ietf.org. list, websec@ietf.org.
1.1. Requirements Language 1.1. Requirements Language
The key words "MUST", "MUST NOT", "REQUIRED", "SHALL", "SHALL NOT", The key words "MUST", "MUST NOT", "REQUIRED", "SHALL", "SHALL NOT",
"SHOULD", "SHOULD NOT", "RECOMMENDED", "MAY", and "OPTIONAL" in this "SHOULD", "SHOULD NOT", "RECOMMENDED", "MAY", and "OPTIONAL" in this
document are to be interpreted as described in RFC 2119 [RFC2119]. document are to be interpreted as described in RFC 2119 [RFC2119].
2. Server and Client Behavior 2. Server and Client Behavior
2.1. Response Header Field Syntax 2.1. Response Header Field Syntax
The Public-Key-Pins HTTP response header field (PKP header field) The Public-Key-Pins HTTP response header field (PKP header field) and
indicates to a UA that it should perform Pin Validation (Section 2.6) Public-Key-Pins-Report-Only response header field (PKP-RO header
in regards to the host emitting the response message containing this field) indicate to a UA that it should perform Pin Validation
header field, and provides the necessary information for the UA to do (Section 2.6) in regards to the host emitting the response message
so. containing these header fields, and provide the necessary information
for the UA to do so.
Figure 1 describes the ABNF (Augmented Backus-Naur Form) syntax of Figure 1 describes the syntax (Augmented Backus-Naur Form) of the
the header field. It is based on the Generic Grammar defined in 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
skipping to change at page 5, line 37 skipping to change at page 5, line 37
The syntax of the max-age directive's REQUIRED value (after quoted- The syntax of the max-age directive's REQUIRED value (after quoted-
string unescaping, if necessary) is defined as: string unescaping, if necessary) is defined as:
max-age-value = delta-seconds max-age-value = delta-seconds
delta-seconds = 1*DIGIT delta-seconds = 1*DIGIT
Figure 2: max-age Value Syntax Figure 2: max-age Value Syntax
delta-seconds is used as defined in [RFC2616], Section 3.3.2. delta-seconds is used as defined in [RFC2616], Section 3.3.2.
NOTE: A max-age value of zero (i.e., "max-age=0") signals the UA to
cease regarding the host as a Known Pinned Host, including the
includeSubDomains directive (if asserted for that Known Pinned Host).
See Section 2.3.1.
2.1.2. The includeSubDomains Directive 2.1.2. The includeSubDomains Directive
The OPTIONAL "includeSubDomains" directive is a valueless directive The OPTIONAL includeSubDomains directive is a valueless directive
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.
When used in the Public-Key-Pins or Public-Key-Pins-Report-Only When used in the PKP or PKP-RO headers, the presence of a report-uri
header, the presence of a report-uri directive indicates to the UA directive indicates to the UA that in the event of Pin Validation
that in the event of Pin Validation failure it SHOULD POST a report failure it SHOULD POST a report to the report-uri. If the header is
to the report-uri. If the header is Public-Key-Pins, the UA should Public-Key-Pins, the UA should do this in addition to terminating the
do this in addition to terminating the connection (as described in connection (as described in Section 2.6).
Section 2.6).
Hosts may set report-uris that use HTTP, HTTPS, or other schemes. If 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 the scheme in the report-uri is one that uses TLS (e.g. HTTPS or
Validation when the host in the report-uri is a Known Pinned Host; WSS), UAs MUST perform Pinning Validation when the host in the
similarly, UAs MUST apply HSTS if the host in the report-uri is a report-uri is a Known Pinned Host; similarly, UAs MUST apply HSTS if
Known HSTS Host. the host in the report-uri is a Known HSTS Host.
Note that the report-uri need not necessarily be in the same Internet Note that the report-uri need not necessarily be in the same Internet
domain or web origin as the Known Pinned Host. domain or web origin as the Known Pinned Host.
UAs SHOULD make their best effort to report Pin Validation failures UAs SHOULD make their best effort to report Pin Validation failures
to the report-uri, but may fail to report in exceptional conditions. to the report-uri, but may fail to report in exceptional conditions.
For example, if connecting the report-uri itself incurs a Pinning For example, if connecting the report-uri itself incurs a Pinning
Validation failure or other certificate validation failure, the UA Validation failure or other certificate validation failure, the UA
MUST cancel the connection (and MAY attempt to re-send the report MUST cancel the connection. Similarly, if Known Pinned Host A sets a
later). Similarly, if Known Pinned Host A sets a report-uri report-uri referring to Known Pinned Host B, and if B sets a report-
referring to Known Pinned Host B, and if B sets a report-uri uri referring to A, and if both hosts fail Pin Validation, the UA
referring to A, and if both hosts fail Pin Validation, the UA SHOULD SHOULD detect and break the loop by failing to send reports to and
detect and break the loop by failing to send reports to and about about those hosts.
those hosts.
In any case of report failure, the UA MAY attempt to re-send the
report later.
UAs SHOULD limit the rate at which they send reports. For example, 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 it is unnecessary to send the same report to the same report-uri more
than once. than once per distinct set of declared pins.
2.1.4. Examples 2.1.4. Examples
Figure 3 shows some example response header fields using the Pins Figure 3 shows some example response header fields using the Pins
extension (folded for clarity). extension. (Lines are folded to fit.)
Public-Key-Pins: max-age=3000; Public-Key-Pins: max-age=3000;
pin-sha256="d6qzRu9zOECb90Uez27xWltNsj0e1Md7GkYYkVoZWmM="; pin-sha256="d6qzRu9zOECb90Uez27xWltNsj0e1Md7GkYYkVoZWmM=";
pin-sha256="E9CZ9INDbd+2eRQozYqqbQ2yXLVKB9+xcprMF+44U1g="; pin-sha256="E9CZ9INDbd+2eRQozYqqbQ2yXLVKB9+xcprMF+44U1g=";
Public-Key-Pins: max-age=2592000; Public-Key-Pins: max-age=2592000;
pin-sha256="E9CZ9INDbd+2eRQozYqqbQ2yXLVKB9+xcprMF+44U1g="; pin-sha256="E9CZ9INDbd+2eRQozYqqbQ2yXLVKB9+xcprMF+44U1g=";
pin-sha256="LPJNul+wow4m6DsqxbninhsWHlwfp0JecwQzYpOLmCQ=" pin-sha256="LPJNul+wow4m6DsqxbninhsWHlwfp0JecwQzYpOLmCQ="
Public-Key-Pins: max-age=2592000; Public-Key-Pins: max-age=2592000;
pin-sha256="E9CZ9INDbd+2eRQozYqqbQ2yXLVKB9+xcprMF+44U1g="; pin-sha256="E9CZ9INDbd+2eRQozYqqbQ2yXLVKB9+xcprMF+44U1g=";
pin-sha256="LPJNul+wow4m6DsqxbninhsWHlwfp0JecwQzYpOLmCQ="; pin-sha256="LPJNul+wow4m6DsqxbninhsWHlwfp0JecwQzYpOLmCQ=";
report-uri="http://example.com/pkp-report" report-uri="http://example.com/pkp-report"
Public-Key-Pins-Report-Only: max-age=2592000; Public-Key-Pins-Report-Only: max-age=2592000;
pin-sha256="E9CZ9INDbd+2eRQozYqqbQ2yXLVKB9+xcprMF+44U1g="; pin-sha256="E9CZ9INDbd+2eRQozYqqbQ2yXLVKB9+xcprMF+44U1g=";
pin-sha256="LPJNul+wow4m6DsqxbninhsWHlwfp0JecwQzYpOLmCQ="; pin-sha256="LPJNul+wow4m6DsqxbninhsWHlwfp0JecwQzYpOLmCQ=";
report-uri="http://example.com/pkp-report" report-uri="https://other.example.net/pkp-report"
Public-Key-Pins: Public-Key-Pins:
pin-sha256="d6qzRu9zOECb90Uez27xWltNsj0e1Md7GkYYkVoZWmM="; pin-sha256="d6qzRu9zOECb90Uez27xWltNsj0e1Md7GkYYkVoZWmM=";
pin-sha256="LPJNul+wow4m6DsqxbninhsWHlwfp0JecwQzYpOLmCQ="; pin-sha256="LPJNul+wow4m6DsqxbninhsWHlwfp0JecwQzYpOLmCQ=";
max-age=259200 max-age=259200
Public-Key-Pins: Public-Key-Pins:
pin-sha256="d6qzRu9zOECb90Uez27xWltNsj0e1Md7GkYYkVoZWmM="; pin-sha256="d6qzRu9zOECb90Uez27xWltNsj0e1Md7GkYYkVoZWmM=";
pin-sha256="E9CZ9INDbd+2eRQozYqqbQ2yXLVKB9+xcprMF+44U1g="; pin-sha256="E9CZ9INDbd+2eRQozYqqbQ2yXLVKB9+xcprMF+44U1g=";
pin-sha256="LPJNul+wow4m6DsqxbninhsWHlwfp0JecwQzYpOLmCQ="; pin-sha256="LPJNul+wow4m6DsqxbninhsWHlwfp0JecwQzYpOLmCQ=";
max-age=10000; includeSubDomains max-age=10000; 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 has 2 parts: (1) the processing rules for HTTP
HTTP request messages received over a secure transport (e.g. TLS request messages received over a secure transport (e.g. TLS); and
[RFC5246]); and the processing rules for HTTP request messages (2) the processing rules for HTTP request messages received over non-
received over non-secure transports, such as TCP. 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, exactly one PKP-RO header field, or one of each, PKP header field, exactly one PKP-RO header field, or one of each.
which MUST satisfy the grammar specified above in Section 2.1. Each instance of either header field MUST satisfy the grammar
specified in Section 2.1.
Establishing a given host as a Known Pinned Host, in the context of a Establishing a given host as a Known Pinned Host, in the context of a
given UA, MAY be accomplished over the HTTP protocol, which is in given UA, MAY be accomplished over the HTTP protocol, which is in
turn running over secure transport, by correctly returning (per this turn running over secure transport, by correctly returning (per this
specification) at least one valid PKP header field to the UA. Other specification) at least one valid PKP header field to the UA. Other
mechanisms, such as a client-side pre-loaded Known Pinned Host list mechanisms, such as a client-side pre-loaded Known Pinned Host list
MAY also be used. MAY also be used.
2.2.2. HTTP Request Type 2.2.2. HTTP Request Type
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
for UAs.
The UA processing model relies on parsing domain names. Note that The UA processing model relies on parsing domain names. Note that
internationalized domain names SHALL be canonicalized according to internationalized domain names SHALL be canonicalized according to
the scheme in Section 10 of [RFC6797]. 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:
skipping to change at page 9, line 17 skipping to change at page 9, line 14
transport, then the UA MUST process only the first PKP header transport, then the UA MUST process only the first PKP header
field (if present) and only the first PKP-RO header field (if field (if present) and only the first PKP-RO header field (if
present). present).
Otherwise: Otherwise:
o If the UA receives the HTTP response over insecure transport, or o If the UA receives the HTTP response over insecure transport, or
if the PKP header is not a Valid Pinning Header (see Section 2.5), if the PKP header is not a Valid Pinning Header (see Section 2.5),
the UA MUST ignore any present PKP header field(s). the UA MUST ignore any present PKP header field(s).
o The UA MUST ignore any PKP header fields not conforming to the o Similarly, if the UA receives the HTTP response over insecure
grammar specified in Section 2.1. transport, the UA MUST ignore any present PKP-RO header field(s).
o The UA MUST ignore any PKP or PKP-RO header fields not conforming
to the grammar specified in Section 2.1.
2.3.2. Interaction of Public-Key-Pins and Public-Key-Pins-Report-Only 2.3.2. Interaction of Public-Key-Pins and Public-Key-Pins-Report-Only
A server MAY set both the Public-Key-Pins and Public-Key-Pins-Report- A server MAY set both the Public-Key-Pins and Public-Key-Pins-Report-
Only headers simultaneously. The headers do not interact with one Only headers simultaneously. The headers do not interact with one
another but the UA MUST process the Public-Key-Pins header and SHOULD another but the UA MUST process the PKP header and SHOULD process
process both. both.
The Public-Key-Pins header is processed as according to The headers are processed according to Section 2.3.1.
Section 2.3.1.
When the Public-Key-Pins-Report-Only header is used with a report- When the PKP-RO header is used with a report-uri, the UA SHOULD POST
uri, the UA SHOULD POST reports for Pin Validation failures to the reports for Pin Validation failures to the indicated report-uri,
indicated report-uri, although the UA MUST NOT enforce Pin although the UA MUST NOT enforce Pin Validation. That is, in the
Validation. That is, in the event of Pin Validation failure when the event of Pin Validation failure when the host has set the PKP-RO
host has set the Public-Key-Pins-Report-Only header, the UA performs header, the UA performs Pin Validation only to check whether or not
Pin Validation only to check whether or not it should POST a report, it should POST a report, but not for causing connection failure.
but not for causing connection failure.
Note: There is no purpose to using the Public-Key-Pins-Report-Only Note: There is no purpose to using the PKP-RO header without the
header without the report-uri directive. User Agents MAY discard report-uri directive. User Agents MAY discard such headers without
such headers without interpreting them further. interpreting them further.
If a Host sets the Public-Key-Pins-Report-Only header, the UA SHOULD When the PKP header is used with a report-uri, the UA SHOULD POST
note the Pins and directives given in the Public-Key-Pins-Report-Only reports for Pin Validation failures to the indicated report-uri, as
header as specified by the max-age directive. If the UA does note well as enforcing Pin Validation.
the Pins and directives in the Public-Key-Pins-Report-Only header it
If a Host sets the PKP-RO header, the UA SHOULD note the Pins and
directives given in the PKP-RO header as specified by the max-age
directive. If the UA does note the Pins and directives in the PKP-RO
header it SHOULD evaluate the specified policy and SHOULD report any
would-be Pin Validation failures that would occur if the report-only
policy were enforced.
If a Host sets both the PKP header and the PKP-RO header, the UA MUST
note and enforce Pin Validation as specified by the PKP header, and
SHOULD note the Pins and directives given in the PKP-RO header. If
the UA does note the Pins and directives in the PKP-RO header it
SHOULD evaluate the specified policy and SHOULD report any would-be SHOULD evaluate the specified policy and SHOULD report any would-be
Pin Validation failures that would occur if the report-only policy Pin Validation failures that would occur if the report-only policy
were enforced. were enforced.
If a Host sets both the Public-Key-Pins header and the Public-Key-
Pins-Report-Only header, the UA MUST note and enforce Pin Validation
as specified by the Public-Key-Pins header, and SHOULD note the Pins
and directives given in the Public-Key-Pins-Report-Only header. If
the UA does note the Pins and directives in the Public-Key-Pins-
Report-Only header it SHOULD evaluate the specified policy and SHOULD
report any would-be Pin Validation failures that would occur if the
report-only policy were enforced.
2.3.3. Noting a Pinned Host - Storage Model 2.3.3. Noting a Pinned Host - Storage Model
The Effective Pin Date of a Known Pinned Host is the time that the UA The Effective Pin Date of a Known Pinned Host is the time that the UA
observed a Valid Pinning Header for the host. The Effective observed a Valid Pinning Header for the host. The Effective
Expiration Date of a Known Pinned Host is the Effective Pin Date plus Expiration Date of a Known Pinned Host is the Effective Pin Date plus
the max-age. A Known Pinned Host is "expired" if the Effective the max-age. A Known Pinned Host is "expired" if the Effective
Expiration Date refers to a date in the past. The UA MUST ignore all Expiration Date 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 expired Known Pinned Hosts from its cache if, at any time, an expired
Known Pinned Host exists in the cache. Known Pinned Host exists in the cache.
skipping to change at page 11, line 18 skipping to change at page 11, line 20
2.3.4. HTTP-Equiv <Meta> Element Attribute 2.3.4. HTTP-Equiv <Meta> Element Attribute
UAs MUST NOT heed http-equiv="Public-Key-Pins" or http-equiv="Public- UAs MUST NOT heed http-equiv="Public-Key-Pins" or http-equiv="Public-
Key-Pins-Report-Only" attribute settings on <meta> elements Key-Pins-Report-Only" attribute settings on <meta> elements
[W3C.REC-html401-19991224] in received content. [W3C.REC-html401-19991224] in received content.
2.4. Semantics of Pins 2.4. Semantics of Pins
An SPKI Fingerprint is defined as the output of a known cryptographic An SPKI Fingerprint is defined as the output of a known cryptographic
hash algorithm whose input is the DER-encoded ASN.1 representation of hash algorithm whose input is the DER-encoded ASN.1 representation of
the SubjectPublicKeyInfo (SPKI) field of an X.509 certificate. A Pin the subjectPublicKeyInfo (SPKI) field of an X.509 certificate. A Pin
is defined as the combination of the known algorithm identifier and is defined as the combination of the known algorithm identifier and
the SPKI Fingerprint computed using that algorithm. the SPKI Fingerprint computed using that algorithm.
The SPKI Fingerprint is encoded in base 64 for use in an HTTP header. The SPKI Fingerprint is encoded in base 64 for use in an HTTP header.
(See [RFC4648].) (See [RFC4648].)
In this version of the specification, the known cryptographic hash In this version of the specification, the known cryptographic hash
algorithm is SHA-256, identified as "sha256" ([RFC4634]). (Future algorithm is SHA-256, identified as "sha256" ([RFC4634]). (Future
versions of this specification may add new algorithms and deprecate versions of this specification may add new algorithms and deprecate
old ones.) UAs MUST ignore Pins for which they do not recognize the old ones.) UAs MUST ignore Pins for which they do not recognize the
skipping to change at page 11, line 46 skipping to change at page 11, line 48
SubjectPublicKeyInfo ::= SEQUENCE { SubjectPublicKeyInfo ::= SEQUENCE {
algorithm AlgorithmIdentifier, algorithm AlgorithmIdentifier,
subjectPublicKey BIT STRING } subjectPublicKey BIT STRING }
AlgorithmIdentifier ::= SEQUENCE { AlgorithmIdentifier ::= SEQUENCE {
algorithm OBJECT IDENTIFIER, algorithm OBJECT IDENTIFIER,
parameters ANY DEFINED BY algorithm OPTIONAL } parameters ANY DEFINED BY algorithm OPTIONAL }
Figure 4: SPKI Definition Figure 4: SPKI Definition
If the SubjectPublicKeyInfo of a certificate is incomplete when taken If the certificate's subjectPublicKeyInfo is incomplete when taken in
in isolation, such as when holding a DSA key without domain isolation, such as when holding a DSA key without domain parameters,
parameters, a public key pin cannot be formed. a public key pin cannot be formed. Hence, pins using these keys
cannot be pinned.
We pin public keys, rather than entire certificates, to enable We pin public keys, rather than entire certificates, to enable
operators to generate new certificates containing old public keys operators to generate new certificates containing old public keys
(see [why-pin-key]). (see [why-pin-key]).
See Appendix A for an example non-normative program that generates See Appendix A for an example non-normative program that generates
SPKI Fingerprints from SubjectPublicKeyInfo fields in certificates. SPKI Fingerprints from certificates.
2.5. Noting Pins 2.5. Noting Pins
Upon receipt of the Public-Key-Pins response header field, the UA Upon receipt of the PKP response header field, the UA notes the host
notes the host as a Pinned Host, storing the Pins and their as a Pinned Host, storing the Pins and their associated directives in
associated directives in non-volatile storage (for example, along non-volatile storage (for example, along with the HSTS metadata).
with the HSTS metadata). The Pins and their associated directives The Pins and their associated directives are collectively known as
are collectively known as Pinning Metadata. Pinning Metadata.
The UA MUST observe these conditions when noting a Host: The UA MUST observe these conditions when noting a Host:
o The UA MUST note the Pins if and only if it received the Public- o The UA MUST note the Pins if and only if it received the PKP
Key-Pins response header field over an error-free TLS connection. response header field over an error-free TLS connection. If the
If the host is a Pinned Host, this includes the validation added host is a Pinned Host, this includes the validation added in
in Section 2.6. 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.3.) Section 4.3.)
If the Public-Key-Pins response header field does not meet all three If the PKP response header field does not meet all three of these
of these criteria, the UA MUST NOT note the host as a Pinned Host. A criteria, the UA MUST NOT note the host as a Pinned Host. A PKP
Public-Key-Pins response header field that meets all these critera is response header field that meets all these critera is known as a
known as a Valid Pinning Header. Valid Pinning Header.
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, Effective Expiration Date
given in the most recently received Valid Pinning Header. (computed from max-age), and (if any) report-uri given in the most
recently received Valid Pinning Header.
For forward compatibility, the UA MUST ignore any unrecognized For forward compatibility, the UA MUST ignore any unrecognized PKP
Public-Key-Pins header directives, while still processing those and PKP-RO header directives, while still processing those directives
directives it does recognize. Section 2.1 specifies the directives it does recognize. Section 2.1 specifies the directives max-age,
max-age, Pins, includeSubDomains, and report-uri but future Pins, includeSubDomains, and report-uri but future specifications and
specifications and implementations might use additional directives. implementations might use additional directives.
Upon receipt of a Public-Key-Pins-Report-Only response header field, Upon receipt of a PKP-RO response header field, the UA SHOULD
the UA SHOULD evaluate the policy expressed in the PKP-RO field, and evaluate the policy expressed in the field, and SHOULD generate and
SHOULD generate and send a report (see Section 3). However, failure send a report (see Section 3). However, failure to validate the pins
to validate the pins in the PKP-RO MUST have no effect on the in the field MUST have no effect on the validity or non-validity of
validity or non-validity of the policy expressed in the PKP field or the policy expressed in the PKP field or in previously-noted pins for
in previously-noted pins for the Known Pinned Host. the Known Pinned Host.
The UA SHOULD NOT note any pins or other policy expressed in the PKP- The UA SHOULD NOT note any pins or other policy expressed in the PKP-
RO response header field. RO response header field.
2.6. Validating Pinned Connections 2.6. Validating Pinned Connections
When a UA connects to a Pinned Host, if the TLS connection has When a UA connects to a Pinned Host, if the TLS connection has
errors, the UA MUST terminate the connection without allowing the errors, the UA MUST terminate the connection without allowing the
user to proceed anyway. (This behavior is the same as that required user to proceed anyway. (This behavior is the same as that required
by [RFC6797].) by [RFC6797].)
skipping to change at page 13, line 27 skipping to change at page 13, line 32
If the connection has no errors, then the UA will determine whether If the connection has no errors, then the UA will determine whether
to apply a new, additional correctness check: Pin Validation. A UA to apply a new, additional correctness check: Pin Validation. A UA
SHOULD perform Pin Validation whenever connecting to a Known Pinned SHOULD perform Pin Validation whenever connecting to a Known Pinned
Host, but MAY allow Pin Validation to be disabled for Hosts according Host, but MAY allow Pin Validation to be disabled for Hosts according
to local policy. For example, a UA may disable Pin Validation for to local policy. For example, a UA may disable Pin Validation for
Pinned Hosts whose validated certificate chain terminates at a user- Pinned Hosts whose validated certificate chain terminates at a user-
defined trust anchor, rather than a trust anchor built-in to the UA. defined trust anchor, rather than a trust anchor built-in to the UA.
To perform Pin Validation, the UA will compute the SPKI Fingerprints To perform Pin Validation, the UA will compute the SPKI Fingerprints
for each certificate in the Pinned Host's validated certificate for each certificate in the Pinned Host's validated certificate
chain, using each supported hash algorithm for each certificate. chain, using each supported hash algorithm for each certificate. (As
(For the purposes of Pin Validation, the UA MUST ignore certificates described in Section 2.4, certificates whose SPKI cannot be taken in
whose SPKI cannot be taken in isolation, and MUST ignore superfluous isolation cannot be pinned.) The UA MUST ignore superfluous
certificates in the chain that do not form part of the validating certificates in the chain that do not form part of the validating
chain.) The UA will then check that the set of these SPKI chain. The UA will then check that the set of these SPKI
Fingerprints intersects the set of SPKI Fingerprints in that Pinned Fingerprints intersects the set of SPKI Fingerprints in that Pinned
Host's Pinning Metadata. If there is set intersection, the UA Host's Pinning Metadata. If there is set intersection, the UA
continues with the connection as normal. Otherwise, the UA MUST continues with the connection as normal. Otherwise, the UA MUST
treat this Pin Failure as a non-recoverable error. Any procedure treat this Pin Validation Failure as a non-recoverable error. Any
that matches the results of this Pin Validation procedure is procedure that matches the results of this Pin Validation procedure
considered equivalent. is considered equivalent.
Note that, although the UA has previously received Pins at the HTTP Although the UA has previously received Pins at the HTTP layer, it
layer, it can and MUST perform Pin Validation at the TLS layer, can and MUST perform Pin Validation at the TLS layer, before
before beginning an HTTP conversation over the TLS channel. The TLS beginning an HTTP conversation over the TLS channel. The TLS layer
layer thus evaluates TLS connections with pinning information the UA 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 additional sources of pinning UAs MAY choose to implement additional sources of pinning
information, such as through built-in lists of pinning information. information, such as through built-in lists of pinning information.
Such UAs SHOULD allow users to override such additional sources, Such UAs SHOULD allow users to override such additional sources,
including disabling them from consideration. including disabling them from consideration.
The effective policy for a Known Pinned Host that has both built-in The effective policy for a Known Pinned Host that has both built-in
pins and pins from previously observed PKP header response fields is pins and pins from previously observed PKP header response fields is
implementation-defined. implementation-defined.
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
skipping to change at page 14, line 46 skipping to change at page 14, line 50
pem1, ... pemN pem1, ... pemN
], ],
"known-pins": [ "known-pins": [
known-pin1, ... known-pinN known-pin1, ... known-pinN
] ]
} }
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 MUST 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 failure. It is provided as a string formatted according to
Section 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 as an integer.
integer.
The effective-expiration-date is the Effective Expiration Date for The effective-expiration-date is the Effective Expiration Date for
the noted Pins. It is provided as a string formatted according to the noted Pins. It is provided as a string formatted according to
Section 5.6, "Internet Date/Time Format", of [RFC3339]. Section 5.6, "Internet Date/Time Format", of [RFC3339].
include-subdomains indicates whether or not the UA has noted the include-subdomains indicates whether or not the UA has noted the
includeSubDomains directive for the Known Pinned Host. It is includeSubDomains directive for the Known Pinned Host. It is
provided as one of the JSON identifiers true or false. provided as one of the JSON identifiers true or false.
The served-certificate-chain is the certificate chain, as served by The served-certificate-chain is the certificate chain, as served by
skipping to change at page 16, line 6 skipping to change at page 16, line 6
Figure 6: Known Pin Syntax Figure 6: Known Pin Syntax
As in Section 2.4, the token refers to the algorithm name, and the As in Section 2.4, the token refers to the algorithm name, and the
quoted-string refers to the base 64 encoding of the SPKI Fingerprint. quoted-string refers to the base 64 encoding of the SPKI Fingerprint.
When formulating the JSON POST body, the UA MUST either use single- When formulating the JSON POST body, the UA MUST either use single-
quoted JSON strings, or use double-quoted JSON strings and \-escape quoted JSON strings, or use double-quoted JSON strings and \-escape
the embedded double quotes in the quoted-string part of the known- the embedded double quotes in the quoted-string part of the known-
pin. pin.
Figure 7 shows an example of a Pin Validation failure report. (PEM Figure 7 shows an example of a Pin Validation failure report. (PEM
strings are shown on multiple lines for readability in this strings are shown on multiple lines for readability.)
document.)
{ {
"date-time": "2014-04-06T13:00:50Z", "date-time": "2014-04-06T13:00:50Z",
"hostname": "www.example.com", "hostname": "www.example.com",
"port": 443, "port": 443,
"effective-expiration-date": "2014-05-01T12:40:50Z" "effective-expiration-date": "2014-05-01T12:40:50Z"
"include-subdomains": false, "include-subdomains": false,
"served-certificate-chain": [ "served-certificate-chain": [
"-----BEGIN CERTIFICATE-----\n "-----BEGIN CERTIFICATE-----\n
MIIEBDCCAuygAwIBAgIDAjppMA0GCSqGSIb3DQEBBQUAMEIxCzAJBgNVBAYTAlVT\n MIIEBDCCAuygAwIBAgIDAjppMA0GCSqGSIb3DQEBBQUAMEIxCzAJBgNVBAYTAlVT\n
skipping to change at page 17, line 44 skipping to change at page 17, line 41
Host operator error; network attack; or a Known Pinned Host that Host operator error; network attack; or a Known Pinned Host that
intentionally migrates all pinned keys, combined with a UA that has 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 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 observe the new true Pins for the Host. (This last example
underscores the importance for Host operators to phase in new keys underscores the importance for Host operators to phase in new keys
gradually, and to set the max-age value in accordance with their gradually, and to set the max-age value in accordance with their
planned key migration schedule.) planned key migration schedule.)
There is probably no ideal upper limit to the max-age directive that 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 60 would satisfy all use cases. However, a value on the order of 60
days (5184000 seconds) may be considered a balance between the two days (5,184,000 seconds) may be considered a balance between the two
competing security concerns. competing security concerns.
4.2. Using includeSubDomains Safely 4.2. Using includeSubDomains Safely
It may happen that Pinned Hosts whose hostnames share a parent domain It may happen that Pinned Hosts whose hostnames share a parent domain
use different Valid Pinning Headers. If a Host whose hostname is a use different Valid Pinning Headers. If a Host whose hostname is a
parent domain for another Host sets the includeSubDomains directive, parent domain for another Host sets the includeSubDomains directive,
the two Hosts' Pins may conflict with each other. For example, the two Hosts' Pins may conflict with each other. For example,
consider two Known Pinned Hosts, example.com and consider two Known Pinned Hosts, example.com and
subdomain.example.com. Assume example.com sets a Valid Pinning subdomain.example.com. Assume example.com sets a Valid Pinning
skipping to change at page 18, line 26 skipping to change at page 18, line 24
Public-Key-Pins: pin-sha256="GHI..."; pin-sha256="JKL..." Public-Key-Pins: pin-sha256="GHI..."; pin-sha256="JKL..."
Figure 9: subdomain.example.com Valid Pinning Header Figure 9: subdomain.example.com Valid Pinning Header
Assume a UA that has not previously noted any Pins for either of 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 these Hosts. If the UA first contacts subdomain.example.com, it will
note the Pins in the Valid Pinning Header, and perform Pin Validation note the Pins in the Valid Pinning Header, and perform Pin Validation
as normal on subsequent conections. If the UA then contacts as normal on subsequent conections. If the UA then contacts
example.com, again it will note the Pins and perform Pin Validation example.com, again it will note the Pins and perform Pin Validation
on future connections. However, if the UA happened to first on future connections.
example.com before subdomain.example.com, the UA would, due to
example.com's use of the includeSubDomains directive, attempt to However, if the UA happened to visit example.com before
perform Pin Validation for subdomain.example.com using the SPKI subdomain.example.com, the UA would, due to example.com's use of the
hashes ABC... and DEF..., which are not valid for the certificate includeSubDomains directive, attempt to perform Pin Validation for
chains subdomain.example.com (which uses certificates with SPKIs subdomain.example.com using the SPKI hashes ABC... and DEF..., which
GHI... and JLK...). Thus, depending on the order in which the UA are not valid for the certificate chains subdomain.example.com (which
observes the Valid Pinning Headers for hosts example.com and uses certificates with SPKIs GHI... and JLK...). Thus, depending on
subdomain.example.com, Pin Validation might or might not fail for the order in which the UA observes the Valid Pinning Headers for
subdomain.example.com, even if the certificate chain the UA receives hosts example.com and subdomain.example.com, Pin Validation might or
for subdomain.example.com is perfectly valid. 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 use the includeSubDomains directive Thus, Pinned Host operators must use the includeSubDomains directive
with care. For example, they may choose to use overlapping pin sets with care. For example, they may choose to use overlapping pin sets
for hosts under a parent domain that uses includeSubDomains, or to for hosts under a parent domain that uses includeSubDomains, or to
not use the includeSubDomains directive in their effective-second- not use the includeSubDomains directive in their effective-second-
level domains, or to simply use the same pin set for all hosts under level domains, or to simply use the same pin set for all hosts under
a given parent domain. a given parent domain.
4.3. Backup Pins 4.3. Backup Pins
The primary way to cope with the risk of inadvertent Pin Failure is The primary way to cope with the risk of inadvertent Pin Validation
to keep a Backup Pin. A Backup Pin is a fingerprint for the public Failure is to keep a Backup Pin. A Backup Pin is a fingerprint for
key of a secondary, not-yet-deployed key pair. The operator keeps the public key of a secondary, not-yet-deployed key pair. The
the backup key pair offline, and sets a pin for it in the Public-Key- operator keeps the backup key pair offline, and sets a pin for it in
Pins header. Then, in case the operator loses control of their the PKP 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.
Because having a backup key pair is so important to recovery, UAs Because having a backup key pair is so important to recovery, UAs
MUST require that hosts set a Backup Pin. (See Section 2.5.) MUST require that hosts set a Backup Pin. (See Section 2.5.)
4.4. Interactions With Cookie Scoping 4.4. Interactions With Cookie Scoping
HTTP cookies [RFC6265] set by a Known Pinned Host can be stolen by a HTTP cookies [RFC6265] set by a Known Pinned Host can be stolen by a
network attacker who can forge web and DNS responses so as to cause a network attacker who can forge web and DNS responses so as to cause a
client to send the cookies to a phony subdomain of the Host. To client to send the cookies to a phony subdomain of the Host. To
prevent this, Hosts SHOULD set the "secure" attribute and omit the prevent this, Hosts SHOULD set the "secure" attribute and omit the
"domain" attribute on all security-sensitive cookies, such as session "domain" attribute on all security-sensitive cookies, such as session
cookies. These settings tell the browser that the cookie should only cookies. These settings tell the browser that the cookie should only
be presented back to the originating host (not its subdomains), and be sent back to the originating host (not its subdomains), and should
should only be sent over HTTPS (not HTTP). only be sent over HTTPS (not HTTP).
5. Privacy Considerations 5. Privacy Considerations
Conforming implementations (as well as implementations conforming to Hosts can use HSTS or HPKP as a "super-cookie", by setting distinct
[RFC6797]) must store state about which domains have set policies, policies for a number of subdomains. For example, assume example.com
hence which domains the UA has contacted. A forensic attacker might wishes to track distinct UAs without explicitly setting a cookie, or
find this information useful, even if the user has cleared other if a previously-set cookie is deleted from the UA's cookie store.
parts of the UA's state. Here are two attack scenarios.
More importantly, Hosts can use HSTS or HPKP as a "super-cookie", by
setting distinct policies for a number of subdomains. For example,
assume example.com wishes to track distinct UAs without explicitly
setting a cookie, or if a previously-set cookie is deleted from the
UA's cookie store. Here are two attack scenarios.
o example.com can use report-uri and the ability to pin arbitrary o example.com can use report-uri and the ability to pin arbitrary
identifiers to distinguish UAs. identifiers to distinguish UAs.
1. example.com sets a Valid Pinning Header in its response to 1. example.com sets a Valid Pinning Header in its response to
requests. The header asserts the includeSubDomains directive, requests. The header asserts the includeSubDomains directive,
and specifies a report-uri directive as well. Pages served by and specifies a report-uri directive as well. Pages served by
the host also include references to subresource https:// the host also include references to subresource
bad.example.com/foo.png. https://bad.example.com/foo.png.
2. The Valid Pinning Header includes a "pin" that is not really 2. The Valid Pinning Header includes a "pin" that is not really
the hash of an SPKI, but is instead an arbitrary the hash of an SPKI, but is instead an arbitrary
distinguishing string sent only in response to a particular distinguishing string sent only in response to a particular
request. For each request, the Host creates a new, distinct request. For each request, the Host creates a new, distinct
distinguishing string and sets it as if it were a pin. distinguishing string and sets it as if it were a pin.
3. The certificate chain served by bad.example.com does not pass 3. The certificate chain served by bad.example.com does not pass
Pin Validation given the pin set the Host asserted in (1). Pin Validation given the pin set the Host asserted in (1).
The HPKP-conforming UA attempts to report the Pin Validation The HPKP-conforming UA attempts to report the Pin Validation
failure to the specified report-uri, including the certificate failure to the specified report-uri, including the certificate
chain it observed and the SPKI hashes it expected to see. chain it observed and the SPKI hashes it expected to see.
Among the SPKI hashes is the distinguishing string in step Among the SPKI hashes is the distinguishing string in step
(2). (2).
4. Different site operators/origins can optionally collaborate by
setting the report-uri to be in an origin they share
administrative control of. UAs MAY, therefore, refuse to send
reports outside of the origin that set the PKP or PKP-RO
header.
o example.com can use SNI and subdomains to distinguish UAs. o example.com can use SNI and subdomains to distinguish UAs.
1. example.com sets a Valid Pinning Header in its response to 1. example.com sets a Valid Pinning Header in its response to
requests. The header asserts the includeSubDomains directive. requests. The header asserts the includeSubDomains directive.
2. On a subsequent page view, the Host responds with a page 2. On a subsequent page view, the Host responds with a page
including the subresource https://0.fingerprint.example.com/ including the subresource https://0.fingerprint.example.com/
foo.png, and the server responds using a certificate chain foo.png, and the server responds using a certificate chain
that does not pass Pin Validation for the pin-set defined in that does not pass Pin Validation for the pin-set defined in
the Valid Pinning Header in step (1). The HPKP-conforming UA the Valid Pinning Header in step (1). The HPKP-conforming UA
skipping to change at page 20, line 35 skipping to change at page 20, line 33
particular UA had noted the (good) Pins for that subdomain. particular UA had noted the (good) Pins for that subdomain.
3. example.com can distinguish 2^N UAs by serving Valid Pinning 3. example.com can distinguish 2^N UAs by serving Valid Pinning
Headers from an arbitrary number N distinct subdomains, giving Headers from an arbitrary number N distinct subdomains, giving
some UAs Valid Pinning Headers for some, but not all some UAs Valid Pinning Headers for some, but not all
subdomains (causing subsequent requests for subdomains (causing subsequent requests for
n.fingerprint.example.com to fail), and giving some UAs no n.fingerprint.example.com to fail), and giving some UAs no
Valid Pinning Header for other subdomains (causing subsequent Valid Pinning Header for other subdomains (causing subsequent
requests for m.fingerprint.example.com to succeed). requests for m.fingerprint.example.com to succeed).
Conforming implementations (as well as implementations conforming to
[RFC6797]) must store state about which domains have set policies,
hence which domains the UA has contacted. A forensic attacker might
find this information useful, even if the user has cleared other
parts of the UA's state.
6. IANA Considerations 6. IANA Considerations
IANA is requested to register the header described in this document IANA is requested to register the header described in this document
in the "Message Headers" registry, with the following parameters: in the "Message Headers" registry, with the following parameters:
o Header Field Names should be "Public-Key-Pins" and "Public-Key- o Header Field Names should be "Public-Key-Pins" and "Public-Key-
Pins-Report-Only". Pins-Report-Only".
o Protocol should be "http" o Protocol should be "http"
skipping to change at page 22, line 49 skipping to change at page 22, line 49
[RFC4627] Crockford, D., "The application/json Media Type for [RFC4627] Crockford, D., "The application/json Media Type for
JavaScript Object Notation (JSON)", RFC 4627, July 2006. JavaScript Object Notation (JSON)", RFC 4627, July 2006.
[RFC4634] Eastlake, D. and T. Hansen, "US Secure Hash Algorithms [RFC4634] Eastlake, D. and T. Hansen, "US Secure Hash Algorithms
(SHA and HMAC-SHA)", RFC 4634, July 2006. (SHA and HMAC-SHA)", RFC 4634, July 2006.
[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.
[RFC4648] Josefsson, S., "The Base16, Base32, and Base64 Data
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.
[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
 End of changes. 57 change blocks. 
177 lines changed or deleted 176 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/