Reply
Form Security
Old 03-19-2008, 01:45 AM Form Security
Truly's Avatar
Extreme Talker

Posts: 225
What tricks do you guys use to make sure that users dont user input boxes to compromise the security of your website?
__________________
DVD Movie Release Database: http://www.couchpotatoesonline.com
Truly is offline
Reply With Quote
View Public Profile
 
When You Register, These Ads Go Away!
Old 03-19-2008, 02:07 AM Re: Form Security
NullPointer's Avatar
Will Code for Food

Posts: 544
Name: Matt
Location: Irvine, CA
mysql_real_escape_string prevents most kinds of sql injections, you should also validate any data a user submits.
__________________
http://tinsology.com/ - Under construction
NullPointer is offline
Reply With Quote
View Public Profile
 
Old 03-19-2008, 06:43 PM Re: Form Security
rogem002's Avatar
Webmaster Talker

Posts: 653
Name: Mike
Location: United Kingdom
I'm a big fan of sterilisation. The functions are serialize($var) and unserialize($var) it's quite useful. I would also reccomend you try md5/base64 something then compare it.

For forms, take a look at:
- Timestamps
- CAPACHA (sp?) - that thing where you type the words in the image.
- Checking how long a stamp takes to submit, if it's too quick ignore it.
__________________
PHP Code:
Add_Talkupation('rogem002'); // Because sharing is awesome! 
Fix 90% of your internet problems
rogem002 is offline
Reply With Quote
View Public Profile Visit rogem002's homepage!
 
Old 03-20-2008, 10:30 PM Re: Form Security
mgraphic's Avatar
Truth Seeker

Latest Blog Post:
Converting Video For YouTube
Posts: 2,339
Name: Keith Marshall
Location: West Hartford, CT
Here is (hopefully) a helpful resource to give you some basic cleaning tools for your users input. This type of input cleaning forces the input into specific types. Would be best to used written in functions, and also allow the recursive cleaning within arrays.

PHP Code:
<?php
  
  
//  Signed Integer
  //  Can be any whole number pos or neg
  
$int intval($_REQUEST['int']);
  
  
//  Unsigned Integer
  //  Can be any whole number pos only
  
$uint = ($uint intval($_REQUEST['uint'])) < $uint;
  
  
//  Signed Floating Number
  //  Can be any floating (decimal) number pos or neg
  
$float floatval($_REQUEST['float']);
  
  
//  Unsigned Floating Number
  //  Can be any floating (decimal) number pos only
  
$ufloat = ($ufloat intval($_REQUEST['ufloat'])) < $ufloat;
  
  
//  Boolean
  //  Will set to True or False
  
$bool = (bool)$_REQUEST['bool'];
  
  
//  String for possible SQL
  //  This only cleans the string, still needs to be
  //  properly escaped before submitting SQL query
  
$string trim(stripslashes($_REQUEST['string']));
  
  
//  String for HTML Display
  //  Allows strings to be safely displayed on HTML pages
  //  second line helps prevent RSS attacks
  
$html htmlentities(trim(stripslashes($_REQUEST['html'])));
  
$html preg_replace(array('#javascript#i''#vbscript#i'), array('java script''vb script'), $html);
__________________

<mgraphic /> - I don't have a solution but I admire the problem.

Last edited by mgraphic : 03-21-2008 at 10:57 AM. Reason: Strings don't neccessary need htmlentities()
mgraphic is offline
Reply With Quote
View Public Profile
 
Old 03-21-2008, 05:02 AM Re: Form Security
Ultra Talker

Posts: 308
Quote:
Originally Posted by rogem002 View Post
I'm a big fan of sterilisation. The functions are serialize($var) and unserialize($var) it's quite useful.
How will serialize and unserialize function will help with form security? I think you've misunderstood the purpose of those functions.

To the OP, validate user input, use mysql_real_escape or similar function for storing data in your db and use htmlentities function for displaying user generated content.
__________________
tiny url
dman_2007 is offline
Reply With Quote
View Public Profile Visit dman_2007's homepage!
 
Old 03-21-2008, 06:36 AM Re: Form Security
NullPointer's Avatar
Will Code for Food

Posts: 544
Name: Matt
Location: Irvine, CA
Quote:
Originally Posted by dman_2007 View Post
How will serialize and unserialize function will help with form security? I think you've misunderstood the purpose of those functions.

To the OP, validate user input, use mysql_real_escape or similar function for storing data in your db and use htmlentities function for displaying user generated content.
I don't think serialize and unseiralize were intended for this, but it has the same effect, any intended mysql injection once serialized would be to no avail.
__________________
http://tinsology.com/ - Under construction
NullPointer is offline
Reply With Quote
View Public Profile
 
Old 03-21-2008, 05:44 PM Re: Form Security
Truly's Avatar
Extreme Talker

Posts: 225
If Im already encrypting a password with md5 I guess I dont really need this for the password but I supposed for anything SELECTED from a database I would need to and not just for inserting.

None of you guys mentioned strip_tags or w/e it is. Is that not necessary because Im using mysql_real_escape_string?
__________________
DVD Movie Release Database: http://www.couchpotatoesonline.com
Truly is offline
Reply With Quote
View Public Profile
 
Reply     « Reply to Form Security
 

Thread Tools

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

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


Webmaster Resources Marketplace:
Software Development Company | Webhosting.UK.com | Text Link Brokers 


   
RSS Feed  Feeds: RSS   JS   XML
RSS Feed  Feeds for this forum: RSS   JS   XML

 


Page generated in 0.14016 seconds with 12 queries