Cross-site Scripting (XSS)
Cross-site scripting (XSS) attacks are a type of injection, in which malicious scripts are injected into otherwise benign and trusted websites. XSS attacks occur when an attacker uses a web application to send malicious code, generally in the form of a browser side script, to a different end user. Flaws that allow these attacks to succeed are quite widespread and occur anywhere a web application uses input from a user within the output it generates without validating or encoding it.
An attacker can use XSS to send a malicious script to an unsuspecting user. The end user’s browser has no way to know that the script should not be trusted, and will execute the script. Because it thinks the script came from a trusted source, the malicious script can access any cookies, session tokens, or other sensitive information retained by the browser and used with that site. These scripts can even rewrite the content of the HTML page.
Cross-Site Scripting (XSS) attacks occur when:
- Data enters a Web application through an untrusted source, most frequently a web request.
- The data is included in dynamic content that is sent to a web user without being validated for malicious content.
OWASP XSS Filter Evasion Cheat Sheet
OWASP Guide to Building Secure Web Applications and Web Services, Chapter 8: Data Validation
OWASP Testing Guide, Testing_for_Reflected_Cross_site_scripting_(OWASP-DV-001)
OWASP Testing Guide, Testing_for_Stored_Cross_site_scripting_(OWASP-DV-002)
OWASP Testing Guide, Testing_for_DOM-based_Cross_site_scripting_(OWASP-DV-003)
OWASP’s How to Build an HTTP Request Validation Engine (J2EE validation using OWASP’s Stinger)
Google Code Best Practice Guide
The Cross Site Scripting FAQ
Understanding the cause and effect of CSS Vulnerabilities
XSSed - Cross-Site Scripting (XSS) Information and Mirror Archive of Vulnerable Websites
CERT Advisory on Malicious HTML Tags