{"id":646,"date":"2017-10-30T15:24:44","date_gmt":"2017-10-30T15:24:44","guid":{"rendered":"https:\/\/securitycurve.com\/?p=646"},"modified":"2017-10-30T15:24:44","modified_gmt":"2017-10-30T15:24:44","slug":"google-abandoning-key-pinning","status":"publish","type":"post","link":"https:\/\/securitycurve.com\/?p=646","title":{"rendered":"Google abandoning key pinning"},"content":{"rendered":"<p><img decoding=\"async\" class=\"alignright size-large lazyload\" data-src=\"https:\/\/i.giphy.com\/media\/wjreQXpQaD6tW\/giphy.webp\" width=\"500\" height=\"375\" src=\"data:image\/svg+xml;base64,PHN2ZyB3aWR0aD0iMSIgaGVpZ2h0PSIxIiB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciPjwvc3ZnPg==\" style=\"--smush-placeholder-width: 500px; --smush-placeholder-aspect-ratio: 500\/375;\" \/>Keeping with our Halloween theme, today we have Pinhead.\u00a0 Because it&#8217;s horror stuff but also because the article is about key pinning (because &#8220;pin&#8221;, get it?)\u00a0 I kill me.<\/p>\n<p>Anyway, today we have an interesting turn of events. Google is <a href=\"https:\/\/www.theregister.co.uk\/2017\/10\/30\/google_hpkp\/\">planning to pull key pinning (HPKP) from Chrome<\/a>.\u00a0 There&#8217;s a whole thread about the motivation, timeline, and plan <a href=\"https:\/\/groups.google.com\/a\/chromium.org\/forum\/#!msg\/blink-dev\/he9tr7p3rZ8\/eNMwKPmUBAAJ\">here<\/a>.<\/p>\n<p>If you&#8217;re not familiar with key pinning, it&#8217;s basically a mechanism to allow a server, via HTTP response headers, to send a message to a &#8220;user agent&#8221; (i.e. your browser) about what public key to expect that server to use.\u00a0 In other words, to say something akin to &#8220;hey&#8230; when you talk to me, you should get this certificate or one of these public keys.&#8221;<\/p>\n<p>Why do this?\u00a0 It&#8217;s a (kludgy I&#8217;d argue) workaround for CA compromise.\u00a0 Say, for example, bad guys trick some CA into issuing a certificate for *.google.com.\u00a0 Those bad guys what to use that certificate to do all kinds of shenanigans &#8211; set up a proxy for MITM for example.\u00a0 Sounds nefarious, right?\u00a0 But if the server has already told the client &#8220;hey, if you talk to me later and you don&#8217;t get this particular cert &#8211; or a cert that contains a public key matching XYZ &#8211; then you&#8217;re probably being scammed.&#8221;\u00a0 This lets the browser warn people about it if they get something they don&#8217;t expect.<\/p>\n<p>If you really want to understand how it works at a high level of depth,\u00a0the<a href=\"https:\/\/tools.ietf.org\/html\/rfc7469\">\u00a0RFC (RFC 7469)<\/a>\u00a0 is the best way to get there, but another useful resource is the <a href=\"https:\/\/www.owasp.org\/index.php\/Certificate_and_Public_Key_Pinning\">page up at OWASP about it<\/a>.\u00a0 It&#8217;s really not complicated though: response headers that specific certificate or key information to be used by the browser to &#8220;pin&#8221; what they should expect to receive from that site.<\/p>\n<p>The primary reason why Google pulling back on it is super interesting though is because it was Google that started all this pinning stuff in the first place.\u00a0 For example, check out that RFC that I linked to before &#8211; do you notice who wrote it?\u00a0 \u00a0Yeah.\u00a0 Google.\u00a0 And recently too.\u00a0 So that&#8217;s interesting.\u00a0 They cite three factors for this decision; paraphrased, they are: it&#8217;s hard to do (exacerbated by the fact that not many people are supporting it), it&#8217;s risky, and someone could attack it.\u00a0 Is it a good idea?\u00a0 Yes&#8230; yes it is.\u00a0 Are they right to deprecate it?\u00a0 Yes, I think they are.<\/p>\n<p>If those two statements sound incompatible to you, I come back to the statement that I made earlier about it being a kludge.\u00a0 I say it&#8217;s a kludge (for you youngsters, &#8220;kludge&#8221;=inelegant workaround) because it&#8217;s outside where this should (in my opinion) really happen, which is the TLS protocol itself&#8230; better yet, in\u00a0<strong>TLS implementations<\/strong> based on instructions built into public PKI certs.<\/p>\n<p>Here&#8217;s why I say that.\u00a0 HPKP is out of band to TLS &#8212; in the response headers, right?\u00a0 But wouldn&#8217;t it be nice if other, non-HTTP connections could have this same safety feature?\u00a0 Sure.\u00a0 Can they?\u00a0 No&#8230; not with this mechanism anyway.\u00a0 \u00a0From a conceptual point of view, the problem we&#8217;re trying to solve isn&#8217;t really a problem with HTTP&#8230; HTTP is fine the way it is.\u00a0 It&#8217;s also not really a TLS issue.\u00a0 The mechanics of security issues in the certificates it uses are, I&#8217;d argue, outside of the scope of the TLS standard.\u00a0 Instead, it&#8217;s a PKI problem.\u00a0 So addressing it at the PKI level seems to make the most sense.<\/p>\n<p>If it were up to me to design a fix, I\u00a0would use either extended key usage (in the certificate) or the certificate policy extension to implement HPKP.\u00a0 Why?\u00a0 Because that&#8217;s what these fields are for &#8211; i.e. information about certificate policy (many times this is just a link, but it doesn&#8217;t have to be) or about how they key should be used.\u00a0 \u00a0That&#8217;s step one.\u00a0 Step two would be to get relying parties (such as TLS implementations) to &#8220;want&#8221; to pin the cert if they get one that has this field set to something informative.\u00a0 In other words, they do it because the cert specifies they should and gives them instructions on how.\u00a0 The implementation can be agnostic about why, for what purpose, whether used in HTTPS or something else, etc.\u00a0 In fact, you could do everything you&#8217;re doing now in HPKP&#8230; just more cleanly and in a way that lets you use it for other use cases too.<\/p>\n<p>At the end of the day, I do think HPKP is a good idea.\u00a0 It starts from the presupposition that &#8220;bogus certificates will happen&#8221;.\u00a0 As a practical matter they do &#8212; for some <a href=\"https:\/\/securitycurve.com\/looking-at-you-ca-browser-forum-economics-of-cas-certificate-authorities-and-viability-of-public-pki\/\">pretty straightforward economic reasons that I&#8217;ve laid out in the past<\/a>.\u00a0 Recognizing this is good security.\u00a0 But that said&#8230; I think if you&#8217;re going to do it, the browser is the wrong place to implement it.\u00a0 The cert, on the other hand, seems like a better path.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Keeping with our Halloween theme, today we have Pinhead.\u00a0 Because it&#8217;s horror stuff but also because the article is about key pinning (because &#8220;pin&#8221;, get it?)\u00a0 I kill me. Anyway, today we have an interesting turn of events. Google is planning to pull key pinning (HPKP) from Chrome.\u00a0 There&#8217;s a whole thread about the motivation, [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_et_pb_use_builder":"","_et_pb_old_content":"","_et_gb_content_width":"","footnotes":""},"categories":[4],"tags":[66],"class_list":["post-646","post","type-post","status-publish","format-standard","hentry","category-security","tag-hpkp"],"_links":{"self":[{"href":"https:\/\/securitycurve.com\/index.php?rest_route=\/wp\/v2\/posts\/646","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/securitycurve.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/securitycurve.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/securitycurve.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/securitycurve.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=646"}],"version-history":[{"count":0,"href":"https:\/\/securitycurve.com\/index.php?rest_route=\/wp\/v2\/posts\/646\/revisions"}],"wp:attachment":[{"href":"https:\/\/securitycurve.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=646"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/securitycurve.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=646"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/securitycurve.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=646"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}