Backtrack Linux – Security & Penetration Testing

This FP has been deprecated in lieu of the Kali Linux FP since Kali has taken Backtrack Linux’s place. I have left this page up as it has important information (that should not be discarded) and BT5 is still the most powerful implementation to date (if you can still find it => Dark Web).

Introduction

First, to put this into context, in a very corny but appropriate way, recall the Star Wars movies and Anakin Skywalker.  You are about to be presented with some very powerful tools.  Please make sure you use them for ethical hacking/vulnerability assessment/penetration testing or put simply, please do not follow the path to the “Dark Side”.

Now to give you an incredibly useful tool as very few people can perform penetration testing (incredible tool and significant positive value to your resume and organization), let’s install Backtrack/Kali Linux in your choice of Virtual Box or on a DVD/USB Thumb Drive – this is your choice (note you should understand what penetrating testing is so research this as necessary).  Note to take full advantage of BTs functionality you would want to purchase a USB Wifi Adapter that supports packet injection and packet sniffing but this is not necessary to see the rudimentary functionality of BT.  I use the TP-Link TL-WN722NC.  Also, if your Backtrack/Kali instance does not have WiFi connectivity, please review past materials as you should be able to solve this yourself.

As background, Backtrack/Kali Linux is an optimized Ubuntu implementation with Backtrack/Kali installed.  Note that you may want to review the previous Ubuntu installation instructions and any notes you may have taken.  The USB install is a wonderful portable tool however as introduced at the outset, you will need to research and deploy persistence in the USB configuration on your own.  Alternatively I see Backtrack/Kali has now launched an image for the Droid Incredible (ARM).  Our installation will be in VirtualBox or VMWare and again, while you may not fully realize what you are getting at this point but I guarantee it will be eye opening.

Preparation and Download

1. Goto http://www.backtrack-linux.org/ and read the installation documentation in the “How To” secition.  Note this is only for your information as you should try my installation procedure below first.  I have bolded this because every semester someone will try the BT installation instruction first and then write me with installation issues.  There are two ways to implement this, Virtual Box/VMWare would be Hard Drive Install (to match this up with the BT site instructions) or again you may use the Thumbdrive install instructions for a USB drive.  My recommendation is to use VirtualBox/VMWare the first time noting the persistent Thumbdrive/DVD implementation is great tool kit development as you just carry this around in your backpack (and to your interview – 🙂  ).

2. I recommend you choose the register and download download links as belonging to this community is a good thing.  For consistency I will document my VirtualBox ISO install even though they have a VMWare appliance that makes this even easier (BTW – you should also be familiar with a Virtual Appliance so please research this as necessary – Wikpedia will work).

3. Follow the Download link and choose successively BT5R2 (BackTrack 5 Release2), Gnome IDE for consistency, 32 bit architecture for consistency as previously documented, ISO image and direct download. Please download this to your desktop or wherever you are comfortable downloading to but for consistency, I will reference Backtrack/Kali downloaded to the desktop and avoids any CD/DVD problems.

If you are comfortable with the torrent technology, you may of course use the torrent.  When I download via a torrent I use micro-torrent – http://www.utorrent.com/.   Introduction of torrents also permits me to state that you should be familiar with torrents so again, please research this as necessary. BTW – this is a large file and may best be done on campus or while you sleep at night when download speeds are quicker (this of course assumes you sleep at night which is a big assumption for CIS students).

4. Ok, while this downloads we have time to investigate installation and functionality.  Please navigate to the Backtrack/Kali Wiki and have a look around and note the Download and Virtual Box installation instructions <http://www.backtrack-linux.org/wiki/index.php/Main_Page>. This is your first resource should something go wrong (get used to it as this is IT today).  We will roughly follow the Wiki instructions but will adhere to my instructions below.

5. Download verification.  The most common cause of malfunctioning installations and errant behavior is because of incomplete/incorrect downloads.  Please try to verify your download with the instructions located here: http://www.backtrack-linux.org/wiki/index.php/Downloading

This verification is straightforward on the Mac and its Linux/Unix kernel as this is a core component of the OS’s functionality.  For Windows machines you will have to download the file from the ‘Downloading” page/link referenced directly above.  Note you will have to navigate to the correct directory to locate the downloaded ISO and verify its MD5 hash. As an example, for me in Mac OSX, I issue the following command in the Mac OSX terminal after downloading the iso to my desktop and navigating (cd) to the desktop directory.

$md5 BT5R2-GNOME-32.iso  

This returns the MD5 checksum  4ad5f359bad43bb934d59fcf6632ae1b which matches the BT5r2-GNOME-32 GNOME 32bit md5sum listed on the BT site.

As information (since I never miss a chance to add an important skill … 🙂 …), MD5 is a Message Digest Algorithm used in both security (Linux Password File Encryption) and to verify data integrity.  This is one of the tools used in computer forensics as investigators will take an MD5 hash of the hard drive to serve as a fingerprint that verifies the integrity serving as a basis for the chain of custody.  So if you are ever a manager and you suspect foul play, the first step of proper law enforcement is to get an MD5 hash of the harddrive/USB drive/etc.  Do not just begin poking around as you will corrupt the chain of evidence and invalidate any case you have.

MD5 & SHA Hash FunctionsCryptographic hashes allow you to confirm the integrity of the files you download.  The md5sum and sha1 hash algorithms take a file as input and produce as output a message digest of the input, which is a highly unique fingerprint.  This enables you to verify that your downloaded files are unaltered from the original.  If your calculated hash matches the message digest we provide, you are assured that the file was downloaded intact.  The SHA hash functions are a set of cryptographic hash functions designed by the National Security Agency (NSA) and published by the NIST as a U.S. Federal Information Processing Standard.   SHA stands for Secure Hash Algorithm. sha-1 and MD5 utilities are available for Windows and Linux and Mac.   Most Linux installations provide a sha1sum command for sha-1 hashes and a md5sum command for calculating MD5 message digests.

Windows:Windows does not provide a built-in utility for generating MD5 sum values. The File Checksum Integrity Verifier (FCIV) can be used on Windows based products to verify both MD5 and sha-1 values. Please see http://support.microsoft.com/kb/841290 for details on FCIV.

You can also obtain a third-party utility to do this. Follow the instructions provided with the utility to generate the MD5 sum value.   An available third-party utility is MD5: Command Line Message Digest Utility.  Mac OS X: How to Verify a SHA-1 Digest http://support.apple.com/kb/HT1652.  In Finder, browse to /Applications/Utilities.Double-click on the Terminal icon. A Terminal window will appear.In the Terminal window, type: “openssl md5” (md5 followed by a space).Drag the downloaded file from the Finder into the Terminal window. Click in the Terminal window, press the Return key, and compare the checksum displayed to the screen to the one on the download page. Instructions on checking an sha-1 checksum on a Mac:

In Finder, browse to /Applications/Utilities.Double-click on the Terminal icon. A Terminal window will appear.  In the Terminal window, type: “openssl sha1 ” (sha1 followed by a space).  Drag the downloaded file from the Finder into the Terminal window.Click in the Terminal window, press the Return key, and compare the checksum displayed to the screen to the one on retrieved from the download page or site.

6. Now I just went ahead and installed as we did for Ubuntu (I recommend you go back and reread the original VB Ubuntu installation).  Note – Backtrack/Kali Installation Instructions are different from mine and are  are located here – for a VB installation please, please try my original VB/Ubuntu installation instructions first as people invariably have trouble when they follow BTs instructions.

Virtual Box http://www.backtrack-linux.org/wiki/index.php/VirtualBox_Install

Thumb Drive http://www.backtrack-linux.org/wiki/index.php/USB_Installs.

Installation

My Installation is as follows but this should be review – Please follow these instructions not the BT instructions.

VB Setup

1. Open VB, choose new,

2. Name your new VB Guest OS Backtrack or Kali, choose Linux and choose Ubuntu (not 64 bit)

3. Give your guest RAM (512 MB is fine but I have 8 GB of memory on my host so I give it I recommend 1 GB or 1024 MB)

4. Create New Hard Disk

5. Choose VDI – Virtual Disk Image

6. Choose Dynamically Allocated and provide this BT VB VM with at least 12.55 GB of storage.

7. Verify the VDI name and allow VB to create the VM

BT VB Installation

1. Choose your new VB Backtrack VM and choose ‘start’ taking you to the ‘run first wizard’

2. Navigate to the BT5xxx-32.iso on the desktop (again burning to CD increases complexity and the chance something will go wrong as CDs fail and require verification of MD5 hash after burning)

3. Click through the normal VB setup as before (hopefully you reread the original Ubuntu installation instructions again)

4. Hit enter at the boot prompt (note VB-BT may cite that it is capturing the mouse which is fine)

5. Chose “Default Text” from the menu

6. Entered startx at the root@root prompt (e.g. root@root>startx) to start the graphical user interface.  Note this is also standard on a server implementation.

7. Double click “Install Backtrack” icon in the upper left quadrant of the window noting installation will hang for some time – don’t panic – :).  Alternatively you may right click the “Install Backtrack” icon and choose “Open”.   Also note this is an earlier version of Ubuntu so much of the dashboard functionality can be found in the Applications menu however the “Shutdown” command is located in system.

8. Move through the BT setup accepting the defaults and choosing “Forward”.  Note you will choose “Erase and use Entire HD” but remember this is the Virtual HD and not your system.  Again, the installation may hang at 99% for some time so don’t panic.

9. Click restart to reboot your system immediately.  To login you will use the username root at the login prompt followed by the password toor.  Following this you will again type startx to get to the graphical interface as this standard for many Linux/Unix implementations noting that servers typically do not have a GUI installed.  (Think about why…. resources used by the GUI…. make it more difficult for script kiddie hackers or lurkers to hurt the system…. etc.)

10.  As with your initial Ubuntu installation, you may have to unmount/get rid of the ISO to avoid continually rebooting and you can get rid of the “Install Backtrack” icon and application by right clicking the icon and choosing “Move to Trash”.

Now normally we would be very cautious about doing things as root however this is a VM and as such cannot damage our system and the VM/File can be blown away and recreated as necessary.  Down the road you may create some users so that we do not have to operate as root.

Optional VBox Guest Addon/Additions

If you choose, you can install (possibly requiring download) and configure the VBox Guest Additions as before (see previous Guest Addition Instructions) to get full screen viewing and other functionality as previously introduced.  Ok, so now reboot (again Login:root password: toor if you are prompted for this) and have a look around and be both amazed and even frightened that tools like this exist for free – :).

If the menu “Install Guest Additions”  installation fails (i.e. it does not mount the Guest Additions .iso then use wget per the Backtrack site’s Virtual Box instructions (you should also research wget to understand its functionality).  Again, note the Guest Addition Installation is optional so this is not required but should you wish to proceed, I suggest you open Firefox and navigate to the Backtrack Virtual Box instructions as this will allow you to copy and paste between Firefox and the terminal where you will be issuing these commands.  Recall that terminal is found in Applications – > Accessories.  Note that the menu copy and paste commands can be misleading as you often do not see the pasted material until you move your mouse.

wget command should look something like this (but you should choose the most up to date stable VBoxGuestAdditions_xxx.iso release).

wget http://download.virtualbox.org/virtualbox/4.0.8/VBoxGuestAdditions_4.0.8.iso

Ok, now the next tutorial commands did not work on my system so I used the following adjusted commands.  I recommend you try the Websites commands first as many people had success with them.  If they don’t work please try the following adjusted commands that worked on my Mac Virtual Box installation.

$ mount VBoxGuestAdditions_4.0.8.iso -o loop /mnt  cd /mnt

$ chmod a+x VBoxLinuxAdditions.run

$ ./VBoxLinuxAdditions.run

Assignment

First, take a screen shot of your BT installation that includes an open terminal, since BT does not contain LibreOffice, name the .png file LastnameFirstnameBT and submit this in the lecture’s assignment.

Second, in the Final Project’s DB, please relate your installation experiences that include the MD5 verification and your initial survey of Backtrack.  There is a large amount of functionality here that includes password crackers, forensics tools, etc (Remember the lines in the Matrix,  “What do you need? Guns… lots of guns”, well you now have “Tools… lots of tools”).  I realize the advanced features are at this point be beyond our comprehension however you will return to this tool from this point forward.  To understand this, consider when you purchased your first computer or first new phone with a new OS, did you understand its functionality and application out of the box or did the fact that you had the tool accelerate your learning?

For those of you interested in Web Design, Wireshark shows that everything that takes place over Wifi is readable if not encrypted. This also applies for all you software developers as nearly every application now has a Web interface. For those of you who are Business students, do you want your sales force using unencrypted transmissions at Panera?

Now what you should do is find 3 items in the menu system, Google them to learn how to use them on an introductory level and post your findings and what you learned.  Minimally, check out Applications -> Backtrack -> Priviledge Escalation -> Sniffers -> Network Sniffers -> Wireshark and see the wireless network traffic at your site (minimally you will see your host machine outside your VM communicating periodically as this is a separate host).  Packet Capture instructions are here: http://wiki.wireshark.org/CaptureSetup.  Please comment on your experiences in the Final Project DB as well.

Lastly, please do not forget to shutdown BT using the shutdown command found in the system menu.

Troubleshooting and other methods and resources

*** Breaking news ***

Backtrack has just posted VirtualBox Installation Instructions here however I have not verified them and I recommend you use my instructions above: http://www.backtrack-linux.org/wiki/index.php/VirtualBox_Install

Also, here are instructions to add Backtrack Tools to an existing Ubuntu implementation.
http://micksmix.wordpress.com/2009/10/28/install-backtrack-4-tools-in-ubuntu/

Lastly, should you wish to learn more here is a Backtrack Linux text: http://www.amazon.com/ BackTrack-Wireless- Penetration-Testing-Beginners/ dp/1849515581

Thank you and you have now taken a giant step forward!