Retired machine. Credentials and flags redacted - solve it yourself.
Summary
IDOR exposes another user’s packet capture, which leaks FTP/SSH credentials. Root comes from a Python capability (os.setuid(0)).
Enumeration
sudo nmap -sC -sV -oA nmap/cap 10.10.10.245
21/tcp open ftp vsFTPd 3.0.3
22/tcp open ssh OpenSSH 7.2p2 Ubuntu
80/tcp open http Gunicorn 19.9.0
- FTP banner (vsFTPd 3.0.3) - not exploitable here.
- Port 80: Gunicorn → Flask app. Page source showed I was already logged in as Nathan.
Foothold
- Logout button didn’t work and there was no redirect → hinted at a web flaw.
- URL contained
/ip/data/2(session-specific). Changing it to/ip/data/1,/ip/data/0returned other users’ data → IDOR. - Downloaded a PCAP via the IDOR and opened it in Wireshark.
- Found an FTP conversation; following the TCP stream revealed Nathan’s FTP credentials.
ftp 10.10.10.245 # login as nathan → success (low-priv, uid 1001)
ssh nathan@10.10.10.245 # same password → user shell
Privilege Escalation
- Found
app.py(the web app) running as root. - It used
os.setuid(0)- lets the process set its UID to 0. - Leveraged that capability to spawn a root shell:
os.system('sh')
cat /root/root.txt
Lessons Learned
- IDOR: always fuzz numeric ids in URLs.
- Inspect credentials inside captured traffic (Follow TCP Stream).
- Check Python capabilities / files running as root during privesc.