Cobblestone
Executive summary — Cobblestone is a six-link Insane Linux chain: a stored XSS becomes RCE thanks to a Selenium admin bot that visits suggested URLs; that privileged access triggers a Twig SSTI that gives RCE as
www-data, but AppArmor blocks nearly every interpreter — bypassed withmysqldumpto steal database hashes. After cracking a hash and getting SSH access to an account locked down with rbash + chroot, SSH port forwarding escapes the jail and reaches the Cobbler XML-RPC API, which with default credentials and a Cheetah template injection yields command execution as root. A XSS → Admin bot → SSTI → limited RCE → AppArmor bypass → restricted SSH → pivot → Cobbler → Root path.
| Platform | Hack The Box |
| Operating system | Linux (Debian 12 “Bookworm”, kernel 6.1.0-47-amd64) |
| Difficulty | Insane |
| Status | Active |
| Target IP | <TARGET_IP> |
Attack map
[80/HTTP] suggest_skin.php -> stored XSS (unsanitised 'url' parameter)
|
v
[BOT] 'john' cron job (every minute) -> headless Selenium logged in as admin
| visits every suggested URL -> fetch(credentials:'include') to preview_banner.php
v
[SSTI] Twig: $twig->createTemplate($first)->render() -> {{7*7}} = 49
| RCE via the map filter: {{ "id" |map("system")|join }}
v
[LIMITED RCE] www-data under AppArmor apache2//cobblestone (enforce)
| deny python3/perl/php/bash/sh -- mysqldump allowed (oversight)
v
[BYPASS] mysqldump dumps the users table -> unsalted SHA256 hashes
| hashcat -m 1400 rockyou -> cobble:iluvdannymorethanyouknow
v
[Restricted SSH] cobble@<TARGET_IP> -- rbash + ChrootDirectory
| non-interactive command -> user.txt
| ssh -L 25151:127.0.0.1:25151 -> port forwarding escapes the chroot
v
[COBBLER XML-RPC] login cobbler:cobbler (default credentials)
| generate_autoinstall + malicious Cheetah template (no sandbox)
v
[ROOT] os.popen() inside #set -> uid=0(root) -> root.txt
1. Reconnaissance
A full port scan, without throttling the packet rate too much:
nmap --privileged -p- --min-rate 5000 -T4 -Pn -oN nmap_allports.txt <TARGET_IP>
PORT STATE SERVICE
22/tcp open ssh
80/tcp open http
With default scripts and version detection on those two ports:
nmap --privileged -sC -sV -p22,80 -oN nmap_sc_sv.txt <TARGET_IP>
22/tcp open ssh OpenSSH 9.2p1 Debian 2+deb12u7 (protocol 2.0)
80/tcp open http Apache httpd 2.4.62
|_http-title: Did not follow redirect to http://cobblestone.htb/
Analysis: a minimal external surface — only SSH and HTTP. The rest of the internal infrastructure (MariaDB on
127.0.0.1:3306, Cobbler XML-RPC on127.0.0.1:25151) is only reachable from inside the host: exploiting either of those later will require a shell or a pivot first.
Root Access unlocks the content you can't see — everything else on the site is already open.
See Root Access plansNo account? Create one free then upgrade from your console.