Cross-site scripting (XSS)

On webserver that is not sanitizing user input, hacker could inject and execute malicious scripts.

Different types of XSS

Stored XSS

Change website for every user by saving script that runs on every page it is opened.

Detection

You’ll need to test every possible point of entry where it seems data is stored and then shown back in areas that other users have access to, like:

Reflected XSS

Reflected XSS injects scripts into web pages that are reflected back to the user. Get data from server like ip or flag from files.

Detecting

Testing for possible entry points:

DOM-Based XSS

Payload never touches the server, entire attack happens client-side via JS manipulating the DOM (e.g. document.write, innerHTML, eval fed by location.search/location.hash). Getting rarer as browsers tighten up.

Example Payloads

Full library of xxs payloads Collection of xss payloads

Detecting

Exploiting

Evasion

Check injection context first, payload needs to match:

Bypassing filters/blocklists:

Resources:

Types of XSS