Jump to content
neo.hapsis

Metasploit MySQL Auxiliary Modules

Recommended Posts

Metasploit provide some MySQL database auxiliary modules who will permit you to scan the running version, do brute force login, execute sql queries and gather some useful informations.

You can find all these auxiliary modules through the Metasploit search command.

Capture-d%E2%80%99%C3%A9cran-2011-08-06-%C3%A0-16.45.31.png

MySQL version scanner (mysql_version)

To invoke this auxiliary module just type the following command :

Capture-d%E2%80%99%C3%A9cran-2011-08-06-%C3%A0-16.47.01.png

Just provide the target address range to the “RHOSTS” variable. “RHOSTS” variable could be an unique IP address, an IP addresses range (ex : 192.168.1.0-192.168.1.255, or 192.168.1.0/24) or a file (file:/tmp/ip_addresses.txt). In order to parallelize version scans, just increase the number of concurrent threads by setting the “THREADS” variable.

Capture-d%E2%80%99%C3%A9cran-2011-08-06-%C3%A0-16.49.08.png

MySQL authentication brute force login (mysql_login)

To invoke this auxiliary module just type the following command :

Capture-d%E2%80%99%C3%A9cran-2011-08-06-%C3%A0-16.50.28.png

This module attempts to authenticate against a MySQL instance using username and password combinations indicated by the “USER_FILE“, “PASS_FILE“, and “USERPASS_FILE” options. Metasploit doesn’t provide default “USER_FILE“, default “PASS_FILE” and default “USERPASS_FILE“. You can use SkullSecurity password lists, or my own list how is updated regularly. In order to parallelize brute force attempts, just increase the number of concurrent threads by setting the “THREADS” variable. Provide the target address range to the “RHOSTS” variable. “RHOSTS” variable could be a an unique IP address, an IP addresses range or a file.

Valid login attempts are displayed in green and non valid in red.

Capture-d%E2%80%99%C3%A9cran-2011-08-06-%C3%A0-17.02.40.png

MySQL generic SQL query execution (mysql_sql)

To invoke this auxiliary module just type the following command :

Capture-d%E2%80%99%C3%A9cran-2011-08-06-%C3%A0-17.04.17.png

This module will allow you to execute a simple SQL query against a MySQL instance. The default SQL query will check the running version of MySQL database. You will require valid login and password previously discovered with the “mysql_login” auxiliary module. Provide the target serveur to the “RHOST” variable. “RHOST” variable should be an unique IP address.

Some useful SQL MySQL queries for pen testing are available on pentestmonkey website.

Capture-d%E2%80%99%C3%A9cran-2011-08-06-%C3%A0-17.06.32.png

MySQL password hashdump (mysql_hashdump)

To invoke this auxiliary module just type the following command :

Capture-d%E2%80%99%C3%A9cran-2011-08-14-%C3%A0-22.30.00.png

Provide the target address range to the “RHOSTS” variable. “RHOSTS” variable could be an unique IP address, an IP addresses range (ex : 192.168.1.0-192.168.1.255, or 192.168.1.0/24) or a file (file:/tmp/ip_addresses.txt). In order to parallelize scans, just increase the number of concurrent threads by setting the “THREADS” variable. You also need to have valid “USERNAME” and “PASSWORD“, maybe obtained through the “mysql_login” auxiliary module.

Capture-d%E2%80%99%C3%A9cran-2011-08-14-%C3%A0-22.13.401.png

MySQL enumeration (mysql_enum)

To invoke this auxiliary module just type the following command :

Capture-d%E2%80%99%C3%A9cran-2011-08-06-%C3%A0-17.07.27.png

This auxiliary module will allow you to gather useful informations from a MySQL server :

The MySQL version

The MySQL OS compilation target

The server architecture

The server hostname

The MySQL datas directory location

If logging of queries and logins is activated or not, and log files location

If the old password hashing algorithm support is activated or not

If local files loading (infile) is activated or not

If logins with old Pre-4.1 passwords is authorized or not

If the “–skip-grant-tables” option is activated or not

If symlinks are authorized to be used for database files

If table merges are allowed

If the “–safe-show-database” option is activated or not

If SSL connexions are enabled or not

All accounts with their password hashes

List of accounts that can log in with SSL if SSL is enabled

List of all accounts with “GRANT“, ”CREATE USER”, “RELOAD“, ”SHUTDOWN“, “SUPER“, “FILE” and “PROCESS” privileges.

List of all accounts with “SELECT“, “INSERT“, “UPDATE“, “DELETE“, “CREATE” and “DROP” privileges.

List of all anonymous accounts.

List of all accounts without passwords

List of all accounts with host wildcard authorized access.

To use this auxiliary module you need to have a access to the database with a privileges user account, maybe gathered with the “mysql_login” auxiliary module. Provide the target serveur to the “RHOST” variable. “RHOST” variable should be an unique IP address.

Capture-d%E2%80%99%C3%A9cran-2011-08-06-%C3%A0-17.55.07.png

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.



×
×
  • Create New...