PDA

View Full Version : MySQL System Abuse - Is There A Solution?


UserName
Thu 2nd Nov '00, 1:27am
Here's my problem - certain people are making 100's of vB page requests per second on my site and crashing it repeatedly because of the enormous number of MySQL processes. We have determined that some of these people are simply running offline browsers and email grabbing spiders, but we also believe that some of them might be malicious. This is not an isolated problem with my hardware, as I believe that you could bring down most vB sites by simply reloading a page as fast as you can for a few minutes.

I have started using an .htaccess to block offline browsers and specific spiders, but most of these programs can be run in "stealth" mode where they send a User Agent that looks like Internet Explorer. So, the simple solution is not going to work.

What I would like to know from some of the MySQL gurus and programming experts here is what can be done to stop this?

I talked to one code hacker who suggested that we might be able to write a script that would monitor the server logs and watch for any single IP address that makes more than X number of requests in a 1 minute period, and then, when found, the script could boot that IP from the site using an .htaccess file that would be updated dynamically by the script. The IP would then remain blocked for an hour and then be dropped from the .htaccess and allowed back into the site. Because of the nature of dynamic IP's, we couldn't permanently ban IP's.

If this is possible, and if it wouldn't eat more server resources than it would save, does this sound like a reasonable solution to those in the know?

I know that there is no way to block a full on DOS attack, but I don't get the feeling that these people are pros - they either don't understand what they're doing to the site or they are just being annoying to have some fun. I'm fairly sure that finding a way to block their IP when it starts to happen would cause them to get bored and go away.

Any thoughts on the solution and how hard it would be to write a script to do something like this?

Chris Schreiber
Fri 3rd Nov '00, 11:08am
How about adding a column to the session table to track the number of queries a client has executed. Then when it hits a limit that you specify, you can then return an error whenever any more queries are attempted.

-Chris

UserName
Sat 11th Nov '00, 3:52am
Originally posted by Chris Schreiber
How about adding a column to the session table to track the number of queries a client has executed. Then when it hits a limit that you specify, you can then return an error whenever any more queries are attempted.

-Chris

Hmmm. I am a total moron, so forgive me. Does every user have a "session" or is this just for users with cookies enabled? I also wonder if writing to the table every time a page is viewed would take a lot of system resources. Maybe the script already does it, I'm just to dumb to know. Thanks for any help - I'm still fighting this war with my users.

UserName
Mon 4th Dec '00, 4:36am
This is a question for Chris or anyone else who knows:

Is there a way to limit the number of simultaneous MySQL connections by a single ip address. That is to say - can I tell MySQL to check the IP address of every user before allowing them to connect and then to reject a user who already has 20 connection to the MySQL server open?

I am still trying to find a way to deal with visitors who are using offline browsers to rip through our site at a rate of 100's of pages per second. No matter what I do this is causing my server to overload. I need to find a way to limit the connections that any one user can make to the MySQL server.

Any and all suggestions appreciated.

Sharg
Mon 4th Dec '00, 11:07am
How about adding a column to the session table to track the number of queries a client has executed. Then when it hits a limit that you specify, you can then return an error whenever any more queries are attempted.

-Chris


What about making this a default standard feature included with 2.0 ?

Benj