PostgreSQL 11.x < 11.11 / 12.x < 12.6 / 13.x < 13.2 Multiple Vulnerabilities - Nessus

Medium   Plugin ID: 148419

This page contains detailed information about the PostgreSQL 11.x < 11.11 / 12.x < 12.6 / 13.x < 13.2 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: 148419
Name: PostgreSQL 11.x < 11.11 / 12.x < 12.6 / 13.x < 13.2 Multiple Vulnerabilities
Filename: postgresql_20210211.nasl
Vulnerability Published: 2021-02-11
This Plugin Published: 2021-04-09
Last Modification Time: 2022-04-11
Plugin Version: 1.8
Plugin Type: local
Plugin Family: Databases
Dependencies: postgres_installed_nix.nbin, postgres_installed_windows.nbin, postgresql_version.nbin

Vulnerability Information


Severity: Medium
Vulnerability Published: 2021-02-11
Patch Published: 2021-02-11
CVE [?]: CVE-2021-3393, CVE-2021-20229
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 11 prior to 11.11, 12 prior to 12.6, or 13 prior to 13.2. As such, it is potentially affected by multiple vulnerabilities :

- An information leak was discovered in postgresql in versions before 13.2, before 12.6 and before 11.11. A user having UPDATE permission but not SELECT permission to a particular column could craft queries which, under some circumstances, might disclose values from that column in error messages. An attacker could use this flaw to obtain information stored in a column they are allowed to write but not read. (CVE-2021-3393)

- A flaw was found in PostgreSQL in versions before 13.2, before 12.6, before 11.11. This flaw allows a user with SELECT privilege on one column to craft a special query that returns all columns of the table. The highest threat from this vulnerability is to confidentiality (CVE-2021-20229)

Note that Nessus has not tested for this issue but has instead relied only on the application's self-reported version number.

Solution

Upgrade to PostgreSQL 11.11 / 12.6 / 13.2 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 11.x < 11.11 / 12.x < 12.6 / 13.x < 13.2 Multiple Vulnerabilities vulnerability:

  1. GitHub: https://github.com/JamesGeeee/CVE-2021-3393
    [CVE-2021-3393: PoC for exploiting CVE-2021-3393]

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-2021-20229
CVSS V2 Vector: AV:N/AC:L/Au:S/C:P/I:N/A:N/E:U/RL:OF/RC:C
CVSS Base Score:4.0 (Medium)
Impact Subscore:2.9
Exploitability Subscore:8.0
CVSS Temporal Score:3.0 (Low)
CVSS Environmental Score:NA (None)
Modified Impact Subscore:NA
Overall CVSS Score:3.0 (Low)
CVSS V3 Vector: CVSS:3.0/AV:N/AC:L/PR:L/UI:N/S:U/C:L/I:N/A:N/E:U/RL:O/RC:C
CVSS Base Score:4.3 (Medium)
Impact Subscore:1.4
Exploitability Subscore:2.8
CVSS Temporal Score:3.8 (Low)
CVSS Environmental Score:NA (None)
Modified Impact Subscore:NA
Overall CVSS Score:3.8 (Low)
STIG Severity [?]: II
STIG Risk Rating: Medium

Go back to menu.

Plugin Source


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

#%NASL_MIN_LEVEL 70300
##
# (C) Tenable Network Security, Inc.
#
# Portions Copyright (C) 1996-2019, The PostgreSQL Global Development Group
# Portions Copyright (C) 1994, The Regents of the University of California
# Permission to use, copy, modify, and distribute this software and its documentation for any purpose, without fee, and without a written agreement is hereby granted, provided that the above copyright notice and this paragraph and the following two paragraphs appear in all copies.
# IN NO EVENT SHALL THE UNIVERSITY OF CALIFORNIA BE LIABLE TO ANY PARTY FOR DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES, INCLUDING LOST PROFITS, ARISING OUT OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN IF THE UNIVERSITY OF CALIFORNIA HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
# THE UNIVERSITY OF CALIFORNIA SPECIFICALLY DISCLAIMS ANY WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE PROVIDED HEREUNDER IS ON AN "AS IS" BASIS, AND THE UNIVERSITY OF CALIFORNIA HAS NO OBLIGATIONS TO PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS.
##

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

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

  script_cve_id("CVE-2021-3393", "CVE-2021-20229");
  script_xref(name:"IAVB", value:"2021-B-0023-S");

  script_name(english:"PostgreSQL 11.x < 11.11 / 12.x < 12.6 / 13.x < 13.2 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 11 prior to 11.11, 12 prior to 12.6, or 13 prior to 13.2. As
such, it is potentially affected by multiple vulnerabilities :

  - An information leak was discovered in postgresql in versions before 13.2, before 12.6 and before 11.11.
    A user having UPDATE permission but not SELECT permission to a particular column could craft queries
    which, under some circumstances, might disclose values from that column in error messages. An attacker
    could use this flaw to obtain information stored in a column they are allowed to write but not read.
    (CVE-2021-3393)

  - A flaw was found in PostgreSQL in versions before 13.2, before 12.6, before 11.11. This flaw allows a
    user with SELECT privilege on one column to craft a special query that returns all columns of the table.
    The highest threat from this vulnerability is to confidentiality (CVE-2021-20229)

Note that Nessus has not tested for this issue but has instead relied only on the application's self-reported version
number.");
  # https://www.postgresql.org/about/news/postgresql-132-126-1111-1016-9621-and-9525-released-2165/
  script_set_attribute(attribute:"see_also", value:"http://www.nessus.org/u?56673af4");
  script_set_attribute(attribute:"see_also", value:"https://access.redhat.com/security/cve/CVE-2021-20229");
  script_set_attribute(attribute:"see_also", value:"https://access.redhat.com/security/cve/CVE-2021-3393");
  script_set_attribute(attribute:"solution", value:
"Upgrade to PostgreSQL 11.11 / 12.6 / 13.2 or later");
  script_set_attribute(attribute:"agent", value:"all");
  script_set_cvss_base_vector("CVSS2#AV:N/AC:L/Au:S/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:L/UI:N/S:U/C:L/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-2021-20229");

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

  script_set_attribute(attribute:"vuln_publication_date", value:"2021/02/11");
  script_set_attribute(attribute:"patch_publication_date", value:"2021/02/11");
  script_set_attribute(attribute:"plugin_publication_date", value:"2021/04/09");

  script_set_attribute(attribute:"plugin_type", value:"local");
  script_set_attribute(attribute:"cpe", value:"cpe:/a:postgresql:postgresql");
  script_set_attribute(attribute:"stig_severity", value:"II");
  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) 2021-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);

#  11.11 / 12.6 / 13.2
var constraints = [
  { 'min_version' : '11', 'fixed_version' : '11.11' },
  { 'min_version' : '12', 'fixed_version' : '12.6' },
  { 'min_version' : '13', 'fixed_version' : '13.2' }
];

vcf::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_20210211.nasl
  • Windows:
    C:\ProgramData\Tenable\Nessus\nessus\plugins\postgresql_20210211.nasl
  • Mac OS X:
    /Library/Nessus/run/lib/nessus/plugins/postgresql_20210211.nasl

Go back to menu.

How to Run


Here is how to run the PostgreSQL 11.x < 11.11 / 12.x < 12.6 / 13.x < 13.2 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 11.x < 11.11 / 12.x < 12.6 / 13.x < 13.2 Multiple Vulnerabilities plugin ID 148419.
  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_20210211.nasl -t <IP/HOST>

Run the plugin with audit trail message on the console:

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

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

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

Go back to menu.

References


IAVB | Information Assurance Vulnerability Bulletin:
  • 2021-B-0023-S
See also: Similar and related Nessus plugins:
  • 150837 - CentOS 8 : postgresql:12 (CESA-2021:2372)
  • 157026 - GLSA-202105-32 : PostgreSQL: Multiple vulnerabilities
  • 147850 - openSUSE Security Update : postgresql12 (openSUSE-2021-423)
  • 150723 - Oracle Linux 8 : postgresql:12 (ELSA-2021-2372)
  • 150815 - RHEL 8 : postgresql:12 (RHSA-2021:2372)
  • 150759 - RHEL 8 : postgresql:12 (RHSA-2021:2389)
  • 150790 - RHEL 7 : rh-postgresql12-postgresql (RHSA-2021:2394)
  • 157772 - Rocky Linux 8 : postgresql:12 (RLSA-2021:2372)
  • 146788 - SUSE SLED15 / SLES15 Security Update : postgresql13 (SUSE-SU-2021:0543-1)
  • 146789 - SUSE SLED15 / SLES15 Security Update : postgresql12 (SUSE-SU-2021:0544-1)
  • 146785 - SUSE SLES12 Security Update : postgresql13 (SUSE-SU-2021:0545-1)
  • 147050 - SUSE SLES15 Security Update : postgresql12 (SUSE-SU-2021:0695-1)
  • 150100 - SUSE SLES12 Security Update : postgresql12 (SUSE-SU-2021:1783-1)
  • 146494 - Ubuntu 20.04 LTS / 20.10 : PostgreSQL vulnerability (USN-4735-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
  • 100260 - 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
  • 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
  • 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_20210211.nasl version 1.8. For more plugins, visit the Nessus Plugin Library.

Go back to menu.