ArticleslgStudy

science

HTTP Public Key Pinning

HTTP Public Key Pinning is a science topic covered in the lgStudy science library. This page brings together a partial reference excerpt, illustrations, worked examples, real-world applications and a short study plan, so you can understand HTTP Public Key Pinning rather than just read about it. In short: HTTP Public Key Pinning (HPKP) is an obsolete Internet security mechanism delivered via an HTTP header which allows HTTPS websites to resist impersonation by attackers using misissued or otherwise fraudulent digital certificates. A server uses it to deliver to the client (e.g. a web browser) a set of hashes of public keys that must appear in the certificate chain of future connections to the same domain name.

HTTP Public Key Pinning — main illustration
HTTP Public Key Pinning — illustration

Key takeaways

  • HTTP Public Key Pinning belongs to science; place it in that map before memorising details.
  • Learn the definition first, then one example that makes the definition concrete.
  • Connect HTTP Public Key Pinning to a quantity you can measure, compute or draw — that is where exam questions come from.
  • Reproduce the core statement of HTTP Public Key Pinning from memory before moving on to harder problems.

Reference excerpt

HTTP Public Key Pinning (HPKP) is an obsolete Internet security mechanism delivered via an HTTP header which allows HTTPS websites to resist impersonation by attackers using misissued or otherwise fraudulent digital certificates. A server uses it to deliver to the client (e.g. a web browser) a set of hashes of public keys that must appear in the certificate chain of future connections to the same domain name. For example, attackers might compromise a certificate authority, and then mis-issue certificates for a web origin. To combat this risk, the HTTPS web server serves a list of “pinned” public key hashes valid for a given time; on subsequent connections, during that validity time, clients expect the server to use one or more of those public keys in its certificate chain. If it does not, an error message is shown, which cannot be (easily) bypassed by the user. The technique does not pin certificates, but public key hashes. This means that one can use the key pair to get a certificate from any certificate authority, when one has access to the private key. Also the user can pin public keys of root or intermediate certificates (created by certificate authorities), restricting site to certificates issued by the said certificate authority. Due to HPKP mechanism complexity and possibility of accidental misuse (potentially causing a lockout condition by system administrators), in 2017 browsers deprecated HPKP and in 2018 removed its support in favor of Certificate Transparency.

Mechanism The server communicates the HPKP policy to the user agent via an HTTP response header field named Public-Key-Pins (or Public-Key-Pins-Report-Only for reporting-only purposes). The HPKP policy specifies hashes of the subject public key info of one of the certificates in the website's authentic X.509 public key certificate chain (and at least one backup key) in pin-sha256 directives, and a period of time during which the user agent shall enforce public key pinning in max-age directive, optional includeSubDomains directive to include all subdomains (of the domain that sent the header) in pinning policy and optional report-uri directive with URL where to send pinning violation reports. At least one of the public keys of the certificates in the certificate chain needs to match a pinned public key in order for the chain to be considered valid by the user agent. At the time of publishing, RFC 7469 only allowed the SHA-256 hash algorithm. (Appendix A. of RFC 7469 mentions some tools and required arguments that can be used to produce hashes for HPKP policies.) A website operator can choose to either pin the root certificate public key of a particular root certificate authority, allowing only that certificate authority (and all intermediate authorities signed by its key) to issue valid certificates for the website's domain, and/or to pin the key(s) of one or more intermediate issuing certificates, or to pin the end-entity public key. At least one backup key must be pinned, in case the current pinned key needs to be replaced. The HPKP is not valid without this backup key (a backup key is defined as a public key not present in the current certificate chain). HPKP is standardized in RFC 7469. It expands on static certificate pinning, which hardcodes public key hashes of well-known websites or services within web browsers and applications. Most browsers disable pinning for certificate chains with private root certificates to enable various corporate content inspection scanners and web debugging tools (such as mitmproxy or Fiddler). The RFC 7469 standard recommends disabling pinning violation reports for "user-defined" root certificates, where it is "acceptable" for the browser to disable pin validation.

Reporting If the user agent performs pin validation and fails to find a valid SPKI fingerprint in the served certificate chain, it will POST a JSON formatted violation report to the host specified in the report-uri directive containing details of the violation. This URI may be served via HTTP or HTTPS; however, the user agent cannot send HPKP violation reports to an HTTPS URI in the same domain as the domain for which it is reporting the violation. Hosts may either use HTTP for the report-uri, use an alternative domain, or use a reporting service. Some browsers also support the Public-Key-Pins-Report-Only, which only triggers this reporting while not showing an error to the user.

Criticism and decline During its peak adoption, HPKP was reported to be used by 3,500 of top 1 million internet sites, a figure that declined to 650 around the end of 2019. Criticism and concern revolved around malicious or human error scenarios known as HPKP Suicide and RansomPKP. In such scenarios, a website owner would have their ability to publish new contents to their domain severely hampered by either losing access to their own keys or having new keys announced by a malicious attacker.

Browser support and deprecation

See also Certificate authority compromise Certificate Transparency HTTP Strict Transport Security List of HTTP header fields DNS Certification Authority Authorization Public Key Pinning Extension for HTTP (HPKP) on MDN Web Docs

References

Illustrations

HTTP Public Key Pinning illustration

Worked examples

Example 1 — a first encounter with HTTP Public Key Pinning

Start with the simplest possible case. Write down what HTTP Public Key Pinning claims or describes in one sentence, then invent the smallest concrete situation in which that sentence is true. In science, the smallest case is usually a single object, a single equation or a single measurement. Check that every symbol or term in your sentence has a meaning in that case.

Example 2 — changing one variable

Take the situation from Example 1 and change exactly one quantity: double it, halve it, or set it to zero. Predict what should happen to HTTP Public Key Pinning before you calculate. Comparing your prediction with the result is the fastest way to find out whether you understand the idea or only the words.

Example 3 — an exam-style question

Typical questions about HTTP Public Key Pinning ask you to (a) state it precisely, (b) apply it to given data, and (c) explain a limitation. Practise writing all three answers in under five minutes; the third part is what separates a full-mark answer from an average one.

Applications of HTTP Public Key Pinning

In research
HTTP Public Key Pinning appears in science research whenever the underlying quantities have to be modelled precisely. Papers usually cite it as a starting assumption and then explore where it breaks down.
In technology and industry
Engineering practice reuses HTTP Public Key Pinning in design rules, simulations and safety margins. Knowing the idea lets you read a specification sheet and understand why the numbers look the way they do.
In the classroom
HTTP Public Key Pinning is common in secondary-school and first-year university syllabi. It links to neighbouring topics Hypertext Transfer Protocol headers, Internet security, Transport Layer Security, so understanding it makes those chapters shorter.
In everyday life
Look for HTTP Public Key Pinning outside the textbook — in sport, cooking, traffic, electronics or the sky above you. An example you found yourself is remembered far longer than one you were given.
Ask Teacher Smith questions about this articleOpens your AI tutor with a question about “HTTP Public Key Pinning” →

Affiliate

Preply — study more efficiently by working with a personal tutor. 50% off.

How to study HTTP Public Key Pinning in 20 minutes

  1. Read the reference excerpt below once, without taking notes.
  2. Close the page and write down what HTTP Public Key Pinning means in your own words.
  3. Compare your version with the excerpt and mark what you missed.
  4. Work through the three examples above with pen and paper.
  5. Explain HTTP Public Key Pinning out loud to somebody else — or to Teacher Smith in the lgStudy chat.

Frequently asked questions

What is HTTP Public Key Pinning in simple terms?

HTTP Public Key Pinning (HPKP) is an obsolete Internet security mechanism delivered via an HTTP header which allows HTTPS websites to resist impersonation by attackers using misissued or otherwise fraudulent digital certificates. A server uses it to deliver to the client (e.g. a web browser) a set…

Why does HTTP Public Key Pinning matter?

Because it connects several science ideas at once: it gives you a definition you can apply, a quantity you can calculate, and a way to check whether a result is plausible.

How should I study HTTP Public Key Pinning?

Read the excerpt, restate it from memory, then work through the examples and applications listed on this page. The five-step study plan above takes about twenty minutes.

What does this page cover?

It gives you a compact reference excerpt plus original lgStudy explanations, examples, applications and study material on HTTP Public Key Pinning.

Tags

  • Hypertext Transfer Protocol headers
  • Internet security
  • Transport Layer Security

Keep exploring