# Hunt Upload

> Turn an upload surface into evidence-carrying CANDIDATES for upload

- Skill: `encod3d-sec/hunt-upload-2` (Agent Skill, multi-file: 3 files)
- Install (CLI): `npx get-skill add encod3d-sec/hunt-upload-2`
- Raw SKILL.md: https://api.skillmd.com/api/skills/encod3d-sec/hunt-upload-2/raw
- Safety review: pending
- Works with: Claude Code, Claude.ai, OpenAI Codex
- Category: Security
- Author: Encod3d-Sec (https://skillmd.com/u/encod3d-sec)
- Updated: 2026-11-16
- Page: https://skillmd.com/skills/encod3d-sec/hunt-upload-2

---


# Hunt: File Upload (golden-image rework)

Turn an upload surface into evidence-carrying CANDIDATES for upload
bypasses: extension/content-type/magic-byte layers, filename traversal,
SVG/XML dual-purpose payloads, archive extraction, image-processor
abuse. This skill produces candidates, never verdicts - findings leave
ONLY through the G1 proof gate (triage).

> Current emphasis (update on wiki harvest): sink-proof baselines
> before bypass work and combined polyglot / magic-byte layers over
> single extension swaps - 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: [[file-upload]] - Payload arsenal:
`wiki/payloads/file-upload.md`
Anchors: [[path-traversal-lfi]], [[xxe]]
**REFS:** [[file-upload]], wiki/payloads/file-upload.md

mcp__wiki-search__query (lex) "file upload webshell extension content-type magic-byte
bypass SVG XXE zip slip path traversal" via wiki-search MCP - ONLY on
a concrete hint the map above does not cover; not a blanket first
step.

Shared bypass arsenal (blocked implies research, but walk this first): `skills/exploit/hunt/hunt-upload/references/bypass-arsenal.md` - CSPT upload-path traversal, malformed part Content-Type -> stored XSS (no nosniff), same-family extension policy diff (jspx vs jsp), nginx include replacement, uWSGI .ini-in-binary, PNG chunk payload survival, writer-endpoint = RCE doctrine.

## 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/upload/<host>
    # VM side (WHERE tools run, same tree through the VMware share):
    ENG_DIR=/mnt/VMshare/<eng>/<eng>
    RUN=$ENG_DIR/hunt/upload/<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/
<eng> 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; quotes ship as base64
  (`echo <b64> | base64 -d | bash` inside the vm-ssh argument).
- Non-login shells do NOT source profile.d: target-facing fetches MUST
  use /opt/scope-shim/bin/{curl,httpx} by absolute path.
- Shim verdict semantics (verified live): out-of-scope dies rc 126
  (never work around); in-scope passes; UNKNOWN gets an ADVISORY -
  not approval; verify against scope.md and self-deny.
- Upload requests ride the Burp seat (multipart editing + Repeater
  confirmation); the VM loop only fetches stored files back.

## Entry gate

All four must pass; each is falsifiable:

1. Active engagement exists (repo tree targets/<eng>/active.md) and
   <host> is on targets/<eng>/scope.md in-scope. Scope-guard is the
   deny. (targets/ is the repo admin tree; $ENG_DIR holds corpus and
   run artifacts only - see Paths.)
2. hunt-core loaded (skills/exploit/hunt/hunt-core/SKILL.md).
3. Producer verified - at least ONE of:
   (a) $ENG_DIR/state.md asset table has >= 1 upload/import endpoint
   row for <host>; \
   (b) $ENG_DIR/js/<domain>/findings/endpoints.jsonl parses (upload/
   avatar/import/attachment paths count); \
   (c) kickoff seeded $RUN/raw/upload-map.md.
   None = dispatch the surface lane first.
4. Toolchain preflight (fails LOUD):

       # install-on-demand (operator rule): try interactsh before the fatal loop
       [ -x /home/tz/go/bin/interactsh-client ] || { \
           command -v go >/dev/null \
             && HOME=/home/tz go install github.com/projectdiscovery/interactsh/cmd/interactsh-client@v1.2.0 2>/dev/null; }
       for t in /usr/bin/jq /usr/bin/python3 \
                 /opt/scope-shim/bin/curl \
                 /home/tz/go/bin/interactsh-client; do
         [ -x "$t" ] || { echo "MISSING TOOL: $t"; exit 1; }
       done

## Checklist (mandatory)

Copy checklist.md (this skill's dir) to
`$ENG_DIR/hunt/upload/<host>/upload-checklist.md` at run start.
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; NOTE: completion-gate emits
its own generic nudge - both mean: 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.

## Confirmation gate

**NOT confirmation:** the upload was accepted; a 200 or a returned
file URL; the file shows up in a listing; a stored path you have not
fetched back; a script uploaded but never requested; a traversal
filename accepted with nothing actually read or written outside the
upload dir.

**IS confirmation:** the uploaded file EXECUTED as code - fetched
back, it runs your command (?cmd=id returns output) or fires an OOB
callback when blind; or the traversal demonstrably wrote or read
outside the upload dir, proven by fetching that target back. SVG/XML:
the script fires in a victim context, or the external entity returns
file contents / an OOB hit. Reproduce in a clean session.

## Methodology

**Rank the sinks first** - not every upload reaches code: avatar/
profile/logo/signature fields (most common; frequently re-encoded -
check whether original bytes are served back); document/CSV/XML import
(parser sinks: XXE, formula injection, zip); ticket/message
attachments (often served under original name + type from a reachable
path); image processing (thumbnails -> ImageMagick/Ghostscript, SVG/
PDF render, EXIF parsers - the PROCESSOR is the bug, not the store);
firmware/plugin/theme upload (direct code load - highest value when
present).

Then attack in LAYERS, cheapest first: extension -> content-type ->
magic-byte -> parser/render.

### Step 1 - Baseline + sink proof

Fingerprint the executing language first when routes hide extensions
(probe /index.php /index.asp /index.aspx /index.jsp) - the shell must
match the runtime. Upload a valid file; note stored path, returned
URL, filename transformation, reachability, execution. A benign echo
probe is the cheapest execution test (raw source echoed back = stored,
NOT executed). **Prove a SINK exists before any bypass work:** if
storage is a DB blob returned as base64 JSON with no serve or render
route anywhere, the vector is dead no matter how weak the filter -
close the lane there [[file-upload]]. Row schema `sink | stored path |
reachable? | executes? | re-encoded?` @ $RUN/raw/upload-map.md.

### Step 2 - Extension ladder

If rejection fires before any HTTP request leaves the browser (JS-only
validation), rename the multipart filename in Burp or strip the
onchange/accept handler in dev tools. Otherwise:

    shell.php  shell.phtml  shell.php5  shell.phar  shell.pHp
    shell.php.jpg   shell.jpg.php   shell.php%00.jpg   shell.php;.jpg
    shell.php/   shell.php....   (trailing dot/space on Windows)
    .htaccess  ->  AddType application/x-httpd-php .jpg  (then .jpg shell)
    web.config (IIS)   .jsp/.jspx/.war (Java)   .asp/.aspx (IIS)

@ $RUN/probes/extension.jsonl.

### Step 3 - Content-Type / magic-byte / polyglot

Content-Type: image/png; prepend real magic bytes (GIF89a;, \xFF\xD8\xFF
JPEG, %PDF-) before the payload; polyglot (valid image + PHP). Combine
layers - a single-layer allowlist rarely survives extension +
content-type + magic-byte applied together. @ $RUN/probes/layers.jsonl.

### Step 4 - Filename path traversal

    filename="../../../../var/www/html/shell.php"

Escape the upload dir / overwrite files; confirm by fetching the
written target back. @ $RUN/probes/traversal.jsonl.

### Step 5 - SVG / XML dual payloads

SVG with <script> -> stored XSS (hunt-xss); SVG/XML with external
entity -> XXE (hunt-injection; OOB-mandatory for blind). @
$RUN/probes/svg-xml.jsonl.

### Step 6 - Archive extraction

Zip-slip (../ paths inside zip) on extract; symlink in archive ->
read host files. @ $RUN/probes/archive.jsonl (N/A: no archive-extract
feature).

### Step 7 - Image processing

ImageMagick/Ghostscript (ImageTragick CVE-2016-3714), pixel-flood DoS
(RoE: no_dos caps the flood - bounded proof only), EXIF payload
executed by a downstream parser. @ $RUN/probes/processor.jsonl (N/A:
no server-side image processing).

### Step 8 - Execution confirmation (through Burp)

Request the uploaded shell in Burp Repeater and run a command
(?cmd=id); OOB callback if blind (oob.md row, class upload - a blind
claim REQUIRES a HIT row). For traversal, fetch the written/read
target back from the path claimed. @ $RUN/probes/execution.jsonl.

### Step 9 - Exit artifact (candidates)

candidates.md every class section present; pointer
$ENG_DIR/hunt-upload-<host>.md:

    UPLOAD-HUNT-DONE sinks=<n> extension=<n> layers=<n> traversal=<n>
    svg-xml=<n> archive=<n> processor=<n> executed=<n>

Plus _requests.md rows (lane = hunt-upload), state.md asset rows,
Deadends rows with the WHY (layers cleared vs held). Every probe JSONL
row: {class, host, endpoint, method, evidence, observed, confidence};
pairs under probes/raw/ (sha256 filenames).

## Evasion (when a layer rejects)

Double extension, null byte, content-type spoof, magic-byte prefix,
case variation. Against a denylist, fuzz the extension in Intruder
(marker on the extension only, payload encoding OFF), sort by response
length to cluster accepted vs rejected; an extension that uploads may
still not execute - cycle the accepted list until one runs.

## Cloud/object-storage uploads (S3 presigned URLs)

When the app mints presigned PUT/GET URLs (SigV4 query style):
- EVERY query parameter except `X-Amz-Signature` is part of the signed
  canonical request - response-content-disposition, content-type overrides,
  and key fields CANNOT be stripped or changed on the URL without breaking
  the signature (403 SignatureDoesNotMatch). Do not burn probes on URL
  tampering; the escalation surface is the MINT input instead (optional
  fields like key/filename/path that pass GraphQL validation - probe each
  with typed values: null, number, bool, object, empty, oversized; string
  shapes that resolver-ISE may hide deeper acceptance).
- `X-Amz-SignedHeaders=host` means only the host header is signed: attacker
  FULLY controls uploaded Content-Type and body. If the serve path ever
  renders stored objects inline, attacker-chosen text/html executes - map
  every render/download consumer before closing severity.
- Bucket keys are usually server-generated (UUIDv1-style); verify by
  sending input shapes with candidate key/filename fields and checking
  whether the returned URL ever embeds them.
- Anonymous HEAD on a 403 bucket typically returns a bare 403 with zero
  headers - no metadata leak. Objects persist after URL expiry; purge
  lists are the only cleanup.

## Chaining

- Upload -> web-shell RCE: once a shell executes, hunt-rce owns post-
  exploitation. Prefer an uploaded reverse shell when egress allows;
  fall back to the web shell when egress filtering or disabled
  functions block the callback.
- SVG/HTML -> stored XSS: hunt-xss (marker discipline, blind beacon).
- SVG/XML/DOCX -> XXE: hunt-injection (OOB-mandatory).

## Validation

- Proof = the uploaded content EXECUTES or is SERVED as active content
  to a browser (upload + path + parser all confirmed). A file stored
  on disk is storage, not RCE.
- Negative control: same upload with a benign extension lands inert;
  the pair isolates the execution cause.

## False Positives

- Polyglot stored but never parsed (S3 with correct Content-Type =
  inert bytes).
- Client-side validation bypassed but server re-validates (stored
  nothing).
- AV quarantine read as "upload failed" (it succeeded, then tripped).
- Image re-encode stripping your payload (resized server-side).
- Upload to a bucket with no public/read path at all.

## Cross-routing

- hunt-rce once code execution is confirmed (this skill ends at file
  exec).
- hunt-xss for SVG/HTML payload impact in browsers.
- hunt-deserialization for serialized-object uploads.
- Not this skill: avatar/document storage with no render or exec sink.

## Severity

CRITICAL if code execution; HIGH if stored XSS / XXE / arbitrary file
write to a sensitive path; MEDIUM if upload of a dangerous type with
no execution path proven.

## Deadends

    Append: - [ ] upload <host> <endpoint> -- ext+CT+magic+traversal
    all blocked; files re-encoded + served from CDN no-exec; no sink
    (DB-blob storage, no serve route)

Record which layers you cleared and which held.

## N/A escapes

- "N/A: no upload endpoint"
- "N/A: no archive-extract feature"
- "N/A: no server-side image processing"
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

Freehand run: skip checklist + numbered steps, one freehand pass over
the upload map, output ONLY $RUN/analysis/bitter-pill.md (tried/found/
dismissed, every claim carries evidence). The execution gate survives
freehand. Declare with a _requests.md row (lane =
hunt-upload-bitterpill).

### 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 + candidates.md +
$ENG_DIR/hunt-upload-<host>.md (pointer with UPLOAD-HUNT-DONE +
counts). Consumer (triage) finds at $RUN: raw/upload-map.md,
probes/*.jsonl, probes/raw/, candidates.{jsonl,md}. Findings leave
ONLY through G1. Distill: `python3 scripts/wiki-stage.py --kind
technique --slug <slug> --target-page techniques/web/file-upload.md`.

After writing `$RUN/surfaces.jsonl`, import the discovered upload
and param surfaces into the hunt feed: one JSON row per surface
`{"surface": "<endpoint|param>", "host": "<host>",
"class_hint": "upload"}`, then
`python3 scripts/surface_backlog.py <eng> import-jsonl
$RUN/surfaces.jsonl --source hunt-upload`.

## Stop conditions

Terminal states complete; nothing written into skill dirs; no
unchecked boxes above REVIEW; hunt-core stop conditions fire unchanged
(pixel-flood proofs bounded by no_dos; destructive writes never).

## Attack surface

**APPROACH:** Rank the sinks (avatar/import/attachment/image-processor/plugin), then attack in layers cheapest-first (extension -> content-type -> magic-byte -> parser/render), and confirm by fetching the uploaded file back and executing it through Burp.
**AVOID:** Upload accepted, a 200, a returned URL, or a stored path you never fetched is NOT confirmation - the file must execute as code (`?cmd=id` returns output / OOB hit) or the traversal must demonstrably read/write outside the upload dir.

