idnits 2.17.1
draft-ietf-websec-key-pinning-21.txt:
Checking boilerplate required by RFC 5378 and the IETF Trust (see
https://trustee.ietf.org/license-info):
----------------------------------------------------------------------------
No issues found here.
Checking nits according to https://www.ietf.org/id-info/1id-guidelines.txt:
----------------------------------------------------------------------------
No issues found here.
Checking nits according to https://www.ietf.org/id-info/checklist :
----------------------------------------------------------------------------
No issues found here.
Miscellaneous warnings:
----------------------------------------------------------------------------
== The copyright year in the IETF Trust and authors Copyright Line does not
match the current year
-- The document date (October 5, 2014) is 3484 days in the past. Is this
intentional?
Checking references for intended status: Proposed Standard
----------------------------------------------------------------------------
(See RFCs 3967 and 4897 for information about using normative references
to lower-maturity documents in RFCs)
== Outdated reference: A later version (-10) exists of
draft-josefsson-pkix-textual-07
** Obsolete normative reference: RFC 4634 (Obsoleted by RFC 6234)
** Obsolete normative reference: RFC 5246 (Obsoleted by RFC 8446)
** Downref: Normative reference to an Informational RFC: RFC 6234
** Obsolete normative reference: RFC 7159 (Obsoleted by RFC 8259)
** Obsolete normative reference: RFC 7230 (Obsoleted by RFC 9110, RFC 9112)
** Obsolete normative reference: RFC 7234 (Obsoleted by RFC 9111)
-- Obsolete informational reference (is this intentional?): RFC 3546
(Obsoleted by RFC 4366)
-- Obsolete informational reference (is this intentional?): RFC 6962
(Obsoleted by RFC 9162)
Summary: 6 errors (**), 0 flaws (~~), 2 warnings (==), 3 comments (--).
Run idnits with the --verbose option for more detailed information about
the items above.
--------------------------------------------------------------------------------
2 Web Security C. Evans
3 Internet-Draft C. Palmer
4 Intended status: Standards Track R. Sleevi
5 Expires: April 8, 2015 Google, Inc.
6 October 5, 2014
8 Public Key Pinning Extension for HTTP
9 draft-ietf-websec-key-pinning-21
11 Abstract
13 This document defines a new HTTP header that allows web host
14 operators to instruct user agents to remember ("pin") the hosts'
15 cryptographic identities over a period of time. During that time,
16 UAs will require that the host presents a certificate chain including
17 at least one Subject Public Key Info structure whose fingerprint
18 matches one of the pinned fingerprints for that host. By effectively
19 reducing the number of trusted authorities who can authenticate the
20 domain during the lifetime of the pin, pinning may reduce the
21 incidence of man-in-the-middle attacks due to compromised
22 Certification Authorities.
24 Status of This Memo
26 This Internet-Draft is submitted in full conformance with the
27 provisions of BCP 78 and BCP 79.
29 Internet-Drafts are working documents of the Internet Engineering
30 Task Force (IETF). Note that other groups may also distribute
31 working documents as Internet-Drafts. The list of current Internet-
32 Drafts is at http://datatracker.ietf.org/drafts/current/.
34 Internet-Drafts are draft documents valid for a maximum of six months
35 and may be updated, replaced, or obsoleted by other documents at any
36 time. It is inappropriate to use Internet-Drafts as reference
37 material or to cite them other than as "work in progress."
39 This Internet-Draft will expire on April 8, 2015.
41 Copyright Notice
43 Copyright (c) 2014 IETF Trust and the persons identified as the
44 document authors. All rights reserved.
46 This document is subject to BCP 78 and the IETF Trust's Legal
47 Provisions Relating to IETF Documents
48 (http://trustee.ietf.org/license-info) in effect on the date of
49 publication of this document. Please review these documents
50 carefully, as they describe your rights and restrictions with respect
51 to this document. Code Components extracted from this document must
52 include Simplified BSD License text as described in Section 4.e of
53 the Trust Legal Provisions and are provided without warranty as
54 described in the Simplified BSD License.
56 Table of Contents
58 1. Introduction . . . . . . . . . . . . . . . . . . . . . . . . 3
59 1.1. Requirements Language . . . . . . . . . . . . . . . . . . 4
60 2. Server and Client Behavior . . . . . . . . . . . . . . . . . 4
61 2.1. Response Header Field Syntax . . . . . . . . . . . . . . 4
62 2.1.1. The pin- Directive . . . . . . . . . . . . . . . . . 5
63 2.1.2. The max-age Directive . . . . . . . . . . . . . . . . 6
64 2.1.3. The includeSubDomains Directive . . . . . . . . . . . 6
65 2.1.4. The report-uri Directive . . . . . . . . . . . . . . 6
66 2.1.5. Examples . . . . . . . . . . . . . . . . . . . . . . 7
67 2.2. Server Processing Model . . . . . . . . . . . . . . . . . 8
68 2.2.1. HTTP-over-Secure-Transport Request Type . . . . . . . 8
69 2.2.2. HTTP Request Type . . . . . . . . . . . . . . . . . . 9
70 2.3. User Agent Processing Model . . . . . . . . . . . . . . . 9
71 2.3.1. Public-Key-Pins Response Header Field Processing . . 9
72 2.3.2. Interaction of Public-Key-Pins and Public-Key-Pins-
73 Report-Only . . . . . . . . . . . . . . . . . . . . . 10
74 2.3.3. Noting a Pinned Host - Storage Model . . . . . . . . 11
75 2.3.4. HTTP-Equiv Element Attribute . . . . . . . . . 12
76 2.4. Semantics of Pins . . . . . . . . . . . . . . . . . . . . 12
77 2.5. Noting Pins . . . . . . . . . . . . . . . . . . . . . . . 13
78 2.6. Validating Pinned Connections . . . . . . . . . . . . . . 14
79 2.7. Interactions With Preloaded Pin Lists . . . . . . . . . . 15
80 2.8. Pinning Self-Signed End Entities . . . . . . . . . . . . 15
81 3. Reporting Pin Validation Failure . . . . . . . . . . . . . . 15
82 4. Security Considerations . . . . . . . . . . . . . . . . . . . 18
83 4.1. Maximum max-age . . . . . . . . . . . . . . . . . . . . . 19
84 4.2. Using includeSubDomains Safely . . . . . . . . . . . . . 19
85 4.3. Backup Pins . . . . . . . . . . . . . . . . . . . . . . . 20
86 4.4. Interactions With Cookie Scoping . . . . . . . . . . . . 21
87 4.5. Hostile Pinning . . . . . . . . . . . . . . . . . . . . . 21
88 5. Privacy Considerations . . . . . . . . . . . . . . . . . . . 21
89 6. IANA Considerations . . . . . . . . . . . . . . . . . . . . . 23
90 7. Usability Considerations . . . . . . . . . . . . . . . . . . 23
91 8. Acknowledgements . . . . . . . . . . . . . . . . . . . . . . 24
92 9. What's Changed . . . . . . . . . . . . . . . . . . . . . . . 24
93 10. References . . . . . . . . . . . . . . . . . . . . . . . . . 25
94 10.1. Normative References . . . . . . . . . . . . . . . . . . 25
95 10.2. Informative References . . . . . . . . . . . . . . . . . 26
96 Appendix A. Fingerprint Generation . . . . . . . . . . . . . . . 27
97 Appendix B. Deployment Guidance . . . . . . . . . . . . . . . . 27
98 Authors' Addresses . . . . . . . . . . . . . . . . . . . . . . . 28
100 1. Introduction
102 This document defines a new HTTP header that enables user agents
103 (UAs) to determine which Subject Public Key Info (SPKI) structures
104 will be present in a web host's certificate chain in future TLS
105 [RFC5246] connections.
107 Deploying PKP safely will require operational and organizational
108 maturity due to the risk that hosts may make themselves unavailable
109 by pinning to a (set of) SPKI(s) that becomes invalid (see
110 Section 4). With care, host operators can greatly reduce the risk of
111 main-in-the-middle (MITM) attacks and other false-authentication
112 problems for their users without incurring undue risk.
114 PKP is meant to be used together with HTTP Strict Transport Security
115 (HSTS) [RFC6797], but it is possible to pin keys without requiring
116 HSTS.
118 A Pin is a relationship between a hostname and a cryptographic
119 identity (in this document, 1 or more of the public keys in a chain
120 of X.509 certificates). Pin Validation is the process a UA performs
121 to ensure that a host is in fact authenticated with its previously-
122 established Pin.
124 Key pinning is a trust-on-first-use (TOFU) mechanism. The first time
125 a UA connects to a host, it lacks the information necessary to
126 perform Pin Validation; UAs can only apply their normal cryptographic
127 identity validation. (In this document, it is assumed that UAs apply
128 X.509 certificate chain validation in accord with [RFC5280].)
130 The UA will not be able to detect and thwart a MITM attacking the
131 UA's first connection to the host. (However, the requirement that
132 the MITM provide an X.509 certificate chain that can pass the UA's
133 validation requirements, without error, mitigates this risk
134 somewhat.) Worse, such a MITM can inject its own PKP header into the
135 HTTP stream, and pin the UA to its own keys. To avoid post facto
136 detection, the attacker would have to be in a position to intercept
137 all future requests to the host from that UA.
139 Thus, key pinning as described in this document is not a perfect
140 defense against MITM attackers capable of passing certificate chain
141 validation procedures -- nothing short of pre-shared keys can be.
142 However, it provides significant value by allowing host operators to
143 limit the number of certification authorities than can vouch for the
144 host's identity, and allows UAs to detect in-process MITM attacks
145 after the initial communication.
147 1.1. Requirements Language
149 The key words "MUST", "MUST NOT", "REQUIRED", "SHALL", "SHALL NOT",
150 "SHOULD", "SHOULD NOT", "RECOMMENDED", "MAY", and "OPTIONAL" in this
151 document are to be interpreted as described in RFC 2119 [RFC2119].
153 2. Server and Client Behavior
155 2.1. Response Header Field Syntax
157 The "Public-Key-Pins" and "Public-Key-Pins-Report-Only" header
158 fields, also referred to within this specification as the PKP and
159 PKP-RO header fields, respectively, are new response headers defined
160 in this specification. They are used by a server to indicate that a
161 UA should perform Pin Validation (Section 2.6) for the host emitting
162 the response message, and to provide the necessary information for
163 the UA to do so.
165 Figure 1 describes the syntax (Augmented Backus-Naur Form) of the
166 header fields, using the grammar defined in [RFC5234] and the rules
167 defined in Section 3.2 of [RFC7230]. The field values of both header
168 fields conform to the same rules.
170 Public-Key-Directives = directive *( OWS ";" OWS directive )
172 directive = directive-name [ "=" directive-value ]
173 directive-name = token
174 directive-value = token
175 / quoted-string
177 Figure 1: HPKP Header Syntax
179 Optional white space (OWS) is used as defined in Section 3.2.3 of
180 [RFC7230]. token and quoted-string are used as defined in
181 Section 3.2.6 of [RFC7230].
183 The directives defined in this specification are described below.
184 The overall requirements for directives are:
186 1. The order of appearance of directives is not significant.
188 2. A given directive MUST NOT appear more than once in a given
189 header field. Directives are either optional or required, as
190 stipulated in their definitions.
192 3. Directive names are case-insensitive.
194 4. UAs MUST ignore any header fields containing directives, or other
195 header field value data, that do not conform to the syntax
196 defined in this specification. In particular, UAs must not
197 attempt to fix malformed header fields.
199 5. If a header field contains any directive(s) the UA does not
200 recognize, the UA MUST ignore those directives.
202 6. If the PKP or PKP-RO header field otherwise satisfies the above
203 requirements (1 through 5), the UA MUST process the directives it
204 recognizes.
206 Additional directives extending the semantic functionality of the
207 header fields can be defined in other specifications. The first such
208 specification will need to define a registry for such directives.
209 Such future directives will be ignored by UAs implementing only this
210 specification, as well as by generally non-conforming UAs.
212 When a connection passes Pin Validation using the UA's noted Pins for
213 the host at the time, the host becomes a Known Pinned Host.
215 2.1.1. The pin- Directive
217 The pin directive specifies a way for web host operators to indicate
218 a cryptographic identity that should be bound to a given web host.
219 The syntax of a pin directive is as follows:
221 pin-directive = pin-directive-name "=" pin-directive-value
223 pin-directive-name = "pin-" token
224 pin-directive-value = quoted-string
226 Figure 2: Pin Directive Syntax
228 In the pin-directive, the token is the name of a cryptographic hash
229 algorithm. The only algorithm allowed at this time is "sha256", i.e.
230 the hash algorithm SHA256 ([RFC4634]); additional algorithms may be
231 allowed for use in this context in the future. The quoted-string is
232 a sequence of base 64 digits: the base 64-encoded SPKI Fingerprint
233 [RFC4648] (see Section 2.4).
235 According to the processing rules of Section 2.1, the UA MUST ignore
236 pin-directives with tokens naming hash algorithms it does not
237 recognize. If the set of remaining effective pin-directives is
238 empty, and if the host is a Known Pinned Host, the UA MUST cease to
239 consider the host as a Known Pinned Host (the UA should fail open).
241 The UA should indicate to users that the host is no longer a Known
242 Pinned Host.
244 Note, per the processing rules of Section 2.1, the pin-directive-name
245 is case insensitive.
247 2.1.2. The max-age Directive
249 The "max-age" directive specifies the number of seconds after the
250 reception of the PKP header field during which the UA SHOULD regard
251 the host (from whom the message was received) as a Known Pinned Host.
253 The "max-age" directive is REQUIRED to be present within a "Public-
254 Key-Pins" header field. The "max-age" directive is meaningless
255 within a "Public-Key-Pins-Report-Only" header field, and UAs MUST
256 ignore it and not cache the header. See Section 2.3.3.
258 The max-age directive is REQUIRED to have a directive value, for
259 which the syntax (after quoted-string unescaping, if necessary) is
260 defined as:
262 max-age-value = delta-seconds
263 delta-seconds = 1*DIGIT
265 Figure 3: max-age Value Syntax
267 delta-seconds is used as defined in [RFC7234], Section 1.2.1.
269 See Section 2.3.3 for limitations on the range of values for max-age.
271 2.1.3. The includeSubDomains Directive
273 The OPTIONAL includeSubDomains directive is a valueless directive
274 that, if present (i.e., it is "asserted"), signals to the UA that the
275 Pinning Policy applies to this Pinned Host as well as any subdomains
276 of the host's domain name.
278 2.1.4. The report-uri Directive
280 The OPTIONAL report-uri directive indicates the URI to which the UA
281 SHOULD report Pin Validation failures (Section 2.6). The UA POSTs
282 the reports to the given URI as described in Section 3.
284 When used in the PKP or PKP-RO headers, the presence of a report-uri
285 directive indicates to the UA that in the event of Pin Validation
286 failure it SHOULD POST a report to the report-uri. If the header is
287 Public-Key-Pins, the UA should do this in addition to terminating the
288 connection (as described in Section 2.6).
290 Hosts may set report-uris that use HTTP or HTTPS. If the scheme in
291 the report-uri is one that uses TLS (e.g. HTTPS), UAs MUST perform
292 Pinning Validation when the host in the report-uri is a Known Pinned
293 Host; similarly, UAs MUST apply HSTS if the host in the report-uri is
294 a Known HSTS Host.
296 Note that the report-uri need not necessarily be in the same Internet
297 domain or web origin as the host being reported about.
299 UAs SHOULD make their best effort to report Pin Validation failures
300 to the report-uri, but may fail to report in exceptional conditions.
301 For example, if connecting the report-uri itself incurs a Pinning
302 Validation failure or other certificate validation failure, the UA
303 MUST cancel the connection. Similarly, if Known Pinned Host A sets a
304 report-uri referring to Known Pinned Host B, and if B sets a report-
305 uri referring to A, and if both hosts fail Pin Validation, the UA
306 SHOULD detect and break the loop by failing to send reports to and
307 about those hosts.
309 In any case of report failure, the UA MAY attempt to re-send the
310 report later.
312 UAs SHOULD limit the rate at which they send reports. For example,
313 it is unnecessary to send the same report to the same report-uri more
314 than once per distinct set of declared Pins.
316 2.1.5. Examples
318 Figure 4 shows some example PKP and PKP-RO response header fields.
319 (Lines are folded to fit.)
320 Public-Key-Pins: max-age=3000;
321 pin-sha256="d6qzRu9zOECb90Uez27xWltNsj0e1Md7GkYYkVoZWmM=";
322 pin-sha256="E9CZ9INDbd+2eRQozYqqbQ2yXLVKB9+xcprMF+44U1g=";
324 Public-Key-Pins: max-age=2592000;
325 pin-sha256="E9CZ9INDbd+2eRQozYqqbQ2yXLVKB9+xcprMF+44U1g=";
326 pin-sha256="LPJNul+wow4m6DsqxbninhsWHlwfp0JecwQzYpOLmCQ="
328 Public-Key-Pins: max-age=2592000;
329 pin-sha256="E9CZ9INDbd+2eRQozYqqbQ2yXLVKB9+xcprMF+44U1g=";
330 pin-sha256="LPJNul+wow4m6DsqxbninhsWHlwfp0JecwQzYpOLmCQ=";
331 report-uri="http://example.com/pkp-report"
333 Public-Key-Pins-Report-Only: max-age=2592000;
334 pin-sha256="E9CZ9INDbd+2eRQozYqqbQ2yXLVKB9+xcprMF+44U1g=";
335 pin-sha256="LPJNul+wow4m6DsqxbninhsWHlwfp0JecwQzYpOLmCQ=";
336 report-uri="https://other.example.net/pkp-report"
338 Public-Key-Pins:
339 pin-sha256="d6qzRu9zOECb90Uez27xWltNsj0e1Md7GkYYkVoZWmM=";
340 pin-sha256="LPJNul+wow4m6DsqxbninhsWHlwfp0JecwQzYpOLmCQ=";
341 max-age=259200
343 Public-Key-Pins:
344 pin-sha256="d6qzRu9zOECb90Uez27xWltNsj0e1Md7GkYYkVoZWmM=";
345 pin-sha256="E9CZ9INDbd+2eRQozYqqbQ2yXLVKB9+xcprMF+44U1g=";
346 pin-sha256="LPJNul+wow4m6DsqxbninhsWHlwfp0JecwQzYpOLmCQ=";
347 max-age=10000; includeSubDomains
349 Figure 4: HPKP Header Examples
351 2.2. Server Processing Model
353 This section describes the processing model that Pinned Hosts
354 implement. The model has 2 parts: (1) the processing rules for HTTP
355 request messages received over a secure transport (e.g.
356 authenticated, non-anonymous TLS); and (2) the processing rules for
357 HTTP request messages received over non-secure transports, such as
358 TCP.
360 2.2.1. HTTP-over-Secure-Transport Request Type
362 When replying to an HTTP request that was conveyed over a secure
363 transport, a Pinned Host SHOULD include in its response exactly one
364 PKP header field, exactly one PKP-RO header field, or one of each.
365 Each instance of either header field MUST satisfy the grammar
366 specified in Section 2.1.
368 Establishing a given host as a Known Pinned Host, in the context of a
369 given UA, is accomplished as follows:
371 1. Over the HTTP protocol running over secure transport, by
372 correctly returning (per this specification) at least one valid
373 PKP header field to the UA.
375 2. Through other mechanisms, such as a client-side pre-loaded Known
376 Pinned Host List.
378 2.2.2. HTTP Request Type
380 Pinned Hosts SHOULD NOT include the PKP header field in HTTP
381 responses conveyed over non-secure transport. UAs MUST ignore any
382 PKP header received in an HTTP response conveyed over non-secure
383 transport.
385 2.3. User Agent Processing Model
387 The UA processing model relies on parsing domain names. Note that
388 internationalized domain names SHALL be canonicalized according to
389 the scheme in Section 10 of [RFC6797].
391 2.3.1. Public-Key-Pins Response Header Field Processing
393 If the UA receives, over a secure transport, an HTTP response that
394 includes a PKP header field conforming to the grammar specified in
395 Section 2.1, and there are no underlying secure transport errors or
396 warnings (see Section 2.5), the UA MUST either:
398 o Note the host as a Known Pinned Host if it is not already so noted
399 (see Section 2.3.3),
401 or,
403 o Update the UA's cached information for the Known Pinned Host if
404 any of of the max-age, includeSubDomains, or report-uri header
405 field value directives convey information different from that
406 already maintained by the UA.
408 The max-age value is essentially a "time to live" value relative to
409 the time of the most recent observation of the PKP header field. If
410 the max-age header field value token has a value of 0, the UA MUST
411 remove its cached Pinning Policy information (including the
412 includeSubDomains directive, if asserted) if the Pinned Host is
413 Known, or, MUST NOT note this Pinned Host if it is not yet Known.
415 If a UA receives more than one PKP header field or more than one PKP-
416 RO header field in an HTTP response message over secure transport,
417 then the UA MUST process only the first PKP header field (if present)
418 and only the first PKP-RO header field (if present).
420 If the UA receives the HTTP response over insecure transport, or if
421 the PKP header is not a Valid Pinning Header (see Section 2.5), the
422 UA MUST ignore any present PKP header field(s). Similarly, if the UA
423 receives the HTTP response over insecure transport, the UA MUST
424 ignore any present PKP-RO header field(s). The UA MUST ignore any
425 PKP or PKP-RO header fields not conforming to the grammar specified
426 in Section 2.1.
428 2.3.2. Interaction of Public-Key-Pins and Public-Key-Pins-Report-Only
430 A server MAY set both the "Public-Key-Pins" and "Public-Key-Pins-
431 Report-Only" headers simultaneously. The headers do not interact
432 with one another but the UA MUST process the PKP header and SHOULD
433 process both.
435 The headers are processed according to Section 2.3.1.
437 When the PKP-RO header is used with a report-uri, the UA SHOULD POST
438 reports for Pin Validation failures to the indicated report-uri,
439 although the UA MUST NOT enforce Pin Validation. That is, in the
440 event of Pin Validation failure when the host has set the PKP-RO
441 header, the UA performs Pin Validation only to check whether or not
442 it should POST a report, but not for causing connection failure.
444 Note: There is no purpose to using the PKP-RO header without the
445 report-uri directive. User Agents MAY discard such headers without
446 interpreting them further.
448 When the PKP header is used with a report-uri, the UA SHOULD POST
449 reports for Pin Validation failures to the indicated report-uri, as
450 well as enforcing Pin Validation.
452 If a host sets the PKP-RO header, the UA SHOULD note the Pins and
453 directives given in the PKP-RO header, ignoring any max-age
454 directive. If the UA does note the Pins and directives in the PKP-RO
455 header it SHOULD evaluate the specified policy and SHOULD report any
456 would-be Pin Validation failures that would occur if the report-only
457 policy were enforced.
459 If a host sets both the PKP header and the PKP-RO header, the UA MUST
460 note and enforce Pin Validation as specified by the PKP header, and
461 SHOULD process the Pins and directives given in the PKP-RO header.
462 If the UA does process the Pins and directives in the PKP-RO header
463 it SHOULD evaluate the specified policy and SHOULD report any would-
464 be Pin Validation failures that would occur if the report-only policy
465 were enforced.
467 2.3.3. Noting a Pinned Host - Storage Model
469 The Effective Pin Date of a Known Pinned Host is the time that the UA
470 observed a Valid Pinning Header for the host. The Effective
471 Expiration Date of a Known Pinned Host is the Effective Pin Date plus
472 the max-age. A Known Pinned Host is "expired" if the Effective
473 Expiration Date refers to a date in the past. The UA MUST ignore any
474 expired Known Pinned Hosts in its cache.
476 For example, if a UA is beginning to perform Pin Validation for a
477 Known Pinned Host and finds that the cached pinning information for
478 the host indicates an Effective Expiration Date in the past, the UA
479 MUST NOT continue with Pin Validation for the host, and must consider
480 the host to no longer be a Known Pinned Host.
482 Known Pinned Hosts are identified only by domain names, and never IP
483 addresses. If the substring matching the host production from the
484 Request-URI (of the message to which the host responded)
485 syntactically matches the IP-literal or IPv4address productions from
486 Section 3.2.2 of [RFC3986], then the UA MUST NOT note this host as a
487 Known Pinned Host.
489 Otherwise, if the substring does not congruently match an existing
490 Known Pinned Host's domain name, per the matching procedure specified
491 in Section 8.2 of [RFC6797], then the UA MUST add this host to the
492 Known Pinned Host cache. The UA caches:
494 o the Pinned Host's domain name,
496 o the Effective Expiration Date, or enough information to calculate
497 it (the Effective Pin Date and the value of the max-age
498 directive),
500 o whether or not the includeSubDomains directive is asserted, and
502 o the value of the report-uri directive, if present.
504 If any other metadata from optional or future PKP header directives
505 are present in the Valid Pinning Header, and the UA understands them,
506 the UA MAY note them as well.
508 UAs MAY set an upper limit on the value of max-age, so that UAs that
509 have noted erroneous Pins (whether by accident or due to attack) have
510 some chance of recovering over time. If the server sets a max-age
511 greater than the UA's upper limit, the UA MAY behave as if the server
512 set the max-age to the UA's upper limit. For example, if the UA caps
513 max-age at 5184000 seconds (60 days), and a Pinned Host sets a max-
514 age directive of 90 days in its Valid Pinning Header, the UA MAY
515 behave as if the max-age were effectively 60 days. (One way to
516 achieve this behavior is for the UA to simply store a value of 60
517 days instead of the 90 day value provided by the Pinned Host.) For
518 UA implementation guidance on how to select a maximum max-age, see
519 Section 4.1.
521 The UA MUST NOT modify any pinning metadata of any superdomain
522 matched Known Pinned Host.
524 The UA MUST NOT cache information derived from a PKP-RO header.
525 (PKP-RO headers are useful only at the time of receipt and
526 processing.)
528 2.3.4. HTTP-Equiv Element Attribute
530 UAs MUST NOT heed http-equiv="Public-Key-Pins" or http-equiv="Public-
531 Key-Pins-Report-Only" attribute settings on elements
532 [W3C.REC-html401-19991224] in received content.
534 2.4. Semantics of Pins
536 An SPKI Fingerprint is defined as the output of a known cryptographic
537 hash algorithm whose input is the DER-encoded ASN.1 representation of
538 the subjectPublicKeyInfo (SPKI) field of an X.509 certificate. A Pin
539 is defined as the combination of the known algorithm identifier and
540 the SPKI Fingerprint computed using that algorithm.
542 The SPKI Fingerprint is encoded in base 64 for use in an HTTP header
543 [RFC4648].
545 In this version of the specification, the known cryptographic hash
546 algorithm is SHA-256, identified as "sha256" [RFC6234]. (Future
547 specifications may add new algorithms and deprecate old ones.) UAs
548 MUST ignore Pins for which they do not recognize the algorithm
549 identifier. UAs MUST continue to process the rest of a PKP response
550 header field and note Pins for algorithms they do recognize.
552 Figure 5 reproduces the definition of the SubjectPublicKeyInfo
553 structure in [RFC5280].
555 SubjectPublicKeyInfo ::= SEQUENCE {
556 algorithm AlgorithmIdentifier,
557 subjectPublicKey BIT STRING }
559 AlgorithmIdentifier ::= SEQUENCE {
560 algorithm OBJECT IDENTIFIER,
561 parameters ANY DEFINED BY algorithm OPTIONAL }
563 Figure 5: SPKI Definition
565 If the certificate's subjectPublicKeyInfo is incomplete when taken in
566 isolation, such as when holding a DSA key without domain parameters,
567 a public key pin cannot be formed.
569 We pin public keys, rather than entire certificates, to enable
570 operators to generate new certificates containing old public keys
571 (see [why-pin-key]).
573 See Appendix A for an example non-normative program that generates
574 SPKI Fingerprints from certificates.
576 2.5. Noting Pins
578 Upon receipt of the PKP response header field, the UA notes the host
579 as a Known Pinned Host, storing the Pins and their associated
580 directives in non-volatile storage (for example, along with the HSTS
581 metadata). The Pins and their associated directives are collectively
582 known as Pinning Metadata.
584 The UA MUST note the Pins for a Host if and only if all three of the
585 following conditions hold:
587 o It received the PKP response header field over an error-free TLS
588 connection. If the host is a Pinned Host, this includes the
589 validation added in Section 2.6.
591 o The TLS connection was authenticated with a certificate chain
592 containing at least one of the SPKI structures indicated by at
593 least one of the given SPKI Fingerprints (see Section 2.6).
595 o The given set of Pins contains at least one Pin that does NOT
596 refer to an SPKI in the certificate chain. (That is, the host
597 must set a Backup Pin; see Section 4.3.)
599 If the PKP response header field does not meet all three of these
600 criteria, the UA MUST NOT note the host as a Pinned Host. A PKP
601 response header field that meets all these critera is known as a
602 Valid Pinning Header.
604 Whenever a UA receives a Valid Pinning Header, it MUST set its
605 Pinning Metadata to the exact Pins, Effective Expiration Date
606 (computed from max-age), and (if any) report-uri given in the most
607 recently received Valid Pinning Header.
609 For forward compatibility, the UA MUST ignore any unrecognized PKP
610 and PKP-RO header directives, while still processing those directives
611 it does recognize. Section 2.1 specifies the directives max-age,
612 Pins, includeSubDomains, and report-uri but future specifications and
613 implementations might use additional directives.
615 Upon receipt of a PKP-RO response header field, the UA SHOULD
616 evaluate the policy expressed in the field, and SHOULD generate and
617 send a report (see Section 3). However, failure to validate the Pins
618 in the field MUST have no effect on the validity or non-validity of
619 the policy expressed in the PKP field or in previously-noted Pins for
620 the Known Pinned Host.
622 The UA need not note any Pins or other policy expressed in the PKP-RO
623 response header field, except for the purpose of determining that it
624 has already sent a report for a given policy. UAs SHOULD make a best
625 effort not to inundate report-uris with redundant reports.
627 2.6. Validating Pinned Connections
629 When a UA connects to a Pinned Host using a TLS connection, if the
630 TLS connection has errors, the UA MUST terminate the connection
631 without allowing the user to proceed anyway. (This behavior is the
632 same as that required by [RFC6797].)
634 If the connection has no errors, then the UA will determine whether
635 to apply a new, additional correctness check: Pin Validation. A UA
636 SHOULD perform Pin Validation whenever connecting to a Known Pinned
637 Host, as soon as possible (e.g. immediately after receiving the
638 Server Certificate message). It is acceptable to allow Pin
639 Validation to be disabled for some Hosts according to local policy.
640 For example, a UA may disable Pin Validation for Pinned Hosts whose
641 validated certificate chain terminates at a user-defined trust
642 anchor, rather than a trust anchor built-in to the UA (or underlying
643 platform).
645 To perform Pin Validation, the UA will compute the SPKI Fingerprints
646 for each certificate in the Pinned Host's validated certificate
647 chain, using each supported hash algorithm for each certificate. (As
648 described in Section 2.4, certificates whose SPKI cannot be taken in
649 isolation cannot be pinned.) The UA MUST ignore superfluous
650 certificates in the chain that do not form part of the validating
651 chain. The UA will then check that the set of these SPKI
652 Fingerprints intersects the set of SPKI Fingerprints in that Pinned
653 Host's Pinning Metadata. If there is set intersection, the UA
654 continues with the connection as normal. Otherwise, the UA MUST
655 treat this Pin Validation Failure as a non-recoverable error. Any
656 procedure that matches the results of this Pin Validation procedure
657 is considered equivalent.
659 A UA that has previously noted a host as a Known Pinned Host MUST
660 perform Pin Validation when setting up the TLS session, before
661 beginning an HTTP conversation over the TLS channel.
663 UAs send validation failure reports only when Pin Validation is
664 actually in effect. Pin Validation might not be in effect e.g.
665 because the user has elected to disable it, or because a presented
666 certificate chain chains up to a user-defined trust anchor. In such
667 cases, UAs SHOULD NOT send reports.
669 2.7. Interactions With Preloaded Pin Lists
671 UAs MAY choose to implement additional sources of pinning
672 information, such as through built-in lists of pinning information.
673 Such UAs should allow users to override such additional sources,
674 including disabling them from consideration.
676 The effective policy for a Known Pinned Host that has both built-in
677 Pins and Pins from previously observed PKP header response fields is
678 implementation-defined.
680 2.8. Pinning Self-Signed End Entities
682 If UAs accept hosts that authenticate themselves with self-signed end
683 entity certificates, they MAY also allow hosts to pin the public keys
684 in such certificates. The usability and security implications of
685 this practice are outside the scope of this specification.
687 3. Reporting Pin Validation Failure
689 When a Known Pinned Host has set the report-uri directive, the UA
690 SHOULD report Pin Validation failures to the indicated URI. The UA
691 does this by POSTing a JSON [RFC7159] message to the URI; the JSON
692 message takes this form:
694 {
695 "date-time": date-time,
696 "hostname": hostname,
697 "port": port,
698 "effective-expiration-date": expiration-date,
699 "include-subdomains": include-subdomains,
700 "noted-hostname": noted-hostname,
701 "served-certificate-chain": [
702 pem1, ... pemN
703 ],
704 "validated-certificate-chain": [
705 pem1, ... pemN
706 ],
707 "known-pins": [
708 known-pin1, ... known-pinN
709 ]
710 }
712 Figure 6: JSON Report Format
714 Whitespace outside of quoted strings is not significant. The key/
715 value pairs may appear in any order, but each MUST appear only once.
717 The date-time indicates the time the UA observed the Pin Validation
718 failure. It is provided as a string formatted according to
719 Section 5.6, "Internet Date/Time Format", of [RFC3339].
721 The hostname is the hostname to which the UA made the original
722 request that failed Pin Validation. It is provided as a string.
724 The port is the port to which the UA made the original request that
725 failed Pin Validation. It is provided as an integer.
727 The effective-expiration-date is the Effective Expiration Date for
728 the noted Pins. It is provided as a string formatted according to
729 Section 5.6, "Internet Date/Time Format", of [RFC3339].
731 include-subdomains indicates whether or not the UA has noted the
732 includeSubDomains directive for the Known Pinned Host. It is
733 provided as one of the JSON identifiers "true" or "false".
735 noted-hostname indicates the hostname that the UA noted when it noted
736 the Known Pinned Host. This field allows operators to understand why
737 Pin Validation was performed for e.g. foo.example.com when the noted
738 Known Pinned Host was example.com with includeSubDomains set.
740 The served-certificate-chain is the certificate chain, as served by
741 the Known Pinned Host during TLS session setup. It is provided as an
742 array of strings; each string pem1, ... pemN is the PEM
743 representation of each X.509 certificate as described in
744 [I-D.josefsson-pkix-textual].
746 The validated-certificate-chain is the certificate chain, as
747 constructed by the UA during certificate chain verification. (This
748 may differ from the served-certificate-chain.) It is provided as an
749 array of strings; each string pem1, ... pemN is the PEM
750 representation of each X.509 certificate as described in
751 [I-D.josefsson-pkix-textual]. For UAs that build certificate chains
752 in more than one way during the validation process, they SHOULD send
753 the last chain built. In this way they can avoid keeping too much
754 state during the validation process.
756 The known-pins are the Pins that the UA has noted for the Known
757 Pinned Host. They are provided as an array of strings with the
758 syntax:
760 known-pin = token "=" quoted-string
762 Figure 7: Known Pin Syntax
764 As in Section 2.4, the token refers to the algorithm name, and the
765 quoted-string refers to the base 64 encoding of the SPKI Fingerprint.
766 When formulating the JSON POST body, the UA MUST either use single-
767 quoted JSON strings, or use double-quoted JSON strings and \-escape
768 the embedded double quotes in the quoted-string part of the known-
769 pin.
771 Figure 8 shows an example of a Pin Validation failure report. (PEM
772 strings are shown on multiple lines for readability.)
774 {
775 "date-time": "2014-04-06T13:00:50Z",
776 "hostname": "www.example.com",
777 "port": 443,
778 "effective-expiration-date": "2014-05-01T12:40:50Z"
779 "include-subdomains": false,
780 "served-certificate-chain": [
781 "-----BEGIN CERTIFICATE-----\n
782 MIIEBDCCAuygAwIBAgIDAjppMA0GCSqGSIb3DQEBBQUAMEIxCzAJBgNVBAYTAlVT\n
783 ...
784 HFa9llF7b1cq26KqltyMdMKVvvBulRP/F/A8rLIQjcxz++iPAsbw+zOzlTvjwsto\n
785 WHPbqCRiOwY1nQ2pM714A5AuTHhdUDqB1O6gyHA43LL5Z/qHQF1hwFGPa4NrzQU6\n
786 yuGnBXj8ytqU0CwIPX4WecigUCAkVDNx\n
787 -----END CERTIFICATE-----",
788 ...
789 ],
790 "validated-certificate-chain": [
791 "-----BEGIN CERTIFICATE-----\n
792 MIIEBDCCAuygAwIBAgIDAjppMA0GCSqGSIb3DQEBBQUAMEIxCzAJBgNVBAYTAlVT\n
793 ...
794 HFa9llF7b1cq26KqltyMdMKVvvBulRP/F/A8rLIQjcxz++iPAsbw+zOzlTvjwsto\n
795 WHPbqCRiOwY1nQ2pM714A5AuTHhdUDqB1O6gyHA43LL5Z/qHQF1hwFGPa4NrzQU6\n
796 yuGnBXj8ytqU0CwIPX4WecigUCAkVDNx\n
797 -----END CERTIFICATE-----",
798 ...
799 ],
800 "known-pins": [
801 'pin-sha256="d6qzRu9zOECb90Uez27xWltNsj0e1Md7GkYYkVoZWmM="',
802 "pin-sha256=\"E9CZ9INDbd+2eRQozYqqbQ2yXLVKB9+xcprMF+44U1g=\""
803 ]
804 }
806 Figure 8: Pin Validation Failure Report Example
808 4. Security Considerations
810 Pinning public keys helps hosts strongly assert their cryptographic
811 identity even in the face of issuer error, malfeasance or compromise.
812 But there is some risk that a host operator could lose or lose
813 control of their host's private key (such as by operator error or
814 host compromise). If the operator had pinned only the key of the
815 host's end entity certificate, the operator would not be able to
816 serve their web site or application in a way that UAs would trust for
817 the duration of their pin's max-age. (Recall that UAs MUST close the
818 connection to a host upon Pin Failure.)
820 Therefore, there is a necessary trade-off between two competing
821 goods: pin specificity and maximal reduction of the scope of issuers
822 on the one hand; and flexibility and resilience of the host's
823 cryptographic identity on the other hand. One way to resolve this
824 trade-off is to compromise by pinning to the key(s) of the issuer(s)
825 of the host's end entity certificate(s). Often, a valid certificate
826 chain will have at least two certificates above the end entity
827 certificate: the intermediate issuer, and the trust anchor.
828 Operators can pin any one or more of the public keys in this chain,
829 and indeed MUST pin to issuers not in the chain (as, for example, a
830 Backup Pin). Pinning to an intermediate issuer, or even to a trust
831 anchor or root, still significantly reduces the number of issuers who
832 can issue end entity certificates for the Known Pinned Host, while
833 still giving that host flexibility to change keys without a
834 disruption of service.
836 4.1. Maximum max-age
838 As mentioned in Section 2.3.3, UAs MAY cap the max-age value at some
839 upper limit. There is a security trade-off in that low maximum
840 values provide a narrow window of protection for users who visit the
841 Known Pinned Host only infrequently, while high maximum values might
842 potentially result in a UA's inability to successfully perform Pin
843 Validation for a Known Pinned Host if the UA's noted Pins and the
844 host's true Pins diverge.
846 Such divergence could occur for several reasons, including: UA error;
847 host operator error; network attack; or a Known Pinned Host that
848 intentionally migrates all pinned keys, combined with a UA that has
849 noted true Pins with a high max-age value and has not had a chance to
850 observe the new true Pins for the host. (This last example
851 underscores the importance for host operators to phase in new keys
852 gradually, and to set the max-age value in accordance with their
853 planned key migration schedule.)
855 There is probably no ideal upper limit to the max-age directive that
856 would satisfy all use cases. However, a value on the order of 60
857 days (5,184,000 seconds) may be considered a balance between the two
858 competing security concerns.
860 4.2. Using includeSubDomains Safely
862 It may happen that Pinned Hosts whose hostnames share a parent domain
863 use different Valid Pinning Headers. If a host whose hostname is a
864 parent domain for another host sets the includeSubDomains directive,
865 the two hosts' Pins may conflict with each other. For example,
866 consider two Known Pinned Hosts, example.com and
867 subdomain.example.com. Assume example.com sets a Valid Pinning
868 Header such as this:
870 Public-Key-Pins: max-age=12000; pin-sha256="ABC...";
871 pin-sha256="DEF..."; includeSubDomains
873 Figure 9: example.com Valid Pinning Header
875 Assume subdomain.example.com sets a Valid Pinning Header such as
876 this:
878 Public-Key-Pins: pin-sha256="GHI..."; pin-sha256="JKL..."
880 Figure 10: subdomain.example.com Valid Pinning Header
882 Assume a UA that has not previously noted any Pins for either of
883 these hosts. If the UA first contacts subdomain.example.com, it will
884 note the Pins in the Valid Pinning Header, and perform Pin Validation
885 as normal on subsequent conections. If the UA then contacts
886 example.com, again it will note the Pins and perform Pin Validation
887 on future connections.
889 However, if the UA happened to visit example.com before
890 subdomain.example.com, the UA would, due to example.com's use of the
891 includeSubDomains directive, attempt to perform Pin Validation for
892 subdomain.example.com using the SPKI hashes ABC... and DEF..., which
893 are not valid for the certificate chains subdomain.example.com (which
894 uses certificates with SPKIs GHI... and JLK...). Thus, depending on
895 the order in which the UA observes the Valid Pinning Headers for
896 hosts example.com and subdomain.example.com, Pin Validation might or
897 might not fail for subdomain.example.com, even if the certificate
898 chain the UA receives for subdomain.example.com is perfectly valid.
900 Thus, Pinned Host operators must use the includeSubDomains directive
901 with care. For example, they may choose to use overlapping pin sets
902 for hosts under a parent domain that uses includeSubDomains, or to
903 not use the includeSubDomains directive in their effective-second-
904 level domains, or to simply use the same pin set for all hosts under
905 a given parent domain.
907 4.3. Backup Pins
909 The primary way to cope with the risk of inadvertent Pin Validation
910 Failure is to keep a Backup Pin. A Backup Pin is a fingerprint for
911 the public key of a secondary, not-yet-deployed key pair. The
912 operator keeps the backup key pair offline, and sets a pin for it in
913 the PKP header. Then, in case the operator loses control of their
914 primary private key, they can deploy the backup key pair. UAs, who
915 have had the backup key pair pinned (when it was set in previous
916 Valid Pinning Headers), can connect to the host without error.
918 Because having a backup key pair is so important to recovery, UAs
919 MUST require that hosts set a Backup Pin (see Section 2.5). The down
920 side of keeping a not-yet-deployed key pair is that if an attacker
921 gains control of the private key she will be able to perform a MITM
922 attack without being discovered. Operators must take care to avoid
923 leaking the key such as keeping it offline.
925 4.4. Interactions With Cookie Scoping
927 HTTP cookies [RFC6265] set by a Known Pinned Host can be stolen by a
928 network attacker who can forge web and DNS responses so as to cause a
929 client to send the cookies to a phony subdomain of the host. To
930 prevent this, hosts SHOULD set the "secure" attribute and precisely
931 scope the "domain" attribute on all security-sensitive cookies, such
932 as session cookies. These settings tell the browser that the cookie
933 should only be sent back to the specific host(s) (and not e.g. all
934 subdomains of a given domain), and should only be sent over HTTPS
935 (not HTTP).
937 4.5. Hostile Pinning
939 An attacker who is able to obtain a valid certificate for a domain,
940 either through misissuance by a Certification Authority or through
941 other means, such as being the prior owner of a given domain, may
942 attempt to perform 'hostile' pinning. In this scenario, the attacker
943 provides a Valid Pinning Header that pins to a set of SPKIs of the
944 attacker's choice. If a UA has not previously noted pins for that
945 host, it may note the attacker's pins, preventing access to the
946 legitimate site.
948 This attack is mitigated through several means. Most prominantly,
949 the attack can only persist for the maximum max-age (see
950 Section 4.1). Web host operators can reduce the opportunity for
951 attack by working to preload the host's pins within the UA.
952 Operators may further detect such misissuance through other means,
953 such as Certificate Transparency ([RFC6962]).
955 5. Privacy Considerations
957 Hosts can use HSTS or HPKP as a "super-cookie", by setting distinct
958 policies for a number of subdomains. For example, assume example.com
959 wishes to track distinct UAs without explicitly setting a cookie, or
960 if a previously-set cookie is deleted from the UA's cookie store.
961 Here are two attack scenarios.
963 o example.com can use report-uri and the ability to pin arbitrary
964 identifiers to distinguish UAs.
966 1. example.com sets a Valid Pinning Header in its response to
967 requests. The header asserts the includeSubDomains directive,
968 and specifies a report-uri directive as well. Pages served by
969 the host also include references to subresource
970 https://bad.example.com/foo.png.
972 2. The Valid Pinning Header includes a "pin" that is not really
973 the hash of an SPKI, but is instead an arbitrary
974 distinguishing string sent only in response to a particular
975 request. For each request, the host creates a new, distinct
976 distinguishing string and sets it as if it were a pin.
978 3. The certificate chain served by bad.example.com does not pass
979 Pin Validation given the pin set the host asserted in (1).
980 The HPKP-conforming UA attempts to report the Pin Validation
981 failure to the specified report-uri, including the certificate
982 chain it observed and the SPKI hashes it expected to see.
983 Among the SPKI hashes is the distinguishing string in step
984 (2).
986 o Different site operators/origins can optionally collaborate by
987 setting the report-uri to be in an origin they share
988 administrative control of. UAs MAY, therefore, refuse to send
989 reports outside of the origin that set the PKP or PKP-RO header.
991 o example.com can use server name indication (SNI; [RFC3546]) and
992 subdomains to distinguish UAs.
994 1. example.com sets a Valid Pinning Header in its response to
995 requests. The header asserts the includeSubDomains directive.
997 2. On a subsequent page view, the host responds with a page
998 including the subresource https://0.fingerprint.example.com/
999 foo.png, and the server responds using a certificate chain
1000 that does not pass Pin Validation for the pin-set defined in
1001 the Valid Pinning Header in step (1). The HPKP-conforming UA
1002 will close the connection, never completing the request to
1003 0.fingerprint.example.com. The host may thus note that this
1004 particular UA had noted the (good) Pins for that subdomain.
1006 3. example.com can distinguish 2^N UAs by serving Valid Pinning
1007 Headers from an arbitrary number N distinct subdomains. For
1008 any given subdomain n.fingerprint.example.com, the host may
1009 deliver a Valid Pinning Header to one UA, but not deliver it
1010 to a different UA. The server may then change the
1011 configuration for n.fingerprint.example.com. If the UA fails
1012 to connect, it was in the set of UAs that were pinned, which
1013 can be distinguished from the UAs that were not pinned, as
1014 they will succeed in connecting. The host may repeat this for
1015 a sufficient number of subdomains necessary to distinguish
1016 individual UAs.
1018 o Conforming implementations (as well as implementations conforming
1019 to [RFC6797]) must store state about which domains have set
1020 policies, hence which domains the UA has contacted. Because these
1021 policies cause remotely-detectable behaviours, it is advisable
1022 that UAs have a way for privacy-sensitive users to clear current
1023 Pins for Pinned Hosts, and to allow users to query the current
1024 state of Pinned Hosts. In addition, note that because Pinning a
1025 Host implies a degree of persistent state, an attacker with
1026 physical access to a device may be able to recover information
1027 about hosts a user has visited, even if the user has cleared other
1028 parts of the UA's state.
1030 o Pin reports, as noted in Section 3, contains information about the
1031 certificate chain that has failed pin validation. In some cases,
1032 such as organization-wide compromise of the end-to-end security of
1033 TLS, this may include information about the interception tools and
1034 design used by the organization that the organization would
1035 otherwise prefer not be disclosed.
1037 6. IANA Considerations
1039 IANA is requested to register the response headers described in this
1040 document in the "Message Headers" registry ([permanent-headers] with
1041 the following parameters:
1043 o Header Field Names should be "Public-Key-Pins" and "Public-Key-
1044 Pins-Report-Only".
1046 o Protocol should be "http"
1048 o Status should be "standard"
1050 o Reference should be this document
1052 7. Usability Considerations
1054 When pinning works to detect impostor Pinned Hosts, users will
1055 experience denial of service. It is advisable for UAs to explain the
1056 reason why, i.e. that it was impossible to verify the confirmed
1057 cryptographic identity of the host.
1059 It is advisable that UAs have a way for users to clear current Pins
1060 for Pinned Hosts, and to allow users to query the current state of
1061 Pinned Hosts.
1063 8. Acknowledgements
1065 Thanks to Tobias Gondrom, Jeff Hodges, Paul Hoffman, Ivan Krstic,
1066 Adam Langley, Barry Leiba, Nicolas Lidzborski, SM, James Manger, Yoav
1067 Nir, Trevor Perrin, Eric Rescorla, Pete Resnick, Tom Ritter, and Yan
1068 Zhu for suggestions and edits that clarified the text.
1070 9. What's Changed
1072 [RFC EDITOR: PLEASE REMOVE THIS SECTION]
1074 Added attack scenario for hostile pinning, as well as mitigations.
1076 Added privacy considerations for the report-uri processing.
1078 Moved pin-directive into its own directive section, leaving the
1079 header syntax to only define directive-name and directive-value.
1081 Updated Privacy Considerations to note that UAs should offer ways to
1082 clear data, and in doing so, clarified the term 'forensic attacker'
1083 to indicate an attacker with physical access.
1085 Updated ABNF for Public-Key-Directives to indicate that at least one
1086 directive is required, and that a directive is required between each
1087 semi-colon.
1089 Clarified that max-age is REQUIRED for PKP, but OPTIONAL for PKP-RO
1090 (where it has no effect.
1092 Updated header field syntax and description to match that in
1093 [RFC7230].
1095 Updated normative references to current documents.
1097 Removed the strict directive.
1099 Removed the requirement that the server set the Valid Pinning Header
1100 on every response.
1102 Added normative references for SHA, JSON, and base-64.
1104 Added the Privacy Considerations section.
1106 Changed non-normative pin generation code from Go to POSIX shell
1107 script using openssl.
1109 Changed max-max-age from SHOULD to MAY, and used the example of 60
1110 days instead of 30.
1112 Removed the section "Pin Validity Times", which was intended to be in
1113 harmony with [I-D.perrin-tls-tack]. Now using max-age purely as
1114 specified in [RFC6797].
1116 Added new directives: includeSubDomains, report-uri and strict.
1118 Added a new variant of the PKP Header: Public-Key-Pins-Report-Only.
1120 Removed the section on pin break codes and verifiers, in favor the of
1121 most-recently-received policy (Section 2.5).
1123 Now using a new header field, Public-Key-Pins, separate from HSTS.
1124 This allows hosts to use pinning separately from Strict Transport
1125 Security.
1127 Explicitly requiring that UAs perform Pin Validation before the HTTP
1128 conversation begins.
1130 Backup Pins are now required.
1132 Separated normative from non-normative material. Removed tangential
1133 and out-of-scope non-normative discussion.
1135 10. References
1137 10.1. Normative References
1139 [I-D.josefsson-pkix-textual]
1140 Josefsson, S. and S. Leonard, "Textual Encodings of PKIX,
1141 PKCS, and CMS Structures", draft-josefsson-pkix-textual-07
1142 (work in progress), September 2014.
1144 [RFC2119] Bradner, S., "Key words for use in RFCs to Indicate
1145 Requirement Levels", BCP 14, RFC 2119, March 1997.
1147 [RFC3339] Klyne, G., Ed. and C. Newman, "Date and Time on the
1148 Internet: Timestamps", RFC 3339, July 2002.
1150 [RFC3986] Berners-Lee, T., Fielding, R., and L. Masinter, "Uniform
1151 Resource Identifier (URI): Generic Syntax", STD 66, RFC
1152 3986, January 2005.
1154 [RFC4634] Eastlake, D. and T. Hansen, "US Secure Hash Algorithms
1155 (SHA and HMAC-SHA)", RFC 4634, July 2006.
1157 [RFC4648] Josefsson, S., "The Base16, Base32, and Base64 Data
1158 Encodings", RFC 4648, October 2006.
1160 [RFC5234] Crocker, D. and P. Overell, "Augmented BNF for Syntax
1161 Specifications: ABNF", STD 68, RFC 5234, January 2008.
1163 [RFC5246] Dierks, T. and E. Rescorla, "The Transport Layer Security
1164 (TLS) Protocol Version 1.2", RFC 5246, August 2008.
1166 [RFC5280] Cooper, D., Santesson, S., Farrell, S., Boeyen, S.,
1167 Housley, R., and W. Polk, "Internet X.509 Public Key
1168 Infrastructure Certificate and Certificate Revocation List
1169 (CRL) Profile", RFC 5280, May 2008.
1171 [RFC6234] Eastlake, D. and T. Hansen, "US Secure Hash Algorithms
1172 (SHA and SHA-based HMAC and HKDF)", RFC 6234, May 2011.
1174 [RFC6265] Barth, A., "HTTP State Management Mechanism", RFC 6265,
1175 April 2011.
1177 [RFC6797] Hodges, J., Jackson, C., and A. Barth, "HTTP Strict
1178 Transport Security (HSTS)", RFC 6797, November 2012.
1180 [RFC7159] Bray, T., "The JavaScript Object Notation (JSON) Data
1181 Interchange Format", RFC 7159, March 2014.
1183 [RFC7230] Fielding, R. and J. Reschke, "Hypertext Transfer Protocol
1184 (HTTP/1.1): Message Syntax and Routing", RFC 7230, June
1185 2014.
1187 [RFC7234] Fielding, R., Nottingham, M., and J. Reschke, "Hypertext
1188 Transfer Protocol (HTTP/1.1): Caching", RFC 7234, June
1189 2014.
1191 [W3C.REC-html401-19991224]
1192 Raggett, D., Hors, A., and I. Jacobs, "HTML 4.01
1193 Specification", World Wide Web Consortium Recommendation
1194 REC-html401-19991224, December 1999,
1195 .
1197 [permanent-headers]
1198 Klyne, G., "Permanent Message Header Field Names", July
1199 2014, .
1202 10.2. Informative References
1204 [I-D.perrin-tls-tack]
1205 Marlinspike, M., "Trust Assertions for Certificate Keys",
1206 draft-perrin-tls-tack-02 (work in progress), January 2013.
1208 [RFC3546] Blake-Wilson, S., Nystrom, M., Hopwood, D., Mikkelsen, J.,
1209 and T. Wright, "Transport Layer Security (TLS)
1210 Extensions", RFC 3546, June 2003.
1212 [RFC6962] Laurie, B., Langley, A., and E. Kasper, "Certificate
1213 Transparency", RFC 6962, June 2013.
1215 [why-pin-key]
1216 Langley, A., "Public Key Pinning", May 2011,
1217 .
1219 Appendix A. Fingerprint Generation
1221 This POSIX shell program generates SPKI Fingerprints, suitable for
1222 use in pinning, from PEM-encoded certificates. It is non-normative.
1224 openssl x509 -noout -in certificate.pem -pubkey | \
1225 openssl asn1parse -noout -inform pem -out public.key
1226 openssl dgst -sha256 -binary public.key | openssl enc -base64
1228 Figure 11: Example SPKI Fingerprint Generation Code
1230 Appendix B. Deployment Guidance
1232 This section is non-normative guidance which may smooth the adoption
1233 of public key pinning.
1235 o Operators should get the backup public key signed by a different
1236 (root and/or intermediary) CA than their primary certificate, and
1237 store the backup key pair safely offline. The semantics of an
1238 SPKI Fingerprint do not require the issuance of a certificate to
1239 construct a valid Pin. However, in many deployment scenarios, in
1240 order to make a Backup Pin operational the server operator will
1241 need to have a certificate to deploy TLS on the host. Failure to
1242 obtain a certificate through prior arrangement will leave clients
1243 that recognize the site as a Known Pinned Host unable to
1244 successfully perform Pin Validation until such a time as the
1245 operator can obtain a new certificate from their desired
1246 certificate issuer.
1248 o It is most economical to have the backup certificate signed by a
1249 completely different signature chain than the live certificate, to
1250 maximize recoverability in the event of either root or
1251 intermediary signer compromise.
1253 o Operators should periodically exercise their Backup Pin plan -- an
1254 untested backup is no backup at all.
1256 o Operators should start small. Operators should first deploy
1257 public key pinning by using the report-only mode together with a
1258 report-uri directive that points to a reliable report collection
1259 endpoint. When moving out of report-only mode, operators should
1260 start by setting a max-age of minutes or a few hours, and
1261 gradually increase max-age as they gain confidence in their
1262 operational capability.
1264 Authors' Addresses
1266 Chris Evans
1267 Google, Inc.
1268 1600 Amphitheatre Pkwy
1269 Mountain View, CA 94043
1270 US
1272 Email: cevans@google.com
1274 Chris Palmer
1275 Google, Inc.
1276 1600 Amphitheatre Pkwy
1277 Mountain View, CA 94043
1278 US
1280 Email: palmer@google.com
1282 Ryan Sleevi
1283 Google, Inc.
1284 1600 Amphitheatre Pkwy
1285 Mountain View, CA 94043
1286 US
1288 Email: sleevi@google.com