Bluehost.com Web Hosting $6.95

RE: [PHP] SQL security

This is a discussion on RE: [PHP] SQL security within the PHP General forums, part of the PHP Programming Forums category; Eugene Lee <mailto:list-php-1@fsck.net> on Friday, October 17, 2003 8:20 AM said: > ...


Go Back   Usenet Forums > PHP Programming Forums > PHP General

FAQ Members List Calendar Search Today's Posts Mark Forums Read
  #1 (permalink)  
Old 10-17-2003
Chris W. Parker
 
Posts: n/a
Default RE: [PHP] SQL security

Eugene Lee <mailto:list-php-1@fsck.net>
on Friday, October 17, 2003 8:20 AM said:

> If you're using MySQL, you can use mysql_real_escape_string(). If
> you're using another database, hopefully there is a similar function.


Doesn't MySQL automatically protect against attacks like SQL injection?
Or maybe it's that it automatically applies addslashes()? I can't
remember exactly.


c.


--
Don't like reformatting your Outlook replies? Now there's relief!
http://home.in.tum.de/~jain/software/outlook-quotefix/
Reply With Quote
  #2 (permalink)  
Old 10-17-2003
Chris Shiflett
 
Posts: n/a
Default RE: [PHP] SQL security

--- "Chris W. Parker" <cparker@swatgear.com> wrote:
> Doesn't MySQL automatically protect against attacks like SQL
> injection? Or maybe it's that it automatically applies addslashes()?


Nope and nope.

What you might be thinking of is that mysql_query() only allows a single query
to be executed. This helps, but it doesn't prevent everything. It only prevents
SQL injection attacks that attempt to terminate the current query and execute
another one.

Chris

=====
My Blog
http://shiflett.org/
HTTP Developer's Handbook
http://httphandbook.org/
RAMP Training Courses
http://www.nyphp.org/ramp
Reply With Quote
  #3 (permalink)  
Old 10-17-2003
Mike Migurski
 
Posts: n/a
Default RE: [PHP] SQL security

>> If you're using MySQL, you can use mysql_real_escape_string(). If
>> you're using another database, hopefully there is a similar function.

>
>Doesn't MySQL automatically protect against attacks like SQL injection?
>Or maybe it's that it automatically applies addslashes()? I can't
>remember exactly.


No - I don't think any database could automatically protect against SQL
injection, since the basis of that attack is the malformation of queries
before they even hit the DB. There is a magic quotes feature, which adds
slashes to request variable. You may be thinking of that:

<http://php.net/manual/en/ref.info.php#ini.magic-quotes-gpc>

---------------------------------------------------------------------
michal migurski- contact info and pgp key:
sf/ca http://mike.teczno.com/contact.html
Reply With Quote
Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are Off
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On




All times are GMT +1. The time now is 03:09 AM.


Powered by vBulletin® Version 3.7.3
Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO 3.0.0