Planning HTB
Planning HTB
Subdomain Enumeration
Further exploration of the website with ffuf uncovers a subdomain
grafana.planning.htb. After adding this subdomain to /etc/hosts file, I login the
Grafana instance with the credentials provided in the scenario.
Subdomain discovery with ffuf
admin / 0D5oT70Fq13EvB5r
Grafana Exploitation
Checking the Grafana version reveals it’s running version 11.0.0, which is known to
have arbitrary file read and Remote Code Execution vulnerability (CVE-2024–9264).
You can find a Github code to exploit this vulnerability.
CVE-2024–9264
First, I create a basic reverse shell, and then serve it using python http server.
Before using the exploit found in the Github, I start listening the port that I specified
in the reverse shell, which is 1337.
rev.sh
Now I get a shell inside the Grafana Docker container. Inside the container, env
reveals the password of the user “enzo”.
enzo user password
I use the password to make ssh connection to the host with enzo user. After gaining
ssh access, I find the user.txt in the /home/enzo folder.
crontab.db file
Local ports
So, I make ssh local port forwarding to port 8000. After that, I go to
http://127.0.0.1:8000, and login into the cronjobs dashboard with the password that I
found in the crontab.db file above.
Now I am on the last step, which is to create a new cronjob to escalate to the root
user. First, I create a cronjob that copies /bin/bash binary under the tmp folder, and
then set the SUID bit on the copied bash binary to escalate privileges.
New cronjob
Finally, I go to the /tmp folder and list the files under it. I see the bash binary
created there. I run the binary, and get the root user. Boom!
Root shell