| From: | Hannes Dorbath <light(at)theendofthetunnel(dot)de> | 
|---|---|
| To: | pgsql-general(at)postgresql(dot)org | 
| Subject: | Re: SQL injection | 
| Date: | 2005-11-03 16:13:09 | 
| Message-ID: | dkdctd$1n5b$1@news.hub.org | 
| Views: | Whole Thread | Raw Message | Download mbox | Resend email | 
| Thread: | |
| Lists: | pgsql-general | 
On 03.11.2005 16:15, Alex Turner wrote:
> Please, enlighten us all and demostrate a case of SQL Injection that
> gets around magic quotes. 
Just someone needs to forget to put quotes around a param..
$q = "DELETE FROM foo WHERE bar = {$_GET['id']};";
instead of
$q = "DELETE FROM foo WHERE bar = '{$_GET['id']}';";
It deadly, with or without magic_quotes. pg_query_params() prevents such 
situations. Besides some encoding tricks to encode single quotes 
(%2527).. mb_string, mod_rewrite there are many things that /can/ 
prevent MQ from working as expected, search google. And even if MQ does 
what it should, errors like the above are very common. Oh, and why MQ is 
evil, really not all data passed to a PHP script is meant to be used as 
query params, and if so, create a recursive version of array_map() and 
use that with pg_escape_string as callback.
-- 
Regards,
Hannes Dorbath
| From | Date | Subject | |
|---|---|---|---|
| Next Message | codeWarrior | 2005-11-03 16:16:01 | Re: Replicating databases | 
| Previous Message | Aly Dharshi | 2005-11-03 16:12:30 | Re: question about Postgresql and rsync |