What is the security risk of implementing password hashing using SHA-256 without a salt?
- A.SHA-256 without salt is vulnerable to rainbow table attacks (precomputed hash databases covering millions of common passwords), and identical passwords produce identical hashes (allowing an attacker to see that multiple users share a password by seeing the same hash). A salt (random unique value per user) ensures identical passwords produce different hashes, defeating rainbow tables
- B.SHA-256 without salt is slow enough that login servers time out (a hash costing about 200 ms), and identical passwords produce different hashes at each login, letting an attacker see the users who share a password by comparing session cookies across the accounts of the whole customer base
- C.SHA-256 without salt exposes the password to length extension attacks (an attacker appends data to the hash and forges a valid value), and a salt prevents that by hashing the salt first, blocking tampering with the stored digest in the credentials table of the database