Preparing

 

Getting the Raspberry Pi

The popularly of the Raspberry Pi has made it very easy to purchase one or two units.  There are several endorsed re-sellers on the raspberrypi.org website; RS Components, Allied Electronics, Element 14, and EGOMAN Technology.   Some re-sellers are strictly located overseas, whereas a few have distribution centers in the United States, such as Element 14.  The current retail price for a Raspberry Pi at Element 14 is $35 without shipping.

Other popular retailers also carry the Raspberry Pi.  The first unit purchased for this project came from Amazon at $39.97 with free two day shipping.  The second unit was purchased at the local Micro Center for only $39.99.  This shows how much the Raspberry Pi has become a commodity in the computer and hobbyist community.  Just about anyone can drive to their local computer store and purchase a Raspberry Pi to tinker with the same day.

Additional accessories are needed to get the Raspberry Pi up and running; such as HDMI cable, SD card, power adapter, and USB wireless adapter.  The process of selecting and installing these accessories falls out of the scope of this project.  If additional information is needed to understand what is needed to operate the Raspberry Pi please visit the Quick Start Guide at the Raspberry Pi website.  That said, it is recommended to use a fast SD card.  A Class 10 SD card is recommended as for best performance with Kali Linux.  Not all SD cards are created equal; please visit the Raspberry Pi SD card compatibility list before making your purchase.

Getting Kali Linux

Getting the latest version of Kali Linux is extremely straight forward.  At the start of this project http://kali.org/downloads/ held the majority of the images needed for almost any platform.  Upon the release of version 1.0.6 on January 9th 2014 this changed.  The only images located at kali.org are the x86 32bit/64bit and ARM processor architectures.  The ARM image located on kali.org is a generic image meant to be compatible between all ARM devices.  However, this may require some tweaking and tuning to get optimal performance on your device.

The suggested image to use for the Raspberry Pi is located at Offensive Security, the founders of Kali Linux.  Custom images for multiple devices are located at http://www.offensive-security.com/kali-linux-vmware-arm-image-download/.

After clicking on the above link the following steps will take you directly to the correct Raspberry Pi image.

Kali_Download

Step 1: Locate the section labeled “Kali Linux Custom ARM Images”
Step 2: Expand the section for the “Raspberry Pi image”
Step 3: Click “Download Image” or “Download Torrent”

Installing Kali

The next step is to install the downloaded image to a SD card.  There are several processes to accomplish the install; this document is going to focus on using a Windows program called Win32 Disk Imager, and can be downloaded from SourceForge here.  Win32 Disk Imager is a program that writes raw disk images to USB thumb drives or SD/SF memory cards.  Thus, Disk Imager will take the image created by Offensive Security and write it to the SD card.  This will make installing Kali Linux on the Raspberry Pi as easy as copying a file.  If your computer system does not have a SD card reader then a basic USB SD reader can be purchased here.

Once Win32 Disk Imager has been downloaded, uncompress the file into a directory of your choice.  The Disk Imager program does not have to be installed into Windows.  Simply double click on the file labeled ‘Win32DiskImager.exe ‘.  The following program will run and display the options to select an image and a destination.

 

Win32DiskImager

 

Step 1:Select the location of the downloaded Kali Linux image.

Step 2: Select the drive letter of your SD Card (Exercise caution, selecting the wrong device could overwrite data on a drive you did not intend).
Step 3:Click ‘Write’

 

 

 

 

Upon completion, the following ‘Write Successful’ dialog box will appear.

Win32DiskImager_WriteSuccessful

 

 

 

 

Note: Linux users can accomplish the same task by using the ‘dd’ command

root@kali:~# dd if=kali-linux-1.0.6a-rpi.img of=/dev/sdb bs=512k

 

Booting for the First Time

Once the image has been written to the SD card we now have to boot off the image into Kali Linux.

Step 1: Insert the card into the Raspberry Pi.
Step 2: Connect the HDMI Cable, Keyboard, USB WiFi, and then your power connector.
Step 3: Log in using the user name ‘root’, and the default password ‘toor’.

Securing the System

After logging into Kali Linux there are several things that have to be done to secure your system.  The image that was downloaded is the same for everyone.  This includes the default password, SSH keys, and operating system.  However, if you tried to do all of these now you will run out of space no matter the size of your SD card.  The Raspberry Pi image was striped down small enough so it would fit on a 4GB SD card, but doesn’t leave much room to add any programs.  The team at Offensive Security included a program called RPI-Wiggle that will expand a smaller image to fill whatever SD card you have installed (Citation).

 

WiggleSDcard

Permission to use use provided by http://rpi.tnet.com/project/scripts/rpi-wiggle

 

Step 1: Change the default password:

root@kali:~# passwd

Step 2: Expand the image size on the SD Card:

root@kali:~# /scripts/rpi-wiggle.sh/

At the end of the expansion process it will force you to reboot, hit ‘enter’ to reboot.  After the reboot has completed login using ‘root’ and your new password.  Now it is time remove and create a new set of SSH public and private host keys.

Step 3: Remove the default host keys

root@kali:~# rm /etc/ssh/ssh_host_*

Step 4: Create a new set of public and private keys pairs

root@kali:~# dpkg-reconfigure openssh-server
RaspberryPi_SSH_HostKeys

You should see the following result after creating the new keys

Lastly, we want to ensure that all updates are applied to the system.

Step 5: Issue the standard update command for Debian Linux

root@kali:~# apt-get update && apt-get upgrade –y

Installing Additional Programs

In order to complete the proposed attack there are a few programs that have to be added.  The first is called SSLStrip.  This program allows some encrypted sessions to be intercepted and specific information gathered, such as login credentials.  The second program is called dsniff, this is not just one program but a suite of programs used in the penetration testing field to enumerate data.  The third program is called fierce, this is used to brute force DNS to gain IP information.

Step 1: Install SSLStrip

root@kali:~# apt-get install sslstrip -y

Step 2: Install the dsniff package

root@kali:~# apt-get install dsniff -y

Step 3: Install the fierce package

root@kali:~# apt-get install fierce -y

Configure Ad-Hoc WiFi network

The final step in preparing the Raspberry Pi is configuring an Ad-hoc WiFi network.  This will allow a laptop to connect to the Raspberry Pi wirelessly without the use of a router or access point.  This is similar to plugging an Ethernet cable between two systems and transferring files.  The /etc/network/interfaces file needs to be updated with some basic configuration changes.  Edit this file using your favorite editor, my personal favorite is ‘vi’.  However, ‘vi’ tends to be complicated to new users, and thus I recommend ‘nano’.

Step 1: Edit the file by typing ‘nano /etc/network/interfaces’

root@kali:~# nano /etc/network/interfaces

Step 2: Add the following lines to the bottom of the file

## AD-HOC WiFi
auto wlan0
iface wlan0 inet static
     address 192.168.11.15
     netmask 255.255.255.0
     wireless-mode ad-hoc
     wireless-essid KALIPI

Step 3: Save the file by hitting ‘Ctrl-O’

Ctrl_O

Step 4: Exit the program by hitting ‘Ctrl-X’

Ctrl_X

Step 5: Restart the networking service

root@kali:~# service networking restart

You can verify that the settings are correct by typing ‘ifconfig wlan0’, and ‘iwconfig’.

root@kali:~# ifconfig wlan0
root@kali:~# iwconfig

RaspberryPi_AdHoc_Status