Jump to content

Recommended Posts

I have been working on this site for a local lacrosse tournament and I am pretty much done.  I need to check for any security holes before I go any further.

 

I'm sure there will be alot, and might need help figuring out how to fix them.

 

http://www.tullycornfieldclassic.com

 

Thanks

Link to comment
https://forums.phpfreaks.com/topic/121497-test-security-please-non-destructive/
Share on other sites

  • Replies 114
  • Created
  • Last Reply

Top Posters In This Topic

Cross Site Scripting (XSS):

You can add ">code when adding or editing values using admin.php.

 

Full Path Disclosure:

http://www.tullycornfieldclassic.com/insert.php

Warning: include(../Login/include/session.php) [function.include]: failed to open stream: No such file or directory in /home/tullyl00/domains/tullycornfieldclassic.com/public_html/insert.php on line 1

 

Warning: include() [function.include]: Failed opening '../Login/include/session.php' for inclusion (include_path='.:/usr/local/lib/php') in /home/tullyl00/domains/tullycornfieldclassic.com/public_html/insert.php on line 1

 

Full Path Disclosure:

http://www.tullycornfieldclassic.com/admin.php

Warning: mysql_num_fields(): supplied argument is not a valid MySQL result resource in /home/tullyl00/domains/tullycornfieldclassic.com/public_html/admin.php on line 92

 

Warning: mysql_num_rows(): supplied argument is not a valid MySQL result resource in /home/tullyl00/domains/tullycornfieldclassic.com/public_html/admin.php on line 93

not selected contains fields.

 

Warning: mysql_num_fields(): supplied argument is not a valid MySQL result resource in /home/tullyl00/domains/tullycornfieldclassic.com/public_html/admin.php on line 241

 

Warning: mysql_num_rows(): supplied argument is not a valid MySQL result resource in /home/tullyl00/domains/tullycornfieldclassic.com/public_html/admin.php on line 242

Cross Site Scripting (XSS):

You can add ">code when adding or editing values using admin.php.

 

That page is not going to be viewable by the public..only me and one other person will have access, I just haven't gotten the chance to secure it.

Where do I add the tags exactly, I have no experience with them.  Here is the code for insert.php

 

<?php include("../Login/include/session.php");?>
<?php
$username="censored";
$password="censored";
$database="censored";

$coach="$user";

$first=$_POST['first'];
$last=$_POST['last'];
$title=$_POST['title'];
$college=$_POST['college'];
$division=$_POST['division'];
$phone=$_POST['phone'];
$cell=$_POST['cell'];
$email=$_POST['email'];

mysql_connect(localhost,$username,$password);
@mysql_select_db($database) or die( "Unable to select database");

$query = "INSERT INTO coach (id, first, last, title, college, division, phone, cell, email) VALUES ('','$first','$last','$title','$college','$division','$phone','$cell','$email')";
mysql_query($query); 

mysql_close();
?>

<?php include("../Login/include/session.php");?>
<?php
$username="censored";
$password="censored";
$database="censored";

$coach="$user";

$first=trim(strip_tags($_POST['first']));
$last=trim(strip_tags($_POST['last']));
$title=trim(strip_tags($_POST['title']))
$college=trim(strip_tags($_POST['college']));
$division=trim(strip_tags($_POST['division']));
$phone=trim(strip_tags($_POST['phone']));
$cell=$_POST['cell'];
$email=$_POST['email'];

mysql_connect(localhost,$username,$password);
@mysql_select_db($database) or die( "Unable to select database");

$query = "INSERT INTO coach (id, first, last, title, college, division, phone, cell, email) VALUES ('','$first','$last','$title','$college','$division','$phone','$cell','$email')";
mysql_query($query); 

mysql_close();
?>

still happening maybe if i tell you what is going on injection wise you can fix it.

 

but  all the variables on insert.php are being manipulated.

 

here is a few examples

 

Attack details

The POST variable last has been set to .

Attack details

The POST variable last has been set to 268435455.

Attack details

The POST variable last has been set to NULL.

Attack details

The POST variable last has been set to -1.0.

 

 

well one way is to make sure they are set like

 

 

if(!empty($_POST['variable'])){// code here
}

 

this will make sure it is not set to NULL or empty the variables i mean. ;)

 

 

 

also try using this function it works great

 

http://kallahar.com/smallprojects/php_xss_filter_function.php

 

 

Sorry, but where exactly do I put that function?

 

Also, would this work?

 

$variable=if(!empty(trim(strip_tags(mysql_real_escape_string($_POST['variable']))));

 

What would happen if the variable was NULL, I think it would mess up the rest of the code.


×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.