3.1 XSS Overview

XSS in a nutshell

Cross-Site Scripting (XSS) is a vulnerability that occurs when untrusted data from the user is processed by the web application without validation and is reflected back to the browser without encoding or escaping, resulting in code execution at the browser engine.

xss-wf

Why XSS is dangerous ?

The impact of XSS is moderate for reflected and DOM XSS, and severe for stored XSS, with remote code execution on the victim’s browser, such as stealing credentials, sessions, MFA bypass, DOM node replacement or defacement (such as trojan login panels), key logging or delivering malware to the victim.

What causes XSS ?

This attack happens mostly because the web application or API uses inputs from any users within the output it generates without proper validation or encoding.

How XSS attacks happen ?

XSS typeDescriptionPayload typePayload ExamplesReal cases
ReflectedReflected in web server as an error message, search result or any input sent to the server as part of the request.From request parameter.imageepic gamesopen in new window
StoredInjected script is permanently stored in target servers.Stored server-side.imagemyspace wormopen in new window
DOM basedModifying the DOM environment in the victim browser.Introduced by DOM modification.imageMicrosoft, Apple, Google,...open in new window
MutationLooks like safe (or just a syntax error) in itself but become active after mutation processMutated by browser.imageGoogle search baropen in new window
Blind Cross-Site scriptingScript is saved on server side and reflected back in the backend application.Teslaopen in new window

Further resources

owasp.org/www-community/attacks/xss/open in new window

Last Updated:
Contributors: Nourredine K