Re: Is it possible to do some damage to database with SELECT query?

From: Karsten Hilbert <Karsten(dot)Hilbert(at)gmx(dot)net>
To: pgsql-general(at)postgresql(dot)org
Subject: Re: Is it possible to do some damage to database with SELECT query?
Date: 2008-07-22 13:28:42
Message-ID: 20080722132840.GB3859@merkur.hilbert.loc
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On Tue, Jul 22, 2008 at 12:20:46PM +0200, A. Kretschmer wrote:

> > is it possible to make a SELECT query with some nasty follow up commands,
> > which damages the database.
> >
> > Something like:
> >
> > SELECT *,(DROP DATABASE enterprise) AS roger FROM sales WHERE sales >
> > (UPDATE order SET order=1);
> >
> > I know this wont work, but is there some possibility to modify database
> > with SELECT query?
>
> Sure, with sql-injection. There are a lot to read via google, for
> instance http://en.wikipedia.org/wiki/SQL_injection

That's why on important databases you'd configure them

"set default_transaction_read_only to on"

and only reverse that connect by connect when a writable
connection is truly needed. That way injectors will not only
have to hijack *any* connection but pick the right one, too.

It also nicely keeps average users from destroying their
data with admin tools like pgadmin etc.

And then there's role based per-table permissions, of course.

Karsten
--
GPG key ID E4071346 @ wwwkeys.pgp.net
E167 67FD A291 2BEA 73BD 4537 78B9 A9F9 E407 1346

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Josh Trutwin 2008-07-22 14:14:03 Re: ER diagram software
Previous Message Rich Shepard 2008-07-22 13:21:51 Problems Restarting PostgreSQL Daemon