Don't like this style? Click here to change it! blue.css
One of the most important families of modern security vulnerabilities is XSS which is this:
The App Developer provides the canvas (vulnerability) on which your users hack each other.
Let's do a live demo:
Here is a firebase-driven chat app: /xss/insecure visit at your own risk. Say hi. The source code is below:
XSS Level 0: Now I'm going to send the message
Hi <style>li{color:salmon}</style>
.
Two questions:
Imagine Exploits I'm going to ask you to brainstorm with your neighbors, your job is to imagine an elaborate WORST CASE SCENARIO for what kind of damage can happen from this flavor of XSS exploit. After a few minutes of discussion drop your concepts in the class-chat and present the imaginative movie plots where XSS is used to do severe harm.
Here is XSS prevention (perhaps the whole course?) in a nutshell:
This solves the problem in a pretty hard-core way:
Here is that code running: /xss/secure
Observe the difference.
In vanilla Javascript this is the difference between: $el.innerHTML =
and $el.innerText =
Well unfortunately this was Level 0 of XSS. The reality is that your client will ask for functionality and most functionality requires having users do something.
User Stories: Our client wants people to have a personalized Avatar image and to be able upload meme images and gifs and things into this chat app. How must you redesign the code to allow images but not arbitrary XSS?
The game of XSS over time is the cat and mouse of giving an inch and devising clever ways to take a mile.
On this one it's hard enough, and important enough, that I want to maybe wax poetic for a second:
Let's look at the OWASP top ten: https://owasp.org/www-project-top-ten/
Let's do a sort of twitch plays this: https://xss-game.appspot.com For each level take a few minutes trying to solve it on your own then use hints/online payload lists/googling to help you through. I want you to see the style of the XSS cat and mouse game.
Super fast data endpoint setups: https://beeceptor.com/
Of course: PayloadsAllTheThings - XSS Injection