Secure Websites Shun HTTP Public Key Pinning
news.netcraft.com
news.netcraft.com
Were we bigger, the benefit might outweigh the costs. Of course if we were bigger, the cost would go up significantly as well. Can you imagine a world where Amazon had to completely re-build its order taking infrastructure around a new domain name due to a mistaken configuration file?
Generally they would do multiple tests to avoid such cases.
As falcolas says, security is about risk tradeoffs. Right now the risk of using HPKP is rightly judged by most webmasters to be far greater than the risk of not using it. Key pinning Is a great security tool in many scenarios but for most public websites, it's not worth the risk.
We got into a debate with them over why they're imposing it, but ultimately, our use case was limited and they likely had the analytics to justify capping max_age at less than a year. I think we'd still rather have had the option of allowing up to a year, but I understand the need for the gloves. https://bugs.chromium.org/p/chromium/issues/detail?id=523654
Which gets to my point: Cyph (https://cyph.im) found more utility in abusing HPKP off-label than in actually using it for its originally intended purpose, so in a roundabout way, I find myself in agreement with netcraft. Heh.
First visit: Add a new backup hash for a certificate that the attacker
controls.
Second visit: Use the new backup certificate for the TLS session
and set a new HPKP header that excludes the keys the site owner
actually uses.
¹ This is assuming browsers won't accept HPKP headers that don't pass for the current connection. I haven't actually checked this.RFC 7469 requires this (https://tools.ietf.org/html/rfc7469#section-2.5):
o The TLS connection was authenticated with a certificate chain
containing at least one of the SPKI structures indicated by at
least one of the given SPKI Fingerprints (see Section 2.6).I'm sure we could survive a total webserver compromise (with some level of lost data), but losing access to our primary domain for 60 days to a year would be devastating.
So it first would need to set the header to include the ransomed key, then deliver the page using that key and afterwards remove the other keys.
Edit: I just read in the RFC. It is in section 2.5 (https://tools.ietf.org/html/rfc7469#section-2.5):
o The TLS connection was authenticated with a certificate chain
containing at least one of the SPKI structures indicated by at
least one of the given SPKI Fingerprints (see Section 2.6).
o The given set of Pins contains at least one Pin that does NOT
refer to an SPKI in the certificate chain. (That is, the host
must set a Backup Pin; see Section 4.3.)Per bullet 1, this seems self-defeating since at that point all that would need to happen is for the victim to forensically extract the private key from the compromised webserver. So long as there's one private key corresponding to a pinned public key, the malware's defeated if the private key can be recovered (assuming I'm understanding your suggestion correctly).
I say "forensically" since I'd presume any malware following this pattern would likely build in some protections to try and blow the private key in the event that someone tries to recover it.
This would make the attack quite complex, though. It's more likely that the malware will just use the new key for a few hours and then delete it and scrub the disk, which will be enough for the majority of production deployments.
Once the ransomware delivered the page to enough users (for some number of enough) it can permanently remove the key used to do so. The header now contains the just-removed key used to poison the browser and a randomly generated hash that does not correspond to a valid key. This assumes that the administrator does not detect the ransomware before it does so.
Then the malware could call out to let's encrypt to issue a certificate, then load the certificate into nginx/apache/whatever, then remove the let's encrypt private key from the file system. That allows the webserver to continue serving traffic with LE's key + ransomware key until it's restarted.
1.) Infect webserver
2.) Generate public/private key pair for the purposes of the ransom on the CC server, then send back the public key back to the compromised server.
3.) Use webserver to issue LE SSL certificate. Delete the private key once it's loaded into the webserver process.
4.) Serve traffic with the hashes of the LE key and the ransomware key.
If the sysadmin restarts the webserver process, they are screwed since that's the only process that contains the LE private key.
Please Please Please read this.
>For me personally, on my blog and on other websites that I run, I've pinned at the leaf certificate level. It does come with the problem that you're responsible for the backups...
HPKP is a giant foot gun and even Ryan Sleevi expresses how he is somewhat unsatisfied with how HPKP turned out[1] and that you should be pinning to intermediates or roots.[2] (His name is on the RFC if you don't know who he is).
In my opinion. If you plan to roll out HPKP you need to read the RFC. Don't follow online guides for your production environment. Figure out what is best for you.
There is a really high operational cost to this in organizations bigger than a couple people. If you aren't prepared for that, then you're going to brick your site for a lot of users.
Security headers are hard to get right and even some really big orgs make mistakes[3]
0 - https://scotthelme.co.uk/hpkp-http-public-key-pinning/
1 - https://twitter.com/sleevi_/status/696171562383224832
2 - https://twitter.com/sleevi_/status/696379082599059457
3 - https://chromium.googlesource.com/chromium/src.git/+/3865c64...
Pinning is a great way for companies like Google to use Chrome to detect when someone has deployed an illegally issued certificate on their behalf. But for a company that hasn't bundled its keys with browsers, the user will just spin up a different browser and go to the compromised site, since HPKP is browser/session specific.
HPKP is a toothless mitigation. We need better measures.
https://brianmhunt.github.io/picking-our-roots-between-hsts-...