Finding XSS combines automated scanning, manual payload testing, and code review. Each has trade-offs — scanners are fast but produce false positives; manual testing confirms execution but is slow; code review is the most reliable but requires source access.

Automated Scanning

Commercial / pro:

  • Burp Suite Pro — active + passive scanner
  • OWASP ZAP — free, decent coverage
  • Nessus — broad web scans

Open-source XSS-specific:

  • XSStrike — intelligent payload generation, context-aware
  • BruteXSS — brute-force payloads against parameters
  • XSSer — automated discovery and exploitation

What scanners do:

  • Passive — examines the client-side JS for sink patterns (potential DOM XSS)
  • Active — injects payloads into parameters, inspects the response for reflections

Important caveat: a payload appearing in the response doesn’t guarantee execution. Scanners often report reflections; you still need to manually verify whether JavaScript actually fires.

XSStrike Example

git clone https://github.com/s0md3v/XSStrike.git
cd XSStrike
pip install -r requirements.txt
python xsstrike.py -u "http://target/index.php?task=test"

Typical output:

[~] Checking for DOM vulnerabilities
[+] WAF Status: Offline
[!] Testing parameter: task
[!] Reflections found: 1
[~] Analysing reflections
[~] Generating payloads
[!] Payloads generated: 3072
LineMeaning
Checking for DOM vulnerabilitiesScans client-side JS for sinks
WAF Status: OfflineNo WAF detected
Reflections found: 1Input appeared somewhere in response
Payloads generated: 3072Candidate payloads for context

Example payload XSStrike produces:

<HtMl%09onPoIntERENTER+=+confirm()>

Manual Discovery

The baseline test payload:

<script>alert(1)</script>

If the app inserts input unescaped and JS runs, you have XSS. But one payload doesn’t fit all contexts — see the Context section below.

Where to Inject

XSS isn’t limited to visible form fields. Test every place user input ends up in a response:

  • URL parameters (both GET query strings and path segments)
  • Form fields (visible and hidden)
  • Cookies (session, preferences, tracking)
  • HTTP headers — User-Agent, Referer, X-Forwarded-For, custom headers
  • JSON / XML / multipart bodies
  • File upload filenames and metadata

Admin dashboards that display headers like User-Agent of visiting users are a frequent source of Stored XSS.

Injection Context Matters

Payloads vary because input lands in different HTML/JS contexts, each needing different escapes.

ContextExample InsertionPayload
HTML body<p>INPUT</p><script>alert(1)</script>
HTML attribute<input value="INPUT">" onfocus=alert(1) autofocus="
Unquoted attribute<input value=INPUT> onfocus=alert(1) autofocus
JavaScript stringvar x = "INPUT";";alert(1);//
JS variable namevar INPUT = 1;x=1;alert(1)//
URL / href<a href="INPUT">javascript:alert(1)
CSS value<div style="color:INPUT">red;background:url(javascript:alert(1))

Two rules:

  1. Payload fails ≠ app is secure — try a different context
  2. Payload reflected ≠ confirmed XSS — check whether it actually executes

Code Review

The most reliable technique when you have source access. Trace the full data flow:

User Input → Back-end processing → Front-end JS / HTML → Browser

For DOM XSS specifically, grep for sinks and work backward to confirm they consume attacker-controlled sources:

grep -rn "innerHTML\|document.write\|eval(\|setTimeout(" .
grep -rn "location.hash\|location.search\|document.URL" .

Understanding the exact context lets you craft a working payload instead of blasting generic ones.

Payload Lists

For contexts where you need variety:

  • PayloadsAllTheThings — github.com/swisskyrepo/PayloadsAllTheThings → XSS folder
  • Payload-Box — github.com/payloadbox/xss-payload-list

Both have thousands of payload variations organized by injection context and WAF-bypass theme.