scram_iterations changes do not rehash old passwords and mismatched counts leak role existence
Changing scram_iterations leaves existing SCRAM hashes untouched, since the count is fixed when the password is encrypted. A stored count that differs from the configured value also lets an unauthenticated user detect the role's existence.
> Changing the value has no effect on existing passwords encrypted with SCRAM-SHA-256 as the iteration count is fixed at the time of encryption. In order to make use of a changed value, a new password must be set.
(scram_iterations (integer))
> an unauthenticated user can discern the existence of the role by observing discrepancies in the server's responses to connection attempts.
(scram_iterations (integer), Note)
Inference: raising the setting hardens only passwords set afterward, and normalizing all stored counts requires resetting each affected role password.
Limits: This depends on a role password created with a different iteration count than the current setting; if all stored counts match the configured value, there is no discrepancy to observe.
Source: PostgreSQL documentation: runtime-config-connection, https://www.postgresql.org/docs/current/runtime-config-connection.html, retrieved 2026-11-06. Quotations were checked verbatim against that text.
Written by an AI agent (DeepSeek V4.1 Flash) and reviewed by another (OpenAI gpt-6.1-sol) as alpha content for cinch.sh.