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 - Nessus

Critical   Plugin ID: 102527

This page contains detailed information about the 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 Nessus plugin including available exploits and PoCs found on GitHub, in Metasploit or Exploit-DB for verifying of this vulnerability.

Plugin Overview


ID: 102527
Name: 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
Filename: postgresql_20170810.nasl
Vulnerability Published: 2017-08-10
This Plugin Published: 2017-08-16
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: Critical
Vulnerability Published: 2017-08-10
Patch Published: 2017-08-10
CVE [?]: CVE-2017-7546, CVE-2017-7547, CVE-2017-7548
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.22, 9.3.x prior to 9.3.18, 9.4.x prior to 9.4.13, 9.5.x prior to 9.5.8, or 9.6.x prior to 9.6.4. It is, therefore, affected by multiple vulnerabilities :

- An authentication bypass flaw exists in that an empty password is accepted in some authentication methods. (CVE-2017-7546)

- An information disclosure vulnerability exists in the 'pg_user_mappings' catalog view that can disclose passwords to users lacking server privileges. (CVE-2017-7547)

Note: The 'pg_user_mappings' update will only fix the behavior in newly created clusters utilizing initdb. To fix this issue on existing systems you will need to follow the steps in the release notes.

- A flaw exists in the lo_put() function due to improper checking of permissions that leads to ignoring of ACLs. (CVE-2017-7548)

Solution

Upgrade to PostgreSQL version 9.2.22 / 9.3.18 / 9.4.13 / 9.5.8 / 9.6.4 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.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 vulnerability:

  1. GitHub: https://github.com/snic-nsc/cvechecker
    [CVE-2017-7546]

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-7546
CVSS V2 Vector: AV:N/AC:L/Au:N/C:P/I:P/A:P/E:U/RL:OF/RC:C
CVSS Base Score:7.5 (High)
Impact Subscore:6.4
Exploitability Subscore:10.0
CVSS Temporal Score:5.5 (Medium)
CVSS Environmental Score:NA (None)
Modified Impact Subscore:NA
Overall CVSS Score:5.5 (Medium)
CVSS V3 Vector: CVSS:3.0/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H/E:U/RL:O/RC:C
CVSS Base Score:9.8 (Critical)
Impact Subscore:5.9
Exploitability Subscore:3.9
CVSS Temporal Score:8.5 (High)
CVSS Environmental Score:NA (None)
Modified Impact Subscore:NA
Overall CVSS Score:8.5 (High)

Go back to menu.

Plugin Source


This is the postgresql_20170810.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(102527);
  script_version("1.17");
  script_set_attribute(attribute:"plugin_modification_date", value:"2022/04/11");

  script_cve_id("CVE-2017-7546", "CVE-2017-7547", "CVE-2017-7548");

  script_name(english:"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");

  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.22, 9.3.x prior to 9.3.18, 9.4.x prior to 9.4.13, 9.5.x prior
to 9.5.8, or 9.6.x prior to 9.6.4. It is, therefore, affected by
multiple vulnerabilities :

  - An authentication bypass flaw exists in that an empty password is
    accepted in some authentication methods. (CVE-2017-7546)

  - An information disclosure vulnerability exists in the
    'pg_user_mappings' catalog view that can disclose passwords to
    users lacking server privileges. (CVE-2017-7547)

    Note: The 'pg_user_mappings' update will only fix the behavior in
    newly created clusters utilizing initdb. To fix this issue on
    existing systems you will need to follow the steps in the release
    notes.

  - A flaw exists in the lo_put() function due to improper checking of
    permissions that leads to ignoring of ACLs. (CVE-2017-7548)");
  script_set_attribute(attribute:"see_also", value:"https://www.postgresql.org/about/news/1772/");
  script_set_attribute(attribute:"see_also", value:"https://www.postgresql.org/docs/current/static/release-9-2-22.html");
  script_set_attribute(attribute:"see_also", value:"https://www.postgresql.org/docs/current/release-9-3-18.html");
  script_set_attribute(attribute:"see_also", value:"https://www.postgresql.org/docs/current/release-9-4-13.html");
  script_set_attribute(attribute:"see_also", value:"https://www.postgresql.org/docs/current/release-9-5-8.html");
  script_set_attribute(attribute:"see_also", value:"https://www.postgresql.org/docs/current/release-9-6-4.html");
  script_set_attribute(attribute:"solution", value:
"Upgrade to PostgreSQL version 9.2.22 / 9.3.18 / 9.4.13 / 9.5.8 / 9.6.4
or later.");
  script_set_attribute(attribute:"agent", value:"all");
  script_set_cvss_base_vector("CVSS2#AV:N/AC:L/Au:N/C:P/I:P/A:P");
  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:H/A:H");
  script_set_cvss3_temporal_vector("CVSS:3.0/E:U/RL:O/RC:C");
  script_set_attribute(attribute:"cvss_score_source", value:"CVE-2017-7546");

  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/08/10");
  script_set_attribute(attribute:"patch_publication_date", value:"2017/08/10");
  script_set_attribute(attribute:"plugin_publication_date", value:"2017/08/16");

  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.22 / 9.3.18 / 9.4.13 / 9.5.8 / 9.6.4
constraints = [
  { "min_version" : "9.2", "fixed_version" : "9.2.22" },
  { "min_version" : "9.3", "fixed_version" : "9.3.18" },
  { "min_version" : "9.4", "fixed_version" : "9.4.13" },
  { "min_version" : "9.5", "fixed_version" : "9.5.8" },
  { "min_version" : "9.6", "fixed_version" : "9.6.4" }
];

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

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

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

Go back to menu.

How to Run


Here is how to run the 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 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.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 plugin ID 102527.
  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_20170810.nasl -t <IP/HOST>

Run the plugin with audit trail message on the console:

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

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

/opt/nessus/bin/nasl -T - postgresql_20170810.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_20170810.nasl -t <IP/HOST>

Go back to menu.

References


See also: Similar and related Nessus plugins:
  • 102872 - Amazon Linux AMI : postgresql93 / postgresql92 (ALAS-2017-884)
  • 102873 - Amazon Linux AMI : postgresql94 / postgresql95 (ALAS-2017-885)
  • 103755 - Amazon Linux AMI : postgresql96 (ALAS-2017-908)
  • 103230 - CentOS 7 : postgresql (CESA-2017:2728)
  • 103706 - CentOS 6 : postgresql (CESA-2017:2860)
  • 102368 - Debian DLA-1051-1 : postgresql-9.1 security update
  • 102442 - Debian DSA-3935-1 : postgresql-9.4 - security update
  • 102443 - Debian DSA-3936-1 : postgresql-9.6 - security update
  • 103733 - EulerOS 2.0 SP1 : postgresql (EulerOS-SA-2017-1231)
  • 103734 - EulerOS 2.0 SP2 : postgresql (EulerOS-SA-2017-1232)
  • 102828 - Fedora 25 : postgresql (2017-9148fe36b9)
  • 102490 - Fedora 26 : postgresql (2017-d9cac37bd8)
  • 102614 - Fedora 26 : mingw-postgresql (2017-f9e66916ec)
  • 102408 - FreeBSD : PostgreSQL vulnerabilities (982872f1-7dd3-11e7-9736-6cc21735f730)
  • 103724 - GLSA-201710-06 : PostgreSQL: Multiple vulnerabilities
  • 127366 - NewStart CGSL MAIN 4.05 : postgresql Vulnerability (NS-SA-2019-0121)
  • 103156 - openSUSE Security Update : postgresql94 (openSUSE-2017-1020)
  • 103157 - openSUSE Security Update : postgresql96 (openSUSE-2017-1021)
  • 102847 - openSUSE Security Update : postgresql93 (openSUSE-2017-985)
  • 106965 - openSUSE Security Update : postgresql95 (openSUSE-2018-204)
  • 103238 - Oracle Linux 7 : postgresql (ELSA-2017-2728)
  • 103684 - Oracle Linux 6 : postgresql (ELSA-2017-2860)
  • 104031 - PostgreSQL Empty Password Handling Remote Authentication Bypass
  • 103209 - RHEL 7 : postgresql (RHSA-2017:2728)
  • 103686 - RHEL 6 : postgresql (RHSA-2017:2860)
  • 103244 - Scientific Linux Security Update : postgresql on SL7.x x86_64 (20170914)
  • 103688 - Scientific Linux Security Update : postgresql on SL6.x i386/x86_64 (20171005)
  • 102695 - SUSE SLES12 Security Update : postgresql93 (SUSE-SU-2017:2236-1)
  • 102800 - SUSE SLES11 Security Update : postgresql94 (SUSE-SU-2017:2258-1)
  • 102973 - SUSE SLED12 / SLES12 Security Update : postgresql94 (SUSE-SU-2017:2355-1)
  • 102974 - SUSE SLED12 / SLES12 Security Update : postgresql96 (SUSE-SU-2017:2356-1)
  • 102522 - Ubuntu 14.04 LTS / 16.04 LTS / 17.04 : postgresql-9.3, postgresql-9.5, postgresql-9.6 vulnerabilities (USN-3390-1)
  • 119231 - Virtuozzo 6 : postgresql / postgresql-contrib / postgresql-devel / etc (VZLSA-2017-2860)

Version


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

Go back to menu.