4 ms·
"salts alone can no longer save you" I use two salts to hash a password: sha1(SALT . SALT2 . $password); the second salt is unique for every user and stored i
by Misiek 15y ago
"salts alone can no longer save you"
I use two salts to hash a password:
sha1(SALT . SALT2 . $password);
the second salt is unique for every user and stored in a database.
Why is it not secure?
- gws 15y agoBecause it's stored in a database. If an attacker has access to the database with the hashed passwords she will likely have access to the database with the salt too.
- Misiek 15y agobut only the second salt is stored in a database, the first salt is stored under WWW-Root.
- gws 15y agoIt's still there on the server, if the attacker has her hands on the database you have to assume that the entire server might be compromised
- Misiek 15y agoWhat is the best way to secure passwords?
- gws 15y agoYou need to assume that the attacker will have access to anything on the server. So first thing is clearly no plain text passwords but hash only. Second thing is make as hard as possible for the attacker to decode the hash. One salt helps preventing use of rainbow tables but more salt is useless since the attacker has them. So you are left with choosing a hard algorithm to crack and currently the best one is bcrypt which is already implemented in most programming language for you.
- bonzoesc 15y agoBecause sha1 is still super fast on a GPU. Why aren't you using bcrypt?
- Misiek 15y agoI thought that hashing password with two types of salt (one of them is unique for every user) and two places to storage salts is secure enough.
- rmc 15y agoIn reality you arent using 2 salts, you are using one unique salt per user, each users salt starts with the same few bytes though.
- Misiek 15y agoyes, I put the first salt in database and the second salt under www-root. Hacker who hack the database only will not know the fist salt.
- leftnode 15y agoI think you have to assume worst case: if they have access to your database, they have access to your web root. It might not be the case, but you should assume that.