Overview - Cross-site scripting (XSS)
What is it?
Cross-site scripting (XSS) is a security vulnerability found in websites where attackers inject harmful code, usually JavaScript, into web pages viewed by other users. This malicious code runs in the victim's browser, allowing attackers to steal information, hijack sessions, or manipulate the website's content. XSS happens when a website does not properly check or clean user input before showing it to others.
Why it matters
XSS exists because websites often accept and display user input without enough safety checks. Without protections against XSS, attackers can steal private data like passwords or personal details, trick users into unwanted actions, or spread malware. This can harm individuals, damage a website's reputation, and lead to financial loss or legal trouble.
Where it fits
Before learning about XSS, you should understand basic web concepts like how websites display content and how browsers work. After XSS, learners often study other web security issues like SQL injection or Cross-Site Request Forgery (CSRF), and how to protect websites using security headers and input validation.