Bug 1448086 (CVE-2017-7485)

Summary: CVE-2017-7485 postgresql: libpq ignores PGREQUIRESSL environment variable
Product: [Other] Security Response Reporter: Adam Mariš <amaris>
Component: vulnerabilityAssignee: Red Hat Product Security <security-response-team>
Status: CLOSED ERRATA QA Contact:
Severity: medium Docs Contact:
Priority: medium    
Version: unspecifiedCC: bkearney, cpelland, dajohnso, databases-maint, dclarizi, devrim, gblomqui, gmccullo, gtanzill, hhorak, hhudgeon, jfrey, jhardy, jmlich83, jorton, jprause, jstanek, kseifried, meissner, mike, obarenbo, pkajaba, pkubat, praiskup, roliveri, security-response-team, simaishi, taw, tgl, thomas, tlestach
Target Milestone: ---Keywords: Security
Target Release: ---   
Hardware: All   
OS: Linux   
Whiteboard:
Fixed In Version: postgresql 9.2.21, postgresql 9.3.17, postgresql 9.4.12, postgresql 9.5.7, postgresql 9.6.3 Doc Type: If docs needed, set a value
Doc Text:
It was discovered that the PostgreSQL client library (libpq) did not enforce the use of TLS/SSL for a connection to a PostgreSQL server when the PGREQUIRESSL environment variable was set. An man-in-the-middle attacker could use this flaw to strip the SSL/TLS protection from a connection between a client and a server.
Story Points: ---
Clone Of: Environment:
Last Closed: 2017-07-07 11:21:40 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Bug Depends On: 1449699, 1449701, 1449704, 1449705, 1450115, 1450116, 1450117    
Bug Blocks: 1448091    

Description Adam Mariš 2017-05-04 13:46:35 UTC
Documentation asserts that, given this variable, libpq will attempt SSL connections only. Instead, libpq ignores the variable and attempts a non-SSL connection after an SSL connection fails. (libpq is a prominent programming interface for PostgreSQL clients.) An attacker intercepting session startup could compel use of a non-SSL connection, then record or modify the remainder of the session. The long-preferred PGSSLMODE environment variable does not have this problem and provides strictly more control.

Affected versions: 9.3 - 9.6

Comment 1 Adam Mariš 2017-05-04 13:46:51 UTC
Acknowledgments:

Name: the PostgreSQL project
Upstream: Daniel Gustafsson

Comment 2 Cedric Buissart 2017-05-10 07:31:56 UTC
Upstream patch : 
* Restore PGREQUIRESSL recognition in libpq.
https://github.com/postgres/postgres/commit/0170b10

Comment 4 Cedric Buissart 2017-05-10 13:52:53 UTC
Mitigation:

Use  PGSSLMODE=require instead of  PGREQUIRESSL=1

Comment 6 Adam Mariš 2017-05-11 14:38:48 UTC
External References:

https://www.postgresql.org/about/news/1746/

Comment 7 Adam Mariš 2017-05-11 14:47:12 UTC
Created mingw-postgresql tracking bugs for this issue:

Affects: epel-7 [bug 1450116]
Affects: fedora-all [bug 1450117]


Created postgresql tracking bugs for this issue:

Affects: fedora-all [bug 1450115]

Comment 9 errata-xmlrpc 2017-07-05 05:45:27 UTC
This issue has been addressed in the following products:

  Red Hat Software Collections for Red Hat Enterprise Linux 6
  Red Hat Software Collections for Red Hat Enterprise Linux 6.7 EUS
  Red Hat Software Collections for Red Hat Enterprise Linux 7
  Red Hat Software Collections for Red Hat Enterprise Linux 7.3 EUS

Via RHSA-2017:1677 https://access.redhat.com/errata/RHSA-2017:1677

Comment 10 errata-xmlrpc 2017-07-05 05:55:26 UTC
This issue has been addressed in the following products:

  Red Hat Software Collections for Red Hat Enterprise Linux 6
  Red Hat Software Collections for Red Hat Enterprise Linux 6.7 EUS
  Red Hat Software Collections for Red Hat Enterprise Linux 7
  Red Hat Software Collections for Red Hat Enterprise Linux 7.3 EUS

Via RHSA-2017:1678 https://access.redhat.com/errata/RHSA-2017:1678

Comment 11 errata-xmlrpc 2017-07-31 15:52:56 UTC
This issue has been addressed in the following products:

  Red Hat Satellite 5.8
  Red Hat Satellite 5.8 ELS

Via RHSA-2017:1838 https://access.redhat.com/errata/RHSA-2017:1838

Comment 12 errata-xmlrpc 2017-08-07 16:13:01 UTC
This issue has been addressed in the following products:

  Red Hat Satellite 5.7

Via RHSA-2017:2425 https://access.redhat.com/errata/RHSA-2017:2425