天天看点

HULK vs. THOR - Application DoS SmackdownHULK ProfileTHOR (ModSecurity Rules) ProfileHULK vs. THOR

<a href="http://blog.spiderlabs.com/2012/05/hulk-vs-thor-application-dos-smackdown.html?utm_source=feedburner&amp;utm_medium=feed&amp;utm_campaign=Feed%3A+SpiderlabsAnterior+%28SpiderLabs+Anterior%29&amp;utm_content=Google+Reader">http://blog.spiderlabs.com/2012/05/hulk-vs-thor-application-dos-smackdown.html?utm_source=feedburner&amp;utm_medium=feed&amp;utm_campaign=Feed%3A+SpiderlabsAnterior+%28SpiderLabs+Anterior%29&amp;utm_content=Google+Reader</a>

In my line of work, I get to see tons of different nifty hacking tools, and traffic generation tools that are meant to either break and steal information off a system, or exhaust its resource pool, rendering the service dead and putting the system under a denial of service. For a while now, I have been playing with some of the more exotic tools, finding that their main problem is always the same… they create repeatable patterns. too easy to predict the next request that is coming, and therefor mitigate. Some, although elegant, lack the horsepower to really put a system on its knees. For research purposes, I decided to take some of the lessons I’ve learned over time and practice what I preach. Enforcing Python’s engines, I wrote a script that generates some nicely crafted unique Http requests, one after the other, generating a fair load on a webserver, eventually exhausting it of resources. this can be optimized much much further, but as a proof of concept and generic guidance it does its job.

<a></a>

HULK is a python script that will use various techniques to make the requests dynamic and thus more difficult to detect with defensive signatures.  For instance, HULK will rotate both User-Agent and Referer fields as shown below:

HULK vs. THOR - Application DoS SmackdownHULK ProfileTHOR (ModSecurity Rules) ProfileHULK vs. THOR

Here is the section of code where the request is being built:

HULK vs. THOR - Application DoS SmackdownHULK ProfileTHOR (ModSecurity Rules) ProfileHULK vs. THOR

When HULK is run against my local Apache web server, I get requests similar to this -

Notice the bolded entries are indeed dynamic and change their payloads with each request.  Also note, however, that the python urllib2 libary is overwriting the "Connection: keep-alive" request header designation specified by the

request.add_header() function and instead using "Connection: close".  So much for trying to optimize that part of the attack...

Since the attack tool's name is using the Marvel comics super-hero name, we thought that we would also pay hommage to

THOR (Thumping Http Obvious Requests).

While the HULK tool does achieve its goal of randomizing the payloads of various headers, it is still quite easily identifiable due to the request header ordering of the requests.  The request header ordering is always:

Accept-Encoding

Host

Keep-Alive

User-Agent

Accept-Charset

Connection

Referer

Cache-Control

Even though HULK defines a certain order of request headers using the request.add_header() function call, the actual order of the headers at run time is dictated by the dictionary key ordering

of the python implementation.

This ordering is a unique fingerprint for this tool as no other legitimate web clients have this header ordering.  Therefore, I created the following ModSecurity rule to identify HULK traffic:

This ruleset will create a custom variable that holds the request header name ordering. It then checks to see if it matches our HULK profile.  If so, it will then initiate a drop action to quickly terminate the connection.  

Let's now pit these two superheros against each other!  These are some sample entries for how it would look when HULK is run against a ModSecurity/THOR site: