News for hackers. Stuff that matters.
Re:Password Security The Right Way by tptacek on Wednesday October 24, 2012 @11:40AM (#4693399)
No.

http://codahale.com/how-to-safely-store-a-password/

It's really not more complicated than this. You can use scrypt instead of bcrypt if that makes you happy. The secret crypto keys in separate storage locations stuff is silly. Get the basics right.

Re:Password Security The Right Way by MattRogish on Wednesday October 24, 2012 @12:31PM (#4693649)
Indeed. Encrypting your bcrypt'd hashes is... massively complex and doesn't provide any additional meaningful security relative to the complexity.

A properly bcrypt'd password table is functionally useless in the hands of a non nation-state. Yeah, it's not something you'd prefer to have a BadGuy(TM) get, but other than embarrassment, it's not a big deal.

Here's my bcrypt with salt. Please, waste your time trying to crack this.

"$2a$19$xZrwzkut/fj2gToExgw8qevT9DtevnuKLEVj.kNiSMclzfFqQq9z."

Re:Password Security The Right Way by tptacek on Wednesday October 24, 2012 @12:58PM (#4693812)
I'm pretty sure your actual bcrypted password doesn't have that cost factor on it.
Re:Password Security The Right Way by AgentConundrum on Wednesday October 24, 2012 @01:06PM (#4693867)
Why not? You'd rather have inferior security than wait a minute and a half[1] to access your accounts?

Shame on you, Thomas! I thought you were a professional!

[1] Based on a remarkably unscientific test I just ran on an Ubuntu 12.04 VM on my laptop. 87.8 seconds.

Re:Password Security The Right Way by MattRogish on Wednesday October 24, 2012 @01:03PM (#4693843)
That's how rails stores it in the database, so trying to be as transparent as possible.
Re:Password Security The Right Way by tptacek on Wednesday October 24, 2012 @01:15PM (#4693912)
It takes 3 minutes to log into your application?
Re:Password Security The Right Way by MattRogish on Wednesday October 24, 2012 @01:56PM (#4694127)
You are absolutely right. This is not our production app (ours is at 12 IIRC) but some internals app I've been playing with.
Re:Password Security The Right Way by tptacek on Wednesday October 24, 2012 @02:00PM (#4694136)
Ok just so you know the default cost factor for bcrypt-ruby is a reasonable choice, and the cost factor you've used here is unreasonable.
Re:Password Security The Right Way by MattRogish on Wednesday October 24, 2012 @02:08PM (#4694182)
Absolutely. Was trying (but failing) to make a joke.
Re:Password Security The Right Way by jgeorge on Wednesday October 24, 2012 @03:36PM (#4694640)
BCrypt 19s are <40s to encrypt here, using Java and not even native code. Certainly not outside the realm of usability for something you don't authenticate against all the time. I wouldn't want that for my screenlock password, but I can still see it being workable.
Re:Password Security The Right Way by jayflux on Wednesday October 24, 2012 @01:24PM (#4693966)
A work factor of 19 seems like overkill. I read that even 08 (less than half that) would suffice in today's world.
Re:Password Security The Right Way by AgentConundrum on Wednesday October 24, 2012 @01:38PM (#4694031)
I think somewhere between 10 and 12 is the sweet spot right now. Also, just to be clear, 08 is a little more than "less than half". The work factors are exponential. Half of 19 would be 18.
Re:Password Security The Right Way by Retric on Wednesday October 24, 2012 @01:42PM (#4694057)
Salting your passwords is cheap and creates a weak form of two factor authentication. Don't forget bcrypt does not help all those people using 'password'.

That said, use bcrypt.

Re:Password Security The Right Way by peterwwillis on Wednesday October 24, 2012 @01:44PM (#4694062)
What the fuck are you talking about? A salted password is not two-factor authentication and bcrypt definitely helps people using 'p@ssw0rd'. This is the worst troll ever.
Re:Password Security The Right Way by Retric on Wednesday October 24, 2012 @02:27PM (#4694294)
If you don't know the salt you can't crack the password.

So, if say your backups are compromised and someone has all the user names and passwords they still need the salts before they can login to your service.

Re:Password Security The Right Way by tptacek on Wednesday October 24, 2012 @03:07PM (#4694510)
If there's some place you can put salts where attackers can't get them, I advise you to put your passwords there too.
Re:Password Security The Right Way by Retric on Wednesday October 24, 2012 @05:25PM (#4695124)
It's not a question of can't just forcing them jump though one more hoop. Ideally, no single employee should be able to compromise your system and doing something as simple as xor'ing passwords with 'bob' goes a long way to prevent DBA's from having easy access to everything. So, from a cost benefit standpoint it's obvious to salt your passwords with something.

Edit: I am honestly surprised how much push-back people are giving this without saying why they actually disagree.

Re:Password Security The Right Way by peterwwillis on Wednesday October 24, 2012 @03:04PM (#4694488)
Let's completely ignore the fact that most compromises of password databases are of live systems, not extraneous backups. What the hell is the point of the backup? You didn't back up the salts, so restoring the backup leaves you with a broken, useless password database.
Re:Password Security The Right Way by chunsaker on Wednesday October 24, 2012 @11:48AM (#4693446)
Totally agree Coda gets the basics right and I love that article. In fact, our CTO wrote a response blog article to that in February: http://www.stormpath.com/blog/strong-password-hashing-apache...

However, to quote from that post: "The author is correct assuming the attacker has direct access to your password store. This is a big assumption - most organizations go through great lengths to ensure access to say, databases, is levels of security 'deep' beyond just a web login form. Anyway, assuming that this might ever happen to you, how can you address the issue?"

Re:Password Security The Right Way by tptacek on Wednesday October 24, 2012 @11:59AM (#4693486)
Iterated SHA2 is inferior to bcrypt and far inferior to scrypt, and yet both these Stormpath.com articles recommend it. The advice in these articles is worse that Coda's articles; developers should read Coda's post and implement it.
Re:Password Security The Right Way by chunsaker on Wednesday October 24, 2012 @12:07PM (#4693528)
You're talking about Bcrypt like its some magical golden unicorn that will cover your ass from all attack vectors. Sure, its awesome. But modern security requires more than just an awesome encryption algorithm.
Re:Password Security The Right Way by tptacek on Wednesday October 24, 2012 @12:15PM (#4693573)
No, I'm talking about bcrypt like it's better than iterated SHA2, which is very, very fast on GPUs. There is no such thing as a unicorn.
Re:Password Security The Right Way by mikeash on Wednesday October 24, 2012 @01:06PM (#4693862)
At what point does he attribute any unicorn-like properties to bcrypt? All he says is that SHA2 is worse, which is completely true.
Re:Password Security The Right Way by asalazar on Wednesday October 24, 2012 @12:26PM (#4693628)
Assuming the attacker has access to your password store is NOT a big assumption for most sites. In fact, 94% of data breaches are to the user DB. And 42% of those attacks are targeting the password store specifically. Check out the Verizon Data Breach Report for details. http://bit.ly/GFfpdk
Re:Password Security The Right Way by lhazlewood on Wednesday October 24, 2012 @12:51PM (#4693771)
BCrypt (level 3) is getting the basics right. Levels 4 and 5 are techniques beyond the basics used to minimize potential brute force attacks, which _are_ an issue, depending on the attack target (read the Verizon report referenced by another post on this page).

Don't think for a second that certain government agencies can't brute force a BCrypt-based password hash, especially given they will know the cost factor and salt. If the hash is encrypted, and then chunked, if an attacker doesn't have the constituent encrypted chunks and/or the encryption key _for a valid time frame_, the possibility of a brute force attack with modern computing power is almost impossible.

While you may not care about such concerns, some of Stormpath's government agency customers do, and so we provide these additional safety measures. That an average website can benefit from them is icing on the cake.

Re:Password Security The Right Way by tptacek on Wednesday October 24, 2012 @12:56PM (#4693802)
You feel that you're protecting password hashes from government sponsored attackers, and yet you're iterating SHA2 as your password hash?
Re:Password Security The Right Way by lhazlewood on Wednesday October 24, 2012 @02:31PM (#4694314)
Depends on the customer - if it is a government agency and SHA2 is mandated for their own passwords (per NIST standards), we comply (with a huge number of iterations based on CPU/GPU target specs). Additionally, we automatically increase iterations over time as CPU/GPU targets change - something a customer never needs to worry about (which is nice). Otherwise BCrypt or SCrypt is used for most customers.

It seems like some of the finer points of your concerns aren't being covered in this thread (e.g. # of iterations, if sufficiently high, will probably address your GPU concerns). Unfortunately for me, I can't read Hacker News all day and must move on, but if you'd like, definitely give us a call at Stormpath and we'd be quite happy to geek out and talk through the all of the details. (And I apologize if any of this came across as negative - no coffee today I guess).

Re:Password Security The Right Way by amalcon on Wednesday October 24, 2012 @01:17PM (#4693928)
if an attacker doesn't have the constituent encrypted chunks and/or the encryption key _for a valid time frame_

This reads an awful lot like "If the attacker has not actually compromised the gateway." After all, the gateway needs to either be able to encrypt the password or decrypt the hash to do its job. That means the gateway needs either the key, or access to an oracle that has the key. Either way, you're compromised.

The data sharding has some merit, if only because it's more difficult to simultaneously steal systems from multiple datacenters. I suppose at some level that becomes a concern, but that's roughly the level where you start hiring people with guns to protect your computers.

Re:Password Security The Right Way by chimeracoder on Wednesday October 24, 2012 @02:13PM (#4694218)
> Don't think for a second that certain government agencies can't brute force a BCrypt-based password hash, especially given they will know the cost factor and salt.

I have no doubt that government agencies have much more powerful intelligence than people realize. But knowing the salt has no connection to their ability to brute-force; it only affects their ability to use rainbow tables.

(All it does is prevent them from matching up passwords by their hashed values, so for example, if one password is cracked, it protects everyone else who is using the same password.)

But it doesn't provide any protection against brute forcing. Nothing can, short of making the hash function slower (or the password domain larger).