Monday, January 19, 2015

msf3 database for Metasploit not working - How to rebuild...

Today I ran into some issues with my msf3 database that I have been using with Metasploit.  I thought I would take a couple minutes and document how I rebuilt it.  This will delete all the current entries and information stored in the msf3 database.

Verify the postgresql server is running or restart the server by executing '/etc/init.d/postgresql restart'

The metasploit framework when it is installed creates the following file that contains the msf3 username and random password that is generated:

cat /opt/metasploit/apps/pro/ui/config/database.yml

Gather from the file the password for the msf3 user or change it to one you would like to use.

Then switch to the postgres user in Kali linux by executing 'su - postgres'.  You should see the prompt at that time 'postgres@machname:~$'

Execute 'psql' at the prompt to get into the postgres database.  To view the databases execute '\list'.

Let's first reset the password of the msf3 account.  Note if you reset the password update it in the database.yml file mentioned above.

Execute: ALTER USER msf3 WITH PASSWORD 'passwordindatabaseymlfile';

Remove the msf3 database by executing the 'drop database msf3;'
Recreate the database by executing: 'create database msf3 owner msf3;'

Then quit from postgres by executing \q.

Type exit to get out of the user postgres.

Then run the metasploit console and it will create the necessary tables for the database then you need to wait 2-5 minutes for it to create the cache that metasploit uses.  This worked to recreate the msf3 database so now it works.

No comments:

Post a Comment

Test Authentication from Linux Console using python3 pexpect

Working with the IT420 lab, you will discover that we need to discover a vulnerable user account.  The following python3 script uses the pex...