PostgreSQL ASCII escaping SQL injection

postgresql-ascii-sql-injection (26628) The risk level is classified as MediumMedium Risk

Description:

PostgreSQL is vulnerable to SQL injection. PostgreSQL fails to properly escape certain character encodings that use the ASCII code for a backslash as the trailing byte in a multibyte character. If a PostgreSQL-based Web application uses one of the affected character encoding sets, a remote attacker could exploit this vulnerability by sending specially-crafted SQL statements containing invalid multibyte encoded characters which would allow the attacker to bypass standard string escaping restrictions and possibly view, add, modify or delete information in the back-end database.

Note: This vulnerability could be exploited using a Web application that uses one of the following character sets:

  • SJIS
  • BIG5
  • GBK
  • GB18030
  • UHC

MailManager, which uses a vulnerable version of PostgreSQL, is also affected by this vulnerability.

Platforms Affected:

  • Canonical, Ubuntu 5.04
  • Canonical, Ubuntu 5.10
  • Canonical, Ubuntu 6.06 LTS
  • Debian, Debian Linux 3.1
  • Gentoo, Linux
  • PostgreSQL, PostgreSQL 7.3
  • PostgreSQL, PostgreSQL 7.3.1
  • PostgreSQL, PostgreSQL 7.3.10
  • PostgreSQL, PostgreSQL 7.3.11
  • PostgreSQL, PostgreSQL 7.3.12
  • PostgreSQL, PostgreSQL 7.3.13
  • PostgreSQL, PostgreSQL 7.3.14
  • PostgreSQL, PostgreSQL 7.3.2
  • PostgreSQL, PostgreSQL 7.3.3
  • PostgreSQL, PostgreSQL 7.3.4
  • PostgreSQL, PostgreSQL 7.3.5
  • PostgreSQL, PostgreSQL 7.3.6
  • PostgreSQL, PostgreSQL 7.3.7
  • PostgreSQL, PostgreSQL 7.3.8
  • PostgreSQL, PostgreSQL 7.3.9
  • PostgreSQL, PostgreSQL 7.4
  • PostgreSQL, PostgreSQL 7.4.1
  • PostgreSQL, PostgreSQL 7.4.10
  • PostgreSQL, PostgreSQL 7.4.11
  • PostgreSQL, PostgreSQL 7.4.12
  • PostgreSQL, PostgreSQL 7.4.2
  • PostgreSQL, PostgreSQL 7.4.3
  • PostgreSQL, PostgreSQL 7.4.4
  • PostgreSQL, PostgreSQL 7.4.5
  • PostgreSQL, PostgreSQL 7.4.6
  • PostgreSQL, PostgreSQL 7.4.7
  • PostgreSQL, PostgreSQL 7.4.8
  • PostgreSQL, PostgreSQL 7.4.9
  • PostgreSQL, PostgreSQL 8.0
  • PostgreSQL, PostgreSQL 8.0.1
  • PostgreSQL, PostgreSQL 8.0.2
  • PostgreSQL, PostgreSQL 8.0.3
  • PostgreSQL, PostgreSQL 8.0.4
  • PostgreSQL, PostgreSQL 8.0.5
  • PostgreSQL, PostgreSQL 8.0.6
  • PostgreSQL, PostgreSQL 8.0.7
  • PostgreSQL, PostgreSQL 8.1
  • PostgreSQL, PostgreSQL 8.1.1
  • PostgreSQL, PostgreSQL 8.1.2
  • PostgreSQL, PostgreSQL 8.1.3
  • RedHat, Enterprise Linux 3 WS
  • RedHat, Enterprise Linux 3 AS
  • RedHat, Enterprise Linux 3 Desktop
  • RedHat, Enterprise Linux 3 ES
  • RedHat, Enterprise Linux 4 Desktop
  • RedHat, Enterprise Linux 4 AS
  • RedHat, Enterprise Linux 4 ES
  • RedHat, Enterprise Linux 4 WS
  • SuSE, SuSE Linux 10.0
  • SuSE, SuSE Linux 10.1
  • SuSE, SuSE Linux 9.1
  • SuSE, SuSE Linux 9.2
  • SuSE, SuSE Linux 9.3
  • SuSE, SuSE Linux Enterprise Server 8.0
  • SuSE, SuSE SLES 9
  • Turbolinux, Turbolinux 10 Desktop
  • Turbolinux, Turbolinux 10 F...
  • Turbolinux, Turbolinux 10 Server
  • Turbolinux, Turbolinux 10 Server x64 Ed
  • Turbolinux, Turbolinux 7 Server
  • Turbolinux, Turbolinux 8 Server
  • Turbolinux, Turbolinux 8 Workstation
  • Turbolinux, Turbolinux Home
  • Turbolinux, Turbolinux Multimedia
  • Turbolinux, Turbolinux Personal
  • Turbolinux, Turbolinux Appliance Server 1.0 Hosting Ed
  • Turbolinux, Turbolinux Appliance Server 1.0 Workgroup Ed
  • Turbolinux, Turbolinux Appliance Server 2.0

Remedy:

Upgrade to the latest version of PostgreSQL (7.3.15 or later), (7.4.13 or later), (8.0.8 or later) or (8.1.4 or later), available from the PostgreSQL Web site. See References.

For Red Hat Linux:
Refer to RHSA-2006:0526-8 for patch, upgrade, or suggested workaround information. See References.

For Debian GNU/Linux:
Refer to DSA-1086-1 for patch, upgrade, or suggested workaround information. See References.

For Gentoo Linux:
Refer to Gentoo Linux Security Announcement GLSA 2006-07-04 for patch, upgrade, or suggested workaround information. See References.

For SUSE Linux:
Refer to SUSE Security Announcement SUSE-SA:2006:030 for patch, upgrade, or suggested workaround information. See References.

For other distributions:
Contact your vendor for upgrade or patch information.

Consequences:

Data Manipulation

References:

  • BugTraq Mailing List, Tue May 23 2006 - 12:47:42 CDT, PostgreSQL security releases 8.1.4, 8.0.8, 7.4.13, 7.3.15 at http://archives.neohapsis.com/archives/bugtraq/2006-05/0537.html.
  • Full-Disclosure Mailing List, Wed May 24 2006 - 16:05:56 CDT, rPSA-2006-0080-1 postgresql postgresql-server at http://archives.neohapsis.com/archives/fulldisclosure/2006-05/0622.html.
  • MailManager Web site, Logicalware Products: MailManager at http://www.logicalware.com/products/.
  • pgsql-announce Mailing List, Tue, 23 May 2006 08:30:21 -0700 , Security Releases for All Active Versions at http://archives.postgresql.org/pgsql-announce/2006-05/msg00010.php.
  • PostgreSQL Web site, Technical Information on Encoding-Based SQL Injection Exploit at http://www.postgresql.org/docs/techdocs.50.
  • PostgreSQL Web site, 8.1.4 et. al. Security Release Information at http://www.postgresql.org/docs/techdocs.52.
  • PostgreSQL Web site, PostgreSQL: Downloads at http://www.postgresql.org/download/.
  • ASA-2006-113: postgresql security update (RHSA-2006-0526)
  • BID-18092: PostgreSQL Multibyte Character Encoding SQL Injection Vulnerabilities
  • CVE-2006-2314: PostgreSQL 8.1.x before 8.1.4, 8.0.x before 8.0.8, 7.4.x before 7.4.13, 7.3.x before 7.3.15, and earlier versions allows context-dependent attackers to bypass SQL injection protection methods in applications that use multibyte encodings that allow the \ (backslash) byte 0x5c to be the trailing byte of a multibyte character, such as SJIS, BIG5, GBK, GB18030, and UHC, which cannot be handled correctly by a client that does not understand multibyte encodings, aka a second variant of Encoding-Based SQL Injection. NOTE: it could be argued that this is a class of issue related to interaction errors between the client and PostgreSQL, but a CVE has been assigned since PostgreSQL is treating this as a preventative measure against this class of problem.
  • CVE-2006-2824: Logicalware MailManager before 2.0.10 does not remove 0xc8 0x27 (0xc8 followed by a single-quote character) from the data stream to the server, which allows remote attackers to modify data and gain administrative access when PostgreSQL is used, aka bug #1494281 - Postgres encoding security hole. NOTE: while this issue involves PostgreSQL, it is specific to MailManager's interface to PostgreSQL and is therefore a different vulnerability than CVE-2006-2313 and CVE-2006-2314.
  • DSA-1087: postgresql -- programming error
  • GLSA-200607-04: PostgreSQL: SQL injection
  • OSVDB ID: 25731: PostgreSQL Single Quote Escaping Filter Bypass
  • RHSA-2006-0526: postgresql security update
  • SA20231: PostgreSQL Encoding-Based SQL Injection Vulnerability
  • SA20303: MailManager PostgreSQL Encoding-Based SQL Injection
  • SA20653: Avaya Products PostgreSQL Multiple Vulnerabilities
  • SECTRACK ID: 1016142: PostgreSQL Encoding Processes May Let Remote Users Inject SQL Commands
  • SUSE-SA:2006:030: PostgreSQL SQL injection attacks
  • SUSE-SR:2006:021: SUSE Security Summary Report

Reported:

May 23, 2006

The information within this database may change without notice. Use of this information constitutes acceptance for use in an AS IS condition. There are NO warranties, implied or otherwise, with regard to this information or its use. Any use of this information is at the user's risk. In no event shall the author/distributor (Internet Security Systems X-Force) be held liable for any damages whatsoever arising out of or in connection with the use or spread of this information.

Copyright (c) 1994-2008 Internet Security Systems, Inc. All rights reserved worldwide.

For corrections or additions please email xforce@iss.net

Return to the main page