Another day, another THM write-up. Today I will be taking on the TryHackMe room Lian_Yu. It's marked as being easy, so we'll see how I get on.
Recon
So, as is fairly usual, we're presented with a machine to attack and told to start enumerating. The room card mentions gobuster so the chances are that there'll be a web server running on it.
The first two things I started with were nmap and gobuster:
No real surprises there. We have a web server running on port 80, FTP on 21, and a SSH server on 22. gobuster found us a directory on the server to take a look at, so we'll do just that:
What? No code word? Let's check the source:
We could also have found the code word by highlighting all the text on the page.
The tasks on the THM page suggest we should have found something else:
By the look of it, it's a 4 character directory name we're looking for and it appears gobuster didn't manage to find it.
Given that it's only 4 chars, that shouldn't take long to brute-force so we'll use crunch to generate us all the possibilities and feed this into gobuster:
crunch 4 4 > four.list
Crunch will now generate the following amount of data: 2284880 bytes
2 MB
0 GB
0 TB
0 PB
Crunch will now generate the following number of lines: 456976
Running this through gobuster got me no results. On checking the file, it's only generating for alphabetic chars. Let's try that again with numbers:
crunch 4 4 0123456789 > four-numbers.list
Let's have a look at the /island/2100 page:
Within the source, there's a comment:
This looks like it's suggesting some form of file extension and the task in the room gives us a steer towards what we're expecting to find:
Running gobuster with my usual list and the argument -x "ticket" comes back with nothing, so I thought I'd take a look at the mask in the answer. The part before the period is 11 characters long. Much like Oliver Queen's name.
Running for all variants on Oliver Queen (including l33t speak versions, which I went and got a nice tool to generate) came back with nothing. Thought I'd try Robert Queen as well. Still nada.
Went and got a bigger list for gobuster and got a result pretty quickly. Think I'll use that list first next time...
Going to this URL gives the following:
The next task appears to be getting in to FTP:
Trying a few usernames, the one I found which asked for a password was the word found "hidden" in the HTML from earlier.
Unfortunately, the token given in the previous task was not the password for it.
It did look like it could be in an encoded format, however, so I stuck it in CyberChef and got something usable in Base58.
This got me in on FTP and allowed access to the following:
Only two of these seemed to be pictures, however:
The aa.jpg file seems to have something hidden in it, as found by running stegcracker on it. I probably didn't need to use stegcracker as the password was pretty obvious.
Anyways, this contained a zip file containing a file with a password in and a file called passwd.txt which warned about booby traps on the island.
The password is not for the user we used for the FTP connection, however. Luckily, whilst I was FTPd in, I checked out what other users were on the system and so I knew to try the name slade. This name, along with the password we just gained got me in.
Once in here, we get access to the user.txt file:
All we need to do now is find some way of escalating our privs to get root.
I first started looking for SUID files before remembering that sudo -l is always worth a quick check to see if there's anything the user can do which may be of help:
OK, looks like we can sudo /usr/bin/pkexec. A quick check on this on gtfobins shows we can simply sudo pkexec /bin/sh out way to glory:
Conclusion
All-in-all this was a fairly simple room (well, it is ranked as easy). There were a couple of takeaways from me on this:
Always use the large directory file for gobuster
crunch doesn't include numbers in it's alphabet by default
Don't disappear down a rabbit hole trying to fix what appears to be a corrupted png file without doing more obvious things first
Anyways, that's about it for this time around. Hope you enjoyed reading :)