LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - General
User Name
Password
Linux - General This Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.

Notices

Reply
 
LinkBack Search this Thread
Old 06-07-2006, 07:44 PM   #1
bdragon
LQ Newbie
 
Registered: Jan 2006
Posts: 6

Rep: Reputation: 0
httpd is spawn many process & sucking bandwidth


This is insane. Over the past month, my DSL has been quite busy, and I couldn't figure out why. I started looking at the router logs, and discovered that my webserver was making a lot of connections to ad sites (see 60 second log below)
Quote:
TCP from 192.168.1.5:50926 to cpc.163.com(202.108.9.214):80
TCP from 192.168.1.5:50927 to union.narrowad.com(210.192.124.8):80
TCP from 192.168.1.5:50928 to xmlfeed.spaex.com(64.82.160.104):80
TCP from 192.168.1.5:50929 to 69.44.123.38:80
TCP from 192.168.1.5:50930 to ad.infinite-ads.com(72.37.157.36):80
TCP from 192.168.1.5:50931 to 69.44.123.54:80
TCP from 192.168.1.5:50932 to www.blazerunner.com(67.15.50.53):80
TCP from 192.168.1.5:50933 to www.clixshare.com(67.15.231.251):80
TCP from 192.168.1.5:50934 to ad.yieldmanager.com(72.37.157.36):80
TCP from 192.168.1.5:50935 to xml.nbcsearch.com(64.182.127.204):80
TCP from 192.168.1.5:50936 to www.dig-out.com(72.9.248.18):80
TCP from 192.168.1.5:50937 to ad.infinite-ads.com(72.37.157.36):80
TCP from 192.168.1.5:50938 to 204.181.57.155:80
TCP from 192.168.1.5:50939 to xml.nbcsearch.com(64.182.127.204):80
TCP from 192.168.1.5:50940 to ad.yieldmanager.com(72.37.157.36):80
TCP from 192.168.1.5:50941 to 69.44.123.38(69.44.123.38):80
TCP from 192.168.1.5:50943 to servedby.advertising.com(209.225.0.34):80
TCP from 192.168.1.5:50944 to union.narrowad.com(210.192.125.119):80
TCP from 192.168.1.5:50945 to servedby.advertising.com(209.225.0.32):80
TCP from 192.168.1.5:50946 to view.atdmt.com(209.67.78.3):80
TCP from 192.168.1.5:50947 to www.proxygrade.com(207.150.184.73):80
TCP from 192.168.1.5:50948 to 64.86.142.104:80
TCP from 192.168.1.5:50950 to network.realmedia.com(64.191.218.23):80
TCP from 192.168.1.5:50951 to g.thinktarget.com(69.8.177.39):80
TCP from 192.168.1.5:50952 to 69.44.123.38(69.44.123.38):80
TCP from 192.168.1.5:50953 to union.narrowad.com(210.192.125.84):80
TCP from 192.168.1.5:50955 to ad.infinite-ads.com(72.37.157.36):80
TCP from 192.168.1.5:50956 to www.blazerunner.com(67.15.48.53):80
TCP from 192.168.1.5:50957 to g.thinktarget.com(69.8.177.39):80
TCP from 192.168.1.5:50958 to 69.44.123.54(69.44.123.54):80
TCP from 192.168.1.5:50959 to ad.yieldmanager.com(72.37.157.36):80
TCP from 192.168.1.5:50962 to www.blazerunner.com(67.15.50.53):80
TCP from 192.168.1.5:50963 to ad.yieldmanager.com(72.37.157.36):80
TCP from 192.168.1.5:50964 to txsearch.epilot.com(63.251.39.197):80
TCP from 192.168.1.5:50965 to ad.yieldmanager.com(72.37.157.36):80
TCP from 192.168.1.5:50967 to www.spaex.com(64.82.160.104):80
Finally notice something I should seen weeks ago.
My httpd processes look odd. First off, I usually 2-4 processes running. Now I have, like, 30 of them.

Secondly, instead of a simple 'httpd -D', the process lists like this:
Quote:
httpd2 -f /etc/httpd/conf/httpd2.conf -DAPACHE2 -DHAVE_PERL -DHAVE_PHP4 -DHAVE_SSL -DHAVE_SUEXEC -DHAVE_ACCESS -DHAVE_ACTIONS -DHAVE_ALIAS -DHAVE_ASIS -DHAVE_AUTH_ANON -DHAVE_AUTH_DBM -DHAVE_AUTH_DIGEST -DHAVE_AUTH -DHAVE_AUTOINDEX -DHAVE_CASE_FILTER_IN -DHAVE_CASE_FILTER -DHAVE_CERN_META -DHAVE_CGID -DHAVE_CGI -DHAVE_CHARSET_LITE -DHAVE_DIR -DHAVE_ENV -DHAVE_EXPIRES -DHAVE_EXT_FILTER -DHAVE_HEA
Stopping the httpd process does shut down all the processes and stops the traffic on my DSL, so I feel this is the source of the problem. I just can't figure out why the server is suddenly reaching out to touch, well, everyone?

I think the problem is going to be somewhere in the daemon script, or one of the .conf files, but I'm not sure what a "normal" one looks like. Any help would be appreciated.
 
Old 06-08-2006, 05:34 AM   #2
unSpawn
Moderator
 
Registered: May 2001
Posts: 21,592
Blog Entries: 47

Rep: Reputation: 1408Reputation: 1408Reputation: 1408Reputation: 1408Reputation: 1408Reputation: 1408Reputation: 1408Reputation: 1408Reputation: 1408Reputation: 1408
(Now *this* would have been a good thread in the Linux - Security forum)

I just can't figure out why the server is suddenly reaching out to touch, well, everyone?
Because you didn't take care of your server, so someone else did. Since they felt comfy, they decide to stay and upload or make your server fetch some bot software to make them money. Note it doesn't need to run as root account user, so chances the box is cracked to the core would seem minimal: but do check.


I think the problem is going to be somewhere in the daemon script, or one of the .conf files, but I'm not sure what a "normal" one looks like.
The problem most likely is in running some deprecated, stale, outdated, vulnerable version of software (most likely some package using PHP) unprotected.
Let it run, make a full "ps axfwww 2>&1>/tmp/process.log" output, one netstat output: "netstat -anp 2>&1>/tmp/connections.log" and (just in case) one lsof output: "lsof -n 2>&1>/tmp/openfiles.log". Now check for processnames that seem "odd" and you most likely found your culprit.

0. Raise your firewall to DROP any inbound traffic to (running) services.
1. kill all network-facing services you don't need (httpd, any remaining accessable Perl, PHP or other interpreter processes)
2. Remove the rogue processes you found in your process, connections and openfiles logs. Most likely their files will reside in directories the user has access to like /tmp or /var/tmp.
3. Download, install and run Chkrootkit, Rootkit Hunter. Run "rpm -Va --noscripts 2>&1>/tmp/rpmcheck.log" and check output. If something seems fishy: please post *exact* output.
4. Remove any software that reads "only for development use" (like for instance XAMPP) or make sure you deny access (firewall) and only allow LAN usage. Update all packages and make sure you do this regularly from now on. Install mod_security. Make sure you deny any access to services until you have properly hardened them.

*Maybe request this thread to be moved to the Linux - Security forum.

Last edited by unSpawn; 06-08-2006 at 05:36 AM. Reason: //have kbd, can't type
 
Old 06-08-2006, 08:57 AM   #3
bdragon
LQ Newbie
 
Registered: Jan 2006
Posts: 6

Original Poster
Rep: Reputation: 0
0. Had that covered for years. Have a hardware firewall will all ports locked except 80, 25 and 110 (the whole point of the box is a web/mail server). It's configuration has not changed in two years.

1. Since it *is* a web server, I kind of need httpd running. But when I rebuilt the box in January, I did disable FTP, Telnet, SMTP, news... all the stuff I'm not going to use.

2. Killed the wayward processes two days ago. Still need to find a "normal" httpd script to compare mine to.

3. Will do it over the weekend.

4. I'll look into that. The LAN firewall is covering my whole net, so I should be good there. Can't restrict to LAN-only (that whole web/mail server thing again).


I'll work on it over the weekend and post back with results. In the meantime, if someone could post their httpd script, I'ld be eternally grateful.
 
Old 06-08-2006, 11:17 AM   #4
unSpawn
Moderator
 
Registered: May 2001
Posts: 21,592
Blog Entries: 47

Rep: Reputation: 1408Reputation: 1408Reputation: 1408Reputation: 1408Reputation: 1408Reputation: 1408Reputation: 1408Reputation: 1408Reputation: 1408Reputation: 1408
1./2. what I mean is wrt ops around cleaning up, just in case something lives you overlooked. But if you don't want to make customers see downtime or whatever reasons you have for not bringing stuff down: BMG, you're the expert I guess...
 
Old 06-10-2006, 01:43 PM   #5
bdragon
LQ Newbie
 
Registered: Jan 2006
Posts: 6

Original Poster
Rep: Reputation: 0
Well, cleaned up the mess.
Uninstalled Apache and reinstalled. Took five minutes and the system is as good as new.

In the meantime, I'm reviewing my router settings and the server security.

I agree that running the minimum services needed is the most secure way to run. I just need to look closely at what is *really* needed.
 
  


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
Trackbacks are Off
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
bandwidth management tools and process thagu Linux - Networking 1 01-18-2006 03:34 AM
MSN bot sucking up my bandwidth vharishankar General 5 01-05-2005 11:18 PM
Per port/process bandwidth bratch Linux - Networking 2 12-11-2004 11:40 AM
How to trace individual process' bandwidth usage wangru Linux - Networking 0 08-24-2004 12:32 PM
how do I make httpd a process that runs on startup Belkorin Linux - Software 4 07-09-2004 02:32 PM


All times are GMT -5. The time now is 11:30 PM.

Main Menu
 
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
identi.ca: @linuxquestions
Facebook: @linuxquestions
Open Source Consulting | Domain Registration