From: Kevin Golding <tearinghairout@yahoo.com>
To: pgsql-php@postgresql.org
Subject: pg_query_params and SQL injection
Date: Mon, 1 Sep 2008 06:50:16 -0700 (PDT)
Message-ID: <723113.98907.qm@web52404.mail.re2.yahoo.com> (raw)
Hi all
I am just doing some playing around with PHP to learn how to avoid SQL injection attacks.
It has been mentioned in a few places that pg_query_params is supposed to protect from sql injection without needing to mess around escaping quotes and things.
However, I was still able to get it to drop a table by feeding in this input "1; drop table results" to the following statement:
$r = pg_query_params($p, 'select * from results where res_id = $1', array($input));
Everyone keeps repeating the same "pg_query_params is safe from SQL injection", but surely someone else must have actually tried it? Where am I going wrong?
I am using Postgresql 8.3 for OS X on 10.5.2, and MAMP which has PHP Version 5.2.5.
Thanks
Kevin
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients from your mail client; the link fills in
the headers below: reply via email
Some clients, webmail especially, drop In-Reply-To and References from
a link, and the reply then starts a new thread: use the mbox below.
To: pgsql-php@postgresql.org
Cc: tearinghairout@yahoo.com
Subject: Re: pg_query_params and SQL injection
In-Reply-To: <723113.98907.qm@web52404.mail.re2.yahoo.com>
References: <723113.98907.qm@web52404.mail.re2.yahoo.com>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox