What are Cross-Site Scripting Vulnerabilities?
Cross-Site Scripting (XSS) is a vulnerability that allows malicious JavaScript code to be injected into trusted web pages, thereby enabling the execution of malicious code in the browsers of users who visit the site.
XSS vulnerabilities arise when unreliable input is not handled properly, but is returned to the browser as it is, causing the browser to interpret it as code on the client side. Such input could be, for example, an open comment on a discussion forum.
The image below shows an example of what a successful XSS attack might look like. The attacker finds an XSS vulnerability on the website, saves malicious JavaScript code on the website, and when the user(s) visit the infected website, the code gets executed, allowing the attacker to steal the desired information.

Learn to hack — start here
Hundreds of interactive courses, virtual labs and CTF challenges in your browser. Start a free trial — no card required.