8 ms·
I use a unique random salt when hashing passwords in a db. This is combined with another salt I keep in my codebase. If the data in the db gets out, they stil
by t0pj 18y ago
I use a unique random salt when hashing passwords in a db.
This is combined with another salt I keep in my codebase.
If the data in the db gets out, they still do not have salt stored in my codebase (unless the entire server has been compromised).
Right or wrong? Any thoughts?
- pyroman 18y agoDefinitely better than what I was suggesting on the site.
- stcredzero 18y agoSo the unique salt has to be transmitted from the server to the client in order to do authentication? Why not just use a hash of the username?
- apgwoz 18y agowhy would you need to transmit the unique salt? why would you transmit anything other than the form to the client? all the checks would be done on the server side. a) user enters username/password b) server looks up in a file the unique string and appends it to the password c) server finds username's salted-password hash d) server extracts hash from stored salted-password hash (possibly the first 4 characters or whatever) e) server concatenates salt, plaintext password and unique string and hashes via sha-N/md5 f) server compares to stored salted-password and if same performs login. otherwise sends generic "invalid username/password combination" message.
- t0pj 18y agoThat's exactly what I'm doing. I think stcredzero is concerned about the plaintext password passing through the pipes. In this case, unique salts and hashes are used to simply protect the database; when the data is stolen, a rainbow attack will not effectively work. Hashing those passwords also protects the user who uses the same email/id/password everywhere; if your db is compromised, you don't also compromise the user's identity (e-mail accounts, banking, etc). It depends on the app, but I also think sending salts to the client and doing some md5/javascript in the browser is generally overkill.
- apgwoz 18y agoSSL certs are like $15/year. Not sure why people don't just get them instead of playing with md5/javascript...
- tptacek 18y agoCould not agree any more strongly about this. You still need to use bcrypt to store passwords, because you will eventually screw up Unicode and SQL on a complicated form somewhere and give up your whole password database. But if you're willing to spend ever a quarter person/day on password auth, there is no economy at all to skipping SSL.
- stcredzero 18y agoYou can't rely entirely on SSL. You're still vulnerable to man in the middle attacks, among other things.
- gojomo 18y agoCould you explain further what sort of MITM attack you mean for which SSL doesn't help? (Are you assuming users who don't insist on an SSL connection with a recognized domain?)
- stcredzero 18y agoDNS poisoning enables a MITM attack even if you're connecting to your safe, legitimate domain.
- brlewis 18y agoSSL throws all sorts of warnings if the cert doesn't match the domain.
- stcredzero 18y ago