Experiencing a Security Breach?

24 Hour Hotline: +1 (866) 659-9097 Option 5

General

+1 (312) 873-7500

Monday - Friday 8:00 AM - 6:00 PM CT (UTC -6)

Sales

Contact a Trustwave solution specialist.

+1 (888) 878-7817

Monday - Friday 8:30 AM - 5:30 PM CT (UTC -6)

Loading...

Blogs & Stories

SpiderLabs Blog

Attracting more than a half-million annual readers, this is the security community's go-to destination for technical breakdowns of the latest threats, critical vulnerability disclosures and cutting-edge research.

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.

HULK Profile

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:

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

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...

THOR (ModSecurity Rules) Profile

Since the attack tool's name is using the Marvel comics super-hero name, we thought that we would also pay hommage to The Avengers movie that is currently out and call our ModSecurity defense rules 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.

HULK vs. THOR

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:

As an added benefit, using the ModSecurity drop action (which issues a TCP FIN packet to forcefully close the connection) seems to cause HULK to freeze. :) After receiving the inital 10 requests, and issuing the drop, HULK sits idle and does not send anymore requests. Apparently HULK only deals well with cleanly terminated HTTP responses.