I just discovered my debian server has been hacked. I noticed when I did apt-get update, it failed because /var/log/apt directory did not exist.
I investigated and found the following:
- Almost all files in /var/log/ were owned by the group "smile".
- Most of /var/log files were zero bites and dated Oct 10 (presume time of attack)
- There was an empty file /var/log/apt (preventing directory apt)
- There was a new user on the server called "smile" with associated group.
- Ran rkhunter, gave warnings:
- Possible rootkit: Xzibit Rootkit (web search returns probably false positive)
- Warning: Account 'smile' is root equivalent (UID = 0)
- Neither ps ax| grep smile, or w or who showed anything
I then did
# userdel smile
userdel: user smile is currently logged in
# userdel -f smile
Then
# grep -R smile /var/log
./auth.log:Nov 20 03:02:05 server sshd[9228]: pam_unix(sshd:auth): authentication failure; logname= uid=0 euid=0 tty=ssh ruser= rhost=211. user=smile
./auth.log:Nov 20 03:02:07 server sshd[9228]: Failed password for smile from 211.... port 58701 ssh2
./auth.log:Nov 20 04:20:32 server sshd[10819]: Invalid user smileing from 211....
./auth.log:Nov 20 04:20:34 server sshd[10819]: Failed password for invalid user smileing from 211.... port 33223 ssh2
So I can assume the user/bot has been logging in multiple times.
I restored the permissions on /var/log, and mkdir /var/log/apt. I then did apt-get update; apt-get upgrade (it had been a while).
My questions are:
- How can I investigate further to find out what the attackers did/changed?
- What else can I do to secure the server? Is it even possible or will I have to do a fresh install?
It is a head node on a small experimental cluster. It is doing NIS, NFS, Torque PBS and Ganglia and would be very inconvenient to reinstall.
Thank you