RedPanda

Recon

chevron-rightnmap_scan.loghashtag
Open 10.129.227.207:22
Open 10.129.227.207:8080
[~] Starting Script(s)
[>] Running script "nmap -vvv -p {{port}} {{ip}} -sV -sC -Pn" on ip 10.129.227.207

PORT     STATE SERVICE REASON  VERSION
22/tcp   open  ssh     syn-ack OpenSSH 8.2p1 Ubuntu 4ubuntu0.5 (Ubuntu Linux; protocol 2.0)
| ssh-hostkey: 
|   3072 48:ad:d5:b8:3a:9f:bc:be:f7:e8:20:1e:f6:bf:de:ae (RSA)
| ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABgQC82vTuN1hMqiqUfN+Lwih4g8rSJjaMjDQdhfdT8vEQ67urtQIyPszlNtkCDn6MNcBfibD/7Zz4r8lr1iNe/Afk6LJqTt3OWewzS2a1TpCrEbvoileYAl/Feya5PfbZ8mv77+MWEA+kT0pAw1xW9bpkhYCGkJQm9OYdcsEEg1i+kQ/ng3+GaFrGJjxqYaW1LXyXN1f7j9xG2f27rKEZoRO/9HOH9Y+5ru184QQXjW/ir+lEJ7xTwQA5U1GOW1m/AgpHIfI5j9aDfT/r4QMe+au+2yPotnOGBBJBz3ef+fQzj/Cq7OGRR96ZBfJ3i00B/Waw/RI19qd7+ybNXF/gBzptEYXujySQZSu92Dwi23itxJBolE6hpQ2uYVA8VBlF0KXESt3ZJVWSAsU3oguNCXtY7krjqPe6BZRy+lrbeska1bIGPZrqLEgptpKhz14UaOcH9/vpMYFdSKr24aMXvZBDK1GJg50yihZx8I9I367z0my8E89+TnjGFY2QTzxmbmU=
|   256 b7:89:6c:0b:20:ed:49:b2:c1:86:7c:29:92:74:1c:1f (ECDSA)
| ecdsa-sha2-nistp256 AAAAE2VjZHNhLXNoYTItbmlzdHAyNTYAAAAIbmlzdHAyNTYAAABBBH2y17GUe6keBxOcBGNkWsliFwTRwUtQB3NXEhTAFLziGDfCgBV7B9Hp6GQMPGQXqMk7nnveA8vUz0D7ug5n04A=
|   256 18:cd:9d:08:a6:21:a8:b8:b6:f7:9f:8d:40:51:54:fb (ED25519)
|_ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIKfXa+OM5/utlol5mJajysEsV4zb/L0BJ1lKxMPadPvR
8080/tcp open  http    syn-ack Apache Tomcat (language: en)
|_http-title: Red Panda Search | Made with Spring Boot
| http-methods: 
|_  Supported Methods: GET HEAD OPTIONS
Service Info: OS: Linux; CPE: cpe:/o:linux:linux_kernel

HTTP (8080)

We have only "Search For Pandas" which is reflected to us right away, when I tried SSTI payload it got denied.

Writeup.png

If we go to random path application gives us Whitelabel Error Page -> Spring Boot Remove Whitelabel Error Pagearrow-up-right

https://book.hacktricks.xyz/pentesting-web/ssti-server-side-template-injection#spring-framework-javaarrow-up-right

*{7*7} returns 49, SSTI confirmed

Writeup-1.png

Get reverse shell

Reverse Shell (woodenk)

User.txt

SSH (22) (woodenk)

Upgrade shell to SSH

Hmm... User is no longer part of logs group from SSH login.

Privilege Escalation

There's some cleanup script in the /opt so some service or user is running these as cronjob (probably). /etc/crontabs is empty so can't determine script.

Download pspy and observe the processes

View the source:

The log looks like following

The program only processes lines that has .jpg in the URL. Then it's parsing lines by splitting line on || and create dictionary. Then it's going to get artist based on Artist attribute from image metadata and it's going to parse that XML.

Available images:

Note: We have access to this directory from Reverse Shell, because that session is part of logs group.

Create malicious jpg image

Create malicious XML: https://book.hacktricks.xyz/pentesting-web/xxe-xee-xml-external-entity#read-filearrow-up-right

Poison the log:

After cronjob runs:

We have LFI as root, let's try leaking the SSH key (if it exists)

Root.txt

Last updated