Skip to main content

XSS

security

Cross-site scripting injects attacker-controlled JavaScript into pages other visitors load, letting it steal sessions or act as the user. It persists wherever user input is rendered without escaping.

Escape output by default, allow rich HTML only through a sanitiser, and set a Content-Security-Policy.

A comment field executing script tags was the vector for session theft across a forum.

Related topics

Frequently asked question

What is XSS?

Cross-site scripting injects attacker-controlled JavaScript into pages other visitors load, letting it steal sessions or act as the user. It persists wherever user input is rendered without escaping. Escape output by default, allow rich HTML only through a sanitiser, and set a Content-Security-Policy.

Read the full answer