Kali linux – keep your tools up-to-date

There is lot of hacking tools available in Kali linux but early or late every package becomes older. What we can do with that? In this post I am going to describe methods of possible tool updates.

Why you should update hacking tools?

Update your hacking toolsA preparation and maintenance of hacking tools is a fundamental step for every successfull security test. A penetration tester wants to find as much as possible in a short time.

To be more specific I have chosen a specific tool – WPScan – which I am going to use in our demonstrations.

 

WPScan

In short WPScan is a vulnerability scanner designed for WordPress. This tool tries to detect WordPress configuration, used plugins ,themes and their vulnerabilities.

How to determine a tool version

Almost every tool has a banner. A banner typically contains a tool name, its version and name of the author. Sometimes to see a complete information we need to specify a certain parameter (version, verbose or something like this). Explore tool’s help, there could be a basic and an advance help so you need to be currious. Let’s move to an example to see what we are talking about.

I executed WPScan without any parameter. The tool printed the banner and a basic command listing. You shouldn’t overlook there is an extra help parameter which will give us an advanced listing of possible parameters. With this knowledge I found a special parameter “version”. The following example shows the WPScan  with “version” parameter.

Great we can now see that there is an extra information “Last DB update” on the bottom of the listing. The tool has an internal database which helps the tool identify WordPress plugins and themes trying to match vulnerable versions.

Ok, now we know what version  we have including the last internal database update. In Kali linux WPScan is present in form of precompiled package for youw hardware platform. We would like to know what is the difference between the tool present in Kali and the current available version on a project site. You can find a project site URL address in the banner or you need to google it. At the time of this writing last possible version for a download is 2.9.1-15. This is not so bad but we will to update the tool using Kali linux package manager.

Update using system packages

We are going to use standard update method using Kali linux package manager. This is the best option to keep operating system integrity and survive in next system updates without collissions.

Let’s first update Kali repository. A repository is a complete set of all existing precompiled tools and other dependencies for your Kali linux. Is it common that your Kali installation does not have all these tools. Kali repository update will ensure that you will get the last current list of all available packages. I issued “apt-get update” command in order to update my Kali repository.

Now I am going to perform upgrade of all packages where a new version is available in Kali repository using “apt-get upgrade” command.

It’s done, unfortunately I do not see wpscan on the list of upgraded packages. I executed wpscan with a version parameter and the output confirms that I am still on the same version 2.8 with an old database update. What’s next? Let’s try to explore help once again in order to see if the tool has an update capabilities.

Manual installation

Než začneme instalovatWhen things do not go well a manual installation is the last chance how to make the tool work.

In most cases a manual installation means a compilation of a source code into an executable binary. Is it quite common that you need to solve many dependencies which will cost your time.

Finally a manual installation will give you latest software functionality, better performance on your hardware and a possibility to enable modules which do not have to be available in a precompiled software package delivered in Kali linux.

Ruby

WPScan is written in Ruby which is an interpreted language. A Ruby program is one ore more scripts which are interpreted and compiled by Ruby everytime a program is excecuted. Ruby itself has an interpreter and compiler but a Ruby program does not need to be compiled. What does it mean? We should be able to download WPScan and just execute it without any problems. We will see.

Downloading a source file

Let’s prepare a target directory where we are going to store our WPScan source files.

Github is quite popular nowadays and you probably know other methods how to get a code, for example unpacking source files from archive using unzip or tar. We are going to use git client with a clone option. We need to know also the URL of a GitHub repository which is visible on wpscan.org website.

Ok, the program is copied and appears in target directory /tools/wpscan. We need to change current directory to this location and use relative addressing of the Ruby script or use an absolute path. We have now two versions of WPScan in our system. The first is the old one, preinstalled by Kali linux and executed everytime when “wpscan” command is issued. The second is the last wpscan download from the GitHub repository stored in /tools/wpscan.

Tool dependecies

I am trying to execute our fresh wpscan. Oh no, we can see from the listing that a different Ruby version, is required. We will not move on until we solve this dependecy.

How to resolve this? Do you have an idea to install new Ruby? Stop before you start to do crazy stuff.

Recommendations before you act

A given Ruby version was chosen for Kali linux and is probably used by other applications or by operating system itself. If you install a new Ruby version it may invoke a conflict now or in future. You shoud be prepared to revert changes you made and make a backup. Sometimes is enough to make notes what did you change and how. It will safe your time, trust me. There is also a good practice to find the minimal invasive option or chose the most tested one (usually documented with known effects).

RVM – Ruby version manager

I was thinking about a multiple Ruby version environment with a version switch possibility. Similar thing exists in Python which is also an interpreted language. I started to search ruby problems in Kali forum and then do the same in Google search. I found a way how to maintain more Ruby version using RVM – Ruby Version Manager. Here is a brief order of installation steps.

  1. Install RVM.
  2. Do the post installation configuration
  3. Chose a current Ruby version for installation and make it active.
  4. Install Gem modules for your current Ruby. You can execute wpscan.rb script multiple times in order to recognize missing gem module. Here is an example of JSON gem module.

Test the new Ruby configuration

Now we can test our new Ruby environment and execute WPScan.

Excellent we are on the last WPScan version (2.9.1) with current database update. This is end of our demonstration.

Summary

We have demonstrated three types of tool updates

  1. An update using operating system package manager.
  2. Partial tool update, internal DB,  using its application functionality.
  3. A manual installation of new version.

What do you do when you prepare your hacking arsenal? Do you have a special trick how to update your tools? Give us a feedback on our Contact page. I hope you have enjoyed the post and see you next time!

 

Blog

Contacts

WABANK – OWASP Top 10 testing

WABANK is deliberately vulnerable web application for security testing according OWASP Top 10 report. Application is free for non commercial usage only.      …

Read more

Kali linux – keep your tools up-to-date

There is lot of hacking tools available in Kali linux but early or late every package becomes older. What we can do with that? In…

Read more

Firewallking (en)

This is an english version of firewalking the rest is in czech

Kontakty

+420 739 639 132

Petr Juhaňák
V Poli 547
517 71 České Meziříčí
Czech Republic

IČO 01259041