---
title: "NET-DB-022 PostgreSQL Password Encryption Not SCRAM"
canonical: https://openvapt.com/checks/NET-DB-022.html
html: https://openvapt.com/checks/NET-DB-022.html
site: OpenVAPT, https://openvapt.com/
license: OpenVAPT Source-Available Licence 1.3, https://openvapt.com/legal/licence-text.html
modified: 2026-10-14
version: 0.1.0-alpha.6
---

# NET-DB-022 PostgreSQL Password Encryption Not SCRAM

password_encryption is set to md5, so new and changed passwords are stored as md5 verifiers that work as pass-the-hash credentials.

- Domain: Network
- Severity: Medium
- Control category: Identity and Authentication
- Fix effort: low
- CVSS v3.1 vector: `CVSS:3.1/AV:N/AC:H/PR:N/UI:N/S:U/C:H/I:N/A:N`
- CIS Controls v8: 5.2
- NIST CSF 2.0: PR.AA-01
- CWE: CWE-916, CWE-328
- OWASP Top 10 2021: A02:2021
- OWASP ASVS 4.0.3: 2.4.1
- NIST SP 800-53 Rev. 5: IA-5(1), SC-13
- Benchmark topic: Database password hashing (topic only, no benchmark text)

## Why It Matters

The stored md5 value is itself sufficient to authenticate, so a leaked catalog is a leaked set of passwords. SCRAM-SHA-256 stores a salted, iterated verifier that is not usable directly. PostgreSQL 14 and newer default to scram-sha-256; older clusters often carry an explicit md5 line.

## How It Detects

Reads postgresql.conf and flags password_encryption = md5 (or on, the legacy alias). Absent passes on the assumption of the modern default and is noted as evidence.

## How to Fix

Set  password_encryption = scram-sha-256 , reload, and ask every role to reset its password so the verifier is regenerated. Then move pg_hba.conf to scram-sha-256 (NET-DB-019).

## How to Verify

```
SELECT rolname FROM pg_authid WHERE rolpassword LIKE 'md5%';  should return no rows after the resets.
```

## Learn the Theory

- [P3 Network Exposure and Firewalls](https://openvapt.com/academy/p3.md)
- [P8 Data Services: Databases, File Shares, DNS and Mail](https://openvapt.com/academy/p8.md)
- [P19 Database, Mail and DNS Hardening](https://openvapt.com/academy/p19.md)

## References

- [PostgreSQL, Password Authentication](https://www.postgresql.org/docs/current/auth-password.html)
- [PostgreSQL, Connections and Authentication](https://www.postgresql.org/docs/current/runtime-config-connection.html)
- [NIST SP 800-63B, Digital Identity Guidelines: Authentication](https://pages.nist.gov/800-63-3/sp800-63b.html)

## Source Code

https://github.com/OpenVAPT/openvapt/blob/574f7f3333c44b75a3c649e2d93a76d507f75adf/internal/checks/network/data_depth.go

Run it: `openvapt scan --only NET-DB-022`. Read it offline: `openvapt explain NET-DB-022`.

---

OpenVAPT is academic, non-commercial, source-available and built by AI Cybersecurity Engineers (AI systems, not people). Free for your own use on machines you own or control, 100% at your own risk; not for sale and not for providing services. This page in HTML: https://openvapt.com/checks/NET-DB-022.html. Part of OpenVAPT Check Catalogue. How to cite: https://openvapt.com/cite.html. Site summary for models: https://openvapt.com/llms.txt.
