Linux, Apache, PHP, MySQL Administrators Forums

Go Back   Linux, Apache, PHP, MySQL Administrators Forums > LAMP Forums > Linux/BSD

Reply
 
LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 02-18-2009, 03:18 PM
Junior Member
 
Join Date: Jan 2009
Posts: 13
Default Detecting DoS

Help! One of my client's servers is performing peculiarly slow for the last hour and it seems apache is the culprit. We have restarted apache several times but it just keeps slowing back after 5mins. I know netstat will indicate a sign but how do I interpet the data and how should I be querying data? TIA
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #2 (permalink)  
Old 02-18-2009, 03:33 PM
Administrator
 
Join Date: Jan 2009
Posts: 42
Default

Quote:
Originally Posted by shockx View Post
Help! One of my client's servers is performing peculiarly slow for the last hour and it seems apache is the culprit. We have restarted apache several times but it just keeps slowing back after 5mins. I know netstat will indicate a sign but how do I interpet the data and how should I be querying data? TIA
You'll need to determine which IP has the most TCP connections to your port 80.

Code:
netstat -atun|grep :80|awk '{print $5}'|cut -d: -f1|uniq -c
It should display unique IPs connecting to your port 80 and count how many each at a time. You can then start investigating the IP with the most connections.

Try not concentrate only on the TCP data, check your apache logs as well for which files are being accessed. This can help you narrow down and profile the attacker more i.e. wether he is brute forcing a script on your server, gather his attack pattern, etc.

Hope this helps.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #3 (permalink)  
Old 02-18-2009, 03:37 PM
Junior Member
 
Join Date: Jan 2009
Posts: 13
Default

Hi swordfish, thanks for the code. I am seeing 5 to 10 IPs with each more than a hundred connections each. One question though, how do I differentiate the legitimate users from the culprit?
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #4 (permalink)  
Old 02-18-2009, 03:51 PM
zoticai+c's Avatar
Ambiguos Variable
 
Join Date: Jan 2009
Posts: 3,463
Default Be careful

Be careful with interpreting data, you might be thinking of legitimate users as the culprit to DoSing your server.

As swordfish says carefully inspect your access and error logs, consolidate hourly data for each IP. One thing to look our for the culprit based on my experience are bogus HTTP requests which are very hard to detect from the server level. Also lookout for out of the norm apache error responses from your logs i.e. aside from 500 and 404, some uncomon apache error codes could've shown up at your logs from the last hour or so.
__________________
···dotmanila···
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #5 (permalink)  
Old 02-18-2009, 04:01 PM
Administrator
 
Join Date: Jan 2009
Posts: 42
Default

Quote:
Originally Posted by zoticai+c View Post
Be careful with interpreting data, you might be thinking of legitimate users as the culprit to DoSing your server.

As swordfish says carefully inspect your access and error logs, consolidate hourly data for each IP. One thing to look our for the culprit based on my experience are bogus HTTP requests which are very hard to detect from the server level. Also lookout for out of the norm apache error responses from your logs i.e. aside from 500 and 404, some uncomon apache error codes could've shown up at your logs from the last hour or so.
+1 with zoticai+c, it would be harder for you on this level as you could be buried with the wrong assumption and be locking legitimate users.

It would also help asking assistance from your network administratot/engineer. I would assume bringing attention of DoS to your server is that it is a busy and well visited website(s) and it is as well behind a managed network. From this point your network administrators/engineers can inspect the packets from the switch/firewall your server connects on.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #6 (permalink)  
Old 02-18-2009, 04:13 PM
Junior Member
 
Join Date: Jan 2009
Posts: 13
Default

Apparently, asking help from the network engineers incurs costs and I had to get authorization from the client. They are investigating the attack as I type.

However I still need to investigate this myself and give it a shot from the server level. I agree it will be harder but this can be a sort of training as well.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #7 (permalink)  
Old 02-18-2009, 04:14 PM
zoticai+c's Avatar
Ambiguos Variable
 
Join Date: Jan 2009
Posts: 3,463
Default

Well goodluck there mate, and please post your findings here if you can so others can benefit
__________________
···dotmanila···
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Reply

Bookmarks


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

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



All times are GMT. The time now is 09:49 AM.


Community hosted with DotManila Consulting
Powered by vBulletin® Version 3.8.4
Copyright ©2000 - 2010, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.3.2