TE
TechEcho
Home24h TopNewestBestAskShowJobs
GitHubTwitter
Home

TechEcho

A tech news platform built with Next.js, providing global tech news and discussions.

GitHubTwitter

Home

HomeNewestBestAskShowJobs

Resources

HackerNews APIOriginal HackerNewsNext.js

© 2025 TechEcho. All rights reserved.

Enough with the Salts: Updates on Secure Password Schemes

339 pointsby saturdayplaceabout 10 years ago

27 comments

moxieabout 10 years ago
It&#x27;s easy to say &quot;use bcrypt&quot; or &quot;use scrypt,&quot; but I think it&#x27;s important to acknowledge the challenges of deploying those functions in large scale high performance environments.<p>It&#x27;s straightforward and effective when password hashing happens client-side (like local encryption for a bitcoin wallet), but using scrypt or bcrypt <i>server-side</i> at effective difficulty levels will either destroy your L1&#x2F;L2 cache or exceed your CPU budget.<p>In practice, from what I&#x27;ve seen, this means scrypt is never used, and bcrypt is used with a work factor that&#x27;s tuned low. I think this is just a fundamental asymmetry, and that at the end of the day people use bcrypt so that they can say &quot;we used bcrypt!&quot; and get a nod when their entire user database is compromised, even though it provides very little value the way it&#x27;s deployed.
评论 #9305504 未加载
评论 #9305247 未加载
评论 #9304943 未加载
评论 #9305000 未加载
评论 #9305071 未加载
评论 #9305015 未加载
评论 #9314536 未加载
评论 #9307511 未加载
评论 #9305037 未加载
评论 #9305185 未加载
评论 #9305201 未加载
评论 #9309131 未加载
评论 #9308688 未加载
ryan-cabout 10 years ago
This article says salting hashes is only useful against rainbow tables. That does not make sense to me. Say you have a password database with 10,000 users in it. You want to see if any of them used &quot;Passw0rd$&quot;. Without salt, you compute the hash once and check it against <i>all</i> the users (perhaps with a bloom filter). With per-user salts, you have to compute the hash for <i>each user</i>.<p>I think salting offers pretty clear benefits against other attacks if you have more than one user.<p>Edit: The point I&#x27;m trying to make here is that it is N_USERS times better to have a unique salt per user, regardless of the hash. One should use bcrypt&#x2F;scrypt&#x2F;pbkdf2 with unique per-user salts.
评论 #9305350 未加载
评论 #9305144 未加载
评论 #9306059 未加载
评论 #9305126 未加载
评论 #9305510 未加载
femto113about 10 years ago
&gt; I see the mantra ‘salt your password hashes!’ &gt; repeated over and over, when its only real &gt; value is against rainbow tables<p>This is dangerously incomplete reasoning. Salts real value is that if multiple password hashes are Leaked simultaneously then each must be cracked individually. In the Adobe leak password hints were included, which allowed for very easy guessing of passwords, and because there were no salts even if you had no hint if someone else had the same password and an obvious hint you were cracked.
评论 #9305329 未加载
mdavidnabout 10 years ago
Salt has one other important property: Salt makes grouping users by password more difficult.<p>Some subset of your users will inevitably use the same terrible password as another user. Or one user will create multiple accounts using the same strong password. These passwords should appear unique in storage.<p>You still need salt, and that salt must be unique for each password. That&#x27;s the peril of PBKDF2 password storage: I&#x27;ve seen applications completely botch salting by using one for all users. Bcrypt and scrypt avoid this common error by salting internally.
评论 #9305051 未加载
djb_hackernewsabout 10 years ago
I&#x27;d be interested to hear more about the approaches a hacker would take in each case if they came across the hashed passwords and have no knowledge of the salts, etc.<p>For instance in the first case where hash = md5(&#x27;deliciously-salty-&#x27; + password)<p>I&#x27;m not sure how easy it is for an attacker to reverse the hash if they don&#x27;t know the salt. (I understand you need to assume the attacker has the salt, but just posing a constrained hypothetical here)
评论 #9305025 未加载
评论 #9305170 未加载
pstratemanabout 10 years ago
&quot;The value of salts is limited to thwarting attacks leveraged pre calculated lookup tables such as rainbow tables.&quot;<p>This is absolute drivel.<p>Salts prevent checking an attempt against all the hashes in parallel.<p>That is to say if the attacker has a dump of 1 million salted hashes, they have 1 million times the work to do compared to 1 million unsalted hashes.
评论 #9307027 未加载
评论 #9307382 未加载
评论 #9307241 未加载
评论 #9307008 未加载
nmcabout 10 years ago
Found the <i>&quot;unnamed blog&quot;</i> post giving the <i>&quot;terrible&quot;</i> salting advice: <a href="http:&#x2F;&#x2F;blog.codinghorror.com&#x2F;rainbow-hash-cracking&#x2F;" rel="nofollow">http:&#x2F;&#x2F;blog.codinghorror.com&#x2F;rainbow-hash-cracking&#x2F;</a>
评论 #9304916 未加载
btillyabout 10 years ago
The need for unique passwords brings me to a stupid idea that I&#x27;ve had for a while.<p>Imagine a service which just stores hashes of every password that it can find from everywhere. Any site that wants can check whether a given password is in use..somewhere..and reject it if it is. Any site that wants can add more passwords to the list.<p>Internally the service would work from a bloom table designed for a fixed false positive rate. (You can actually layer bloom tables in front of bloom tables with parameters to make this possible.) So even if someone compromises that site, there is no direct record of the actual hashes for passwords.<p>Basically let sites say, &quot;You have to choose a unique password, and do not reuse a password that anyone has used elsewhere!&quot;
评论 #9305705 未加载
评论 #9321179 未加载
评论 #9306229 未加载
评论 #9305881 未加载
sarciszewskiabout 10 years ago
I&#x27;ve been saying &quot;scrypt, bcrypt, PBKDF2, or bust&quot; for years.<p>Also, there&#x27;s a large industry trend of, &quot;let&#x27;s &#x27;pepper&#x27; our hashes too!&quot; whereby they have a sitewide salt. This is a mistake. If you want to add a site-specific layer of security to your passwords, encrypting them makes far better sense than adding to the salt.<p><a href="https:&#x2F;&#x2F;github.com&#x2F;lizardhq&#x2F;php_bcrypt_aes" rel="nofollow">https:&#x2F;&#x2F;github.com&#x2F;lizardhq&#x2F;php_bcrypt_aes</a><p><a href="http:&#x2F;&#x2F;blog.ircmaxell.com&#x2F;2015&#x2F;03&#x2F;security-issue-combining-bcrypt-with.html" rel="nofollow">http:&#x2F;&#x2F;blog.ircmaxell.com&#x2F;2015&#x2F;03&#x2F;security-issue-combining-b...</a>
noinsightabout 10 years ago
It&#x27;s not just the scheme that&#x27;s important, it&#x27;s also the implementation of it that&#x27;s important. If I&#x27;m doing the smart thing and not rolling my own crypto, can I trust the existing implementation that I&#x27;ve chosen? It&#x27;s hard to say. Does it have secure defaults or do I need to choose and why do I need to choose, why aren&#x27;t the defaults secure? I&#x27;m not a crypto expert, I&#x27;m not qualified to judge and therefore I don&#x27;t even care (as such) - why aren&#x27;t the defaults secure?<p>For example, I&#x27;m writing an app that requires a password setup in Python so I was investigating this issue:<p>1. Passlib - <a href="https:&#x2F;&#x2F;pythonhosted.org&#x2F;passlib&#x2F;" rel="nofollow">https:&#x2F;&#x2F;pythonhosted.org&#x2F;passlib&#x2F;</a> - &quot;implementations of over 30 password hashing algorithms&quot; - What? I&#x27;m not qualified to judge what&#x27;s secure so I don&#x27;t even care, I just want something secure!<p>2. python bcrypt - <a href="https:&#x2F;&#x2F;pypi.python.org&#x2F;pypi&#x2F;bcrypt&#x2F;1.0.1" rel="nofollow">https:&#x2F;&#x2F;pypi.python.org&#x2F;pypi&#x2F;bcrypt&#x2F;1.0.1</a> - OK standard bcrypt, supposedly that&#x27;s secure - &quot;Author: Donald Stufft&quot; - who is Donald Stufft? Is the code good? I don&#x27;t know C and I&#x27;m not qualified to judge!<p>3. python scrypt - <a href="https:&#x2F;&#x2F;pypi.python.org&#x2F;pypi&#x2F;scrypt&#x2F;" rel="nofollow">https:&#x2F;&#x2F;pypi.python.org&#x2F;pypi&#x2F;scrypt&#x2F;</a> - OK it&#x27;s Colin Percival&#x27;s code, it&#x27;s probably good, &quot;Author: Magnus Hallin&quot; - did Magnus Hallin screw it up though? &quot;Burstaholic on Bitbucket provided the necessary changes to make the library build on Windows.&quot; Eh. Did &quot;Burstaholic&quot; ruin the crypto? Who knows.<p>Also, in my case I needed something cross-platform, primarily for Windows. bcrypt worked out of the box. The scrypt library required building on Windows with OpenSSL development headers or whatever and all that - I just said &quot;pass&quot;.<p>Nacl is fantastic and simple to use, it can&#x27;t get much easier than this: <a href="https:&#x2F;&#x2F;libnacl.readthedocs.org&#x2F;en&#x2F;latest&#x2F;topics&#x2F;public.html" rel="nofollow">https:&#x2F;&#x2F;libnacl.readthedocs.org&#x2F;en&#x2F;latest&#x2F;topics&#x2F;public.html</a><p>Something similar should exist for passwords - I just want to call compare(password, storedhash) or whatever and be done with it, I&#x27;m not qualified to judge the crypto. And it should be cross-platform.
评论 #9307131 未加载
huevingabout 10 years ago
This is missing something pretty important about salts. They hide the fact that two users have the same password. That&#x27;s a huge security risk if that correlation is leaked.<p>Correct me if this is mentioned in the article, but based on several mentions of how salts were effectively useless, I think this was overlooked.
评论 #9304938 未加载
tootieabout 10 years ago
I fail to understand why salting is bad. Seems like he&#x27;s saying it&#x27;s not a cureall. We knew that. But it&#x27;s at least marginally better than not salting and it&#x27;s easy, so why the hell not?
评论 #9305208 未加载
评论 #9305246 未加载
评论 #9305526 未加载
slasausabout 10 years ago
I&#x27;ve recently found out about Diceware and the importance of a strong password [1][2]. Often users choose a really weak password to begin with. I&#x27;ve read [3] that if you have a strong password (like a 7 word Diceware password) even MD4 or MD5 would suffice :O. I&#x27;m really curious if this is true.<p>[1] <a href="http:&#x2F;&#x2F;world.std.com&#x2F;~reinhold&#x2F;diceware.html" rel="nofollow">http:&#x2F;&#x2F;world.std.com&#x2F;~reinhold&#x2F;diceware.html</a><p>[2] <a href="https:&#x2F;&#x2F;firstlook.org&#x2F;theintercept&#x2F;2015&#x2F;03&#x2F;26&#x2F;passphrases-can-memorize-attackers-cant-guess&#x2F;" rel="nofollow">https:&#x2F;&#x2F;firstlook.org&#x2F;theintercept&#x2F;2015&#x2F;03&#x2F;26&#x2F;passphrases-ca...</a><p>[3] <a href="https:&#x2F;&#x2F;github.com&#x2F;freedomofpress&#x2F;securedrop&#x2F;issues&#x2F;180#issuecomment-29760395" rel="nofollow">https:&#x2F;&#x2F;github.com&#x2F;freedomofpress&#x2F;securedrop&#x2F;issues&#x2F;180#issu...</a><p>ps. for those that use bcrypt and want to ensure a constant user experience on their server see <a href="https:&#x2F;&#x2F;www.npmjs.com&#x2F;package&#x2F;bcrypt-speed" rel="nofollow">https:&#x2F;&#x2F;www.npmjs.com&#x2F;package&#x2F;bcrypt-speed</a>
zobzuabout 10 years ago
while we&#x27;re at it and throwing stuff around as if its an easy fix: lets stop using passwords. Use keys. Use a trust model on these keys. So many advantages.. you don&#x27;t receive the cleartext password no more (because really I DONT CARE if you use triplezscrypt.. SINCE YOU GET MY PASSWORD IN CLEAR TEXT during authentication.. its not like if compromises were &quot;on the database&quot;. Its always at the application level.)<p>Beside it makes rotation easier, and not having to remember multiple passwords, or having a password manager, etc. a thing.<p>Oh wait ;) Google and others are actually attempting to make this work with U2F:<p><a href="https:&#x2F;&#x2F;support.google.com&#x2F;accounts&#x2F;answer&#x2F;6103523?hl=en" rel="nofollow">https:&#x2F;&#x2F;support.google.com&#x2F;accounts&#x2F;answer&#x2F;6103523?hl=en</a> (yes it works with gmail. Right. Now.)<p><a href="https:&#x2F;&#x2F;www.yubico.com&#x2F;applications&#x2F;fido&#x2F;" rel="nofollow">https:&#x2F;&#x2F;www.yubico.com&#x2F;applications&#x2F;fido&#x2F;</a>
biotabout 10 years ago
The points made here are covered in Coda Hale&#x27;s post: <a href="http:&#x2F;&#x2F;codahale.com&#x2F;how-to-safely-store-a-password&#x2F;" rel="nofollow">http:&#x2F;&#x2F;codahale.com&#x2F;how-to-safely-store-a-password&#x2F;</a><p>While it recommends using bcrypt, if you augment that with &quot;or scrypt or PBKDF2&quot; the same principles apply.
danbrucabout 10 years ago
There is one thing that I think is often omitted. A <i>lot</i> of user use trivial passwords and they reuse them. These users&#x27; passwords will fall essentially no matter what you do because making the check so slow that a dictionary attack with a couple thousand very common passwords becomes impractical is itself borderline impractical. On the other hand strong passwords will withstand an attack even if they are hashed with plain MD5 or SHA1 - at least right now, there are already some serious collision attacks.<p>The user group really benefiting from strong password hashing schemes is the one between the two mentioned extremes. So if you really want to protect all your users and use simple password authentication you have to enforce strong passwords policies which is itself not trivial and will definitely badly annoy some users.
评论 #9307827 未加载
elchiefabout 10 years ago
Since the author didn&#x27;t bother to mention any threat models, we can assume that the threat is the most common one, SQL Injection.<p>You don&#x27;t need SQL Injection if you can directly read the database file, or can operate as the web server user, therefore if you&#x27;re doing SQL Injection you don&#x27;t have those privileges.<p>If you can HMAC or encrypt passwords (prior to hashing them) in the database with a key only on the web server, then that&#x27;s an extra level of protection. You can&#x27;t get that key with SQL Injection alone.<p><a href="https:&#x2F;&#x2F;blog.mozilla.org&#x2F;webdev&#x2F;2012&#x2F;06&#x2F;08&#x2F;lets-talk-about-password-storage&#x2F;" rel="nofollow">https:&#x2F;&#x2F;blog.mozilla.org&#x2F;webdev&#x2F;2012&#x2F;06&#x2F;08&#x2F;lets-talk-about-p...</a><p>password_hash(base64_encode(hash_hmac(&quot;sha512&quot;, $password, $key, true)), PASSWORD_BCRYPT)
评论 #9306621 未加载
Sami_Lehtinenabout 10 years ago
How about not reusing passwords and always using a strong password? SHA256 alone is enough, when you just do that. And so what if someone got my password. If they had already access to the system, they could have also stolen the data they were after anyway. Today&#x27;s password: .P`éA@O?&#x2F;^2HNVSé%@ÖY it contains more than 256 bits of entropy. Based on this SHA256 collision attacks and cracking AES128 should be trivial. I personally consider passwords to be unique shared secret blobs &#x2F; service.
kpcyrdabout 10 years ago
Password hashing is crypto, too. Don&#x27;t roll your own crypto.
评论 #9305668 未加载
borskiabout 10 years ago
Jeff&#x27;s and Thomas&#x27; posts are totally on the money. We wrote a piece as well, specifically to talk about how encryption and hashing are not the same thing. You&#x27;d be surprised how often people screw that up.<p><a href="https:&#x2F;&#x2F;www.tinfoilsecurity.com&#x2F;blog&#x2F;store-data-securely-encryption-hashing-how-to-guide" rel="nofollow">https:&#x2F;&#x2F;www.tinfoilsecurity.com&#x2F;blog&#x2F;store-data-securely-enc...</a>
DenisMabout 10 years ago
If you are using .NET, you will be glad to know that .NET framework has a standard implementation of PBKDF2, one of the recommended choices in the article.<p><pre><code> var hash = new System.Security.Cryptography.Rfc2898DeriveBytes(password, salt, workfactor).GetBytes(32); </code></pre> Using a NIST-approved function that&#x27;s continuously supported by a large player seems like a good choice.
评论 #9306277 未加载
ghshephardabout 10 years ago
And, as always - these discussions about Salts&#x2F;bcrypt&#x2F;scrypt are only relevant to people where passwords&#x2F;security are important, but not critical.<p>For anybody who has critical security needs, just use an HSM already. Sophos&#x2F;Utimaco makes a nice one, and it is a nice foundation for password security.
seanwilsonabout 10 years ago
How about using a tested login library instead and consider using OAuth as well (e.g. Google account to login)?<p>Rolling your own login system, dealing with hash functions and checking passwords yourself is far too low level and dangerous for most apps (as this thread demonstrates).
kyberiasabout 10 years ago
Urghh... I hate these articles that list bad examples of salt use and then doesn&#x27;t explain the reasoning why exactly these are bad. Just trying to prove to the world how smart the author is. Maybe he doesn&#x27;t really know how to explain it?
k__about 10 years ago
Does this mean we should drop the salts, simply scrypt and be done with it?<p>Or should we still include salts in addition to scrypt?<p>If yes, only one global or many user specific or both?
codahaleabout 10 years ago
Use bcry—ah, fuck it.
xai3luGiabout 10 years ago
Why are we still using passwords in 2015?