News for hackers. Stuff that matters.
Re:Opensubtitles.org breached – Email addresses, IP addresse... by Aissen on Wednesday January 19, 2022 @06:33AM (#29992372)
A tip I learned recently: if you see a database with a simple hash with no salt(md5, sha256…) like this, and you want to migrate to a secure password hashing function (bcrypt, argon2…) you don't need to wait for the users to re-login: simply do bcrypt(md5(password)) immediately, and delete the old hashes, and you get higher security.
Re:Opensubtitles.org breached – Email addresses, IP addresse... by dabeledo on Wednesday January 19, 2022 @06:55AM (#29992514)
> simply do bcrypt(md5(password))

This could also be problematic.

Password Shucking https://www.youtube.com/watch?v=OQD3qDYMyYQ

Re:Opensubtitles.org breached – Email addresses, IP addresse... by marcosdumay on Wednesday January 19, 2022 @09:50AM (#29994265)
Ok, some text with a 3 lines explanation of the attack, instead of a 45 minutes video where it's explained somewhere in less than a second:

https://security.stackexchange.com/questions/234794/is-bcryp...

Re:Opensubtitles.org breached – Email addresses, IP addresse... by Shamii on Wednesday January 19, 2022 @07:45AM (#29992883)
It can be a good migration strategy. Just make sure to fix it in first next Login of a user.

Still much better to have md5 directly in your db.

I fixed something like this just 4 years ago. :|

Re:Opensubtitles.org breached – Email addresses, IP addresse... by mpeg on Wednesday January 19, 2022 @07:11AM (#29992632)
Honestly, not as a big a deal as some people make it.

First off, you'd have to assume the attacker knows the bcrypt hashes are bcrypt(md5(password)) – an attacker wouldn't always know this

Also it assumes there is password reuse, but that the password is strong enough that the md5 is uncracked.

Re:Opensubtitles.org breached – Email addresses, IP addresse... by Perseids on Wednesday January 19, 2022 @10:38AM (#29994966)
I'm also not quite sure about the circumstances where that would be relevant, but on the StackExchange a sibling comment found there is this further explanation:

> > I know I'm probably stupid but... how is this different from a dictionary attack? Instead of trying a list of known passwords, you try their md5s. If the md5 hasn't been cracked before, chances are that the password is strong enough to resist being cracked now. – nobody Jul 17 '20 at 14:55

> Because there are plenty of MD5s in the wild that A) just happen to not have been cracked yet because they weren't interesting enough to stand out, but B) once an attacker can figure out that that MD5 is inside a really interesting, high-value-target bcrypt, they might spend a lot more effort to crack that MD5. So it's not just a dictionary attack; it's a dictionary attack of passwords that are currently unknown but might be crackable with additional effort. And that effort is much less than trying to crack that password if it was only inside a pure bcrypt. – Royce Williams Jul 17 '20 at 15:00

https://security.stackexchange.com/questions/234794/is-bcryp...

So the assumption is: There is a breach A of an low-interest target with MD5 hashes and a breach B of a high-interest target with BCrypt(MD5) hashes. As A is not interesting enough, people don't invest the time to crack A's MD5s. But as B is super interesting they will use A as a dictionary source to then know on which MD5s they should invest a high amount of time, as it will help them crack the high-interest target B. Note that no specific user association takes place, like in the presentation about password shucking by Sam Croley (above Youtube link), where usernames/emails of A and B are correlated.

I think this is a bit more plausible than Croley's take on it. Because if I have identified a high interest individual, I would already invest a lot time to crack the MD5 password.

And yes, what you said bears repeating: All of this attack lives in the small space where the password is too strong to be cracked from a simple MD5 hash when you are mildly interested but not strong enough to prevent cracking when you are deeply interested – for varying degrees of mildly and deeply interested. Overall I would like to read about real world examples where this made the difference and how that password happened to fall into that region.

Re:Opensubtitles.org breached – Email addresses, IP addresse... by Aissen on Wednesday January 19, 2022 @08:54AM (#29993621)
Thanks for sharing this, TIL.

It's a very interesting attack, highly specific to the high-number of breaches, high password reuse environment we're in that enables at-scale password cracking.

I don't think it invalidates this advice completely. You should watch the talk and eventually add a global pepper (assuming it does not leak), and of course do the final bcrypt(md5(pass)) -> bcrypt(pass) migration upon user login.

Re:Opensubtitles.org breached – Email addresses, IP addresse... by kobalsky on Wednesday January 19, 2022 @12:04PM (#29996366)
I wonder if adding a random salt for each account would help in that situation?.

bcrypt(md5(password) + salt) + salt

the problem with password shucking would be that they just do a bcrypt(md5) over the list of md5 hashes they have and check if they exist in your database.

but if each hash is salted they would need to run every their complete md5 hash list through bcrypt for each account instead of once per database.

Re:Opensubtitles.org breached – Email addresses, IP addresse... by Aissen on Thursday January 20, 2022 @03:43AM (#30006387)
No that wouldn't help because you'd need to store the random salt along the hashes. So you can still do: bcrypt(other_leaked_md5 + salt) to shuck it (i.e confirm if both are the same, and skip the bcrypt on your stronger service). The defense is a global "pepper" that would be in the code but not the DB, assuming only the second one leaks.
Re:Opensubtitles.org breached – Email addresses, IP addresse... by asddubs on Wednesday January 19, 2022 @06:58AM (#29992546)
for md5, you could also download some common password lists and rehash at least the ones you can "crack"
Re:Opensubtitles.org breached – Email addresses, IP addresse... by fps-hero on Wednesday January 19, 2022 @10:40AM (#29994994)
Great idea, but seeing as you are rearchitecting you might as well add the salt to the MD5 while you are at it.
Re:Opensubtitles.org breached – Email addresses, IP addresse... by danhoule on Wednesday January 19, 2022 @10:51AM (#29995175)
I believe that this is a great idea but I was kind of wondering why people are not resorting to this method?
Re:Opensubtitles.org breached – Email addresses, IP addresse... by stevewodil on Wednesday January 19, 2022 @06:55AM (#29992510)
Slightly related, in order to prevent super long passwords from eating up CPU time is it better to hash using sha256 before argon/bcrypt so that the length is constant, or is it better to limit password length to some arbitrary number like 64 characters
Re:Opensubtitles.org breached – Email addresses, IP addresse... by tzs on Wednesday January 19, 2022 @08:46AM (#29993553)
I've been tempted a few times to simply use salt and a single iteration SHA-256 to store passwords, and put something like this on the account creation and password change screens:

> If you care about the security of your account use a 20+ character random password and do not reuse that password at any other sites. There are several excellent password managers that can generate and remember such a password for you and make it easy to use. Here's a list: <link to list of password managers>.

> We allow all normal US printable characters in your password: upper and lower case A-Z, digits, and <list of punctuation>. Set your password generator to length 20+ and to use mixed case, digits, and symbols and you will be fine.

> If you think you might have to manually type this password at some point, you can use a reduced character set with a longer password. If you use just mixed case letters and digits make the password 22+ characters long. If you use just mixed case letters make it 23+ characters. Letters all of the same case? Make it 28+ characters. 32+ characters of hex is fine, too. Heck, you can make it all digits if you use at least 39 of them.

> If your password manager offers other options, such as patterns like groups of digits or pronounceable syllables separated by some symbol, that too is fine as long as you make it long enough. Make it long enough that your password manager gives it its highest strength rating.

> The exact upper limit on password length that our password entry fields allow might vary from time to time as we update the site, but will always be at least 64 characters.

Re:Opensubtitles.org breached – Email addresses, IP addresse... by mooreds on Wednesday January 19, 2022 @08:47AM (#29993564)
What's wrong with super long passwords eating up CPU time? Can't imagine it is that prevalent with normal users and there are other ways to deal with it if it is a vector for a DOS attack (rate-limiting the number of registrations or logins, for example).

NIST says there's no reason to limit password length any more[0]:

"Memorized secrets SHALL be at least 8 characters in length if chosen by the subscriber. Memorized secrets chosen randomly by the CSP or verifier SHALL be at least 6 characters in length and MAY be entirely numeric. If the CSP or verifier disallows a chosen memorized secret based on its appearance on a blacklist of compromised values, the subscriber SHALL be required to choose a different memorized secret. No other complexity requirements for memorized secrets SHOULD be imposed. A rationale for this is presented in Appendix A Strength of Memorized Secrets."

0: https://pages.nist.gov/800-63-3/sp800-63b.html

Re:Opensubtitles.org breached – Email addresses, IP addresse... by DrBoring on Wednesday January 19, 2022 @08:03AM (#29993050)
> to prevent super long passwords from eating up CPU time

Is that why websites sometimes have low maximum password length requirements ? Ex: must be less than 20 characters.

Re:Opensubtitles.org breached – Email addresses, IP addresse... by ThreeToZero on Wednesday January 19, 2022 @08:23AM (#29993280)
Super long is >100 character passwords. Not much point: either the hash function is broken or some other hack will happen before humanity develops enough compute power to crack 100 char bcrypt passwords.

Websites (like some banks used to) that have less-than 20 char limits for passwords are purely bad security strategy.

Re:Opensubtitles.org breached – Email addresses, IP addresse... by mooreds on Wednesday January 19, 2022 @09:43AM (#29994160)
You know what the worst is? When they limit you to, say, 20 or 32 characters, but accept a longer password and silently truncate it!

I've run across that at least once and it was a total pain to troubleshoot and figure out.

Re:Opensubtitles.org breached – Email addresses, IP addresse... by GordonS on Wednesday January 19, 2022 @08:40AM (#29993496)
The number of sites that restrict passwords to 20 characters drives me nuts!

There needs to be a limit, yes, but surely something like 100 characters, or even 50, would be more sensible.

Re:Opensubtitles.org breached – Email addresses, IP addresse... by BlueTemplar on Wednesday January 19, 2022 @09:14AM (#29993798)
And it's the same websites that tend to use the bad practice of forcing the use of 2-4 "types" of characters...
Re:Opensubtitles.org breached – Email addresses, IP addresse... by userbinator on Wednesday January 19, 2022 @09:19AM (#29993844)
like some banks used to

Banks all have systems that will stop you from attempting to bruteforce them.

Re:Opensubtitles.org breached – Email addresses, IP addresse... by colejohnson66 on Wednesday January 19, 2022 @09:18AM (#29993837)
The CPU usage difference between a hash on 20 bytes vs 100 (assuming ASCII) can't be that bad, can it?
Re:Opensubtitles.org breached – Email addresses, IP addresse... by patrakov on Thursday January 20, 2022 @05:46AM (#30007202)
We are not talking about 100 bytes of password here, but megabytes of garbage. See https://www.djangoproject.com/weblog/2013/sep/15/security/, also known as CVE-2013-1443.

"A password one megabyte in size, for example, will require roughly one minute of computation to check when using the PBKDF2 hasher."

Re:Opensubtitles.org breached – Email addresses, IP addresse... by l-lousy on Wednesday January 19, 2022 @07:13AM (#29992644)
I think an average user password would be shorter than a sha256 hash no?
Re:Opensubtitles.org breached – Email addresses, IP addresse... by LeifCarrotson on Wednesday January 19, 2022 @08:02AM (#29993043)
Bcrypt truncates to 72 bytes, so it's kind of irrelevant IMO. Whether your average length is 12 or 20 or 64 bytes doesn't matter much.

I expect the parent's concern came from experience with PBKDF2, where the length is unbounded. It's good to consider possible denial of service attacks: if someone submits an enormous 1 MB password a PBKDF2 hasher can be knocked offline for 60s. Sha256 will quickly crunch that attack to a more manageable length.

Re:Opensubtitles.org breached – Email addresses, IP addresse... by stevewodil on Thursday January 20, 2022 @08:35PM (#30018057)
Exactly this, it’s a vector for DOS
Re:Opensubtitles.org breached – Email addresses, IP addresse... by 8organicbits on Wednesday January 19, 2022 @07:53AM (#29992960)
> Many implementations of bcrypt truncate the password to the first 72 bytes, following the OpenBSD implementation.

https://en.m.wikipedia.org/wiki/Bcrypt

This sounds undesirable to me, so I'd support sha256 and an alternative.

I'd also recommend adding a max password length to any API. No point in allowing million character passwords.

Re:Opensubtitles.org breached – Email addresses, IP addresse... by 8organicbits on Wednesday January 19, 2022 @03:37PM (#29999717)
I'm guessing folks are reading that as endorsement or sha256 over bcrypt. In context with the above post, this is sha256 over truncation.