Sitemap

OLYMPUS — Tryhackme

6 min readMar 2, 2025

Well… Happy hacking ^^

Performed an Nmap scan on the target IP and found that port 22/ssh and port 80/http are open. Since the specified IP address does not load, we need to add the IP to the hosts file with the DNS record as olympus.thm.

Press enter or click to view image in full size
Nmap scan

Website port 80

Press enter or click to view image in full size
olympus.thm

There is a message on the website indicating that the previous CMS version is still accessible, so a Dirbuster scan was performed on the target.

Press enter or click to view image in full size
Dirbuster

Navigate to the directory that was found. The only important things we see are the search function and the login page.

Press enter or click to view image in full size
/~webmaster

So, use the search function and add the payload [1'] in the search field. You'll see that there is a SQL syntax error. The next well-known step is to use SQLMap. You can refer to this blog about SQL injection using SQLMap.

Press enter or click to view image in full size
SQL syntax error

capture the request and run sqlmap

Press enter or click to view image in full size
request
Press enter or click to view image in full size
sqlmap
Press enter or click to view image in full size
database

sqlmap -r req.txt — batch — tables Olympus

Press enter or click to view image in full size
table Olympus

Database dump

Press enter or click to view image in full size
found flag and users

So, the cat_id parameter is vulnerable to SQL injection and can be used to read data from the backend database. With SQLMap, it is possible to enumerate databases, tables, and columns using the following options:

  • Use --dbs to list the database names. Once you have identified the desired database, you can specify it on the command line with the -D <DB NAME> option.
  • Use --tables to list the table names. Specify the table on the command line with -T <TABLE NAME>.
  • Use --columns to list the column names within a table. Specify the columns with -C <COLUMN NAME>.
  • You can dump the entire table using --dump.
Press enter or click to view image in full size
the cat_id parameter is vulnerable to SQL injection

Found the first flag.

Press enter or click to view image in full size
flag 1

There is a table named ‘users’. Dump the table and look for important details.

Press enter or click to view image in full size
table user

Dump the data from the users table.

Press enter or click to view image in full size
found user and password

There are usernames and passwords for three users. Copy the hashes and use John to crack the passwords. John was only able to crack Prometheus’s password.

Press enter or click to view image in full size
crack Prometheus’s password

Now log in with the credentials that were found.

Press enter or click to view image in full size
login
Press enter or click to view image in full size
Admin page

Dump the users file again.

Press enter or click to view image in full size
Dump users

There is another subdomain called ‘chat.olympus.thm’. Add it to the hosts file and start hacking.

Press enter or click to view image in full size
found subdomain

After accessing the website, we see a login page.

Press enter or click to view image in full size
chat.olympus.thm

There is an upload option on the chat page.

Press enter or click to view image in full size
upload option

Upload php_reverse_shell.php

Press enter or click to view image in full size
malicious file upload

After wondering where the uploaded files go, I scanned with Dirbuster and found the /uploads directory.

Press enter or click to view image in full size
/upload

After seeing a blank page, I remembered the table from the Olympus database related to chat. Let’s try SQLi again and extract the data.

Press enter or click to view image in full size
table chats

Here, you can see that all file names are encoded in a certain way and changed to something else. For our uploaded file, the name was changed from reverseshell.php.

Press enter or click to view image in full size
found file names are encoded

Now try to access the uploaded file in /uploads while starting Netcat at the same time.

Press enter or click to view image in full size
reverse shell

At this stage, we have a reverse shell from the website with the www-data user. To access the zeus directory, we need to escalate our privileges or log in as zeus. Using the command find / -perm -u=s -type f 2>/dev/null, we found an interesting file called cputils.

Press enter or click to view image in full size
cputils

That file is interesting because it can be executed as zeus, and its function is to copy files.

Press enter or click to view image in full size
its function is to copy files

Immediately copy Zeus’s private SSH key so that you can log in as Zeus.

User Zeus

Found the second flag in the zeus folder, and we obtained the id_rsa by running the cputils file.

Press enter or click to view image in full size
flag user

Read the id_rsa file.

id_rsa

Downloaded the private key, but when trying to log in, it asks for a passphrase since it is password-protected. So, use ssh2john to generate a hash and crack it.

Press enter or click to view image in full size
ssh2john

SSH into the system as zeus.

Press enter or click to view image in full size
zeus

Run the command find / -type f -group zeus 2>/dev/null.

Press enter or click to view image in full size
find / -type f -group zeus 2>/dev/null

I tried searching for files to use for privilege escalation and found /var/www/html/0aB*************/VIGQFQMYOST.php. So, I tried reading and analyzing the file. It simply does something straightforward (runs a binary) to gain root access.

Press enter or click to view image in full size
privilege escalation

Run the same code in the terminal as zeus since it grants us root access.

Press enter or click to view image in full size
user root

Go to /root, find flag3, and read it.

Press enter or click to view image in full size
flag root

--

--

GrimTheRipper
GrimTheRipper

Written by GrimTheRipper

You get the best out of others when you give the best of yourself

No responses yet