September 9, 2026
Cross-Site Scripting (XSS): Bug Bounty Technical Report
Focus: Web Security โข Red Team โข Bug Bounty
By Rifdhyrm
5 min read
1. Executive Summary
Cross-Site Scripting (XSS) remains one of the most important web application vulnerabilities. It occurs when attacker-controlled input reaches a browser and is interpreted as executable HTML or JavaScript.
XSS can appear in search fields, profiles, comments, support tickets, error pages, APIs, file uploads, and modern JavaScript applications.
The most important lesson is simple:
Don't start with payloads. Start by understanding where your input is rendered.
The impact depends heavily on context and the user who eventually views the vulnerable content.
2. The Three Main Types of XSS
2.1 Reflected XSS
Reflected XSS occurs when malicious input is immediately returned in an HTTP response without appropriate encoding.
A simple example:
/search?q=<test>/search?q=<test>If the application places the value directly into HTML without encoding it, the input may become executable markup.
Common locations include:
- Search parameters
- Error messages
- Redirect parameters
- URL paths
- Filter parameters
- Custom headers
For authorized testing, a harmless proof of execution such as:
<img src=x onerror=alert(document.domain)><img src=x onerror=alert(document.domain)>can demonstrate that attacker-controlled HTML reached an executable context.
2.2 Stored XSS
Stored XSS is more serious because the payload is saved by the application and later rendered to other users.
Common targets include:
- User profiles
- Comments
- Support tickets
- Forum posts
- Reviews
- Rich-text editors
- Administrative dashboards
- File metadata
For example, imagine a support system storing:
Message: <test>Message: <test>If an internal support dashboard later renders that value as HTML without proper protection, the stored input may execute whenever an employee opens the ticket.
The important question is not simply "Can JavaScript execute?"
It is:
Who will execute it?
An XSS affecting an administrator or privileged support user can have substantially greater impact than one affecting only the attacker's own account.
2.3 DOM-Based XSS
DOM XSS occurs primarily in client-side JavaScript.
The server may return the page normally, but JavaScript takes attacker-controlled data and writes it into an unsafe browser sink.
Typical sources include:
location.searchlocation.hashdocument.URLpostMessagelocalStorage
Common dangerous sinks include:
innerHTMLouterHTMLdocument.write()eval()insertAdjacentHTML()- React
dangerouslySetInnerHTML
A simplified vulnerable pattern looks like:
element.innerHTML = location.hash;element.innerHTML = location.hash;A safer approach is to treat the value as text:
element.textContent = location.hash;element.textContent = location.hash;The key methodology is source โ transformation โ sink tracing.
3. Context-First XSS Testing
One of the biggest mistakes in XSS testing is trying hundreds of payloads without understanding the rendering context.
First determine where your input appears.
ContextExampleHTML body<div>INPUT</div>Attribute<input value="INPUT">JavaScript stringvar x = 'INPUT';URL<a href="INPUT">CSSstyle="color:INPUT"
Then choose a payload appropriate for that context.
For example, if the application produces:
<div>INPUT</div><div>INPUT</div>you are testing an HTML context.
If it produces:
<input value="INPUT"><input value="INPUT">you must determine whether quotes are encoded and whether you can safely demonstrate breaking out of the attribute.
This context-first approach is much more efficient than blindly spraying payload lists.
4. Simple XSS Proofs
For authorized testing and labs, keep the initial proof simple.
HTML context
<img src=x onerror=alert(document.domain)><img src=x onerror=alert(document.domain)>SVG context
<svg onload=alert(document.domain)><svg onload=alert(document.domain)>Attribute context
Test whether quotation marks are correctly encoded before attempting a controlled breakout.
DOM context
Trace whether attacker-controlled URL data reaches an unsafe sink.
The goal of the first test is confirmation, not maximum exploitation.
Avoid collecting real credentials, session tokens, or personal information.
5. Useful XSS Tooling
You don't need to publish hundreds of lines of scripts to explain a practical workflow. These projects already provide mature tooling.
Burp Suite
Use Burp Suite to:
- Intercept requests
- Modify parameters
- Replay requests
- Compare responses
- Identify reflection points
- Investigate rendering behavior
PortSwigger Web Security Academy XSS Labs
Dalfox
Dalfox is a popular open-source XSS scanner designed for parameter analysis and automated testing.
A simple workflow is:
URLs โ Parameter discovery โ Reflection testing โ Manual validationURLs โ Parameter discovery โ Reflection testing โ Manual validationAutomated results should always be manually verified.
Nuclei
Nuclei can be useful for repeatable security checks and template-based scanning.
Use scanning tools to reduce repetitive work, not as a replacement for understanding the application's behavior.
Semgrep
For source-code review, Semgrep can help identify potentially dangerous JavaScript and framework patterns.
A useful workflow is:
Source โ Find user-controlled data โ Trace transformations โ Inspect sink โ ValidateSource โ Find user-controlled data โ Trace transformations โ Inspect sink โ Validate6. CSP Analysis
Content Security Policy (CSP) is an important defense-in-depth control, but it should not be treated as a replacement for correct output encoding.
Look for the application's:
Content-Security-PolicyContent-Security-PolicyImportant directives include:
script-srcobject-srcbase-uriframe-ancestors
For example:
script-src 'self'script-src 'self'is generally stronger than allowing unrestricted inline scripts.
Weak policies may contain dangerous allowances such as:
'unsafe-inline''unsafe-inline'or:
'unsafe-eval''unsafe-eval'The correct approach is to fix the underlying XSS vulnerability first and use CSP as an additional security layer.
7. Reporting XSS Professionally
A strong bug bounty report should be short, reproducible, and focused on impact.
Recommended structure
Title
Stored XSS in support-ticket message rendered in employee dashboard
Summary
Explain where attacker-controlled input is stored and where it is later rendered.
Steps to Reproduce
- Log in using a test account.
- Submit a harmless XSS proof.
- Open the affected page.
- Observe controlled JavaScript execution.
Impact
Explain who can be affected and what privileges that user has.
Evidence
Include:
- Request/response
- Screenshot
- Affected URL
- Rendered HTML
- CSP header
- Redacted Burp evidence
Remediation
Recommend context-aware output encoding and appropriate sanitization where HTML is intentionally supported.
8. Responsible Impact Demonstration
A vulnerability report should prove the security issue without creating unnecessary risk.
For example:
alert(document.domain)alert(document.domain)can demonstrate JavaScript execution without stealing information.
For blind XSS testing, use a unique canary identifier such as:
XSS-CANARY-001XSS-CANARY-001rather than attempting to collect real cookies or credentials.
In bug bounty programs:
- Don't access other users' sensitive data.
- Don't steal production session tokens.
- Don't modify production records.
- Don't create persistent payloads that harm real users.
- Follow the program's rules of engagement.
For red-team engagements, use controlled accounts and environments unless the authorization explicitly permits production testing.
9. Remediation
9.1 Context-Aware Output Encoding
Encode untrusted data according to its output context.
HTML, attributes, JavaScript, CSS, and URLs require different handling.
The safest default is:
Treat untrusted input as data, not executable code.
9.2 HTML Sanitization
If an application genuinely needs to support user-controlled HTML, use a well-maintained sanitizer with an appropriate allowlist.
Sanitization should be part of a defense-in-depth strategy, not an excuse to skip proper output encoding.
9.3 Safe DOM APIs
Prefer APIs that treat content as text.
Safer:
element.textContent = userInput;element.textContent = userInput;Riskier:
element.innerHTML = userInput;element.innerHTML = userInput;Avoid unnecessary use of dynamic code execution such as eval() and similar APIs.
9.4 Cookie Protection
Session cookies should generally use appropriate security attributes, including:
HttpOnly
Secure
SameSiteHttpOnly
Secure
SameSiteThese controls don't fix XSS, but they can reduce the impact of some attacks.
10. Practical XSS Testing Roadmap
A simple workflow for authorized assessments:
1. Map the application
โ
2. Identify user-controlled inputs
โ
3. Find reflection/storage points
โ
4. Determine rendering context
โ
5. Test with harmless canaries
โ
6. Trace DOM source โ sink flows
โ
7. Review CSP and browser protections
โ
8. Validate impact safely
โ
9. Document reproducible evidence
โ
10. Recommend remediation1. Map the application
โ
2. Identify user-controlled inputs
โ
3. Find reflection/storage points
โ
4. Determine rendering context
โ
5. Test with harmless canaries
โ
6. Trace DOM source โ sink flows
โ
7. Review CSP and browser protections
โ
8. Validate impact safely
โ
9. Document reproducible evidence
โ
10. Recommend remediationThis methodology is more valuable than memorizing thousands of payloads.
11. GitHub Resources
For readers who want to continue practicing:
These resources provide labs, detection techniques, defensive guidance, and practical examples.
12. Key Takeaways
- Understand the context before choosing a payload.
- Reflected, stored, and DOM XSS require different investigation strategies.
- Stored XSS severity depends heavily on who renders the content.
- Modern applications require source-to-sink DOM analysis.
- Burp Suite, Dalfox, Nuclei, and Semgrep can accelerate testing.
- CSP is defense-in-depth, not a substitute for fixing XSS.
- Use harmless canaries and controlled accounts when demonstrating impact.
- A concise, reproducible report is more valuable than a huge payload list.
The goal of professional XSS testing isn't to find the longest payload. It's to understand the data flow, prove the vulnerability, demonstrate realistic impact safely, and explain exactly how to fix it.
Rifdhy RMโฆ.