CVE-2018-16850 SQL injection in postgresql

High 8.0 Published Updated

An attacker can execute arbitrary SQL statements with superuser privileges via crafted trigger definitions in pg_upgrade and pg_dump.

Exploited in the wild
Not known
Login needed
Any signed-in user
Attackable
Over the internet
Victim action needed
A user has to click or open something
Fix
Available

What is CVE-2018-16850?

CVE-2018-16850 is a high-severity SQL injection vulnerability in Canonical Ubuntu Linux, published on 13 Nov 2018. Any signed-in user can exploit it over the network, and only if a user opens a file or follows a link.

Official description

postgresql before versions 11.1, 10.6 is vulnerable to a to SQL injection in pg_upgrade and pg_dump via CREATE TRIGGER ... REFERENCING. Using a purpose-crafted trigger definition, an attacker can cause arbitrary SQL statements to run, with superuser privileges.

Weakness: CWE-89

Which versions are affected by CVE-2018-16850?

It affects 3 products.

Linux distribution packages (32)
rh-postgresql10-postgresql Red Hat:rhel_software_collections:3::el7All versions0:10.6-1.el7
rh-postgresql10-postgresql-contrib Red Hat:rhel_software_collections:3::el7All versions0:10.6-1.el7
rh-postgresql10-postgresql-contrib-syspaths Red Hat:rhel_software_collections:3::el7All versions0:10.6-1.el7
rh-postgresql10-postgresql-debuginfo Red Hat:rhel_software_collections:3::el7All versions0:10.6-1.el7
rh-postgresql10-postgresql-devel Red Hat:rhel_software_collections:3::el7All versions0:10.6-1.el7
rh-postgresql10-postgresql-docs Red Hat:rhel_software_collections:3::el7All versions0:10.6-1.el7
rh-postgresql10-postgresql-libs Red Hat:rhel_software_collections:3::el7All versions0:10.6-1.el7
rh-postgresql10-postgresql-plperl Red Hat:rhel_software_collections:3::el7All versions0:10.6-1.el7
rh-postgresql10-postgresql-plpython Red Hat:rhel_software_collections:3::el7All versions0:10.6-1.el7
rh-postgresql10-postgresql-pltcl Red Hat:rhel_software_collections:3::el7All versions0:10.6-1.el7
rh-postgresql10-postgresql-server Red Hat:rhel_software_collections:3::el7All versions0:10.6-1.el7
rh-postgresql10-postgresql-server-syspaths Red Hat:rhel_software_collections:3::el7All versions0:10.6-1.el7
rh-postgresql10-postgresql-static Red Hat:rhel_software_collections:3::el7All versions0:10.6-1.el7
rh-postgresql10-postgresql-syspaths Red Hat:rhel_software_collections:3::el7All versions0:10.6-1.el7
rh-postgresql10-postgresql-test Red Hat:rhel_software_collections:3::el7All versions0:10.6-1.el7
postgresql10 SUSE:Linux Enterprise Desktop 12 SP3All versions10.6-1.6.1
postgresql10-libs SUSE:Linux Enterprise Desktop 12 SP3All versions10.6-1.6.1
postgresql10 SUSE:Linux Enterprise Desktop 12 SP4All versions10.6-1.6.1
postgresql10-libs SUSE:Linux Enterprise Desktop 12 SP4All versions10.6-1.6.1
postgresql10 SUSE:Linux Enterprise Module for Basesystem 15All versions10.6-4.8.1
postgresql10 SUSE:Linux Enterprise Module for Package Hub 15All versions10.6-4.8.1
postgresql10 SUSE:Linux Enterprise Module for Server Applications 15All versions10.6-4.8.1
postgresql10 SUSE:Linux Enterprise Server 12 SP3All versions10.6-1.6.1
postgresql10-libs SUSE:Linux Enterprise Server 12 SP3All versions10.6-1.6.1
postgresql10 SUSE:Linux Enterprise Server 12 SP4All versions10.6-1.6.1
postgresql10-libs SUSE:Linux Enterprise Server 12 SP4All versions10.6-1.6.1
postgresql10 SUSE:Linux Enterprise Server for SAP Applications 12 SP3All versions10.6-1.6.1
postgresql10-libs SUSE:Linux Enterprise Server for SAP Applications 12 SP3All versions10.6-1.6.1
postgresql10 SUSE:Linux Enterprise Server for SAP Applications 12 SP4All versions10.6-1.6.1
postgresql10-libs SUSE:Linux Enterprise Server for SAP Applications 12 SP4All versions10.6-1.6.1
postgresql10-libs SUSE:Linux Enterprise Software Development Kit 12 SP3All versions10.6-1.6.1
postgresql10-libs SUSE:Linux Enterprise Software Development Kit 12 SP4All versions10.6-1.6.1

Products include Canonical Ubuntu Linux, Postgresql Postgresql, Redhat Enterprise Linux.

How do I fix CVE-2018-16850?

Upgrade to a fixed version.

Use parameterised queries everywhere and never build SQL by joining strings. Upgrade affected software first; a web application firewall only buys time. More about SQL injection.

Is CVE-2018-16850 being exploited?

There is no known exploitation of CVE-2018-16850 in the wild and no public exploit code.

All Canonical Ubuntu Linux vulnerabilities

Sources

Also known as ALPINE-CVE-2018-16850, CLEANSTART-2026-QP57180, GHSA-h6p9-49w4-8mm8, RHSA-2018:3757, SUSE-SU-2018:3770-1, SUSE-SU-2018:3770-2 and 3 more.

Is CVE-2018-16850 in your software?

Upload an SBOM and sbomify checks it against every vulnerability here, every day.

Check your SBOMs for free