Topics


Blogs


Forums


Samples


Media


Labs


Resources

 




DevCentral > Weblogs > Lori MacVittie - Two Different Socks
 Stop brute force listing of HTTP OPTIONS with network-side scripting
posted on Monday, January 05, 2009 5:58 AM

Over the holidays Marcin @ tssci security offered up a python script for brute forcing the HTTP OPTIONS on directories. One of the reasons someone would want this information is because if you're (accidentally, of course) allowing PUT methods on any directories, someone can upload something nasty and potentially execute an attack. The availability of PUT makes XSS attacks simple even for script kiddies, for example.

There may be legitimate reasons for enabling PUT on your servers, but you don't necessarily want the whole world to know that - just the applications that need the functionality. As with many pieces of information about your web architecture, you want (and need) to keep this secret.

Using network-side scripting you can easily intercept requests for HTTP OPTIONS and ensure that the information is not shared with just anyone. There are a plethora of ways in which you can deal with the request - from simply resetting the connection (rude, but effective) to determining who might be making the request, logging it, and deciding whether to provide the answer.

A similar solution can be implemented using configuration options in Apache and other web application servers to be sure, but using network-side scripting provides greater flexibility and simplicity in implementing a solution. A single network-side script can provide a solution that prevents the retrieval of HTTP OPTIONS for an entire site, while most server-side solutions require the configuration and deployment of multiple files and/or across multiple servers. Using network-side scripting also allows you the option to identify requests based on a variety of parameters not always available in a server-side solution that can make implementation easier if you have a legitimate need to allow some applications access to HTTP OPTIONS.

Network-side scripting also allows you to examine virtually any aspect of the request - from the HTTP headers to the data (if any) being exchanged - in order to make a determination whether the request should be honored or not. Basically, you need to:

  1. Intercept HTTP requests
  2. Examine the HTTP method
  3. If the method is OPTIONS, determine how to react
  4. Do it!

Here's the core of an iRule to stop folks from gathering this kind of information from your site. 

when HTTP_REQUEST {

   set method [HTTP::method]

   if {$method eq "OPTIONS"} {
      HTTP::respond 200 content "No. Not yours."
   }

}

You could also specifically look for the methods you want to manage - PUT for example - and deal only with them in the case that some applications you have may need the functionality (unlikely, but possible).

Obviously you'll want something a bit more expansive to address how you - and your organization - want to deal with requests like this, but the core of the script offers you the foundation upon which to build out a solution more specific to your site and application needs.

Follow me on Twitter View Lori's profile on SlideShare AddThis Feed Button Bookmark and Share

Reblog this post [with Zemanta]


 
      

Feedback


1/5/2009 8:27 AM
Gravatar Attackers could just send in a PUT request and then check to see if it worked. It would be twice the requests to cover the same brute force space but it would eliminate false positives. This defense wouldn't work as a general solution unfortunately since OPTIONS will be necessary for HTML5 functionality and violates the HTTP 1.1 specification.

That being said, I like the flexibility.
arshan

1/23/2009 1:08 PM
Gravatar Great post Lori - perhaps also worth mentioning that both ASM (Application Security Module) and PSM (Protocol Security Module) allow by default only GET POST and HEAD as HTTP methods thereby disabling anyone from using any other method.

Thanks,

Tom.
Tom Spector

3/26/2009 7:26 AM
Gravatar Hi

as i look into my apache access log, i found this line below wit list
of my root path.

151.68.238.154 151.68.238.154 - - [24/Mar/2009:19:34:05 +0100] "OPTIONS bin dev etc etc.defaults initrd lib linuxrc lost+found mnt proc root sbin sys tmp usr var var.defaults volume1 volumeSATA volumeUSB1 volumeUSB2 volumeUSB4 HTTP/1.0" 200 - "-" "-"

Is this an attack described in this blog?
Haaki

3/26/2009 7:39 AM
Gravatar @Haaki

It's certainly some kind of interesting attack. OPTIONS is usually used to get information on what kind of HTTP options are available (PUT, DELETE, GET, POST, etc...) not used on a root directory listing. If you can block OPTIONS you should be able to prevent this command from actually returning any information - or breaking something in the process, if that's the intent. I'm not sure exactly what the request is trying to do, though it's obviously coming from someone trying to hide their identity (no referrer, no agent, no identifying data but IP).

So this is not exactly the attack described, but you should be able to use the same technique to stop such a request from hitting the server.

Lori
Lori MacVittie

11/6/2009 12:30 PM
Gravatar TLS Man-in-the-Middle Attack Disclosed Yesterday Solved Today with Network-Side Scripting
Lori MacVittie
 Leave Feedback
Title  
Name  
Email
Url
Comments   
Please add 4 and 4 and type the answer here: