News for hackers. Stuff that matters.
Re:What technical reasons are there to have low maximum pass... by derefr on Sunday March 31, 2013 @02:22AM (#5467903)
If you allow truly unlimited-length passwords, malicious users can set gigabyte-long passwords. Whether you hash them or just store them, that's a DoS waiting to happen with every login.

So, there actually is a reasonable limit for the length of passwords, email addresses, and most other user-editable fields that end up either being hashed, or shoved through to the database. That limit is just probably somewhere around 100KB to 1MB, not "eight". ;)

More importantly, that limit is an infrastructure concern, not a business-domain concern; it's best enforced by something like nginx spitting out a 400, not the model-validation logic in your app server.

Re:What technical reasons are there to have low maximum pass... by fruchtose on Sunday March 31, 2013 @02:52AM (#5467956)
While this is true, hashes use a set number of characters. For example, SHA-256 hashes can be stored in 32-character hex strings. In that sense, there's no point in allowing for a variable length field for password hashes.
Re:What technical reasons are there to have low maximum pass... by pyre on Sunday March 31, 2013 @02:57AM (#5467960)
It's not only dealing with password length. You could DoS the server by tying up all threads in processing the upload. Uploading 4GB isn't instantaneous.
Re:What technical reasons are there to have low maximum pass... by jbrechtel on Sunday March 31, 2013 @10:32AM (#5468706)
For the application code to complain about password length then the 4gb upload has to have already occurred.

Protecting against a DoS attack this way is done in the webserver, which doesn't care about individual fields. Sure this means there's an implicit password length limit, but not in any application-level sense.

Re:What technical reasons are there to have low maximum pass... by fruchtose on Sunday March 31, 2013 @03:39AM (#5468029)
I'm not arguing with that. I wholly agree with you that a client should not be able to upload 4 GB for the password field. I think I misread your first point as if it dealt with server-side storage.
Re:What technical reasons are there to have low maximum pass... by just2n on Sunday March 31, 2013 @03:31AM (#5468021)
That's why the client should perform the hash and only submit the result.
Re:What technical reasons are there to have low maximum pass... by derefr on Sunday March 31, 2013 @04:06AM (#5468064)
No; this is effectively the same as doing no hashing at all. If your database gets stolen, people can replay the "hashed" passwords from it to the server, without having to hash them themselves.
Re:What technical reasons are there to have low maximum pass... by just2n on Sunday March 31, 2013 @05:06AM (#5468159)
I didn't mean to imply that you'd just store the hash the client comes up with. That's idiotic, of course. Not everyone uses SSL, even though they should, and it's not always secure, and even with the use of SSL, it seems that there would be a potential length attack that could be employed to effectively guess a user's password length. So in all cases, IMO, it makes more sense to be receiving a fixed-length thing that is fairly insensitive to attack in itself. So perhaps a user has 2 salts associated with their account, per password: an auth salt and a storage salt. Then an auth looks something like this:

    hash(saltFromServer + hash(password))
And then the server would do

    hash(user.salt + clientHash)
I'm not sure, but this seems reasonable to me.
Re:What technical reasons are there to have low maximum pass... by ajanuary on Sunday March 31, 2013 @06:16AM (#5468271)
Now you have quite a restricted domain, so if your database is compromised there are a lot fewer values an attacker needs to enumerate to try and crack the password.
Re:What technical reasons are there to have low maximum pass... by just2n on Sunday March 31, 2013 @06:32PM (#5470435)
That reasoning doesn't really sit well with me as a mathematician.

I would expect the image of MD5 on its codomain is almost a bijection (would love to be demonstrated wrong here, if anyone knows of a paper that studies this, but it seems reasonable that any good hash would have this property).

This doesn't really protect against a dictionary attack, but to guarantee a collision, an attacker would still need to try approximately 2^128 passwords for each password in the database, which is already the worst case for the attacker, so no strength is really lost.

Re:What technical reasons are there to have low maximum pass... by drostie on Sunday March 31, 2013 @09:24AM (#5468576)
Here is the attack scenario: Alice is trying to login to server Bob, but her WiFi access point Eve is running a protocol-mismatch attack: Alice communicates to Eve by HTTP, which Eve records and then transmits to Bob by HTTPS. We'll assume that Eve does not inject her own scripts but just eavesdrops on the conversation.

Your problem: clientHash is "password-like" and Eve can use it to log in.

One solution: use the HTTPS auth methods. Unfortunately, this is not the standard in the industry because the GUI is ugly.

The reason why this is an even bigger problem than you might think: what does the login method do? It probably sets a "remember me!" cookie, which is also "password-like" for just about every purpose. Eve sniffs the cookie and can use it to compromise the account in the future.

Also the 'remember me' cookie is probably stored in the clear in the database. So much for that, eh?

What you really want is a system based on digital signatures: whenever I make a request I digitally sign it. But the core problem is that I don't want to type in my password for every damn request, so this is being cached between requests and between page views. Depending on how it's cached, there are vulnerabiities -- especially if you just have your browser automatically fill in the password blanks, but also if you carry these "password-like" login cookies. A system of delegation and revocation can be done, but you come dangerously close to reinventing a public key infrastructure if you go too far down this road.

HTTPS auth methods can help out quite a bit, but can be hard to set up with a custom backend and hard to test against that sort of "downgrade attack" I mentioned in my first paragraph. The best of these ideas is to give your users client certificates and thus be safe forever, but nobody has found it useful enough to actually do this.

The only real alternative has been to remind the customers to always look for the s in the "https:// in the location bar. This is stupid and now there are some proposals for browsers to ship with lists which are "Expected to be secure", to avoid it, but yeah, we never really outgrew it.

Re:What technical reasons are there to have low maximum pass... by just2n on Sunday March 31, 2013 @06:43PM (#5470473)
Thanks for explaining that.

So sitting here trying to think about a way to solve that problem, what I come up with is essentially PKI. But if the attacker has the ability to inject code, they can always break this entirely by stealing my private key.

This feels to me like URLs are fundamentally broken, in that a user might try to go to http://mybank.com. Is there any secure way to get their browser to redirect to https://mybank.com? It seems like there might be something that could be done with dnssec, but that feels brittle too. Gross.

Re:What technical reasons are there to have low maximum pass... by stouset on Monday April 01, 2013 @03:00AM (#5471870)
HTTP Strict Transport Security solves this.
Re:What technical reasons are there to have low maximum pass... by just2n on Monday April 01, 2013 @04:47AM (#5472069)
That only works if the user makes an https request first.

Say the URL is: https://mybank.com, but I go to http://mybank.com, and I haven't been there yet, so the STS rule isn't in my browser. How can a user reliably be switched to https without risk of having the connection hijacked by someone injecting code to the user?

Re:What technical reasons are there to have low maximum pass... by icebraining on Sunday March 31, 2013 @06:27AM (#5468295)
If you don't use SSL and the attacker can sniff the stream, chances are he can inject JavaScript to send him the password.

SSL is just indispensable nowadays for authentication.

Re:What technical reasons are there to have low maximum pass... by drdaeman on Sunday March 31, 2013 @09:13AM (#5468547)
And if you have SSL anyway, why use passwords when you can use certificates?
Re:What technical reasons are there to have low maximum pass... by icebraining on Sunday March 31, 2013 @04:56PM (#5470154)
Because users don't understand certificates?
Re:What technical reasons are there to have low maximum pass... by drdaeman on Monday April 01, 2013 @09:17AM (#5472807)
They didn't understood many other form of credentials either (like OpenID), but sites educated them and now they do.
Re:What technical reasons are there to have low maximum pass... by icebraining on Monday April 01, 2013 @11:01AM (#5473442)
They do? Are you sure of that?
Re:What technical reasons are there to have low maximum pass... by drdaeman on Monday April 01, 2013 @01:09PM (#5474384)
That depends on who the site's audience are and how the login UI's done. Fairly tech-savvy visitors certainly do understand OpenID and alike. At least, I strongly believe so. Well, more casual audience probably don't.

However, my bank uses X.509 certificates to authenticate users over Internet. Out of curiosity, I've asked bank employee once and was told that most users do manage their certificates just fine, without any issues. Obviously, bank provides short and simple manuals, which explain how to generate a certificate request, obtain a signed certificate (by visiting bank in person), authenticate and renew expiring certs.

(My bank's not using in-browser PKI due to legal reasons and provides a small piece of software wrapping around the browser, but that doesn't really matter.)

Re:What technical reasons are there to have low maximum pass... by ema on Sunday March 31, 2013 @04:55AM (#5468139)
Couldn't you solve that by hashing it again on the sever?
Re:What technical reasons are there to have low maximum pass... by codesuela on Sunday March 31, 2013 @12:59PM (#5469250)
I'm not sure about the added security benefit. Basically the only additional security is if someone gains access to your server they can't capture plain text passwords anymore but once someone gains access all bets are off and they might as well just switch out the Javascript. In any case you should run a strong hashing algorithm like bcrypt with a salt and oh I don't know 1000 iterations? Also last time I tried something like that (which was a few years ago) I ran into big problems with different hashing algorithm implementations providing different results (JS.md5("password") != Python.md5("password")).

Also please correct me if I'm wrong.

Re:What technical reasons are there to have low maximum pass... by quasque on Sunday March 31, 2013 @01:23PM (#5469351)
The added security benefit of server-side hashing is the same as if plain text passwords are sent, to prevent knowledge of the authentication secret if the database contents are disclosed to malicious third parties. The client side hash of the password is only to ensure that a fixed length secret is sent and subsequently processed, to avoid DoS attacks on the server.
Re:What technical reasons are there to have low maximum pass... by codesuela on Sunday March 31, 2013 @01:26PM (#5469358)
Ah I see, thanks for pointing that out. Haven't thought of it myself.