News for hackers. Stuff that matters.
Re:Blake3 is 10 times faster than SHA-2 by nolok on Saturday January 11, 2020 @05:27PM (#22022815)
> tune it so it’s slow enough without impacting overall usability (e.g. takes 50ms on your server)

I want to insist that this is a very important part. If you are 99.9% of applications or websites out there, the only time you need to run that hash is at registration, login and password change. All of these case will be fine if it's a bit slow. Don't lowball it.

Also informationally I would like to add that as part of their "meant to be slow" job, algorithm like bcrypt are built in a way that makes it extremely hard if not impossible to run on cheap massively parallelized hardware (eg: CUDA on GPU).

Re:Blake3 is 10 times faster than SHA-2 by kragen on Saturday January 11, 2020 @05:36PM (#22022865)
Also you can do the stretching in the browser client (“server relief”) without losing security. Historically this would have meant a big performance penalty (and thus an advantage for attackers, who don't need to use your code) but JS and wasm are fast enough now that the price is fairly low.
Re:Blake3 is 10 times faster than SHA-2 by nneonneo on Saturday January 11, 2020 @07:12PM (#22023409)
If you’re going to do this, make sure you still hash the client’s hash output on the server (you can use SHA-2 in this case since the client’s hash output will effectively be high-entropy if salted). Otherwise you will be vulnerable to a “pass the hash” attack where an attacker in possession of your stored password hashes simply passes the hash to login.
Re:Blake3 is 10 times faster than SHA-2 by jaytaylor on Saturday January 11, 2020 @07:48PM (#22023567)
I didn't think hashing the hash would be helpful here, and couldn't think of a way to mitigate against this attack.

After reading more it seems the only mitigation is Layers of Security.

https://en.m.wikipedia.org/wiki/Pass_the_hash#Mitigations

Re:Blake3 is 10 times faster than SHA-2 by kragen on Saturday January 11, 2020 @08:17PM (#22023735)
No, hashing the hash solves the problem.
Re:Blake3 is 10 times faster than SHA-2 by lisper on Saturday January 11, 2020 @09:50PM (#22024136)
It's important to understand why this is so: it's because the hash is big, so while it might be possible to mount a brute force preimage attack against a password, it is not practical to do so against a hash. So hashing a hash (once) is secure even though hashing a password (once) isn't.
Re:Blake3 is 10 times faster than SHA-2 by throwaway838475 on Saturday January 11, 2020 @11:38PM (#22024510)
Almost. That construction is still vulnerable to chosen input attacks without inner and outer padding, which is basically rediscovering HMAC, which also isn’t suitable for storing passwords. Don’t roll your own crypto if you don’t know what you’re doing. Use a PBKDF like argon2, scrypt, bcrypt or PBKDF2 as they are intended because they are far, far stronger than hashing a couple of times.
Re:Blake3 is 10 times faster than SHA-2 by nneonneo on Sunday January 12, 2020 @12:05AM (#22024596)
I believe what we’re discussing is having a client compute a PBKDF of the password, and then having the server hash the PBKDF output one more time to obtain the thing that’s actually inserted into the database. The idea is that if the database leaks, the attacker gets H(PBKDF(password)) which is hard to bruteforce due to the PBKDF, and can’t be used directly as a login token because of the extra H(). I don’t see where this would be subject to a chosen input attack.
Re:Blake3 is 10 times faster than SHA-2 by jaytaylor on Saturday January 11, 2020 @08:33PM (#22023806)
I see, clever. Thanks!
Re:Blake3 is 10 times faster than SHA-2 by zahllos on Sunday January 12, 2020 @03:30AM (#22025191)
It's not server relief, but there's also a technique called delegated hashing, i.e. allowing the client to do part of the work of computing the actual hash. This was one of the main selling points of the Makwa candidate for the password hashing competition.

It did not win, and I believe it is only CPU hard and not also memory hard unlike argon2. Nevertheless techniques to do this have been explored academically and might make it into future designs.

In case it isn't obvious, please continue to use argon2 (I'm just mentioning this as a point of interest).

Re:Blake3 is 10 times faster than SHA-2 by zxcmx on Sunday January 12, 2020 @05:21AM (#22025538)
Lots of advice in these threads and no one has mentioned anchoring yet so I'll staple it here; if you're a big company who can afford an HSM and the overhead of the key ceremony stuff to manage it (managed stuff like AWS cloud HSM simplifies this a fair bit) a great option is using an HSM as an anchored one-way function.

For whatever reason this seems to be seldom discussed but the general idea is as follows in hand-wavey fashion:

Set up HSM with a non-exportable symmetric key, set key usages to "encrypt only" and as one step of the hashing scheme you use, encrypt your hash through the HSM. Protected HMAC key would work too.

The result is that an attacker who compromises your password db cannot perform offline attacks on your passwords anymore - they now need to do key extraction on your HSM or remain in your infrastructure and keep running guesses through the HSM where it is relatively easy to monitor what is going on and they can't do a bajillion operations per second anymore.

Wish everyone running large user dbs like yahoo or linkedin etc applied anchoring to their password hashing - it's a relatively simple measure for an org "at scale" to make hash dumps alone useless.

Re:Blake3 is 10 times faster than SHA-2 by zahllos on Wednesday January 15, 2020 @06:20PM (#22059941)
Fair warning, mine isn't advice, just a comment about a technique that requires experienced cryptographers to use. I wouldn't attempt to use it myself :)
Re:Blake3 is 10 times faster than SHA-2 by tgb on Saturday January 11, 2020 @05:56PM (#22022973)
Can you elaborate? This doesn't sound right to me but I don't know much about this.
Re:Blake3 is 10 times faster than SHA-2 by kragen on Saturday January 11, 2020 @06:19PM (#22023129)
It is indeed surprising; it took me a long time to be sure it was safe. Google “server relief”.
Re:Blake3 is 10 times faster than SHA-2 by jaytaylor on Saturday January 11, 2020 @08:07PM (#22023667)
Re:Blake3 is 10 times faster than SHA-2 by pitaj on Saturday January 11, 2020 @09:01PM (#22023931)
That is pretty interesting, but doesn't actually offer up a solution that provides server relief, unless I missed something. In every case they still require that HSrv be a slow hash function.
Re:Blake3 is 10 times faster than SHA-2 by jaytaylor on Saturday January 11, 2020 @09:07PM (#22023954)
My take away was that the server relief comes from reducing the ability of clients to trigger disproportionate amounts of server resource consumption.
Re:Blake3 is 10 times faster than SHA-2 by nneonneo on Saturday January 11, 2020 @10:59PM (#22024371)
I don’t see how that follows. If HSrv is expensive or slow, a malicious client could just submit nonsense hashes that only look like they might have come from HCli - the server shouldn’t be able to tell the difference.

Requiring client-side JavaScript for your login system seems fraught. I would much rather have an approach that does server side hashing exclusively, but gates it behind some kind of DDoS protection or rate-limiting.

Re:Blake3 is 10 times faster than SHA-2 by pnako on Saturday January 11, 2020 @11:39PM (#22024514)
You do the slow (bcrypt, argon2 or whatever) hash in the browser, and then the server can do the hyper-fast hash (SHA256).

You can still flood the server, but you're flooding it with things that take microseconds to compute, instead of 50ms.

Re:Blake3 is 10 times faster than SHA-2 by tgb on Sunday January 12, 2020 @02:45PM (#22028704)
That's not what the article states, though it's not very explicit about why you shouldn't do what you suggest.
Re:Blake3 is 10 times faster than SHA-2 by CalmStorm on Sunday January 12, 2020 @01:29AM (#22024834)
But you also need to be careful. The slow password hashing can be exploited for Denial of Service attack. You may want to rate-limit the APIs that use the hash algorithm.