Re: Prepared Statements

From: Kris Jurka <books(at)ejurka(dot)com>
To: Peter Kovacs <peter(dot)kovacs(at)siemens(dot)com>
Cc: Fernando Nasser <fnasser(at)redhat(dot)com>, Dima Tkach <dmitry(at)openratings(dot)com>, Oliver Jowett <oliver(at)opencloud(dot)com>, Kim Ho <kho(at)redhat(dot)com>, Barry Lind <blind(at)xythos(dot)com>, pgsql-jdbc-list <pgsql-jdbc(at)postgresql(dot)org>, Dave Cramer <Dave(at)micro-automation(dot)net>
Subject: Re: Prepared Statements
Date: 2003-07-22 05:52:20
Message-ID: Pine.LNX.4.33.0307220149200.14671-100000@leary.csoft.net
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-jdbc

On Mon, 21 Jul 2003, Peter Kovacs wrote:

> I think that the simplest thing would be to have an option in the
> backend to disable processing of multiple statements in one query --
> i.e. disallow the use of ';' as a separator of statements. I am not sure
> why this feature (multiple statments in one query) is there anyway.
> "Reduce network roundtrips" is the usual reply, but, then, what is the
> purpose of stored procedures (functions in PostgreSQL)?
>

> From this perspective, the whole wrestling with "drop table..." and
> similar risks seem farily vain to me. At least, the driver is not the
> place to solve this kind of security problems which basically exist due
> to the wya the server behaves. Instead, the question should be asked: is
> the behaviour of the server optimal?. Do we need this feature
> (processing multiple, semi-colon separated statements)? Should not this
> feature be eventually optional?

The second statement type of attack is just one variant. Consider a query
that displayed a list of your orders. SELECT * FROM orders WHERE
userid='username'. Suppose I substituted a username of username' OR
true OR userid='. This is another injection attack that does not
require the backend to support multiple statements per query.

Kris Jurka

In response to

Browse pgsql-jdbc by date

  From Date Subject
Next Message Tom Lane 2003-07-22 05:56:03 Re: Prepared Statements
Previous Message Barry Lind 2003-07-22 05:49:14 Patch applied for SQL Injection vulnerability for setObject(int, Object, int)