Cross-site Scripting (XSS)

Another form of attack against web applications is known as Cross-Site Scripting. (This is abbreviated to XSS as the acronym CSS was already taken by Cascading Style Sheets.) In a cross-site scripting attack, data is entered into an application which is later written back to another user. If the application has not taken care to validate the data correctly, it may simply echo the input back allowing the insertion of Javascript code into the HTML page.

A naive implementation of a bulletin board might store a user's comment in a database and write it straight back to other users who are viewing the thread. By posting something like

"<script>alert('XSS');</script>"
the attacker can execute Javascript on a third-party computer whenever the comment is viewed. Although XSS is a common vulnerability in web applications, it is using the web application as an attack vector and other users are the target, so we have not included it below. More information is available from The Cross Site Scripting (XSS) FAQ.