Multi Manage DbVisualizer Query - Metasploit


This page contains detailed information about how to use the post/multi/manage/dbvis_query metasploit module. For list of all metasploit modules, visit the Metasploit Module Library.

Module Overview


Name: Multi Manage DbVisualizer Query
Module: post/multi/manage/dbvis_query
Source code: modules/post/multi/manage/dbvis_query.rb
Disclosure date: -
Last modification time: 2021-10-06 13:43:31 +0000
Supported architecture(s): -
Supported platform(s): Linux, Windows
Target service / protocol: -
Target network port(s): -
List of CVEs: -

Dbvisulaizer offers a command line functionality to execute SQL pre-configured databases (With GUI). The remote database can be accessed from the command line without the need to authenticate, and this module abuses this functionality to query and will store the results. Please note: backslash quotes and your (stacked or not) queries should end with a semicolon.

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


There are two ways to execute this post module.

From the Meterpreter prompt

The first is by using the "run" command at the Meterpreter prompt. It allows you to run the post module against that specific session:

meterpreter > run post/multi/manage/dbvis_query

From the msf prompt

The second is by using the "use" command at the msf prompt. You will have to figure out which session ID to set manually. To list all session IDs, you can use the "sessions" command.

msf > use post/multi/manage/dbvis_query
msf post(dbvis_query) > show options
    ... show and set options ...
msf post(dbvis_query) > set SESSION session-id
msf post(dbvis_query) > exploit

If you wish to run the post against all sessions from framework, here is how:

1 - Create the following resource script:


framework.sessions.each_pair do |sid, session|
  run_single("use post/multi/manage/dbvis_query")
  run_single("set SESSION #{sid}")
  run_single("run")
end

2 - At the msf prompt, execute the above resource script:

msf > resource path-to-resource-script

Required Options


  • SESSION: The session to run this module on.

Go back to menu.

Msfconsole Usage


Here is how the multi/manage/dbvis_query post exploitation module looks in the msfconsole:

msf6 > use post/multi/manage/dbvis_query

msf6 post(multi/manage/dbvis_query) > show info

       Name: Multi Manage DbVisualizer Query
     Module: post/multi/manage/dbvis_query
   Platform: Linux, Windows
       Arch: 
       Rank: Normal

Provided by:
  David Bloom

Compatible session types:
  Meterpreter

Basic options:
  Name     Current Setting  Required  Description
  ----     ---------------  --------  -----------
  DBALIAS  localhost        yes       Use dbvis_enum module to find out databases and aliases
  QUERY                     yes       The query you want to execute on the remote database
  SESSION                   yes       The session to run this module on.

Description:
  Dbvisulaizer offers a command line functionality to execute SQL 
  pre-configured databases (With GUI). The remote database can be 
  accessed from the command line without the need to authenticate, and 
  this module abuses this functionality to query and will store the 
  results. Please note: backslash quotes and your (stacked or not) 
  queries should end with a semicolon.

References:
  http://youtu.be/0LCLRVHX1vA

Module Options


This is a complete list of options available in the multi/manage/dbvis_query post exploitation module:

msf6 post(multi/manage/dbvis_query) > show options

Module options (post/multi/manage/dbvis_query):

   Name     Current Setting  Required  Description
   ----     ---------------  --------  -----------
   DBALIAS  localhost        yes       Use dbvis_enum module to find out databases and aliases
   QUERY                     yes       The query you want to execute on the remote database
   SESSION                   yes       The session to run this module on.

Advanced Options


Here is a complete list of advanced options supported by the multi/manage/dbvis_query post exploitation module:

msf6 post(multi/manage/dbvis_query) > show advanced

Module advanced options (post/multi/manage/dbvis_query):

   Name       Current Setting  Required  Description
   ----       ---------------  --------  -----------
   VERBOSE    false            no        Enable detailed status messages
   WORKSPACE                   no        Specify the workspace for this module

Post Actions


This is a list of all post exploitation actions which the multi/manage/dbvis_query module can do:

msf6 post(multi/manage/dbvis_query) > show actions

Post actions:

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

Evasion Options


Here is the full list of possible evasion options supported by the multi/manage/dbvis_query post exploitation module in order to evade defenses (e.g. Antivirus, EDR, Firewall, NIDS etc.):

msf6 post(multi/manage/dbvis_query) > show evasion

Module evasion options:

   Name  Current Setting  Required  Description
   ----  ---------------  --------  -----------

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.

File not found: <DBVIS_FILE>


Here is a relevant code snippet related to the "File not found: <DBVIS_FILE>" error message:

67:	      dbvis_file = "#{user_profile}\\.dbvis\\config70\\dbvis.xml"
68:	    end
69:	
70:	    unless file?(dbvis_file)
71:	      # File not found, we next try with the old config path
72:	      print_status("File not found: #{dbvis_file}")
73:	      print_status("This could be an older version of dbvis, trying old path")
74:	
75:	      case session.platform
76:	      when 'linux'
77:	        dbvis_file = "#{user_base}.dbvis/config/dbvis.xml"

File not found: <DBVIS_FILE>


Here is a relevant code snippet related to the "File not found: <DBVIS_FILE>" error message:

78:	      when 'windows'
79:	        dbvis_file = "#{user_profile}\\.dbvis\\config\\dbvis.xml"
80:	      end
81:	
82:	      unless file?(dbvis_file)
83:	        print_error("File not found: #{dbvis_file}")
84:	        return
85:	      end
86:	
87:	      old_version = true
88:	    end

Nothing read from file: <DBVIS_FILE>, file may be empty


Here is a relevant code snippet related to the "Nothing read from file: <DBVIS_FILE>, file may be empty" error message:

91:	    raw_xml = ""
92:	    begin
93:	      raw_xml = read_file(dbvis_file)
94:	    rescue EOFError
95:	      # If there's nothing in the file, we hit EOFError
96:	      print_error("Nothing read from file: #{dbvis_file}, file may be empty")
97:	      return
98:	    end
99:	
100:	    db_found = false
101:	    alias_found = false

Database alias not found in dbvis.xml


Here is a relevant code snippet related to the "Database alias not found in dbvis.xml" error message:

134:	          end
135:	        end
136:	      end
137:	    end
138:	    if db_type.blank?
139:	      print_error("Database alias not found in dbvis.xml")
140:	    end
141:	    return db_type # That is empty if DB is not supported
142:	  end
143:	
144:	  # Find path to dbviscmd.sh|bat

dbviscmd.sh not found


Here is a relevant code snippet related to the "dbviscmd.sh not found" error message:

145:	  def find_dbviscmd
146:	    case session.platform
147:	    when 'linux'
148:	      dbvis = session.shell_command("locate dbviscmd.sh").chomp
149:	      if dbvis.chomp == ""
150:	        print_error("dbviscmd.sh not found")
151:	        return nil
152:	      else
153:	        print_good("Dbviscmd found : #{dbvis}")
154:	      end
155:	    when 'windows'

Dbvis home not found, maybe uninstalled ?


Here is a relevant code snippet related to the "Dbvis home not found, maybe uninstalled ?" error message:

171:	        if (d =~ /DbVisualizer[\S+\s+]+/i)
172:	          dbvis_home_dir = d
173:	        end
174:	      end
175:	      if dbvis_home_dir.blank?
176:	        print_error("Dbvis home not found, maybe uninstalled ?")
177:	        return nil
178:	      end
179:	      dbvis = "#{program_files}\\#{dbvis_home_dir}\\dbviscmd.bat"
180:	      unless file?(dbvis)
181:	        print_error("dbviscmd.bat not found")

dbviscmd.bat not found


Here is a relevant code snippet related to the "dbviscmd.bat not found" error message:

176:	        print_error("Dbvis home not found, maybe uninstalled ?")
177:	        return nil
178:	      end
179:	      dbvis = "#{program_files}\\#{dbvis_home_dir}\\dbviscmd.bat"
180:	      unless file?(dbvis)
181:	        print_error("dbviscmd.bat not found")
182:	        return nil
183:	      end
184:	      print_good("Dbviscmd found : #{dbvis}")
185:	    end
186:	    return dbvis

User doesn't have enough rights to execute dbviscmd, aborting


Here is a relevant code snippet related to the "User doesn't have enough rights to execute dbviscmd, aborting" error message:

209:	          "dbvis_query.txt",
210:	          "dbvis query"
211:	        )
212:	        print_good("Query stored in: #{p.to_s}")
213:	      else
214:	        print_error("User doesn't have enough rights to execute dbviscmd, aborting")
215:	      end
216:	    else
217:	      print_error("#{dbvis} is not a file")
218:	    end
219:	    return error

<DBVIS> is not a file


Here is a relevant code snippet related to the "<DBVIS> is not a file" error message:

211:	        )
212:	        print_good("Query stored in: #{p.to_s}")
213:	      else
214:	        print_error("User doesn't have enough rights to execute dbviscmd, aborting")
215:	      end
216:	    else
217:	      print_error("#{dbvis} is not a file")
218:	    end
219:	    return error
220:	  end
221:	end

Go back to menu.


References


See Also


Check also the following modules related to this module:

Authors


  • David Bloom

Version


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

Go back to menu.