Overview of Kali Linux Distribution
Overview of Kali Linux Distribution
Linux distribution
Debian derivative
Purpose
Features
Policies
Chapter
A Bit of History 2 Relationship with Debian 4 Purpose and Use Cases 5 Main Kali Linux Features 8
Kali Linux Policies 10 Summary 11
Kali Linux1 is an enterprise-ready security auditing Linux distribution based on Debian
GNU/Linux. Kali is aimed at security professionals and IT administrators, enabling them to con-
duct advanced penetration testing, forensic analysis, and security auditing.
What is a Linux Although it is commonly used as a name for the entire operating system, Linux is
Distribution? just the name of the kernel, a piece of software that handles interactions between the
hardware and end-user applications.
The expression Linux distribution, on the other hand, refers to a complete operating
system (OS) built on top of the Linux kernel, usually including an installation pro-
gram and many applications, which are either pre-installed or packaged in an easily
installable way.
Debian GNU/Linux2 is a leading generic Linux distribution, known for its quality and
stability. Kali Linux builds on the work of the Debian project and adds over 400 special-
purpose packages of its own, all related to information security, particularly the field
of penetration testing.
Debian is a free software project providing multiple versions of its operating system
and we often use the term distribution to refer to a specific version of it, for exam-
ple the Debian Stable or Debian Testing distributions. The same also applies to Kali
Linux—with the Kali Rolling distribution, for example.
The Kali Linux project began quietly in 2012, when Offensive Security decided that they wanted to
replace their venerable BackTrack Linux project, which was manually maintained, with something
that could become a genuine Debian derivative3 , complete with all of the required infrastructure
and improved packaging techniques. The decision was made to build Kali on top of the Debian dis-
tribution because it is well known for its quality, stability, and wide selection of available software.
That is why I (Raphaël) got involved in this project, as a Debian consultant.
The first release (version 1.0) happened one year later, in March 2013, and was based on Debian
7 “Wheezy”, Debian’s stable distribution at the time. In that first year of development, we pack-
aged hundreds of pen-testing-related applications and built the infrastructure. Even though the
number of applications is significant, the application list has been meticulously curated, drop-
ping applications that no longer worked or that duplicated features already available in better
programs.
During the two years following version 1.0, Kali released many incremental updates, expanding
the range of available applications and improving hardware support, thanks to newer kernel re-
leases. With some investment in continuous integration, we ensured that all important packages
1
[Link]
2
[Link]
3
[Link]
Xfce is Kali Linux’s A desktop environment is a collection of graphical applications that share a common
Default Desktop graphical toolkit and that are meant to be used together on user workstations. Desk-
Environment top environments are generally not used in servers. They usually provide an applica-
tion launcher, a file manager, a web browser, an email client, an office suite, etc.
Xfce4 is one of the most popular lightweight desktop environments, perfect for our
live ISO images and is included on the main installer ISO images provided by Kali
Linux (together with GNOME5 , KDE6 ). You can select a desktop environment of your
choosing during installation. Otherwise, post-installation you have the additional
options of; i37 , i3-gaps8 , MATE9 , Enlightenment10 , LXDE11 .
In parallel, we increased our efforts to ensure that Kali Linux always has the latest version of all
pen-testing applications. Unfortunately, that goal was a bit at odds with the use of Debian Stable12
as a base for the distribution, because it required us to backport many packages. This is due to the
fact that Debian Stable puts a priority on the stability of the software, often causing a long delay
from the release of an upstream update to when it is integrated into the distribution. Given our
investment in continuous integration, it was quite a natural move to rebase Kali Linux on top of
Debian Testing13 so that we could benefit from the latest version of all Debian packages as soon
as they were available. Debian Testing has a much more aggressive update cycle, which is more
compatible with the philosophy of Kali Linux.
This is, in essence, the concept of Kali Rolling. While the rolling distribution has been available
for quite a while, Kali 2016.1 was the first release to officially embrace the rolling nature of that
distribution: when you install the latest Kali release, your system actually tracks the Kali Rolling
distribution and every single day you get new updates. In the past, Kali releases were snapshots of
the underlying Debian distribution with Kali-specific packages injected into it.
4
[Link]
5
[Link]
6
[Link]
7
[Link]
8
[Link]
9
[Link]
10
[Link]
11
[Link]
12
[Link]
13
[Link]
The Kali Linux distribution is based on Debian Testing14 . Therefore, most of the packages available
in Kali Linux come straight from this Debian repository.
While Kali Linux relies heavily on Debian, it is also entirely independent15 in the sense that we
have our own infrastructure and retain the freedom to make any changes we want.
On the Debian side, the contributors are working every day on updating packages and uploading
them to the Debian Unstable distribution (Unstable is also known as sid16 ). From there, packages
migrate to the Debian Testing distribution once the most troublesome bugs have been taken out.
The migration process also ensures that no dependencies are broken in Debian Testing. The goal
is that Testing is always in a usable (or even releasable!) state.
Debian Testing’s goals align quite well with those of Kali Linux so we picked it as the base. To add
the Kali-specific packages in the distribution, we follow a two-step process.
First, we take Debian Testing and force-inject our own Kali packages (located in our kali-dev-only
repository) to build the kali-dev repository. This repository will break from time to time: for in-
stance, our Kali-specific packages might not be installable until they have been recompiled against
newer libraries. In other situations, packages that we have forked might also have to be updated,
either to become installable again, or to fix the installability of another package that depends on
a newer version of the forked package. In any case, kali-dev is not for end-users.
kali-rolling is the distribution that Kali Linux users are expected to track and is built out of kali-dev
in the same way that Debian Testing is built out of Debian Unstable. Packages migrate only when
all dependencies can be satisfied in the target distribution.
14
[Link]
15
[Link]
16
[Link]
As a design decision, we try to minimize the number of forked packages as much as possible. How-
ever, in order to implement some of Kali’s unique features, some changes must be made. To limit
the impact of these changes, we strive to send them upstream, either by integrating the feature di-
rectly, or by adding the required hooks so that it is straightforward to enable the desired features
without further modifying the upstream packages themselves.
The Kali Package Tracker17 helps us to keep track of our divergence with Debian. At any time, we
can look up which package has been forked and whether it is in sync with Debian, or if an update
is required. All our packages are maintained in Git repositories18 hosting a Debian branch and a
Kali branch side-by-side. Thanks to this, updating a forked package is a simple two-step process:
update the Debian branch and then merge it into the Kali branch.
While the number of forked packages in Kali is relatively low, the number of additional packages
is rather high: in January 2021 there were almost 50019 . Most of these packages are free software
complying with the Debian Free Software Guidelines20 and our ultimate goal would be to maintain
those packages within Debian whenever possible. That is why we strive to comply with the Debian
Policy21 and to follow the good packaging practices used in Debian. Unfortunately, there are also
quite a few exceptions where proper packaging was nearly impossible to create. As a result of
time being scarce, few packages have been pushed to Debian.
While Kali’s focus can be quickly summarized as “penetration testing and security auditing”, there
are many different tasks involved behind those activities. Kali Linux is built as a platform, because
it includes many tools covering very different use cases (though they may certainly be used in
combination during a penetration test).
For example, Kali Linux can be used on various types of computers: obviously on the laptops of
penetration testers, but also on servers of system administrators wishing to monitor their net-
work, on the workstations of forensic analysts, and more unexpectedly, on stealthy embedded de-
vices, typically with ARM CPUs, that can be dropped in the range of a wireless network or plugged
in the computer of target users. Many ARM devices are also perfect attack machines due to their
small form factors and low power requirements. Kali Linux can also be deployed in the cloud to
quickly build a farm of password-cracking machines and on mobile phones and tablets to allow
for truly portable penetration testing.
17
[Link]
18
[Link]
19
[Link]
20
[Link]
21
[Link]
• Information Gathering: Collecting data about the target network and its structure, identify-
ing computers, their operating systems, and the services that they run. Identifying poten-
tially sensitive parts of the information system. Extracting all sorts of listings from running
directory services.
Kali Linux is a Linux distribution that contains its own collection of hundreds of software tools
specifically tailored for their target users—penetration testers and other security professionals.
It also comes with an installation program to completely setup Kali Linux as the main operating
system on any computer.
This is pretty much like all other existing Linux distributions but there are other features that
differentiate Kali Linux, many of which are tailored to the specific needs of penetration testers.
Let’s have a look at some of those features.
Alongside the main installer ISO images, Kali Linux offers a separate live ISO image to download.
This allows you to use Kali Linux as a bootable live system. In other words, you can use Kali Linux
without installing it, just by booting the ISO image (usually after having copied the image onto a
USB key).
The live system contains the tools most commonly used by penetration testers, so even if your day-
to-day system is not Kali Linux, you can simply insert the disk or USB key and reboot to run Kali.
However, keep in mind that the default configuration will not preserve changes between reboots.
If you configure persistence with a USB key (see section 9.4, “Adding Persistence to the Live ISO
with a USB Key” [page 246]), then you can tweak the system to your liking (modify config files,
save reports, upgrade software, and install additional packages, for example), and the changes
will be retained across reboots.
In general, when doing forensic work on a system, you want to avoid any activity that would alter
the data on the analyzed system in any way. Unfortunately, modern desktop environments tend
to interfere with this objective by trying to auto-mount any disk(s) they detect. To avoid this
behavior, Kali Linux has a forensics mode that can be enabled from the boot menu: it will disable
all such features.
The live system is particularly useful for forensics purposes, because it is possible to reboot any
computer into a Kali Linux system without accessing or modifying its hard disks.
Kali Linux always provides a customized recent Linux kernel22 , based on the version in Debian
Unstable. This ensures solid hardware support, especially for a wide range of wireless devices.
The kernel is patched23 for wireless injection support since many wireless security assessment
tools rely on this feature.
Since many hardware devices require up-to-date firmware files (found in /lib/firmware/), Kali
installs them all by default—including the firmware available in Debian’s non-free section. Those
are not installed by default in Debian, because they are closed-source and thus not part of Debian
proper.
Kali Linux is built by penetration testers for penetration testers, but we understand that not ev-
eryone will agree with our design decisions or choice of tools to include by default. With this in
mind, we always ensure that Kali Linux is easy to customize based on your own needs and prefer-
ences. To this end, we publish the live-build24 configuration used to build the official Kali images
so you can customize it to your liking. It is very easy to start from this published configuration
and implement various changes based on your needs thanks to the versatility of live-build.
Live-build includes many features to modify the installed system, install supplementary files, in-
stall additional packages, run arbitrary commands, and change the values pre-seeded to debconf.
Users of a security distribution rightfully want to know that it can be trusted and that it has been
developed in plain sight, allowing anyone to inspect the source code. Kali Linux is developed by a
small team25 of knowledgeable developers working transparently and following the best security
practices: they upload signed source packages, which are then built on dedicated build daemons.
The packages are then checksummed and distributed as part of a signed repository.
The work done on the packages can be fully reviewed through the packaging Git repositories26
(which contain signed tags) that are used to build the Kali source packages. The evolution of each
package can also be followed through the Kali package tracker27 .
22
[Link]
23
[Link]
24
[Link]
25
[Link]
26
[Link]
27
[Link]
Kali Linux provides binary packages for the armel, armhf, and arm64 ARM architectures. Thanks
to the easily installable images provided by Offensive Security, Kali Linux can be deployed on
many interesting devices, from smartphones and tablets to Wi-Fi routers and computers of various
shapes and sizes.
While Kali Linux strives to follow the Debian policy whenever possible, there are some areas where
we made significantly different design choices due to the particular needs of security profession-
als.
In contrast to Debian, Kali Linux disables any installed service that would listen on a public net-
work interface by default, such as HTTP and SSH.
The rationale behind this decision is to minimize exposure during a penetration test when it is
detrimental to announce your presence and risk detection because of unexpected network inter-
actions.
You can still manually enable any services of your choosing by running sudo systemctl enable
service. We will get back to this in chapter 5, “Configuring Kali Linux” [page 108] later in this
book.
Debian aims to be the universal operating system and puts very few limits on what gets packaged,
provided that each package has a maintainer.
By way of contrast, Kali Linux does not package every penetration testing tool available. Instead,
we aim to provide only the best freely-licensed tools covering most tasks that a penetration tester
might want to perform.
Kali developers working as penetration testers drive the selection process and we leverage their
experience and expertise to make enlightened choices. In some cases this is a matter of fact, but
there are other, more difficult choices that simply come down to personal preference.
Here are some of the points considered when a new application gets evaluated:
• The usefulness of the application in a penetration testing context
• The unique functionality of the application’s features
1.6. Summary
In this chapter we have introduced you to Kali Linux, provided a bit of history, run through some
of the primary features, and presented several use cases. We have also discussed some of the
policies we have adopted when developing Kali Linux.
Summary Tips:
• Kali Linux29 is an enterprise-ready security auditing Linux distribution based on Debian
GNU/Linux. Kali is aimed at security professionals and IT administrators, enabling them
to conduct advanced penetration testing, forensic analysis, and security auditing.
• Unlike most mainstream operating systems, Kali Linux is a rolling distribution, which means
that you will receive updates every single day.
• The Kali Linux distribution is based on Debian Testing30 . Therefore, most of the packages
available in Kali Linux come straight from this Debian repository.
• While Kali’s focus can be quickly summarized with “penetration testing and security audit-
ing”, there are several use cases including system administrators wishing to monitor their
networks, forensic analysis, embedded device installations, wireless monitoring, installa-
tion on mobile platforms, and more.
• Kali’s menus make it easy to get to tools for various tasks and activities including: vulnera-
bility analysis, web application analysis, database assessment, password attacks, wireless at-
tacks, reverse engineering, exploitation tools, sniffing and spoofing, post exploitation tools,
forensics, reporting tools, and social engineering tools.
• Kali Linux has many advanced features including: use as a live (non-installed) system, a ro-
bust and safe forensics mode, a custom Linux kernel, ability to completely customize the
system, a trusted and secure base operating system, ARM installation capability, secure de-
fault network policies, and a curated set of applications.
In the next chapter (chapter 2, “Getting Started with Kali Linux” [page 14]), we will jump in and
try out Kali Linux thanks to its live mode.
28
[Link]
29
[Link]
30
[Link]
Download
ISO image
Live boot
Chapter
Downloading a Kali ISO Image 14 Booting a Kali ISO Image in Live Mode 24 Summary 44
Unlike some other operating systems, Kali Linux makes getting started easy, thanks to the fact that
a live disk image is available, meaning that you can boot the downloaded image without following
any prior installation procedure. This means you can use the same image for testing, for use as
a bootable USB or DVD-ROM image in a forensics case, or for installing as a permanent operating
system on physical or virtual hardware.
Because of this simplicity, it is easy to forget that certain precautions must be taken. Kali users
are often the target of those with ill intentions, whether state sponsored groups, elements of orga-
nized crime, or individual hackers. The open-source nature of Kali Linux makes it relatively easy
to build and distribute fake versions, so it is essential that you get into the habit of downloading
from original sources and verifying the integrity and the authenticity of your download. This is
especially relevant to security professionals who often have access to sensitive networks and are
entrusted with client data.
The only official source of Kali Linux ISO images is the Downloads section of the Kali website. Due
to its popularity, numerous sites offer Kali images for download, but they should not be considered
trustworthy and indeed may be infected with malware or otherwise cause irreparable damage to
your system.
è [Link]
The website is available over HTTPS, making it difficult to impersonate. Being able to carry out
a man-in-the-middle attack is not sufficient as the attacker would also need a [Link] cer-
tificate signed by a Transport Layer Security (TLS) certificate authority that is trusted by the vic-
tim’s browser. Because certificate authorities exist precisely to prevent this type of problem, they
deliver certificates only to people whose identities have been verified and who have provided
evidence that they control the corresponding website.
[Link] The links found on the download page point to the [Link] domain, which
redirects to a mirror close to you, improving your transfer speed while reducing the
burden on Kali’s central servers.
A list of available mirrors can be found here:
è [Link]
The official download page shows a short list of ISO images, as shown in Figure 2.1, “List of Images
Offered for Download” [page 15].
Is My CPU 64-bit or Under Microsoft Windows, you can find this information by running the System Infor-
32-bit? mation application (found in the Accessories > System Tools folder). On the System
Summary screen, you can inspect the System Type field: it will contain ”x64-based
PC” for a 64-bit CPU or “x86-based PC” for a 32-bit CPU.
Under OS X/macOS, there is no standard application showing this information but
you can still infer it from the output of the uname -m command run on the terminal.
It will return x86_64 on a system with a 64-bit kernel (which can only run on a 64-bit
CPU), systems with a 32-bit kernel, it will return i386 or something similar (i486,
i586, or i686), and on systems with an arm64 kernel, it will return arm64. Any 32-
bit kernel can run on a 64-bit CPU, but since Apple controls the hardware and the
software, it is unlikely you will find this configuration.
Under Linux, you can inspect the flags field in the /proc/cpuinfo virtual file. If it
contains the lm attribute, then your CPU is a 64-bit; otherwise, it is a 32-bit. The
following command line will tell you what kind of CPU you have:
Now that you know whether you need a 64-bit or 32-bit image, there is only one step left: selecting
the kind of image. The available images differ in how they go about installation. The Installer
and NetInstaller images, specialized for a straightforward install featuring selectable installation
options, do not come with the ability to run the live system. The Live image, however, comes
with the ability to run the live system or start the installation process, although it does lack the
selectable options featured in the installation images. The selectable options include choices in
desktop environments as well as which collection of packages to install. We will be using the live
image throughout this book.
Once you have decided on the image you need, you can download the image by clicking on the
title in the respective row. Alternatively, you can download the image from the BitTorrent peer-
to-peer network by clicking on ”Torrent,” provided that you have a BitTorrent client associated
with the .torrent extension.
While your chosen ISO image is downloading, you should take note of the checksum written in
the sha256sum column. Once you have downloaded your image, use this checksum to verify that
1
[Link]
Security professionals must verify the integrity of their tools to not only protect their data and
networks but also those of their clients. While the Kali download page and links are TLS-protected,
Kali relies on a network of external mirrors to distribute the image means that you should not
blindly trust what you download. The mirror you were directed to may have been compromised,
or you might be the victim of an attack yourself.
To alleviate this, the Kali project always provides checksums of the images it distributes. But to
make such a check effective, you must be sure that the checksum you grabbed is effectively the
checksum published by the Kali Linux developers. You have different ways to ascertain this.
When you retrieve the checksum from the TLS-protected download webpage, its origin is indi-
rectly guaranteed by the X.509 certificate security model: the content you see comes from a web
site that is effectively under the control of the person who requested the TLS certificate.
Now you should generate the checksum of your downloaded image and ensure that it matches
what you recorded from the Kali website:
$ sha256sum [Link]
1a0b2ea83f48861dd3f3babd5a2892a14b30a7234c8c9b5013a6507d1401874f [Link]
If your generated checksum matches the one on the Kali Linux download page, you have the cor-
rect file. If the checksums differ, there is a problem, although this does not always indicate a com-
promise or an attack; downloads occasionally get corrupted as they traverse the Internet. Try
your download again, from another official Kali mirror, if possible (see “[Link]” [page
14] for more information about available mirrors).
If you don’t trust HTTPS for authentication, you are a bit paranoid but rightfully so. There are
many examples of badly managed certificate authorities that issued rogue certificates, which
ended up being misused. You may also be the victim of a “friendly” man-in-the-middle at-
tack implemented on many corporate networks, using a custom, browser-implanted trust store
that presents fake certificates to encrypted websites, allowing corporate auditors to monitor en-
crypted traffic.
This key is part of a global web of trust because it has been signed at least by me (Raphaël Hertzog)
and I am part of the web of trust due to my heavy GnuPG usage as a Debian developer.
The PGP/GPG security model is very unique. Anyone can generate any key with any identity, but
you would only trust that key if it has been signed by another key that you already trust. When you
sign a key, you certify that you met the holder of the key and that you know that the associated
identity is correct. And you define the initial set of keys that you trust, which obviously includes
your own key.
This model has its own limitations so you can opt to download Kali’s public key over HTTPS (or
from a keyserver) and just decide that you trust it because its fingerprint matches what we an-
nounced in multiple places, including just above in this book:
$ wget -q -O - [Link] | gpg --import
[ or ]
$ gpg --keyserver hkp://[Link] --recv-key 44C6513A8E4FB3D30875F758ED444FF07D8D0BF6
gpg: key ED444FF07D8D0BF6: public key ”Kali Linux Repository <devel@[Link]>” imported
gpg: Total number processed: 1
gpg: imported: 1
[...]
$ gpg --fingerprint 44C6513A8E4FB3D30875F758ED444FF07D8D0BF6
[...]
44C6 513A 8E4F B3D3 0875 F758 ED44 4FF0 7D8D 0BF6
[...]
After you have retrieved the key, you can use it to verify the checksums of the distributed im-
ages. Let’s download the file with the checksums (SHA256SUMS) and the associated signature file
([Link]) and verify the signature:
$ wget [Link]
[...]
$ wget [Link]
[...]
$ gpg --verify [Link] SHA256SUMS
gpg: Signature made Tue 18 Aug 2020 [Link] AM EDT
gpg: using RSA key 44C6513A8E4FB3D30875F758ED444FF07D8D0BF6
gpg: Good signature from ”Kali Linux Repository <devel@[Link]>”
If you get that “Good signature” message, you can trust the content of the SHA256SUMS file and use
it to verify the files you downloaded. Otherwise, there is a problem. You should review whether
you downloaded the files from a legitimate Kali Linux mirror.
If you don’t get OK in response, then the file you have downloaded is different from the one re-
leased by the Kali team. It cannot be trusted and should not be used.
Unless you want to run Kali Linux in a virtual machine, the ISO image is of limited use in and of
itself. You must burn it on a DVD-ROM or copy it onto a USB key to be able to boot your machine
into Kali Linux. We have chosen the Kali live image as we wish to boot from a USB allowing us to
either use a live environment or install Kali Linux’s default configuration.
We won’t cover how to burn the ISO image onto a DVD-ROM, as the process varies widely by plat-
form and environment, but in most cases, right clicking on the .iso file will present a contextual
menu item that executes a DVD-ROM burning application. Try it out!
Warning
In this section, you will learn how to overwrite an arbitrary disk with a Kali
Linux ISO image. Always double-check the target disk before launching
the operation as a single mistake would likely cause complete data loss and
possibly damage your setup beyond repair.
Once the copy is completed, safely eject the USB drive from your Microsoft Windows system. You
can now use the USB device to boot Kali Linux.
Creating a bootable Kali Linux USB key in a Linux environment is easy. The GNOME desktop envi-
ronment, which is installed by default in many Linux distributions, comes with a Disks utility (in
the gnome-disk-utility package). That program shows a list of disks, which refreshes dynamically
when you plug or unplug a disk. When you select your USB key in the list of disks, detailed infor-
mation will appear and will help you confirm that you selected the correct disk. Note that you can
find its device name in the title bar as shown in Figure 2.3, “GNOME Disks” [page 21].
Click on the menu button and select Restore Disk Image... in the displayed pop-up menu. Select
the ISO image that you formerly downloaded and click on Start Restoring... as shown in Figure 2.4,
“Restore Disk Image Dialog” [page 21].
Create the Bootable USB Even though the graphical process is fairly straightforward, the operation is just as
Drive from the Command easy for command line users.
Line When you insert your USB key, the Linux kernel will detect it and assign it a name,
which is printed in the kernel logs. You can find its name by inspecting the logs
returned by dmesg.
$ dmesg
[...]
[ 2596.727036] usb 1-2.1: new high-speed USB device number 7 using uhci_hcd
[ 2597.023023] usb 1-2.1: New USB device found, idVendor=0781, idProduct=5575,
å bcdDevice= 1.26
[ 2597.023025] usb 1-2.1: New USB device strings: Mfr=1, Product=2,
å SerialNumber=3
[ 2597.023026] usb 1-2.1: Product: Cruzer Glide
[ 2597.023026] usb 1-2.1: Manufacturer: SanDisk
[ 2597.023026] usb 1-2.1: SerialNumber: 200533495211C0824E58
[ 2597.025989] usb-storage 1-2.1:1.0: USB Mass Storage device detected
[ 2597.026064] scsi host3: usb-storage 1-2.1:1.0
[ 2598.055632] scsi [Link] Direct-Access SanDisk Cruzer Glide 1.26
å PQ: 0 ANSI: 5
[ 2598.058596] sd [Link] Attached scsi generic sg2 type 0
[ 2598.063036] sd [Link] [sdb] 31266816 512-byte logical blocks: (16.0 GB
å /14.9 GiB)
[ 2598.067356] sd [Link] [sdb] Write Protect is off
[ 2598.067361] sd [Link] [sdb] Mode Sense: 43 00 00 00
[ 2598.074276] sd [Link] [sdb] Write cache: disabled, read cache: enabled,
å doesn’t support DPO or FUA
[ 2598.095976] sdb: sdb1
[ 2598.108225] sd [Link] [sdb] Attached SCSI removable disk
Now that you know that the USB key is available as /dev/sdb, you can proceed to
copy the image with the dd command:
# dd if=[Link] of=/dev/sdb
6129688+0 records in
6129688+0 records out
3138400256 bytes (3.1 GB, 2.9 GiB) copied, 678.758 s, 4.6 MB/s
OS X/macOS is based on UNIX, so the process of creating a bootable Kali Linux USB drive is similar
to the Linux procedure. Once you have downloaded and verified your chosen Kali ISO file, use dd
to copy it over to your USB stick.
To identify the device name of the USB key, run diskutil list to list the disks available on
your system. Next, insert your USB key and run the diskutil list command again. The second
output should list an additional disk. You can determine the device name of the USB key by com-
paring the output from both commands. Look for a new line identifying your USB disk and note
the /dev/diskX where X represents the disk ID.
You should make sure that the USB key is not mounted, which can be accomplished with an explicit
unmount command (assuming /dev/disk6 is the device name of the USB key):
$ diskutil unmount /dev/disk6
Now proceed to execute the dd command. This time, add a supplementary parameter — bs for
block size. It defines the size of the block that is read from the input file and then written to the
output file. We will also utilize the raw disk path (signified by the r before disk) which will allow
faster write speeds.
# dd if=[Link] of=/dev/rdisk2 bs=4m
748+1 records in
748+1 records out
3138400256 bytes transferred in 713.156461 secs (4400718 bytes/sec)
That’s it. Your USB key is now ready and you can boot from it or use it to install Kali Linux.
Booting an Alternate Disk To boot from an alternate drive on an OS X/macOS system, bring up the boot menu by
on OS X/macOS pressing and holding the Option key immediately after powering on the device and
selecting the drive you want to use.
For more information, see Apple’s knowledge base2 .
As a prerequisite, you need either a USB key prepared (as detailed in the previous section) or a
DVD-ROM burned with a Kali Linux ISO image.
The BIOS/UEFI is responsible for the early boot process and can be configured through a piece of
software called Setup. In particular, it allows users to choose which boot device is preferred. In
this case, you want to select either the DVD-ROM drive or USB drive, depending on which device
you have created. Depending on your BIOS/UEFI, you may have a one time boot menu option,
allowing to temporarily change the boot order.
Starting Setup usually involves pressing a particular key very soon after the computer is powered
on. This key is often Delete or Escape, and sometimes F2, F8, F10 or F12. Most of the time, the
choice is briefly flashed onscreen when the computer powers on, before the operating system
loads.
Once the BIOS/UEFI has been properly configured to boot from your device, booting Kali Linux
is simply a matter of inserting the DVD-ROM or plugging in the USB drive and powering on the
computer.
Disable Secure Boot While the Kali Linux images can be booted in UEFI mode, they do not support secure
boot. You should disable that feature in your machine’s Setup.
Virtual machines have multiple benefits for Kali Linux users. They are especially useful if you want
to try out Kali Linux but aren’t ready to commit to installing it permanently on your machine or if
you have a powerful system and want to run multiple operating systems simultaneously. This is a
popular choice for many penetration testers and security professionals who need to use the wide
range of tools available in Kali Linux but still want to have full access to their primary operating
system. This also provides them with the ability to archive or securely delete the virtual machine
and any client data it may contain rather than reinstalling their entire operating system.
The snapshot features of virtualization software also make it easy to experiment with potentially
dangerous operations, such as malware analysis, while allowing for an easy way out by restoring
a previous snapshot.
There are many virtualization tools available for all major operating systems, including VirtualBox®,
VMware Workstation®, Xen, KVM, and Hyper-V to name a few. Ultimately, you will use the one that
best suits you but we will cover the two most frequently-used in a desktop context: VirtualBox® and
2
[Link]
Preliminary Remarks
To fully benefit from virtualization, you should have a CPU with the appropriate virtualization
features and they should not be disabled by the BIOS/UEFI. Double check for any “Intel® Virtual-
ization Technology” and/or “Intel® VT-d Feature” options in the machine’s Setup screens.
You should also have a 64-bit host operating system, such as amd64 architecture for Debian-based
Linux distributions, x86_64 architecture for RedHat-based Linux distributions, and 64-bit for Mi-
crosoft Windows.
If you lack any of the prerequisites, either the virtualization tool will not work properly or it will
be restricted to running only 32-bit guest operating systems.
Since virtualization tools hook into the host operating system and hardware at a low level, there
are often incompatibilities between them. Do not expect these tools to run well at the same time.
Also, Microsoft Windows users beware that professional editions or higher come with Hyper-V
installed and enabled, which might interfere with your virtualization tool of choice. To turn it off,
execute “Turn Windows features on or off” from Windows Settings.
VirtualBox
After the initial installation, VirtualBox’s main screen looks something like Figure 2.6, “Virtual-
Box’s Start Screen” [page 26].
Click on New (Figure 2.7, “Name and Operating System” [page 27]) to start a wizard that will guide
you through the multiple steps required to input all the parameters of the new virtual machine.
In the first step, shown in Figure 2.7, “Name and Operating System” [page 27], you must assign a
name to your new virtual machine. We will use “Kali Linux.” You must also indicate what kind
of operating system will be used. Since Kali Linux is based on Debian GNU/Linux, select ”Linux”
for the type and ”Debian (32-bit)” or ”Debian (64-bit)” for the version. Although any other Linux
version will most likely work, this will help distinguish between the various virtual machines that
you might have installed.
In the second step, you must decide how much memory to allocate to the virtual machine. While
the recommended size of 1024 MB is acceptable for a Debian virtual machine acting as a server, it
is definitely not enough to run a Kali desktop system, especially not for a Kali Linux live system,
as the live system uses memory to store changes made to the file system. We recommend increas-
ing the value to 1500 MB (Figure 2.8, “Memory Size” [page 28]) and highly recommend that you
allocate no less than 2048 MB of RAM. For more information, see section 4.1, “Minimal Installation
Requirements” [page 66]
In the third step (shown in Figure 2.9, “Hard disk” [page 29]), you are prompted to choose a physi-
cal or virtual hard disk for your new virtual machine. Although a hard disk is not required to run
Kali Linux as a live system, add one for when we demonstrate the installation procedure later, in
chapter 4, “Installing Kali Linux” [page 66].
The content of the hard disk of the virtual machine is stored on the host machine as a file. Virtu-
alBox is able to store the contents of the hard disk using multiple formats (shown in Figure 2.10,
“Hard Disk File Type” [page 30]): the default (VDI) corresponds to VirtualBox’s native format;
VMDK is the format used by VMware. Keep the default value, because you don’t have any reason
to change it. The ability to use multiple formats is interesting mainly when you want to move a
virtual machine from one virtualization tool to another.
The explanation text in Figure 2.11, “Storage on Physical Hard Disk” [page 31] clearly describes
the advantages and drawbacks of dynamic and fixed disk allocation. In this example, we accept
the default selection (Dynamically allocated), since we are using a laptop with SSD disks. We don’t
want to waste space and won’t need the extra bit of performance as the machine is already quite
fast to begin with.
The default hard disk size of 20 GB shown in Figure 2.12, “File Location and Size” [page 32] is
enough for a standard installation of Kali Linux, so we will not change it. For more information
about Kali’s requirements see section 4.1, “Minimal Installation Requirements” [page 66]. You can
also tweak the name and the location of the disk image. This can be handy when you don’t have
enough space on your hard disk, allowing you to store the disk image on an external drive.
The virtual machine has been created but you can’t really run it yet, because there is no operating
system installed. You also have some settings to tweak. Click on Settings on the VM Manager
screen and let’s review some of the most useful settings.
In the Storage screen (Figure 2.14, “Storage Settings” [page 34]), you should associate the Kali
Linux ISO image with the virtual CD/DVD-ROM reader. First, select the CD-ROM drive in the Stor-
age Tree list and then click on the small CD-ROM icon on the right to display a contextual menu
where you can Choose Virtual Optical Disk File….
In the System screen (Figure 2.15, “System Settings: Motherboard” [page 35]), you will find a Moth-
erboard tab. Make sure that the boot order indicates that the system will first try to boot from
any optical device before trying a hard disk. This is also the tab where you can alter the amount
of memory allocated to the virtual machine, should the need arise.
In the same screen but on the “Processor” tab (Figure 2.16, “System Settings: Processor” [page
36]), you can adjust the number of processors assigned to the virtual machine. Most importantly,
if you use a 32-bit image, enable PAE/NX or the Kali image will not boot since the default kernel
variant used by Kali for i386 (aptly named “686-pae”) is compiled in a way that requires Physical
Address Extension (PAE) support in the CPU.
There are many other parameters that can be configured, like the network setup (defining how
the traffic on the network card is handled), but the above changes are sufficient to be able to boot
a working Kali Linux live system. Finally, click Boot and the virtual machine should boot properly,
as shown in Figure 2.17, “Kali Linux Boot Screen in VirtualBox” [page 37]. If not, carefully review
all settings and try again.
VMware Workstation
VMware Workstation is very similar to VirtualBox in terms of features and user interface, because
they are both designed primarily for desktop usage, but the setup process for a new virtual ma-
chine is a bit different. We will be using VMware Workstation Pro edition.
The initial screen, shown in Figure 2.18, “VMware Start Screen” [page 38], displays a big Create a
New Virtual Machine button that starts a wizard to guide you through the creation of your virtual
machine.
The wizard assumes that you want to install the operating system immediately and asks you to
select the ISO image containing the installation program (Figure 2.20, “Guest Operating System
Installation” [page 39]). Select “Installer disc image file (iso)” and click on Browse to select the
image file.
When the operating system cannot be detected from the selected ISO image, the wizard asks you
which guest OS type you intend to run. You should select “Linux” for the OS and “Debian 10.x
64-bit” for the version, as shown in Figure 2.21, “Select a Guest Operating System” [page 40]. We
select ”Debian 10.x” due to Kali Linux being constantly updated to the newest version of Debian.
Choose ”Kali Linux” as the name of the new virtual machine (Figure 2.22, “Name the Virtual Ma-
chine” [page 41]). As with VirtualBox, you also have the option to store the virtual machine files
in an alternate location.
VMware Workstation is now configured to create the new virtual machine. It displays a summary
of the choices made so that you can double-check everything before creating the machine. Notice
that the wizard opted to allocate 2048 MB of RAM to the virtual machine, which is sufficient for
our needs. If the allocated value is lower, that is not enough so click on Customize Hardware... (Fig-
ure 2.24, “Ready to Create Virtual Machine” [page 42]) and tweak the Memory setting, as shown
in Figure 2.25, “Configure Hardware Window” [page 43].
After a last click on Finish (Figure 2.24, “Ready to Create Virtual Machine” [page 42]), the virtual
machine is now configured and can be started by clicking ”Power on this virtual machine” as
shown in Figure 2.26, “Kali Linux Virtual Machine Ready” [page 44].
2.3. Summary
In this chapter, you learned about the various Kali Linux ISO images, learned how to verify and
download them, and learned how to create bootable USB disks from them on various operating sys-
tems. We also discussed how to boot the USB disks and reviewed how to configure the BIOS/UEFI
and startup settings on various hardware platforms so that the USB disks will boot.
Summary Tips:
• [Link] is the only official download site for Kali ISOs. Do not download them from
any other site, because those downloads could contain malware.
• Always validate the sha256sum of your downloads with the sha256sum command to ensure
the integrity of your ISO download. If it doesn’t match, try the download again or use a
different source.
• You must write the Kali Linux ISO image to a bootable media if you want to boot it on a
physical machine. Use Win32 Disk Imager on Microsoft Windows, the Disks utility on Linux
using GNOME, or the dd command on Mac OS X/macOS/Linux. Be very careful when writing
the image. Selecting the wrong disk could permanently damage data on your machine.
• Configure the BIOS/UEFI Setup screens on a PC or hold the Option key on OS X/macOS to
allow the machine to boot from the USB drive.
• Virtual machine programs like VirtualBox and VMware Workstation Pro are especially useful
if you want to try out Kali Linux but aren’t ready to commit to installing it permanently on