14 ms·
I cannot see any obvious weaknesses in this scheme. It seems to address a known pain point in bcrypt (max length), implements a pepper in a secure way (which c
by Someone1234 10y ago
I cannot see any obvious weaknesses in this scheme.
It seems to address a known pain point in bcrypt (max length), implements a pepper in a secure way (which cannot inadvertently degrade security), and is otherwise doing things which are best practices (high work factor, per user salt, etc).
I know peppers remain controversial (some people claim they're pointless, and make a good argument). But ultimately nothing Dropbox is doing with peppers in this article makes your password easier to break, only harder.
I'd call this scheme 10/10.
- daddykotex 10y agoCan you explain a use case where wrong usage of a pepper actually degrade security? (just curious)
- nmc 10y agoAs mentioned by someone else in the thread [0], Dropbox is using pepper with encryption. Many (stupid) people will use it with hashing instead, which means they cannot rotate the pepper without resetting every user's password. Moreover, using pepper will make some (stupider) people do stuff like hash( salt + hash( pepper + password ) ) which is very likely to increase the attack surface. More broadly, since most secure hashing functions were not designed to be used pepper, it forces people to try to come up with their own ways of making it work. They should not: DO NOT roll your own crypto [1]. [0] https://news.ycombinator.com/item?id=12548597 https://news.ycombinator.com/item?id=12548597 [1] https://www.schneier.com/blog/archives/2011/04/schneiers_law.html https://www.schneier.com/blog/archives/2011/04/schneiers_law...
- cellularmitosis 10y agoAre they stupid people, or just uneducated? (Stupid implies they can never correct that behavior)
- singlow 10y agoThe uneducated but not stupid developer would not write her own password storage system.
- arielb1 10y agoWhat's the problem with `H(salt||H(pepper||password))`? If `H` is a good PRF, it should work fine (you want `KDF(salt, H(pepper||password))` to protect against guessing attacks). In any case, if you pepper is exposed and you don't have a good pepper rotation scheme, you are no worse than if you started with no pepper at all.
- Sammi 10y agoWhat wrong with concatenating the pepper with the password, other than it not allowing easy pepper rotation?
- borplk 10y agoNothing
- danbruc 10y agoIf the used hash function is based on the Merkle-Damgård construction, then it is vulnerable to a length extension attack [1]. That means if an attacker knows a hash of the form H(pepper || salt || password), then the attacker can generate more hashes H(pepper || salt || password || password_extension) by only knowing the combined length of pepper, salt and password but without knowing any of the values. That does not help breaking the password but you still have an attack point in your system. Maybe someone makes a really bad decision and decides to reuse the password hash for something it really should not be used. Also note that with this construction you can trivially find collisions for different pepper, salt and password, they just have to yield the same string when concatenated. Okay, but the suggestion was not to just concatenate everything but involved hashing parts before further concatenating and hashing them again. The length extension attack will still apply, you could for example use it on H(pepper || password) in H(salt || H(pepper || password)). Is this useful? Where would you get the length of and a hash for pepper || password from? I don't know but why would you risk that someone figures out how to do and abuse it if there are alternatives? And last but not least constructions like H1(H2(message)) or H1(message) || H2(message) may look innocent but they are not and they may weaken your system. See for example this Cryptography Stack Exchange question [2] or the answer by ircmaxell on this Stack Overflow question [3]. [1] https://en.wikipedia.org/wiki/Length_extension_attack https://en.wikipedia.org/wiki/Length_extension_attack [2] http://crypto.stackexchange.com/questions/270/guarding-against-cryptanalytic-breakthroughs-combining-multiple-hash-functions http://crypto.stackexchange.com/questions/270/guarding-again... [3] http://stackoverflow.com/questions/348109/is-double-hashing-a-password-less-secure-than-just-hashing-it-once http://stackoverflow.com/questions/348109/is-double-hashing-...
- tedunangst 10y agoSo as a couple comments ask, what if you have to rotate the pepper? There's ways to do that, but sometimes people disengage their brains, and by making the whole scheme a little more complicated and a little more difficult to work with, you entice people to cheat. Like storing the plaintext password in a second column for "rehashing" purposes.
- CiPHPerCoder 10y agoIf you encrypt instead of peppering, you just decrypt then re-encrypt with a new key and call it a day. Peppering has always meant, to me, doing something like this: // Hashing $preHash = base64_encode( hash_hmac('sha512', $password, $_ENV['pepper'], true) ); $storedHash = password_hash($preHash, PASSWORD_DEFAULT); // Validation $preHash = base64_encode( hash_hmac('sha512', $password, $_ENV['pepper'], true) ); if (password_verify($preHash, $storedHash)) { // You're in! } To anyone reading this: Don't bother peppering.
- jbrownbridge 10y agoAlternatively you could just encrypt the already encrypted data with the new key.
- CiPHPerCoder 10y agoWouldn't that require you to retain all compromised keys, and daisy chain the encryption operations?
- dsacco 10y agoIt's a good system, especially compared with the current best practice of simply hashing passwords with bcrypt and calling it a day. I can't recall it off the top of my head, but Facebook has a similarly impressive system with more secret sauce involved for performance at scale. I believe what they do is the following: 1. Hash the password with MD5(password). 2. Generate a 20-byte (160-bit) random salt (this is well over the 64 bits you'd need to defend against birthday attack collisions). 3. Hash with hmac_sha1(hash, salt). 4. Send this value to a separate server for further operations (mitigates offline brute-forcing). 5. Hash in a secret key with hmac_256(hash, secret). Note this operation is on a separate server. The secret key might be colloquially termed a "pepper". 6. Hash with scrypt(hash, salt) to make local computation slower. 7. Shrink the final value with hmac_256(hash, salt) for efficient database storage. If any Facebook engineers are around, please correct me if I've missed or misinterpreted any part of that.
- amenghra 10y agoIt's a chain of hash because that's how passwords were migrated from being stored unsalted, to salted, to scrypted. People sometimes complain that migrating passwords is a pain, but if you wrap the older scheme with a newer hash* it kind of works out. Today, I would consider argon2 which came out of PHC. * you need to carefully study the security properties of the combined hash.
- dsacco 10y ago>> It's a chain of hash because that's how passwords were migrated from being stored unsalted, to salted, to scrypted. I kind of figured that, thanks for confirming :). Personally I wouldn't consider Argon2 yet for production, but only because I'd like to see it run at scale for a few years. PHC or not, I'm hoping it becomes more battle-tested in production use. That said, I'd fully respect any team for using Argon2 and have no personal qualms with it.
- user5994461 10y agoArgon2i and argon2d => bad idea to use that in production (and yes, the researchers made two different algorithms with the same name)
- benhoyt 10y agoThe "obvious weakness" is the non-technical part of this: you can sign up to Dropbox (and most services for that matter) with an extremely weak password. I just signed up with a dummy email address and a password of "password". :-) If you look through password lists that have leaked online, the most common passwords are very easily guessable. Anyway, not trying to dismiss their efforts here -- they're good. But this is only half of the equation.
- RussianCow 10y agoI go back and forth on this, but ultimately, anyone using "password" or "123456" as their password should expect their account to get broken into at some point. Honestly, I've never met anyone that uses passwords that weak for anything they actually care about, even completely non-technical folks.
- perfectfire 10y agoProof that they're not pointless: The adobe password leak. Other than the giant crossword puzzle[0] created by the password hints combined with their choice of ECB mode to encrypt the passwords that allowed people to infer blocks of passwords, I haven't been able to find any evidence that the encryption key was leaked or guessed. So, most of the passwords were never discovered. I'm betting their key was a full 168 bit random value that was immediately deleted when the leak came to light, so it's likely that value will never exist again in this universe. Compare that to something like LinkedIn (SHA1) where enthusiasts have cracked almost 97% of the passwords in that leak. How many more have blackhats cracked? I certainly wouldn't rely on symmetric encryption alone to store passwords. If the password leaks, you expose all passwords in mere seconds. Plus you can see your user's plaintext passwords (since you have the key), which you should not be able to do. But as an extra measure symmetric encryption has already proven itself to be useful. [0] https://xkcd.com/1286/ https://xkcd.com/1286/
- novaleaf 10y agoGlad to know that my self-designed system pretty much matches this "10/10" scheme :) the only difference I do, is I perform the Sha512 hash client-side, so that the user's plain-text password isn't sent to my servers. Any thoughts on that?
- mason55 10y agoYou wouldn't be able to enforce password rules. I could send my own hash of a password that wouldn't meet your password policy and you'd never know.
- novaleaf 10y agopassword rules are enforced client-side too. You are right that a determined person could circumvent the client-side validation, but my thinking is that if someone really wants to do this, it doesnt really hurt me any. FYI I also do recaptcha for signup+resetpw.
- vmasto 10y ago> it doesn't really hurt me any This is the unsafe mentality of "roll your own" and it's always a bad idea. There's a reason why we have to practically blindly follow the best practices; the attack vectors are so diverse we cannot predict them. How would you handle 3rd party phishing schemes attempting to register users with weak passwords for example?
- novaleaf 10y agoAs I said, I use recaptcha to prevent bots, which would also include preventing phishing. Ultimately, if you are writing A SaaS you have to roll your own at some point, but I agree it shouldn't include things like key derivation functions. Maybe I'm dense, but I just don't see how enforcing password strength on both the client and server is making me safer from hackers.