pg.ddx.io  pgsql-committers@postgresql.org mailing list archive  
help / color / mirror / Atom feed
pgsql: Fix detection of passwords hashed with MD5 or SCRAM-SHA-256
6+ messages / 1 participants
[nested] [flat]

* pgsql: Fix detection of passwords hashed with MD5 or SCRAM-SHA-256
@ 2019-04-23 06:47 Michael Paquier <michael@paquier.xyz>
  0 siblings, 0 replies; 6+ messages in thread

From: Michael Paquier @ 2019-04-23 06:47 UTC (permalink / raw)
  To: pgsql-committers@lists.postgresql.org

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

Branch
------
master

Details
-------
https://git.postgresql.org/pg/commitdiff/ccae190b916f27fbe4079ee4664d34cd1be47b79

Modified Files
--------------
src/backend/libpq/auth-scram.c         |  4 +---
src/backend/libpq/crypt.c              | 13 +++++++++++--
src/include/common/md5.h               |  1 +
src/include/libpq/scram.h              |  2 ++
src/test/regress/expected/password.out | 17 ++++++++++++++++-
src/test/regress/sql/password.sql      | 13 +++++++++++++
6 files changed, 44 insertions(+), 6 deletions(-)



^ permalink  raw  reply  [nested|flat] 6+ messages in thread

* pgsql: Fix detection of passwords hashed with MD5 or SCRAM-SHA-256
@ 2019-04-23 06:47 Michael Paquier <michael@paquier.xyz>
  0 siblings, 0 replies; 6+ messages in thread

From: Michael Paquier @ 2019-04-23 06:47 UTC (permalink / raw)
  To: pgsql-committers@lists.postgresql.org

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

Branch
------
REL_11_STABLE

Details
-------
https://git.postgresql.org/pg/commitdiff/7f56d43663dd06e23aeb9a5265d3e16e8616e9d8

Modified Files
--------------
src/backend/libpq/auth-scram.c         |  4 +---
src/backend/libpq/crypt.c              | 13 +++++++++++--
src/include/common/md5.h               |  1 +
src/include/libpq/scram.h              |  2 ++
src/test/regress/expected/password.out | 17 ++++++++++++++++-
src/test/regress/sql/password.sql      | 13 +++++++++++++
6 files changed, 44 insertions(+), 6 deletions(-)



^ permalink  raw  reply  [nested|flat] 6+ messages in thread

* pgsql: Fix detection of passwords hashed with MD5 or SCRAM-SHA-256
@ 2019-04-23 06:47 Michael Paquier <michael@paquier.xyz>
  0 siblings, 0 replies; 6+ messages in thread

From: Michael Paquier @ 2019-04-23 06:47 UTC (permalink / raw)
  To: pgsql-committers@lists.postgresql.org

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

Branch
------
REL_10_STABLE

Details
-------
https://git.postgresql.org/pg/commitdiff/15fe91e70ec69ecffad9f250f8e96f3823147195

Modified Files
--------------
src/backend/libpq/auth-scram.c         |  4 +---
src/backend/libpq/crypt.c              | 13 +++++++++++--
src/include/common/md5.h               |  1 +
src/include/libpq/scram.h              |  2 ++
src/test/regress/expected/password.out | 17 ++++++++++++++++-
src/test/regress/sql/password.sql      | 13 +++++++++++++
6 files changed, 44 insertions(+), 6 deletions(-)



^ permalink  raw  reply  [nested|flat] 6+ messages in thread

* pgsql: Fix detection of passwords hashed with MD5
@ 2019-04-24 00:06 Michael Paquier <michael@paquier.xyz>
  0 siblings, 0 replies; 6+ messages in thread

From: Michael Paquier @ 2019-04-24 00:06 UTC (permalink / raw)
  To: pgsql-committers@lists.postgresql.org

Fix detection of passwords hashed with MD5

This commit fixes an issue related to the way password verifiers hashed
with MD5 are detected, leading to possibly detect that plain passwords
are legit MD5 hashes.  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 after the three-character prefix.

Fix 9.6 down to 9.4, where this code is present.  This area of the code
has changed in 10 and upwards with the introduction of SCRAM, which led
to a different fix committed as of ccae190.

Reported-by: Tom Lane
Author: Michael Paquier
Reviewed-by: Jonathan Katz
Discussion: https://postgr.es/m/016deb6b-1f0a-8e9f-1833-a8675b170aa9@postgresql.org
Backpatch-through: 9.4

Branch
------
REL9_6_STABLE

Details
-------
https://git.postgresql.org/pg/commitdiff/af298f00a1e8d47f37e21567a00558defd492297

Modified Files
--------------
src/include/libpq/md5.h | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)



^ permalink  raw  reply  [nested|flat] 6+ messages in thread

* pgsql: Fix detection of passwords hashed with MD5
@ 2019-04-24 00:06 Michael Paquier <michael@paquier.xyz>
  0 siblings, 0 replies; 6+ messages in thread

From: Michael Paquier @ 2019-04-24 00:06 UTC (permalink / raw)
  To: pgsql-committers@lists.postgresql.org

Fix detection of passwords hashed with MD5

This commit fixes an issue related to the way password verifiers hashed
with MD5 are detected, leading to possibly detect that plain passwords
are legit MD5 hashes.  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 after the three-character prefix.

Fix 9.6 down to 9.4, where this code is present.  This area of the code
has changed in 10 and upwards with the introduction of SCRAM, which led
to a different fix committed as of ccae190.

Reported-by: Tom Lane
Author: Michael Paquier
Reviewed-by: Jonathan Katz
Discussion: https://postgr.es/m/016deb6b-1f0a-8e9f-1833-a8675b170aa9@postgresql.org
Backpatch-through: 9.4

Branch
------
REL9_5_STABLE

Details
-------
https://git.postgresql.org/pg/commitdiff/20dbc84bd002c5ef2b5439ac29b6a5b24b0a3d69

Modified Files
--------------
src/include/libpq/md5.h | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)



^ permalink  raw  reply  [nested|flat] 6+ messages in thread

* pgsql: Fix detection of passwords hashed with MD5
@ 2019-04-24 00:06 Michael Paquier <michael@paquier.xyz>
  0 siblings, 0 replies; 6+ messages in thread

From: Michael Paquier @ 2019-04-24 00:06 UTC (permalink / raw)
  To: pgsql-committers@lists.postgresql.org

Fix detection of passwords hashed with MD5

This commit fixes an issue related to the way password verifiers hashed
with MD5 are detected, leading to possibly detect that plain passwords
are legit MD5 hashes.  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 after the three-character prefix.

Fix 9.6 down to 9.4, where this code is present.  This area of the code
has changed in 10 and upwards with the introduction of SCRAM, which led
to a different fix committed as of ccae190.

Reported-by: Tom Lane
Author: Michael Paquier
Reviewed-by: Jonathan Katz
Discussion: https://postgr.es/m/016deb6b-1f0a-8e9f-1833-a8675b170aa9@postgresql.org
Backpatch-through: 9.4

Branch
------
REL9_4_STABLE

Details
-------
https://git.postgresql.org/pg/commitdiff/a82c06f4001d28c17f67c61b492f774d5e507b31

Modified Files
--------------
src/include/libpq/md5.h | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)



^ permalink  raw  reply  [nested|flat] 6+ messages in thread


end of thread, other threads:[~2019-04-24 00:06 UTC | newest]

Thread overview: 6+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2019-04-23 06:47 pgsql: Fix detection of passwords hashed with MD5 or SCRAM-SHA-256 Michael Paquier <michael@paquier.xyz>
2019-04-23 06:47 pgsql: Fix detection of passwords hashed with MD5 or SCRAM-SHA-256 Michael Paquier <michael@paquier.xyz>
2019-04-23 06:47 pgsql: Fix detection of passwords hashed with MD5 or SCRAM-SHA-256 Michael Paquier <michael@paquier.xyz>
2019-04-24 00:06 pgsql: Fix detection of passwords hashed with MD5 Michael Paquier <michael@paquier.xyz>
2019-04-24 00:06 pgsql: Fix detection of passwords hashed with MD5 Michael Paquier <michael@paquier.xyz>
2019-04-24 00:06 pgsql: Fix detection of passwords hashed with MD5 Michael Paquier <michael@paquier.xyz>

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox