Category Archives: Metasploit

Metasploit Ruby issues when starting from Social Engineering Toolkit

I ran into some issues with SET 6.2 and Metasploit 4.11.1 on Kali Linux 1.1.0.
SET was cloned directly from github but I had the same issue with the older version that is bundled with Kali.

Basically when selecting “Java Applet Attack Method” exploit and choosing meterpreter reverse_tcp it crashed and burned. I got the error both with Apache and the built in web server.

This is where it crashed:

[--] Tested on Windows, Linux, and OSX [--]
[*] Moving payload into cloned website.
[*] The site has been moved. SET Web Server is now listening..
[-] Launching MSF Listener...
[-] This may take a few to load MSF...
Could not find rake-10.4.2 in any of the sources
Run bundle install to install missing gems.

As this was a Ruby related issue I though that I would have a look what is up with Metasploit. I googled around and got some ideas from Rapid7 forums but none really helped, but it pointed me in the right direction.

I first tried this, but it did not help. Error messages below.

1. cd to /usr/share/metasploit-framework/
2. bundle install

root@kalle:/usr/share/metasploit-framework# bundle install
Fetching gem metadata from https://rubygems.org/.........
Installing rake (10.4.2)
Installing i18n (0.6.11)
Installing multi_json (1.0.4)
Installing activesupport (3.2.21)
Installing builder (3.0.4)
Installing activemodel (3.2.21)
Installing erubis (2.7.0)
Installing journey (1.0.4)
Installing rack (1.4.5)
Installing rack-cache (1.2)
Installing rack-test (0.6.2)
Installing hike (1.2.3)
Installing tilt (1.4.1)
Installing sprockets (2.2.3)
Installing actionpack (3.2.21)
Installing arel (3.0.3)
Installing tzinfo (0.3.42)
Installing activerecord (3.2.21)
Installing arel-helpers (2.1.0)
Installing bcrypt (3.1.10) with native extensions
Installing rkelly-remix (0.0.6)
Installing jsobfu (0.2.1)
Installing json (1.8.1) with native extensions
Installing rack-ssl (1.3.4)
Installing rdoc (3.12.2)
Installing thor (0.19.1)
Installing railties (3.2.21)
Installing metasploit-concern (0.3.0)
Installing metasploit-model (0.29.0)
Installing pg (0.18.1) with native extensions
Gem::Installer::ExtensionBuildError: ERROR: Failed to build gem native extension.
/usr/bin/ruby1.9.1 extconf.rb
checking for pg_config... yes
Using config values from /usr/bin/pg_config
You need to install postgresql-server-dev-X.Y for building a server-side extension or libpq-dev for building a client-side application.
You need to install postgresql-server-dev-X.Y for building a server-side extension or libpq-dev for building a client-side application.
checking for libpq-fe.h... no
Can't find the 'libpq-fe.h header
*** extconf.rb failed ***
Could not create Makefile due to some reason, probably lack of
necessary libraries and/or headers.  Check the mkmf.log file for more
details.  You may need configuration options.
Provided configuration options:
--with-opt-dir
--without-opt-dir
--with-opt-include
--without-opt-include=${opt-dir}/include
--with-opt-lib
--without-opt-lib=${opt-dir}/lib
--with-make-prog
--without-make-prog
--srcdir=.
--curdir
--ruby=/usr/bin/ruby1.9.1
--with-pg
--without-pg
--enable-windows-cross
--disable-windows-cross
--with-pg-config
--without-pg-config
--with-pg_config
--without-pg_config
--with-pg-dir
--without-pg-dir
--with-pg-include
--without-pg-include=${pg-dir}/include
--with-pg-lib
--without-pg-lib=${pg-dir}/lib

Gem files will remain installed in /usr/share/metasploit-framework/vendor/bundle/ruby/1.9.1/gems/pg-0.18.1 for inspection.
Results logged to /usr/share/metasploit-framework/vendor/bundle/ruby/1.9.1/gems/pg-0.18.1/ext/gem_make.out
An error occured while installing pg (0.18.1), and Bundler cannot continue.
Make sure that gem install pg -v '0.18.1' succeeds before bundling.

Long story short. I had to do this. Make sure you are in the “/usr/share/metasploit-framework” dir.

1. cd /usr/share/metasploit-framework
2. apt-get install postgresql-server-dev-all
3. apt-get install libsqlite3-dev
4. gem install pg -v 0.18.1
5. bundle install

And now it works!