![netcat reverse shell example netcat reverse shell example](https://miro.medium.com/max/1140/1*sLvPYEHpRRURz0kbAkp0Vg.png)
Let’s have a look at how this works with the following example where we’ve setup 2 Linux systems with Netcat. We can than issue the Netcat command with –e on the target host and initiate a reverse shell with Netcat to issue commands. Let’s say we have found a remote code execution (RCE) vulnerability on the target host. Please note that we can also use the –e option with cmd.exe on Windows. The –e option sends back a Bash shell to the attack box. In this example the target connects back to the attack box using port 4444. Let’s have a look at the visualization of a reverse Netcat shell to get a better understanding of how it works: In fact, often you need to use more common ports like 80 and 443 to setup reverse shells as it is more common for these ports to be open.
![netcat reverse shell example netcat reverse shell example](https://www.hackingtutorials.org/wp-content/uploads/2017/01/Netcat-to-Meterpreter-msfconsole-1.jpg)
We will be using port 4444 throughout this tutorial but please note that this can be any open port instead. In the following paragraphs we will be demonstrating the use of bind and reverse shell.
Netcat reverse shell example software#
In malicious software a bind shell is often revered to as a backdoor. A bind shell is setup on the target host and binds to a specific port to listens for an incoming connection from the attack box. A reverse shell is a shell initiated from the target host back to the attack box which is in a listening state to pick up the shell.
Netcat reverse shell example how to#
In this tutorial we will be learning how to use Netcat for:Ī very popular usage of Netcat and probably the most common use from penetration testing perspective are reverse shells and bind shells. We will conclude this tutorial with how to use bind shells. Programming and script languages like Python, PHP, Perl and Bash are great alternatives. In these cases we will learn about how to use other tools and programming languages than Netcat which replaces some functionality to setup a reverse shell. Quite often Netcat is not present on systems as it could be considered as a potential security issue. In this tutorial we will be learning about the difference between a bind shell and a reverse shell and how to use them. Now it is time to dive deeper into the most popular and common usage of Netcat: Setting up bind shells and reverse shells. In part 1 of the Hacking with Netcat tutorials we have learned the very basics of Netcat.