Results 1 to 6 of 6
Like Tree2Likes
  • 2 Post By softwarefreak

Thread: About website security

  1. #1
    Senior Member softwarefreak's Avatar
    Join Date
    Jun 2011
    Location
    http://softwarefreak.in
    Posts
    347
    Thanks
    142
    Thanked 211 Times in 69 Posts
    Rep Power
    2

    Default About website security

    Hi guys!(This is not any tut,I'm actually asking for help &/or to make myself correct! :D)
    As we all know about the php malicious input filtering functions like mysql_real_escape_string, strip_slashes, strip_tags, htmlentities, etc.
    Lets take mysql_real_escape_string

    $input = "'OR 1=1'";
    $safe_input = mysql_real_escape_string($input);
    So it turns .......
    \'OR 1=1\'
    But the malformed query is actually being processed after filtering,which is a wastage of resource & opening door to say "Yeah,come show your hacking skills!".
    So why not detect such malicious inputs from an user before starting the actual program flow?
    Lets bring a very simple function in to play.

    PHP Code:
    function kickass($str)
    {
    $str str_ireplace("<script>",""$str$i);
    $str str_ireplace("</script>",""$str$j);
    $str str_ireplace("'"""$str$k);
    $str str_ireplace('"'''$str$l);
    $str str_irelace(";"""$str$m);
    ////////////Add more in the list or lets make a easy function wid preg_match
    return $i+$j+$k+$l+$m;

    PHP Code:

    if(kickass($_POST['username'] + kickass($_POST['password']) > 0)
    {
    /*inputs are unsafe,
    Give a warning message or just redirect him back to the login page
    */
    }
    else
    {
    //Start the actual program flow wid safe inputs

    ////mysql_connect,mysql query etc

    Mysqli & PDO are fine,But pls correct me in here,thanks in advance..
    s3nzo and shushant like this.
    I need some facebook likes, can you please help me
    [Only registered and activated users can see links. Click Here To Register...]
    I noticed social media is really powerful
    Well DONE is better than well SAID

  2. #2
    Moderator arnage's Avatar
    Join Date
    May 2009
    Location
    Serbia
    Posts
    711
    Thanks
    165
    Thanked 183 Times in 80 Posts
    Rep Power
    5

    Default

    Can you be just a little more specific about the question bro?
    <!DOCTYPE html PUBLIC "-//WAPFORUM.RS

  3. #3
    Senior Member softwarefreak's Avatar
    Join Date
    Jun 2011
    Location
    http://softwarefreak.in
    Posts
    347
    Thanks
    142
    Thanked 211 Times in 69 Posts
    Rep Power
    2

    Default

    Bro,I mean to say dat,Will there be still any security flaws if I'm starting the program flow only wid safe inputs,assuming that the malicious inputs were filtered by the function

  4. #4
    Moderator arnage's Avatar
    Join Date
    May 2009
    Location
    Serbia
    Posts
    711
    Thanks
    165
    Thanked 183 Times in 80 Posts
    Rep Power
    5

    Default

    For secure input there is no use of that. This step should not be avoided in any case:

    PHP Code:
    $input mysql_real_escape_string(stripslashes($input)); 
    For passwords doesn't matter because its usually hashed, for user name should be filtered for example like this:

    PHP Code:
    function match($input) {
    if (
    preg_match('/^[\w\s]+$/iD'$input)) {
        return 
    true;
    } else {
        return 
    false;
    }

    Filtering regular messages and posts by striping tags no point, posters needs those, and attack always can be encoded. ;)
    <!DOCTYPE html PUBLIC "-//WAPFORUM.RS

  5. #5
    Senior Member softwarefreak's Avatar
    Join Date
    Jun 2011
    Location
    http://softwarefreak.in
    Posts
    347
    Thanks
    142
    Thanked 211 Times in 69 Posts
    Rep Power
    2

    Default

    lol,of course bro,mysql_real_escape_string is must,I kno dat but I don't think it'd be a bad idea to predict the inputs b4 querying mysql for a hacker :p & thanks so much for all your guidelines

  6. #6
    Moderator arnage's Avatar
    Join Date
    May 2009
    Location
    Serbia
    Posts
    711
    Thanks
    165
    Thanked 183 Times in 80 Posts
    Rep Power
    5

    Default

    You are welcome. But there is no point predicting anything except wildcards and quantifiers. ;)
    <!DOCTYPE html PUBLIC "-//WAPFORUM.RS

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. Database Security?
    By something else in forum Coding Forum
    Replies: 7
    Last Post: 23-02-12, 21:34
  2. Help with web security.
    By s3nzo in forum General Discussion
    Replies: 5
    Last Post: 28-09-11, 14:37
  3. be a partner free give your website link for my website
    By prspravin in forum Site / Script testing and error fixing
    Replies: 1
    Last Post: 02-06-11, 21:17
  4. Cookie security
    By ripkk2tfk in forum Site / Script testing and error fixing
    Replies: 7
    Last Post: 26-01-10, 12:04
  5. PHP Security / SQL Security - Part 1
    By riderz in forum Coding Forum
    Replies: 3
    Last Post: 12-12-09, 12:40

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  

SEO by vBSEO

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19