Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Why is it considered secure to store a random salt in a database with the user's password digest?

In the light of the big LinkedIn password leak, I've been thinking about password security. The web development frameworks that I have worked with in the past typically store a master, application-level salt as an app constant, then salt all user passwords with that value (randomly generated on a per-app basis). e.g. in pseudo-code: password = hash(App::salt + userPassword).

I've read a lot of advice that suggests generating a random salt for each user, then storing that in the database along with each user's password. My question is, how does this increase security? If an attacker procures a list of password digests from the database, they are likely also able to get the salt as well, right? Or is there some attack vector that I don't know of that will get password digests without access to the rest of the table?

like image 905
rybosome Avatar asked Dec 07 '25 12:12

rybosome


1 Answers

Storing random salt for each user defeats Rainbow table attack.

In case of a "master salt" it is still possible to precompute such table and use it in the attack. With a per-user salt this becomes impractical.

like image 54
Sergio Tulentsev Avatar answered Dec 11 '25 09:12

Sergio Tulentsev



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!