Login Register


[PHP] Protection from SQL injection filter_list
Author
Message
RE: [PHP] Protection from SQL injection #11
(11-09-2011, 02:28 PM)bluedog.tar.gz Wrote: Thanks for the share. I will be needing this when i have my website up and running. Ill reward $20 if you can hack my site.
URL?
Where I live... its freaking cold!
[Image: HC_Signature.png]


RE: [PHP] Protection from SQL injection #12
(11-09-2011, 02:28 PM)bluedog.tar.gz Wrote: Thanks for the share. I will be needing this when i have my website up and running. Ill reward $20 if you can hack my site.
URL?
Where I live... its freaking cold!
[Image: HC_Signature.png]


RE: [PHP] Protection from SQL injection #13
(11-09-2011, 02:28 PM)bluedog.tar.gz Wrote: Thanks for the share. I will be needing this when i have my website up and running. Ill reward $20 if you can hack my site.
URL?
Where I live... its freaking cold!
[Image: HC_Signature.png]


RE: [PHP] Protection from SQL injection #14
(11-09-2011, 02:28 PM)bluedog.tar.gz Wrote: Thanks for the share. I will be needing this when i have my website up and running. Ill reward $20 if you can hack my site.
URL?
Where I live... its freaking cold!
[Image: HC_Signature.png]


RE: [PHP] Protection from SQL injection #15
(10-26-2013, 10:39 PM)Sebastian Kvernland Wrote:
(11-09-2011, 02:28 PM)bluedog.tar.gz Wrote: Thanks for the share. I will be needing this when i have my website up and running. Ill reward $20 if you can hack my site.
URL?

Please watch the date the post is posted at..
"Wednesday, November 9th, 2011 03:28 PM"

Do not respond to 2 year old threads please.

Closed


RE: [PHP] Protection from SQL injection #16
(10-26-2013, 10:39 PM)Sebastian Kvernland Wrote:
(11-09-2011, 02:28 PM)bluedog.tar.gz Wrote: Thanks for the share. I will be needing this when i have my website up and running. Ill reward $20 if you can hack my site.
URL?

Please watch the date the post is posted at..
"Wednesday, November 9th, 2011 03:28 PM"

Do not respond to 2 year old threads please.

Closed


RE: [PHP] Protection from SQL injection #17
(10-26-2013, 10:39 PM)Sebastian Kvernland Wrote:
(11-09-2011, 02:28 PM)bluedog.tar.gz Wrote: Thanks for the share. I will be needing this when i have my website up and running. Ill reward $20 if you can hack my site.
URL?

Please watch the date the post is posted at..
"Wednesday, November 9th, 2011 03:28 PM"

Do not respond to 2 year old threads please.

Closed


RE: [PHP] Protection from SQL injection #18
(10-26-2013, 10:39 PM)Sebastian Kvernland Wrote:
(11-09-2011, 02:28 PM)bluedog.tar.gz Wrote: Thanks for the share. I will be needing this when i have my website up and running. Ill reward $20 if you can hack my site.
URL?

Please watch the date the post is posted at..
"Wednesday, November 9th, 2011 03:28 PM"

Do not respond to 2 year old threads please.

Closed


RE: [PHP] Protection from SQL injection #19
Because this thread has been already bumped, I'll just chip in a little advice.
Methods listed in this thread will not protect you against SQL injection, there are multiple ways to bypass myslq_real_escape_string etc.
mysql_* commands should not be used. Look for mysqli or PDO to handle your queries and always, always, always use prepared statements.
http://net.tutsplus.com/tutorials/php/wh...se-access/

Prepared statements by themselves too don't really help you against SQL injection as explained:
http://stackoverflow.com/questions/13409...-injection

the best way is to make a white-list of allowed characters, length etc. If you need just and id, use regular expressions to get just the number from the users input.
If you allow just a 10 character string and somebody submits 20 character string, either strip it, or report an error.

last but not least, all this is useless if you don't handle encoding correctly in your database. If you don't know how to do this exactly, just set database, table and column encoding to utf-8. That should do the trick most of the time.

tl;dr
  • Don't use mysql_* queries. User PDO or Mysqli instead
  • Use prepared statements
  • Make a white-list (black-lists are proven to be not so effective)
  • Make sure your encoding is correct. If you are not sure, use utf-8 EVERYWHERE
Staff will never ever ask you for your personal information.
We know everything about you anyway.


RE: [PHP] Protection from SQL injection #20
Because this thread has been already bumped, I'll just chip in a little advice.
Methods listed in this thread will not protect you against SQL injection, there are multiple ways to bypass myslq_real_escape_string etc.
mysql_* commands should not be used. Look for mysqli or PDO to handle your queries and always, always, always use prepared statements.
http://net.tutsplus.com/tutorials/php/wh...se-access/

Prepared statements by themselves too don't really help you against SQL injection as explained:
http://stackoverflow.com/questions/13409...-injection

the best way is to make a white-list of allowed characters, length etc. If you need just and id, use regular expressions to get just the number from the users input.
If you allow just a 10 character string and somebody submits 20 character string, either strip it, or report an error.

last but not least, all this is useless if you don't handle encoding correctly in your database. If you don't know how to do this exactly, just set database, table and column encoding to utf-8. That should do the trick most of the time.

tl;dr
  • Don't use mysql_* queries. User PDO or Mysqli instead
  • Use prepared statements
  • Make a white-list (black-lists are proven to be not so effective)
  • Make sure your encoding is correct. If you are not sure, use utf-8 EVERYWHERE
Staff will never ever ask you for your personal information.
We know everything about you anyway.








Users browsing this thread: 1 Guest(s)