Author Topic: Security holes.  (Read 3609 times)

Offline Nox

  • Level 35
  • **
  • Posts: 768
  • Reputation: +12/-2
    • View Profile
Re: Security holes.
« Reply #25 on: July 23, 2009, 05:20:31 PM »
But your function only works for mysql querys. Strip tags has its uses, htmlspecialchars definitely has its uses.
You need to escape specificaly for the situation
Your function for example won't protect you against XSS...if you don't use one of previously mentioned functions
than your sites are vulnerable to it (I hope I scared you now :),
not always bad to be worried :) )

... but I think this all was mentioned here before

Btw... why the capital letter in variable names? So much extra shift pressing...
« Last Edit: July 23, 2009, 05:22:14 PM by Nox »
Meet us at an IRC irc.freenode.net #bbg as well
https://vimeo.com/36579366 (a must-watch) | Join BOINC - no longer a hype, but you can help never the less

Offline Crazy-T

  • Level 19
  • *
  • Posts: 197
  • Reputation: +0/-0
  • Building Games
    • View Profile
Re: Security holes.
« Reply #26 on: July 24, 2009, 03:34:42 AM »
Btw... why the capital letter in variable names? So much extra shift pressing...
Karlos always does it always has guess its a habit. :P Or maybe he just likes Capital on every first word :D
Crazy-T

Offline Scion

  • Level 27
  • **
  • Posts: 402
  • Reputation: +11/-0
    • View Profile
Re: Security holes.
« Reply #27 on: July 24, 2009, 03:44:21 AM »
camelCase http://en.wikipedia.org/wiki/CamelCase is quite a popular Idiom in many developer communities.

it helps readability of longer compound parameter names eg compare maxRowsPerRfc to maxrowsperrfc

Offline Nox

  • Level 35
  • **
  • Posts: 768
  • Reputation: +12/-2
    • View Profile
Re: Security holes.
« Reply #28 on: July 24, 2009, 03:49:14 AM »
I meant first capital letter ... I use $maxRows but I see no reason to use $Max instead of $max
Meet us at an IRC irc.freenode.net #bbg as well
https://vimeo.com/36579366 (a must-watch) | Join BOINC - no longer a hype, but you can help never the less

Offline Karlos

  • Level 7
  • *
  • Posts: 31
  • Reputation: +2/-0
    • View Profile
Re: Security holes.
« Reply #29 on: July 24, 2009, 04:12:42 AM »
But your function only works for mysql querys. Strip tags has its uses, htmlspecialchars definitely has its uses.
You need to escape specificaly for the situation
Your function for example won't protect you against XSS...if you don't use one of previously mentioned functions
than your sites are vulnerable to it (I hope I scared you now :),
not always bad to be worried :) )

... but I think this all was mentioned here before

Btw... why the capital letter in variable names? So much extra shift pressing...

I believe your looking past the point a little bit.
htmlspecialchars(); should be used for displaying! Think about charsets and collations and even the field length, there are just so many problems with this!

Consider the string:
"It's a simple string" = 22 characters

Now passing that through mysql_real_escape_string(); and htmlspecicalchars();, this becomes:
"It\'s a simple string" = 33 characters

Starting to see, that not even messing with charsets, collations and considering the field lenght...


Please tell me any points I may of missed..

Offline Nox

  • Level 35
  • **
  • Posts: 768
  • Reputation: +12/-2
    • View Profile
Re: Security holes.
« Reply #30 on: July 24, 2009, 04:24:46 AM »
I didn't say it should be used for insering into database, it should be used when displaying, this topic is about overall security so I followed that
But strip_tags can be used when inserting if you don't want users to use html tags (at all or you're using bbcode), so you don't store this extra data
Meet us at an IRC irc.freenode.net #bbg as well
https://vimeo.com/36579366 (a must-watch) | Join BOINC - no longer a hype, but you can help never the less

Offline Karlos

  • Level 7
  • *
  • Posts: 31
  • Reputation: +2/-0
    • View Profile
Re: Security holes.
« Reply #31 on: July 24, 2009, 04:31:41 AM »
I am purely basing what I am writing from the information for that function used by Darklandz, secureInput() suggests one thing for me, insertion in to the database, more so when i see mysql_real_escape_string();

string_tags() does have a good use, I will not deny that, but I have no good reason to use it for now.

Offline Karlos

  • Level 7
  • *
  • Posts: 31
  • Reputation: +2/-0
    • View Profile
Re: Security holes.
« Reply #32 on: July 24, 2009, 04:36:01 AM »
Btw... why the capital letter in variable names? So much extra shift pressing...
Karlos always does it always has guess its a habit. :P Or maybe he just likes Capital on every first word :D

Crazy-T/Alan/BadGirl or whatever ou wish to call yourself... You should know I've done it for ages, and I will continue displaying my code how I like.  :)

Offline Chris

  • Game Owner
  • Level 35
  • *
  • Posts: 2,217
  • Reputation: +28/-1
    • View Profile
Re: Security holes.
« Reply #33 on: July 24, 2009, 04:44:17 AM »
Btw... why the capital letter in variable names? So much extra shift pressing...
Karlos always does it always has guess its a habit. :P Or maybe he just likes Capital on every first word :D

Crazy-T/Alan/BadGirl or whatever ou wish to call yourself... You should know I've done it for ages, and I will continue displaying my code how I like.  :)
LOL, reputation +1, at least one person who don't believe in the "proper coding style" crap :D

Offline Karlos

  • Level 7
  • *
  • Posts: 31
  • Reputation: +2/-0
    • View Profile
Re: Security holes.
« Reply #34 on: July 24, 2009, 04:46:49 AM »
LOL, reputation +1, at least one person who don't believe in the "proper coding style" crap :D
I like to have my own style, I don't like to follow others, mine suits me and I like it :)

Offline Nox

  • Level 35
  • **
  • Posts: 768
  • Reputation: +12/-2
    • View Profile
Re: Security holes.
« Reply #35 on: July 24, 2009, 05:00:04 AM »
Quote
don't believe in the "proper coding style" crap
That's what we get for trying to make Karlos' life easier :P :)
Meet us at an IRC irc.freenode.net #bbg as well
https://vimeo.com/36579366 (a must-watch) | Join BOINC - no longer a hype, but you can help never the less

Offline Karlos

  • Level 7
  • *
  • Posts: 31
  • Reputation: +2/-0
    • View Profile
Re: Security holes.
« Reply #36 on: July 24, 2009, 05:04:32 AM »
Quote
don't believe in the "proper coding style" crap
That's what we get for trying to make Karlos' life easier :P :)

How does that make my life easier? :P The only thing what would make my life eaiser is enough sleep :P

Offline Harkins

  • Level 28
  • **
  • Posts: 424
  • Reputation: +11/-2
  • Coder, blogger, entrepreneur.
    • View Profile
    • Push CX - Blog
Re: Security holes.
« Reply #37 on: July 24, 2009, 06:56:34 AM »
LOL, reputation +1, at least one person who don't believe in the "proper coding style" crap :D
I like to have my own style, I don't like to follow others, mine suits me and I like it :)

And that'll be fine as long as you don't work with anyone else or expect to get too much help from people who may not have the patience to figure out another random style.

Visit #bbg on irc.freenode.net to talk browser games anytime.

Offline Qwerty

  • Level 12
  • *
  • Posts: 90
  • Reputation: +0/-0
    • View Profile
Re: Security holes.
« Reply #38 on: July 24, 2009, 06:44:33 PM »
Well I just put trim() on everything so if it gets inserted into the database or file, there isn't all of the space wasted.

Also on my register code so users don't make accounts with usernames with spaces in the front.
- "I sentance you to life"
- "You moron I'm already alive"

Offline Crazy-T

  • Level 19
  • *
  • Posts: 197
  • Reputation: +0/-0
  • Building Games
    • View Profile
Re: Security holes.
« Reply #39 on: July 25, 2009, 09:30:10 AM »
Why not upper there username first something like.
Code: [Select]
$username = mysql_real_escape_string(trim($_POST['name']));
$sql = $db->execute('SELECT `username` FROM `players` WHERE UPPER(`username`) = UPPER(\''. $username .'\')');
if($db->row_count($sql))
{
echo "This username is already exists. Please pick a new username.";
$error = true;
}
else
{
echo "Your account has been made.<br />";
echo "Your details are<br />";
echo "Username: ". stripslashes($_POST['name']) ."<br />";
echo "Password: ". $_POST['password'] ."<br />";
echo "<a href='login.php'>Click here to login your account</a>";
$error = false;
}
Something like that?.
Crazy-T

 


SimplePortal 2.3.3 © 2008-2010, SimplePortal