# Hunt Xss Dom

> DOM-XSS expert of the xss split: the vuln lives in client-side

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

---


# Hunt: XSS - DOM expert (microskill)

DOM-XSS expert of the xss split: the vuln lives in client-side
JavaScript - a source (hash, search, postMessage, referrer, name)
flows into a sink (innerHTML, document.write, eval, jQuery .html).
The mapper (hunt-xss) owns class routing; this skill owns the
source->sink analysis, the browser discipline, and the CSP verdict.

The load-bearing idea: DOM claims need the sink observed in the LIVE
Inspector (post-load DOM), never view-source - the DOM source is the
pre-mutation document and will lie to you.

## Wiki

Hub: [[wiki/techniques/web/xss]] - Primary page: [[wiki/techniques/web/xss]]
Anchors: [[wiki/techniques/web/xss]] (if harvested), [[wiki/techniques/web/xss]],
[[prototype-pollution]]
**REFS:** [[wiki/techniques/web/xss]]

qmd on hint only: "dom xss postmessage innerhtml sink source csp
mutation mxss prototype pollution gadget" - the xss page first.

## Paths (binding - shared with the mapper run)

    # seat side (wsl):
    ENG_DIR=/mnt/c/Users/Lenovo/Desktop/VMshare/<eng>/<eng>
    RUN=$ENG_DIR/hunt/xss/<host>          # SHARED with hunt-xss
    # VM side:
    ENG_DIR=/mnt/VMshare/<eng>/<eng>
    RUN=$ENG_DIR/hunt/xss/<host>

Experts write probes/xss-dom*.jsonl into the mapper's $RUN tree.

## 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); one argument per call; quotes
  ship as base64 (`echo <b64> | base64 -d | bash`).
- Static-asset fetches via /opt/scope-shim/bin/curl; out-of-scope dies
  rc 126 (never work around); UNKNOWN = ADVISORY, self-deny.
- Browser runs on the seat (real browser, live Inspector). jsluice
  over the JS corpus runs on the VM when the source needs a first
  pass: /home/tz/go/bin/jsluice.

## Entry gate

All four must pass; each is falsifiable:

1. Active engagement exists; the page/origin is on targets/<eng>/
   scope.md in-scope. Scope-guard is the deny.
2. hunt-core loaded (skills/exploit/hunt/hunt-core/SKILL.md).
3. Mapper verified: $RUN/raw/reflection-map.md exists AND the
   XSS-HUNT-DONE pointer names dom in next=. Missing = dispatch
   hunt-xss first. ALSO: the JS corpus from the recon lane must exist
   (js.md / bundle paths) - DOM analysis without source is guessing;
   missing = dispatch the JS inventory lane first.
4. Toolchain preflight (fails LOUD):

       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/jsluice ] \
         || echo "ADVISORY: jsluice absent - manual source reading"

## Checklist (mandatory)

Copy checklist.md (this skill's dir) to
`$ENG_DIR/hunt/xss/<host>/xss-dom-checklist.md` at run start.
Unchecked at stop = UNCHECKED lane, re-run from the first unchecked
step. SKILL.md 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:** a source and a sink found in the code but no
proven flow; a payload that only works on your local copy; a sink
"visible" in view-source.

**IS confirmation:** the flow proven (file:line chain) AND the
payload EXECUTED through the winning source with the sink observed in
the live DOM Inspector post-load; console captured before navigation;
reproduced from your own written steps.

## Methodology

### Steps 1-3 - Source -> sink analysis

- Sources: location.hash, location.search, postMessage listeners
  (check origin validation), document.referrer, window.name.
- Sinks: innerHTML/outerHTML, document.write, eval/Function, jQuery
  .html()/.append(), script src assignment, location redirects.
- JOIN them: reachable flows get rows (`source | sink | flow proof`),
  dead sinks and unreachable sources get deadend rows. Join with the
  js-parser gadget/symbol table when the corpus has one - a sink
  behind a gadget call is still a sink.

### Steps 4-6 - Validation + CSP

- Browser discipline: console captured BEFORE navigation; networkidle
  wait; sink observed in the LIVE Inspector (post-load) - never
  view-source.
- Payload through the winning source: execution captured
  (alert(window.origin) or DOM mutation observed); console +
  screenshot into targets/<eng>/poc/.
- CSP analysis: enforced vs report-only (report-only is NOT a
  mitigating control - record which); script-src nonce/strict-dynamic
  impact on the chosen sink recorded in the row.

### Steps 7-8 - Sub-branches

- **mXSS**: sink mutation paths - sanitized-looking payloads that
  mutate AFTER the sink write (namespace confusion, innerHTML
  round-trips).
- **Prototype-pollution gadgets**: pollutable merge/set paths joined
  to gadgets (script.src hijack, sanitizer bypass via polluted
  templates). Both are sub-branches HERE (per the split design), not
  separate skills.

### Step 9 - Exit

Append rows to the mapper's $RUN/candidates.jsonl;
`XSS-DOM-DONE flows=<n> executed=<n> csp=<enforced|report-only|none>`
appended to the mapper pointer $ENG_DIR/hunt-xss-<host>.md;
_requests.md rows (lane = hunt-xss-dom); Deadends per dead sink /
unreachable source.

## Chaining

- Server reflection feeds the same page -> hunt-xss-reflected.
- postMessage from another origin in scope -> cross-check that
  origin's sender (the vuln may be the pair).
- LLM-rendered markdown into a DOM sink -> hunt-llm joint row.

## Validation

- Proof = live-Inspector sink observation + execution through the
  source; console captured pre-navigation.
- Negative control: same navigation without the source param leaves
  the DOM clean.

## False Positives

- Sink behind a dead branch (feature flag off, A/B variant).
- postMessage listener that validates origin correctly.
- CSP enforced with strict-dynamic killing every injection vector -
  a real mitigating control, record it and deadend honestly.
- view-source "evidence" (pre-mutation DOM).

## Severity

HIGH = executed, sink reachable from an attacker-controlled link
(hash/postMessage). MEDIUM = referrer/name sources (weaker delivery).
LOW = local-only sink (extension/dev page).

## N/A escapes

- "N/A: no mutation sink" (mXSS round-trip evidence)
- "N/A: no pollutable path" (merge-path inventory)
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 JS corpus, output ONLY $RUN/analysis/bitter-pill.md. The
live-Inspector gate survives freehand. Declare with a _requests.md row
(lane = hunt-xss-dom-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

Appends into the shared mapper $RUN: probes/xss-dom*.jsonl,
raw/dom-{sources,sinks}.md, analysis/dom-flows.md, candidates.jsonl
rows, pointer line XSS-DOM-DONE. Consumer: triage. Findings leave ONLY
through G1. Distill: `python3 scripts/wiki-stage.py --kind technique
--slug <slug> --target-page techniques/web/xss.md`.

## Stop conditions

All steps terminal; live-Inspector evidence for every claimed flow;
nothing written into skill dirs; no unchecked boxes above REVIEW;
hunt-core stop conditions fire unchanged.

## Attack surface

**APPROACH:** Map every reflection point, classify reflected/stored/DOM, probe the sanitizer (`aaa"bbb'ccc<ddd`), then fire the context-matched payload; plant a blind beacon in admin/moderation-viewed fields and confirm the session-theft callback.
**AVOID:** A payload that comes back URL/HTML-encoded (`&lt;script&gt;`) is NOT XSS; a blind/stored beacon is unproven until its `oob.md` row flips to HIT.

## Cross-routing

- Load hunt-upload for SVG/file-borne payload delivery.
- Load hunt-cache / hunt-smuggling when the payload needs a poisoned or desynced
  response to reach the victim.
- Load hunt-llm when the sink renders model output (markdown render of LLM content).
- Not this skill: stored-but-always-escaped fields (deadend with the control named).

