News for hackers. Stuff that matters.
Re:"YOLO" is not a valid hash construction by tptacek on Saturday August 24, 2024 @04:17PM (#41341172)
This is a good post, but there's a little too much ritual in here about password-based KDFs for my taste. Put all the mainstream KDFs on a dartboard, yes including PBKDF2, and throw a dart. I think you'll be fine. Bcrypt, the most popular password hash, has held up surprisingly well, and scrypt might still be one of the best options.
Re:"YOLO" is not a valid hash construction by Aachen on Saturday August 24, 2024 @06:07PM (#41342092)
Still a difference between "you'll be fine" and "if you're newly choosing, might as well not pick PBKDF2 where anyone with a regular GPU gets a 100x speedup compared to your server CPU". Bcrypt wasn't even designed for memory hardness but is so much more annoying to crack because it seems to stress (per my understanding) the GPU's memory bus just enough with the iirc 4k state table that's being randomly accessed
Re:"YOLO" is not a valid hash construction by layer8 on Saturday August 24, 2024 @06:17PM (#41342174)
In the browser, PBKDF2 can still make sense, because all modern browsers support it via SubtleCrypto.deriveKey(), and you may want to avoid the overhead of a JS-implemented alternative. Just select the maximum iteration count that is still acceptable for your use case and targeted devices (mobile devices tend to be the slowest).
Re:"YOLO" is not a valid hash construction by Aachen on Saturday August 24, 2024 @06:22PM (#41342210)
Very true. May make sense to check how WASM implementations stack up, though. Makes me realise I don't even know if WASM does multithreading; maybe via background workers?
Re:"YOLO" is not a valid hash construction by Vecr on Saturday August 24, 2024 @04:59PM (#41341458)
There's no point intentionally making your implementation weaker than it has to be.
Re:"YOLO" is not a valid hash construction by delusional on Saturday August 24, 2024 @05:33PM (#41341730)
The complement is also true. There's no point in making it stronger than it has to be.

If I have this box that says Bcrypt, but scrypt might be better. I can either spend a bunch of time re-implementing scrypt, or I can shove Bcrypt into there and move on. If Bcrypt is sufficient, then I don't really care if scrypt would be "better"

Re:"YOLO" is not a valid hash construction by Vecr on Saturday August 24, 2024 @05:45PM (#41341850)
I think tptacek is talking about a ground-up design, in that case I think you should use Argon2id. Using something weaker is not really needed, turn the parallelism down to 1 and then start reducing the rounds and memory until it works for your case.
Re:"YOLO" is not a valid hash construction by Aachen on Saturday August 24, 2024 @06:13PM (#41342145)
The LUKS2 source code mentions there is an attack on Argon2 which they prevent by setting rounds to 2 or 4 iirc. Not sure what that's about though, would need to look it up again but perhaps heed the recommended settings to avoid such pitfalls

As for parallelism=1, why would you do that? My understanding is that you want it to a point where it'll saturate your memory bus because then you're getting the most out of your system -> making it the hardest for the attacker. (Pretty sure this takes more than one thread on a modern system because I've tested that argon2id with the same number of rounds and memory gets faster with more threads.) Beyond that, increasing memory usage is good because that dominates the die space of an ASIC which in turn dominates the cost, if I remember and understood the argon2 paper correctly. The repetitions value is the last thing to touch, namely when you've run out of threads and usable RAM (such as when it gets into DoS territory)

(I focus on argon2 because that's what I've read up on. Scrypt is also a good option but I'm not sure the same advice applies because it has this TMTO attack. The underlying concepts will be the same of course, but tweaking one parameter before another may play into the attacker's hand.)

Re:"YOLO" is not a valid hash construction by Vecr on Saturday August 24, 2024 @06:42PM (#41342388)
No. The parallelism is an upper bound, higher reduces security. If you're running a server for multiple clients each client should only get one thread for argon2 anyway, more won't help your overall throughput.
Re:"YOLO" is not a valid hash construction by Aachen on Saturday August 24, 2024 @08:49PM (#41343328)
I'm not understanding the why behind that claim
Re:"YOLO" is not a valid hash construction by Vecr on Saturday August 24, 2024 @10:13PM (#41343761)
It's been a while, I thought it was something to do with the blocks but it probably depends on what the exact state of the art is for cracking at this point.

Don't put it any higher than 4, that's for sure.

In theory a parallelism on 1 should make it so the information required to do the next step has to be computed linearly (think of the dependency graph, it should look like a line instead of diverging then converging) but it's possible that either never worked or got cracked.

Re:"YOLO" is not a valid hash construction by rstuart4133 on Sunday August 25, 2024 @03:53AM (#41345349)
PBKDF2 makes it harder by using more ALU related functions to calculate the key. The problem is ALU's are rather easy to add to a chip, which means it is relatively easy to increase parallelism. ALU parallelism is I'm guessing what you are thinking of.

The others target other constraints, with varying degrees of success. Scrypt for example targets the connection between the CPU chip and DRAM. It doesn't use a lot of CPU time, but rather jumps in a very random way over a whole pile of memory. So adding ALU's doesn't help you crack scrypt. You have to increase memory bandwidth. How fast you can access memory is effectively limited by the numbers of pins you can put on a die, and the number of pins is far harder to increase that the number of ALU's.

So the answer is yes parallelism always helps, but if you chose the things that constrains you to stuff that is hard to add (like pins) adding that parallelism is hard.

Re:"YOLO" is not a valid hash construction by tptacek on Saturday August 24, 2024 @06:06PM (#41342084)
I would probably still reach for scrypt.
Re:"YOLO" is not a valid hash construction by vintermann on Saturday August 24, 2024 @05:55PM (#41341973)
Yes, it was conspicuous to me that for the two other examples, they mentioned "this has been used in a real attack!", but for key derivation functions, they didn't say that.

Sure, you should still use Argon2.

Re:"YOLO" is not a valid hash construction by FreakLegion on Saturday August 24, 2024 @06:14PM (#41342154)
I'd draw a line at the post's NIST-adjacent advice.

With the caveat that I may be up to two years out of date here: Last I checked Balloon was a bad choice (only a research implementation) and Argon2 didn't meet the requirements (unapproved primitive in BLAKE2).

With enough rigamarole can you get these into a government office? Probably. But scrypt and yescrypt (the default on most Linux systems) already fit the bill, so just use one of those.

Re:"YOLO" is not a valid hash construction by tptacek on Saturday August 24, 2024 @07:43PM (#41342901)
I have a really hard time taking the attack research on password KDFs all that seriously. I don't think there are many common threat models where "weaknesses" in password hashes are more than marginal issues.

Not using a real password KDF is a big issue. Using the wrong one, not so much.

Re:"YOLO" is not a valid hash construction by FreakLegion on Saturday August 24, 2024 @09:21PM (#41343496)
I don't disagree at all. My comment is about paperwork and selling to the government ("operating in the FIPS world", as the post has it, where NIST enters the conversation). I'm sure you can get away with tacking PBKDF2 onto Argon2 here, but those are hoops you don't need to jump through.