Directly writing user input (for example, an HTTP request parameter) to a webpage, without properly sanitizing the input first, allows for a cross-site scripting vulnerability.

To guard against cross-site scripting, consider using contextual output encoding/escaping before writing user input to the page, or one of the other solutions that are mentioned in the references.

The following example shows the page parameter being written directly to the server error page, leaving the website vulnerable to cross-site scripting.

  • OWASP: XSS (Cross Site Scripting) Prevention Cheat Sheet.
  • Wikipedia: Cross-site scripting.