Why LivingSocial’s 50 million password breach is graver than you may think
arstechnica.com
arstechnica.com
Should they? Should they really? Should we also give them a cookie for properly dressing themselves in the morning?
Uniquely salting and hashing passwords is the bare minimum for acceptable security practices. It is not a sign of expertise, but of competence.
I suppose it could be corporate bureaucracy or something, but it seems weird that a company with at least 30+ developers (based on public members on the github org) no one would point out that this is a Bad Idea.
1. user management is a pretty trivial thing to code and one of the first things you do when you set up any site. It could have been a simple oversight before a rushed launch.
2. Playing off of 1), once you have any users in a database using a particular system, you have to go through a bit of a process to convert people over (you can't convert from one hashing algo to another yourself since you don't have the original passwords). That involves creating a concurrent password table, creating login hooks that force the user to upgrade their password on login (especially a pain if they're using native apps -- i'm not sure if they are), etc. Making sure that 50 million users migrate over without a hitch is a potentially site-breaking undertaking that could have serious impact on the site's success. Given the rocky climate LS currently faces, you'd have to have nerves of steel to lead a n initiative like that.
3. Depending on how LivingSocial has their code management structure set up, there may only be a few devs who actually have access to the user login system (you really don't want an intern or freelancer to be able to modify those). Given that the same devs who have that access probably have more immediate issues to deal with day-to-day, something like the current hashing algorithm might not be on the top of their priority list.
Not that any of these are very good excuses, but I could see how it could happen.
Assuming you haven't been hacked yet the old password is still secret. Therefore you modify your login system so that when the user next logs in:
* Check password against old hash
* If old hash exists and matches user's password then re-hash the password using new hash and save new hash in new field
* If old hash does not exist then just check against new hash only.
Run the above code for X time (X being the time it takes Y% (Defined by company) of your users to login at least once.
After X time THEN you start forcing the remainder to switch over.
Done properly for the vast majority of your users should not even know you have changed anything.
[EDIT] - With some extra code you could probably avoid having to create a new field for the new hash by just checking against one hash field using old algorithm then new algorithm. This would avoid a potentially costly DB migration.
I'm glad you mentioned "safer", because for some reason rurounijones's approach made me nervous, but I couldn't quite put my finger on it.
Here's some more discussion on the issue: http://crypto.stackexchange.com/questions/2945/is-this-passw... (I found that from here: http://stackoverflow.com/questions/3955223/password-hashing-...).
Someone with a bit of experience in this field would know to include the hash algorithm in the stored data when processing a password set/change/reset. For example, good old Netscape LDAP server stored passwords in the general form "{ssha}xxxxxx", "{crypt}xxxxxx", or "{plain}xxxxx". This allows for easy comparison as users login, as well as for gradual upgrade to stronger algorithms in the future when accepting changes--one could extend with with "{bcrypt}", "{pbkdf2-10k}", etc., etc.
Having only a small number of trusted ignoramuses working on the code is a pretty lame defense. Honestly this stuff is in the news all the time. How could nobody at such a massive site raise the question, "if our database is compromised, will we be exposed as careless oafs?"
1) Always review the code for sensitive data before allowing it to go live (especially by someone well-versed in security).
2) Have a plan of attack in place for security upgrades so that they're not quite so painful.
3) Despite day-to-day responsibilities, there need to be regular reviews of security practices by management.
I find it pretty hard to believe that no one would ever poke around the User model in a Rails app :)
By comparison, today's bcrypt passwords at today's work factors are tomorrow's ASIC snacks. Doesn't mean that bcrypt at reasonable work factors are wrong today.
Who knows the sensitive database passwords? Where are they stored? How often are they changed? Have you fired anyone recently? Was their access revoked and were all passwords changed?
Things you didn't mention as precautions are protections from SQL injection attacks (I'm assuming you're using prepared statements) and that you're using huge passphrases, along with making sure that your applications are up to date with the latest security patches.
(I'll leave it to others more knowledgeable to answer this but keep what I say next in mind.)
My question to you is, how big of a target are you?
I mean the security you would use if you are Madonna is not the same as a "B" list actor or the person working in the local coffee shop.
You can put untold hours into this but unfortunately security is a full time job and can also detract from other things you need to be concerned with that might be more important for your particular situation.
"I may be forgetting something"
Sure but the same concern is in play when taking a trip or with anything. What are you forgetting? Where are you going? How easy will it be to solve the problem and how much impact will forgetting dental floss have? Are you going to an uninhabited island or Manhattan where you can buy almost anything 24/7?
While the former member might not be a high profile target for the moment (and let's assume that he isn't for the sake of devils advocate), who's to say that next week a story hits the news about his wife or children or even a company he's affiliated with and then reporters decide to start poking about on forums and social media for cheap information to write sensationalist reports on? Or that hackers use that news as an excuse to target the poor guy?
Or even who's to say that next month he annoys someone on HN who decides to play some pranks?
While you are right that that security is a full time job, you should never advocate the numbers game because as remote as the odds might be, people do win the lottery.
The LivingSocial password hashing debacle is an example of a security failure that pretty much every website in the known universe could improve on by changing a single line of code -- that's what's so frustrating about it in the first place.
There are cases, though, where certain security measures are probably not needed. For example, I would probably not recommend that my mom use a keyfob security token to log into her blog admin page (although I'd probably offer to make one for her with an Arduino as a weekend project lol), or hire armed guards to guard her database servers. Enterprises certainly need these measures along with many others.
I'm assuming from the OPs tone, that his box sits somewhere between the two extremes. However the very fact that he's got an SSH account on it makes the box a much more favorable target than the millions of free blogs on shared hosting services - so even if his box doesn't contain 3rd party passwords and/or credit card information, and even if he can easily restore the box from a back up, he still has the problem that a break in could see his box used to send spam and what not. Many hosting providers will just kill your subscription if that happens.
So while you're right that there's a balance between security and usability, security most definitely comes first if you're administrating your own VPS / dedicated hardware.
I don't believe that is what I am saying. I'm saying you are less of a target if you are "nobody" than "somebody".
Would you agree that it is proper to have more security in place at an event like the Boston Marathon or a major league baseball game or when the prime minister visits then the dance recital at the local school?
But that's exactly what security through obscurity is!
> Would you agree that it is proper to have more security in place at an event like the Boston Marathon or a major league baseball game or when the prime minister visits then the dance recital at the local school?
If you must use that crude analogy then please remember than In the UK we've had terrorists blow up random buses and trains (7/11) and attack town centres on otherwise uneventful days (IRA). In America there has been frequent shootings at schools without the need for high profile dignitaries visiting. So your own example proves my point that being a seemingly low profile target doesn't mean that you're safe from attack.
It's something just as easy to get wrong in application code, but good frameworks already do, and abstract it away where you might not realise.
Maybe by having the database on external hardware with an API, but I can imagine this is hard to scale. What if you need to sync it across several load balancing servers, or what if you want to make backups?
One can design a special hardware, with a port for just comparing passwords and a port for copying. A Hacker would need physical access to copy the database.
>> Load balancing
Could be part of the design.Say card in a box, with internal physical connection inside the box for copying.
... then it's game over for you. But I guess intruders typically use either SQL-injection or somehow get the application password to access the password table. In both cases an unreadable table would thwart the intruder.
If the only way your production server can check passwords is by sending hash(salt+pw+salt) and getting a true\false reply from a piece of external hardware...then even if an intruder got complete control though some exploit or injection, he wouldn't be able to dump the database for later cracking with rainbow tables.
See also [2] for a cute implementation using an Arduino to secure an AWS API key
[1] https://en.wikipedia.org/wiki/Hardware_security_module
[2] http://stefan.arentz.ca/signing-aws-requests-with-your-ardui...
Deleted comment
The vast majority of merchants fall into PCI-DSS Level 2-4. Those merchants complete a self-assessment questionnaire (SAQ), in other words, self-reporting. They also have to pass a rather rudimentary quarterly automated scan from an approved vendor.
You don't get to external auditors until you get to Level 1, which is a vanishingly small percentage of the merchants in the world.
Pbkdf2 has been recommended by NIST, while the main crypto algorithm for bcrypt hasn't seen as much attention (though it has been around for a while and is probably safe).
Edit: Though, it looks like PBKDF2-HMAC-SHA512 is not FIPS compliant.
SHA2-512 is designed to be fast on hardware.
It's just important to understand the differences and trust behind the different algorithms. PBKDF2 is NIST recommended, which I would say speaks to its strength (unlikely it will be easily cracked). It can also be used with any input size. Though, calculation requires little memory, so it can easily be implemented in hardware.
bcrypt has been around since 1999 has is still going strong, but is limited to input sizes of 55-characters.
scrypt is fairly new and I don't feel has been wrong long enough to be vetted by the security community.
I don't follow GPU tech enough to know if they plan on implementing 64-floats any time soon, so commodity hardware to easily brute-force SHA-512 may not be around for a while. Though, they can still implement SHA-512 calculations on a GPU a lot easier than they can for scrypt or bcrypt.
Now, if you use PBKDF2 with a large iteration count (lets say 20000), it will make the time to calculate the final solution a lot harder. You could give an iteration count to PBKDF2 to have it take the same amount of time as bcrypt would take to run. The only thing you can't do with PBKDF2 is adjust the amount of memory required to calculate the solution.
You can SHA512 the password before feeding it to bcrypt if that's an issue.
55 character passwords cannot be brute forced anyway.
- Did the user use a common passwords? If they did, then it will quick to brute-force.
- Did the user reuse the same credentials on other sites? If they did then the value of recovering the password becomes worth plowing through well-salted scrypt.
The real problem is that far too many people use the same credentials for LivingSocial and their Gmail.
Plus bcrypt is used as a hashing function and includes a salt. So even if what you said was true, it would make bcrypt obsolete.
Yes, I know, bcrypt uses a block cipher but block cipher can be easily used for cryptographic hashes (see DES for one example).
From the perspective of the person using it, it's just a single hash. Saying "Hashing and salting" works is not really any better than what people do already, because, e.g. the passwords in the case discussed in this article WERE hashed and salted, but with a relatively weak hash.