Your submission was sent successfully! Close

You have successfully unsubscribed! Close

Thank you for signing up for our newsletter!
In these regular emails you will find the latest updates about Ubuntu and upcoming events where you can meet our team.Close

USN-288-3: PostgreSQL client vulnerabilities

9 June 2006

PostgreSQL client vulnerabilities

Reduce your security exposure

Ubuntu Pro provides ten-year security coverage to 25,000+ packages in Main and Universe repositories, and it is free for up to five machines.

Learn more about Ubuntu Pro



USN-288-1 described a PostgreSQL client vulnerability in the way
the >>'<< character is escaped in SQL queries. It was determined that
the PostgreSQL backends of Exim, Dovecot, and Postfix used this unsafe
escaping method.

For reference, these are the details of the original USN:

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

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

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 for further

Reduce your security exposure

Ubuntu Pro provides ten-year security coverage to 25,000+ packages in Main and Universe repositories, and it is free for up to five machines.

Learn more about Ubuntu Pro

Update instructions

The problem can be corrected by updating your system to the following package versions:

Ubuntu 6.06
  • exim4-daemon-heavy - 4.60-3ubuntu3.1
  • postfix-pgsql - 2.2.10-1ubuntu0.1
  • dovecot-common - 1.0.beta3-3ubuntu5.1
Ubuntu 5.10
  • exim4-daemon-heavy - 4.52-1ubuntu0.1
  • postfix-pgsql - 2.2.4-1ubuntu2.1
  • dovecot-common - 0.99.14-1ubuntu1.1
Ubuntu 5.04
  • exim4-daemon-heavy - 4.34-10ubuntu0.1
  • postfix-pgsql - 2.1.5-9ubuntu3.1
  • dovecot-common - 0.99.13-3ubuntu0.1

In general, a standard system upgrade is sufficient to effect the
necessary changes.

Related notices

  • USN-288-2: postgresql-client-8.1, libpq-dev, postgresql-contrib-8.1, postgresql-8.1, libpq4
  • USN-288-1: postgresql-client, postgresql-contrib-7.4, postgresql-8.0, postgresql-client-7.4, postgresql-client-8.0, libpq3, postgresql-7.4, python2.3-pgsql, postgresql-contrib-8.0, python2.4-psycopg, postgresql, python2.4-pgsql, python2.3-psycopg, libpq4, postgresql-contrib
  • USN-303-1: mysql-server-4.1, mysql-server-5.0, libmysqlclient14, libmysqlclient15off