Installing Kali Linux on Raspberry Pi – Partial Book Chapter

This is a partial sample chapter from my latest “Security Testing with Raspberry Pi” book – The full chapter (chapter 4) is over 20 pages long and includes how to use several of the installed Kali Linux tools.

In this chapter we will cover installing Kali Linux on a Raspberry Pi 3b+. We will also see how to run several Kali tools on this platform. As I assume the reader has used Kali Linux before, the goal is to show how to get up and running quickly on a Raspberry Pi, not necessarily to show how to run each individual tool. Most of the tools work just like they would in a full PC install of Kali. Though some of the tools, like Hashcat, apparently don’t have ARM compatible binaries and are not included in the Kali Pi version.

Surf to the Offensive Security Website:

https://www.offensive-security.com/kali-linux-arm-images/

Navigate to the Kali ARM images and then select the Raspberry Pi branch. Download the version of Raspberry Pi for the Pi that you have. I used a Pi3b+ for this chapter, so I downloaded the Kali Linux Raspberry Pi 3 64-bit image. If you have a Pi 4, you must download the Pi 4 version of Kali.

Once the image is downloaded, all you need to do is write it you your SD Ram card.

Etcher works great:

Insert your memory card into the Pi, attach keyboard, mouse, network line, and video cable. Lastly, plug in the power cord. The Pi will boot up and give you a graphical login screen.

  • Login with User: root, Password: toor

At the “Welcome to the first start of the panel” message, click on “Use default config”. You will then be presented with the Kali Desktop. Take a second and familiarize yourself with it. You will notice it is slightly different looking than the regular Kali Desktop, as it is using a different desktop environment. Xfce is used as the default Pi interface as it is a lightweight and fast desktop. But it is the same Kali underneath that you know and love.

Click the “Applications” button to see the tools menu. They are pretty sparse at the moment; we will fix that soon. There are a couple house keeping things we need to do first.

Setting up SSH

The first thing we will want to do is regenerate the SSH security keys.

  • Open a Terminal
  • cd /etc/ssh/
  • mkdir default_keys
  • mv ssh_host_* default_keys/
  • dpkg-reconfigure openssh-server

In a couple seconds we should have new SSH security keys.

In the current version of Kali for the Pi, root login is permitted by default. This is fine for our lab, but this is something you would want to change in “/etc/ssh/sshd_config” if you were going to use this for regular purposes. You will also want to change the root password using the “passwd” command.

The SSH server is already started by default in the Kali Pi install, so all we need is the IP address of Kali. If you are an old time Linux user like me you will probably still use Ifconfig, the old “deprecated” commands are easier to use and look nicer in my opinion, (have to love change, lol) though you are supposed to use the “ip” command now.

  • Enter, “ip a” to see all the network addresses or “ip -4 a” to only see the ip 4 address.

Now you can just SSH or use Putty like we did in the previous chapter to connect remotely to the Kali system.

Metapackages

The Kali-Pi image comes pre-installed with some tools already installed. They were called the “top 10” in an earlier release of Kali and include Metasploit, nmap, Recon-NG, etc.  The rest of the Kali tools can be downloaded via Kali “Metapackages”. Metapackages are security tool packages grouped by function. If you have a 16 GB or greater SDRam card, and a lot of patience, you can install the full Kali Linux install. If you didn’t need all of these tools, you could install just the Wireless tools (kali-linux-wireless) or the Web Application Assessment tools (kali-linux-web), depending on your needs.

All the available Metapackages are listed on the Kali Metapackages website:

Installation is simple, in a terminal just enter, “apt install” along with the metapackage that you want. You basically have 2 options; you can install the full package or individual tool packages. The only drawback to option 2 is that some of the necessary “helper” tools may not be installed and you may need to install them manually.

Option 1

If you want the full Kali install:

  • apt install kali-linux-full

This includes all the tools from a normal Kali Linux install. This will take a very long time to install, so be patient.

Option 2

If you want to install a specific category of tools:

Depending on what you want to do with your Kali install, a good choice is the Wireless tools. The wireless package includes numerous tools including ones for Wi-Fi, Bluetooth & SDR. You can see what packages are included by using the following command:

  • apt-cache show kali-linux-wireless |grep Depends

If these are the tools that you want, then proceed with the install:

  • apt install kali-linux-wireless

Whichever option you pick, the new tools will show up in the Kali menu after the install:

Either install option seems to take hours, be patient, and reboot when it is finished.

The downloaded tools are the SAME tools that you would receive on the regular Kali install. These aren’t watered down versions or anything like that. I have run into a couple tools that didn’t work, or seemed to be missing, but it is a rare occurrence. If it works in the regular Kali install, chances are you can do the same thing, the same way, in the Raspberry Pi version. So, after that long install, let’s play!


If you liked this sample and want to learn a lot more about using the Raspberry Pi for Ethical Hacking, check out my new book, “Security Testing with Raspberry Pi“!

Advertisements

New Book: “Security Testing with Raspberry Pi”

My latest book, “Security Testing with Raspberry Pi” is out. The newest in my “Security Testing” series is all about the versatile Raspberry Pi! †

The credit card sized Raspberry Pi has been a hit with makers for years, it is amazing how many different ways you can use these devices. What many don’t know is that they are also a great tool for use in the security field.

The RPi can run many of the popular Ethical Hacking tools and operating systems. The small size and portability of the Pi makes it a perfect tool for Red Teams and Pentesters.

For example, the RPi makes for great pentesting “Drop Boxes”, small scanning remote access tools left behind on a client’s website during a test. But that is just one use, thanks to P4wnP1, the Pi can also be used as a very powerful and live customizable HiD attack tool. They can even be used as surveillance cameras.

In my book, I cover how to install and use many of the top security tools on the Raspberry Pi.

How to install Kali Linux on a RPi, installing security tools on Raspbian, how to use Warberry Pi – a drop box like system, even how to setup your Pi to act like a security camera, and much, much more!

Like my previous books, the first thing covered is setting up a test lab with vulnerable targets. You will see how to use the RPi to scan test systems for vulnerabilities. I also cover how to use the RPi as an actual test target so you hone your ethical hacking skills without breaking the bank.

This book basically takes off where “Basic Security Testing with Kali Linux” ends and shows you how to use a Pi as a functional security tool. Though not a beginner, “How to use a Pi” book, I use step-by-step tutorials for those new to ethical hacking and the Raspberry Pi.

What about the Raspberry Pi 4? The book now includes notes for those who want to use the brand new Pi 4. As the Pi 4 was just released, many of the operating systems and tools are not 100% functional yet with the Pi 4. But you can install Kali Linux on the Pi 4, and use many of the popular security tools in Raspbian. Functionality will increase as time goes on and as tools are updated to work with the Pi 4.

If you are interested in the Raspberry Pi and want to see how to use it in the security realm, check out, “Security Testing with Raspberry Pi“!

Disguised Raspberry Pi that can Hack your Network

I’ve been playing around with a Raspberry Pi on and off for a while now. The credit card sized, fully functional computer can do many things, including being transformed into a security testing tool!

There is a great article on TunnelsUp.com that demonstrates disguising a Raspberry Pi computer as a power plug and configuring it to connect out to a control server using SSH. Basically making it into something like the popular Pwnie Plug device.

When assembled, the device looks like a any other power adapter that clutters our power hungry offices. Except this one allows someone on the outside of the building to connect into the building, possibly allowing them to perform attacks against your infrastructure.

Though the author mentions just using “A Linux OS” on the PI, using something like this and placing Kali Linux on it would make it a very powerful (and affordable) attack/ security testing platform. Kali is the latest version of the Backtrack penetration testing platform, is loaded with security tools and works exceptionally well on a Raspberry Pi.

Very cool project, this should jog the creative mind of penetration testers and hopefully be a warning to IT departments to keep an eye out for rogue devices such as this.

Wireless Penetration testing with Kali Linux on a Raspberry Pi

In our last article we saw how to install Kali Linux on a Raspberry Pi and connect to it remotely from a Windows system. This time we will look at how to run some basic pentesting tools including Wi-Fi monitoring.

Once your Kali is up and running you can enter “startx” or run commands from the terminal prompt. If you are using Kali remotely, you will mostly be running commands from the command prompt.

For example, here we ran a simple nmap scan:

Running Nmap

Most of the commands that run in regular Kali Linux have no problems running on the Raspberry Pi. But I did run into some snags.

For Example, I tried running Metasploit on mine, but gave up after it seemed to take forever to come up. I also tried running the Social Engineering Toolkit (se-toolkit from command prompt). Even parts of this gave random errors, thought it did look very cool:

Social Engineering Toolkit 1

Wireless Penetration testing with the Kali on PI worked very well, and was a lot of fun.

Just Plug your USB Wi-Fi adapter into the PI.

I used a TP-Link TL-WN722N.

At the command prompt type “ifconfig” and check to see if your Wi-Fi adapter is listed. It should show up as wlan0. If you don’t see it, type “ifconfig wlan0 up“. Then run “ifconfig” again and it should show up:

Wireless wlan0

Next let’s see what networks our wireless card can see.

Type, “iwlist wlan0 scanning“:

Wireless Iwlist

Very cool, it is working. Now let’s run some of the basic Aircrack-NG tools.

First we need to put our wireless adapter into monitoring mode.

Type “airmon-ng wlan0 start“:

Wireless airmon

This creates a new wireless adapter called mon0. Now we can use this interface to capture wireless management and control frames.

Normally you would just run Wireshark and tell it to capture packets from the mon0 interface. Well, I was remotely logged into Kali and couldn’t run Wireshark through Putty as it is a graphical program.

So I just used tcpdump instead.

Simply type tcpdump -i mon0:

TCPDump

This will display all the management and control communication for all wireless networks within the reach of your Wi-Fi adapter.

So with just a few short commands, we were able to perform basic Wi-Fi monitoring with Kali Linux on a Raspberry Pi.

How cool is that?

This is just a basic look at using the aircrack-NG tools on Kali.

For more information check out “Hacking Wi-Fi Networks with Fern, Kali and a Raspberry Pi

Want to learn a lot more about Wireless Penetration testing? Check out the Backtrack 5 Wireless Penetration Testing book by Vivek Ramachandran.

*** Note – as always do not access networks that you do not own or have permission to do so. ***