Introduction
It is the second machine in the HTB-Starter series, and the difficulty rating is very easy. Oopsie hints towards a mistake. I am blogging while trying to solve so expect facing rabbit holes.

Scanning & Enumeration
From the results above, let us populate our Service Version Enumeration Table.

HTTP Enumeration
Well, we know SSH is not usually the way in, so we start with HTTP.

We take the happy path before going malicious and try to view the website like any normal user.
Finally, we get a login page at /cdn-cgi/login
I tried SQL injections and some default passwords. Finally, I realized I had a password(I am not sure if I can reveal the password here) from the first box in the series, so with the username admin and the password, we log in.

Now we again take the happy path and gather some more information.
When we try to log in on uploads section :

We come across the following message “This action requires super admin rights”. So I started looking for other usernames/accounts. That’s when I found that we have a client with the name Tafcz and the contact email - [email protected] who also owns an account with id = 4 and
8832 — is the access id for Tafcz
So now we have to brute-force different ids. Let's do that using Burp.
Finally, I got the access id for super admin

With this access id, we click on uploads and intercept the request in Burp, and replace the access ID.

We finally get the upload option!
Vulnerability Analysis
We have super admin rights and we have an upload page, this should be an insecure functionality where I can upload a malicious PHP and gain a reverse shell. Let’s try that.

We were able to upload the malicious file. The next task is to find the location where these files are uploaded.
Exploitation
In the reverse-shell.php add your ip and port and create a listener.
Change the cookie to contain the id of the super admin.


And we finally get the basic shell.

Lateral Movement
I logged in and kept looking at different files. One of the best tips is to look at the web directory and look for config files. I found a db.php file which has credentials.

I have a hunch that this can be the password for the user Robert.

And we were able to log in. We still do not have admin rights. So the saga continues.
Privesc
Now we run linpeas and go through the results.

Some useful ports, we will try to check these out as well.

We saw that we are in the group bugtracker as well, this might be the intended vector.

But we need to get a tty.

We see that they are using cat as an absolute path. So we can create a custom cat file, and add it to the path.

And we got root.
Summary | TL;DR
- Scan ports using Nmap
- Reuse password to login as admin
- Find access code for super admin using brute-force
- Upload PHP reverse shell
- Reuse password from config files to log in as robert.
- Priv esc using the binary bugtracker, which has suid set, and absolute path for cat.
Parting Thoughts
In this machine, we learned the following:
- We should not reuse passwords
- When writing shell scripts, we should define absolute paths to binaries and ensure that no one has permissions to rewrite those binaries.
Thank you for reading, please provide your feedback and share it with people who are in need. :)