diff options
author | Michael Paquier <michael@paquier.xyz> | 2019-04-23 15:43:21 +0900 |
---|---|---|
committer | Michael Paquier <michael@paquier.xyz> | 2019-04-23 15:43:21 +0900 |
commit | ccae190b916f27fbe4079ee4664d34cd1be47b79 (patch) | |
tree | ee7edf3781e72c33b6c546a7ac93bf221a22f3f0 /src/include/libpq/scram.h | |
parent | b5f58cf213bdab7e726f7b09c1137b4ea397fc0b (diff) | |
download | postgresql-ccae190b916f27fbe4079ee4664d34cd1be47b79.tar.gz postgresql-ccae190b916f27fbe4079ee4664d34cd1be47b79.zip |
Fix detection of passwords hashed with MD5 or SCRAM-SHA-256
This commit fixes a couple of issues related to the way password
verifiers hashed with MD5 or SCRAM-SHA-256 are detected, leading to
being able to store in catalogs passwords which do not follow the
supported hash formats:
- A MD5-hashed entry was checked based on if its header uses "md5" and
if the string length matches what is expected. Unfortunately the code
never checked if the hash only used hexadecimal characters, as reported
by Tom Lane.
- A SCRAM-hashed entry was checked based on only its header, which
should be "SCRAM-SHA-256$", but it never checked for any fields
afterwards, as reported by Jonathan Katz.
Backpatch down to v10, which is where SCRAM has been introduced, and
where password verifiers in plain format have been removed.
Author: Jonathan Katz
Reviewed-by: Tom Lane, Michael Paquier
Discussion: https://postgr.es/m/016deb6b-1f0a-8e9f-1833-a8675b170aa9@postgresql.org
Backpatch-through: 10
Diffstat (limited to 'src/include/libpq/scram.h')
-rw-r--r-- | src/include/libpq/scram.h | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/src/include/libpq/scram.h b/src/include/libpq/scram.h index d7f4c094c9d..bc297e2a336 100644 --- a/src/include/libpq/scram.h +++ b/src/include/libpq/scram.h @@ -29,6 +29,8 @@ extern int pg_be_scram_exchange(void *opaq, const char *input, int inputlen, /* Routines to handle and check SCRAM-SHA-256 verifier */ extern char *pg_be_scram_build_verifier(const char *password); +extern bool parse_scram_verifier(const char *verifier, int *iterations, char **salt, + uint8 *stored_key, uint8 *server_key); extern bool scram_verify_plain_password(const char *username, const char *password, const char *verifier); |