oss-sec mailing list archives

postgresql-jdbc 8.1 SQL injection with postgresql server 9.1


From: Ludwig Nussel <ludwig.nussel () suse de>
Date: Fri, 30 Mar 2012 14:51:14 +0200

Hi,

Postgresql 9.1 turned "standard conforming strings" on by default[1][2].
postgresql-jdbc before version 8.2-504 however did not know about that
kind of string and escaped single quotes with a backslash always. When
such an old version of postgresql-jdbc is used with a newer postgresql
server it not only breaks when strings contain single quotes, it also
allows for SQL injections[3].
The bug is neither in postgresql-jdbc as it was working correctly at the
time it was released, nor is it really postgresql 9.1's fault which I
guess doesn't expect and can't detect such an old jdbc adapter. The
security issue arises when mixing the old adapter and the new server.
One might be inclined to say this is not a security issue as it's likely
to break during normal operation as soon as some string contains a
single quote. But then isn't that the case for SQL injections in
general?

[1] http://www.depesz.com/2010/07/21/waiting-for-9-1-standard_conforming_strings-on/
[2] http://archives.postgresql.org/pgsql-committers/2010-07/msg00210.php
[3] http://lists.opensuse.org/opensuse-security/2012-03/msg00024.html

cu
Ludwig

-- 
 (o_   Ludwig Nussel
 //\
 V_/_  http://www.suse.de/
SUSE LINUX Products GmbH, GF: Jeff Hawn, Jennifer Guild, Felix Imendörffer, HRB 16746 (AG Nürnberg) 


Current thread: