CVE-2024-3400: PAN-OS Command Injection Vulnerability in GlobalProtect Gateway. Learn More

CVE-2024-3400: PAN-OS Command Injection Vulnerability in GlobalProtect Gateway. Learn More

Services
Capture
Managed Detection & Response

Eliminate active threats with 24/7 threat detection, investigation, and response.

twi-managed-portal-color
Co-Managed SOC (SIEM)

Maximize your SIEM investment, stop alert fatigue, and enhance your team with hybrid security operations support.

twi-briefcase-color-svg
Advisory & Diagnostics

Advance your cybersecurity program and get expert guidance where you need it most.

tw-laptop-data
Penetration Testing

Test your physical locations and IT infrastructure to shore up weaknesses before exploitation.

twi-database-color-svg
Database Security

Prevent unauthorized access and exceed compliance requirements.

twi-email-color-svg
Email Security

Stop email threats others miss and secure your organization against the #1 ransomware attack vector.

tw-officer
Digital Forensics & Incident Response

Prepare for the inevitable with 24/7 global breach response in-region and available on-site.

tw-network
Firewall & Technology Management

Mitigate risk of a cyberattack with 24/7 incident and health monitoring and the latest threat intelligence.

Solutions
BY TOPIC
Offensive Security
Solutions to maximize your security ROI
Microsoft Exchange Server Attacks
Stay protected against emerging threats
Rapidly Secure New Environments
Security for rapid response situations
Securing the Cloud
Safely navigate and stay protected
Securing the IoT Landscape
Test, monitor and secure network objects
Why Trustwave
About Us
Awards and Accolades
Trustwave SpiderLabs Team
Trustwave Fusion Security Operations Platform
Trustwave Security Colony
Partners
Technology Alliance Partners
Key alliances who align and support our ecosystem of security offerings
Trustwave PartnerOne Program
Join forces with Trustwave to protect against the most advance cybersecurity threats
SpiderLabs Blog

HULK vs. THOR - Application DoS Smackdown

SpiderLabs Research Team Contributions from:

@jgrunzweig

@ethackal

@claudijd

There was a new web server DoS tool released yesterday called HULK (Http Unbearable Load King). Here is a snippet from the blog page:

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:

9696_676242be-4908-4450-8cd4-b0d2577c2189

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

Screen shot 2012-05-18 at 1.51.44 PM
When HULK is run against my local Apache web server, I get requests similar to this -

GET /?CFEGD=MBDPVA HTTP/1.1
Accept-Encoding: identity
Host: 192.168.1.103
Keep-Alive: 116
User-Agent: Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 5.1; Trident/4.0; SV1; .NET CLR 2.0.50727; InfoPath.2)
Accept-Charset: ISO-8859-1,utf-8;q=0.7,*;q=0.7
Connection: close
Referer: http://engadget.search.aol.com/search?q=ALXUW
Cache-Control: no-cache
GET /?ASH=REHRKP HTTP/1.1
Accept-Encoding: identity
Host: 192.168.1.103
Keep-Alive: 110
User-Agent: Opera/9.80 (Windows NT 5.2; U; ru) Presto/2.5.22 Version/10.51
Accept-Charset: ISO-8859-1,utf-8;q=0.7,*;q=0.7
Connection: close
Referer: http://www.google.com/?q=VUCWJE
Cache-Control: no-cache
GET /?UALK=USXGPJD HTTP/1.1
Accept-Encoding: identity
Host: 192.168.1.103
Keep-Alive: 110
User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US) AppleWebKit/532.1 (KHTML, like Gecko) Chrome/4.0.219.6 Safari/532.1
Accept-Charset: ISO-8859-1,utf-8;q=0.7,*;q=0.7
Connection: close
Referer: http://engadget.search.aol.com/search?q=ZNWFXTOD
Cache-Control: no-cache

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:

SecRule REQUEST_HEADERS_NAMES ".*" "id:'11',chain,phase:1,t:none,log,drop,msg:'Request Header Ordering Alert: Potential Attack Tool - HULK DoS.',setvar:'tx.header_order=%{tx.header_order}, %{matched_var}'"
SecRule TX:HEADER_ORDER "@streq , Accept-Encoding, Host, Keep-Alive, User-Agent, Accept-Charset, Connection, Referer, Cache-Control""

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:

[Fri May 18 12:04:29 2012] [error] [client 192.168.1.103] ModSecurity: Access denied with connection close (phase 1). String match ", Accept-Encoding, Host, Keep-Alive, User-Agent, Accept-Charset, Connection, Referer, Cache-Control" at TX:header_order. [file "/usr/local/apache/conf/crs/base_rules/modsecurity_crs_15_custom.conf"] [line "1"] [id "11"] [msg "Request Header Ordering Alert: Potential Attack Tool - HULK DoS."] [hostname "192.168.1.103"] [uri "/"] [unique_id "T7ZzDcCoAWcAAV8cETwAAAAB"]
[Fri May 18 12:04:29 2012] [info] [client 192.168.1.103] (9)Bad file descriptor: core_output_filter: writing data to the network
[Fri May 18 12:04:30 2012] [error] [client 192.168.1.103] ModSecurity: Access denied with connection close (phase 1). String match ", Accept-Encoding, Host, Keep-Alive, User-Agent, Accept-Charset, Connection, Referer, Cache-Control" at TX:header_order. [file "/usr/local/apache/conf/crs/base_rules/modsecurity_crs_15_custom.conf"] [line "1"] [id "11"] [msg "Request Header Ordering Alert: Potential Attack Tool - HULK DoS."] [hostname "192.168.1.103"] [uri "/"] [unique_id "T7ZzDsCoAWcAAV8fEYIAAAAE"]
[Fri May 18 12:04:30 2012] [info] [client 192.168.1.103] (9)Bad file descriptor: core_output_filter: writing data to the network
[Fri May 18 12:04:30 2012] [error] [client 192.168.1.103] ModSecurity: Access denied with connection close (phase 1). String match ", Accept-Encoding, Host, Keep-Alive, User-Agent, Accept-Charset, Connection, Referer, Cache-Control" at TX:header_order. [file "/usr/local/apache/conf/crs/base_rules/modsecurity_crs_15_custom.conf"] [line "1"] [id "11"] [msg "Request Header Ordering Alert: Potential Attack Tool - HULK DoS."] [hostname "192.168.1.103"] [uri "/"] [unique_id "T7ZzDsCoAWcAAV8bEUsAAAAA"]
[Fri May 18 12:04:30 2012] [info] [client 192.168.1.103] (9)Bad file descriptor: core_output_filter: writing data to the network
[Fri May 18 12:04:30 2012] [error] [client 192.168.1.103] ModSecurity: Access denied with connection close (phase 1). String match ", Accept-Encoding, Host, Keep-Alive, User-Agent, Accept-Charset, Connection, Referer, Cache-Control" at TX:header_order. [file "/usr/local/apache/conf/crs/base_rules/modsecurity_crs_15_custom.conf"] [line "1"] [id "11"] [msg "Request Header Ordering Alert: Potential Attack Tool - HULK DoS."] [hostname "192.168.1.103"] [uri "/"] [unique_id "T7ZzDsCoAWcAAV8eEYQAAAAD"]
[Fri May 18 12:04:30 2012] [info] [client 192.168.1.103] (9)Bad file descriptor: core_output_filter: writing data to the network
[Fri May 18 12:04:30 2012] [error] [client 192.168.1.103] ModSecurity: Access denied with connection close (phase 1). String match ", Accept-Encoding, Host, Keep-Alive, User-Agent, Accept-Charset, Connection, Referer, Cache-Control" at TX:header_order. [file "/usr/local/apache/conf/crs/base_rules/modsecurity_crs_15_custom.conf"] [line "1"] [id "11"] [msg "Request Header Ordering Alert: Potential Attack Tool - HULK DoS."] [hostname "192.168.1.103"] [uri "/"] [unique_id "T7ZzDsCoAWcAAV8dEUQAAAAC"]
[Fri May 18 12:04:30 2012] [info] [client 192.168.1.103] (9)Bad file descriptor: core_output_filter: writing data to the network

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.

Round 1 goes to THOR!

8058_156d8019-63d7-42d8-903a-79d798c667c2
Cover to The Mighty Thor #272 (June 1978).

Art by John Buscema.

Latest SpiderLabs Blogs

Fake Dialog Boxes to Make Malware More Convincing

Let’s explore how SpiderLabs created and incorporated user prompts, specifically Windows dialog boxes into its malware loader to make it more convincing to phishing targets during a Red Team...

Read More

The Secret Cipher: Modern Data Loss Prevention Solutions

This is Part 7 in my ongoing project to cover 30 cybersecurity topics in 30 weekly blog posts. The full series can be found here. Far too many organizations place Data Loss Prevention (DLP) and Data...

Read More

CVE-2024-3400: PAN-OS Command Injection Vulnerability in GlobalProtect Gateway

Overview A command injection vulnerability has been discovered in the GlobalProtect feature within Palo Alto Networks PAN-OS software for specific versions that have distinct feature configurations...

Read More