XSS (Cross-Site Scripting) is an attack technique that exploits a vulnerability in a web application to inject malicious JavaScript code into a page and steal users' Cookies, session information, personal data, and so on. In the 2025 edition of the OWASP Top 10, XSS is included in A05 Injection.
According to OWASP's explanation of XSS (as of October 2026), XSS is generally divided into reflected and stored types, and separately there is the less well-known DOM-based XSS. They are, respectively, reflected XSS (a script contained in a URL parameter is displayed on the page as is), stored XSS (a script saved in a database is displayed to other users), and DOM-based XSS (occurs when client-side JavaScript manipulates the DOM).
OWASP's XSS prevention cheat sheet (as of October 2026) explains that no single technique solves XSS and that defensive techniques need to be combined correctly. The three considered most effective are framework protection features, output encoding (such as converting < to < and > to >), and HTML sanitization. It notes that Cookie attributes such as HttpOnly limit the damage of XSS but do not prevent it, and recommends using the CSP header as an additional layer rather than the main defense.
In a URL shortener, there is a risk of XSS when URLs entered by users are displayed on a page. In particular, if URLs with the javascript: scheme are allowed, arbitrary JavaScript is executed when the link is clicked. OWASP's cheat sheet also gives, as an example countermeasure, allowing only URLs whose protocol is http:// or https:// when untrusted URLs are used as link destinations.