PostgreSQL 9.2.x < 9.2.21 / 9.3.x < 9.3.17 / 9.4.x < 9.4.12 / 9.5.x < 9.5.7 / 9.6.x < 9.6.3 Multiple Vulnerabilities - Nessus

High   Plugin ID: 100260

This page contains detailed information about the PostgreSQL 9.2.x < 9.2.21 / 9.3.x < 9.3.17 / 9.4.x < 9.4.12 / 9.5.x < 9.5.7 / 9.6.x < 9.6.3 Multiple Vulnerabilities Nessus plugin including available exploits and PoCs found on GitHub, in Metasploit or Exploit-DB for verifying of this vulnerability.

Plugin Overview


ID: 100260
Name: PostgreSQL 9.2.x < 9.2.21 / 9.3.x < 9.3.17 / 9.4.x < 9.4.12 / 9.5.x < 9.5.7 / 9.6.x < 9.6.3 Multiple Vulnerabilities
Filename: postgresql_20170511.nasl
Vulnerability Published: 2017-05-11
This Plugin Published: 2017-05-17
Last Modification Time: 2022-04-11
Plugin Version: 1.17
Plugin Type: local
Plugin Family: Databases
Dependencies: postgres_installed_nix.nbin, postgres_installed_windows.nbin, postgresql_version.nbin

Vulnerability Information


Severity: High
Vulnerability Published: 2017-05-11
Patch Published: 2017-05-11
CVE [?]: CVE-2017-7484, CVE-2017-7485, CVE-2017-7486
CPE [?]: cpe:/a:postgresql:postgresql

Synopsis

The remote database server is affected by multiple vulnerabilities.

Description

The version of PostgreSQL installed on the remote host is 9.2.x prior to 9.2.21, 9.3.x prior to 9.3.17, 9.4.x prior to 9.4.12, 9.5.x prior to 9.5.7, or 9.6.x prior to 9.6.3. It is, therefore, affected by multiple vulnerabilities :

- A information disclosure vulnerability exists in unspecified selectivity estimation functions due to improper checking of user privileges before providing information from pg_statistics. An authenticated, remote attacker can exploit this to disclose potentially sensitive information from restricted tables. (CVE-2017-7484)

- A flaw exists because the PGREQUIRESSL environment variable setting is not properly honored, which results in a failure to require appropriate SSL/TLS connections. A man-in-the-middle attacker can exploit this to cause an insecure, non-SSL/TLS connection between a client and and a server. Note that version 9.2.x is not affected by this vulnerability. (CVE-2017-7485)

- A information disclosure vulnerability exists in the pg_user_mappings view that allows access to user mappings which may contain passwords that have persisted from the CREATE USER MAPPING command. An authenticated, remote attacker who has USAGE privilege on the associated foreign server can exploit this to disclose foreign server passwords. (CVE-2017-7486)

Solution

Upgrade to PostgreSQL version 9.2.21 / 9.3.17 / 9.4.12 / 9.5.7 / 9.6.3 or later.

Public Exploits


Target Network Port(s): 5432
Target Asset(s): installed_sw/PostgreSQL, Services/postgresql
Exploit Available: True (GitHub)
Exploit Ease: Exploits (PoCs) are available

Here's the list of publicly known exploits and PoCs for verifying the PostgreSQL 9.2.x < 9.2.21 / 9.3.x < 9.3.17 / 9.4.x < 9.4.12 / 9.5.x < 9.5.7 / 9.6.x < 9.6.3 Multiple Vulnerabilities vulnerability:

  1. GitHub: https://github.com/alphagov/pay-aws-compliance
    [CVE-2017-7484]
  2. GitHub: https://github.com/alphagov/pay-aws-compliance
    [CVE-2017-7485]
  3. GitHub: https://github.com/alphagov/pay-aws-compliance
    [CVE-2017-7486]

Before running any exploit against any system, make sure you are authorized by the owner of the target system(s) to perform such activity. In any other case, this would be considered as an illegal activity.

WARNING: Beware of using unverified exploits from sources such as GitHub or Exploit-DB. These exploits and PoCs could contain malware. For more information, see how to use exploits safely.

Risk Information


CVSS Score Source [?]: CVE-2017-7486
CVSS V2 Vector: AV:N/AC:L/Au:N/C:P/I:N/A:N/E:U/RL:OF/RC:C
CVSS Base Score:5.0 (Medium)
Impact Subscore:2.9
Exploitability Subscore:10.0
CVSS Temporal Score:3.7 (Low)
CVSS Environmental Score:NA (None)
Modified Impact Subscore:NA
Overall CVSS Score:3.7 (Low)
CVSS V3 Vector: CVSS:3.0/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:N/A:N/E:U/RL:O/RC:C
CVSS Base Score:7.5 (High)
Impact Subscore:3.6
Exploitability Subscore:3.9
CVSS Temporal Score:6.5 (Medium)
CVSS Environmental Score:NA (None)
Modified Impact Subscore:NA
Overall CVSS Score:6.5 (Medium)

Go back to menu.

Plugin Source


This is the postgresql_20170511.nasl nessus plugin source code. This script is Copyright (C) 2017-2022 and is owned by Tenable, Inc. or an Affiliate thereof.

#%NASL_MIN_LEVEL 70300
#
# (C) Tenable Network Security, Inc
#

include('deprecated_nasl_level.inc');
include('compat.inc');

if (description)
{
  script_id(100260);
  script_version("1.17");
  script_set_attribute(attribute:"plugin_modification_date", value:"2022/04/11");

  script_cve_id("CVE-2017-7484", "CVE-2017-7485", "CVE-2017-7486");
  script_bugtraq_id(98459, 98460, 98461);

  script_name(english:"PostgreSQL 9.2.x < 9.2.21 / 9.3.x < 9.3.17 / 9.4.x < 9.4.12 / 9.5.x < 9.5.7 / 9.6.x < 9.6.3 Multiple Vulnerabilities");

  script_set_attribute(attribute:"synopsis", value:
"The remote database server is affected by multiple vulnerabilities.");
  script_set_attribute(attribute:"description", value:
"The version of PostgreSQL installed on the remote host is 9.2.x prior
to 9.2.21, 9.3.x prior to 9.3.17, 9.4.x prior to 9.4.12, 9.5.x prior
to 9.5.7, or 9.6.x prior to 9.6.3. It is, therefore, affected by
multiple vulnerabilities :

  - A information disclosure vulnerability exists in
    unspecified selectivity estimation functions due to
    improper checking of user privileges before providing
    information from pg_statistics. An authenticated, remote
    attacker can exploit this to disclose potentially
    sensitive information from restricted tables.
    (CVE-2017-7484)

  - A flaw exists because the PGREQUIRESSL environment
    variable setting is not properly honored, which results
    in a failure to require appropriate SSL/TLS connections.
    A man-in-the-middle attacker can exploit this to cause
    an insecure, non-SSL/TLS connection between a client and
    and a server. Note that version 9.2.x is not affected by
    this vulnerability. (CVE-2017-7485)

  - A information disclosure vulnerability exists in the
    pg_user_mappings view that allows access to user
    mappings which may contain passwords that have persisted
    from the CREATE USER MAPPING command. An authenticated,
    remote attacker who has USAGE privilege on the
    associated foreign server can exploit this to disclose
    foreign server passwords. (CVE-2017-7486)");
  script_set_attribute(attribute:"see_also", value:"https://www.postgresql.org/about/news/1746/");
  script_set_attribute(attribute:"see_also", value:"https://www.postgresql.org/docs/current/static/release-9-2-21.html");
  script_set_attribute(attribute:"see_also", value:"https://www.postgresql.org/docs/current/release-9-3-17.html");
  script_set_attribute(attribute:"see_also", value:"https://www.postgresql.org/docs/current/release-9-4-12.html");
  script_set_attribute(attribute:"see_also", value:"https://www.postgresql.org/docs/current/release-9-5-7.html");
  script_set_attribute(attribute:"see_also", value:"https://www.postgresql.org/docs/current/release-9-6-3.html");
  script_set_attribute(attribute:"solution", value:
"Upgrade to PostgreSQL version 9.2.21 / 9.3.17 / 9.4.12 / 9.5.7 / 9.6.3
or later.");
  script_set_attribute(attribute:"agent", value:"all");
  script_set_cvss_base_vector("CVSS2#AV:N/AC:L/Au:N/C:P/I:N/A:N");
  script_set_cvss_temporal_vector("CVSS2#E:U/RL:OF/RC:C");
  script_set_cvss3_base_vector("CVSS:3.0/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:N/A:N");
  script_set_cvss3_temporal_vector("CVSS:3.0/E:U/RL:O/RC:C");
  script_set_attribute(attribute:"cvss_score_source", value:"CVE-2017-7486");

  script_set_attribute(attribute:"exploitability_ease", value:"No known exploits are available");
  script_set_attribute(attribute:"exploit_available", value:"false");

  script_set_attribute(attribute:"vuln_publication_date", value:"2017/05/11");
  script_set_attribute(attribute:"patch_publication_date", value:"2017/05/11");
  script_set_attribute(attribute:"plugin_publication_date", value:"2017/05/17");

  script_set_attribute(attribute:"plugin_type", value:"local");
  script_set_attribute(attribute:"cpe", value:"cpe:/a:postgresql:postgresql");
  script_set_attribute(attribute:"thorough_tests", value:"true");
  script_end_attributes();

  script_category(ACT_GATHER_INFO);
  script_family(english:"Databases");

  script_copyright(english:"This script is Copyright (C) 2017-2022 and is owned by Tenable, Inc. or an Affiliate thereof.");

  script_dependencies("postgres_installed_windows.nbin", "postgres_installed_nix.nbin", "postgresql_version.nbin");
  script_require_ports("Services/postgresql", 5432, "installed_sw/PostgreSQL");

  exit(0);
}

include('vcf_extras_postgresql.inc');

var app = 'PostgreSQL';
var win_local = TRUE;

if (!get_kb_item('SMB/Registry/Enumerated'))
  win_local = FALSE;

var port = get_service(svc:'postgresql', default:5432);
var kb_base = 'database/' + port + '/postgresql/';
var kb_ver = NULL;
var kb_path = kb_base + 'version';
var ver = get_kb_item(kb_path);
if (!empty_or_null(ver)) kb_ver = kb_path;

app_info = vcf::postgresql::get_app_info(app:app, port:port, kb_ver:kb_ver, kb_base:kb_base, win_local:win_local);
vcf::check_granularity(app_info:app_info, sig_segments:2);

#  9.2.21 / 9.3.17 / 9.4.12 / 9.5.7 / 9.6.3
constraints = [
  { "min_version" : "9.2", "fixed_version" : "9.2.21" },
  { "min_version" : "9.3", "fixed_version" : "9.3.17" },
  { "min_version" : "9.4", "fixed_version" : "9.4.12" },
  { "min_version" : "9.5", "fixed_version" : "9.5.7" },
  { "min_version" : "9.6", "fixed_version" : "9.6.3" }
];

vcf::postgresql::check_version_and_report(app_info:app_info, constraints:constraints, severity:SECURITY_WARNING);

The latest version of this script can be found in these locations depending on your platform:

  • Linux / Unix:
    /opt/nessus/lib/nessus/plugins/postgresql_20170511.nasl
  • Windows:
    C:\ProgramData\Tenable\Nessus\nessus\plugins\postgresql_20170511.nasl
  • Mac OS X:
    /Library/Nessus/run/lib/nessus/plugins/postgresql_20170511.nasl

Go back to menu.

How to Run


Here is how to run the PostgreSQL 9.2.x < 9.2.21 / 9.3.x < 9.3.17 / 9.4.x < 9.4.12 / 9.5.x < 9.5.7 / 9.6.x < 9.6.3 Multiple Vulnerabilities as a standalone plugin via the Nessus web user interface (https://localhost:8834/):

  1. Click to start a New Scan.
  2. Select Advanced Scan.
  3. Navigate to the Plugins tab.
  4. On the top right corner click to Disable All plugins.
  5. On the left side table select Databases plugin family.
  6. On the right side table select PostgreSQL 9.2.x < 9.2.21 / 9.3.x < 9.3.17 / 9.4.x < 9.4.12 / 9.5.x < 9.5.7 / 9.6.x < 9.6.3 Multiple Vulnerabilities plugin ID 100260.
  7. Specify the target on the Settings tab and click to Save the scan.
  8. Run the scan.

Here are a few examples of how to run the plugin in the command line. Note that the examples below demonstrate the usage on the Linux / Unix platform.

Basic usage:

/opt/nessus/bin/nasl postgresql_20170511.nasl -t <IP/HOST>

Run the plugin with audit trail message on the console:

/opt/nessus/bin/nasl -a postgresql_20170511.nasl -t <IP/HOST>

Run the plugin with trace script execution written to the console (useful for debugging):

/opt/nessus/bin/nasl -T - postgresql_20170511.nasl -t <IP/HOST>

Run the plugin with using a state file for the target and updating it (useful for running multiple plugins on the target):

/opt/nessus/bin/nasl -K /tmp/state postgresql_20170511.nasl -t <IP/HOST>

Go back to menu.

References


BID | SecurityFocus Bugtraq ID: See also: Similar and related Nessus plugins:
  • 100639 - Amazon Linux AMI : postgresql92 (ALAS-2017-838)
  • 100640 - Amazon Linux AMI : postgresql93 / postgresql94,postgresql95 (ALAS-2017-839)
  • 102747 - CentOS 7 : postgresql (CESA-2017:1983)
  • 102368 - Debian DLA-1051-1 : postgresql-9.1 security update
  • 100165 - Debian DSA-3851-1 : postgresql-9.4 - security update
  • 103073 - EulerOS 2.0 SP1 : posrgresql (EulerOS-SA-2017-1215)
  • 103074 - EulerOS 2.0 SP2 : posrgresql (EulerOS-SA-2017-1216)
  • 101572 - Fedora 26 : mingw-postgresql (2017-0d5817efc0)
  • 101693 - Fedora 26 : postgresql (2017-a45fb81029)
  • 103724 - GLSA-201710-06 : PostgreSQL: Multiple vulnerabilities
  • 100659 - openSUSE Security Update : postgresql93 (openSUSE-2017-657)
  • 101220 - openSUSE Security Update : postgresql94 (openSUSE-2017-770)
  • 102292 - Oracle Linux 7 : postgresql (ELSA-2017-1983)
  • 102142 - RHEL 5 : rh-postgresql95-postgresql (RHSA-2017:1838)
  • 102108 - RHEL 7 : postgresql (RHSA-2017:1983)
  • 102653 - Scientific Linux Security Update : postgresql on SL7.x x86_64 (20170801)
  • 100538 - SUSE SLES12 Security Update : postgresql93 (SUSE-SU-2017:1441-1)
  • 101060 - SUSE SLED12 / SLES12 Security Update : postgresql94 (SUSE-SU-2017:1690-1)
  • 101260 - SUSE SLES11 Security Update : postgresql94 (SUSE-SU-2017:1783-1)
  • 63353 - PostgreSQL 8.3 < 8.3.19 / 8.4 < 8.4.12 / 9.0 < 9.0.8 / 9.1 < 9.1.4 Multiple Vulnerabilities
  • 63354 - PostgreSQL 8.3 < 8.3.20 / 8.4 < 8.4.13 / 9.0 < 9.0.9 / 9.1 < 9.1.5 Multiple Vulnerabilities
  • 64669 - PostgreSQL 8.3 < 8.3.23 / 8.4 < 8.4.16 / 9.0 < 9.0.12 / 9.1 < 9.1.8 / 9.2 < 9.2.3 Denial of Service
  • 65854 - PostgreSQL 8.4 < 8.4.17 / 9.0 < 9.0.13 / 9.1 < 9.1.9 / 9.2 < 9.2.4 Multiple Vulnerabilities
  • 102527 - PostgreSQL 9.2.x < 9.2.22 / 9.3.x < 9.3.18 / 9.4.x < 9.4.13 / 9.5.x < 9.5.8 / 9.6.x < 9.6.4 Multiple Vulnerabilities
  • 107226 - PostgreSQL 9.3.x < 9.3.22 / 9.4.x < 9.4.17 / 9.5.x < 9.5.12 / 9.6.x < 9.6.8 / 10.x < 10.3 Privilege Escalation Vulnerability
  • 127905 - PostgreSQL 9.4.x < 9.4.24 / 9.5.x < 9.5.19 / 9.6.x < 9.6.15 / 10.x < 10.10 / 11.x < 11.5 Multiple Vulnerabilities
  • 148419 - PostgreSQL 11.x < 11.11 / 12.x < 12.6 / 13.x < 13.2 Multiple Vulnerabilities
  • 10483 - PostgreSQL Default Unpassworded Account
  • 104031 - PostgreSQL Empty Password Handling Remote Authentication Bypass

Version


This page has been produced using Nessus Professional 10.1.2 (#68) LINUX, Plugin set 202205072148.
Plugin file postgresql_20170511.nasl version 1.17. For more plugins, visit the Nessus Plugin Library.

Go back to menu.