This site is the archived OWASP Foundation Wiki and is no longer accepting Account Requests.
To view the new OWASP Foundation website, please visit https://owasp.org
Password Storage Cheat Sheet
DRAFT CHEAT SHEET - WORK IN PROGRESS
Introduction
This article is focused on providing guidance to storing a passwords in order to help prevent password theft.
Password Storage Rules
It is crucial that passwords are stored in a way that they can be *verified* but not *exposed* in any way, even by insiders or administrations. To accomplish this, store the salted hashed value of the password. Preferably use a different random salt for each password hash instead of a constant long salt. It is recommended that you avoid storing the clear text password or an encrypted version of the password.
- Use a modern hash
- SHA
- bcrypt
- Use a long cryptographically random salt
- Isolate the salt from the hash
- Iterate the hash
References
Cryptographic framework for password hashing is described in PKCS #5 v2.1: Password-Based Cryptography Standard. Specific secure password hashing algorithms exist such as bcrypt, scrypt. Implementations of secure password hashing exist for PHP (phpass), ASP.NET (ASP.NET 2.0 Security Practices), Java (OWASP Hashing Java).
OWASP Cheat Sheets Project Homepage