{"id":975,"date":"2012-08-30T00:00:13","date_gmt":"2012-08-30T04:00:13","guid":{"rendered":"http:\/\/jlg.name\/blog\/?p=975"},"modified":"2013-09-01T23:30:08","modified_gmt":"2013-09-02T03:30:08","slug":"high-sodium-passwords","status":"publish","type":"post","link":"http:\/\/jlg.name\/blog\/2012\/08\/high-sodium-passwords\/","title":{"rendered":"High-sodium passwords"},"content":{"rendered":"<p>Recently I\u2019ve had some interesting conversations about passwords and password policies.<\/p>\n<p>In general I despise password policies, or at least I despise the silly requirements made by most policies.\u00a0 As I wrote in TCS\u2019s recent\u00a0<em><a href=\"http:\/\/info.telecomsys.com\/better-passwords-whitepaper\">Better Passwords, Usable Security<\/a><\/em>\u00a0white paper, \u201cWhy do you require your users\u2019 passwords to look as though somebody sneezed on their keyboard? \u2026 Is your organization really better protected if you require your users to memorize a new 14-character password every two months? I argue no!\u201d<\/p>\n<p>In the\u00a0<em>BPUS<\/em>\u00a0white paper \u2014 which is behind a paywall, and I understand how that means it\u2019s unlikely you\u2019ll ever read it \u2014 I argue for three counterintuitive points:<\/p>\n<ol start=\"1\">\n<li>Password policies should serve your users\u2019 needs, not vice versa.<\/li>\n<li>Passwords shouldn\u2019t be your sole means of protection.<\/li>\n<li>Simpler passwords can be better than complex ones.<\/li>\n<\/ol>\n<p>Beyond these points, it is also important to implement good mechanisms for storing and checking passwords.<\/p>\n<p><em>Storing passwords:<\/em>\u00a0In June of this year there was a flurry of news articles about password leaks, including leaks at\u00a0<a href=\"http:\/\/www.zdnet.com\/blog\/btl\/6-46-million-linkedin-passwords-leaked-online\/79290\">LinkedIn<\/a>,\u00a0<a href=\"http:\/\/www.slate.com\/articles\/technology\/technology\/2012\/06\/linkedin_eharmony_password_leak_what_russian_hackers_do_with_your_personal_information_.html\">eHarmony<\/a>, and\u00a0<a href=\"http:\/\/news.cnet.com\/8301-1009_3-57449037-83\/last.fm-warns-users-of-password-leak\/\">Last.fm<\/a>.\u00a0 The LinkedIn leak was especially bad because they didn\u2019t \u201csalt\u201d their stored password hashes.\u00a0 Salting works as follows:<\/p>\n<ul>\n<li>An authentication system typically stores\u00a0<a href=\"http:\/\/computer.howstuffworks.com\/encryption5.htm\">hashes of passwords<\/a>, not cleartext passwords themselves.\u00a0 Storing the hash originally made it hard for someone who stole the \u201cpassword file\u201d to actually obtain the passwords.<\/li>\n<li>When you type in your password, the authentication system first takes a hash of what you typed in, then compares the hash with what\u2019s stored in the password file.\u00a0 If your hash matches the stored hash, you get access.<\/li>\n<li>But attackers aren\u2019t dumb.\u00a0 An attacker can create (or obtain) a \u201c<a href=\"http:\/\/www.codinghorror.com\/blog\/2007\/09\/rainbow-hash-cracking.html\">rainbow table<\/a>\u201d containing reverse mappings of hash value to password.\u00a0 For example, the SHA-1 hash of \u201cPeter\u201d is \u201c64ca93f83bb29b51d8cbd6f3e6a8daff2e08d3ec\u201d.\u00a0 A rainbow table would map \u201c64ca93f83bb29b51d8cbd6f3e6a8daff2e08d3ec\u201d back to \u201cPeter\u201d.<\/li>\n<li>Salt can foil this attack.\u00a0 Salt is random characters that are appended to a password before the hash is taken.\u00a0 So, using the salt \u201c89h29348U#^^928h35\u2033, your password \u201cPeter\u201d would be automatically extended to \u201cPeter89h29348U#^^928h35\u201d, which hashes to \u201cb2d58c2785ada702df68d32744811b1cfccc5f2f\u201d. \u00a0For large truly-random salts, it is unlikely that a rainbow table already exists for that salt \u2014 taking the reverse-mapping option off the table for the attacker.<\/li>\n<li>Each user is assigned a\u00a0<a href=\"http:\/\/crypto.stackexchange.com\/questions\/18\/how-can-a-random-salt-for-a-hash-function-work-in-practice\">different set of random characters<\/a>\u00a0for generating the salted hash, and these would be stored somewhere in your authentication system.\u00a0 Nathan\u2019s set of random characters would be different from Aaron\u2019s.<\/li>\n<li>A big win of salt is that it provides compromise independence.\u00a0 Even if an attacker has both the password\/hash file and the list of salts for each user, the attacker still has to run a brute-force attack against every cleartext password he wants to obtain.<\/li>\n<\/ul>\n<p>If you don\u2019t salt your passwords, then anyone who can get access to the leaked file can likely reverse many of the passwords, very easily.\u00a0 This password recovery is especially a problem since many users reuse passwords across sites (I admit that I used to do this on certain sites until fairly recently).<\/p>\n<p><em>Checking passwords:<\/em>\u00a0But it turns out that salt may no longer be solving the world\u2019s password woes.\u00a0 A colleague sent me a link to a post-LeakedIn interview arguing that\u00a0<a href=\"https:\/\/krebsonsecurity.com\/2012\/06\/how-companies-can-beef-up-password-security\/\">cryptographic hashes are pass\u00e9<\/a>.\u00a0 At first I felt that the interviewee was blowing smoke, and wrote the following observations to my colleague:<\/p>\n<blockquote><p>He confuses the notion of \u201cstrong salt\u201d with \u201cstrong hash\u201d.<\/p>\n<p>(A) strong salt: you add a lot of random characters to your password before hashing\u2026as a result the attacker has to run a brute force attack against the hash for a looooong time (many * small effort) in order to crack the password.<\/p>\n<p>(B) strong hash: you use a computationally-intensive function to compute the hash\u2026as a result the attacker has to run a brute force attack against the hash for a looooong time (few * large effort) in order to crack the password.<\/p>\n<p>In both cases you get the desirable \u201clooooong time\u201d property.\u00a0 You can also combine 1 and 2 for an even looooonger time (and in general looooonger is better, though looooong is often long enough).<\/p>\n<p>There can be some problems with approach #2 \u2014 the biggest is non-portability of the hash (SHA-1 is supported by pretty much everything; bcrypt isn\u2019t necessarily), another could be remote denial of service attacks against the authentication system (it will have a much higher workload because of the stronger hash algorithm, and if you\u2019re LinkedIn you have to process a lot of authentications per second).<\/p>\n<p>Conclusion: The problem with LinkedIn was the lack of salted passwords.<\/p><\/blockquote>\n<p>But I kept thinking about that article, and\u00a0<a href=\"http:\/\/www.itworld.com\/security\/280813\/expert-calls-linkedins-new-salted-hashes-useless\">related posts<\/a>, and eventually had to eat some of my words (though not all of them).\u00a0 Looooong is often\u00a0<strong>not<\/strong>\u00a0long enough.<\/p>\n<p>The best discussion I found on the topic was in the RISKS digest,\u00a0<a href=\"http:\/\/catless.ncl.ac.uk\/Risks\/26.90.html#subj8.1\">especially this post<\/a>\u00a0and its two\u00a0<a href=\"http:\/\/throwingfire.com\/storing-passwords-securely\/\">particularly<\/a>\u00a0<a href=\"https:\/\/www.f-secure.com\/weblog\/archives\/00002095.html\">interesting<\/a>\u00a0references.<\/p>\n<p>My point (A) above may be becoming increasingly less valid due to the\u00a0<a href=\"http:\/\/hardware.slashdot.org\/story\/11\/06\/20\/1738208\/brute-force-password-cracking-with-gpus\">massive increases in cracking speed<\/a>\u00a0made possible by running crackers directly on GPUs.\u00a0 Basically, using a salt + password means that you should be using a large\/strong enough salt to evade brute force attacks.\u00a0 So that raises the concern that some people aren\u2019t using a large\/strong enough salt.<\/p>\n<p>Beyond salting there are always ways to increase the security of a password-based authentication system.\u00a0 Instead of a stronger hash, you could require users to type 20 character passwords, or you could require two passwords, etc.<\/p>\n<p>But back to my original point, longer or complex passwords aren\u2019t always the best choice.\u00a0 That is especially the case when you have two-factor authentication (or other protection mechanisms) \u2014 as long as you use the two factors\u00a0<em>everywhere<\/em>.\u00a0 (For example, one company I recently talked with deployed a strong two-factor authentication system for VPN connections but mistakenly left single-factor password authentication enabled on their publicly-accessible webmail server.)<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Recently I\u2019ve had some interesting conversations about passwords and password policies. In general I despise password policies, or at least I despise the silly requirements made by most policies.\u00a0 As I wrote in TCS\u2019s recent\u00a0Better Passwords, Usable Security\u00a0white paper, \u201cWhy do you require your users\u2019 passwords to look as though somebody sneezed on their keyboard? [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":[],"categories":[5,7],"tags":[],"_links":{"self":[{"href":"http:\/\/jlg.name\/blog\/wp-json\/wp\/v2\/posts\/975"}],"collection":[{"href":"http:\/\/jlg.name\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/jlg.name\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/jlg.name\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"http:\/\/jlg.name\/blog\/wp-json\/wp\/v2\/comments?post=975"}],"version-history":[{"count":1,"href":"http:\/\/jlg.name\/blog\/wp-json\/wp\/v2\/posts\/975\/revisions"}],"predecessor-version":[{"id":976,"href":"http:\/\/jlg.name\/blog\/wp-json\/wp\/v2\/posts\/975\/revisions\/976"}],"wp:attachment":[{"href":"http:\/\/jlg.name\/blog\/wp-json\/wp\/v2\/media?parent=975"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/jlg.name\/blog\/wp-json\/wp\/v2\/categories?post=975"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/jlg.name\/blog\/wp-json\/wp\/v2\/tags?post=975"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}