1. Overview

https://owasp.org/www-community/attacks/xss/

Web apps work by:

  1. receiving HTML code from backend server
  2. Rendering it on clientside browser

When vuln webapps dont sanitize user input, we can inject extra JS code in an input field (like a comment or reply) so that when other users view the same page they execute the code on their machine.

XSS solely executed on clientside. Do not directly affect backend Only affects user who executes

Direct impact on backend, low. Very commonly found in webapps. Equates to medium risk:

Always reduce risk by detecting remediating and proactively preventing these vulns


XSS attacks

XSS attacks executed with Js are limited to within the browser JS engine.

If a skilled researcher identifies a binary vuln in a web browser (heap overflow in chrome for example) xss can be leveraged to exec JS exploit on browser that breaks out of sandbox and executes code on machine

Wellknown xss example is Samy worm https://en.wikipedia.org/wiki/Samy_(computer_worm)

https://blog.sucuri.net/2014/06/serious-cross-site-scripting-vulnerability-in-tweetdeck-twitter.html

Types of XSS matrix

Type Description
Stored (Persistent) XSS The most critical type of XSS, which occurs when user input is stored on the back-end database and then displayed upon retrieval (e.g., posts or comments)
Reflected (Non-Persistent) XSS Occurs when user input is displayed on the page after being processed by the backend server, but without being stored (e.g., search result or error message)
DOM-based XSS Another Non-Persistent XSS type that occurs when user input is directly shown in the browser and is completely processed on the client-side, without reaching the back-end server (e.g., through client-side HTTP parameters or anchor tags)