What is an XSS attack?
XSS, cross-site scripting, is the injection of a foreign script into a page, which then runs in other users' browsers and can steal their session or data. The defence is escaping data when it is output to the page and a strict content security policy (CSP) that prevents the browser from running foreign scripts.
More in the guide to web application security.