Pidsec

Torify Kali VM Network Traffic via Virtualbox & Virt-Manager

torifykali

To mask your Kali linux virtual machine (vm) with a good degree of anonymity, one can actually reroute your Kali vm from a default connection to your NAT and into a whonix gateway. This is a 3 step tiered process in order to accomplish this.

Step 1: Download and install Whonix

Whonix is a Linux distribution built for the purposes of anonymity, and there are many reasonable reasons why anyone would need anonymity.

You will to head over to the https://www.whonix.org/ website and download the ova file in their download section and you will download it relative to your operating system of choice. We will continue on this basic tutorial with utilizing Oracle's Virtual-box virtual machine software for this. However, while it is free and open source, the Virtual-box platform is not as secure as for example Linux's KVM virt manager virtualization tool which is more powerful and more secure. However one can achieve a good relative level of security and anonymity utilizing Oracle's Virtual-box. It is also a bit more easier to navigate than KVM.

The great thing about downloading Whonix is that the ova file is already pre-configured by the Whonix team and there is literally not a single thing to perform on your end as a user. Except for one step which is merely to check and verify if it is configured correctly in Virtual-box which we will get into now

Step 2: Verifying the network

Obviously, you will need to have already installed Virtual-box in your operating system in order to even begin running the Whonix ova file inside Virtual-box, and your various linux distros will usually have it in their standard repo or download it from https://www.virtualbox.org/

Next, you will open the ova file and your system should already open it in Virtual-box. Once opened, you want to check the system settings and navigate to the network as shown here.

virtbox

As you can see, Whonix is actually two virtual sessions, a gateway and the second being the actual workstation that the user is encouraged to use. This two tiered network connection is how one secures your workstation from de-anonymizing attacks on your computer. However, the Whonix workstation is already configured and for this tutorial, we won't be using Whonix workstation, we want to connect our kali vm to the Whonix gateway.

Now, In this photo above, you can see that once you navigate to the "Network" tab, to the right you will see adapter setting. Adapter 1 needs to be set as NAT. That is what will actually connect to your computer's local connection to your internet gateway. Then, click on Adapter 2. It should look like this

vb2

Under "Attached to" instead of NAT chosen in Adapter 1, you want to select from the dropdown menu "internal network". This internal network is integrated inside of Virtual-box choices of connections, and since Whonix was set up, whonix will be recognized and that is what you will select. What this means is that all your network traffic will be re-routed to the Whonix gateway as opposed to your local machines detectable and public ip address. Essentially this is how you torify your internet traffic, since Whonix is built by design to torify network traffic, and we are essentially piggy backing off of the Whonix gateway. However, we are not completely done yet. We still have to perform a two-pronged step, one at the Virtual-box settings and one inside of the kali vm once you have started it.

Step 3: Configuring Kali Networking

Download the kali vm from https://www.kali.org/ and select the vm of your choosing, its usually pre-configured as its an ova file. However once you port it to Virtual-box, open the settings prior to starting the vm. Navigate to Network. It should look like this.

vb3

Under Adapter 1, make sure you click the dropdown menu and click on "internal network". Once selected, it will defacto pick Whonix for you, if not, choose Whonix. That is preety much it. You have done your part at the Virtual-box level. Now its time to start the vm.

After starting the vm, and you sign into kali using the default username and password which is kali, you will see in the network icon that it is going to be disconnected. Hence you will have to edit the network connection. Review the image below

kali

Since my host computer is connected via ethernet, then it would be under ethernet connection. You want to select that connection and click the settings icon. Once in settings, you want to navigate to ethernet and select the device as it would be unselected by default. If you dont select the device, you won't be able to connect to the internet. So make sure you select and chose the device. Mine is eth0.

kali2

Once you have performed this, you want to navigate to Ipv4 settings. You will have to select "manual" and then you will have to click "add" and type in the following specs as shown here

kali3

The address should be

10.152.152.3

as the ip address.

For the subnet mask, although the image says "18" what you would type is the following address here

255.255.192.0

This is the address you type in the subnet mask. After it connects it will then alter this number automatically. Then, for the gateway, you type in

10.152.152.10

Then you click on the DNS server and you type in the same address as you did in the gateway and as is shown in the image above

10.152.152.10

Once you click save, exit the settings and it will then connect to the internet via the Whonix gateway we have set up in Virtual-box. You can test your connection and its anonymity by going to https://dnsleaktest.com

Now, you can start hacking with a degree of anonymity!

Torify Other Virtual Machines

An added bonus to utilizing the Whonix Gateway via Virtual-box is that you can actually bridge any other virtual machine operating system to the Whonix gateway following the exact same protocol in this basic tutorial. I believe the Whonix team on their website document this in their documentation section. The Whonix gateway is not isolated to only the Whonix workstation, or even kali, you can deploy any operating system as a virtual machine and connect it to the Whonix gateway. That is the beauty of the Whonix protocol.

Virt-Manager

These same credentials will also work in Virt-Manager in Linux as well as you download Whonix for KVM from the whonix website. You can also link other KVM machines to the Whonix gateway inside Virt-Manager.

#anonymity #cryptography #hacking #opsec #privacy