I've been researching the methods of securely storing user passwords in a database (by only storing the hashed password, with a strong algorithm, along with a salt, and deriving the key after so many iterations, like pbkdf2). This is great for if my server ever gets hacked and my database stolen. But can't the hacker just change the passwords in the database directly, along with the salt used to generate them?

  • 2
    These are very generic questions that belong more in the realm of software architecture, and the answer would be long. As a start, you can build your app to have different DB users, schema's, hashes stored in separate tables/DBs, etc. Most websites just use one DB user for everything, so you can start there. You should also train the developers not to store passwords in their git repo, etc, etc. – Halfgaar Jul 1 '17 at 19:01
  • That's what I was thinking - like the password db on one server, and user information in a db on a different server. – user305964 Jul 1 '17 at 19:09
  • 2
    Different servers may be overkill for your application, but yes, Facebook probably does that. – Halfgaar Jul 1 '17 at 19:18
  • 2
    Another reason for protecting the passwords is that a lot of people re-use the same password on multiple sites - so a stolen list of usernames and passwords can be tried on multiple sites and result in break-ins. – Jenny D Jul 2 '17 at 12:42
  • I've updated my question to be more concise. – user305964 Jul 3 '17 at 17:26

Try this out it might interest you -


  • This is useful, Oron. I think I'm going to close this question as being too vague :( – user305964 Jul 3 '17 at 17:22
  • nvm - couldn't delete so reworded title of question. – user305964 Jul 3 '17 at 17:24

Not the answer you're looking for? Browse other questions tagged or ask your own question.