TE
TechEcho
Home24h TopNewestBestAskShowJobs
GitHubTwitter
Home

TechEcho

A tech news platform built with Next.js, providing global tech news and discussions.

GitHubTwitter

Home

HomeNewestBestAskShowJobs

Resources

HackerNews APIOriginal HackerNewsNext.js

© 2025 TechEcho. All rights reserved.

“Username or password is incorrect” is bullshit

244 pointsby carlchenetover 7 years ago

33 comments

pornelover 7 years ago
The right answer isn&#x27;t a blanket &quot;sites should do this super-secret e-mail-only shuffle and not tell you anything&quot;.<p>First, you should define your threat model: which information is considered secret and which isn&#x27;t, and treat any violations as security vulnerabilities.<p>If usernames are public by design, then don&#x27;t hide them in one form, and expose in URLs elsewhere on the site.<p>If exposing who&#x27;s registered on your site really is a threat, then by all means have a weird registration (and password reminder) that doesn&#x27;t tell whether it worked or not. But if your site is for cookie receipies and you don&#x27;t consider exposing who&#x27;s a fan of cookies a privacy violation, then just use most helpful messages you can.
评论 #15988339 未加载
评论 #15987169 未加载
评论 #15988110 未加载
评论 #15987949 未加载
评论 #15988562 未加载
评论 #15987088 未加载
GlitchMrover 7 years ago
I have an argument for &quot;username or password is incorrect&quot; messages: it&#x27;s possible that the password is correct, username exists but isn&#x27;t the intended one. Then &quot;password is incorrect&quot; message would be lying, as the issue is actually with a username.
评论 #15986790 未加载
评论 #15986920 未加载
评论 #15987751 未加载
评论 #15987067 未加载
评论 #15986908 未加载
评论 #15988381 未加载
评论 #15986999 未加载
评论 #15990419 未加载
评论 #15986788 未加载
cdancetteover 7 years ago
Signup and login should behave the same, and provide no information wether the email is registered or not. And username should be treated as public.<p>So for login: always say &quot;email or password is incorrect&quot;.<p>And for register: as he said, always say &quot;we sent you an email to verify your email&quot;.
评论 #15987183 未加载
评论 #15986910 未加载
评论 #15986784 未加载
评论 #15986742 未加载
评论 #15986786 未加载
u801eover 7 years ago
Not quite on topic, but it would be nice if more websites would offer the option of using client side TLS certificate &quot;login&quot; with or without an additional prompt for a username and password.<p>It would be next to impossible for an attacker to bypass that. For example, even if the attacker provided the correct credentials, they most likely would not have the associated client-side TLS certificate private key. Then the server could just reject the log on attempt outright (since the certificate wasn&#x27;t provided or verified).
评论 #15987218 未加载
评论 #15987063 未加载
axman6over 7 years ago
Even if this doesn’t increase security, you should still do it in the hope the user will check the username they’ve just typed as well as retyping the password.
评论 #15986593 未加载
willvarfarover 7 years ago
The article explains how to do it properly at the end:<p>&gt; To prevent attackers from knowing whether an account exists or not your signup must only take an email address and provide no feedback in the UI if the sign up succeeded or not. Instead the user would receive an email saying they’re signed up.<p>Is this not also part of the various &#x27;best practices&#x27;? (I confess I don&#x27;t read too many of them!)
评论 #15986619 未加载
评论 #15986648 未加载
1ba9115454over 7 years ago
The solution is relatively simple.<p>1. Email and password for login. Don&#x27;t tell the attacker which is correct.<p>2. Email and password for registration. On registration send confirmation email. If user is already register attacker would need access to their email. Access to email is game over.<p>So now an attacker can&#x27;t see which users are registered with your service and you&#x27;ve protected your customers privacy.<p>Extra points if your code is aware of timing attacks.
评论 #15986812 未加载
评论 #15986732 未加载
davrosthedalekover 7 years ago
The title is &quot;bullshit&quot;. The real problem is that they leak the information they try not to leak anyway, on a different form. This is a common, but not universal, problem.<p>It&#x27;s not OK to leak information, even if that information is maybe leaked somewhere else already.
评论 #15986824 未加载
j_sover 7 years ago
Ask HN: Why does Amazon allow multiple accounts with the same email address? (2014) | <a href="https:&#x2F;&#x2F;news.ycombinator.com&#x2F;item?id=7075372" rel="nofollow">https:&#x2F;&#x2F;news.ycombinator.com&#x2F;item?id=7075372</a>
评论 #15993547 未加载
评论 #15987030 未加载
rafaelbarbosaover 7 years ago
It&#x27;s still good advice for software where there is no public signup, such as SaaS where accounts are created by administrators.
jkireover 7 years ago
Isn&#x27;t the other reason so that adversaries can&#x27;t tell if a particular username&#x2F;email has signed up? This is not so useful for something like github, sure, but certainly is useful for the more embarrassing sites where users have an expectation the site won&#x27;t leak their membership.<p>So in some ways I&#x27;ve always thought of this as a privacy concern rather than a security one?<p>Edit: I guess I&#x27;m thinking purely of emails where you don&#x27;t get availability checkers during sign up.
评论 #15986560 未加载
alexozerover 7 years ago
If you&#x27;re just trying to find a set of accounts with a weak password, isn&#x27;t it much more viable to use the sign-in page that shows &quot;invalid password&quot; instead of &quot;invalid username or password&quot; rather than dealing with captchas on the signup page? Assuming you can&#x27;t just find usernames as public profiles like on GitHub.
JansjoFromIkeaover 7 years ago
There&#x27;s definitely a trend away from this to some degree lately, I feel. It&#x27;s probably more influenced by Google not doing it with their accounts (enter username -&gt; forwarded to password page with your avatar) more than anything else, mind.
styfleover 7 years ago
I asked this same question[0] on StackExchange earlier this year. It has been asked many times and it really comes down to considering a username a secret or not.<p>In B2B applications where there is no registration form, then the username is probably a secret. In B2C applications where anyone can register, then the username likely isn&#x27;t a secret. Many of those applications have the concept of &quot;mentions&quot; by username so clearly the username is not considered a secret in that case.<p>[0]: <a href="https:&#x2F;&#x2F;security.stackexchange.com&#x2F;q&#x2F;158075&#x2F;11536" rel="nofollow">https:&#x2F;&#x2F;security.stackexchange.com&#x2F;q&#x2F;158075&#x2F;11536</a>
rawnlqover 7 years ago
Try searching for your username on <a href="https:&#x2F;&#x2F;namechk.com&#x2F;" rel="nofollow">https:&#x2F;&#x2F;namechk.com&#x2F;</a> <a href="https:&#x2F;&#x2F;www.namecheckr.com&#x2F;" rel="nofollow">https:&#x2F;&#x2F;www.namecheckr.com&#x2F;</a> <a href="http:&#x2F;&#x2F;checkusernames.com&#x2F;" rel="nofollow">http:&#x2F;&#x2F;checkusernames.com&#x2F;</a> or <a href="https:&#x2F;&#x2F;pipl.com" rel="nofollow">https:&#x2F;&#x2F;pipl.com</a>. I am sure these name checkers can&#x27;t be built if they have to spam the sign up forms just to check availability (at least not for free if they have to pay for manual recaptchas).<p>The privacy is worth it.
rmetzlerover 7 years ago
This is actually a feature for users who have almost the same username and mistype this instead the password. E.g. this could probably happen through an unfamilar kayboard layout.<p>I understand that a lot of people think this is a security feature, but once upon a time it was the lazy programmers answer when &quot;SELECT * FROM users WHERE username=? AND password=?&quot; didn&#x27;t return a result.<p>With proper salts for hashed passwords you now have to find the username, use the salt to hash the password and compare this. If your database allows to hash passwords with a dedicated function it&#x27;s still the easiest to say username OR password must be wrong.
oliwarnerover 7 years ago
Stripe does it wrong, so it&#x27;s wrong everywhere? Nah. <i>That&#x27;s</i> bullshit.<p>For emails, you can very easily fake a second signup with the same email and ping out an enhanced verification email &quot;Somebody just tried to register with this address but you already have an account&quot;.<p>Building the username into that flow is harder. That&#x27;s why I preference not having separate usernames but some people would argue this is itself a bad thing (removing a factor or somesuch).<p>Either which way, <i>Stripe&#x27;s approach is broken</i>. That doesn&#x27;t make the whole idea nonsense.
kuceramover 7 years ago
Here is a super useful article about how you should build login <a href="https:&#x2F;&#x2F;blog.codinghorror.com&#x2F;the-god-login&#x2F;" rel="nofollow">https:&#x2F;&#x2F;blog.codinghorror.com&#x2F;the-god-login&#x2F;</a> (if you don&#x27;t want to rely on professionals from Auth0 or Okta :-). In the article, there is a very good statement &quot;being user friendly is way more important than being secure&quot; and this is exactly this case also...
sika_grrover 7 years ago
&gt; Even if reCAPTCHA was perfect, a hacker could manually validate their usernames of interest by trying to sign up, then automate an attack on the sign in page.<p>Why is imperfect reCAPTCHA worthless? Do sign up pages even allow brute forcing of usernames (once validated)?<p>Is he suggesting to fix sign up pages, or to allow brute forcing usernames on login?<p>His writing style is dramatic, but the arguments are very weak.
kyberiasover 7 years ago
I like the dramatic style this opinion is written.
评论 #15986733 未加载
exabrialover 7 years ago
My other favorite security theater advice is locking an account after x number of failures. How could this used for anything but DOS?<p>Depending on the service that&#x27;s being protected, rate-limiting to 5 minutes between attempts, alerting the owner, and assigning them a temporary username seems more reasonable countermeasures to me.
z3t4over 7 years ago
After reading this I went straight to change the login system I&#x27;m currently working on ... And discover that I would need to add some extra code paths &#x2F; conditionals ... So for me it&#x27;s not &quot;best practice&quot;, it&#x27;s more todo with laziness and not wanting to add complexity to critical functions.
skywhopperover 7 years ago
This is a pointless argument because I doubt Github or anyone who uses this message seriously considers it to be a security measure. Github&#x27;s usernames are absolutely public. But they also have so many users that I suspect the wrong username is typed all the time. So yes, sometimes maybe the username is wrong.
zanedbover 7 years ago
I have felt this same way for so long and I&#x27;m really glad someone finally wrote about it.
dreamdu5tover 7 years ago
What’s the point of having passwords at all? If there’s a password reset mechanism they provide no additional security. Just send a one time login token to the email.<p>Having a password just increases the odds of a hack by the user accidentally exposing it.
评论 #15993563 未加载
hbk1966over 7 years ago
Also if you are doing the username&#x2F;password is incorrect you should also add an artificial delay if it&#x27;s the username is wrong. Because you can tell which one is wrong my seeing how long it takes the server to respond.
samnwaover 7 years ago
I suggest we just randomly say your username or password is incorrect.<p>&quot;Your username is incorrect&quot; &quot;Your password is incorrect&quot; &quot;You hit the wammy. Try logging in again.&quot;<p>That way, you never know what&#x27;s going on at all.
chicobover 7 years ago
In the article: &quot;You gain no security, yet your customers lose clarity.&quot;<p>Oh boohoo. Like it&#x27;s not on the customers side to know which email it is and which password.<p>And as many have said, one does gain privacy.
godzilla82over 7 years ago
So, as per the author, sites should first check if the user exists and then check the password? Why? What if the username belongs to someone else?
27182818284over 7 years ago
Lately I&#x27;ve seen the catch-all &quot;We could not verify the credentials you entered&quot; and it has grown on me a lot.
scotty79over 7 years ago
... also, you can often do &quot;Forgot my password&quot; and if you give unregistered email it will tell you that.
vatotemkingover 7 years ago
Doesnt “username or password is incorrect” falls into the Security through obscurity category?
observationover 7 years ago
Good point. I&#x27;m embarrassed it didn&#x27;t occur to me before.