root@thehacksparrow:~/writeups$ SYSTEM ONLINE
root@sparrow:~/writeups$ cat cap.md
// writeups

Cap

5 Jun 2021 · 10 min read · user access
Cap - maquina de Hack The Box

Executive summary — Cap is a very elegant Easy Linux box with no public exploit involved: everything rests on design flaws. An IDOR in a «security» dashboard lets us download another session's network capture (.pcap), where cleartext FTP credentials travel; with them we log into FTP and SSH (password reuse), and the final escalation abuses a Linux capability (cap_setuid) granted to python3.8 to become root without touching sudo or SUID. An IDOR → PCAP → FTP/SSH → capabilities → root path.

PlatformHack The Box
Operating systemLinux
DifficultyEasy
StatusRetired
Target IP10.129.17.19

Attack map

[80] security dashboard · /capture → /data/1
   │  IDOR: change the ID → /data/0 downloads 0.pcap (another session capture)
   ▼
[PCAP]  Wireshark → cleartext FTP traffic → nathan:Buck3tH4TF0RM3!
   ▼
[FTP]  login nathan → user.txt
   ▼
[SSH]  nathan → interactive shell
   │  find -perm -4000 → nothing useful · getcap → /usr/bin/python3.8 = cap_setuid+ep
   ▼
[ROOT]  python3.8 -c "os.setuid(0); os.system('/bin/bash')"

1. Reconnaissance

As always, we start with a full port scan instead of trusting nmap's default top-1000: on HTB boxes you never know which «odd» service is hiding on a high port.

nmap -p- --open -n -T5 -v 10.129.17.19

Why these flags:

  • -p- → scans all 65535 ports, not just the most common ones.
  • --open → only shows ports that answer as open, keeping the output clean.
  • -n → no DNS resolution, faster scan.
  • -T5 → very aggressive timing template (lab network, no IDS to worry about).
  • -v → verbose mode, so ports show up as they're confirmed.
21/tcp  open  ftp
22/tcp  open  ssh
80/tcp  open  http

Analysis: three very classic services —FTP, SSH and HTTP—. The «web with something interesting + FTP with credentials + SSH to get in» pattern is common on Easy boxes, so we start with the web.

🔒 Free account required

This is USER ACCESS content — free to unlock, no payment. The rest of the write-up (and everything else at this level) opens up once you're signed in.

Create a free account