Prevention of Cross-Site Scripting Attacks XSS On
Prevention of Cross-Site Scripting Attacks XSS On
2
Department of Information Technology, Sri Sairam Engineering College,
Chennai- 44, Tamilnadu, India.
Abstract Cross Site Scripting (XSS) Attacks are transparently run by the web browser. The malicious
currently the most popular security problems in modern script inherits the user’s rights, authentication, and so
web applications. These Attacks make use of on. XSS represents the majority of web based
vulnerabilities in the code of web-applications, resulting security vulnerabilities
in serious consequences, such as theft of cookies, One reason for the popularity of XSS vulnerabilities
passwords and other personal credentials. Cross-Site is that developers of web-based applications often
scripting (XSS) Attacks occur when accessing have little or no security background. The result is
information in intermediate trusted sites. Client side that poorly developed code, riddled with security
solution acts as a web proxy to mitigate Cross Site flaws, is deployed and made accessible to the whole
Scripting Attacks which manually generated rules to Internet. Currently, XSS attacks are dealt with by
mitigate Cross Site Scripting attempts. Client side solution
fixing the server-side vulnerability, which is usually
the result of improper input validation routines.
effectively protects against information leakage from the
XSS protection can be configured for multiple types
user's environment. Cross Site Scripting (XSS) Attacks
of request and response data – URL query parameters
are easy to execute, but difficult to detect and prevent.
– URL encoded input (“POST data”) – HTTP
This paper provides client-side solution to mitigate cross-
headers – Cookies.
site scripting Attacks. The existing client-side solutions
The possibilities to manipulate HTML documents
degrade the performance of client's system resulting in a displayed by the browser with JavaScript or to
poor web surfing experience. In this project provides a influence the operation of the browser itself are
client side solution that uses a step by step approach to dangerous features if misused. The misuse potential
protect cross site scripting, without degrading much the directly relates to the functions available for a
user's web browsing experience. malicious programmer. Unfortunately JavaScript
provides full access to HTML documents using the
document object model (DOM). A script therefore
Keywords -- Cross Site Scripting; web proxy; can modify at least the document it is residing in
Software Protection; Code Injection Attacks; arbitrarily: it is also possible to completely delete the
Security Policies. document and create a t otally different document.
From an attackers point of view two things are of
special interest: cookies associated to a document and
1. INTRODUCTION access credentials. JavaScript also provides access
possibilities to these information. The cookies
Cross-Site Scripting, commonly known as XSS, is a
associated to a document can be accessed using the
type of attack that gathers malicious information
function call document.cookie and application level
about a u ser; typically in the form of a s pecially
access credentials are often acquired using form
crafted hyperlink that will save the users credentials.
based login. Here the credentials are input into input
Cross-site scripting, or XSS is a web security
fields residing in a form environment. Since the form
vulnerability where the attacker injects malicious
is part of the document a script can access all
client-side script into a web page. When a user visits
information in all fields or can simply modify the
a web page, the script code is downloaded and
IJCSI International Journal of Computer Science Issues, Vol. 8, Issue 4, No 1, July 2011
ISSN (Online): 1694-0814
www.IJCSI.org 651
• Stored XSS: Also known as HTML injection been known. Attacks that do not anticipated by the
attacks, stored cross-site scripting exploits are those signature authors are left unprotected by the scheme.
where some data sent to the server is stored (typically The two main aims of XSS attacks are stealing the
in a database) to be used in the creation of pages that victim user’s sensitive information and invoking
will be served to other users later. This form of cross- malicious acts on the user’s behalf. Noxes provides a
site scripting exploit can affect any visitor to your client-side web proxy to block URL requests by
Web site, if your site is subject to a stored cross-site malicious content using manual and automatic rules.
scripting vulnerability. The classic example of this Reference presents another approach: tracking the
sort of vulnerability is content management software flow of sensitive information in the browser to
such as forums and bulletin boards where users are prevent malicious content from leaking such
allowed to use raw HTML and XHTML to format information. Both of these projects focus on ensuring
their posts. confidentiality of sensitive data (e.g., cookies) by
As with preventing reflected exploits, the key to analyzing the flow of data through the browser, rather
securing your site against stored exploits is ensuring than preventing unauthorized script execution. They
that all submitted data is translated to display entities can defeat only the first goal of XSS attacks. It would
before display so that it will not be interpreted by the be defeated by attacks that do not violate same-origin
browser as code. policies. By contrast, our approach is based on
. analyzing function-call sequences of JavaScript to
• DOM-based XSS: It is a special variant of reflected detect unauthorized scripts; we can defeat both
XSS, where logic errors in legitimate JavaScript and objectives of XSS attacks.
careless usage of client-side data result in XSS One of the most important discussions related to
conditions. aspects of code injection is by CERT. The paper
Application developers and owners need to describes the source of code injection: invalidated
understand DOM Based XSS, as it represents a threat input from untrustworthy sources. It also proposes
to the web application, which has different solutions that may be carried out directly by users.
preconditions. As such, there are many web On the client side, the most effective solution is to
applications on the Internet that are vulnerable to disable all scripting language support in user’s
DOM Based XSS, yet when tested for standard XSS, browsers and e-mail readers. If this is not a feasible
are demonstrated to be “not vulnerable”. Developers option for business reasons, another recommendation
and site maintainers need to familiarize themselves is to use reasonable caution when clicking links in
with techniques to detect DOM Based XSS anonymous e-mails and dubious web pages. Also,
vulnerabilities, as well as with techniques to defend keeping up to date with the latest browser patches
against them. and versions is important. But usually, neither do
users willing to disable all scripting language
support, nor do they keen to keep their browsers up to
3. RELATED WORK date let alone how many of them are aware of the
dangerous XSS.
By now there have been a variety of defensive Scott and Sharp used an application proxy to abstract
techniques to prevent XSS, including the following Web application protection; the proxy validates user
aspects: static analysis, dynamic analysis, black-box input to protect against XSS attacks. Commercial
testing, white-box testing, anomaly detection, etc. products such as Appshield and InterDo use a similar
Generally, these approaches are deployed on the approach. However, even though it provides
client-side or server-side to protect web users from immediate assurance of Web application security, it
XSS injection attack. To remedy the shortcomings of requires the correct identification of and validation
server- side protection, there have been several policy for each individual entry point to a Web
defensive strategies which are deployed on the client application. Another limitation is that this approach
side. In a client-side mechanism for detecting protects Web applications at the deployment phase
malicious JavaScript is proposed. The system instead of trying to eliminate bugs during the
consists of a browser-embedded script auditing development phase. One thing should not be avoided
component, and an IDS that processes the audit logs when discussing the server side solution, the
and compares them to signatures of known malicious performance.
behavior or attacks. With this system, it is possible to Most existing browsers are capable of interpreting
detect various kinds of malicious scripts, not only and executing scripts created in such scripting
XSS attacks. languages as JavaScript, JScript, VBScript that are
However, the system has significant weakness: it can embedded in the Web-page downloads from the Web
only detect the XSS attacks whose behavior haven server. When an attacker introduces a malicious
IJCSI International Journal of Computer Science Issues, Vol. 8, Issue 4, No 1, July 2011
ISSN (Online): 1694-0814
www.IJCSI.org 653
script to a dynamic form submitted by the user, a web site. We assume the attacker has the following
cross-site scripting (XSS) attack then occurs. abilities:
• The attacker owns and operates a web site.
4. PROPOSED MODEL • The user visits the attacker's web site.
• The target web site lets the attacker inject an
The solutions on server side result in considerable arbitrary sequence of bytes into the entity-
degradation of web application and are often body of one of its HTTP responses.
unreliable, whereas the client side solutions result in
a poor web browsing experience, there is need of an Vulnerability Coverage. Ideally, a client-side XSS
efficient client side solution which does not degrade would prevent all attacks against all vulnerabilities.
the performance. The proposed system is designed in However, implementation is infeasible. Instead, we
order to provide effective security against the Cross focus our attention on a narrower threat model that
Site Scripting attack, keeping the concept of usable covers a certain class of vulnerabilities. For example,
security with optimized web browsing. This approach we consider only rejected XSS vulnerabilities, where
uses a three step process: the byte sequence chosen by the attacker appears in
the HTTP request that retrieved the resource.
Attacker Abilities. Client-side XSS _lters are The proposed solution has been tested with thousands
designed to mitigate XSS vulnerabilities in web sites of malicious inputs, non vulnerable input with white
without requiring the web site operator to modify the listed tags and vulnerable websites. Fig. 4 shows
comparison of the proposed browser with Firefox
IJCSI International Journal of Computer Science Issues, Vol. 8, Issue 4, No 1, July 2011
ISSN (Online): 1694-0814
www.IJCSI.org 654