note 14084 added to function.pg-exec.php
| From: | sterling at php2 dot chek dot com | Date: | Mon, 16 Jul 2001 20:08:35 +0000 |
| Subject: | note 14084 added to function.pg-exec.php | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-15448@lists.php.net to get a copy of this message | ||
I don't know whether to call this a feature or a bug but there is a security concern with the
way pg_exec() passes queries on to PostgreSQL. That is, be very careful of the use of GET or POST
variables being used in your queries.<br>
<br>
This is because multiple queries can be run for each call to pg_exec(). This means that a rather
benign looking query such as:<br>
<br>
select * from sometable where field='$post_value'<br>
<br>
However, if the $post_value was set to "'; insert into sometable(descr) values ('I am
a nasty hacker type person, so there! Ha ha!'); select * from sometable where field =
'x" the foreign user has now just modified your database. This could be VERY
bad.<br>
<br>
The user only needs to know something about the structure of your SQL and about your database
schema. Since many projects using PHP are OpenSource, many projects have this information on display
for anyone to discover. So, be careful!
http://www.php.net/manual/en/function.pg-exec.php