Skip to content

OSWA · Module 4

Cross-Site Scripting: Discovery

Identify reflected, stored, and DOM-based XSS by finding where user input reaches an output context without proper encoding.

~2 h 3 resources Last updated September 27, 2026

Cross-site scripting (XSS) lets an attacker execute JavaScript in another user's browser in the context of the vulnerable application. It comes in three forms: reflected (payload echoed back in the immediate response), stored (payload persisted and served to other users), and DOM-based (payload processed entirely client-side by JavaScript). Discovery is about finding where user input reaches an output context without proper encoding, and confirming script execution in that context.

Reflected and Stored XSS Discovery

Finding reflected XSS starts with confirming that input is echoed back, then identifying the exact output context: HTML body, attribute, JavaScript, or URL. The context dictates the payload. Stored XSS requires locating persistence points (comments, profiles, uploads) and testing whether stored input executes when rendered to a viewer. File uploads, SVG files, and filenames are common stored vectors, and blind XSS needs an out-of-band callback to confirm.

DOM-Based XSS Discovery

DOM-based XSS never touches the server response body: JavaScript reads a source (location.hash, search params, postMessage, window.name) and writes it to a dangerous sink (innerHTML, document.write, eval). Discovery means tracing sources to sinks in the client-side code, setting breakpoints on sinks in DevTools, and using tooling like DOM Invader to automate the trace across single-page applications.