Forum Moderators: coopster
i am using PHP+MYSQL CMS for my jokes website. someone hacked my site three time after that when i login to my FTP account i get index.htm which contain about messeges from the damn hacker, can any one tell me whats the flaw or reason maybe of this problem.
thanks
[edit reason] no urls thanks [/edit]
[edited by: jatar_k at 10:29 pm (utc) on July 21, 2006]
What you can do however, is blocking write access to your site directories and .php files with chmod (assuming you are on unix) for the user which runs the httpd process on your server. Even if there are holes in the CMS (almost all CMS systems have them, hackers just need to find them) the hacker won't succeed in messing up your site because it is not possible to change your existing .php files or upload new files.
// Configuration Settings
$SendFrom = "Add The joke";
$SendTo = "jokespk@gmail.com";
$SubjectLine = "Add the Joke";
$ThanksURL = "http://www.example.com/joke-added.php"; //confirmation page
$Divider = "~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~";
// Build Message Body from Web Form Input
$MsgBody = @gethostbyaddr($_SERVER["REMOTE_ADDR"]) . "\n$Divider\n";
foreach ($_POST as $Field=>$Value)
$MsgBody .= "$Field: $Value\n";
$MsgBody .= $Divider . "\n" . $_SERVER["HTTP_USER_AGENT"] . "\n";
$MsgBody = htmlspecialchars($MsgBody); //make content safe
// Send E-Mail and Direct Browser to Confirmation Page
mail($SendTo, $SubjectLine, $MsgBody, "From: " . $SendFrom);
header("Location: $ThanksURL");
?>
is there any flaw in the upper php code? which help the hacker to attack on my site,
whenever i noticed the attack, i found a new file in the root directory of my site, like (index.html, hacked.txt etc... )
i am realy scared due to this problem this will be so nice if someone just give me the way to fix or stop such a attackes
Thanks
Shanee
[edited by: coopster at 4:43 pm (utc) on July 22, 2006]
[edit reason]
[1][edit reason] generalized domain [/edit] [/edit][/1]