Bind Shell With Netcat
Bind Shell With Netcat
Step 1: Open the lab link to access the Kali GUI instance
These systems can be accessed via the tab switcher at the top of the lab as shown in the
following screenshot.
This lab requires two systems in order to provide you with an understanding of how Netcat
communicates either via a listener or when connecting to a port.
Before we get started, you will need to obtain the IP address of the target system within the lab
environment.
This lab will provide you with the target IP address in a leafpad window when you first access
the lab as shown in the following screenshot.
Note: Your target IP address will be different, so make sure to substitute the IP shown in the
commands below with the one in your lab.
In order to setup a bind shell with Netcat, we will need to transfer the nc.exe executable to the
target system running Windows.
Kali Linux comes pre-packaged with the nc.exe executable, we can host the executable by
setting up an HTTP server with Python.
The first step will involve navigating to the /usr/share/windows-binaries directory. This can be
done by running the following command:
Command
cd /usr/share/windows-binaries
We can then setup an HTTP server with Python within this directory by running the following
command:
Command
python -m SimpleHTTPServer 80
You will now need to identify the IP address of your Kali Linux system, this can be done by
running the following command on the Kali system:
Command
ifconfig
As shown in the following screenshot, the Kali Linux IP address in this case is10.10.3.2. In your
case, this will be different.
You will now need to navigate to the target system running windows by clicking on the Target
Machine tab at the top of the lab as shown in the following screenshot.
You will then need to open up a command prompt, navigate to the Desktop directory and run the
following command to download the nc.exe executable from the web server being hosted on the
Kali Linux system.
Command
In this case, we will be connecting to a bind shell listener on the Windows system, as a result, we
will need to setup a Netcat listener on the Windows system and configure it to
execute cmd.exe when a connection is made from a client.
Command
We can now connect to the bind shell listener running on the Windows system from the Kali
Linux system by running the following command:
Command
As shown in the following screenshot, connecting to the bind shell listener will provide us with a
remote shell on the Windows system.
This process can also be reversed, for example, if we wanted to obtain a bind shell on the Kali
Linux system from the Windows system, we would need to setup a Netcat listener on the Kali
Linux system and configure it to execute a shell like /bin/bash.
Command
We can now connect to the bind shell listener on the Kali Linux system from the Windows
system by running the following command:
Command
As shown in the following screenshot, connecting to the bind shell listener will provide us with a
remote shell on the Kali linux system.