Love Writeup - HackTheBox
Love is a Windows box. The chain runs: nmap finds an SSL certificate leaking a staging subdomain, the staging site has a file scanner with SSRF, using SSRF to reach an internal port 5000 returns plaintext admin credentials for the voting system, the admin panel allows arbitrary file upload so a PHP webshell lands in the web root, and AlwaysInstallElevated registry keys set to 1 allow any MSI to run as SYSTEM.
Discovery
Port scan
PORT STATE SERVICE VERSION 80/tcp open http Apache httpd 2.4.46 (OpenSSL/1.1.1j PHP/7.3.27) 443/tcp open ssl/https? | ssl-cert: Subject: commonName=staging.love.htb 445/tcp open microsoft-ds Windows 10 Pro 19042 3306/tcp open mysql MariaDB 10.3.24 5000/tcp open http Apache httpd 2.4.46 |_http-title: 403 Forbidden
The TLS certificate on port 443 exposes staging.love.htb. Port 5000 returns 403 externally. Add both vhosts to /etc/hosts.
SSRF via File Scanner
beta.php [Status: 200, Size: 4997]
beta.php is a file scanner that accepts a URL and fetches its content. It makes requests from the server itself, meaning it can reach internal services that are blocked externally. Port 5000 returned 403 from outside. Reach it through the SSRF:
Vote Admin Creds admin: $PHOEBE_PASSWORD
Port 5000 serves a page with plaintext admin credentials for the voting system.
Foothold
PHP webshell via admin file upload
love\phoebe
The admin panel accepts arbitrary files as candidate images and serves them from /images/. Code execution as phoebe. Trigger a reverse shell via a base64-encoded PowerShell payload:
connect to [$ATTACKER_IP] from (UNKNOWN) [$TARGET_IP] 61647 PS C:\xampp\htdocs\omrs\images> whoami love\phoebe
Shell as phoebe.
Privilege Escalation
AlwaysInstallElevated
AlwaysInstallElevated REG_DWORD 0x1 AlwaysInstallElevated REG_DWORD 0x1
Both HKLM and HKCU keys set to 1. Any MSI installed by any user runs as SYSTEM. Generate a malicious MSI, drop it in an AppLocker-allowed path, and install it:
connect to [$ATTACKER_IP] from (UNKNOWN) [$TARGET_IP] 61649 C:\WINDOWS\system32>whoami nt authority\system
Related
References
-
AlwaysInstallElevatedTOOL: AlwaysInstallElevated, book.hacktricks.wiki/en/windows-hardening/windows-local-privilege-escalation/index.html#alwaysinstallelevated (opens in new tab)
HackTricks, AlwaysInstallElevated privilege escalation.