Vulnerabilities > CVE-2016-7048 - Improper Access Control vulnerability in Postgresql

047910
CVSS 8.1 - HIGH
Attack vector
NETWORK
Attack complexity
HIGH
Privileges required
NONE
Confidentiality impact
HIGH
Integrity impact
HIGH
Availability impact
HIGH
network
high complexity
postgresql
CWE-284
nessus

Summary

The interactive installer in PostgreSQL before 9.3.15, 9.4.x before 9.4.10, and 9.5.x before 9.5.5 might allow remote attackers to execute arbitrary code by leveraging use of HTTP to download software.

Vulnerable Configurations

Part Description Count
Application
Postgresql
323

Common Weakness Enumeration (CWE)

Common Attack Pattern Enumeration and Classification (CAPEC)

  • Embedding Scripts within Scripts
    An attack of this type exploits a programs' vulnerabilities that are brought on by allowing remote hosts to execute scripts. The attacker leverages this capability to execute scripts to execute his/her own script by embedding it within other scripts that the target software is likely to execute. The attacker must have the ability to inject script into script that is likely to be executed. If this is done, then the attacker can potentially launch a variety of probes and attacks against the web server's local environment, in many cases the so-called DMZ, back end resources the web server can communicate with, and other hosts. With the proliferation of intermediaries, such as Web App Firewalls, network devices, and even printers having JVMs and Web servers, there are many locales where an attacker can inject malicious scripts. Since this attack pattern defines scripts within scripts, there are likely privileges to execute said attack on the host. Of course, these attacks are not solely limited to the server side, client side scripts like Ajax and client side JavaScript can contain malicious scripts as well. In general all that is required is for there to be sufficient privileges to execute a script, but not protected against writing.
  • Signature Spoofing by Key Theft
    An attacker obtains an authoritative or reputable signer's private signature key by theft and then uses this key to forge signatures from the original signer to mislead a victim into performing actions that benefit the attacker.

Nessus

NASL familyDatabases
NASL idPOSTGRESQL_20161027.NASL
descriptionThe version of PostgreSQL installed on the remote host is 9.1.x prior to 9.1.24, 9.2.x prior to 9.2.19, 9.3.x prior to 9.3.15, 9.4.x prior to 9.4.10, 9.5.x prior to 9.5.5, or 9.6.x prior to 9.6.1. It is, therefore, affected by a denial of service vulnerability due to a use-after-free error when executing aggregate functions using DISTINCT. An unauthenticated, remote attacker can exploit this to deference already freed memory, resulting in crashing the database.
last seen2020-06-01
modified2020-06-02
plugin id94610
published2016-11-07
reporterThis script is Copyright (C) 2016-2019 and is owned by Tenable, Inc. or an Affiliate thereof.
sourcehttps://www.tenable.com/plugins/nessus/94610
titlePostgreSQL 9.1.x < 9.1.24 / 9.2.x < 9.2.19 / 9.3.x < 9.3.15 / 9.4.x < 9.4.10 / 9.5.x < 9.5.5 / 9.6.x < 9.6.1 Aggregate Functions Use-after-free DoS
code
#
# (C) Tenable Network Security, Inc
#

include("compat.inc");

if (description)
{
  script_id(94610);
  script_version("1.10");
  script_cvs_date("Date: 2019/11/14");

  script_cve_id("CVE-2016-7048");

  script_name(english:"PostgreSQL 9.1.x < 9.1.24 / 9.2.x < 9.2.19 / 9.3.x < 9.3.15 / 9.4.x < 9.4.10 / 9.5.x < 9.5.5 / 9.6.x < 9.6.1 Aggregate Functions Use-after-free DoS");
  script_summary(english:"Checks the version of PostgreSQL.");

  script_set_attribute(attribute:"synopsis", value:
"The remote database server is affected by a denial of service
vulnerability.");
  script_set_attribute(attribute:"description", value:
"The version of PostgreSQL installed on the remote host is 9.1.x prior
to 9.1.24, 9.2.x prior to 9.2.19, 9.3.x prior to 9.3.15, 9.4.x prior
to 9.4.10, 9.5.x prior to 9.5.5, or 9.6.x prior to 9.6.1. It is,
therefore, affected by a denial of service vulnerability due to a
use-after-free error when executing aggregate functions using
DISTINCT. An unauthenticated, remote attacker can exploit this to
deference already freed memory, resulting in crashing the database.");
  script_set_attribute(attribute:"see_also", value:"https://www.postgresql.org/about/news/1712/");
  script_set_attribute(attribute:"see_also", value:"https://www.postgresql.org/docs/current/release-9-1-24.html");
  script_set_attribute(attribute:"see_also", value:"https://www.postgresql.org/docs/current/static/release-9-2-19.html");
  script_set_attribute(attribute:"see_also", value:"https://www.postgresql.org/docs/current/release-9-3-15.html");
  script_set_attribute(attribute:"see_also", value:"https://www.postgresql.org/docs/current/release-9-4-10.html");
  script_set_attribute(attribute:"see_also", value:"https://www.postgresql.org/docs/current/release-9-5-5.html");
  script_set_attribute(attribute:"see_also", value:"https://www.postgresql.org/docs/current/release-9-6-1.html");
  script_set_attribute(attribute:"solution", value:
"Upgrade to PostgreSQL version 9.1.24 / 9.2.19 / 9.3.15 / 9.4.10 /
9.5.5 / 9.6.1 or later.");
  script_set_cvss_base_vector("CVSS2#AV:N/AC:M/Au:N/C:C/I:C/A:C");
  script_set_cvss_temporal_vector("CVSS2#E:U/RL:OF/RC:C");
  script_set_cvss3_base_vector("CVSS:3.0/AV:N/AC:H/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-2016-7048");

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

  script_set_attribute(attribute:"vuln_publication_date", value:"2016/10/27");
  script_set_attribute(attribute:"patch_publication_date", value:"2016/10/27");
  script_set_attribute(attribute:"plugin_publication_date", value:"2016/11/07");

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

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

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

  script_dependencies("postgresql_version.nbin");
  script_require_ports("Services/postgresql", 5432);

  exit(0);
}

include("audit.inc");
include("backport.inc");
include("global_settings.inc");
include("misc_func.inc");

port = get_service(svc:"postgresql", default:5432, exit_on_fail:TRUE);

version = get_kb_item_or_exit('database/'+port+'/postgresql/version');
source = get_kb_item_or_exit('database/'+port+'/postgresql/source');
database = get_kb_item('database/'+port+'/postgresql/database_name');

get_backport_banner(banner:source);
if (backported && report_paranoia < 2) audit(AUDIT_BACKPORT_SERVICE, port, 'PostgreSQL server');

ver = split(version, sep:'.');
for (i=0; i < max_index(ver); i++)
  ver[i] = int(ver[i]);

if (
  (ver[0] == 9 && ver[1] == 1 && ver[2] < 24) ||
  (ver[0] == 9 && ver[1] == 2 && ver[2] < 19) ||
  (ver[0] == 9 && ver[1] == 3 && ver[2] < 15) ||
  (ver[0] == 9 && ver[1] == 4 && ver[2] < 10) ||
  (ver[0] == 9 && ver[1] == 5 && ver[2] < 5) ||
  (ver[0] == 9 && ver[1] == 6 && ver[2] < 1)
)
{
  if(database)
  {
    order = make_list("Database name", "Version source", "Installed version", "Fixed version");
    report = make_array(
      order[0], database,
      order[1], source,
      order[2], version,
      order[3], "9.1.24 / 9.2.19 / 9.3.15 / 9.4.10 / 9.5.5 / 9.6.1"
    );
  }
  else
  {
    order = make_list("Version source", "Installed version", "Fixed version");
    report = make_array(
      order[0], source,
      order[1], version,
    order[2], "9.1.24 / 9.2.19 / 9.3.15 / 9.4.10 / 9.5.5 / 9.6.1"
    );
  }

  report = report_items_str(report_items:report, ordered_fields:order);
  security_report_v4(port:port, extra:report, severity:SECURITY_HOLE);
  exit(0);
}
else audit(AUDIT_LISTEN_NOT_VULN, 'PostgreSQL', port, version);