Handbooks / Web Security (OWASP) / Chapter 3
Authentication and Sessions
7 pages · ~5 min✓ Reviewed
Builds on Cross-Site Scripting (XSS). Next up: CSRF and CORS.
Password Storage Mental Model
1. Hash, Don't Encrypt
- Store a slow, salted hash, never the password
- Hash = one-way; encryption = reversible
- Never store an encrypted copy either
2. Salt vs Pepper
| Salt | Pepper | |
|---|---|---|
| Value | Random, per user | One app-wide secret |
| Kept | Beside hash, in clear | Env var or KMS |
| Defeats | Rainbow tables, equal hashes | DB leak alone |
- Password
- + salt
- Slow hash
- Store