111

Lets say a user is logging into a typical site, entering their username and password, and they mistype one of their inputs. I have noticed that most, if not all, sites show the same message (something along the lines of, "Invalid username or password") despite only one input being wrong.

To me, it seems easy enough to notify the user of which input was wrong and this got me wondering why sites do not do it. So, is there a security reason for this or is it just something that has become the norm?

bobble14988
  • 1,375
  • 3
  • 9
  • 12
  • 10
    For websites which offer a different way to see if a user exists, there is no security gain. They're just being annoying. – CodesInChaos Jul 30 '12 at 11:47
  • Non security reason: If the database contains salted and hashed passwords, determining that the password matches an existing one would require hashing the password provided with every salt (1 per user, we hope) in the database. – Matt Jul 30 '12 at 14:14
  • 30
    One totally non-security related reason is that it's possible the provider doesn't know which was wrong. E.g. if bob1@provider.com mistypes his user name as bob2@provider.com and there really is another user bob2@provider.com. – Mark Beadles Jul 30 '12 at 14:24
  • @MarkBeadles ... the logon entity won't know if the username is valid? You might have to explain that one more... – schroeder Jul 30 '12 at 14:37
  • 13
  • BOB1@PROVIDER.COM mistypes id as "BOB2@PROVIDER.COM" and types his (own) password correctly
  • A user BOB2 exists in the user store
  • logon entity thinks that BOB2 mistypes his password, when in reality BOB1 mistyped his username.
  • – Mark Beadles Jul 30 '12 at 14:54
  • 6
    I would agree that it is for security reasons. I don't know any website where the username is supposed to be secret. As an example: Google does the "Username and/or Password Invalid" thing but you can still find out if a username exists (by trying to register it). – João Portela Jul 30 '12 at 18:57
  • 8
    @JoãoPortela, but the creation screen is guarded by captcha. Thats the difference. – user606723 Jul 30 '12 at 20:18
  • 3
    Occam's Razor says: Programmers are lazy. :) – Affe Jul 30 '12 at 20:20
  • 1
    @JoãoPortela not all systems allow you to self-register automatically. – Bruno Jul 30 '12 at 20:47
  • Because hackers can easily hack the accounts if they know any one thing correctly – Venkatesh S Jul 31 '12 at 07:24
  • 1
    @user606723 fair point (I had forgotten about that). Still: your username is your email, which makes it very much public. – João Portela Jul 31 '12 at 09:29
  • @Affe yes, but you still see this behavior in systems with public usernames where the "it's for security" reasoning does not apply. As such there must be another reason... Maybe it's just because everyone else is doing it. – João Portela Jul 31 '12 at 09:30
  • Even if system allows to check if account exists in some other way, this would still slow down bruteforcing by amount of those requests. – Oleg V. Volkov Jul 31 '12 at 14:55
  • 2
    @JoãoPortela, consider this: If gmail allowed you to figure out if a userid exists without captcha, they'd allow spammers a way to harvest legit email accounts. And you're right, if there are cases where userid's are completely public, then it's likely by convention. Why should your website code not support both occurrences? – user606723 Jul 31 '12 at 17:23
  • @user606723 In the mean time I read ExpectoPatronum and similar ones and it makes a lot more sense. I just wasn't buying the whole: "after they know the username they just have to guess the password" thing. – João Portela Jul 31 '12 at 17:28
  • 2
    @user606723 In the case of Google, the captcha is there for signing up (like submitting the form), the validation is done via AJAX. You can see the URL, and the POST parameters, and the headers, so the hidden usernames are not the issue. – jadkik94 Jul 31 '12 at 18:09
  • @MarkBeadles The possibility of the user mistyping the username and submitting is extremely rare. Divide it by a billion and get the possibility of the mistyped username matching the one of another user. However, when the user base is huge (like Google's or Yahoo's) the possibility of this happening is higher. But even then, when bob1 mistypes bob2, without knowing he's actually bob1, the site could say "Password invalid for bob2" and the user will get the problem. – Zippo Jul 31 '12 at 21:37
  • 1
    Some sites will tell you if the email address you've given already exists in their system when registering (sometimes pointing you towards the password reset function). Can anyone shed some light on how this isn't giving a malicious user another way to discover valid usernames? (I'm not talking about informative JavaScript prompts, etc. solely here) – Adam Lynch Aug 01 '12 at 11:30
  • Just adding more to the fire: facebook actually tells you when the username does not exist. :) – João Portela Aug 02 '12 at 17:51
  • So does Microsoft: "That Microsoft account doesn't exist. Enter a different email address or get a new account." / "That password is incorrect. Be sure you're using the password for your Microsoft account." – bwDraco Apr 29 '13 at 01:16