About the Machine
The first step in owing the Planning machine like I have always done in my previous writeups is to connect my Kali Linux terminal with Hack the Box server. To establish this connection, I ran the following command in the terminal:
Once the connection was successful, I started the target machine and I was assigned an IP address 10.10.11.68. Under the machine information, two credentials which are likely to be a username and password were given as: admin & 0D5oT70Fq13EvB5r. Next, I started with an aggressive Nmap scan to identify open ports and services:
- Port 22 running OpenSSH (not immediately useful).
- Port 80 running Nginx hosting a website titled "Edukate - Online Education Website".
To uncover hidden subdomains or virtual hosts, I used ffuf to fuzz the Host header:
This technique filters out generic 178-byte responses and attempts to discover valid vhosts. It revealed:
This indicated the presence of a Grafana instance, likely accessible via http://grafana.planning.htb/. I added it to my /etc/hosts file to access it in the browser (I have previously done this manually using sudo nano /etc/hosts but you can add it by running the following command in your terminal):
Afterwards, I launched my browser and visited http://grafana.planning.htb. This displayed a webpage with a username and password text input field. Using the credentials from the machine information from Hack the Box, I was able to sign into the website.
I cloned the repository using the following command and navigated right into it:
Before running the exploit, I checked my IP address and start the netcat listener at port 6666 to listening to incoming connection:
I used a known exploit against Grafana v11, which allowed RCE via [CVE-2024-9264-RCE-Exploit in Grafana via SQL Expressions]. I used the following PoC:
sh: 0: can't access tty). Navigating around, I found myself in /usr/share/grafana, indicating that the shell is running inside the Grafana container or environment.By inspecting environment variables, I discovered admin credentials:
- Username:
enzo - Password:
RioTecRANDEntANT!
This could be useful for accessing Grafana’s web interface or reusing the credentials for lateral movement.
Key directories like /etc/grafana/provisioning and /var/lib/grafana were explored to find sensitive configs or databases.
enzo, I found the user.txt file and successfully captured the flag:Hurray!!! I got my user flag.
After securing the user flag as enzo, I then began local enumeration to search for paths to escalate privileges to root. Notably, I discovered a custom cron configuration file at:
- A daily backup job that archives a Docker image named root_grafana, compresses it, and zips it using the password P4ssw0rdS0pRi0T3c. This job is a strong candidate for privilege escalation via Docker image tampering or extraction.
- A privileged cleanup job that runs every minute:
This script executes as root. If I find a way to influence this script or its dependencies, I may achieve full privilege escalation. Next, I ran the netstat -tupln command to show active listening network services which allows me to find local services that aren't externally exposed:
Running netstat -tupln revealed that several services were only bound to 127.0.0.1, including a suspicious one on port 8000:
Since the service wasn't accessible externally, I used SSH local port forwarding to tunnel traffic from my attacker machine to the internal port:
http://localhost:8000 in my browser and interact with the internal service directly from my host system.Accessing the Crontab UI via Web Interface
After gaining access to the crontab.db file, I extracted the login credentials:
- Username:
root - Password:
P4ssw0rdS0pRi0T3c
Abusing Crontab UI for Privilege Escalation
To escalate privileges or establish persistence, I added a new job titled revshell, and used the following command:
- cp /bin/bash /tmp/bash: Copies the bash binary to /tmp
- chmod u+s /tmp/bash: Applies the SetUID bit to the copied binary, allowing any user executing /tmp/bash to run it with root privileges
This action effectively gave me a root shell by simply executing /tmp/bash later with elevated privileges. After the cron job executed (as set in the Crontab UI), I checked the /tmp directory and found a file named bash:
Among other systemd-generated temporary files and log output (*.stdout, *.stderr), the presence of the /tmp/bash binary confirmed that the cron job successfully copied the system's Bash binary into the /tmp directory and applied the SetUID bit:
This SetUID bit allows the binary to execute with the permissions of its owner, which in this case is root.
To confirm this, I ran the following command in the shell:
The -p flag preserves the privileged UID. The shell prompt changed, and running whoami confirmed root access:
Retrieving the Root Flag
With root access, I was able to read the flag stored in /root/root.txt:
Hurray!!! I got the root flag
Keywords:
variatype htb write up
variatype htb walkthrough
variatype.htb
hackthebox variatype
variatype htb machine solution
variatype hack the box write up
variatype hack the box walkthrough
cctv htb write up
cctv htb walkthrough
cctv.htb
hackthebox cctv
cctv htb machine solution
cctv hack the box write up
cctv hack the box walkthrough
pirate htb write up
pirate htb walkthrough
pirate.htb
hackthebox pirate
pirate htb machine solution
pirate hack the box write up
pirate hack the box walkthrough
interpreter htb write up
interpreter htb walkthrough
interpreter.htb
hackthebox interpreter
interpreter htb machine solution
interpreter hack the box write up
interpreter hack the box walkthrough
wingdata htb write up
wingdata htb walkthrough
wingdata.htb
hackthebox wingdata
wingdata htb machine solution
wingdata hack the box write up
wingdata hack the box walkthrough
pterodactyl htb write up
pterodactyl htb walkthrough
pterodactyl.htb
hackthebox pterodactyl
pterodactyl htb machine solution
pterodactyl hack the box write up
pterodactyl hack the box walkthrough
facts htb write up
facts htb walkthrough
facts.htb
hackthebox facts
facts htb machine solution
facts hack the box write up
facts hack the box walkthrough
overwatch htb write up
overwatch htb walkthrough
overwatch.htb
hackthebox overwatch
overwatch htb machine solution
overwatch hack the box write up
overwatch hack the box walkthrough
airtouch htb write up
airtouch htb walkthrough
airtouch.htb
hackthebox airtouch
airtouch htb machine solution
airtouch hack the box write up
airtouch hack the box walkthrough
browsed htb write up
browsed htb walkthrough
browsed.htb
hackthebox browsed
browsed htb machine solution
browsed hack the box write up
browsed hack the box walkthrough
eloquia htb write up
eloquia htb walkthrough
eloquia.htb
hackthebox eloquia
eloquia htb machine solution
eloquia hack the box write up
eloquia hack the box walkthrough
monitorsfour htb write up
monitorsfour htb walkthrough
monitorsfour.htb
hackthebox monitorsfour
monitorsfour htb machine solution
monitorsfour hack the box write up
monitorsfour hack the box walkthrough
fries htb write up
fries htb walkthrough
fries.htb
hackthebox fries
fries htb machine solution
fries hack the box write up
fries hack the box walkthrough
eighteen htb write up
eighteen htb walkthrough
eighteen.htb
hackthebox eighteen
eighteen htb machine solution
eighteen hack the box write up
eighteen hack the box walkthrough
nanocorp htb write up
nanocorp htb walkthrough
nanocorp.htb
hackthebox nanocorp
nanocorp htb machine solution
nanocorp hack the box write up
nanocorp hack the box walkthrough
conversor htb write up
conversor htb walkthrough
conversor.htb
hackthebox conversor
conversor htb machine solution
conversor hack the box write up
conversor hack the box walkthrough
hercules htb write up
hercules htb walkthrough
hercules.htb
hackthebox hercules
hercules htb machine solution
hercules hack the box write up
hercules hack the box walkthrough
darkzero htb write up
darkzero htb walkthrough
darkzero.htb
hackthebox darkzero
darkzero htb machine solution
darkzero hack the box write up
darkzero hack the box walkthrough
cobblestone htb write up
cobblestone htb walkthrough
cobblestone.htb
hackthebox cobblestone
cobblestone htb machine solution
cobblestone hack the box write up
cobblestone hack the box walkthrough
sorcery htb write up
sorcery htb walkthrough
sorcery.htb
hackthebox sorcery
sorcery htb machine solution
sorcery hack the box write up
sorcery hack the box walkthrough





























0 Comments