XSS - Cross Site Scripting
Cross-site scripting (XSS) is a type of computer security vulnerability typically found in web applications. XSS enables attackers to inject client-side scripts into web pages viewed by other users.
Summary
Exploit code or POC
Data grabber for XSS
UI redressing
Javascript keylogger
Other ways
Identify an XSS endpoint
XSS in HTML/Applications
Common Payloads
XSS using HTML5 tags
XSS using a remote JS
XSS in hidden input
DOM based XSS
XSS in JS Context
XSS in wrappers javascript and data URI
XSS in files (XML/SVG/CSS/Flash/Markdown)
XSS in PostMessage
Blind XSS
XSS Hunter
Other Blind XSS tools
Blind XSS endpoint
Mutated XSS
Polyglot XSS
Filter Bypass and Exotic payloads
Bypass case sensitive
Bypass tag blacklist
Bypass word blacklist with code evaluation
Bypass with incomplete html tag
Bypass quotes for string
Bypass quotes in script tag
Bypass quotes in mousedown event
Bypass dot filter
Bypass parenthesis for string
Bypass parenthesis and semi colon
Bypass onxxxx= blacklist
Bypass space filter
Bypass email filter
Bypass document blacklist
Bypass using javascript inside a string
Bypass using an alternate way to redirect
Bypass using an alternate way to execute an alert
Bypass ">" using nothing
Bypass "<" and ">" using < and >
Bypass ";" using another character
Bypass using HTML encoding
Bypass using Katana
Bypass using Cuneiform
Bypass using Lontara
Bypass using ECMAScript6
Bypass using Octal encoding
Bypass using Unicode
Bypass using UTF-7
Bypass using UTF-8
Bypass using UTF-16be
Bypass using UTF-32
Bypass using BOM
Bypass using weird encoding or native interpretation
Bypass using jsfuck
CSP Bypass
Common WAF Bypass
Exploit code or POC
Data grabber for XSS
Obtains the administrator cookie or sensitive access token, the following payload will send it to a controlled page.
Write the collected data into a file.
CORS
UI redressing
Leverage the XSS to modify the HTML content of the page in order to display a fake login form.
Javascript keylogger
Another way to collect sensitive data is to set a javascript keylogger.
Other ways
More exploits at http://www.xss-payloads.com/payloads-list.html?a#category=all:
Identify an XSS endpoint
This payload opens the debugger in the developper console rather than triggering a popup alert box.
Modern applications with content hosting can use sandbox domains
to safely host various types of user-generated content. Many of these sandboxes are specifically meant to isolate user-uploaded HTML, JavaScript, or Flash applets and make sure that they can't access any user data.
For this reason, it's better to use alert(document.domain) or alert(window.origin) rather than alert(1) as default XSS payload in order to know in which scope the XSS is actually executing.
Better payload replacing <script>alert(1)</script>:
While alert() is nice for reflected XSS it can quickly become a burden for stored XSS because it requires to close the popup for each execution, so console.log() can be used instead to display a message in the console of the developper console (doesn't require any interaction).
Example:
References:
Tools
Most tools are also suitable for blind XSS attacks:
XSSStrike: Very popular but unfortunately not very well maintained
xsser: Utilizes a headless browser to detect XSS vulnerabilities
Dalfox: Extensive functionality and extremely fast thanks to the implementation in Go
XSpear: Similar to Dalfox but based on Ruby
domdig: Headless Chrome XSS Tester
XSS in HTML/Applications
Common Payloads
XSS using HTML5 tags
XSS using a remote JS
XSS in hidden input
XSS when payload is reflected capitalized
DOM based XSS
Based on a DOM XSS sink.
XSS in JS Context
XSS in wrappers javascript and data URI
XSS with javascript:
XSS with data:
XSS with vbscript: only IE
XSS in files
** NOTE:** The XML CDATA section is used here so that the JavaScript payload will not be treated as XML markup.
XSS in XML
XSS in SVG
XSS in SVG (short)
XSS in Markdown
XSS in SWF flash application
more payloads in ./files
XSS in SWF flash application
XSS in CSS
XSS in PostMessage
If the target origin is asterisk * the message can be sent to any domain has reference to the child page.
Blind XSS
XSS Hunter
Available at https://xsshunter.com/app
XSS Hunter allows you to find all kinds of cross-site scripting vulnerabilities, including the often-missed blind XSS. The service works by hosting specialized XSS probes which, upon firing, scan the page and send information about the vulnerable page to the XSS Hunter service.
Other Blind XSS tools
Blind XSS endpoint
Contact forms
Ticket support
Referer Header
Custom Site Analytics
Administrative Panel logs
User Agent
Custom Site Analytics
Administrative Panel logs
Comment Box
Administrative Panel
Tips
You can use a Data grabber for XSS and a one-line HTTP server to confirm the existence of a blind XSS before deploying a heavy blind-XSS testing tool.
Eg. payload
Eg. one-line HTTP server:
Mutated XSS
Use browsers quirks to recreate some HTML tags when it is inside an element.innerHTML.
Mutated XSS from Masato Kinugawa, used against DOMPurify component on Google Search. Technical blogposts available at https://www.acunetix.com/blog/web-security-zone/mutation-xss-in-google-search/ and https://research.securitum.com/dompurify-bypass-using-mxss/.
Polyglot XSS
Polyglot XSS - 0xsobky
Polyglot XSS - Ashar Javed
Polyglot XSS - Mathias Karlsson
Polyglot XSS - Rsnake
Polyglot XSS - Daniel Miessler
Polyglot XSS - @s0md3v 

Polyglot XSS - from @filedescriptor's Polyglot Challenge
Filter Bypass and exotic payloads
Bypass case sensitive
Bypass tag blacklist
Bypass word blacklist with code evaluation
Bypass with incomplete html tag
Works on IE/Firefox/Chrome/Safari
Bypass quotes for string
Bypass quotes in script tag
Bypass quotes in mousedown event
You can bypass a single quote with ' in an on mousedown event handler
Bypass dot filter
Convert IP address into decimal format: IE. http://192.168.1.1 == http://3232235777 http://www.geektools.com/cgi-bin/ipconv.cgi
Base64 encoding your XSS payload with Linux command: IE. echo -n "alert(document.cookie)" | base64 == YWxlcnQoZG9jdW1lbnQuY29va2llKQ==
Bypass parenthesis for string
Bypass parenthesis and semi colon
Bypass onxxxx= blacklist
Bypass space filter
Bypass email filter
Bypass document blacklist
Bypass using javascript inside a string
Bypass using an alternate way to redirect
Bypass using an alternate way to execute an alert
From @brutelogic tweet.
From @theMiddle - Using global variables
The Object.keys() method returns an array of a given object's own property names, in the same order as we get with a normal loop. That's means that we can access any JavaScript function by using its index number instead the function name.
Then calling alert is :
We can find "alert" with a regular expression like ^a[rel]+t$ :
Oneliner:
From @quanyang tweet.
From @404death tweet.
Bypass using an alternate way to trigger an alert
Bypass ">" using nothing
You don't need to close your tags.
Bypass "<" and ">" using < and >
Unicode Character U+FF1C and U+FF1E
Bypass ";" using another character
Bypass using HTML encoding
Bypass using Katana
Using the Katakana library.
Bypass using Cuneiform
Bypass using Lontara
More alphabets on http://aem1k.com/aurebesh.js/#
Bypass using ECMAScript6
Bypass using Octal encoding
Bypass using Unicode
Bypass using Unicode converted to uppercase
Bypass using UTF-7
Bypass using UTF-8
Bypass using UTF-16be
Bypass using UTF-32
Bypass using BOM
Byte Order Mark (The page must begin with the BOM character.) BOM character allows you to override charset of the page
Bypass using weird encoding or native interpretation
Bypass using jsfuck
Bypass using jsfuck
CSP Bypass
Check the CSP on https://csp-evaluator.withgoogle.com and the post : How to use Google’s CSP Evaluator to bypass CSP
Bypass CSP using JSONP from Google (Trick by @apfeifer27)
//google.com/complete/search?client=chrome&jsonp=alert(1);
More JSONP endpoints:
/Intruders/jsonp_endpoint.txt
Bypass CSP by lab.wallarm.com
Works for CSP like Content-Security-Policy: default-src 'self' 'unsafe-inline';, POC here
Bypass CSP by Rhynorater
Bypass CSP by @akita_zen
Works for CSP like script-src self
Bypass CSP by @404death
Works for CSP like script-src 'self' data: as warned about in the official mozilla documentation.
Common WAF Bypass
Cloudflare XSS Bypasses by @Bohdan Korzhynskyi
25st January 2021
21st April 2020
22nd August 2019
5th June 2019
3rd June 2019
Cloudflare XSS Bypass - 22nd March 2019 (by @RakeshMane10)
Cloudflare XSS Bypass - 27th February 2018
Chrome Auditor - 9th August 2018
Live example by @brutelogic - https://brutelogic.com.br/xss.php
Incapsula WAF Bypass by @Alra3ees- 8th March 2018
Incapsula WAF Bypass by @c0d3G33k - 11th September 2018
Incapsula WAF Bypass by @daveysec - 11th May 2019
Akamai WAF Bypass by @zseano - 18th June 2018
Akamai WAF Bypass by @s0md3v - 28th October 2018
WordFence WAF Bypass by @brutelogic - 12th September 2018
Fortiweb WAF Bypass by @rezaduty - 9th July 2019
References
tbm
Sleeping stored Google XSS Awakens a $5000 Bounty by Patrik Fehrenbach
RPO that lead to information leakage in Google by filedescriptor
God-like XSS, Log-in, Log-out, Log-in in Uber by Jack Whitton
Three Stored XSS in Facebook by Nirgoldshlager
Using a Braun Shaver to Bypass XSS Audit and WAF by Frans Rosen
An XSS on Facebook via PNGs & Wonky Content Types by Jack Whitton
Stored XSS in *.ebay.com by Jack Whitton
Complicated, Best Report of Google XSS by Ramzes
Command Injection in Google Console by Venkat S
Facebook's Moves - OAuth XSS by PAULOS YIBELO
Stored XSS in Google Docs (Bug Bounty) by Harry M Gertos
Stored XSS on developer.uber.com via admin account compromise in Uber by James Kettle (albinowax)
Yahoo Mail stored XSS by Klikki Oy
Abusing XSS Filter: One ^ leads to XSS(CVE-2016-3212) by Masato Kinugawa
Youtube XSS by fransrosen
Best Google XSS again - by Krzysztof Kotowicz
IE & Edge URL parsing Problem - by detectify
Flash XSS mega nz - by frans
Flash XSS in multiple libraries - by Olivier Beg
xss in Yahoo Mail Again, worth $10000 by Klikki Oy
Sleeping XSS in Google by securityguard
Decoding a .htpasswd to earn a payload of money by securityguard
How I found a $5,000 Google Maps XSS (by fiddling with Protobuf) by Marin MoulinierFollow
XSS in Uber via Cookie by zhchbin
XSS in TinyMCE 2.4.0 by Jelmer de Hen
Twitter XSS by stopping redirection and javascript scheme by Sergey Bobrov
Last updated