Cross-site scripting (XSS) is a type of computer security vulnerability that enables attackers to inject client-side scripts into web pages viewed by other users. There are two types: reflected XSS involves including malicious code in a URL link, while stored XSS embeds malicious code directly into a website database. To prevent XSS attacks, developers should validate, escape, and sanitize all user input before displaying it. For example, by filtering HTML tags and encoding special characters. An infamous example is a 2005 MySpace XSS worm that spread to millions of users by automatically adding anyone who visited an infected profile as a friend.
Related topics: