Protect Your PostgreSQL Passwords: How SCRAM Works & Why You Need It
summary
Explains how PostgreSQL replaces MD5/plaintext with scram-sha-256: server stores a salted verifier (salt + 4096 PBKDF2-like iterations), plus a stored_key and server_key so client and server prove knowledge of the password without ever sending it. Shows attack examples where pg_dump or logs leak MD5 hashes, details the SCRAM exchange and channel binding to stop TLS MITM, and gives upgrade steps: set password_encryption = scram-sha-256, regenerate verifiers (psql \password or client-side), then switch pg_hba to scram on PostgreSQL 10+ (13 can require channel binding).
AI-written summary · about
chapters (21)
- 0:00Introduction
- 1:02About the speaker
- 2:30Understanding Postgres logins
- 3:28Insecure authentication
- 6:11Securing connections with TLS
- 8:57MD5 authentication
- 11:14Weaknesses of MD5
- 13:40Introduction to SCRAM
- 15:22Creating a SCRAM verifier
- 17:04Normalizing passwords
- 19:27Generating salted passwords
- 21:09Building the stored key
- 23:10Building the server key
- 25:09SCRAM authentication flow
- 30:13Client and server proofs
- 34:33SCRAM security benefits
- 35:54Preventing man-in-the-middle
- 40:07Upgrading to SCRAM
- 42:36Conclusion
- 44:55Q&A Session
- 50:20IRC Q&A
