pg.ddx.io pgsql-php@postgresql.org mailing list archive
help / color / mirror / Atom feedpostgreSQL web form; Security
4+ messages / 4 participants
[nested] [flat]
* postgreSQL web form; Security
@ 2003-07-14 19:10 Davi Leal <davileal@terra.es>
2003-07-19 02:16 ` Re: postgreSQL web form; Security Rod Taylor <rbt@rbt.ca>
2003-07-19 08:53 ` Re: postgreSQL web form; Security Adrian Tineo <adriantineo@softhome.net>
2003-07-19 11:06 ` Re: postgreSQL web form; Security Michelle Konzack <linux4michelle@freenet.de>
0 siblings, 3 replies; 4+ messages in thread
From: Davi Leal @ 2003-07-14 19:10 UTC (permalink / raw)
To: pgsql-php; +Cc: web-dev@gnuherds.org
Hi,
We are developing a web page: PHP & postgreSQL. We can transform the below (a)
query to get the (b) query, if we add,
"01001'); DELETE * FROM tbHosp; INSERT INTO tbRev (Id) VALUES ('01001"
, as the value of Id in the web form.
(a) INSERT INTO tbRev (Id) VALUES ('01001');
(b) INSERT INTO tbRev (Id) VALUES ('01001'); DELETE FROM tbHosp; INSERT INTO
tbRev (Id) VALUES ('01001');
We are able to delete registers. We have checked and it works!. Microsoft
Access 2000 does not allow me execute a composed query. It warns with
something similar to "ERROR; -2147217900 [Microsoft][Microsoft Access ODBC
Driver] Characters after the end of the first SQL query".
How can we avoid this security risk using PHP & postgreSQL?.
Regards,
Davi
^ permalink raw reply [nested|flat] 4+ messages in thread
* Re: postgreSQL web form; Security
2003-07-14 19:10 postgreSQL web form; Security Davi Leal <davileal@terra.es>
@ 2003-07-19 02:16 ` Rod Taylor <rbt@rbt.ca>
2 siblings, 0 replies; 4+ messages in thread
From: Rod Taylor @ 2003-07-19 02:16 UTC (permalink / raw)
To: Davi Leal <davileal@terra.es>; +Cc: pgsql-php; web-dev@gnuherds.org
> How can we avoid this security risk using PHP & postgreSQL?.
Be sure to verify all input from the untrusted source is valid, and
after you do that, be sure to escape it using pg_escape_string() or
pg_escape_bytea().
Attachments:
signature.asc (application/pgp-signature, 186B) download
^ permalink raw reply [nested|flat] 4+ messages in thread
* Re: postgreSQL web form; Security
2003-07-14 19:10 postgreSQL web form; Security Davi Leal <davileal@terra.es>
@ 2003-07-19 08:53 ` Adrian Tineo <adriantineo@softhome.net>
2 siblings, 0 replies; 4+ messages in thread
From: Adrian Tineo @ 2003-07-19 08:53 UTC (permalink / raw)
To: pgsql-php@postgresql.org, "Davi Leal" <davileal@terra.es>
> How can we avoid this security risk using PHP & postgreSQL?.
Every system has its security caveats. But that doesn't mean it can't be
taken care of. Check this link for some important security issues regarding
PHP and SQL.
http://forums.devshed.com/t20525/s7cec8677087e43c40ce670ad005d327c.html
http://es2.php.net/manual/en/security.database.php
What I do is verify all user input ($_GET and $_POST array) and not allow
certain characters, most importantly ";". If they can't put a ";" they can't
close a query and they can't do SQL injection.
That is if you want to build the security wall at the application level. For
extra security or for security at DB level you could connect as a previously
created user with only read-access permission. Although at some point you
might need to insert/delete stuff, you can use the read-only user while you
don't need to write. A lot of times you have some public pages that
everybody can access that don't need write permission. Then you can have
other password-protected pages intended only for admins or people you trust
that need write/delete so the security risk would be lower.
Hope that helps.
Adrian Tineo
^ permalink raw reply [nested|flat] 4+ messages in thread
* Re: postgreSQL web form; Security
2003-07-14 19:10 postgreSQL web form; Security Davi Leal <davileal@terra.es>
@ 2003-07-19 11:06 ` Michelle Konzack <linux4michelle@freenet.de>
2 siblings, 0 replies; 4+ messages in thread
From: Michelle Konzack @ 2003-07-19 11:06 UTC (permalink / raw)
To: pgsql-php
Hello Adrian,
Am 10:53 2003-07-19 +0200 hat Adrian Tineo geschrieben:
>What I do is verify all user input ($_GET and $_POST array) and not allow
>certain characters, most importantly ";". If they can't put a ";" they
can't
>close a query and they can't do SQL injection.
How do you do that ?
With a Java-Script in the WebPage ?
or
On the Server-Side ?
I think, we must use all two, the first one to prevent to much work
on the Server-Side and the second one if someone hack the input field
or use Commandline to access the URL.
Hmm, have no clue how to check it with Java-Script...
Does anyone have a small GPL'ed code for it ?
(I do not code Java-Script)
Thanks
Michelle
^ permalink raw reply [nested|flat] 4+ messages in thread
end of thread, other threads:[~2003-07-19 11:06 UTC | newest]
Thread overview: 4+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2003-07-14 19:10 postgreSQL web form; Security Davi Leal <davileal@terra.es>
2003-07-19 02:16 ` Rod Taylor <rbt@rbt.ca>
2003-07-19 08:53 ` Adrian Tineo <adriantineo@softhome.net>
2003-07-19 11:06 ` Michelle Konzack <linux4michelle@freenet.de>
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