{"id":292,"date":"2018-12-16T12:55:41","date_gmt":"2018-12-16T12:55:41","guid":{"rendered":"http:\/\/nitk.acm.org\/blog\/?p=292"},"modified":"2018-12-16T12:55:41","modified_gmt":"2018-12-16T12:55:41","slug":"strengthening-security-with-pake-protocol","status":"publish","type":"post","link":"https:\/\/nitk.acm.org\/blog\/2018\/12\/16\/strengthening-security-with-pake-protocol\/","title":{"rendered":"Strengthening Security with PAKE Protocol"},"content":{"rendered":"<p><span style=\"font-weight: 400;\">You know that guy who does a lot of work but just doesn\u2019t get the attention he deserves? The PAKE Protocol is that guy. <\/span><\/p>\n<p><span style=\"font-weight: 400;\">PAKE &#8211; One of the most efficient cryptographic protocols ever drafted yet rarely gets used.<\/span><\/p>\n<p><i><span style=\"font-weight: 400;\">NOTE : Throughout this article, there might be words you have never heard of. I have tried explaining most of them in braces[] and in italics.<\/span><\/i><\/p>\n<p><b>PAKE stands for Password Authenticated Key Exchange. <\/b><\/p>\n<p><span style=\"font-weight: 400;\">Let us consider a simple problem where there is a server which stores user passwords. <\/span><span style=\"font-weight: 400;\">The traditional way to do this is to hash [<\/span><i><span style=\"font-weight: 400;\">A cryptographic hash function is a hash function which takes an input and returns a fixed-size alphanumeric string<\/span><\/i><span style=\"font-weight: 400;\">] each user password and store the result in a database. But there exists a drawback : <\/span><b><i>When the user comes back to log into the website, they will still need to send over their (cleartext) password, since this is required in order for the server to do the check. <\/i><\/b><\/p>\n<p><span style=\"font-weight: 400;\">The fact that the cleartext password <\/span><b>has<\/b><span style=\"font-weight: 400;\"> to reach the server poses a major threat if the server is compromised. Hence, there is a need to introduce a new method to ensure that the cleartext password doesn\u2019t reach the server. <\/span><\/p>\n<p><span style=\"font-weight: 400;\">PAKE as the name suggests is a key exchange mechanism. Key exchange protocols are designed to help two parties (say a <\/span><i><span style=\"font-weight: 400;\">client<\/span><\/i><span style=\"font-weight: 400;\"> and <\/span><i><span style=\"font-weight: 400;\">server<\/span><\/i><span style=\"font-weight: 400;\">) agree on a shared key, using public-key cryptography. Some key exchange protocols \u2014 like the Diffie-Hellman were unauthenticated, which made them vulnerable to man-in-the-middle attacks <\/span><i><span style=\"font-weight: 400;\">[Attacks where the attacker secretly relays and possibly alters the communication between two parties who believe they are directly communicating with each other]<\/span><\/i><span style=\"font-weight: 400;\">. The distinguishing feature of PAKE protocols is the client will authenticate herself to the server using a password. <\/span><\/p>\n<p><span style=\"font-weight: 400;\">PAKE provides protection for the client\u2019s password. After a login attempt (valid, or invalid) both the client and server should learn <\/span><b>only<\/b><span style=\"font-weight: 400;\"> whether the client\u2019s password matched the server\u2019s expected value, and <\/span><b>no<\/b><span style=\"font-weight: 400;\"> additional information. <\/span><\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-293\" src=\"https:\/\/nitk.acm.org\/blog\/wp-content\/uploads\/2018\/12\/530FC049-212C-4AD9-9124-AA31A823CF25.jpeg\" alt=\"\" width=\"748\" height=\"156\" srcset=\"https:\/\/nitk.acm.org\/blog\/wp-content\/uploads\/2018\/12\/530FC049-212C-4AD9-9124-AA31A823CF25.jpeg 748w, https:\/\/nitk.acm.org\/blog\/wp-content\/uploads\/2018\/12\/530FC049-212C-4AD9-9124-AA31A823CF25-300x63.jpeg 300w\" sizes=\"auto, (max-width: 748px) 100vw, 748px\" \/><\/p>\n<p><i><span style=\"font-weight: 400;\">Ideal representation of the PAKE protocol<\/span><\/i><\/p>\n<h2><b>Why isn\u2019t PAKE being adopted?<\/b><\/h2>\n<p><span style=\"font-weight: 400;\">With the exception of SRP(explained below), which is a varied version of the PAKE protocol, there seems to be no sight of the PAKE anywhere else. <\/span><\/p>\n<p><span style=\"font-weight: 400;\">Possible reasons : <\/span><\/p>\n<ol>\n<li style=\"font-weight: 400;\"><span style=\"font-weight: 400;\">There\u2019s a lack of good PAKE implementations in useful languages, which makes it a hassle to use. <\/span><\/li>\n<li style=\"font-weight: 400;\"><span style=\"font-weight: 400;\">Patents hinder its implementation.<\/span><\/li>\n<li style=\"font-weight: 400;\"><span style=\"font-weight: 400;\">PAKE is not officially a certified protocol and many people aren\u2019t aware of it.<\/span><\/li>\n<\/ol>\n<h2><b>OPAQUE<\/b><\/h2>\n<p><span style=\"font-weight: 400;\">There is a certain protocol called the SRP<\/span> <span style=\"font-weight: 400;\">[<\/span><i><span style=\"font-weight: 400;\">Secure Remote Password<\/span><\/i><span style=\"font-weight: 400;\">]<\/span> <span style=\"font-weight: 400;\">protocol, which is a varied version of the PAKE protocol. It is one of the widely used protocols right now. SRP has been declared as an industry standard, and is actually implemented in libraries like OpenSSL. <\/span><\/p>\n<p><span style=\"font-weight: 400;\">But SRP has its drawbacks. SRP is vulnerable to pre-computation attacks, because it hands over the user\u2019s \u201csalt\u201d <\/span><i><span style=\"font-weight: 400;\">[In cryptography, a salt is random data that is used as an additional input to a one-way function that &#8220;hashes&#8221; data. A new salt is randomly generated for each password]<\/span><\/i><span style=\"font-weight: 400;\"> to an attacker who can start an SRP session. This means the attacker can ask a server for your salt, and build a dictionary of potential password hashes even <\/span><i><span style=\"font-weight: 400;\">before<\/span><\/i><span style=\"font-weight: 400;\"> the server is compromised (hence the term, pre-computation). <\/span><\/p>\n<p><span style=\"font-weight: 400;\">OPAQUE solves this scenario. The protocol might be too complex to explain in a single article. But its features and functionality advantages can be easily studied.<\/span><\/p>\n<p><span style=\"font-weight: 400;\">OPAQUE does <\/span><i><span style=\"font-weight: 400;\">not<\/span><\/i><span style=\"font-weight: 400;\"> reveal the salt to the attacker. It solves this problem by using an efficient oblivious<\/span> <b><i>PRF<\/i><\/b><span style=\"font-weight: 400;\"> [A Pseudo Random Function is a function that is indistinguishable from a function selected at random from the set of all functions with the same domain and value set.] to combine the salt with the password, in a way that ensures the client does not learn the salt <\/span><i><span style=\"font-weight: 400;\">and<\/span><\/i><span style=\"font-weight: 400;\"> the server does not learn the password. OPAQUE works with <\/span><i><span style=\"font-weight: 400;\">any<\/span><\/i><span style=\"font-weight: 400;\"> password hashing function. Since all the hashing work is done on the <\/span><i><span style=\"font-weight: 400;\">client<\/span><\/i><span style=\"font-weight: 400;\">, OPAQUE can actually <\/span><i><span style=\"font-weight: 400;\">take load off<\/span><\/i><span style=\"font-weight: 400;\"> the server.<\/span><\/p>\n<h2><b>How OPAQUE works<\/b><\/h2>\n<h3><b><i>Keeps the salt a secret <\/i><\/b><\/h3>\n<p><span style=\"font-weight: 400;\">The salt, along with the password is fed into a hash function. If the server is the one that computes this function, then the server has to see the password and the purpose is destroyed. Meanwhile, if it\u2019s the client, the client needs the salt, which again defeats the purpose. <\/span><\/p>\n<p><span style=\"font-weight: 400;\">To solve this, OPAQUE does the following. The protocol leaves the password has on the client\u2019s side, but doesn\u2019t provide the salt to the hash. Instead, a special two-party protocol called an oblivious <\/span><b>PRF<\/b><span style=\"font-weight: 400;\"> (mentioned earlier) is employed to calculate a second salt so that the client can use this new salt in the hash function, but does not know the original salt. <\/span><\/p>\n<h3><b><i>Proving that the client got the right key K<\/i><\/b><\/h3>\n<p><span style=\"font-weight: 400;\">The client has derived a key K, but the server doesn\u2019t know what it is or whether it\u2019s the right key. <\/span><\/p>\n<p><span style=\"font-weight: 400;\">When the user registers on the server for the first time, she generates a strong public and private key for a secure agreement protocol, and encrypts the resulting private key under K, along with the public key of the server into a ciphertext. Let\u2019s call this ciphertext C.<\/span><\/p>\n<p><span style=\"font-weight: 400;\">The server sends the stored ciphertext C to the client. If the client entered the right password into the first phase, she can derive K, and now decrypt this ciphertext. The server verifies the clients\u2019 inputs against its copy of the client\u2019s public key, and the client does similarly.<\/span><\/p>\n<p><span style=\"font-weight: 400;\">Whew, that was a lot of information to handle. <\/span><i><span style=\"font-weight: 400;\">But the point is the PAKE protocol is a perfectly secure protocol being overlooked for not-so-valid reasons.<\/span><\/i><\/p>\n<p style=\"text-align: right;\"><em>&#8211; Nishanth Subramanian<\/em><\/p>\n","protected":false},"excerpt":{"rendered":"<p>You know that guy who does a lot of work but just doesn\u2019t get the attention he deserves? The PAKE Protocol is that guy. PAKE &#8211; One of the most efficient cryptographic protocols ever drafted yet rarely gets used. NOTE : Throughout this article, there might be words you have never heard of. I have&#8230;<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_exactmetrics_skip_tracking":false,"_exactmetrics_sitenote_active":false,"_exactmetrics_sitenote_note":"","_exactmetrics_sitenote_category":0,"footnotes":""},"categories":[25,10],"tags":[79,78,80],"class_list":["post-292","post","type-post","status-publish","format-standard","hentry","category-sanganitra","category-tech","tag-cryptography","tag-pake-protocol","tag-security"],"_links":{"self":[{"href":"https:\/\/nitk.acm.org\/blog\/wp-json\/wp\/v2\/posts\/292","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/nitk.acm.org\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/nitk.acm.org\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/nitk.acm.org\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/nitk.acm.org\/blog\/wp-json\/wp\/v2\/comments?post=292"}],"version-history":[{"count":1,"href":"https:\/\/nitk.acm.org\/blog\/wp-json\/wp\/v2\/posts\/292\/revisions"}],"predecessor-version":[{"id":294,"href":"https:\/\/nitk.acm.org\/blog\/wp-json\/wp\/v2\/posts\/292\/revisions\/294"}],"wp:attachment":[{"href":"https:\/\/nitk.acm.org\/blog\/wp-json\/wp\/v2\/media?parent=292"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/nitk.acm.org\/blog\/wp-json\/wp\/v2\/categories?post=292"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/nitk.acm.org\/blog\/wp-json\/wp\/v2\/tags?post=292"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}