Jump to content

Recommended Posts

Please can anyone run some security tests on my site, i believe i have covered everything to protect it.

 

On the site the main things i want to be safe against are things like RFI, cross-server attack, sql attacks and in game exploits.

 

Any loop holes can be posted here, on the site, or PM(ed) to me on either site.

 

The site is

http://www.americangangsters.org/

 

Username: test

password: tester

 

Here is another thing to test

http://www.americangangsters.org/airport.php

Go there without logging in, and it redirects to the home page then back there when you log in, should i store the previous page in sessions?

 

Thanks,

Blade

 

Link to comment
https://forums.phpfreaks.com/topic/157827-security-test-american-gangsters/
Share on other sites

Find.php:

Failures:12

Tested value: %31%27%20%4F%52%20%27%31%27%3D%27%31

Tested value: 1 AND ASCII(LOWER(SUBSTRING((SELECT TOP 1 name FROM sysobjects WHERE xtype='U'), 1, 1))) > 116

Tested value: 1 AND USER_NAME() = 'dbo'

Tested value: 1 AND 1=1

Tested value: 1 OR 1=1

 

 

cartheft.php:

Failures:16

Tested value: %31%27%20%4F%52%20%27%31%27%3D%27%31

Tested value: 1' OR '1'='1

Tested value: 1 UNION ALL SELECT 1,2,3,4,5,6,name FROM sysObjects WHERE xtype = 'U' --

Tested value: 1 UNI/**/ON SELECT ALL FROM WHERE

Tested value: 1 AND ASCII(LOWER(SUBSTRING((SELECT TOP 1 name FROM sysobjects WHERE xtype='U'), 1, 1))) > 116

Tested value: ' OR username IS NOT NULL OR username = '

Tested value: 1' AND non_existant_table = '1

Tested value: 1'1

Tested value: '; DESC users; --

Tested value: 1 AND USER_NAME() = 'dbo'

Tested value: 1' AND 1=(SELECT COUNT(*) FROM tablenames); --

hmm ok, good good

 

One last thing, unless there are more vulnerabilities

 

will my function stop or cause a problem to my data, if used to sanitise queries

 

	function QuerySecure($query)
{
	$query = strip_tags($query);
	$query = htmlspecialchars($query);
	$query = filter_var($query);
	$query = trim($query);
	$query = stripslashes($query);
	$query = mysql_real_escape_string($query);
	return $query;
}

Try:

<?php
function QuerySecure($query)
{
	$query = strip_tags($query);
	$query = htmlspecialchars($query);
                          //works only in php5 strips unwanted injection
	$query = filter_var($query,FILTER_SANITIZE_STRING);
                          /////////////////
	$query = trim($query);
	$query = stripslashes($query);
	$query = mysql_real_escape_string($query);
	return $query;
}
?>

 

also as suggested read up on the functions to see what they do and see if you need them or not ;)

Okay then, if you're too don't want to check for yourself.

 

strip_tags removes HTML tags from a string.

htmlentities converts characters to their respective HTML entities (e.g. © -> ©)

filter_var with FILTER_SANITIZE_STRING removes HTML tags plus some extra optional stuff. This has already been done.

trim removes whitespace from both ends. That's fine.

stripslashes strips slashes. How do you know that's needed?

mysql_real_escape_string escapes things for MySQL queries. This is the only thing you needed here.

 

You shouldn't escape things like HTML entities before inserting it into the database, but rather do it before you output it. You should store the raw data in the database.

 

Better yet, just use prepared statements and your strings will automatically be sanitized.

 

darkfreaks just listed a lot of functions for sanitation, most of which were irrelevant to that problem, and you just slammed all of them in one big function.

×
×
  • 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.