News for hackers. Stuff that matters.
Re:Most “mandatory requirements” in corporations are imaginary by thaumasiotes on Wednesday August 19, 2020 @02:03PM (#24213719)
> I was faced with a password "security policy" that pretty much only whitelisted SHA2 + salting for password hashing. We were using a time-hard (not memory-hard though) password hashing function instead and several levels of auditors were effectively asking us to downgrade to comply with their policy without even understanding the difference.

You can comply without downgrading by just applying the SHA2 hash after your time-hard hash.

Re:Most “mandatory requirements” in corporations are imaginary by the8472 on Wednesday August 19, 2020 @02:22PM (#24214008)
That's possible but it would mean unnecessarily changing security-critical code. I'd again have to make sure to use constant-time comparisons of the different output, migrate the existing data or require users to reset their passwords and so on. All to tick a box.

Ultimately we pretty much did that, switched to scrypt which is based on sha2 and pointed to the standard saying it's sha2-based. But that does not change the fact that the policy imposes incorrect requirements on teams. SHA2 is not appropriate for password hashing.

Re:Most “mandatory requirements” in corporations are imaginary by thaumasiotes on Wednesday August 19, 2020 @03:35PM (#24215157)
> I'd again have to make sure to use constant-time comparisons of the different output

Why? What would this mean? You have a flow like this:

1. User sends "password".

2. Time-hard hash processes "password" into some hex value, HASHT. No comparison is done.

3. SHA2 processes HASHT into some other hex value, SHAHASH. You compare SHAHASH to the user's stored hashed password.

But even in step 3, you don't need constant-time comparisons. What purpose would they serve?

Assume the attacker knows your full hashing algorithm -- they can compute SHAHASH for any input password. (Maybe your salt is equal to the username, say.) That's enough to use a standard timing attack against early-abort comparison to learn the first byte (or other comparison unit) of SHAHASH.

But to learn the second byte, you need to provide a large number of hashes which all have the correct first byte. This can't be done. (It can, but you'll have to generate around 256 times as many hashes as you can use.) To learn the third byte, you need to provide a large number of hashes which all have the correct first two bytes. This is even more impossible. (In fact, you may recognize this problem as being the proof-of-work that Bitcoin requires.) The whole point of using a cryptographic hash in the first place is that we can't predict the outcome of a hash! Constant-time comparisons are something you need when you're comparing an attacker-controlled value to a secret value, but that never occurs here.

Re:Most “mandatory requirements” in corporations are imaginary by the8472 on Wednesday August 19, 2020 @05:52PM (#24217137)
Perhaps I was thinking of verifying API tokens. But see, I made a mistake while reasoning about security code. Don't make me do that more often than necessary, one day it'll go wrong.