Service detection performed. Please report any incorrect results at https://nmap.org/submit/ . Nmap done: 1 IP address (1 host up) scanned in 74.37 seconds
The scan identified that the server was hosting a web site that allows the analysis of powershell scripts supplied to it.
By uploading a powershell script to obtain a reverse shell, you gain direct remote access to the machine.
Encoded user flag
An attempt to retrieve the user flag reveals that it contains a base64 encoded string.
Decoding the file reveals the existence of a hidden endpoint on the website.
1 2 3
┌──(kali㉿kali)-[~/ctf/thm] └─$ echo -n "WW91IGNhbiBnZXQgdGhlIGZsYWcgYnkgdmlzaXRpbmcgdGhlIGxpbmsgaHR0cDovLzxJUF9PRl9USElTX1BDPjo4MDAwL2FzZGFzZGFkYXNkamFramRuc2Rmc2Rmcy5waHA=" | base64 -d You can get the flag by visiting the link http://<IP_OF_THIS_PC>:8000/asdasdadasdjakjdnsdfsdfs.php
Accessing the latter, we learn that to retrieve the flag, the log files must be deleted.
By browsing the machine and analyzing the script which analyzed the uploader files, we discover that the logs are stored in the following directory:
1
C:\xampp\htdocs\uploads
By deleting them and returning to the web page, we can retrieve the flag.
Modification of a scheduled task
To fully compromise the machine, I started by enumerating its configurations with privesccheck, which I transferred like this:
The script tells us that we have write access to a directory containing a file that is being executed by a scheduled task.
If you replace the script with a reverse shell, you won’t be able to stabilize the connection because of the antivirus.
1 2 3 4 5 6 7
msf6 exploit(multi/handler) > run [*] Started reverse TCP handler on 10.21.110.163:4444 [*] Command shell session 2 opened (10.21.110.163:4444 -> 10.10.204.232:50051) at 2025-06-27 18:17:44 -0400
schtasks /run /tn \MyTHMTask SUCCESS: Attempted to run the scheduled task "\MyTHMTask".
To get around this problem, you can write a C script that will create a new user on the machine and add him/her to the local administrator group.
Once converted into an exe, this script added my account to the machine’s local administrator group and compromised it.
1 2 3
net users User accounts for \HOSTEVASION ------------------------------------------------------------------------------- Administrator chemse DefaultAccount evader Guest WDAGUtilityAccount The command completed successfully.