News for hackers. Stuff that matters.
Re:Yahoo discloses hack of 1B accounts by x0 on Wednesday December 14, 2016 @05:50PM (#13180454)
And nobody ever seemed to say "hey, maybe we should be using something more secure". Yahoo's been around for how many decades, and the fact they were still using MD5 in 2013 is just shameful. Yeah if it was some legacy code from 1993 you can probably excuse it, but I just can't believe after 20 years nobody thought it was a problem.

I'm not really a software developer but I really can't imagine it being a huge change. Instead of md5(pass) you could probably just change that to secure_hash(md5(pass), salt), add another column in the database for the salt, and rehash all the passwords. Customers wouldn't notice. Rehashing the databases would take a while, but otherwise that's really not a huge amount of work.

Re:Yahoo discloses hack of 1B accounts by ashark on Wednesday December 14, 2016 @06:00PM (#13180539)
Well, you can only rehash if you have the plaintext password. So you have to wait until they login again, or force a password reset for everyone. In the former case you're stuck with a bunch of md5 passwords hanging around for any account that's not very active, and for the latter you'll lose some percentage of active accounts whose reset process is for some reason no longer functional. You could mix-and-match the two methods (start with the former, force the latter on any stragglers after, say, a few weeks) to minimize the damage, but that's more work and a number that someone somewhere in the organization finds very important is still probably gonna go down.

(I've never had to do this myself, so these are just the most obvious options I came up with. Possibly there are others.)

Re:Yahoo discloses hack of 1B accounts by manarth on Wednesday December 14, 2016 @06:16PM (#13180681)

  You can only rehash if you have the plaintext password
There are techniques to rehash, even without the plain-text password, and without the user having to login to trigger a rehash.

Drupal 7 used such a technique for upgrades from Drupal 6, migrating from MD5 to a salted sha512 hash, but it's not an uncommon technique.

The old passwords are stored as MD5 hashes in the databases. The MD5 hash is processed through the same techniques as new passwords: a salt and the new sha512 hash. Provide a way to identify whether the origin was a password, or an MD5 hash.

Either way, you end up with a hash. You can identify whether the origin was a password, or an MD5 hash, but you can neither determine the origin MD5 hash, nor the origin password, as the new hash is secure. So even if the original MD5 hash was insecure, the new hash is secure.

When someone attempts to login, you still need to determine which password-validation to use: hash = sha512(salt + password), or hash = sha512(salt + MD5(password)), but the security level is the same.

Re:Yahoo discloses hack of 1B accounts by leereeves on Wednesday December 14, 2016 @07:03PM (#13180994)
> hash = sha512(salt + MD5(password))

Passing the password through MD5 reduces the complexity to 128 bits, you can't get that back.

So the security level is not the same, though it may be resistant to some attacks on MD5.

And it's probably not important for most people, since there are less than 2^56 eight character ASCII passwords.

Re:Yahoo discloses hack of 1B accounts by manarth on Wednesday December 14, 2016 @07:27PM (#13181136)

  > "Passing the password through MD5 reduces the complexity to 128 bits, you can't get that back."
Assuming that the new hash is secure (and sha512 is generally agreed to be secure), then, given a specific sha512 hash, the original MD5 hash can only be determined via rainbow tables, which is a Big-O operation. Even though entropy is reduced, it's still a significant work to determine the original MD5 hash (significant in this instance being longer than the heat-death of the Sun, given current extrapolations of computing performance).

Attacks against MD5 are based around knowing the original MD5 hash. In this instance, the original MD5 hash is unknown, so there is no mathematical shortcut to finding a collision.

Re:Yahoo discloses hack of 1B accounts by leereeves on Wednesday December 14, 2016 @07:30PM (#13181161)
In this case an attacker isn't looking for a collision (which would mean creating two passwords with the same hash, and what hash that is doesn't matter).

The attacker needs a password with a specific hash, and the best reported attack for that is around 2^128.

Re:Yahoo discloses hack of 1B accounts by manarth on Wednesday December 14, 2016 @07:40PM (#13181234)
Agreed, that the best reported rainbow-table attack on MD5 is 2^128 (i.e. the complete range of possible MD5 hashes).

Personally, I'm willing to chance that my password will be discovered via a brute-force attack within the next 0.65 billion billion years [1]

[1] http://bitcoin.stackexchange.com/questions/2847/how-long-wou...

Re:Yahoo discloses hack of 1B accounts by leereeves on Wednesday December 14, 2016 @08:29PM (#13181545)
I think it does make sense to be cautious.

A new preimage attack could be discovered - or might already have been, secretly.

Re:Yahoo discloses hack of 1B accounts by danielweber on Wednesday December 14, 2016 @09:31PM (#13181874)
> Passing the password through MD5 reduces the complexity to 128 bits

No, this is not the problem with MD5. You are not going to find two user-memorizeable-and-typeable passwords with an MD5 collision.

If you are bringing a password with more than 128 bits of complexity to the party, any password storage scheme better than plaintext will have your password safe.

Re:Yahoo discloses hack of 1B accounts by leereeves on Wednesday December 14, 2016 @11:09PM (#13182324)
For passwords, there is no known problem with MD5, unless you know about a preimage attack.

Collisions are a problem for digital signatures, not for passwords.

But some people do want and use more than 2^128 bit passwords, for whatever reason, and an MD5 intermediate stage limits that.

Re:Yahoo discloses hack of 1B accounts by rev_bird on Wednesday December 14, 2016 @06:56PM (#13180951)
I was doing all kinds of mental gymnastics trying to figure out how this would work; thanks for explaining it so clearly.
Re:Yahoo discloses hack of 1B accounts by dsacco on Wednesday December 14, 2016 @06:14PM (#13180659)
I have been in this situation, and you're correct.

Somewhere in the organization, a product team is going to throw a fit about usability and churn over the decision to reset user passwords en masse, or to force users to change them when they first log in. This isn't a slight against product managers, but one of the clearest indications of a company's overall security culture "health" is how the security, engineering and product teams choose to compromise and "pick their battles." Risk accepting vulnerabilities has a legitimate place when you have to balance product development and usability, but so does pushing back on egregious issues.

I don't have privileged insight into Yahoo's organization, but in this case it's pretty clear the security team should have either been more diligent in conveying the ramifications or less kneecapped by the surrounding org units, depending on the circumstance. More importantly, Yahoo should have "migrated" their passwords in the manner a parallel comment explains in this thread. This is what Facebook and other companies did after maturing their security programs (see "Facebook Onion" on how Facebook transitioned away from MD5).

Also good to note - there is evidence Yahoo's security culture improved over the years. The decision to go with MD5 almost certainly happened in the 90s, and when Tumblr suffered a breach all users were forced to reset their passwords. The capability and awareness was clearly there.

Re:Yahoo discloses hack of 1B accounts by sleet on Wednesday December 14, 2016 @06:20PM (#13180709)
x0's algorithm was secure_hash(md5(pass), salt), you already have md5(pass) so this can be done in one bulk update.
Re:Yahoo discloses hack of 1B accounts by rz2k on Wednesday December 14, 2016 @06:11PM (#13180641)
Does an insecure algorithm mean that you effectively have the plain text passwords?
Re:Yahoo discloses hack of 1B accounts by manarth on Wednesday December 14, 2016 @06:25PM (#13180742)
Not necessarily, because of collisions.

The password "foo" may encrypt to the hash "12345". If an attacker were to discover that the hash is "12345", they would look for a password that hashes to "12345", which could, hypothetically, be the password "bar". They don't know the original password "foo", they've simply discovered an alternative, which happens to match the algorithm enough to unlock access.

In general, rainbow tables are used for identifying and attacking common passwords, but that doesn't mean that the algorithm is insecure.

Insecure algorithms can be attacked through collisions, which don't necessarily give you the original password, they just provide an alternative password which is accepted by the algorithm. The distinction matters when it comes to password reuse, because if Site A uses MD5, but Site B uses sha512, finding a collision that grants access on Site A doesn't necessarily give you a password that will grant access on Site B.

Re:Yahoo discloses hack of 1B accounts by gottam on Wednesday December 14, 2016 @06:36PM (#13180820)
Having worked with monolithic legacy codebases that they likely have, it has gone through hundreds of developers who dont work for the company anymore that created a bunch of spaghetti code means its a huge effort required to make sure that none of their other services break when they implement such changes. Also, management HATES when dev teams do this because it isn't "new stuff" thats immediately visible to their bosses nor the end user.

If anything goes wrong with the password update, users get angry, lose faith in the services, stress, a few people get fired maybe, etc etc. On the other hand, letting it stay old and crappy just everything stays just peachy, and nobody is the wiser that the entire system is a house of cards. Until the day someone hacks the database of course... which happened so its "now" a problem.

They're not going to begin to take security seriously even after this incident. They'll do what they need to right now but there's no auditing and their users don't normally care about this sort of thing, therefore the management won't care either.

Re:Yahoo discloses hack of 1B accounts by haser_au on Wednesday December 14, 2016 @05:58PM (#13180522)
There are likely to be a lot of identity systems using the password in the database, all of which have been coded to look for an MD5 hash, not a salted hash. This means code in a number of applications have to be updated at the same time.

The typical way around this is to create your new destination column (e.g. sha256 with salt), and progressively have applications reference this column rather than the MD5 unsalted column.

It's a huge amount of work, and if the applications were made in 1990's, the code is likely legacy. If Yahoo are doing regular code security reviews, this will likely have been put in the pile of "we need to fix, but it's too costly to do".

Re:Yahoo discloses hack of 1B accounts by flukus on Wednesday December 14, 2016 @06:19PM (#13180698)
> It's a huge amount of work, and if the applications were made in 1990's, the code is likely legacy.

Which begs the question, can legacy code survive in an international network?

Re:Yahoo discloses hack of 1B accounts by haser_au on Wednesday December 14, 2016 @07:49PM (#13181293)
That's the right question to ask. The answer is no, because new security vulnerabilities are disclosed every hour.

A large organisation will implement layered security (otherwise known as layers of the onion) to prevent this type of attack. This means; more secure passwords to access the password database, fewer people with access, rotation of access passwords, auditing of backup storage and encryption, etc etc. Clearly Yahoo's layers of security were all broken to allow this type of theft.

Re:Yahoo discloses hack of 1B accounts by pbhjpbhj on Wednesday December 14, 2016 @07:55PM (#13181332)
>It's a huge amount of work //

Really? Moving from doing md5(password) to bcrypt(password,salt)? I see organisations make things hard and legacy code-base, yadda, yadda but surely if Yahoo couldn't do this then they couldn't manage scratching their own butt; it really seems like quite a small change in the scheme of things. Like one senior engineer, one afternoon of work (then testing, etc., OK, sure) ... ?

Re:Yahoo discloses hack of 1B accounts by haser_au on Wednesday December 14, 2016 @09:02PM (#13181725)
"It Takes 6 Days to Change 1 Line of Code" https://news.ycombinator.com/item?id=13119138

I'm going to go out on a limb and guess you've never worked as a software engineer in a large organisation.

Given MD5 hashes are currently stored, how do you propose user's password get converted to SHA256/512? Should Yahoo brute force the passwords, and then store them in the new algorithm? Or should they wait for the user to log on, verify their password, and store it in the new hash algorithm (given some users rarely log on, this could take over 12 months to complete 80% of users).

Re:Yahoo discloses hack of 1B accounts by flukus on Wednesday December 14, 2016 @09:43PM (#13181942)
Yes it could take months or years to complete the process, but they've had at least a decade.

Even if it never completes (abandoned accounts), it would still have saved most active accounts from being breached.

Re:Yahoo discloses hack of 1B accounts by haser_au on Wednesday December 14, 2016 @09:59PM (#13182019)
100% agree. Yahoo should have started the process a long time ago.

I was just replying to the comment it could be completed in an afternoon.

Re:Yahoo discloses hack of 1B accounts by pbhjpbhj on Thursday December 15, 2016 @07:44AM (#13184186)
You're right on the first count. It wasn't sarcasm, it was a question.

On the storing of hashes though the standard protocol has been to pass the hash in as if it were a password.

Re:Yahoo discloses hack of 1B accounts by _asummers on Wednesday December 14, 2016 @05:56PM (#13180490)
Hashing the hash isn't a good idea, you're reducing the domain of your secure_hash function to the range of md5. The way to do it is to have a "password hash algo version" column and when the user puts in their password, you verify against the hash[algo](password) and rehash with the later version, changing the algo column for that user.
Re:Yahoo discloses hack of 1B accounts by aidos on Wednesday December 14, 2016 @06:01PM (#13180547)
You could do both though. Give much more security in the short term and upgrade anyone else who logged in later.

I did ask about the hash of hash thing some time ago and ptacek claimed that's a reasonable thing to do.

Re:Yahoo discloses hack of 1B accounts by danielweber on Wednesday December 14, 2016 @09:35PM (#13181900)
> you're reducing the domain of your secure_hash function to the range of md5.

Oh no, only 128 bits. The NSA will be able to brute force one of those passwords in 80 years.

Re:Yahoo discloses hack of 1B accounts by nodamage on Thursday December 15, 2016 @02:00AM (#13182976)
You need to do both. If you only do the latter, then stale accounts which never log in again will never have their passwords upgraded to the more secure hash. Hashing the hash allows you to replace the md5 hashes immediately, and then you can perform the upgrade if/when the user logs in again.
Re:Yahoo discloses hack of 1B accounts by cuckcuckspruce on Wednesday December 14, 2016 @06:19PM (#13180703)
>I'm not really a software developer but...

If I had a nickle for every time I've heard this statement then I'd have enough to comfortably retire.

Yes, in theory, changing a column in a database (which in this case, happens to be a password) seems simple, but in practice, it's not.

Re:Yahoo discloses hack of 1B accounts by rconti on Wednesday December 14, 2016 @07:54PM (#13181323)
You're assuming engineering is just sitting on their thumbs, reviewing their code once a week, thinking of ways to optimize it.

In reality, they're constantly under pressure to develop new features, fix reported bugs, move on to the next project, keep the site from falling over, etc etc.

And the ones who choose NOT to work hard aren't sitting around reviewing old code either.

Re:Yahoo discloses hack of 1B accounts by ozten on Wednesday December 14, 2016 @06:21PM (#13180716)
For an IdP at the scale of Yahoo, the can adopt something as complicated as supporting versioned passwords and migrating credentials to the latest secure algorithm upon successful login. You have the clear text password at that point. You can store metadata such as the version (or algorithms) used to hash the credential.
Re:Yahoo discloses hack of 1B accounts by mschuster91 on Wednesday December 14, 2016 @06:48PM (#13180895)
Complex?!

It's easy as hell. Even PHP, so often flamed for "bad security" these days supports EASY functions for this (and polyfills are available, if you're running PHP < 5.5, which you should't do anyway):

- password_hash, which creates a salted hash (the returned value consists of a type/strength spec, the hash, and the salt)

- password_verify, which verifies a password with a hash in a timing-safe manner

- password_needs_rehash, which tells you if you should update the hash in the database

password_hash and password_needs_rehash take a parameter for the hash function (currently only bcrypt is supported, quite likely to keep people from using md5/sha1), and for the cost (the amount of hash function calls).

I believe any reasonable programming language these days has such functions.

What I am NOT so sure about is how the various LDAP server implementations, which many people use for SSO and "normal" account management (because it's easier to connect a new software to LDAP than to migrate existing user db's into LDAP), handle password storage. I mean, having an LDAP server for the credentials prevents any form of password leakage, but in case someone breaches both servers/the LDAP daemon is running on the same host as the webserver?

Re:Yahoo discloses hack of 1B accounts by ozten on Wednesday December 14, 2016 @06:57PM (#13180956)
Nothing is "easy as hell" at scale.
Re:Yahoo discloses hack of 1B accounts by xxs on Wednesday December 14, 2016 @06:40PM (#13180846)
Normally you'd =not= store the salt separately; the usual way is keeping the salt and the password together in the same 'blob'

Rehashing can be safely implemented as long as the auth. process can handle both md5 and some composite hash [i.e. shash(md5(pwd))]

It's really a trivial operation.