draft-ietf-websec-key-pinning-17.txt   draft-ietf-websec-key-pinning-18.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: December 27, 2014 Google, Inc. Expires: January 4, 2015 Google, Inc.
June 25, 2014 July 3, 2014
Public Key Pinning Extension for HTTP Public Key Pinning Extension for HTTP
draft-ietf-websec-key-pinning-17 draft-ietf-websec-key-pinning-18
Abstract Abstract
This memo describes an extension to the HTTP protocol allowing web This document describes an extension to the HTTP protocol allowing
host operators to instruct user agents to remember ("pin") the hosts' web host operators to instruct user agents to remember ("pin") the
cryptographic identities for a given period of time. During that hosts' cryptographic identities for a given period of time. During
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
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 December 27, 2014. This Internet-Draft will expire on January 4, 2015.
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 3, line 7 skipping to change at page 3, line 7
9. What's Changed . . . . . . . . . . . . . . . . . . . . . . . 22 9. What's Changed . . . . . . . . . . . . . . . . . . . . . . . 22
10. References . . . . . . . . . . . . . . . . . . . . . . . . . 23 10. References . . . . . . . . . . . . . . . . . . . . . . . . . 23
10.1. Normative References . . . . . . . . . . . . . . . . . . 23 10.1. Normative References . . . . . . . . . . . . . . . . . . 23
10.2. Informative References . . . . . . . . . . . . . . . . . 24 10.2. Informative References . . . . . . . . . . . . . . . . . 24
Appendix A. Fingerprint Generation . . . . . . . . . . . . . . . 25 Appendix A. Fingerprint Generation . . . . . . . . . . . . . . . 25
Appendix B. Deployment Guidance . . . . . . . . . . . . . . . . 25 Appendix B. Deployment Guidance . . . . . . . . . . . . . . . . 25
Authors' Addresses . . . . . . . . . . . . . . . . . . . . . . . 26 Authors' Addresses . . . . . . . . . . . . . . . . . . . . . . . 26
1. Introduction 1. Introduction
We propose a new HTTP header to enable a web host to express to user This document defines a new HTTP header that enables a web host to
agents (UAs) which Subject Public Key Info (SPKI) structure(s) UAs express to user agents (UAs) which Subject Public Key Info (SPKI)
SHOULD expect to be present in the host's certificate chain in future structure(s) UAs SHOULD expect to be present in the host's
connections using TLS (see [RFC5246]). We call this "public key certificate chain in future connections using TLS [RFC5246]. We call
pinning" (PKP). At least one UA (Google Chrome) has experimented this "public key pinning" (PKP). At least one UA (Google Chrome) has
with the idea by shipping with a user-extensible embedded set of experimented with the idea by shipping with a user-extensible
Pins. Although effective, this does not scale. This proposal embedded set of Pins. Although effective, this does not scale. This
addresses the scale problem. proposal addresses the scale problem.
Deploying PKP safely will require operational and organizational Deploying PKP safely will require operational and organizational
maturity due to the risk that hosts may make themselves unavailable maturity due to the risk that hosts may make themselves unavailable
by pinning to a (set of) SPKI(s) that becomes invalid. (See by pinning to a (set of) SPKI(s) that becomes invalid (see
Section 4.) We believe that, with care, host operators can greatly Section 4). With care, host operators can greatly reduce the risk of
reduce the risk of main-in-the-middle (MITM) attacks and other false- main-in-the-middle (MITM) attacks and other false-authentication
authentication problems for their users without incurring undue risk. problems for their users without incurring undue risk.
We intend for hosts to use PKP together with HSTS ([RFC6797]), but is
possible to pin keys without requiring HSTS.
This draft is being discussed on the WebSec Working Group mailing PKP is meant to be used toegether with HTTP Strict Transport Security
list, websec@ietf.org. (HSTS) [RFC6797], but is possible to pin keys without requiring HSTS.
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" and "Public-Key-Pins-Report-Only" header The "Public-Key-Pins" and "Public-Key-Pins-Report-Only" header
fields, also referred to within this specification as the PKP and fields, also referred to within this specification as the PKP and
PKP-RO header fields, respectively, are are response headers used by PKP-RO header fields, respectively, are new response headers defined
server to indicate that a a UA should perform Pin Validation in this specification. They are used by a server to indicate that a
(Section 2.6) in regards to the host emitting the response message UA should perform Pin Validation (Section 2.6) for the host emitting
containing these header fields, and provide the necessary information the response message, and to provide the necessary information for
for the UA to do so. the UA to do so.
Figure 1 describes the syntax (Augmented Backus-Naur Form) of the Figure 1 describes the syntax (Augmented Backus-Naur Form) of the
header fields, using the grammar defined in [RFC5234] and the rules header fields, using the grammar defined in [RFC5234] and the rules
defined in Section 3.2 of [RFC7230]. The field values of both header defined in Section 3.2 of [RFC7230]. The field values of both header
fields conform to the same rules. fields conform to the same rules.
Public-Key-Directives = [ directive ] *( OWS ";" OWS [ directive ] ) Public-Key-Directives = [ directive ] *( OWS ";" OWS [ directive ] )
directive = simple-directive directive = simple-directive
/ pin-directive / pin-directive
skipping to change at page 4, line 27 skipping to change at page 4, line 27
Figure 1: HPKP Header Syntax Figure 1: HPKP Header Syntax
OWS is used as defined in Section 3.2.3 of [RFC7230]. token and OWS is used as defined in Section 3.2.3 of [RFC7230]. token and
quoted-string are used as defined in Section 3.2.6 of [RFC7230]. quoted-string are used as defined in Section 3.2.6 of [RFC7230].
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 given header 2. A given simple-directive MUST NOT appear more than once in a
field. Directives are either optional or required, as stipulated given header field. Directives are either optional or required,
in their definitions. as stipulated in their definitions.
3. Directive names are case-insensitive. 3. Directive names are case-insensitive.
4. UAs MUST ignore any header fields containing directives, or other 4. UAs MUST ignore any header fields containing directives, or other
header field value data, that do not conform to the syntax header field value data, that do not conform to the syntax
defined in this specification. defined in this specification. In particular, UAs must not
attempt to fix malformed header fields.
5. If a header field contains any directive(s) the UA does not 5. If a header field contains any directive(s) the UA does not
recognize, the UA MUST ignore those directives. recognize, the UA MUST ignore those directives.
6. If the PKP or PKP-RO header field otherwise satisfies the above 6. If the PKP or PKP-RO header field otherwise satisfies the above
requirements (1 through 5), the UA MUST process the directives it requirements (1 through 5), the UA MUST process the directives it
recognizes. recognizes.
Additional directives extending the semantic functionality of the Additional directives extending the semantic functionality of the
header fields can be defined in other specifications, with a registry header fields can be defined in other specifications. The first such
(having an IANA policy definition of IETF Review [RFC5226]) defined specification will need to define a reistry for such directives.
for them at such time. Such future directives will be ignored by UAs Such future directives will be ignored by UAs implementing only this
implementing only this specification, as well as by generally non- specification, as well as by generally non-conforming UAs.
conforming UAs.
In the pin-directive, the token is the name of a cryptographic hash In the pin-directive, the token is the name of a cryptographic hash
algorithm, and MUST be "sha256". (In the future, additional hash algorithm. The only algorithm allowed at this time is "sha256";
algorithms MAY be registered and used.) The quoted-string is a additional algorithms may be defined in the future. The quoted-
sequence of base 64 digits: the base 64-encoded SPKI Fingerprint string is a sequence of base 64 digits: the base 64-encoded SPKI
([RFC4648]). See Section 2.4. Fingerprint [RFC4648] (see Section 2.4).
The UA MUST ignore pin-directives with tokens naming hash algorithms When a connection passes Pin Validation using the UA's noted Pins for
it does not recognize. If the set of remaining effective pin- the host at the time, the host becomes a Known Pinned Host.
directives is empty, and if the connection passed Pin Validation with
the UA's existing noted pins for the Host (i.e. the Host is a Known According to rule 5, above, the UA MUST ignore pin-directives with
Pinned Host), the UA MUST cease to consider the Host as a Known tokens naming hahs algorithms it does not recognize. If the set of
Pinned Host. (I.e. the UA should fail open.) The UA SHOULD indicate remaining effective pin-directives is empty, and if the host is a
to users that the Host is no longer a Known Pinned Host. Known Pinned Host, the UA MUST cease to consider the host as a Known
Pinned Host (the UA should fail open). The UA SHOULD indicate to
users that the host is no longer a Known Pinned Host.
2.1.1. The max-age Directive 2.1.1. The max-age Directive
The "max-age" directive specifies the number of seconds, after the The "max-age" directive specifies the number of seconds after the
reception of the PKP header field, during which the UA SHOULD regard reception of the PKP header field during which the UA SHOULD regard
the host (from whom the message was received) as a Known Pinned Host. the host (from whom the message was received) as a Known Pinned Host.
The delta-seconds production is specified in [RFC7234].
The "max-age" directive is REQUIRED to be present within a "Public- The "max-age" directive is REQUIRED to be present within a "Public-
Key-Pins" header field, and is OPTIONAL within a "Public-Key-Pins- Key-Pins" header field, and is OPTIONAL within a "Public-Key-Pins-
Report-Only" header field. Report-Only" header field.
If present, the max-age directive is REQUIRED to have a directive If present, the max-age directive is REQUIRED to have a directive
value, for which the the syntax (after quoted-string unescaping, if value, for which the the syntax (after quoted-string unescaping, if
necessary) is defined as: 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 [RFC7234], Section 1.2.1. delta-seconds is used as defined in [RFC7234], Section 1.2.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 that, if present (i.e., it is "asserted"), signals to the UA that the
the Pinning Policy applies to this Pinned Host as well as any Pinning Policy applies to this Pinned Host as well as any subdomains
subdomains of the host's domain name. 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 PKP or PKP-RO headers, the presence of a report-uri When used in the PKP or PKP-RO headers, the presence of a report-uri
directive indicates to the UA that in the event of Pin Validation directive indicates to the UA that in the event of Pin Validation
failure it SHOULD POST a report to the report-uri. If the header is failure it SHOULD POST a report to the report-uri. If the header is
Public-Key-Pins, the UA should do this in addition to terminating the Public-Key-Pins, the UA should do this in addition to terminating the
connection (as described in Section 2.6). connection (as described in 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 one that uses TLS (e.g. HTTPS or the scheme in the report-uri is one that uses TLS (e.g. HTTPS or
WSS), UAs MUST perform Pinning Validation when the host in the WSS), UAs MUST perform Pinning Validation when the host in the
report-uri is a Known Pinned Host; similarly, UAs MUST apply HSTS if report-uri is a Known Pinned Host; similarly, UAs MUST apply HSTS if
the host in the report-uri is a 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 host being reported about.
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. Similarly, if Known Pinned Host A sets a MUST cancel the connection. Similarly, if Known Pinned Host A sets a
report-uri referring to Known Pinned Host B, and if B sets a report- 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 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 SHOULD detect and break the loop by failing to send reports to and
about those hosts. about those hosts.
In any case of report failure, the UA MAY attempt to re-send the In any case of report failure, the UA MAY attempt to re-send the
report later. 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 per distinct set of declared pins. 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 PKP and PKP-RO response header fields.
extension. (Lines are folded to fit.) (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=";
skipping to change at page 8, line 6 skipping to change at page 8, line 6
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.
Each instance of either header field MUST satisfy the grammar Each instance of either header field MUST satisfy the grammar
specified in Section 2.1. 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, is accomplished as follows:
turn running over secure transport, by correctly returning (per this
specification) at least one valid PKP header field to the UA. Other 1. Over the HTTP protocol running over secure transport, by
mechanisms, such as a client-side pre-loaded Known Pinned Host list correctly returning (per this specification) at least one valid
MAY also be used. PKP header field to the UA.
2. Through other mechanisms, such as a client-side pre-loaded Known
Pinned Host List.
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
skipping to change at page 8, line 39 skipping to change at page 8, line 42
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 Pinned Host if it is not already so noted o Note the host as a Known Pinned Host if it is not already so noted
(see Section 2.3.3), (see Section 2.3.3),
or, or,
o Update the UA's cached information for the Known Pinned Host if o Update the UA's cached information for the Known Pinned Host if
any of of the max-age, includeSubDomains, or report-uri header any of of the max-age, includeSubDomains, or report-uri header
field value directives convey information different than that field value directives convey information different from that
already maintained by the UA. already maintained by the UA.
o The max-age value is essentially a "time to live" value relative The max-age value is essentially a "time to live" value relative to
to the time of the most recent observation of the PKP header the time of the most recent observation of the PKP header field. If
field. the max-age header field value token has a value of 0, the UA MUST
remove its cached Pinning Policy information (including the
o If the max-age header field value token has a value of 0, the UA includeSubDomains directive, if asserted) if the Pinned Host is
MUST remove its cached Pinning Policy information (including the Known, or, MUST NOT note this Pinned Host if it is not yet Known.
includeSubDomains directive, if asserted) if the Pinned Host is
Known, or, MUST NOT note this Pinned Host if it is not yet Known.
o If a UA receives more than one PKP header field or more than one
PKP-RO header fieled in an HTTP response message over secure
transport, then the UA MUST process only the first PKP header
field (if present) and only the first PKP-RO header field (if
present).
Otherwise:
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),
the UA MUST ignore any present PKP header field(s).
o Similarly, if the UA receives the HTTP response over insecure If a UA receives more than one PKP header field or more than one PKP-
transport, the UA MUST ignore any present PKP-RO header field(s). RO header fieled in an HTTP response message over secure transport,
then the UA MUST process only the first PKP header field (if present)
and only the first PKP-RO header field (if present).
o The UA MUST ignore any PKP or PKP-RO header fields not conforming If the UA receives the HTTP response over insecure transport, or if
to the grammar specified in Section 2.1. the PKP header is not a Valid Pinning Header (see Section 2.5), the
UA MUST ignore any present PKP header field(s). Similarly, if the UA
receives the HTTP response over insecure transport, the UA MUST
ignore any present PKP-RO header field(s). 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- A server MAY set both the "Public-Key-Pins" and "Public-Key-Pins-
Report-Only" headers simultaneously. The headers do not interact Report-Only" headers simultaneously. The headers do not interact
with one another but the UA MUST process the PKP header and SHOULD with one another but the UA MUST process the PKP header and SHOULD
process both. process both.
The headers are processed according to Section 2.3.1. The headers are processed according to Section 2.3.1.
skipping to change at page 9, line 44 skipping to change at page 9, line 42
it should POST a report, but not for causing connection failure. it should POST a report, but not for causing connection failure.
Note: There is no purpose to using the PKP-RO header without the Note: There is no purpose to using the PKP-RO header without the
report-uri directive. User Agents MAY discard such headers without report-uri directive. User Agents MAY discard such headers without
interpreting them further. interpreting them further.
When the PKP header is used with a report-uri, the UA SHOULD POST When the PKP header is used with a report-uri, the UA SHOULD POST
reports for Pin Validation failures to the indicated report-uri, as reports for Pin Validation failures to the indicated report-uri, as
well as enforcing Pin Validation. well as enforcing Pin Validation.
If a Host sets the PKP-RO header, the UA SHOULD note the Pins and 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 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 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 header it SHOULD evaluate the specified policy and SHOULD report any
would-be Pin Validation failures that would occur if the report-only would-be Pin Validation failures that would occur if the report-only
policy were enforced. policy were enforced.
If a Host sets both the PKP header and the PKP-RO header, the UA MUST 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 note and enforce Pin Validation as specified by the PKP header, and
SHOULD process the Pins and directives given in the PKP-RO header. SHOULD process the Pins and directives given in the PKP-RO header.
If the UA does process the Pins and directives in the PKP-RO header If the UA does process the Pins and directives in the PKP-RO header
it SHOULD evaluate the specified policy and SHOULD report any would- it SHOULD evaluate the specified policy and SHOULD report any would-
be Pin Validation failures that would occur if the report-only policy be Pin Validation failures that would occur if the report-only policy
were enforced. 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 any
expired Known Pinned Hosts from its cache if, at any time, an expired expired Known Pinned Hosts in its cache.
Known Pinned Host exists in the cache.
If the substring matching the host production from the Request-URI For example, if a UA is beginning to perform Pin Validation for a
(of the message to which the host responded) syntactically matches Known Pinned Host and finds that the cached pinning information for
the IP-literal or IPv4address productions from Section 3.2.2 of the host indicates an Effective Expiration Date in the past, the UA
[RFC3986], then the UA MUST NOT note this host as a Known Pinned MUST NOT continue with Pin Validation for the host, and must consider
Host. the host to no longer be a Known Pinned Host.
Otherwise, if the substring does not congruently match a Known Pinned Known Pinned Hosts are identified only by domain names, and never IP
Host's domain name, per the matching procedure specified in addresses. If the substring matching the host production from the
Section 8.2 of [RFC6797], then the UA MUST note this host as a Known Request-URI (of the message to which the host responded)
Pinned Host, caching the Pinned Host's domain name and noting along syntactically matches the IP-literal or IPv4address productions from
with it the Effective Expiration Date (or enough information to Section 3.2.2 of [RFC3986], then the UA MUST NOT note this host as a
calculate it, i.e. the Effective Pin Date and the value of the max- Known Pinned Host.
age directive), whether or not the includeSubDomains directive is
asserted, the value of the report-uri directive (if present). If any Otherwise, if the substring does not congruently match an existing
other metadata from optional or future PKP header directives is Known Pinned Host's domain name, per the matching procedure specified
present in the Valid Pinning Header, the UA MAY note them if it in Section 8.2 of [RFC6797], then the UA MUST add this host to the
understands them, and need not note them if it does not understand Known Pinned Host cache. The UA caches:
them.
o the Pinned Host's domain name,
o the Effective Expiration Date, or enough information to calculate
it (the Effective Pin Date and the value of the max-age
directive),
o whether or not the includeSubDomains directive is asserted, and
o the value of the report-uri directive, if present.
If any other metadata from optional or future PKP header directives
are present in the Valid Pinning Header, and the UA understands them,
the UA MAY note them as well.
UAs MAY set an upper limit on the value of max-age, so that UAs that UAs MAY set an upper limit on the value of max-age, so that UAs that
have noted erroneous Pins (whether by accident or due to attack) have 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 some chance of recovering over time. If the server sets a max-age
greater than the UA's upper limit, the UA MAY behave as if the server greater than the UA's upper limit, the UA MAY behave as if the server
set the max-age to the UA's upper limit. For example, if the UA caps set the max-age to the UA's upper limit. For example, if the UA caps
max-age at 5184000 seconds (60 days), and a Pinned Host sets a max- max-age at 5184000 seconds (60 days), and a Pinned Host sets a max-
age directive of 90 days in its Valid Pinning Header, the UA MAY age directive of 90 days in its Valid Pinning Header, the UA MAY
behave as if the max-age were effectively 60 days. (One way to behave as if the max-age were effectively 60 days. (One way to
achieve this behavior is for the UA to simply store a value of 60 achieve this behavior is for the UA to simply store a value of 60
skipping to change at page 11, line 24 skipping to change at page 11, line 31
[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].) [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" ([RFC6234]). (Future algorithm is SHA-256, identified as "sha256" [RFC6234]. (Future
versions of this specification may add new algorithms and deprecate specifications may add new algorithms and deprecate old ones.) UAs
old ones.) UAs MUST ignore Pins for which they do not recognize the MUST ignore Pins for which they do not recognize the algorithm
algorithm identifier. UAs MUST continue to process the rest of a PKP identifier. UAs MUST continue to process the rest of a PKP response
response header field and note Pins for algorithms they do recognize; header field and note Pins for algorithms they do recognize; UAs MUST
UAs MUST recognize "sha256". recognize "sha256".
Figure 4 reproduces the definition of the SubjectPublicKeyInfo Figure 4 reproduces the definition of the SubjectPublicKeyInfo
structure in [RFC5280]. structure in [RFC5280].
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 certificate's subjectPublicKeyInfo is incomplete when taken in If the certificate's subjectPublicKeyInfo is incomplete when taken in
isolation, such as when holding a DSA key without domain parameters, isolation, such as when holding a DSA key without domain parameters,
a public key pin cannot be formed. Hence, pins using these keys a public key pin cannot be formed.
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 certificates. SPKI Fingerprints from certificates.
2.5. Noting Pins 2.5. Noting Pins
Upon receipt of the PKP response header field, the UA notes the host Upon receipt of the PKP response header field, the UA notes the host
as a Pinned Host, storing the Pins and their associated directives in as a Known Pinned Host, storing the Pins and their associated
non-volatile storage (for example, along with the HSTS metadata). directives in non-volatile storage (for example, along with the HSTS
The Pins and their associated directives are collectively known as metadata). The Pins and their associated directives are collectively
Pinning Metadata. known as Pinning Metadata.
The UA MUST observe these conditions when noting a Host: The UA MUST note the Pins for a Host if and only if all three of the
following conditions hold:
o The UA MUST note the Pins if and only if it received the PKP o It received the PKP response header field over an error-free TLS
response header field over an error-free TLS connection. If the connection. If the host is a Pinned Host, this includes the
host is a Pinned Host, this includes the validation added in validation added in Section 2.6.
Section 2.6.
o The UA MUST note the Pins if and only if the TLS connection was o The TLS connection was authenticated with a certificate chain
authenticated with a certificate chain containing at least one of containing at least one of the SPKI structures indicated by at
the SPKI structures indicated by at least one of the given SPKI 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 given set of Pins contains at least one Pin that does NOT
contains at least one Pin that does NOT refer to an SPKI in the refer to an SPKI in the certificate chain. (That is, the host
certificate chain. (That is, the host must set a Backup Pin; see must set a Backup Pin; see Section 4.3.)
Section 4.3.)
If the PKP response header field does not meet all three of these If the PKP response header field does not meet all three of these
criteria, the UA MUST NOT note the host as a Pinned Host. A PKP criteria, the UA MUST NOT note the host as a Pinned Host. A PKP
response header field that meets all these critera is known as a response header field that meets all these critera is 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, Effective Expiration Date Pinning Metadata to the exact Pins, Effective Expiration Date
(computed from max-age), and (if any) report-uri given in the most (computed from max-age), and (if any) report-uri given in the most
recently received Valid Pinning Header. recently received Valid Pinning Header.
For forward compatibility, the UA MUST ignore any unrecognized PKP For forward compatibility, the UA MUST ignore any unrecognized PKP
and PKP-RO header directives, while still processing those directives and PKP-RO header directives, while still processing those directives
it does recognize. Section 2.1 specifies the directives max-age, it does recognize. Section 2.1 specifies the directives max-age,
Pins, includeSubDomains, and report-uri but future specifications and Pins, includeSubDomains, and report-uri but future specifications and
implementations might use additional directives. implementations might use additional directives.
Upon receipt of a PKP-RO response header field, the UA SHOULD Upon receipt of a PKP-RO response header field, the UA SHOULD
evaluate the policy expressed in the field, and SHOULD generate and evaluate the policy expressed in the field, and SHOULD generate and
send a report (see Section 3). However, failure to validate the pins send a report (see Section 3). However, failure to validate the Pins
in the field MUST have no effect on the validity or non-validity of in the field MUST have no effect on the validity or non-validity of
the policy expressed in the PKP field or in previously-noted pins for the policy expressed in the PKP field or in previously-noted Pins for
the Known Pinned Host. the Known Pinned Host.
The UA need not note any pins or other policy expressed in the PKP-RO The UA need not note any Pins or other policy expressed in the PKP-RO
response header field, except for the purpose of determining that it response header field, except for the purpose of determining that it
has already sent a report for a given policy. UAs SHOULD make a best has already sent a report for a given policy. UAs SHOULD make a best
effort not to inundate report-uris with redundant reports. effort not to inundate report-uris with redundant reports.
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].)
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. It is acceptable to allow Pin Validation to be disabled for
to local policy. For example, a UA may disable Pin Validation for some Hosts according to local policy. For example, a UA may disable
Pinned Hosts whose validated certificate chain terminates at a user- Pin Validation for Pinned Hosts whose validated certificate chain
defined trust anchor, rather than a trust anchor built-in to the UA. terminates at a user-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. (As chain, using each supported hash algorithm for each certificate. (As
described in Section 2.4, certificates whose SPKI cannot be taken in described in Section 2.4, certificates whose SPKI cannot be taken in
isolation cannot be pinned.) The UA 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 Validation Failure as a non-recoverable error. Any treat this Pin Validation Failure as a non-recoverable error. Any
procedure that matches the results of this Pin Validation procedure procedure that matches the results of this Pin Validation procedure
is considered equivalent. is considered equivalent.
Although the UA has previously received Pins at the HTTP layer, it Note that the UA MUST perform Pin Validation when setting up the TLS
can and MUST perform Pin Validation at the TLS layer, before session, before beginning an HTTP conversation over the TLS channel.
beginning an HTTP conversation over the TLS channel. The TLS layer
thus evaluates TLS connections with pinning information the UA
received previously, regardless of mechanism: statically preloaded,
via HTTP header, or some other means (possibly in the TLS layer
itself).
If Pin Validation is not in effect (e.g. because the user has elected UAs send validation failure reports only when Pin Validation is
to disable it, or because a presented certificate chain chains up to actually in effect. Pin Validation might not be in effect e.g.
a locally-installed anchor), and if the server has set a report-uri because the user has elected to disable it, or because a presented
in a PKP or PKP-RO header, the UA SHOULD NOT send any reports to the certificate chain chains up to a locally-installed anchor. In such
report-uri for the given certificate chain. cases, UAs SHOULD NOT send reports.
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
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
When a Known Pinned Host has set the report-uri directive, the UA When a Known Pinned Host has set the report-uri directive, the UA
SHOULD report Pin Validation failures to the indicated URI. The UA SHOULD report Pin Validation failures to the indicated URI. The UA
does this by POSTing a JSON ([RFC4627]) message to the URI; the JSON does this by POSTing a JSON [RFC4627] message to the URI; the JSON
message takes this form: message takes this form:
{ {
"date-time": date-time, "date-time": date-time,
"hostname": hostname, "hostname": hostname,
"port": port, "port": port,
"effective-expiration-date": expiration-date, "effective-expiration-date": expiration-date,
"include-subdomains": include-subdomains, "include-subdomains": include-subdomains,
"served-certificate-chain": [ "served-certificate-chain": [
pem1, ... pemN pem1, ... pemN
skipping to change at page 15, line 43 skipping to change at page 15, line 43
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 as an integer. failed Pin Validation. It is provided as an 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
the Known Pinned Host during TLS session setup. It is provided as an the Known Pinned Host during TLS session setup. It is provided as an
array of strings; each string pem1, ... pemN is the PEM array of strings; each string pem1, ... pemN is the PEM
representation of each X.509 certificate as described in representation of each X.509 certificate as described in
[I-D.josefsson-pkix-textual]. [I-D.josefsson-pkix-textual].
The validated-certificate-chain is the certificate chain, as The validated-certificate-chain is the certificate chain, as
constructed by the UA during certificate chain verification. (This constructed by the UA during certificate chain verification. (This
may differ from the served-certificate-chain.) It is provided as an may differ from the served-certificate-chain.) It is provided as an
skipping to change at page 18, line 26 skipping to change at page 18, line 26
disruption of service. disruption of service.
4.1. Maximum max-age 4.1. Maximum max-age
As mentioned in Section 2.3.3, UAs MAY cap the max-age value at some As mentioned in Section 2.3.3, UAs MAY cap the max-age value at some
upper limit. There is a security trade-off in that low maximum upper limit. There is a security trade-off in that low maximum
values provide a narrow window of protection for users who visit the values provide a narrow window of protection for users who visit the
Known Pinned Host only infrequently, while high maximum values might Known Pinned Host only infrequently, while high maximum values might
potentially result in a UA's inability to successfully perform Pin 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 Validation for a Known Pinned Host if the UA's noted Pins and the
Host's true Pins diverge. host's true Pins diverge.
Such divergence could occur for several reasons, including: UA error; Such divergence could occur for several reasons, including: UA error;
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 (5,184,000 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
Header such as this: Header such as this:
Public-Key-Pins: max-age=12000; pin-sha256="ABC..."; pin-sha256="DEF..."; Public-Key-Pins: max-age=12000; pin-sha256="ABC..."; pin-sha256="DEF...";
includeSubDomains includeSubDomains
Figure 8: example.com Valid Pinning Header Figure 8: example.com Valid Pinning Header
Assume subdomain.example.com sets a Valid Pinning Header such as Assume subdomain.example.com sets a Valid Pinning Header such as
this: this:
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. on future connections.
However, if the UA happened to visit example.com before However, if the UA happened to visit example.com before
subdomain.example.com, the UA would, due to example.com's use of the subdomain.example.com, the UA would, due to example.com's use of the
includeSubDomains directive, attempt to perform Pin Validation for includeSubDomains directive, attempt to perform Pin Validation for
subdomain.example.com using the SPKI hashes ABC... and DEF..., which subdomain.example.com using the SPKI hashes ABC... and DEF..., which
are not valid for the certificate chains subdomain.example.com (which are not valid for the certificate chains subdomain.example.com (which
skipping to change at page 20, line 6 skipping to change at page 20, line 6
The primary way to cope with the risk of inadvertent Pin Validation The primary way to cope with the risk of inadvertent Pin Validation
Failure is to keep a Backup Pin. A Backup Pin is a fingerprint for Failure is to keep a Backup Pin. A Backup Pin is a fingerprint for
the public key of a secondary, not-yet-deployed key pair. The the public key of a secondary, not-yet-deployed key pair. The
operator keeps the backup key pair offline, and sets a pin for it in operator keeps the backup key pair offline, and sets a pin for it in
the PKP 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). The down
side of keeping a not-yet-deployed key pair is that if an attacker
gains control of the private key she will be able to perform a MITM
attack without being discovered. Operators must take care to avoid
leaking the key such as keeping it offline.
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 sent back to the originating host (not its subdomains), and should be sent back to the originating host (not its subdomains), and should
only be sent over HTTPS (not HTTP). only be sent over HTTPS (not HTTP).
5. Privacy Considerations 5. Privacy Considerations
Hosts can use HSTS or HPKP as a "super-cookie", by setting distinct Hosts can use HSTS or HPKP as a "super-cookie", by setting distinct
policies for a number of subdomains. For example, assume example.com policies for a number of subdomains. For example, assume example.com
wishes to track distinct UAs without explicitly setting a cookie, or wishes to track distinct UAs without explicitly setting a cookie, or
skipping to change at page 20, line 39 skipping to change at page 20, line 43
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 the host also include references to subresource
https://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 4. Different site operators/origins can optionally collaborate by
setting the report-uri to be in an origin they share setting the report-uri to be in an origin they share
administrative control of. UAs MAY, therefore, refuse to send administrative control of. UAs MAY, therefore, refuse to send
reports outside of the origin that set the PKP or PKP-RO reports outside of the origin that set the PKP or PKP-RO
header. 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
will close the connection, never completing the request to will close the connection, never completing the request to
0.fingerprint.example.com. The Host may thus note that this 0.fingerprint.example.com. The host may thus note that this
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).
skipping to change at page 22, line 8 skipping to change at page 22, line 8
o Protocol should be "http" o Protocol should be "http"
o Status should be "standard" o Status should be "standard"
o Reference should be this document o Reference should be this document
7. Usability Considerations 7. Usability Considerations
When pinning works to detect impostor Pinned Hosts, users will When pinning works to detect impostor Pinned Hosts, users will
experience denial of service. UAs MUST explain the reason why, i.e. experience denial of service. It is advisable for UAs to explain the
that it was impossible to verify the confirmed cryptographic identity reason why, i.e. that it was impossible to verify the confirmed
of the host. cryptographic identity of the host.
UAs MUST have a way for users to clear current Pins for Pinned Hosts. It is advisable that UAs have a way for users to clear current Pins
UAs SHOULD have a way for users to query the current state of Pinned for Pinned Hosts, and to allow users to query the current state of
Hosts. Pinned Hosts.
8. Acknowledgements 8. Acknowledgements
Thanks to Tobias Gondrom, Jeff Hodges, Paul Hoffman, Ivan Krstic, Thanks to Tobias Gondrom, Jeff Hodges, Paul Hoffman, Ivan Krstic,
Adam Langley, Nicolas Lidzborski, SM, James Manger, Yoav Nir, Trevor Adam Langley, Barry Leiba, Nicolas Lidzborski, SM, James Manger, Yoav
Perrin, Eric Rescorla, Tom Ritter, and Yan Zhu for suggestions and Nir, Trevor Perrin, Eric Rescorla, Tom Ritter, and Yan Zhu for
edits that clarified the text. suggestions and edits that clarified the text.
9. What's Changed 9. What's Changed
[RFC EDITOR: PLEASE REMOVE THIS SECTION] [RFC EDITOR: PLEASE REMOVE THIS SECTION]
Clarified that max-age is REQUIRED for PKP, but OPTIONAL for PKP-RO Clarified that max-age is REQUIRED for PKP, but OPTIONAL for PKP-RO
(where it has no effect. (where it has no effect.
Updated header field syntax and description to match that in Updated header field syntax and description to match that in
[RFC7230]. [RFC7230].
skipping to change at page 23, line 30 skipping to change at page 23, line 30
Separated normative from non-normative material. Removed tangential Separated normative from non-normative material. Removed tangential
and out-of-scope non-normative discussion. and out-of-scope non-normative discussion.
10. References 10. References
10.1. Normative References 10.1. Normative References
[I-D.josefsson-pkix-textual] [I-D.josefsson-pkix-textual]
Josefsson, S. and S. Leonard, "Text Encodings of PKIX and Josefsson, S. and S. Leonard, "Text Encodings of PKIX and
CMS Structures", draft-josefsson-pkix-textual-03 (work in CMS Structures", draft-josefsson-pkix-textual-04 (work in
progress), April 2014. progress), July 2014.
[RFC2119] Bradner, S., "Key words for use in RFCs to Indicate [RFC2119] Bradner, S., "Key words for use in RFCs to Indicate
Requirement Levels", BCP 14, RFC 2119, March 1997. Requirement Levels", BCP 14, RFC 2119, March 1997.
[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, RFC Resource Identifier (URI): Generic Syntax", STD 66, RFC
3986, January 2005. 3986, January 2005.
skipping to change at page 25, line 21 skipping to change at page 25, line 21
openssl asn1parse -noout -inform pem -out public.key openssl asn1parse -noout -inform pem -out public.key
openssl dgst -sha256 -binary public.key | base64 openssl dgst -sha256 -binary public.key | base64
Figure 10: Example SPKI Fingerprint Generation Code Figure 10: 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
construct a valid Pin. However, in many deployment scenarios, in construct a valid Pin. However, in many deployment scenarios, in
order to make a Backup Pin operational the server operator will order to make a Backup Pin operational the server operator will
need to have a certificate to deploy TLS on the host. Failure to need to have a certificate to deploy TLS on the host. Failure to
obtain a certificate through prior arrangement will leave clients obtain a certificate through prior arrangement will leave clients
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 -- an
untested backup is no backup at all. 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
Chris Evans Chris Evans
 End of changes. 64 change blocks. 
190 lines changed or deleted 193 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/