MYSQL Password Hashdump - Metasploit


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

Module Overview


Name: MYSQL Password Hashdump
Module: auxiliary/scanner/mysql/mysql_hashdump
Source code: modules/auxiliary/scanner/mysql/mysql_hashdump.rb
Disclosure date: -
Last modification time: 2021-09-07 10:01:17 +0000
Supported architecture(s): -
Supported platform(s): -
Target service / protocol: -
Target network port(s): 3306
List of CVEs: -

This module extracts the usernames and encrypted password hashes from a MySQL server and stores them for later cracking.

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


This module is a scanner module, and is capable of testing against multiple hosts.

msf > use auxiliary/scanner/mysql/mysql_hashdump
msf auxiliary(mysql_hashdump) > show options
    ... show and set options ...
msf auxiliary(mysql_hashdump) > set RHOSTS ip-range
msf auxiliary(mysql_hashdump) > exploit

Other examples of setting the RHOSTS option:

Example 1:

msf auxiliary(mysql_hashdump) > set RHOSTS 192.168.1.3-192.168.1.200 

Example 2:

msf auxiliary(mysql_hashdump) > set RHOSTS 192.168.1.1/24

Example 3:

msf auxiliary(mysql_hashdump) > set RHOSTS file:/tmp/ip_list.txt

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 scanner/mysql/mysql_hashdump auxiliary module looks in the msfconsole:

msf6 > use auxiliary/scanner/mysql/mysql_hashdump

msf6 auxiliary(scanner/mysql/mysql_hashdump) > show info

       Name: MYSQL Password Hashdump
     Module: auxiliary/scanner/mysql/mysql_hashdump
    License: Metasploit Framework License (BSD)
       Rank: Normal

Provided by:
  theLightCosine <[email protected]>

Check supported:
  No

Basic options:
  Name      Current Setting  Required  Description
  ----      ---------------  --------  -----------
  PASSWORD                   no        The password for the specified username
  RHOSTS                     yes       The target host(s), range CIDR identifier, or hosts file with syntax 'file:<path>'
  RPORT     3306             yes       The target port (TCP)
  THREADS   1                yes       The number of concurrent threads (max one per host)
  USERNAME                   no        The username to authenticate as

Description:
  This module extracts the usernames and encrypted password hashes 
  from a MySQL server and stores them for later cracking.

Module Options


This is a complete list of options available in the scanner/mysql/mysql_hashdump auxiliary module:

msf6 auxiliary(scanner/mysql/mysql_hashdump) > show options

Module options (auxiliary/scanner/mysql/mysql_hashdump):

   Name      Current Setting  Required  Description
   ----      ---------------  --------  -----------
   PASSWORD                   no        The password for the specified username
   RHOSTS                     yes       The target host(s), range CIDR identifier, or hosts file with syntax 'file:<path>'
   RPORT     3306             yes       The target port (TCP)
   THREADS   1                yes       The number of concurrent threads (max one per host)
   USERNAME                   no        The username to authenticate as

Advanced Options


Here is a complete list of advanced options supported by the scanner/mysql/mysql_hashdump auxiliary module:

msf6 auxiliary(scanner/mysql/mysql_hashdump) > show advanced

Module advanced options (auxiliary/scanner/mysql/mysql_hashdump):

   Name                 Current Setting  Required  Description
   ----                 ---------------  --------  -----------
   CHOST                                 no        The local client address
   CPORT                                 no        The local client port
   ConnectTimeout       10               yes       Maximum number of seconds to establish a TCP connection
   Proxies                               no        A proxy chain of format type:host:port[,type:host:port][...]
   SSL                  false            no        Negotiate SSL/TLS for outgoing connections
   SSLCipher                             no        String for SSL cipher - "DHE-RSA-AES256-SHA" or "ADH"
   SSLVerifyMode        PEER             no        SSL verification method (Accepted: CLIENT_ONCE, FAIL_IF_NO_PEER_CERT, NONE, PEER)
   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)
   ShowProgress         true             yes       Display progress messages during a scan
   ShowProgressPercent  10               yes       The interval in percent that progress should be shown
   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 scanner/mysql/mysql_hashdump module can do:

msf6 auxiliary(scanner/mysql/mysql_hashdump) > show actions

Auxiliary actions:

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

Evasion Options


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

msf6 auxiliary(scanner/mysql/mysql_hashdump) > show evasion

Module evasion options:

   Name                Current Setting  Required  Description
   ----                ---------------  --------  -----------
   TCP::max_send_size  0                no        Maxiumum tcp segment size.  (0 = disable)
   TCP::send_delay     0                no        Delays inserted before every send.  (0 = disable)

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.

There was an error reading the version


Here is a relevant code snippet related to the "There was an error reading the version" error message:

56:	
57:	    # Grab the username and password hashes and store them as loot
58:	    version = mysql_get_variable("@@version")
59:	
60:	    if version.nil?
61:	      print_error("There was an error reading the version")
62:	      return
63:	    end
64:	
65:	    # Starting from MySQL 5.7, the 'password' column was changed to 'authentication_string'.
66:	    if version[0..2].to_f > 5.6

There was an error reading the MySQL User Table


Here is a relevant code snippet related to the "There was an error reading the MySQL User Table" error message:

68:	    else
69:	      res = mysql_query("SELECT user,password from mysql.user")
70:	    end
71:	
72:	    if res.nil?
73:	      print_error("There was an error reading the MySQL User Table")
74:	      return
75:	    end
76:	
77:	    service_data = {
78:	      address: ::Rex::Socket.getaddress(rhost, true),

Go back to menu.


Go back to menu.

See Also


Check also the following modules related to this module:

Authors


  • theLightCosine

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.