question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Support the creation of a unique salt for each user

See original GitHub issue

From http://crackstation.net/hashing-security.htm:

The most common salt implementation errors are reusing the same salt in multiple hashes, or using a salt that is too short.

Salt Reuse

A common mistake is to use the same salt in each hash. Either the salt is hard-coded into the program, or is generated randomly once. This is ineffective because if two users have the same password, they’ll still have the same hash. An attacker can still use a reverse lookup table attack to run a dictionary attack on every hash at the same time. They just have to apply the salt to each password guess before they hash it. If the salt is hard-coded into a popular product, lookup tables and rainbow tables can be built for that salt, to make it easier to crack hashes generated by the product.

A new random salt must be generated each time a user creates an account or changes their password."

Upon user signup, a new salt should be created and stored in the newly created User object.

If the application uses bcrypt, the best way to generate a salt would be as follows:

import bcrypt
salt = bcrypt.gensalt()

Issue Analytics

  • State:closed
  • Created 10 years ago
  • Comments:13 (5 by maintainers)

github_iconTop GitHub Comments

6reactions
ksdmitrievacommented, Oct 30, 2017

Agree with teloon. The name is missleading, because if the passlib is already generating the salt per user, why do we even need a static salt for the whole application? If it is a key to HMAC for the whole application, then it serves a different purpose. If the database is stolen (with the salts), then an attacker won’t be able to crack a specific password (targeted attack), because there’s the application HMAC key that is not stored in the database. This is a legitimate use. If that’s the purpose of that variable specified during the configuration time, then it should be noted so in the documentation.

5reactions
patrickyancommented, Mar 30, 2014

Could this be added to the documentation? It took me a while to decide whether or not to use Flask-Security, because I thought the documentation implied that only one salt was used for all users.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Adding Salt to Hashing: A Better Way to Store Passwords
Salts create unique passwords even in the instance of two users choosing the same passwords. Salts help us mitigate hash table attacks by ......
Read more >
Unique generated SALT for each user? - Stack Overflow
I'd like to ask if it's possible to generate a unique salt for each user and then hash it like sha1(sha1($password . $salt))...
Read more >
What does password salting do to protect against bad actors?
Password salting protects passwords by adding a unique string of 32 or more characters to them and then hashing them. Learn more about...
Read more >
How can I use a unique salt for each user
I'm creating a signup/login system (with node.js to be particular), and I'm trying to hash the user's password (with bcrypt), as well as...
Read more >
If I make the SALT random for each user, how do I ...
Salt is randomly generated for each user but it's saved somewhere in the database. You look up the salt for the ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found