Remix.run Logo
tialaramex 14 hours ago

> I don't know the details of the login system for Hacker News, but i would expect they learn "a hash of your password and some salt" for every login

No. That would be a terrible idea and so that's not what they do. You can go see for yourself, it's an HTML form, the text field with your password in it is submitted to their web server, much in the same way this larger field full of comment text was sent.

If you think a bit harder you'll realize why your approach would be a bad idea. A bad guy who has obtained the password hashes (for example by dumpster diving, or an SQL extraction) can just play back a hash they've seen without ever knowing your password, you've rendered the knowledge of the password useless.

Yes, that means if you've been around long enough, sites which had passwords but did not use TLS or before that SSL, were sending your actual password, unencrypted, for any snoop to see. That might seem crazy, but because I'm an old man when I first used the Internet it was normal to send your password, letter by letter in plain text, to connect to a remote Unix machine. The "Secure Shell" you take for granted today did not exist until July 1995.

fc417fc802 13 hours ago | parent [-]

That's not a bad idea and I believe it is how any modern not-a-website password based authentication works. Agreed that it does not address the attack vector of someone sniffing your password for site A and then logging into site A with it. However a key stretching algorithm (as opposed to just a hash) combined with salt does protect against an attacker logging into site B if the user reused his password.

Of course for a website and assuming TLS then in practice it doesn't make much difference whether the hashing takes place client side or server side since an attacker sitting on the server could presumably serve up a compromised frontend. And without TLS a MITM could again compromise the frontend. But hashing client side does at minimum prevent the service operator from accidentally logging plaintext passwords, and anyway not all services are web apps. An attacker can't trivially change out the frontend if it's an app on my phone.