Updating Kali Linux
Kali must be patched regularly to ensure that the base operating system and applications are up-to-date and that security patches have been applied.
The Debian package management system
Debian's package management system relies on discrete bundled applications called packages. Packages can be installed or removed by the user to customize the environment, and support tasks such as penetration testing. They can also extend the functionality of Kali, supporting tasks, such as communications (Skype, instant messaging, and secure e-mails) or documentation (OpenOffice and Microsoft Office running under Wine).
Packages are stored in repositories and are downloaded to the system user to ensure the integrity of the package.
By default, Kali uses only the official Kali repositories. It is possible that an incomplete installation process may not add the repositories to the correct sources.list
file, or that you may wish to extend the available repositories when new applications are added.
Updating the source.list
file can be done from the command line (echo deb http://http.kali.org/kiali kali main contrib non-free >> /etc/apt/sources.list
), or by using a text editor.
The default package repositories that should be present in /etc/apt/sources.list
are listed as follows; if not present, edit the sources.list file to include them:
## Kali deb http://http.kali.org/kali kali main contrib non-free ## Kali-dev deb http://http.kali.org/kali kali-dev main contrib non-free ## Kali Security updates deb http://security.kali.org/kali-security kali/updates maincontrib non-free
Not every Kali tool is presently maintained in the official tool repositories. If you choose to update a tool manually, it is possible that you will overwrite existing packaged files and break dependencies. Therefore, some tools that have not been officially moved to Debian repositories, such as the aircrack-ng
, dnsrecon
, sqlmap
, beef-xss
, and Social Engineering Toolkit (se-toolkit), are maintained in the Bleeding Edge repository. This repository may also be added to sources.list
using the following command line:
## Bleeding Edge repository deb http://repo.kali.org/kali kali kali-bleeding-edge main
Dpkg is Debian's package management system. This command-line application is used to install, remove, and query packages. In general, dpkg
performs actions on individual packages.
The following screenshot shows an excerpt of the returned data when dpkg -l is invoked, providing a list of all applications installed on the Kali distribution; this is particularly useful in identifying applications that may only be accessible directly from the command line.
Advanced Packaging Tools (APT), extend the functionalities of dkpg
by searching repositories and installing or upgrading packages along with all the required dependencies. The APT can also be used to upgrade a complete distribution.
The most common apt
commands are as follows:
apt-get update
: This is used to resynchronize the local package index files with their source as defined in/etc/apt/sources.list
. Theupdate
command should always be used first, before performing anupgrade
ordist-upgrade
.apt-get upgrade
: This is used to install the newest versions of all packages installed on the system using/etc/apt/sources.list
. Packages that are installed on Kali with new versions available are upgraded. The upgrade command will not change or delete packages that are not being upgraded, and it will not install packages that are not already present.apt-get dist-upgrade
: This upgrades all packages currently installed on the system and their dependencies. It also removes obsolete packages from the system.The
apt-get
command can also be used to show a full description of a package and identify its dependencies (apt-cache show <package name>
) or remove a package (apt-get remove <package name>
).
Some applications are not upgraded by the apt-get
command. For example, the local copy of the exploit-db
archive must be manually upgraded. Create a script named update.sh
and add the following commands to it, to automate the update process:
cd /usr/share/exploitdb wget http://www.exploit-db.com/archive.tar.bz2 tar –xvjf archive.tar.bz2 rm archive.tar.bz2