Backdoor ( Netcat ) on Windows and Kali Linux
Introduction
Netcat (NC) is a networking utility used to establish TCP or UDP connections between computers. It can listen on network ports, connect to remote systems, and help troubleshoot network communication.
In this practical guide, we will explore three concepts:
- Chat between Kali Linux and Windows
- Bind shell
- Reverse shell
We will also learn how to check IP addresses, verify connectivity, and understand the difference between these connection types.
Disclaimer: Perform these exercises only in an isolated lab environment using systems you own or have permission to test.
Lab Setup
We will use two virtual machines for this practical.
Component Details Attacker machine Kali Linux Target machine Windows
Kali Linux IP192.168.114.128
Windows IP192.168.0.232
Port4444
Tool on Kali LinuxNetcat (nc) Tool on Windows Netcat (nc.exe)
Note: These IP addresses are examples. Replace them with the actual IP addresses assigned to your virtual machines.
Step 1: Check the Windows IP Address
Open Command Prompt on Windows and execute:
ipconfigFind the active network adapter and note its IPv4 address.
Windows Configuration:
Step 2: Check the Kali Linux IP Address
Open the Kali Linux terminal and execute:
ip aAlternatively, use:
ifconfigIdentify the IP address assigned to the active network interface.
Kali Linux IP Configuration:
Step 3: Verify Netcat Availability
On Kali Linux, execute:
nc -hOn Windows, locate the nc.exe executable in your lab tools folder.
Netcat Availability:
1: Chat Between Kali Linux and Windows 11
Objective
Establish a TCP connection between Kali Linux and Windows 11 and exchange text messages.
Step 1: Start the Listener on Kali Linux
Open a terminal on Kali Linux and execute:
nc -lvnp 4444Command explanation:
-l: Listen for incoming connections.-v: Display connection information.-n: Do not perform DNS lookups.-p 4444: Specify port 4444.
The terminal waits for an incoming connection.
Kali Linux Listening on Port 4444:
Step 2: Connect from Windows 11 & Test the Chat Connection
Open Command Prompt in the directory containing nc.exe.
Type a harmless test message in one terminal and verify that it appears in the other terminal. Repeat in the opposite direction.
cd C:\Program Files\Npcap
winget install Insecure.NmapConnect to the Kali Linux machine:
ncat -v 192.168.114.128 4444If the connection is successful, the two terminals can exchange text.
Windows 11 Connecting to Kali Linux:
Expected Result
Both systems can exchange text through the established TCP connection.
2: Bind Shell
What Is a Bind Shell?
A bind shell is a connection model in which the machine hosting a command interpreter listens on a network port. A remote client initiates a connection to that port.
In a traditional bind shell, the network connection is attached to a command interpreter. This can allow remote command execution, making it a security-sensitive technique.
Connection Flow
Kali Linux (VMware)
Client
|
| TCP Connection → Port 4444
|
v
Windows 11 Pro (Base Machine)
ListenerStep 1: Understand the Listening Host
In a bind-shell scenario, the Windows machine acts as the listening host, while Kali Linux acts as the connecting client.
Get Rahul’s stories in your inbox
Join Medium for free to get updates from this writer.
The listener waits for a connection on the configured port.
Step 2: Understand the Client Connection
The client connects to the listening machine using its IP address and port.
In an authorized lab, observe the connection direction using a harmless Netcat test connection rather than exposing a command interpreter over the network.
Bind Shell Client and Listener:
Step 3: Verify the Concept
Confirm which machine listens and which machine initiates the connection.
Remember that a traditional bind shell may provide access to the command interpreter with the permissions of the process running it.
Expected Result
The Windows machine is the listening host, and Kali Linux initiates the connection.
3: Reverse Shell
What Is a Reverse Shell?
A reverse shell reverses the direction of the connection. The machine hosting the command interpreter initiates an outgoing connection to a listener on another machine.
Reverse shells are studied in cybersecurity to understand remote access techniques and investigate suspicious outbound connections.
Connection Flow
Kali Linux (Listener)
^
| Outgoing TCP Connection
|
Windows 10 (Connecting Host)Step 1: Start the Listener on Kali Linux
Open the Kali Linux terminal and execute:
nc -lvnp 4444Kali Linux waits for an incoming TCP connection on port 4444.
Reverse Shell Listener on Kali Linux:
Step 2: Understand the Windows Connection
In a reverse-shell scenario, Windows initiates the connection to the Kali Linux listener.
For a safe demonstration, establish a normal Netcat connection and exchange a test message. Do not attach an unauthenticated remote command interpreter to the connection.
Windows-to-Kali Connection:
Step 3: Observe the Connection
Check the terminal output and confirm that Windows initiated the connection to Kali Linux.
Reverse Connection Established:
Expected Result
Kali Linux acts as the listener, and Windows initiates the outgoing connection.
A reverse shell does not automatically bypass a firewall. Its success depends on network rules, endpoint security, and other controls.
Bind Shell vs. Reverse Shell
Feature Bind Shell Reverse Shell Listening machine Target machine Remote listener Connection initiator Remote client Target machine Connection direction Client to target Target to listener Main security concern Unexpected listening port Suspicious outbound connection
Common Troubleshooting
1. Connection Refused
Possible causes:
- No listener is running on the destination port.
- The IP address or port is incorrect.
- The listening process has stopped.
What to check: Verify the destination IP, port, and listener status.
2. Connection Timed Out
Possible causes:
- The machines cannot reach each other.
- A firewall is blocking the traffic.
- The virtual machines are connected to incompatible networks.
What to check: Review the virtual machine network settings and verify connectivity.
3. Netcat Command Not Found
On Kali Linux, execute:
command -v ncOn Windows, confirm that the executable exists in the expected directory.
4. Incorrect IP Address
Recheck the Windows IP using ipconfig and the Kali Linux IP using ip a
Use the actual address assigned to the active network interface.
Security Best Practices
- Use an isolated virtual network for practical exercises.
- Test only systems you own or are authorized to assess.
- Keep Windows Defender and other endpoint protection enabled.
- Avoid exposing unauthenticated command interpreters over a network.
- Do not expose lab listeners to the public internet.
- Stop lab processes when testing is complete.
Conclusion
Netcat is a useful tool for understanding network communication and TCP connections.
A chat connection demonstrates basic communication between two systems. A bind shell waits for a remote client, while a reverse shell initiates a connection to a remote listener.
Understanding these concepts helps cybersecurity learners recognize potentially suspicious connections and improve their network security knowledge.
Key takeaway: Always practice in an isolated lab, document your observations, and follow security best practices.








