11/24/2021»»Wednesday

Kali Linux Container

Posted: (1 day ago) Full Kali Linux toolset, with many tools available via a simple menu system.; Command line interface to the Kali Linux container.; Kali desktop EXperience; Custom, device specific kernel with wireless injection support. HDMI output of Kali desktop to external display for supported. Thanks to the awesome people maintaining the Linux Image Server for LXC and LXD, our Kali Linux container images are now available for easy installation using LXD or LXC. If you are already running Kali Linux but need to protect your machine from yourself whilst reversing that funky malware you just discovered, or you got issued a work laptop.

Container

Docker is a great way of running an isolated environment for testing. A few people have been asking me is it possible to run Kali Linux in Docker. Kali is a great use case for Docker under the right circumstances. In all honesty, I have not used it often, but in general, I find Docker is well suited for Kali in circumstances where you can use all command-line tools. The first step is to. Recon Tainer ⭐ 2. A docker container that will enumerate subdomains and then filters out injection point parameters and much more. Pentest Toolbox ⭐ 2. Offensive cybersecurity toolbox within a container. Secondary Domain Tasks 20 ⭐ 2. Secondary Domain Tasks for the Summer of 2020. Ctf Kali Linux ⭐ 1. A docker image for CTFs.

Kali Linux Download For Windows

LXD gives you system containers and virtual machines, usable from the same user interface. You would rather use system containers as they are more lightweight than VMs.

Previously we have seen how to use the Kali LXD containers (includes how to use a USB network adapter). There is documentation on using graphics applications (X11) in the Kali LXD containers at the Kali website. In this post we see again how to use graphics applications (X11) in the Kali LXD containers. The aim is to simplify and make the instructions more robust.

Kali Linux Container Architecture

The following assume that you have configured LXD on your system.

Overview of the Kali LXD containers

Let’s have a look at the available Kali images. Currently, there are only container images (no VM images), for the x86_64, armel, arm64, armhf and i386 architectures. They all follow Kali current which is very fresh. There are plain and cloud images. The latter support cloud-init and are more user-friendly. The cloud images create a non-root account for us (username is debian)

From the above list, you would install either kali or kali/cloud. Since these are container images, your LXD will automatically consider your host’s architecture and install the appropriate one. In our case, we are interested in the cloud variant because we want to configure the container while it gets started so that it gets X11 support in an easy way.

LXD profile for Kali containers, X11/graphics support

We are using the following LXD profile to add X11 (graphics) support for applications running in the Kali containers. Download the file and save as x11kali.txt. Then, import the profile into your LXD installation.

Launching a Kali container with X11 support

We have the LXD profile and we are ready to launch a Kali container with X11 support. We select the Kali container image with cloud-init support. We name the container xkali. We apply first the default profile, then the x11kali profile. Then, we run the cloud-init status --wait command in the container so that it shows the progress until the container is fully ready to be used. It should take a bit because it is updating the package list and installs a few X11 support packages.

Here is the container.

Kali Linux Container

Using the Kali LXD container with X11 support

There are several ways to get a shell into a container. We are using a particular one here, and create a LXD alias for it. Use the following commands that create a kalishell alias to give you a shell (non-root) to the Kali container.

Kali Linux Docker Container

We get a shell into the Kali container and run a few commands to test X11 applications, OpenGL applications and finally play audio. Note that you can also run CUDA applications (not shown below).

You can now install all sort of packages. Note that to get the whole lot of Kali packages, you can install the kali-linux-default metapackage. If you are only interested in a specific package, you can install just that one instead.

Conclusion

You managed to get a Kali LXD container work with X11 applications, so that they will appear on the host. As if you are running Kali on the host but you have properly separated the filesystem and the networking from the host. Still, in the situation described in this post, the X server is that of the host. There is no separation here, and you should not use this setup if you are dealing with malicious code samples, or malicious hosts. You would need a separate X server for a proper separation between the container and the host.

In this post we did not mention any networking configuration, and we have been using the default private bridge that LXD provides to us. Depending on your requirements, you would use something else. Such as setting up a USB network adapter to be used exclusively by the Kali container, or using a bridge, macvlan, ipvlan or routed networking.

Hello Hackers!!
Not all Kali Linux tools are easy or possible to install on another operating system, so it is common to use a bootable USB or a VM to use them, but there is another solution such as using the official Kali Linux container for Docker.

To install, I recommend reading the following official docker instructions.

After having docker installed, the next step is to download the official image of Kali Linux.
To do this we execute the following:

We will proceed by creating the container with the following parameters:

–name this parameter names the container.

–net=”host” this parameter is used to make the programs inside the Docker container look like they are running on the host itself, from the perspective of the network. It allows the container greater network access than it can normally get.

–privileged along with –net It allows you to place the network interface in monitor mode and use the host content hardware such as bluetooth.

-e DISPLAY=$DISPLAY -v /tmp/.X11-unix:/tmp/.X11-unix these two parameters allow applications that require a graphic server to be run using the host’s.

-it This parameter allows the container to run in interactive mode in the current tty.

Kali

Kali Linux only provides a base image of Docker so it is necessary to install the rest of the packages using apt.

Kali Linux Container Development

The complete reference as well as the download sizes of the metapackages is available on the Kali Linux site.

For example, to install the Kali-Linux metapackage we must execute the following:

Conclusion

Official Kali Linux Download

Docker is an alternative not to depend on a USB memory, dual boot or a VM to use Kali Linux, in addition this form of installation allows you to use the tools as if they were part of the host where the container is located, similar to how they work applications with Snap.

About the author:

Gerardo Eliasib

Ethical Hacker - FullStack Developer

Cybersecurity Consultant and also creator of the content published in this blog.

Kali Linux Container Management

Kali linux container free

Kali Linux Container List


Most Viewed Posts