root@thehacksparrow:~/writeups$ SYSTEM ONLINE
root@sparrow:~/writeups$ cat redpanda.md
// writeups

RedPanda

9 Jul 2022 · 13 min read · root access
RedPanda - maquina de Hack The Box

Executive summary — RedPanda is a very Java-focused Easy Linux box. The «Red Panda Search» site (Spring Boot) is vulnerable to SSTI on the Thymeleaf engine, giving RCE as woodenk. For escalation, that same user belongs to the logs group and can write to a log file that a root process (launched by cron) processes periodically: that process opens every image referenced in the log, reads its EXIF Artist metadata field and uses it to build the path of an XML it parses without protection against external entities. By controlling the log line, the image and the metadata, we make root parse our own XXE that reads its SSH key. Path: SSTI → woodenk → poisoned log/EXIF → XXE (root cron) → root.

PlatformHack The Box
Operating systemLinux
DifficultyEasy
StatusRetired
Target IP10.129.227.207

Attack map

[8080] Red Panda Search → search box → SSTI (Thymeleaf, *{...}) → RCE
   ▼
[SHELL]  woodenk  (user.txt)
   │  id → group "logs": redpanda.log is group-writable
   ▼
[PSPY]  root cron every ~2 min → LogParser.jar (App.java)
   │  reads redpanda.log line by line → URI → JPG image → EXIF Artist → XML
   ▼
[XXE]  URI (traversal) + Artist (traversal) point to our own XML
   │  <!ENTITY foo SYSTEM "file:///root/.ssh/id_rsa"> parsed as root
   ▼
[ROOT]  root SSH key → root.txt

1. Reconnaissance

nmap -sVC 10.129.227.207
22/tcp   open  ssh
8080/tcp open  http

Only two ports: SSH and a web app on http://10.129.227.207:8080. The page title is surprisingly generous with information: «Red Panda Search — Made with Spring Boot». Knowing the backend is Spring Boot already points at a usual suspect in Java land: its default template engine, Thymeleaf, vulnerable to SSTI whenever it concatenates user input carelessly.

🔒 Clearance required

This content is Root Access only. Everything else on the site — the free tier, the whole public library — stays open.

See Root Access plans

No account? Create one free then upgrade from your console.