Don’t Hash Secrets (2008)
benlog.com
benlog.com
Actually, it's underkill. HMAC is too easy to crack to be used as a password hashing scheme.
http://security.stackexchange.com/questions/16809/is-a-hmac-...
http://security.stackexchange.com/questions/3165/hmac-why-no...
(I was actually more worried about cryptanalytic attacks - the construction itself is obviously secure when instantiated with a random oracle - but I don't really see how that would work either. I maintain that it's ugly, but HMAC isn't the nicest construction in the world either, I suppose...)
Hell, you could take the 'use bcrypt' meme out of context and you'd be fine.
HMACs have their use case, and it's good to use them for that, but honestly it's a tiny corner of the possibilities for "hashing secrets", and an effective approximation (hash(message + hash(secret)), as mentioned towards the end of the article) is the obvious approach if you have any idea how hashes work, and just as effective as a dedicated HMAC.
If I understood correctly sha1(sha1(secret) + message) is not safe, because from that hash you can calculate sha1(sha1(secret) + message + ANYTHING)
What? When you see a sign by the pool that says "Don't Run" do you get down on your belly and start crawling? Some assumptions are safe to make -- e.g. most people who care enough to read this know not to send secrets in the clear.
Yeah, a better title would be "Don't just hash secrets."
But it's wrong about the database password storage. These days the real threat there is the monstrous computing power available to compute tons of hashes simultaneously. To combat that, you want a hashing function specifically designed to be slow. And not just slow, but to have a tunable parameter so you can require more and more work as GPUs get faster and cheaper. PBKDF2 is such a function, and is used by Django as of a year or two ago. bcrypt is another.
This usually means "use whatever is in OpenSSL, Keyczar, etc", that's what it's for.
"A component can only be secure under certain well-defined circumstances, not for any use that happens to look similar."
What does "plain" mean in this context? (If you mean ECB then you are right, but it is ambiguous.)
There is another important aspect to salting that he neglects to say. Adding an 8byte salt is extremely effective (along with a proper password hashing algorithm) in increasing the complexity of generating and storing rainbow tables. PBKDF2 and bcrypt are both slow enough to protect a lot of that low hanging fruit that he is saying ISN'T protected....Sure if you use SHA1....they might get some of them....but everyone agrees you should not be using SHA1 ! (for passwords).
This is simply wrong. Padding of cryptographic hash functions protect against this behavior.
But doesn't the attacker only need to rebuild the dictionary once, using the salt they recovered?
Because each salt is ~unique, the attacker must rebuild a separate dictionary for every single stored secret. That's functionally the same as having no dictionary, at all.