TryHackMe | Simple CTF Box

Ready for another one? Let’s do it! As per usual, let’s do an nmap scan and see what’s going on.

Time to break it down:

  • Port 80: We can check for a site of some kind here in the web browser, and also look up the version of Apache to see if their are any vulnerabilities/exploits for it.
  • Same tactics can be applied to port 21 and port 2222, check the versions for vulnerabilities.

Personally, I like to start with the website in these instances, as you are usually guaranteed to have something there. The main page for this site is the default Apache page though, so let’s see if Dirbuster will give us any directories.

Let’s see what’s hiding in that /simple/ directory.

Pulling the site up shows us that the framework being used is “CMS Made Simple” version 2.2.8. Let’s see if there are any vulnerabilities for that.

Time to download and run the exploit:

The command I ran to get the output is the command below the output

Let’s break this command up a little bit:

  • “python” runs the exploit we downloaded as it is a .py file.
  • “46635.py” is the exploit file.
  • “-u” is referring to the target (basically). It is referring to the URL.
  • “–crack” says that you want to crack the passwords found and
  • “-w” is referring to the wordlist you want to use to crack the password

We found two usernames, here’s one of them:

Now that we cracked the password and have a username to attempt to use, let’s try out ssh’ing on port 2222.

Sweet! We made it in! Now we can take a look around.

There’s the user flag. Time to escalate privileges. The first step (especially in these beginner boxes) that I take is to perform the command “sudo -l”.

From there we are able to observe that vim can be run without the root password, so let’s check out GTFO Bins to see what we can do with vim.

Trying out the first option, it is a complete success! Let’s deconstruct why this works.

  • “sudo” runs program as superuser.
  • “NOPASSWD” in “sudo -l” means this user has the privilege level to run this program as the superuser without needing to authenticate.
  • “vim” the program we are running as the superuser.
  • “-c” designates a command to be read after the first file.
  • “‘:!/bin/sh'” is the command executed by the “-c” bit. It will run the shell as the elevated user, making you root.

That’s the end of it! Thanks for reading!

TryHackMe | RootMe Box

So, as per usual, let’s kick it off with an nmap scan:

We notice that two ports are open; 22-ssh, and 80-http. Web sites are always fun in CTFs and leave lots of different places to stuff clues and challenges, so let’s check out the site first, and run Dirbuster on it at the same time to see if it has any hidden directories.

Two important directories that are needed for us. /panel, and /uploads. Panel brings us to this page:

Which WILL NOT take a standard .php file (my poor reverse shell). And we can assume once we get past this roadblock, that the shell we will be executing is going to be located in the /uploads directory.

So I have a simple little minimalist reverse shell I like to use for php (nothing fancy, I should probably upgrade). I just need to run this command:

And switch it over to a php5 extension instead of php. This is called a “file name bypass” and hoodwinks the file name validation the upload functionality has in place. You can read further up on this here, but essentially, this is a type of blacklisting bypass. We found out that a php file is blacklisted from being uploaded, but to bypass this, we just have to try an unpopular php extension such as: php3, phpt, php5, php6, etc.

And wouldn’t ya know, it works! Let’s go verify that our reverse shell is now inside of the uploads directory.

Before clicking on it, make sure to get a netcat listener running.

You might have to do some things to stabilize this shell. As I said, it is extremely minimalist. Now we just need to search for a file with SUID permissions, and find the one that sticks out. We can do this by running the following command:

One major one that sticks out that I’ve used before can be seen here:

Python is great if you have access to it. Check out GTFO Bins for some more information. Keep in mind that this is SUID related, and we already have access to python.

That means we just need to run the second command there.

And boom, you’re root.

TryHackMe | Anthem Box

This box will be a little different, due to it being a Windows box. Now, given that like 98% of business infrastructure runs on Windows, I’m starting to think it’s due time for me to start branching out. I’ve got a couple more write ups coming soon, they are just very very long, so I haven’t gotten around to creating them yet.

But for this box, let’s start off with a little nmap scan.

So, we’ve got a lot of ports open. I’m going to look into the importance of each of these ports real quick, just for review:

  • Port 80 – HTTP: The port that the server expects to receive data from a web client. It can be configured differently, but this is the default.
  • Port 135 – MSRPC: This is a modified version of DCE/RPC. Stands for “Microsoft Remote Procedure Call”. It is a protocol that uses the client-server model in order to allow one program to request service from a program on another computer without having to understand the details of that computer’s network.
  • Port 139 – NetBIOS-SSN: Stands for “NETBIOS Session Service”. TCP NetBIOS connections are made over this port, usually by Windows machines, but can also be any other system running Samba (SMB). These sessions support “connection oriented file sharing activities”.
  • Port 445 – Microsoft-DS: This port is usually used for file sharing, with something like Samba. It stands for “Microsoft Directory Services”. It is the preferred port for carrying Windows file sharing and “numerous other services”.
  • Port 3389 – MS-WBT-Server: So, from the port number, we can already guess that this is an RDP instance. Also known as “msrdp” or “Microsoft Remote Display Protocol”, it sets up a terminal server that can be remoted into.

Let’s take a crack at the website first.

So, there wasn’t anything important on the main page, and robots.txt is always a great place to check when crawling directories. So if you’re feeling lazy and don’t want to start up and configure dirbuster, just add that “/robots.txt” to the end of the URL and see if it pulls up anything important. In our case it did, multiple directories to check out, and a potential password.

This just shows what the site’s URL is supposed to be. It answers one of the questions for the box.

Another question was to find out the name of the SysAdmin, which I considered this one a bit dumb, just because the whole concept of this question is flawed. You need to Google this poem that this employee wrote about the sysadmin, and it gives you the author of the original poem, which is what the sysadmin’s name is. Why this bears any relevance, how anyone was actually supposed to connect those dots, I’ll never know. I’m just glad I didn’t do the foot work on this bit of the box (haha).

^Name of the sysadmin^

This was to identify how the company creates its emails. So we have a first and last name, and we have an example email. Now we can create the sysadmin’s email, and it looks like we have his password from the robots.txt file too.

The challenge here was to just find three (maybe four? I don’t remember exactly) flags that were hidden in/on the site. Most of them were in the source code, so I just went to each page, opened the source code, and ctrl+f’d for “THM{“, which is the standard format for TryHackMe flags.

I didn’t spend too much time looking, but I feel like there should be a tool to crawl a specific website and all the links/pages it has on it and be able to look for certain parameters with the source code. I couldn’t find a tool like that, but maybe I should make one as a challenge. Could use Python + Beautiful Soup or something.

Final flag for this section was on a profile page.

I also broke into the website manager using the email and password for the sysadmin. Didn’t find anything, but it was fun to try.

So RDPing into the box works using the sysadmin and the password that we found. So now we just have to root around a bit (hehe…get it?), and then escalate our privilege to full admin to find the final text file.

First text file found just sitting on the desktop.

Interesting folders that were hidden. If going back through this box, you’ll want to check on those.

So, all we really had to do was add ourselves as owners to a hidden file, so that we now have full control.

Opening the file provides us with the administrator’s password.

Now, let’s log out, and attempt to login as admin.

And we’re in! The final flag was sitting on the desktop as well. Great box to get your feet wet with Windows and RDP, but I’m definitely looking forward to more!