SY0-701 Question 41
Single answerHashing: SaltingA security administrator is reviewing a recently deployed customer portal after an internal audit found that several users with identical passwords also have identical password hashes stored in the database. The development team says they are already using SHA-256 to hash passwords before storing them. The administrator needs to recommend a change that best reduces the risk of attackers using precomputed tables and makes identical passwords produce different stored values for different users. Which of the following should the administrator recommend?
- A
Add a unique random salt to each user's password before hashing and store the salt with the resulting hash
- B
Encrypt the password database with the web server's TLS certificate so attackers cannot compare hashes
- C
Hash each password twice with SHA-256 so matching passwords are no longer detectable
- D
Use a single application-wide salt value for all users and append it after hashing
Show answer and explanation
Correct answer: A
Explanation
The best recommendation is to add a unique random salt for each user's password before hashing and store that salt with the hash. This ensures that identical passwords do not produce identical stored hashes, which directly addresses the audit finding. Salting also significantly reduces the value of rainbow tables and other precomputed cracking methods because attackers must attack each salted hash individually. Security best practices and widely accepted guidance, including NIST SP 800-63B and OWASP Password Storage Cheat Sheet, recommend using password hashing mechanisms designed for credential storage, such as Argon2id, scrypt, bcrypt, or PBKDF2, all with unique salts per password. While salting improves resistance to precomputed attacks, organizations should also use slow, adaptive password hashing algorithms rather than general-purpose fast hashes like SHA-256 alone.
- A. Correct.
Correct. A unique random salt per password is the standard way to prevent identical passwords from producing identical hashes and to make rainbow table or other precomputed attacks far less effective. The salt is not required to be secret and is typically stored alongside the password hash. In practice, modern password hashing functions such as bcrypt, scrypt, Argon2, or PBKDF2 incorporate salting as part of the process.
- B. Incorrect.
Incorrect. Encrypting the database may help protect data at rest, but it does not address the specific problem described: identical passwords generating identical hashes. TLS certificates are used for securing communications, not as a mechanism for password salting. Even if the database were encrypted, once an attacker obtained the decrypted hash data or gained database access, unsalted hashes would still be vulnerable to comparison and precomputed attacks.
- C. Incorrect.
Incorrect. Simply hashing a password twice with SHA-256 does not solve the issue of identical inputs producing identical outputs. Two users with the same password would still have the same final hash. Repeated fast hashing also does little to slow modern cracking hardware compared with purpose-built password hashing algorithms.
- D. Incorrect.
Incorrect. A single shared salt, often called a global salt or pepper when handled differently, does not ensure that two users with the same password have different stored hashes if the same value is reused for everyone. In addition, appending a salt after hashing is not proper salting because the original password input was already hashed without that unique randomness. The key requirement is a unique salt incorporated into the password hashing input for each user.