Metasploit with postgresql

Metasploitversion 3.7.0 is available for download, this new release comes with a significant number of improvements. One of the most important updates is the session management, now metasploit is capable to handle hundreds of  sessions, this come handy when running large-scale social engineering engagements. Along with this update, other long-awaited features has been added, pass-the-hash and stolen password attacks against Windows 2008 and NTLM authentication support to the Microsoft SQL Server driver are the most important. As bonus, this release is shipped with 35 new remote exploits, check it out.

Here you can see how to install Metasploit and Armitage from scratch with the postgresql support on Ubuntu 11.04.

Metasploit installation

wget  http://updates.metasploit.com/data/releases/framework-3.7.0-linux-mini.run
install the metasploit framework
chmod +x framework-3.7.0-linux-mini.run
./framework-3.7.0-linux-mini.run --help
./framework-3.7.0-linux-mini.run
#run the metasploit update
msfupdate

Postgresql and dependencies installation

apt-get install postgresql pgadmin3 libpq-dev sun-java6-plugin ruby rubygems libreadline-dev libssl-dev libpq5 ruby-dev nmap
gem install pg

#Metasploit database and a user creation

su postgres
createuser metasploit -P
Enter password for new role:
Enter it again:
Shall the new role be a superuser? (y/n) n
Shall the new role be allowed to create databases? (y/n) n
Shall the new role be allowed to create more new roles? (y/n) n
createdb --owner=metasploit metasploit
#Run the msfconsole  and run the following commands
#msfconsole
msf> db_driver postgresql
msf> db_connect metasploit:metasploit@127.0.0.1:5432/metasploit

The msfrpcd must be started,

msfrpcd -f -U metasploit -P metasploit -t Basic

And now is time to start armitage:

/opt/framework-3.7.0/msf3/armitage

Please check the correct postgresql credential, and press connect.

User: metasploit
Password: metasploit
DB connect string: metasploit:metasploit@127.0.0.1/metasploit

In a in a couple of seconds Armitage  should appear.

On Armitage, go to Hosts > Nmap scan > Intense Scan > Input a subnet of interest and happy hunting !

Note: In case you get the error: The address is already in use (0.0.0.0:55553) , please check the process that is keeping the port 55553 busy. You can do it easily running the command lsof -i :55553 .

COMMAND    PID USER   FD   TYPE DEVICE SIZE/OFF NODE NAME
.ruby.bin 5538 root    4u  IPv4 154865      0t0  TCP *:55553 (LISTEN)

At this point you need to kill the process by his own PID, in this case kill -9 5538, and restart again the msfrpcd with “msfrpcd -f -U metasploit -P metasploit -t Basic“

本文转自国外黑客网由网络安全攻防研究室(www.91ri.org) 信息安全小组收集整理。