mirror of
https://github.com/postgres/postgres.git
synced 2026-10-23 13:29:09 +03:00
Use value of scram_iterations in mock_scram_secret().
Presently, mock_scram_secret() always uses SCRAM_SHA_256_DEFAULT_ITERATIONS, which poses an observable response discrepancy hazard when scram_iterations is set to something else. To fix, use the value of the configuration parameter instead, and document that unauthenticated users can discover the existence of roles with passwords created with different iteration counts. Reported-by: Radim Marek <radim@boringsql.com> Author: Nathan Bossart <nathandbossart@gmail.com> Reviewed-by: Michael Paquier <michael@paquier.xyz> Reviewed-by: Heikki Linnakangas <hlinnaka@iki.fi> Reviewed-by: Jacob Champion <champion.p@gmail.com> Security: CVE-2026-14672 Backpatch-through: 16
This commit is contained in:
committed by
Noah Misch
parent
a3832a7571
commit
4d192fa168
@@ -1172,6 +1172,19 @@ include_dir 'conf.d'
|
||||
time of encryption. In order to make use of a changed value, a new
|
||||
password must be set.
|
||||
</para>
|
||||
<note>
|
||||
<para>
|
||||
If a role password was created with a different iteration count than
|
||||
the value of <literal>scram_iterations</literal> specified in the
|
||||
<filename>postgresql.conf</filename> file or on the server command
|
||||
line, an unauthenticated user can discern the existence of the role by
|
||||
observing discrepancies in the server's responses to connection
|
||||
attempts. If you find this concerning, ensure that all role passwords
|
||||
are created with <literal>scram_iterations</literal> set to the value
|
||||
specified in the <filename>postgresql.conf</filename> file or on the
|
||||
server command line.
|
||||
</para>
|
||||
</note>
|
||||
</listitem>
|
||||
</varlistentry>
|
||||
|
||||
|
||||
@@ -727,7 +727,7 @@ mock_scram_secret(const char *username, pg_cryptohash_type *hash_type,
|
||||
encoded_salt[encoded_len] = '\0';
|
||||
|
||||
*salt = encoded_salt;
|
||||
*iterations = SCRAM_SHA_256_DEFAULT_ITERATIONS;
|
||||
*iterations = scram_sha_256_iterations;
|
||||
|
||||
/* StoredKey and ServerKey are not used in a doomed authentication */
|
||||
memset(stored_key, 0, SCRAM_MAX_KEY_LEN);
|
||||
|
||||
Reference in New Issue
Block a user