As part of pentesting I am trying to access/hack a MySQL server using Kali Linux metasploit auxilary with mysql_enum module. But I unable to access it as access is denied.

Does anyone of you have any idea how to access the DB when unauthorized access is denied?

  • 1
    Have you compromised the database machine itself or are you operating remotely? – DKNUCKLES Mar 1 '17 at 18:58
  • 2
    If you don't have valid database credentials, no root access on the server, or a vulnerability in MySQL, a successful attack is unlikely. – multithr3at3d Mar 1 '17 at 19:17

Try hydra! It's preinstalled on your Kali box.

hydra -l root -P <path to passwords file> <ip address of vulnerable box> mysql -V

This will use all the passwords in the password file supplied to brute force the mysql password for the root account.

A couple good list of password located on every kali box at /usr/share/wordlists. I recommend rock you

| improve this answer | |
  • 2
    Not to be contrarian but in the interest of lively debate, brute force is always my last resort. If I know a box is vulnerable (lab box, vulnhub.com, pen test exam, etc) I will do anything I can before resorting to brute force. It's noisy and slow and if you know there's another vector try those first. – DKNUCKLES Mar 1 '17 at 20:30
  • Yep, agreed. Maybe you could do an answer using nexpose and a metasploit exploit for whatever old version of mysql metasploitable has. – MikeSchem Mar 1 '17 at 20:33
  • I was hoping to hear whether or not he had a shell on the machine already before doing that :) – DKNUCKLES Mar 1 '17 at 20:49
  • Hi @MikeSchem. . i tried as you suggested, but its not working as expected .. and found the script got stucked .. please have a look at the script hydra -l root -P /usr/share/wordlists <target Ip> mysql -V Hydra v8.2 (c) 2016 by van Hauser/THC - Please do not use in military or secret service organizations, or for illegal purposes. Hydra (thc.org/thc-hydra) starting at 2017-03-02 22:33:56 [INFO] Reduced number of tasks to 4 (mysql does not like many parallel connections) not sure what wrong happend? – umesh Mar 2 '17 at 17:56

Not the answer you're looking for? Browse other questions tagged or ask your own question.