Cross-Site Scripting (XSS) is a security vulnerability that allows attackers to inject and execute malicious code (usually JavaScript) in a legitimate website that users visit.
Because the browser treats this injected code as trusted content, attackers can:
Steal cookies and session tokens
Impersonate users
Take over accounts
Unlike server-side attacks, XSS happens entirely in the user’s browser, making it harder to detect and block.