{"id":176,"date":"2013-07-23T11:38:03","date_gmt":"2013-07-23T19:38:03","guid":{"rendered":"http:\/\/blog.mozilla.org\/warner\/?p=176"},"modified":"2013-07-23T11:53:11","modified_gmt":"2013-07-23T19:53:11","slug":"picl-crypto-review","status":"publish","type":"post","link":"https:\/\/blog.mozilla.org\/warner\/2013\/07\/23\/picl-crypto-review\/","title":{"rendered":"PiCL Crypto Review"},"content":{"rendered":"<p>I&#8217;ve been working on the security design for the next version of Firefox Sync, which is the bit that keeps your bookmarks\/history\/saved-passwords\/etc synchronized between Firefoxes on all your various devices. The working title is &#8220;PiCL&#8221;, which stands for &#8220;Profile In the CLoud&#8221;. In the coming year, this will be deployed to roughly 500 million Firefox users.<\/p>\n<p>I&#8217;m looking for feedback on our design. It involves key-stretching (PBKDF2 and scrypt), secure handling of password-derived keys, SRP, and a healthy distrust of SSL. If you&#8217;re interested, read on!<\/p>\n<p><!--more--><\/p>\n<p>Unlike the previous Sync design, in which a full-strength random key was transferred between paired devices with a J-PAKE-based protocol, PiCL is obligated to use a traditional email+password as account credentials. My task has been to provide as much cryptographic protection of the user&#8217;s private data as possible, given that constraint. Our goal is to enable the user to have some data that is not visible to Mozilla (we run the servers) or their email-provider (through which a forgotten password can be reset).<\/p>\n<p>I&#8217;m focusing on the portion of the system that gets from email+password to a pair of master keys &#8220;kA&#8221; and &#8220;kB&#8221; (described below) and a session token. There are a lot of parts you can ignore for now, like how we use kA\/kB to encrypt the user&#8217;s data later (we&#8217;ll use HKDF to get per-datatype AES\/HMAC keys), how BrowserID certificates authorize communication with the storage-server, and how the data actually gets synchronized (efficient delta transfer, resolving merge conflicts, etc).<\/p>\n<p>The protocol is mainly described here:<\/p>\n<ul>\n<li><a title=\"https:\/\/wiki.mozilla.org\/Identity\/AttachedServices\/KeyServerProtocol\" href=\"https:\/\/wiki.mozilla.org\/Identity\/AttachedServices\/KeyServerProtocol\" target=\"_blank\">https:\/\/wiki.mozilla.org\/Identity\/AttachedServices\/KeyServerProtocol<\/a><\/li>\n<\/ul>\n<p>with some additional background here:<\/p>\n<ul>\n<li><a title=\"https:\/\/wiki.mozilla.org\/Identity\/AttachedServices\/Architecture\" href=\"https:\/\/wiki.mozilla.org\/Identity\/AttachedServices\/Architecture\" target=\"_blank\">https:\/\/wiki.mozilla.org\/Identity\/AttachedServices\/Architecture<\/a><\/li>\n<li><a title=\"https:\/\/wiki.mozilla.org\/Identity\/AttachedServices\" href=\"https:\/\/wiki.mozilla.org\/Identity\/AttachedServices\" target=\"_blank\">https:\/\/wiki.mozilla.org\/Identity\/AttachedServices<\/a><\/li>\n<\/ul>\n<p>The protocol page might be missing some context, so here&#8217;s a summary:<\/p>\n<ul>\n<li>PICL accounts are defined by an email address and a password<\/li>\n<li>PICL will encrypt all user data, with per-datatype keys derived from either a &#8220;class-A&#8221; or a &#8220;class-B&#8221; master key (kA and kB).<\/li>\n<li>data in class-A is recoverable, even if you forget your password: you can ask us\u00a0 nicely (via the usual email-based account-reset process) and we&#8217;ll tell you kA.<\/li>\n<li>data is class-B is not recoverable if you forget the password<\/li>\n<li>we run a &#8220;keyserver&#8221;, which is used during signin. It knows kA and a wrapped form of kB.<\/li>\n<li>encrypted data is stored on a &#8220;storage server&#8221;, and to control it, clients must present a BrowserID assertion, whose certificate is signed by the keyserver. The Session\u00a0 Token gets you these signatures.<\/li>\n<\/ul>\n<p>My goal is for the confidentiality of the class-B data to be no weaker than the account password, and for this password never be revealed outside the user&#8217;s browser. If your password can&#8217;t be brute-forced, your data should remain safe, even if our keyserver is compromised. Class-A data should be no weaker than the typical &#8220;service-provider sees everything&#8221; approach. We also do a lot of key-stretching on the password, to make a brute-force attack as expensive as possible.<\/p>\n<p>It&#8217;s supposed to reject all but the following attacks:<\/p>\n<ul>\n<li>a TLS failure during initial account creation allows the MitM to offline brute-force the user&#8217;s password<\/li>\n<li>anybody can try an online brute-force attack, rate-limited of course<\/li>\n<li>the keyserver can do an offline brute-force attack<\/li>\n<li>the IdP (who sees the forgot-password email) can reset the account themselves and\u00a0 learn kA, but not kB<\/li>\n<li>compromising the browser itself reveals everything, of course<\/li>\n<\/ul>\n<p>In particular, the storage servers shouldn&#8217;t be any better off than a random stranger, to keep the security perimeter small.<\/p>\n<p>Feel free to send comments to me, or drop by the #picl IRC channel on irc.mozilla.org (I&#8217;m &#8220;warner&#8221; on #picl), or send them to the sync-dev mailing list (<a title=\"https:\/\/mail.mozilla.org\/listinfo\/sync-dev\" href=\"https:\/\/mail.mozilla.org\/listinfo\/sync-dev\">https:\/\/mail.mozilla.org\/listinfo\/sync-dev<\/a>). And please forward this to anyone else you think might be interested.<\/p>\n<p>thanks!<br \/>\n-Brian<\/p>\n","protected":false},"excerpt":{"rendered":"<p>I&#8217;ve been working on the security design for the next version of Firefox Sync, which is the bit that keeps your bookmarks\/history\/saved-passwords\/etc synchronized between Firefoxes on all your various devices. The working title is &#8220;PiCL&#8221;, which stands for &#8220;Profile In the CLoud&#8221;. In the coming year, this will be deployed to roughly 500 million Firefox [&hellip;]<\/p>\n","protected":false},"author":328,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[10479,8633],"tags":[],"_links":{"self":[{"href":"https:\/\/blog.mozilla.org\/warner\/wp-json\/wp\/v2\/posts\/176"}],"collection":[{"href":"https:\/\/blog.mozilla.org\/warner\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/blog.mozilla.org\/warner\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/blog.mozilla.org\/warner\/wp-json\/wp\/v2\/users\/328"}],"replies":[{"embeddable":true,"href":"https:\/\/blog.mozilla.org\/warner\/wp-json\/wp\/v2\/comments?post=176"}],"version-history":[{"count":0,"href":"https:\/\/blog.mozilla.org\/warner\/wp-json\/wp\/v2\/posts\/176\/revisions"}],"wp:attachment":[{"href":"https:\/\/blog.mozilla.org\/warner\/wp-json\/wp\/v2\/media?parent=176"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/blog.mozilla.org\/warner\/wp-json\/wp\/v2\/categories?post=176"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/blog.mozilla.org\/warner\/wp-json\/wp\/v2\/tags?post=176"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}