bot net get request attack mitigation?

Posted on 2004-04-30
Medium Priority
Last Modified: 2010-04-22
It seems we have a bot net of roughly 10000 computers sending hudreds of the following request per second to one of our customer's web servers:

[30/Apr/2004:17:16:56 -0700] "GET

which comes with an accompanying error_log entry as follows:

Fri Apr 30 17:18:59 2004] [error] [client x.x.x.x] (36)File name too

We have tried writing a script to detect these bots on the fly and add them to the server's iptables, but the server quickly becomes overwhelmed with 1500+ iptables entries.  We have also tried adding ACLs at our core switches in order to help mitigate the attack, but unfortunately they have a 500 ACL limit.  The ips of the bots seem to sufficiently change every hour on the hour such that it makes us believe there are nearly an unlimited amount of bots at this person(s) disposal.

Anyone ever seen something like this before and/or have advice as to how to combat it?  Could this be an apache related problem as well relative to apache responding in an inefficient manner to the unusually long urls?

Question by:skeed
  • 4
  • 4
LVL 40

Expert Comment

ID: 10965206
That sounds like a viral DDoS with that many attack nodes. Are the IP's randomly scattered across the Internet or concentrated in only a few netblocks? A random distribution might point to a viral distribution of the attack program.

Other than a fast upstream filter there's not a lot you can do about this sort of attack and still keep the web server available for normal use. I don't see any new viruses that mention this sort of attack or and new security advisories about Apache, so this may be something completely new.

Author Comment

ID: 10965630
Yeah, lucky us.  We have seen similar attacks before, but never this powerful.  I made the mistake of not making a good authoritative master list of all the "bots", but am doing so now.  Based on what I've seen so far though, it's totally random and there are thousands of them.  

I'm definitely wondering if Apache could make a more "efficient" response to such a request.  Is there an apache hack that might recognize this request in some way and drop it immediately?  I've tried doing a "Files" match for it and then denying it but that didn't help either.

I'm also going to try the iptables "string" match option to see if that helps at all.

Any other suggestions would be immensely appreciated.
LVL 51

Expert Comment

ID: 10966565
in iptables you can block such requests, but it's a performance bootleneck 'cause iptables needs to parse each http packet (needs to terminate the request)
in apache you can use mod_rewrite or mod_security to block the request, I'd suggest to simply drop them

Or you need a Web Application Shield. AFAIK, there are no free products now, think about starting with at least $10000,-
Some traditional network firewalls (iptables still mentioned) also have limited posibilities to block it.

Do you need more detailed informations?
Managed Security Services Webinar - March 15

Selecting the right managed security services platform to grow your business can be a huge undertaking. Join WatchGuard and Frost & Sullivan in an upcoming webinar as we dive into the key elements of selecting a vendor platform and partnership to fuel a successful MSSP business.


Author Comment

ID: 10966643
I suspect that iptables would crumble, having to inspect each and every http packet.

What do you mean simply dropping them?  I have tried using a Deny from IP set of statements, but for some reason these long requests bypass them.  I'm not sure how or why.  I have also tried using mod_security, but can't seem to find the filter that does the trick.  What SecFilter regexp should catch the request above?  For some reason mod_security can't catch them either.  

I have also thought about hacking the apache source code such that it behaves differently when receiving a long filename but am not sure where to look or if this is the right thing to do.

Web application shield is not an option right now, unfortunately.

LVL 51

Expert Comment

ID: 10966677
SecFilter "/AAA.*"

> What do you mean simply dropping them?
I mean drop the packets, not reject

Author Comment

ID: 10966786
For some reason, that Filter won't match the packets.  Does the request have to be valid for it to work?  Remember, the requests are have very large filenames that cause apache to throw errors very early on.

LVL 51

Expert Comment

ID: 10977573
did you enable logging or debugging? It tells you what's going on, usually.

SecFilterDefaultAction "deny,log"
SecFilterDebugLog logs/modsec_debug_log
SecFilterDebugLevel 4


SecAuditEngine On
SecAuditLog logs/audit_log

then  a filter:

SecFileter AAAA "deny,log,status:500"

and with the malicious request it should produce log messages

Author Comment

ID: 10978151

Here's a mod_security log of the attack:

HTTP/0.9 (null) ======================================== Request: - - [Sat May 1 13:13:08 2004] "GET
403 0 Handler: (null) Error: access to
failed ---------------------------------------- GET

I tried various regular expression combinations but nothing worked.  Could it be that mod_security cannot block it because the URL is too long?

LVL 51

Accepted Solution

ahoffmann earned 1500 total points
ID: 10978689
works for me.
I get in the audit and debug log file:
     Access denied with code 403. Pattern match "AAAAAAAAAA" at THE_REQUEST.
as well as a 403 status page in my client

Featured Post

Keep up with what's happening at Experts Exchange!

Sign up to receive Decoded, a new monthly digest with product updates, feature release info, continuing education opportunities, and more.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

​Being a Managed Services Provider (MSP) has presented you  with challenges in the past— and by meeting those challenges you’ve reaped the rewards of success.  In 2014, challenges and rewards remain; but as the Internet and business environment evol…
Hello EE, Today we will learn how to send all your network traffic through Tor which is useful to get around censorship and being tracked all together to a certain degree. This article assumes you will be using Linux, have a minimal knowledge of …
The video provides a quick and easy steps to migrate MBOX file to well known Outlook PST and Office 365. Besides this, it also supports and migrates more than 20 email clients of MBOX which include AppleMail, Opera, Thunderbird and SeaMonkey effortl…
To export Lotus Notes to Outlook PST or Exchange and Domino Server files to Exchange Server or PST files with ease, go for Kernel for Lotus Notes to Outlook conversion tool. Through the video, you can watch the conversion process. A common user with…

600 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question