Reverse Shells Command on Linux Server
published onJune 10, 2016
0views
4minutes read
This time, I will discuss several ways to obtain an interactive shell when we successfully find a Command Execution Vulnerability during penetration testing. Our choice for a reverse shell depends on the programming language installed on the target server. Now, I will discuss some options/commands to perform a reverse shell using php, python, ruby, etc.
Before initiating the reverse shell, make sure that on our computer (attacker), we have already started using netcat.
is the port we will open. Please change it according to your preference.
Reverse Shell using Bash
Bash can be used to perform a reverse shell.
![](https://ik.imagekit.io/umarhadi/images/c6bc1-reverse-shell_5raSuQcJr-F.png)
From the target computer/server, enter the following command:
is the attacker's IP. is the port we opened earlier in the netcat listening command.
Reverse Shell using Netcat
Netcat can also be used to perform a reverse shell.
![](https://ik.imagekit.io/umarhadi/images/68abc-reverse-nc_LOBXyqAXhM.png)
From the target computer, enter the following command:
Reverse Shell using PHP
![](https://ik.imagekit.io/umarhadi/images/6f4dc-reverse-php_QKzzPComGa3q.png)
Command:
If it fails, change the file descriptor number from 3 to 4, 5, or 6.
Reverse Shell using Perl
Perl can also be used to perform a reverse shell.
![](https://ik.imagekit.io/umarhadi/images/50feb-reverse-perl_pmlHld_JzGaK.png)
Command:
Reverse Shell using Ruby
Ruby also allows us to perform a reverse shell.
![](https://ik.imagekit.io/umarhadi/images/11fd5-reverse-ruby_riFux1PXu5.png)
Command:
Reverse Shell using Python
The last option is Python.
![](https://ik.imagekit.io/umarhadi/images/06a63-reverse-python_08-Ani0PCA.png)
Command:
Tags:
#Linux
#Penetration Testing
#Reverse Shell