News for hackers. Stuff that matters.
Re:The God Login by laurencei on Friday January 09, 2015 @08:39AM (#8862152)
The author refers to "Handle common user mistakes" - by displaying a message "your caps lock is on".

Personally I love the Facebook approach. Facebook just accepts passwords with caps lock inverted, so you never have the problem in the first place. No need to display a message to the user.

Link: http://www.zdnet.com/article/facebook-passwords-are-not-case...

Re:The God Login by epochwolf on Friday January 09, 2015 @09:23AM (#8862305)
One snag, on Macs capslock works differently. It doesn't invert when you press shift. Shift + A with capslock on will still result in an uppercase A.
Re:The God Login by shawabawa3 on Friday January 09, 2015 @09:48AM (#8862399)
I'm not sure about facebook but I believe blizzard (WoW/Diablo/etc) ignores case completely in all passwords
Re:The God Login by pcnc on Friday January 09, 2015 @10:08AM (#8862487)
Blizzard also has an upper limit of 16 for the length of the password.
Re:The God Login by Glide on Friday January 09, 2015 @12:11PM (#8863115)
What? I know I have to put in upper case for my password for WoW.

They also have authenticators before a lot of other people had them. And please use one if you do. Battle.net accounts are targets.

Re:The God Login by d_k_f on Friday January 09, 2015 @01:57PM (#8863700)
Unless they changed their entire auth mechanism, it's definitely case insensitive.

IIRC, the client encrypts the password using some variant of SRP6 plus some additional magic, but the last time I dabbled in wow emulation was quite some time ago.

EDIT Here's a link to a moderator confirmation: http://eu.battle.net/wow/en/forum/topic/2679778775#3

Re:The God Login by jimminy on Friday January 09, 2015 @12:50PM (#8863296)
>What? I know I have to put in upper case for my password for WoW

You don't have to do that, my password has capitals, but after I found out the shift the alphas to only one case I stopped typing the caps.

Re:The God Login by Strilanc on Friday January 09, 2015 @09:48AM (#8862403)
Giving the attacker two ciphertexts, where their plaintexts are related by a simple function, sounds like the sort of thing that breaks cryptosystems.

So I hope they're canonicalizing the password casing instead of storing the hash of both possibilities.

Re:The God Login by jamessb on Friday January 09, 2015 @09:53AM (#8862427)
Why would they need to store the hash of both possibilities? They can simply invert the case of what the user types before hashing it - ie. compare both hash(enteredPassword) and hash(invertCase(enteredPassword)) to the hash in the database and see if either match.
Re:The God Login by Strilanc on Friday January 09, 2015 @04:07PM (#8864523)
Ah, good point. The overhead of doing two checks isn't that high.
Re:The God Login by jimktrains2 on Friday January 09, 2015 @10:12AM (#8862504)
They could also just ignore case: hash(upper(password)) so there is only ever one hash (that happens to map to multiple input passwords) instead of multiple hashes relating to a single password each.
Re:The God Login by WA on Friday January 09, 2015 @11:09AM (#8862782)
But this is less secure than storing the properly hashed password. This would reduce the space of all passwords to upper case letters (plus whatever symbols and numbers are allowed) only.
Re:The God Login by eterm on Friday January 09, 2015 @11:23AM (#8862854)
It is however the approach battleNet (Blizzard - World of Warcraft) take, their password is completely case insensitive.
Re:The God Login by jimktrains2 on Friday January 09, 2015 @03:11PM (#8864214)
Yeah, I'm being downvoted for pointing out the method some places use. It's terrible to have anything but a minimum length requirement IMHO. Making it password insensitive is nice for users, but does make the resultant search space much smaller (to the point that I don't think the convince for users trumps, especially given the UI can inform them if they have caps lock on to begin with).
Re:The God Login by WA on Friday January 09, 2015 @05:42PM (#8864959)
Which is weird, too. I wrote an email once to Blizzard, asking why they also have a maxlength for the password. This doesn't mean anything, but it could be an indicator for password = VARCHAR(16). Makes no sense whatsoever to restrict the length of a password, especially in such a large network. Never got a reply though.
Re:The God Login by quakkels on Friday January 09, 2015 @10:24AM (#8862551)
I suspect that Facebook still wants to know that some letters have a different case than other letters. If They just converted all letters to uppercase then that information would be lost.
Re:The God Login by ciderpunx on Friday January 09, 2015 @01:38PM (#8863585)
Sure, I think that this means that the try the normal case and the flipped case.

> ie. compare both hash(enteredPassword) and hash(invertCase(enteredPassword)) to the hash in the database and see if either match

Here's an example in bash:

  $ echo PasSwoRd | tr 'A-Za-z' 'a-zA-Z'
  pASsWOrD
In the database store one variant

  $ echo PasSwoRd | tr 'A-Za-z' 'a-zA-Z' | sha256sum > db
Then you can test both on input

  $ echo PasSwoRd | sha256sum > sum1
  $ echo PasSwoRd | tr 'A-Za-z' 'a-zA-Z' | sha256sum > sum2
  $ diff -q db sum1
  Files db and sum1 differ # i.e. LOGIN FAILS
  $ diff -q db sum2
  $ # i.e. LOGIN SUCCEEDS
The problem with the caps lock behaviour on Macs is harder. You definitely don't want to force to uppercase!
Re:The God Login by wlesieutre on Friday January 09, 2015 @10:52AM (#8862691)
Do you know how they handle caps lock on Macs then? When caps lock is on, it types in caps even with shift.
Re:The God Login by iso8859-1 on Tuesday January 13, 2015 @09:08PM (#8883868)
Who says they can't check 3 times? Original, caps inverted and uppercase? This would make sense. You could even make it try neighboring keys on common key layouts. If the hash has enough bits of security then good passwords will still not break.
Re:The God Login by onion2k on Friday January 09, 2015 @08:53AM (#8862190)
That's a good approach for usability but it does halve the keyspace for anyone attempting a brute force attack. It might not be appropriate everywhere.
Re:The God Login by ZoFreX on Friday January 09, 2015 @08:56AM (#8862207)
Halving isn't really a big issue, when we're talking about something that normally talk about in exponents.
Re:The God Login by lost_my_pwd on Friday January 09, 2015 @09:14AM (#8862271)
Not if, when caps lock is detected, the case is inverted before submitting.
Re:The God Login by Rinum on Friday January 09, 2015 @09:31AM (#8862334)
I purposefully create passwords with caps lock on, what then?
Re:The God Login by jephir on Friday January 09, 2015 @09:39AM (#8862366)
> I purposefully create passwords with caps lock on, what then?

I think he means doing it on the server, i.e. checking the password as-is, if that doesn't work, then check it with case inverted.

Re:The God Login by mark-r on Friday January 09, 2015 @05:37PM (#8864935)
The best way to handle this is not to modify the entered password, or to reject it, but rather to just display the message. If it stands out enough you should notice it and make the corrective action yourself. In your case no corrective action would be necessary.
Re:The God Login by sp332 on Friday January 09, 2015 @09:45AM (#8862389)
It does "halve" the keyspace, by removing one bit of entropy from your password. This is assuming you only use letters in your password and not numbers or other symbols not affected by capslock.
Re:The God Login by bnegreve on Friday January 09, 2015 @10:40AM (#8862639)
Well, it's a bit tricky. Two inverted passwords still have different hashs. From that perspective, two inverted passwords are not equivalent and therefore the entropy is not decreased.

This is important because if you want to decode a hashed password using a rainbow table for example, you still have to hash the entire keyspace, not just half of it.

Edit @sp332: Exactly. That was my point.

Re:The God Login by sp332 on Friday January 09, 2015 @10:46AM (#8862666)
If you're doing an online attack, you can submit half as many passwords. I guess it's just as hard for an offline attack where you're cracking the database of hashes.
Re:The God Login by ChrisLomont on Friday January 09, 2015 @11:18AM (#8862836)
It cuts it vastly more than in half.

For n character alphabetic values, it reduces the keyspace from 52^n to 26^n.

Re:The God Login by stouset on Friday January 09, 2015 @12:16PM (#8863139)
That would be for case-insensitive matching, not matching on the case being inverted.
Re:The God Login by 0942v8653 on Friday January 09, 2015 @03:46PM (#8864408)
That's only if it works with Mac-style caps lock.
Re:The God Login by wzsddtc on Friday January 09, 2015 @12:21PM (#8863158)
For the 2 matching cases, it only reduces to 51^n
Re:The God Login by RossM on Friday January 09, 2015 @09:40AM (#8862369)
It might be nice to do it client-side.

    var caps = null;
    passwordField.onkeypress = function(e) {
        if (caps !== false) {
            var s = String.fromCharCode(e.keyCode || e.which);
            caps = s.toUpperCase() == s && !e.shiftKey;
        }
    };
    loginForm.onsubmit = function(e) {
        if (caps) {
            passwordField.value = invertCase(passwordField.value);
        }
    };
Re:The God Login by iso8859-1 on Tuesday January 13, 2015 @09:15PM (#8883888)
No. Now you won't be able to log in if you signed up without JavaScript, or if you paste your password into the form field.
Re:The God Login by jenscow on Friday January 09, 2015 @06:38PM (#8865180)
What if they used caps-lock on purpose?
Re:The God Login by nmc on Friday January 09, 2015 @08:56AM (#8862205)
This "Facebook approach" almost certainly requires you to have, at least once, access to your users' non-hashed passwords.

Which is widely regarded as bad security practice because your users' passwords can be compromised by an attacker getting read-only access.

[EDIT] Well, good thing I used "almost", since I was wrong: of course, case-inverting the password and hashing the result could also be done client-side, silly me!

[EDIT'] Answers pointing out that you always have access to non-hashed passwords, and I believe this is wrong. When the user submits their password, it SHOULD be hashed client-side and only the hash SHOULD be sent to you.

Re:The God Login by ZoFreX on Friday January 09, 2015 @10:11AM (#8862497)
> When the user submits their password, it SHOULD be hashed client-side and only the hash SHOULD be sent to you.

No. If you are going to do something like this, do it properly with something like a zero-knowledge password proof.

As you describe it you are introducing a huge flaw: If your password database leaks, an attacker now has everything they need to log in to user accounts, no password hash attacking required.

Re:The God Login by varikin on Friday January 09, 2015 @09:03AM (#8862232)
You always have access to the user's unhashed passwords when they submit it. In authentication, hash the raw password and invert case and the hash that. Then compare the stored hash against both hashed passwords from the input.

There is no need to store the password in plain text in any form.

Re:The God Login by Someone on Friday January 09, 2015 @12:19PM (#8863154)
If you send a hash instead of a password, that hash _is_ your password. If I steal the hash but not the string it was derived from, I can pretend to be you and log in.
Re:The God Login by maaarghk on Friday January 09, 2015 @08:59AM (#8862216)
You do have access to their non-hashed password. When they type it into your form and press enter. You just invert the case and check it against the hash again.
Re:The God Login by k__ on Friday January 09, 2015 @09:41AM (#8862375)
Why not including the lowercase into the hash-algorithm?
Re:The God Login by MartinCron on Friday January 09, 2015 @10:05AM (#8862478)
A hashing algorithm specifically for passwords that would hash to the same thing based on inverted caps lock or other deterministic user errors (white space at the edges, maybe)? That sounds like a great idea.
Re:The God Login by akerl_ on Friday January 09, 2015 @01:10PM (#8863414)
If you hash the password client side, then the hash is the actual password and the server still sees the actual password.
Re:The God Login by dsacco on Friday January 09, 2015 @09:10AM (#8862257)
You're right that it's bad to store non-hashed passwords, but your point about security is unfounded.

Facebook, and any other company you'll log in to, requires a non-hashed password at some point to check against the hash. You need a cleartext password at some point, otherwise the user can't send anything to you.

The best practice for security is to not store passwords in cleartext. You can certainly perform extremely limited actions on passwords in cleartext (like hash checking), and you inevitably have to.

Which brings me to my overall point - as the Facebook security team has explained before on their whitehat page, you do not practically reduce security by allowing caps lock inversion to check a hash.

What you're saying about Facebook having an abnormal process also isn't true either - Facebook does one of two things, both of which are secure:

1. Stores two hashes for each password, one the real password and the other the case inverted, or

2. Checks a password against a hash, and inverts the case and checks again if it fails.

There is nothing about this which is different from normal password transmission in cleartext, and Facebook doesn't store the cleartext password you send them.

EDIT to your EDIT:

No, no no no no, no. Don't do clientside things like that. Allowing a user to directly manipulate something as major as whether or not their password is hashed before it is sent to you is bad. It doesn't even matter that it's just them hacking themselves; it's just bad form to put that in their browsers' hands. Plus, a stored cross-site scripting error that went viral on the login page pre-auth could screw your password database, leading to a layup for mass cleartext password compromise. Or in a worse scenario, you're giving a user direct write access (and then maybe reads) to the password database.

It's much safer to do the industry best practice of destroying cleartext sensitive information upon successful hash.

Say no to clientside security. There are arguments for hashing clientside, but they can all be summed up by "You shouldn't let people potentially sniff users' passwords" - if you implement TLS/SSL correctly, this won't be an issue and the cleartext password will exist briefly, then get destroyed.

The one other argument is that someone could compromise the server handling the hashing process and write a script watching all the passwords. But this isn't a valid concern - if someone has backdoored your login server, it no longer matters if passwords are cleartext for the damage they'll do. The level of difficulty you introduce by having passwords hashed originally becomes moot at that point.

Finally, consider that a client-side hash of a password sent to a server becomes the effective password for that user, not the hash of the password. This means that, effectively, if no other action is done at the server, you're actually then storing the password in plaintext. If a user was MITM'd while sending the password, the hash can now be sent directly to the server in place of the user's password, because it is the de facto password.

The bottomline: client-side hashing offers no real addition to overall security posture under TLS/SSL, and removes most of the benefit of hashing.

Re:The God Login by wtbob on Friday January 09, 2015 @12:53PM (#8863313)
> Facebook, and any other company you'll log in to, requires a non-hashed password at some point to check against the hash. You need a cleartext password at some point, otherwise the user can't send anything to you.

No, they really don't need that. C.f. SRP (http://srp.stanford.edu/) and similar protocols, where the end user performs a local calculation and the remote party is able to verify identity without ever knowing the password.

This could be the workflow:

1. User enters email address at site. 2. Site sends an email containing a URL with a 512-bit query parameter (yes, this means that user's ISP—and anyone else with access to the email—could sign in once). This parameter might be HMAC(secret, address), enabling the server to store no state for unverified users. 3. User visits URL, and sees a form for email address and password entry. There are hidden fields for the crypto parameters. 4. The user's browser takes the user's address and password, generates a random salt, and calculates a function of the crypto parameters and the local CSPRNG to get the salt a function of the address, password and crypto parameters to get the password verifier. 5. The user's browser POSTs (address, salt, verifier) to the server

Then whenever the user logs in, the browser and server engage in the SRP exchange.

The server never knows the client's password, ever. Nor is someone who knows the verifier able to forge the password.

The best practise is never to transmit sensitive data in the first place.

Re:The God Login by ceallen on Friday January 09, 2015 @10:42AM (#8862641)
> if someone has backdoored your login server, it no longer matters if passwords are cleartext for the damage they'll do. The level of difficulty you introduce by having passwords hashed originally becomes moot at that point.

If your hacker has a cleartext password and their login ID (email address), you've just given the hacker access to a bunch of their other accounts on non-compromised sites (for the significant % of your userbase that recycles passwords). I think the possible collateral damage creates a far more severe worst-case scenario.

Re:The God Login by mentat on Friday January 09, 2015 @11:10AM (#8862787)
If they have access to your server they can inline javascript that will do the same thing on the client. The client is not secure, ever. If the users are reusing passwords, it's not something you can same them from except not saving the cleartext password yourself. Database attacks are different from on line interception.
Re:The God Login by dsacco on Friday January 09, 2015 @11:07AM (#8862767)
That's a fair point, though it doesn't outweigh the myriad other reasons not to do client-side hashing.

Security is always a battle of usability and tradeoffs. Client-side hashing simply doesn't make sense for security. It removes the fundamental point of the hash in the first place and introduces an avenue for possibly attacking or manipulating your database.

In fact, there's hardly ever a reason to do client-side security.

Re:The God Login by mentat on Friday January 09, 2015 @11:11AM (#8862795)
Perhaps you can quality "client-side security"? You mean never trust the client right?
Re:The God Login by dsacco on Friday January 09, 2015 @11:23AM (#8862855)
Yes, that's exactly what I mean. Treat all user-input (and by extension, client-side anything) as dangerous. A server putting a security protocol in the hands of the client when it is not unavoidable is usually bad.
Re:The God Login by stouset on Friday January 09, 2015 @12:34PM (#8863216)
Hashing client-side is not a good idea in practice — a leak of your password database leaks direct credentials for logging in. If you're going to go this route, something like the zero-knowledge SRP protocol is necessary.
Re:The God Login by kibwen on Friday January 09, 2015 @09:01AM (#8862226)
Assuming that you run your own login service like Facebook does, you always have access to your user's passwords at least once because at some point you have to take the raw password and hash it. Facebook just creates two variations of the user's password and stores the hashes for all three of them.
Re:The God Login by ssmoot on Friday January 09, 2015 @09:18AM (#8862286)
All three of them? The Hash for the password as-typed, another for as-typed.invert(). What's the third? I feel like I'm missing something obvious. :-/
Re:The God Login by plorkyeran on Friday January 09, 2015 @10:09AM (#8862493)
First letter uppercase, for mobile devices that default to shift being on for just the first letter.
Re:The God Login by andrewaylett on Friday January 09, 2015 @09:52AM (#8862425)
Mac-style caps-lock, which doesn't invert again with shift, and PC-style, which does.
Re:The God Login by TheCoelacanth on Friday January 09, 2015 @10:31AM (#8862591)
Possibly for the two different types of caps lock. The kind that inverts the case of everything and the kind that makes everything uppercase.
Re:The God Login by ssmoot on Friday January 09, 2015 @01:12PM (#8863421)
I never noticed that. (I switched to Macs around 8 years ago.) Huh.

In that case I guess I have to wonder what the point is? Why store three hashes as opposed to just upper-casing the plain-text before hashing? You end up storing fewer variations, and it makes no functional security difference to the front-end (since any attacker would just .toUpperCase() their inputs anyways)?

At least best I can reason.

Re:The God Login by vertex-four on Friday January 09, 2015 @09:13AM (#8862269)
> Answers pointing out that you always have access to non-hashed passwords, and I believe this is wrong. When the user submits their password, it SHOULD be hashed client-side and only the hash SHOULD be sent to you.

If you insist on doing this, you can always invert it and hash it on the client side, and send both hashes. You still have access to it, just on the client's computer (running your own code).