Just a quick update to tell about a new Docker based on the phocean/msf image.
It provides an image for the BeEF framework for XSS browser exploitation (http://beefproject.com/).
I pushed the image on Docker Hub, so that deploying it is now as easy as:
docker pull phocean/msf
It is an automatic build based on the Github repository.
It means that the image is built by Docker, not by me. For this task, they simply have a read access to the Dockerfile on Github.
Thus, you may place in this image the same level of trust than the one you have in Docker (I cannot interfere in the process and mess with the image).
I say it because I am myself reluctant of installing third-party images. While I prefer to rebuild everything from Dockerfiles, I am fine with automatically built images if I am in a hurry and for non sensitive data.
Just a quick note to say that I am very happy about this Metasploit docker image being useful to some people, according to the feedback I got.
And Lenny was kind enough to integrate it into his Linux distro, REMnux, well known among reversing people. He also came up with very good suggestions and helped me to bring some improvements, so many thanks to him.
Don’t miss reading his blog article on how to use the image in REMnux : “Run Metasploit Framework as a Docker Container Without Installation Pains”.
Stay tuned ;-)
I made a few improvements (at least, I think they are) to the metasploit-frameword Dockerfile :
It is all up-to-date in its github repo. I will keep adjusting it, if I feel something is missing.
I hope I did it the right way, let me know what you think!
Managing updates and dependencies of a Metasploit installation have definitely been too much trouble and repetitive.
Instead of keeping reproducing boring installation steps every x months, I decided to build a Dockerfile for once.
I chose Debian for its good compromise between features, stability and lightness. I am aware of the Kali Dockerfile, that I could have used as a base. But:
So, this Debian-based Metasploit container comes with:
You can find it on my github.
If you have any trouble or suggestion on how to improve it, please let me know. Enjoy it and go ahead if you want to fork it!
Update 2015/08/04: Works on Fedora 22 too. I recently applied the exact same procedure with success.
A quick update from a previous post for setting Metasploit on Fedora 21, the latest version.
It is mainly a copy and paste, except for a few typo fixes and some changes on the Ruby part. The good news is that Metasploit was recently ported to Ruby 2.x, so we don’t need anymore the rvm stuff anymore, which makes the process much simpler.
yum -y install postgresql-server postgresql-devel
Initiate a new “cluster” and connect to the sql client through the
# as root: postgresql-setup initdb systemctl start postgresql.service su postgres psql
Inside the psql console, create the new Metasploit user and its database:
create user msf; alter user msf with encrypted password 'super password'; create database msfdb; grant all privileges on database msfdb to msf; \q
Then, we will tell to Postgres how to accept local connections. ident necessitates an system account, trust means no password for any local account and md5 stands for a classic password authentication, which we will prefer.
Back to a root terminal, add this line inside
/var/lib/pgsql/data/pg_hba.conf and beware that the order is important:
# IPv4 local connections: host msfdb msf 127.0.0.1/32 md5 host all all 127.0.0.1/32 ident
Then we can restart the service and check with psql that the credentials are working:
systemctl restart postgresql.service psql -U msf msfdb -h localhost \q
Metasploit runs well with Ruby 1.9.3, so we will install this version and switch to it using
rbenv does a nice job at managing several version of ruby next to each other, installing dependancies (as OpenSSL) and setting
# as root: yum install ruby rubygems ruby-devel rubygem-bundler
# as root in e.g. /opt git clone https://github.com/rapid7/metasploit-framework.git msf cd msf yum -y install libpcap-devel sqlite-devel ./msfupdate
The installation of ruby modules will take a while. Then, configure the database by creating
production: adapter: postgresql database: msfdb username: msf password: host: 127.0.0.1 port: 5432 pool: 75 timeout: 5
Launch it and have fun :
# as root ./msfconsole # check connection to the database db_status
You may want to add a
cron entry in
/etc/crontab to get regular updates (though it may break from time to time due to broken dependencies, so you are advised to check it sometimes):
# msfupdate every 2 hours 0 */2 * * * root /opt/msf/msfupdate 2>&1