┌──(root㉿kali)-[~/box/pandora]
└─# nmap -sC -sV -p- panda.htb
Starting Nmap 7.94 ( https://nmap.org ) at 2024-06-17 00:16 EDT
Nmap scan report for panda.htb (10.10.11.136)
Host is up (0.046s latency).
Not shown: 65533 closed tcp ports (reset)
PORT STATE SERVICE VERSION
22/tcp open ssh OpenSSH 8.2p1 Ubuntu 4ubuntu0.3 (Ubuntu Linux; protocol 2.0)
| ssh-hostkey:
| 3072 24:c2:95:a5:c3:0b:3f:f3:17:3c:68:d7:af:2b:53:38 (RSA)
| 256 b1:41:77:99:46:9a:6c:5d:d2:98:2f:c0:32:9a:ce:03 (ECDSA)
|_ 256 e7:36:43:3b:a9:47:8a:19:01:58:b2:bc:89:f6:51:08 (ED25519)
80/tcp open http Apache httpd 2.4.41 ((Ubuntu))
|_http-server-header: Apache/2.4.41 (Ubuntu)
|_http-title: Play | Landing
Service Info: OS: Linux; CPE: cpe:/o:linux:linux_kernel
Service detection performed. Please report any incorrect results at https://nmap.org/submit/ .
Nmap done: 1 IP address (1 host up) scanned in 24.39 seconds
damn this is tough not getting anything from directory enumeration and no subdirectories apparently either
missed finding #1
run nmap -sU to scan udp ports too, maybe you missed something
PORT STATE SERVICE
161/udp open snmp
1036/udp open|filtered nsstp
4672/udp open|filtered rfa
18156/udp open|filtered unknown
18958/udp open|filtered unknown
19273/udp open|filtered unknown
19707/udp open|filtered unknown
20004/udp open|filtered unknown
21898/udp open|filtered unknown
31189/udp open|filtered unknown
32768/udp open|filtered omad
36778/udp open|filtered unknown
PORT STATE SERVICE VERSION
161/udp open snmp SNMPv1 server; net-snmp SNMPv3 server (public)
| snmp-info:
| enterprise: net-snmp
| engineIDFormat: unknown
| engineIDData: 48fa95537765c36000000000
| snmpEngineBoots: 30
|_ snmpEngineTime: 47m26s
| snmp-netstat:
| TCP 0.0.0.0:22 0.0.0.0:0
| TCP 10.10.11.136:39804 1.1.1.1:53
| TCP 127.0.0.1:3306 0.0.0.0:0
| TCP 127.0.0.53:53 0.0.0.0:0
| UDP 0.0.0.0:161 *:*
|_ UDP 127.0.0.53:53 *:*
| snmp-interfaces:
| lo
| IP address: 127.0.0.1 Netmask: 255.0.0.0
| Type: softwareLoopback Speed: 10 Mbps
| Traffic stats: 482.42 Kb sent, 482.42 Kb received
| VMware VMXNET3 Ethernet Controller
| IP address: 10.10.11.136 Netmask: 255.255.254.0
| MAC address: 00:50:56:b0:44:ee (VMware)
| Type: ethernetCsmacd Speed: 4 Gbps
|_ Traffic stats: 600.83 Mb sent, 68.26 Mb received
| snmp-sysdescr: Linux pandora 5.4.0-91-generic #102-Ubuntu SMP Fri Nov 5 16:31:28 UTC 2021 x86_64
|_ System uptime: 47m25.61s (284561 timeticks)
| snmp-processes:
SNMP enumeration
┌──(root㉿kali)-[~/box/pandora]
└─# snmpwalk -v 1 -c public 10.10.11.136 > snmpwalk.out

we can login to ssh with this
INSERT INTO `tusuario`
(`id_user`, `fullname`, `firstname`, `lastname`, `middlename`, `password`, `comments`, `last_connect`, `registered`, `email`, `phone`, `is_admin`, `language`, `block_size`, `section`, `data_section`, `metaconsole_access`)
VALUES
('admin', 'Pandora', 'Pandora', 'Admin', '', '1da7ee7d45b96d0e1f45ee4ee23da560', 'Admin Pandora', 1232642121, 0, 'admin@example.com', '555-555-5555', 1, 'default', 0, 'Default', '', 'advanced');
pw -> pandora
this is kindof a rabbit hole but maybe useful later
PORT FORWARDING

 
localhost is on port 80 here
maybe we can try the details we got earlier here protip they dont work
[[Pivoting#PROXYCHAINS]] to use shit against this site

we have a version number here tho https://defendtheweb.net/discussion/614-read-a-websites-db-using-sqlmap-proxychains
https://github.com/shyam0904a/Pandora_v7.0NG.742_exploit_unauthenticated
sqlmap with proxychains
SQLMAP usage
 

tsessions_php looks interesting   we travel to:
http://localhost/pandora_console/include/chart_generator.php?session_id=g4e01qdgk36mfdh90hvcc54umq which appears to put their session into our cookie properties going back to http://localhost/pandora_console shows us logged in as matt
https://www.coresecurity.com/core-labs/advisories/pandora-fms-community-multiple-vulnerabilities there's a vulnerability with the /events endpoint that allows code execution

 which gives us a shell
secondarily we can get the admin PHPSESS cookie and get the ability to upload files. we can upload a php reverse shell and send a bash session to ourselves. [[Pivoting#From php webshell curl to send bash session back to yourself]]  
check suid binaries 
we can't actually run /usr/bin/pandora_backup so checkout >>
checkout [[Pivoting#Dropping your SSH public key into authorized_keys]]
It’s doing a backup, with a long list of paths, all in `/var/www/pandora`. At the top it references `tar` a couple times, which suggests it’s using `tar` to compress/archive.

ltrace - 
It crashes because it doesn’t have permissions to `/root/.backup/pandora-backup.tar.gz`, which makes sense since `ltrace` drops the privs from SUID.
Still, I’ll note that it’s using `system` to call `tar` without a full path
Because there’s no path given for `tar`, it will use the current user’s `PATH` environment variable to look for valid executables to run. But I can control that path, which makes this likely vulnerable to path hijack.