Thanks Lachlan+Andrew for some of the slides
We expect a high standard of professionalism from you at all times while you are taking any of our courses. We expect all students to act in good faith at all times.
TLDR: Don’t be a dick
<script>..</script>
<img .. />
<script>
or loaded externally<script>...</script>
<img onerror="..." src="x">
<svg/>
document.write()
fetch()
What is an origin?
http://www.website.com:80
origin = scheme + host + port
What is a site?
http://www.website.com:80 > https://mobile.website.com:443 > ftp://f.website.com:21
site = private_domain + public_suffix
http://www.website.com:80
origin = scheme + host + port
site = private_domain + public_suffix site = domain
The payload is part of user input (i.e. URL bar, inside a cookie, etc)
Demo:
Reflected XSS
Who’d click on them though…. But also like, link shorteners… But also like, “…”
The payload is stored in some sort of database.
Arguably more dangerous… Anyone who opens a page that returns content from that same database may be victim to a stored XSS attack
Demo: Stored XSS
The client pieces together data which eventually becomes an exploit itself.
i.e.
document.write(...)
Don’t use .innerHTML
or .outerHTML
use .innerText
or .textContent
Demo: DOM XSS
JS Frameworks
X-XSS-Protection
header
Turn it off, it’s broken 🔥 🌊🚒
✅ X-XSS-Protection: 0
“Firefox never supported X-XSS-Protection and Chrome and Edge have announced they
are droppinghave dropped support for it."
Sandboxing
iframes, sandbox, seamless, etc…
Link: GitHub
Cross site request forgery
“Heyyyy, look here 🥺 👉👈”
Tricking a user into making requests they didn’t intend, sending data and loading attacker controlled documents
Stop CSRF attempts by supplying the user with a single-use ’nonce’ value.
Can’t forge a request if you don’t know the nonce before hand… sort of…
CSRF vs XSS
Generally XSS is performed in the background (since it’s a script exploit)
eval()