Jump to content

Possible DoS attack? and how to prevent?


schilly

Recommended Posts

Well our db server just went down for 4 mins due to max connections being hit. After looking at the processlist for the db it was all sleep threads. I get an email any time the db goes down with POST, GET, SESSION, SERVER info from PHP. After reviewing, someone from the same ip hit the same page on our web server 400+ times in 3mins. I'm assuming this is a DoS attack?

 

Is there any way I can know for sure? What should I look for?

 

How do I prevent this in the future?

 

Max idle time on the db right now is 3min. Should I decrease this to 30s?

 

Why did I receive all these sleep threads in the db? Was it because the attacker killed the HTTP connection before the server could respond?

 

 

Any help is greatly appreciated.

 

Thanks.

Link to comment
Share on other sites

Hmm, albeit it a weak one, I do think it might be an attack of some kind.  It's either that or a very aggressive search crawler (google bot for example).

 

Is the page particularly resource intensive?  Because if I were going to attack a website and had little resources, my approach would be to find a very DB/memory heavy page and slam it.  If a page is rather resource intensive, a fairly modest computer/internet connection can flood a server.

 

Anyway, is it the exact URL or variations of it?  For example store.php over and over again, or store.php?page=1 then store.php?page=2...

 

Also, have you tried googling the IP address?  If it's a search bot, that will likely bring something up about it.

Link to comment
Share on other sites

See: http://wiki.kartbuilding.net/index.php/Apache#mod_evasive

 

To prevent the db server from falling over, I suggest you limit the number of connections allowed from a mysql user. I limited mine to 10 simultaneous connections per user. This helped a LOT. In my case the db server didn't fall over, and after a few minutes sorted itself out.

I also suggest you look at what web pages are accessed and what mysql queries are been made. It could be the type of mysql query been made. Also did you see if there are any mysql slow queries? (assuming your using mysql).

 

-steve

Link to comment
Share on other sites

Thanks for the replies.

 

IP: 208.53.157.241.  I don't see much about it other than it's in Illinois, US. It was the same URL the whole time.

 

I'll take a look at mod_evasive. Looks very interesting.

 

I'll check the slow query log but I don't think this is the issue. My main concern is all the sleep queries in MySQL. I think I'll limit the max idle time to 30s instead of 300s.

 

So if this person loads our page then kills the connection really fast before the page can finish loading would this leave the MySQL connection open for that page load? It seemed like for some reason connections we're getting closed.

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.