LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
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 09-25-2010, 01:33 PM   #1
deathsfriend99
Member
 
Registered: Nov 2007
Distribution: CentOS 6
Posts: 200

Rep: Reputation: 22
100's of "apache-init-server"


I have a VPS that has 512MB of ram. I'm using it as a mail/web server. It keeps running out of memory. I know amavis/clamav are memory hogs, but I checked my ps aux and found 100's of instances of "apache-init-server" running. I killed them all, and they keep spawning back. What could be causing this. I've never seen this on a webserver before.

OS: CentOS 5.5
 
Old 09-25-2010, 03:57 PM   #2
bathory
LQ Guru
 
Registered: Jun 2004
Location: Piraeus
Distribution: Slackware
Posts: 13,072

Rep: Reputation: 1969Reputation: 1969Reputation: 1969Reputation: 1969Reputation: 1969Reputation: 1969Reputation: 1969Reputation: 1969Reputation: 1969Reputation: 1969Reputation: 1969
Hi,

You should take a look at apache logs and the output of
Code:
netstat -tan|grep 80|grep EST
 
Old 09-25-2010, 04:23 PM   #3
unSpawn
Moderator
 
Registered: May 2001
Posts: 29,415
Blog Entries: 55

Rep: Reputation: 3599Reputation: 3599Reputation: 3599Reputation: 3599Reputation: 3599Reputation: 3599Reputation: 3599Reputation: 3599Reputation: 3599Reputation: 3599Reputation: 3599
In addition to that, I just don't know one by the name of "apache-init-server", could you please save data like this: '(/bin/ps axfwwwe; /usr/sbin/lsof -Pwln; /bin/ls -al /var/spool/cron; locate apache-init-server; netstat -antpe; lastlog; last; who -a) > /dev/shm/data.txt', scrub sensitive data if necessary and attach the plain text "data.txt" file? After attaching I'd bring down the web server and mail daemon just in case. Checking system and daemon logs is a good thing to do. Also please tell us what forum, web log, admin tool, web-based panel, etc, etc, you run, possibly with versions.

Last edited by unSpawn; 09-25-2010 at 04:26 PM.
 
Old 09-26-2010, 09:50 AM   #4
deathsfriend99
Member
 
Registered: Nov 2007
Distribution: CentOS 6
Posts: 200

Original Poster
Rep: Reputation: 22
[QUOTE=unSpawn;4108919]In addition to that, I just don't know one by the name of "apache-init-server", could you please save data like this: '(/bin/ps axfwwwe; /usr/sbin/lsof -Pwln; /bin/ls -al /var/spool/cron; locate apache-init-server; netstat -antpe; lastlog; last; who -a) > /dev/shm/data.txt', scrub sensitive data if necessary and attach the plain text "data.txt" file? After attaching I'd bring down the web server and mail daemon just in case. Checking system and daemon logs is a good thing to do. [\Quote]


I can't get the data.txt attached. It's too big for the forums max, but the netstat shows where these are coming from:

Active Internet connections (servers and established)
Proto Recv-Q Send-Q Local Address Foreign Address State User Inode PID/Program name
tcp 0 0 127.0.0.1:10024 0.0.0.0:* LISTEN 100 132951431 21813/amavisd (mast
tcp 0 0 127.0.0.1:10025 0.0.0.0:* LISTEN 0 132951797 21874/master
tcp 0 0 0.0.0.0:3306 0.0.0.0:* LISTEN 27 132951128 21701/mysqld
tcp 0 0 127.0.0.1:3310 0.0.0.0:* LISTEN 101 132950955 21613/clamd
tcp 0 0 0.0.0.0:40404 0.0.0.0:* LISTEN 48 132955866 22398/apache-init-s
tcp 0 0 127.0.0.1:631 0.0.0.0:* LISTEN 0 132950654 21535/cupsd
tcp 0 0 127.0.0.1:25 0.0.0.0:* LISTEN 0 132951679 21874/master
tcp 0 0 my.host.ip:25 0.0.0.0:* LISTEN 0 132951678 21874/master
tcp 0 1 my.host.ip:40945 200.229.199.198:25 LAST_ACK 0 0 -
tcp 0 0 127.0.0.1:10025 127.0.0.1:59516 ESTABLISHED 89 132963212 27905/smtpd
tcp 0 0 my.host.ip:59358 217.124.183.2:25 ESTABLISHED 89 132970149 21896/smtp
tcp 49 0 127.0.0.1:41139 127.0.0.1:10025 CLOSE_WAIT 100 132953245 21947/amavisd (ch1-
tcp 0 0 127.0.0.1:10025 127.0.0.1:41139 FIN_WAIT2 0 0 -
tcp 0 0 127.0.0.1:59516 127.0.0.1:10025 ESTABLISHED 100 132963199 21948/amavisd (ch1-
tcp 0 0 my.host.ip:51049 212.85.64.68:6667 ESTABLISHED 48 132971146 28018/apache-init-s
tcp 0 1 my.host.ip:57129 212.85.64.68:6667 SYN_SENT 48 132978931 28670/apache-init-s
tcp 0 1 my.host.ip:53922 212.85.64.68:6667 SYN_SENT 48 132978886 30339/apache-init-s
tcp 0 0 my.host.ip:47071 212.85.64.68:6667 ESTABLISHED 48 132978975 28406/apache-init-s
tcp 0 1 my.host.ip:40452 212.85.64.68:6667 SYN_SENT 48 132978820 32015/apache-init-s
tcp 0 0 my.host.ip:38295 212.85.64.68:6667 ESTABLISHED 48 132976381 22398/apache-init-s
tcp 0 0 :::143 :::* LISTEN 0 132951218 21743/dovecot
tcp 0 0 :::80 :::* LISTEN 0 132954239 22000/httpd
tcp 0 0 :::21 :::* LISTEN 99 132954044 21988/proftpd: (acc
tcp 0 0 :::22 :::* LISTEN 0 132950607 21526/sshd
tcp 0 0 :::993 :::* LISTEN 0 132951219 21743/dovecot
tcp 0 0 ::ffff:my.host.ip:22 ::ffff:my.home.ip:1284 ESTABLISHED 0 132950830 21591/0

No idea what these's IP's are. They trace to Swiss IP's.
I could not locate apache-init-server anywhere on the machine.
I can't bring down the server, it's my only webserver at the moment.


Quote:
Originally Posted by unSpawn View Post
Also please tell us what forum, web log, admin tool, web-based panel, etc, etc, you run, possibly with versions.
I am running Swiftpanel 1.6 (Gameserver control panel)

Here is the full data.txt:
https://docs.google.com/document/edi...thkey=CLir4MYI
 
Old 09-26-2010, 11:27 AM   #5
deathsfriend99
Member
 
Registered: Nov 2007
Distribution: CentOS 6
Posts: 200

Original Poster
Rep: Reputation: 22
I did find this file, along with a bunch of other files that didn't seem kosher in /var/tmp/ They were owned by apache. I don't know if they came with the VPS install or what, but they weren't mine. Looked like IRC bots and old stuff from a PBX server. Really odd. I removed them and that seems to have solved the problem for now. I ran a rootkit check just to be safe and it came up with nothing. Not sure how VPS's work, but hopefully a security compromise on someone else's VPS doesn't compromise mine. Not sure if the VPS company may have left files in the /var/tmp directory, but it seems odd to do so.
 
Old 09-26-2010, 03:31 PM   #6
unSpawn
Moderator
 
Registered: May 2001
Posts: 29,415
Blog Entries: 55

Rep: Reputation: 3599Reputation: 3599Reputation: 3599Reputation: 3599Reputation: 3599Reputation: 3599Reputation: 3599Reputation: 3599Reputation: 3599Reputation: 3599Reputation: 3599
From data.txt:
Code:
]$ grep init data.txt
(..)
28018 ? Ss 0:00 apache-init-server SHELL=/bin/sh USER=apache PATH=. PWD=/var/tmp/vi.recover SHLVL=3 HOME=/var/www LOGNAME=apache _=./apache-init-server

]$ grep 28018 data.txt
apache-in 28018   48  cwd DIR   0,148 4096   2687362 /var/tmp/vi.recover
apache-in 28018   48  rtd DIR   0,148 4096  26495303 /
apache-in 28018   48  txt REG   0,148   504464  12132376 /var/tmp/vi.recover/apache-init-server
apache-in 28018   48  mem REG  8,6 12132376 /var/tmp/vi.recover/apache-init-server
(..)
apache-in 28018   48 0w   REG   0,148   34  12263490 /var/tmp/vi.recover/LinkEvents
apache-in 28018   48 1u  IPv4   132971146  TCP my.host.ip:51049->212.85.64.68:6667 (ESTABLISHED)
apache-in 28018   48 3u  IPv4   132964998  UDP *:34975 
tcp 0  0 my.host.ip:51049 212.85.64.68:6667 ESTABLISHED 48  132971146  28018/apache-init-s
So the created directory is /var/tmp/vi.recover, the processes run as apache and the result is an IRC bot (EnergyMech to be exactly) whose argv[0] is mimicking something apache-like. Nice try.


Quote:
Originally Posted by deathsfriend99 View Post
I can't bring down the server, it's my only webserver at the moment.
What's more important? Running an 0wned web stack or providing services in a stable and secure way?


Quote:
Originally Posted by deathsfriend99 View Post
I did find this file, along with a bunch of other files (..) I removed them
That's rather unfortunate for all sorts of reasons.


Quote:
Originally Posted by deathsfriend99 View Post
and that seems to have solved the problem for now
Treating symptoms is not the same as treating the cause. Shut down your web server. Raise the firewall to deny any traffic except SSH from your management IP/range (BTW you logging in as root over SSH is real bad) while you're investigating. Now run all system and daemon logs through Logwatch with the "--detail High --service All --range All --archives --numeric --save /tmp/logwatch.log" args. Please attach, pastebin, docs.google or email the file.
 
Old 09-26-2010, 03:37 PM   #7
paulsm4
LQ Guru
 
Registered: Mar 2004
Distribution: SusE 8.2
Posts: 5,863
Blog Entries: 1

Rep: Reputation: Disabled
Or have your provider re-initialize your VPS.

The sad truth, deathsfriend99, is that your system has been *compromised*, and you *cannot* try to use it as-is.

The Good News is that it's a VPS (and not a physical system, which you might have to re-install from scratch).

Strong suggestion: nuke your "infected" VPS, and start again with a "clean" one.

IMHO...

PS here are unSpawn's commands, in a slightly different format:
Code:
set LOG=/dev/shm/data.txt
date >> $LOG
/bin/ps axfwwwe >> $LOG
/usr/sbin/lsof -Pwln>> $LOG
/bin/ls -al /var/spool/cro n>> $LOG
locate apache-init-server >> $LOG
netstat -antpe >> $LOG
lastlog >> $LOG
last >> $LOG
who -a  >> $LOG
echo >> $LOG

Last edited by paulsm4; 09-26-2010 at 03:42 PM.
 
Old 09-26-2010, 03:49 PM   #8
GrapefruiTgirl
LQ Guru
 
Registered: Dec 2006
Location: underground
Distribution: Slackware64
Posts: 7,594

Rep: Reputation: 555Reputation: 555Reputation: 555Reputation: 555Reputation: 555Reputation: 555
Moved: This thread is more suitable in Security and has been moved accordingly to help your thread/question get the exposure it deserves.
 
Old 09-26-2010, 03:52 PM   #9
unSpawn
Moderator
 
Registered: May 2001
Posts: 29,415
Blog Entries: 55

Rep: Reputation: 3599Reputation: 3599Reputation: 3599Reputation: 3599Reputation: 3599Reputation: 3599Reputation: 3599Reputation: 3599Reputation: 3599Reputation: 3599Reputation: 3599
Quote:
Originally Posted by paulsm4 View Post
Or have your provider re-initialize your VPS. (..) your system has been *compromised*, and you *cannot* try to use it as-is. (..) nuke your "infected" VPS, and start again with a "clean" one. IMHO...
Just starting afresh, without investigation, without precautions, might re-introduce the hole and get the OPs web stack compromised again faster than you can say "root me please". So please don't.

Last edited by unSpawn; 09-26-2010 at 03:53 PM. Reason: //Emphasis
 
Old 09-29-2010, 10:12 AM   #10
unSpawn
Moderator
 
Registered: May 2001
Posts: 29,415
Blog Entries: 55

Rep: Reputation: 3599Reputation: 3599Reputation: 3599Reputation: 3599Reputation: 3599Reputation: 3599Reputation: 3599Reputation: 3599Reputation: 3599Reputation: 3599Reputation: 3599
Jean-michels posts have been moved to his own thread to avoid confusion.
 
Old 09-30-2010, 03:26 PM   #11
unSpawn
Moderator
 
Registered: May 2001
Posts: 29,415
Blog Entries: 55

Rep: Reputation: 3599Reputation: 3599Reputation: 3599Reputation: 3599Reputation: 3599Reputation: 3599Reputation: 3599Reputation: 3599Reputation: 3599Reputation: 3599Reputation: 3599
* Apparently there are some scripts that (automagically re-)initialize the users crontab so to stop it from running one could stop the Cron daemon or in Bash deny any user from running crontabs by issuing '$>/etc/cron.allow' while one investigates.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

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
X Server broken. start w/ "INIT: ld "x" respawning too fast: disabled for 5 minutes&q tektone Linux - Hardware 5 07-25-2007 07:18 PM
"init 3" freezes while checking "lm_sensors" diogobaeder Fedora 5 07-03-2006 07:40 AM
Computer is not turning off after "init 0" or "shutdown -h now" f430 Linux - General 5 12-17-2005 02:54 AM
commands "init" and "modprobe" not working Diagmato Fedora 2 07-22-2005 11:44 PM
RH "null" beta system freezes right after printing "INIT" markus1982 Linux - Hardware 0 09-09-2002 03:31 PM

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

All times are GMT -5. The time now is 03:01 PM.

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