Ubuntu 5.04 / 5.10 : postgresql-7.4/-8.0, postgresql, psycopg, (USN-288-1)

high Nessus Plugin ID 21613

Synopsis

The remote Ubuntu host is missing one or more security-related patches.

Description

CVE-2006-2313: Akio Ishida and Yasuo Ohgaki discovered a weakness in the handling of invalidly-encoded multibyte text data. If a client application processed untrusted input without respecting its encoding and applied standard string escaping techniques (such as replacing a single quote >>'<< with >>\'<< or >>''<<), the PostgreSQL server could interpret the resulting string in a way that allowed an attacker to inject arbitrary SQL commands into the resulting SQL query. The PostgreSQL server has been modified to reject such invalidly encoded strings now, which completely fixes the problem for some 'safe' multibyte encodings like UTF-8.

CVE-2006-2314: However, there are some less popular and client-only multibyte encodings (such as SJIS, BIG5, GBK, GB18030, and UHC) which contain valid multibyte characters that end with the byte 0x5c, which is the representation of the backslash character >>\<< in ASCII. Many client libraries and applications use the non-standard, but popular way of escaping the >>'<< character by replacing all occurences of it with >>\'<<. If a client application uses one of the affected encodings and does not interpret multibyte characters, and an attacker supplies a specially crafted byte sequence as an input string parameter, this escaping method would then produce a validly-encoded character and an excess >>'<< character which would end the string.
All subsequent characters would then be interpreted as SQL code, so the attacker could execute arbitrary SQL commands.

To fix this vulnerability end-to-end, client-side applications must be fixed to properly interpret multibyte encodings and use >>''<< instead of >>\'<<. However, as a precautionary measure, the sequence >>\'<< is now regarded as invalid when one of the affected client encodings is in use. If you depend on the previous behaviour, you can restore it by setting 'backslash_quote = on' in postgresql.conf. However, please be aware that this could render you vulnerable again.

This issue does not affect you if you only use single-byte (like SQL_ASCII or the ISO-8859-X family) or unaffected multibyte (like UTF-8) encodings.

Please see http://www.postgresql.org/docs/techdocs.50 for further details.

The psycopg and python-pgsql packages have been updated to consistently use >>''<< for escaping quotes in strings.

Note that Tenable Network Security has extracted the preceding description block directly from the Ubuntu security advisory. Tenable has attempted to automatically clean and format it as much as possible without introducing additional issues.

Solution

Update the affected packages.

Plugin Details

Severity: High

ID: 21613

File Name: ubuntu_USN-288-1.nasl

Version: 1.15

Type: local

Agent: unix

Published: 5/29/2006

Updated: 1/19/2021

Supported Sensors: Agentless Assessment, Continuous Assessment, Frictionless Assessment Agent, Frictionless Assessment AWS, Frictionless Assessment Azure, Nessus Agent, Nessus

Risk Information

VPR

Risk Factor: Medium

Score: 5.8

CVSS v2

Risk Factor: High

Base Score: 7.5

Temporal Score: 5.5

Vector: CVSS2#AV:N/AC:L/Au:N/C:P/I:P/A:P

Vulnerability Information

CPE: p-cpe:/a:canonical:ubuntu_linux:libpq3, p-cpe:/a:canonical:ubuntu_linux:postgresql-client-7.4, p-cpe:/a:canonical:ubuntu_linux:postgresql-dev, p-cpe:/a:canonical:ubuntu_linux:python2.3-pgsql, p-cpe:/a:canonical:ubuntu_linux:postgresql-8.0, p-cpe:/a:canonical:ubuntu_linux:postgresql-plpython-7.4, p-cpe:/a:canonical:ubuntu_linux:postgresql-doc-8.0, p-cpe:/a:canonical:ubuntu_linux:postgresql-client, p-cpe:/a:canonical:ubuntu_linux:postgresql-doc, p-cpe:/a:canonical:ubuntu_linux:python-pgsql, p-cpe:/a:canonical:ubuntu_linux:python-psycopg, p-cpe:/a:canonical:ubuntu_linux:postgresql, p-cpe:/a:canonical:ubuntu_linux:postgresql-plpython-8.0, p-cpe:/a:canonical:ubuntu_linux:libecpg5, p-cpe:/a:canonical:ubuntu_linux:postgresql-contrib-8.0, p-cpe:/a:canonical:ubuntu_linux:python2.4-psycopg, cpe:/o:canonical:ubuntu_linux:5.10, p-cpe:/a:canonical:ubuntu_linux:libecpg4, p-cpe:/a:canonical:ubuntu_linux:postgresql-doc-7.4, p-cpe:/a:canonical:ubuntu_linux:postgresql-pltcl-8.0, p-cpe:/a:canonical:ubuntu_linux:python2.3-psycopg, p-cpe:/a:canonical:ubuntu_linux:zope2.7-psycopgda, p-cpe:/a:canonical:ubuntu_linux:libpq4, p-cpe:/a:canonical:ubuntu_linux:postgresql-server-dev-8.0, p-cpe:/a:canonical:ubuntu_linux:postgresql-plperl-7.4, p-cpe:/a:canonical:ubuntu_linux:postgresql-contrib-7.4, p-cpe:/a:canonical:ubuntu_linux:libpq-dev, p-cpe:/a:canonical:ubuntu_linux:python2.4-pgsql, p-cpe:/a:canonical:ubuntu_linux:postgresql-contrib, p-cpe:/a:canonical:ubuntu_linux:postgresql-pltcl-7.4, p-cpe:/a:canonical:ubuntu_linux:postgresql-server-dev-7.4, p-cpe:/a:canonical:ubuntu_linux:postgresql-7.4, p-cpe:/a:canonical:ubuntu_linux:libecpg-compat2, p-cpe:/a:canonical:ubuntu_linux:libpgtypes2, cpe:/o:canonical:ubuntu_linux:5.04, p-cpe:/a:canonical:ubuntu_linux:libpgtcl-dev, p-cpe:/a:canonical:ubuntu_linux:libecpg-dev, p-cpe:/a:canonical:ubuntu_linux:libpgtcl, p-cpe:/a:canonical:ubuntu_linux:postgresql-client-8.0, p-cpe:/a:canonical:ubuntu_linux:postgresql-plperl-8.0

Required KB Items: Host/cpu, Host/Ubuntu, Host/Ubuntu/release, Host/Debian/dpkg-l

Exploit Ease: No known exploits are available

Patch Publication Date: 5/29/2006

Vulnerability Publication Date: 5/22/2006

Reference Information

CVE: CVE-2006-2313, CVE-2006-2314

BID: 18092

USN: 288-1