hi
very bad happen
i made a cms and desgined some site with it but today one hacker groups hacked all of them! 🙁
the hacker group dosn't help me for find security problem in my script and also i could not
find it.
i descript my cms scripts and thanks for any one can help me :
i use of register_globals = Off
the cms has 2 section
1- visitor interface
2- admin interface
1- visitor interface
in visitor interface there is index.php. when it runs it include template/index.htm and then replace some keywords with the result that comes form database. then shows it.
2- admin interface /admin
in admin iterface there is a form for get username and password. then it send it to
phpselfpage page:
index.php:
session_start();
$username=addslashes($_REQUEST["username"]);
$password=md5(addslashes($_REQUEST["password"]));
if(isset($username) & isset($password)) {
require_once"../include/common.php";
$sql = mysql_query("SELECT password FROM user WHERE username = '$username'");
$fetch_em = mysql_fetch_array($sql);
$numrows = mysql_num_rows($sql);
$username=stripslashes($username);
$password=stripslashes($password);
if($numrows != "0" & $password == $fetch_em["password"]) {
$validuser = 1;
session_start();
$_SESSION['username']=$username;
$_SESSION['password']=$password;
$_SESSION['validuser']=$validuser;
header("location: home.php");
exit();
}
}
if ($_SESSION['validuser']) {
unset($_SESSION['username']);
unset($_SESSION['password']);
$_SESSION = array();
session_destroy();
}
Here is HTML Form
common.php:
$DBhost = "localhost";
$DBuser = "USERNAME";
$DBpass = "PASSWORD";
$DBName = "cms";
$dbh = mysql_connect($DBhost,$DBuser,$DBpass) or die("Unable to connect to database");
mysql_query("SET NAMES utf8");
mysql_query("SET CHARACTER_SET utf8");
mysql_select_db("$DBName",$dbh) or die("Unable to select database $DBName");
home.php:
require_once"include/session.php";
require_once"../include/common.php";
some html links to other pages in admin area
session.php:
$expire_time=2500;
ini_set("session.gc_maxlifetime",$expire_time);
session_start();
if ($_SESSION['validuser']!=1) header("location: index.php");
all of pages in admin area include session.php that linked to them in home.php.
also there is a logout link to in index.php in home.php
the hacker can change some records that can change in admin area pages.
i am wating for answer
Thanks