News for hackers. Stuff that matters.
Re:Yahoo discloses hack of 1B accounts by sk5t on Wednesday December 14, 2016 @08:28PM (#13181541)
It sort of does matter for bcrypt, surprisingly: http://security.stackexchange.com/questions/39849/does-bcryp...

In the interests of hewing closest to cryptographic reality, I design not to allow a password longer than the algorithm can usefully use.

Re:Yahoo discloses hack of 1B accounts by dlubarov on Wednesday December 14, 2016 @09:23PM (#13181829)
I think it's best to allow longer passwords for those who use long phrases. It's easier to remember the full phrase than a truncated version. You could show a warning that the extra chars beyond 50-55 will be ignored.
Re:Yahoo discloses hack of 1B accounts by kijin on Thursday December 15, 2016 @12:02AM (#13182564)
Or you could SHA256 the original password and feed the hash to bcrypt. Remember to use the 64-byte hexadecimal hash, not the 32-byte binary because bcrypt chokes on null bytes.

Everyone's been saying "just use bcrypt", but bcrypt has too many gotchas to be the default choice. We really need to work on getting scrypt and argon2 into the most popular programming languages and frameworks a.s.a.p.

Re:Yahoo discloses hack of 1B accounts by blowski on Thursday December 15, 2016 @04:29AM (#13183432)
> Everyone's been saying "just use bcrypt", but bcrypt has too many gotchas to be the default choice

This has got to be the underlying problem of modern security. By the time a best practice is well known, it's no longer best practice.

Re:Yahoo discloses hack of 1B accounts by dajohnson89 on Thursday December 15, 2016 @10:14AM (#13185094)
I think that's a good observation. The implication seems to be that we're not iterating fast enough, or not sufficiently fast in implementing changes/improvements.

On the flipside, isn't there a risk of moving too quickly? There's a certain culture of caution because there's something to be said for "if it aint broke, don't fix it." and even if something is broke, how certain are we that cool new encryption algorithm is better or safer?

Re:Yahoo discloses hack of 1B accounts by kaeluka on Friday December 16, 2016 @03:52AM (#13191974)
Like nutrition!
Re:Yahoo discloses hack of 1B accounts by paulmd on Thursday December 15, 2016 @11:50AM (#13185940)
You would probably want to use PBKDF2 as a key-stretching function rather than just naive SHA256. Otherwise you're clipping your bcrypt input from "56 arbitrary bytes" down to "56 hexadecimal characters".

I haven't looked deeply at this, but using "key stretching" that clips your output characters to such a small space smells very suspect to me.

Remember: there is only 32 bytes of actual output there, regardless of whether you represent it as hex or binary. And since bcrypt can't take more than 56 bytes of input, you are clipping that down to the equivalent of 23 bytes.

Re:Yahoo discloses hack of 1B accounts by bschwindHN on Thursday December 15, 2016 @02:15AM (#13183014)
Is "just use scrypt" an acceptable answer then? I'm not a security expert and I don't know the advantages of one over the other.
Re:Yahoo discloses hack of 1B accounts by amenghra on Thursday December 15, 2016 @04:08AM (#13183375)
Yes, scrypt is a perfectly fine password hash.

If you are currently using something else (say salted md5 or even just plain md5), you can migrate your passwords to scrpyt(current_hash()) without having to change everyone's password and/or wait for everyone to log in.

See also this comment thread: https://news.ycombinator.com/item?id=12549110

Re:Yahoo discloses hack of 1B accounts by aaronbasssett on Thursday December 15, 2016 @05:16AM (#13183594)
Don't do that. You've essentially just turned the old hashes into plain-text passwords, and how sure are you that those hashes don't exist in backups anywhere?
Re:Yahoo discloses hack of 1B accounts by rietta on Thursday December 15, 2016 @08:34AM (#13184437)
No, not exactly. An adversary who has the old hash, but not the plaintext that it represents cannot login because scrypt(H(H(value))) != scrypt(H(value)). This is not considering the offline crackability of a compromised hash. But there are legitimate situations where upgrading the password backing to a modern slow hash is preferable to continuing to use the old hash or worse storing the old hash as a field for a long time so that when a breach happens both the new and old hashes are available.

There are user experience battles when talking about forcing a million users to change their passwords in a real system. Hashing the hash may be vastly preferable to management nixing the security upgrade. A password updating schema that changes the hash as users login and eventually locking the accounts of users who have not logged in for an extended period of time can accomplish rolling the hashes without having to tell users to change their passwords.

Re:Yahoo discloses hack of 1B accounts by StavrosK on Thursday December 15, 2016 @06:34AM (#13183885)
Not if you mark the converted versions and try scrypt(oldhash()) on users authenticating with them.
Re:Yahoo discloses hack of 1B accounts by fractal618 on Thursday December 15, 2016 @06:37AM (#13183892)
Woah! Very good point!
Re:Yahoo discloses hack of 1B accounts by kijin on Thursday December 15, 2016 @05:33AM (#13183649)
scrypt is okay if you use it correctly. It's too easy to use it incorrectly, though, because scrypt is a low-level algorithm that wasn't specifically designed for password storage. [1]

http://blog.ircmaxell.com/2014/03/why-i-dont-recommend-scryp...

In order to be able to tell people to "just use scrypt", we would need to have a sort of standard wrapper that uses the correct parameters by default and produces identical results in every common programming language.

Re:Yahoo discloses hack of 1B accounts by zeveb on Thursday December 15, 2016 @04:32AM (#13183450)
> You could show a warning that the extra chars beyond 50-55 will be ignored.

Or you could use a better KDF, e.g. scrypt (even PBKDF2 is better on this metric). Artificial password-length restrictions are symptomatic of poor design.

Re:Yahoo discloses hack of 1B accounts by baby on Wednesday December 14, 2016 @09:54PM (#13181993)
This is surprising, do you know how Argon2 behaves compared to this?
Re:Yahoo discloses hack of 1B accounts by pjscott on Wednesday December 14, 2016 @11:59PM (#13182554)
Argon2 does the right thing. No silly upper bounds.
Re:Yahoo discloses hack of 1B accounts by KMag on Thursday December 15, 2016 @09:34AM (#13184766)
That depends on how silly you consider 2^32 - 1 bytes, if I recall correctly.
Re:Yahoo discloses hack of 1B accounts by Dylan16807 on Thursday December 15, 2016 @06:43AM (#13183918)
That's just a bug. Truncation invalidates the 'stored properly' part of the statement.
Re:Yahoo discloses hack of 1B accounts by mannykannot on Thursday December 15, 2016 @07:30AM (#13184112)
Could you expand on that? I did not think bcrypt was responsible for storing the resultant hash. The limit appears to be in calculating the hash.
Re:Yahoo discloses hack of 1B accounts by Dylan16807 on Thursday December 15, 2016 @02:09PM (#13187221)
The original phrasing was "stored properly, (i.e. bcrypt)". That's including the hashing as part of the 'storing'. Bcrypt has a size limit, but a size limit is not the same thing as truncating. It's broken code on the front end that truncates instead of doing something like sha512.
Re:Yahoo discloses hack of 1B accounts by sk5t on Thursday December 15, 2016 @11:06AM (#13185508)
Bcrypt spits out a string, that the caller must store, somewhere. I presume the parent post means that Bcrypt "stores" in its output string a value that, for all practical purposes, varies reliably with the same salt but different plaintext.