The goal of the OWASP Top 10 project is to raise awareness about application security by identifying some of the most critical risks facing organizations. At Appknox, we started a journey with you to help create awareness about the Top 10 project and learn how everyone can make their mobile and web apps secure.
Today, we explore the third most exploited security threat in the web app space, called Cross Site Scripting (XSS).
What is Cross Site Scripting?
XSS is the most prevalent web application security flaw. XSS flaws occur when an application includes user supplied data in a page sent to the browser without properly validating or escaping that content. There are two different types of XSS flaws:
1) Stored, and
2) Reflected, and each of these can occur on the
a) Server, or
b) on the Client.
What is the Impact of Cross Site Scripting?
Technical Impact: Attackers can execute scripts in a victim’s browser to hijack user sessions, deface web sites, insert hostile content, redirect users, hijack the user’s browser using malware, etc.
Business Impact: Consider the business value of the affected system and all the data it processes. Also consider the business impact of public exposure of the vulnerability.
Are you vulnerable to Cross Site Scripting?
How to provent Cross Site Scripting?
Preventing XSS requires separation of untrusted data from active browser content.
- Positive or “whitelist” input validation is also recommended as it helps protect against XSS, but is not a complete defense as many applications require special characters in their input. Such validation should, as much as possible, validate the length, characters, format, and business rules on that data before accepting the input.
- For rich content, consider auto-sanitization libraries like OWASP’s AntiSamy or the Java HTML Sanitizer Project.
The application uses untrusted data in the construction of the following HTML snippet without validation or escaping:
The attacker modifies the ‘CC’ parameter in their browser to:
This causes the victim’s session ID to be sent to the attacker’s website, allowing the attacker to hijack the user’s current session.
While Cross Site Scripting is one of the most exploited security threats, it is also something that can be taken care of easily. Developers can make use of automated tools to quickly know if there are issues present and can thus handle the situation better. Validating input is one of the most important steps which should never be compromised upon.
Appknox is a tool that uses a system + human approach to ensure complete coverage from many such issues like Cross Site Scripting. Do let us know if you would want us to schedule a demo for you.