3 ms·
Session ids != usernames/passwords. Not even close. Why? * Re-use across sites: people unfortunately reuse passwords across services. That means that getting
by mooreds 5y ago
Session ids != usernames/passwords.
Not even close. Why?
* Re-use across sites: people unfortunately reuse passwords across services. That means that getting access to these cookies would be great for credential stuffing attacks. A session identifier is no use for that type of attack.
* Re-auth across devices: you can't typically exchange a session for another session on a different device, but you sure can do so with a password.
* Session ids can be revoked with less user impact (they have to log in again). Passwords can be revoked too (it's a password reset), but it impacts users far more.
As other comments mention, passwords should be manipulated in memory, only stored hashed and salted by a strong algorithm, and seen by the bare minimum of software. Preferably handled by software designed for handling passwords and other sensitive credentials. There are commercial options, free options, and open source options.
(Full disclosure, I work for an auth company.)
- nirui 5y agoThere are considerations on the performance as well. Usually, a responsible website will password-hash the plain-text password into a hashed string before saving the hashed string into their storage. Password-hash is a special hashing process designed to be reasonability slow, so an attacker who somehow obtained the hashed string cannot easily collide the hash with another plain-text. Some password-hash configuration can took few milliseconds to run, that's really expensive if you have to do that for every request just so you can compare the client password-hash v.s. the one stored on your server. (Full disclosure, I designed few session manage systems for my job before :D)
- mooreds 5y agoThat's a great point. Hashing makes it more painful to credential stuff. I had a colleague write a few thousand words on the topic: https://fusionauth.io/learn/expert-advice/security/math-of-password-hashing-algorithms-entropy https://fusionauth.io/learn/expert-advice/security/math-of-p...
- megous 5y ago* Re-auth across devices: you can't typically exchange a session for another session on a different device, but you sure can do so with a password. Ever had Google deny you access for a perfectly valid username/password combo when loging in from "unfamiliar" location? :) Or a bank ask you for SMS code when logging in from a different browser? It really depends on level of paranoia of the authentication system. You can have user device validation even with username/password, and you may not have it for session IDs in a different implementation.
- mooreds 5y agoThat's a fair point. I guess I was speaking in the more general case, but yes, you can have multiple layers of authentication and it is super implementation dependent. Everyone has their own threat model (hopefully!). (I wrote a few thousand words on MFA a year or so ago: https://fusionauth.io/learn/expert-advice/authentication/multi-factor-authentication https://fusionauth.io/learn/expert-advice/authentication/mul... )