Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

Help in using SetEnvIf in Apache Configuration

Posted on 2004-04-03
10
Medium Priority
?
741 Views
Last Modified: 2008-03-17
I'm getting these rather annoying hits in my access.log file this is something like:

123.456.789.23 - -[23/Mar/2004:07:07:26 -0500] "SEARCH /\x90\x90\x90.........."

Where the \x90 goes on for many lines. I've tried using SetEnvIf to block this, but without success.

Any ideas on how to block this?


0
Comment
Question by:keyboardman
  • 6
  • 4
10 Comments
 
LVL 6

Expert Comment

by:prof666
ID: 10789714
I had the same Issue. You cant remove SEARCH from log ??? Instead I used iptables to block SEARCH requests to Port 80:

iptables -I INPUT -j DROP -p tcp -s 0.0.0.0/0 --dport 80 -m string --string "SEARCH"

Works a treat. Might cause quite a hit on your cpu if your site is high volume. To remove:

iptables -D INPUT -j DROP -p tcp -s 0.0.0.0/0 --dport 80 -m string --string "SEARCH"

Regards

Da Proff

0
 

Author Comment

by:keyboardman
ID: 10791185
Can you tell me what iptables is?  I've never heard of them.  

I just did a google search and got some things about Linux and iptables?  I'm running XP and can't seem to find anything anything about iptables for Windows.

Thanks,
Keyboardman
0
 
LVL 6

Expert Comment

by:prof666
ID: 10791346
Ahh, I foolishly assumed you were using Linux...sorry. Iptables are part of the linux kernel, and can filter Network I/O, thus can act as a stateful firewall, and block SEARCH.
As for XP...I think your stuck with the log entries. You could try and block the top level subnet that these requests come from. Most of the entries I got were from my ISP subnet, so try blocking that using the apache allow/deny. I have a feeling that this won't block SEARCH.
If you run a firewall on your XP then you could also block the IP's completely.

Good luck

Da Proff
0
Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 

Author Comment

by:keyboardman
ID: 10791417
Thanks for the help.  I have blocked the IP's that I'm getting the attacks from, but they keep changing.  I think it's a useless battle.  At least I know that their attempts are fruitless.

Just for now, I'm going to leave this question open, but unfortunately I think there is no good solution.

Thanks again,
Keyboardman
0
 

Author Comment

by:keyboardman
ID: 10791448
Actually, I just thought of something.  Is there a way for me to send all GET's and POST's to another file?  That would in effect only leaving the stupid stuff in my access.log file.
0
 
LVL 6

Expert Comment

by:prof666
ID: 10821538
You could infact do this.
I haven't tried it but you could try the following:

Instead of using SetEnvIf to block, with the:
SetEnvIf        Request_URI "/x90" DontLog
CustomLog               /var/apache/logs/access_log common env=!DontLog

Use it to Only log GET and POST:
SetEnvIf        Request_URI "GET" Log
SetEnvIf        Request_URI "POST" Log
CustomLog               /var/apache/logs/access_log common env=Log

That should only log POST and GET.
Give that a rty and see..

Da Proff
0
 

Author Comment

by:keyboardman
ID: 10829719
I've got a couple of the following already in the configuration:

SetEnvIf Request_URI "/(cmd\.exe|root\.exe|default\.ida)$" dontlog

And one "dontlog" for not logging my own IP address, so then I added the lines you suggested with log instead of dontlog.  My last line is like this:

CustomLog logs/access.log combined env=!dontlog

I'll see if this works.  I'll let you know.  I usually see the WebDev attacks daily, so I'll be able to tell fairly quickly if it worked.

Thanks,
Keyboardman
0
 

Author Comment

by:keyboardman
ID: 10861819
After trying to only log GET's and POST's, it still logs the irritating SEARCH requests as well.  Unfortunately, I think I'm just stuck with logging the SEARCH requests.

One other question that I had is, I recently changed to using xampp on Windows, which comes with Apache 2.0.  It also has a module for WebDav, which seems to be the target of the SEARCH exploit.  My question is, does this exploit only affect IIS servers running WebDav, or if I run WebDav under Apache, am I also susceptible?

-Keyboardman
0
 
LVL 6

Accepted Solution

by:
prof666 earned 2000 total points
ID: 10866507
If you are not intending to use Webdav then turn it off (I think apache has it disabled by default). I know the welchii worm (that annoying x90 thing) is only a buffer overflow vuln for IIS. So don't worry about it too much. Another method of cutting down on the scans it to write a perl script to rip out from the logs the IP's of the servers attacking, and block the whole subnets. This will also block ligitimate callers, but may offer you some restpite. The majority of attacks on my server come from my ISP's subnets, and much will be the same in your case. Block these off and you may loose up to 90% of the scans.
Best of Luck

Da Proff
0
 

Author Comment

by:keyboardman
ID: 10869309
You are correct about most of my attacks have been from my own ISP's subnets.  Come to think of it, I could probably write a perl script to rip out the good stuff from the logs and write that to another log file and totally disregard my current log file.  From here I think I will consider this item closed.

Thanks again for all your help!

-Keyboardman
0

Featured Post

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Over the last year I have answered a couple of basic URL rewriting questions several times so I thought I might as well have a stab at: explaining the basics, providing a few useful links and consolidating some of the most common queries into a sing…
Hi, in this article I'm going to teach you how to run your own site, and how to let people in (without IP). I'll talk about and explain each step... :) By the way, everything in this Tutorial is completely free and legal. This article is for …
Exchange organizations may use the Journaling Agent of the Transport Service to archive messages going through Exchange. However, if the Transport Service is integrated with some email content management application (such as an anti-spam), the admin…
Please read the paragraph below before following the instructions in the video — there are important caveats in the paragraph that I did not mention in the video. If your PaperPort 12 or PaperPort 14 is failing to start, or crashing, or hanging, …
Suggested Courses
Course of the Month9 days, 16 hours left to enroll

926 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