What You Need to Know about HTTP Public Key Pinning (HPKP)
blog.rlove.org
blog.rlove.org
1. View pinned certificates/keys?
2. Pin one manually, from the browser?
From what I understand neither is possible, even though this was added to Firefox 1.5 years ago. Which really makes you go Hmm. I'd expect I'm not the only one who wants to pin few certs for sites that I visit frequently.
How can you tell what the backup pin for those websites would be without the owner publishing the HKPK headers? How do you know the max-age of their current pin?
It sound a bit like trying to stuff things into the browser's cache - a road to disaster.
If you don't control the sites, it is not a good idea to pin them "from the browser" as you suggest.
The fun begins with report uris, it doesn't seem like there's a way to specify multiple of them.
We deem this acceptable because the proxy or MITM can only be effective if the client machine has already been configured to trust the proxy’s issuing certificate — that is, the client is already under the control of the person who controls the proxy (e.g. the enterprise’s IT administrator). If the client does not trust the private trust anchor, the proxy’s attempt to mediate the connection will fail as it should.
https://www.chromium.org/Home/chromium-security/security-faq...
I'm personally fine with this. MITM proxies are a valid use case. I do think that all parties should be made aware of it, but that's probably something that has to be fixed via laws (I think some European countries forbid this practice unless it's been made clear that there can be no expectation of privacy on a company-provided device).
[1]: https://wiki.mozilla.org/SecurityEngineering/Public_Key_Pinn...
The whole idea of this security feature is that MITMs can't bypass it. It would be worthless if proxies could bypass it.
EDIT: Okay, the coffee is flowing and the gears are starting to turn. I guess if I'm going to pin my cert, I should generate a new private key for the backup, and if I'm going to pin the intermediate cert, I should use a different CA. And for maximum protection, do both, and not keep both private keys on the same servers. Does that make sense?
If your "primary" certificate or any of the others in the chain is compromised -- for whatever reason -- you want the ability to immediately switch over to your "backup" certificate without problems or affecting your users.
You don't have to compromise the root. This could still happen if a trusted intermediate CA's private key is compromised, because that CA's certificate was signed by the CA in the chain of trust that ultimately terminates with a trusted root.
Also, how does rfc7469 work with respect to CRLs and OCSP?
Do I have that right?
By pinning to a public key you're saying "is this public key in this certificate's chain of trust?". Pinning to a root you have the most flexibility but the least amount of protection against MITM.
"user agents (UAs) will require that the host presents a certificate chain including at least one Subject Public Key Info structure whose fingerprint matches one of the pinned fingerprints for that host."
This makes it easier to deploy. If an org repeatedly gets their certs from a single CA they can just pin that CA. It does of course open you up to being compromised if anyone compromises that CA. But, like you said it's a big improvement over nothing.
For instance: http://randywestergren.com/reverse-engineering-the-subway-an...
EDIT: Just to clarify given the comment below (and downvotes...), I'm talking about a different attack scenario. Here's a decent source on some of pinning's weaknesses for your standard MITM scenario: https://www.owasp.org/index.php/Certificate_and_Public_Key_P...
Attacker --> Attacker's Phone --> App --> MITM proxy --> API/Server
So you could use this to pull down real-estate listings from a real-estate app in an easily parsed format (usually JSON). Or write an app that pull down the odds from various sports betting app APIs, detects arbitrage opportunities and automatically places bets using their APIs...
EDIT: Oh and on the plaintext thing, generally no. Most apps will use TLS for app-to-server comms. Pinning in this context means they bundle the cert (or signature) with their app. By the looks of this (http://security.stackexchange.com/questions/29988/what-is-ce...) it's a similar story with chrome: they pre-bundle some signatures. The alternative is to pin on the first interaction, but this leaves you potentially vulnerable if an attacker is listening in on that first interaction. It also raises the question: what happens if the website needs to revoke and re-issue? Wouldn't pre-bundling mean you'd have to wait for the next browser update (and for out of band commms to have occurred between google and the website)?
If you're providing both an app and a server for the app to talk to you, you control both ends of the TLS connection and can pin however you'd like; you're not limited to HPKP and key-continuity. Secure apps have been doing custom pins of TLS keys long before HPKP got rolled out.