TryHackMe CyberLens
Writeup

Overview
- Machine Name: CyberLens
- OS: Windows
- Difficulty: Easy
Reconnaissance
We'll initiate an nmap scan to identify any open ports.
Nmap Scan Results
Add the IP of the machine to your /etc/hosts
After the scan, we see several open ports, port 80 is open so let's go to the website to see what we find.
We can see a feature on the target webpage, CyberLens Image Metadata Extractor. This functionality allows users to upload images and conveniently extract all associated metadata, but before inspecting that feature of the web let's do a directory enumeration with gobuster to see if we find interesting directories.
Directory Enumeration
Nothing interesting !
Let's check the source code from the webpage to see if we can get something interesting.
Looking at the sourcecode of the website, on line 192 we find the CyberLens Image Extractor, and something very interesting appears, which is this script.
We can see that the image extractor, once an image is uploaded, it sends it to http://cyberlens.thm:61777/meta to extract the metadata of the image and returns it to us.
Let's go there and see what we find.
And the server is running Apache Tika 1.17 Server, Let's see if there are any CVEs for this version
Exploitation
Searching we can find that it is vulnerable to Command Injection CVE-2018-1335 https://www.exploit-db.com/exploits/46540
Let's try the exploit to see if we can gain access to the machine
Then let's build the command, I will use https://www.revshells.com/ PowerShell #3 (Base64)
Start a netcat listener
And we are in !
Go to C:\Users\CyberLens\Desktop and grab the user flag ! Now let's focus on privilege escalation.
Post-Exploitation
Privilege Escalation
Let's get on, for this I will establish a shell with metasploit and then use post/multi/recon/local_exploit_suggester to see what we can get.
Craft a shell with msfvenom
Transfer it to target machine
Then
Start listener and we have it.
Background the session
We will use post/multi/recon/local_exploit_suggester.
After launching it it tells us that the machine is vulnerable to always_install_elevated
Let's see if it's true
This command checks if the "AlwaysInstallElevated" policy is enabled on the system. The output indicates that the policy is set to 0x1
, meaning it is enabled. This policy allows Windows Installer to elevate privileges for all .msi (Microsoft Installer) files, which can be exploited by an attacker to gain elevated privileges by running a malicious .msi file.
So let's generate an MSI installer payload with msfvenom.
Transfer it to the victim machine
Run it
Start a netcat listener.
And we are nt authority\system
Conclusion
In conclusion, here is my first writeup, I hope it has been useful to you, and as for the machine, a easy easy Windows to reinforce basic concepts.