What is XSS

Source: Internet
Author: User

1. What is cross site scripting?

Cross Site Scripting (or XSS) is one of the most common application-layer Web attacks. XSS commonly targets scripts embedded in a page which are executed on the client-side (in the user's web browser) rather than on the server-side. XSS in itself is a threat which is brought about by the Internet security weaknesses of client-side scripting languages, with HTML and JavaScript (others being VBScript, ActiveX, HTML, or flash) as the prime culprits for this exploit. the concept of XSS is to manipulate client-side scripts of a Web application to execute in the manner desired by the malicious user. such a manipulation can embed a script in a page which can be executed every time the page is loaded, or whenever an associated event is wrongly med.

In a typical XSS attack the hacker infects a legitimate Web page with his malicious client-side script. when a user visits this web page the script is downloaded to his browser and executed. there are using slight variations to this theme, however all XSS attacks follow this pattern, which is depicted in the dimo-below.

A basic example of XSS is when a malicious user injects a script in a legitimate shopping site URL which in turn redirects a user to a fake but identical page. the malicious page wocould run a script to capture the cookie of the user browsing the shopping site, and that cookie gets sent to the malicious user who can now hijack the legitimate user's session. although no real hack has been published med against the shopping site, XSS has still exploited a scripting weakness in the page to snare a user and take command of his session. A trick which often is used to make malicous URLs less obvious is to have the XSS part of the URL encoded in hex (or other encoding methods ). this will look harmless to the user who recognizes the URL he is familiar with, and simply disregards and following 'tricked' code which wocould be encoded and therefore inconspicuous.

2. site owners are always confident, but so are hackers!

Without going into complicated technical details, one must be aware of the varous cases which have shown that XSS can have serous consequences when exploited on a vulnerable web application. website owners dismiss XSS on the grounds that it cannot be used to steal sensitive data from a back-end database. this is a common mistake because the consequences of XSS against a web application and its customers have been proven to be very serous, both in terms of application functionality and business operation. an online business project cannot afford to lose the trust of its present and future MERs simply because nobody has ever stepped forward to prove that their site is really vulnerable to XSS exploits. ironically, there are stories of site owners who have boldly claimed that XSS is not really a high-risk exploit. this has often resulted in a public challenge which hackers are always itching to accept, with the site owner having to later deal with a defaced application and public embarrassment.

3. The repercussions of XSS

Analysis of different cases which detail XSS exploits teaches us how the constantly changing Web technology is nowhere close to making applications more secure. A thorough Web search will reveal into stories of large-scale corporation web sites being hacked through XSS exploits, and the reports of such cases always show the same recurring consequences as being of the severe kind.

Exploited XSS is commonly used to achieve the following malicious results:

    • Identity theft
    • Accessing sensitive or restricted information
    • Gaining free access to otherwise paid for content
    • Spying on user's web browsing habits
    • Altering browser functionality
    • Public defamation of an individual or corporation
    • Web application defacement
    • Denial of Service attacks

Any site owner with a healthy level of integrity wocould agree that none of the above can be considered us frivolous or unimportant impacts on a vulnerable site. security flaws in high-profile web sites have allowed hackers to obtain credit card details and user information which allowed them to perform transactions in their name. legitimate users have been frequently tricked into clicking a link which redirects them to a malicious but legitimate-looking page which in turn captures all their details and sends them straight to the hacker. this example might not sound as bad as hacking into a previous ate database; however it takes no effort to cause site visitors or customers to lose their trust in the application's security which in turn can result in liability and loss of business.

4. XSS attack vectors

Internet applications today are not static html pages. they are dynamic and filled with ever changing content. modern web pages pull data from your different sources. this data is amalgamated with your own web page and can contain simple text, or images, and can also contain HTML tags such as

for paragraph, for image and

If you wowould like a deeper discussion on the different XSS attack vectors and examples of what they look like you shoshould refer to the following article, which explains XSS, it's attack vectors and some more examples of what an attack looks like.

5. A practical example of XSS on an acunetix test site.

The following example is not a hacking tutorial. it is just a basic way to demonstrate how XSS can be used to control and modify the functionality of a web page and to re-design the way the page processes its output. the practical use of the example may be freely debated; however anyone may see the regular reports which describe how advanced XSS is used to achieve very complex results, most commonly without being noticed by the user. I encourage also those individuals with no hacking knowledge to try the following example, I am sure you will find it interesting.

1. Load the following link in your browser:Http://testasp.vulnweb.com/search.asp, You will notice that the page is a simple page with an input field for running a search

2. Try to insert the following code into the search field, and notice how a login form will be displayed on the page:

Please login with the form below before proceeding:<Br> Please login with the form below before proceeding: <form action = "destination. ASP "> <Table> <tr> <TD> login: </TD> <input type = text length = 20 name = login> </TD> </tr> <TD> password: </TD> <input type = text length = 20 name = PASSWORD> </TD> </tr> </table> <input type = submit value = login> </form>,Then simply hit the search button after inserting the code.

Through the XSS flaw on the page, it has been possible to create a fake login form which can convince gather a user's credentials. as seen in step 2, the Code contains a section which mentions "destination. ASP ". that is where a hacker can decide where the fake login form will send the user's log-in details for them to be retrieved and used maliciously.

A hacker can also inject this code by passing it around und via the browser's address bar as follows:

Http://testasp.vulnweb.com/Search.asp? Tfsearch = % 3cbr % 3E % 3cbr % 3 eplease + login + with +
The + form + below + before + proceeding % 3A % 3C form + action % 3d % 22test. asp % 22% 3E % 3C
Table % 3E % 3ctr % 3E % 3ctd % 3 elogin % 3A % 3C % 2ftd % 3E % 3ctd % 3E % 3 cinput + type % 3d
Text + Length % 3d20 + name % 3 dlogin % 3E % 3C % 2ftd % 3E % 3C % 2ftr % 3E % 3ctr % 3E % 3C
TD % 3 epassword % 3A % 3C % 2ftd % 3E % 3ctd % 3E % 3 cinput + type % 3 dtext + Length % 3d20
+ Name % 3 dpassword % 3E % 3C % 2ftd % 3E % 3C % 2ftr % 3E % 3C % 2 ftable % 3E % 3 cinput
+ Type % 3 dsubmit + Value % 3 dlogin % 3E % 3C % 2 fform % 3E

This will create the same result on the page, showing how XSS can be used in several different ways to achieve the same result. after the hacker retrieves the user's log-in credentials, he can easily cause the browser to display the search page as it was originally and the user wocould not even realize that he has just been fooled. this example may also be seen in use in all those spam emails we all receive. it is very common to find an email in your inbox saying how a certain auctioning site suspects that another individual is using your account maliciously, and it then asks you to click a link to validate your identity. this is a similar method which directs the unsuspecting user to a fake version of the auctioning site, and captures the user's log-in credentials to then send them to the hacker.

6. Why wait to be hacked?

The observation which can be made when new stories of the latest hacks are published is that the sites which belong to the large brands and deployments are hacked in exactly the same way as those sites owned by businesses on a much smaller budget. this clearly shows how lack of security is not a matter of resources, but it is directly dependant on the lack of awareness among businesses of all size. statistically, 42% of Web applications which request security audits are vulnerable to XSS, which is clearly the most recurring high-risk exploit among all the applications tested. the effort to raise awareness about how easy it is for an expert hacker to exploit a vulnerable application does not seem to be going too far. it is still very common to see the "we'll see when I get hacked" mentality still lingering among site owners who finally risk losing a lot of money and also the trust of their MERs. anybody with the interest to research this matter will see how even individuals claiming to be security experts feel comfortable to state that XSS is over-rated and cannot really be used to achieve serous results on a Web application. however further research will also prove that statistical figures speak for themselves, and those same statistics keep growing at a rate which will eventually overcast the claims of those incredulous "experts ".

7. Preventing cross site scripting attacks

The purpose of this article is define cross site scripting attacks and give some practical examples. preventing XSS attacks requires diligence from the part of the programmers and the necessary security testing. you can learn more about preventing cross-site scripting attacks here.

8. Scan your site for XSS with the Free Edition of acunetix WVS.

Acunetix web vulnerability available free edition offers the functionality for anyone who wants to test their own application for cross site scripting. acunetix encourages all site owners and developers to visithttp: // www.acunetix.com/cross-site-scripting/scanner.htm and to download the Free Edition of acunetix WVS. this free edition will scan any web application for XSS and it will also reveal all the essential information related to it, such as the vulnerability location and remediation techniques. scanning for XSS is normally a quick exercise (depending on the size of the application) and indeed can surprise all those who really wish to see where their Web site stands from a security point of view.

 

See also:

Http://jax-work-archive.blogspot.jp/2010/05/xss.html

 

 

 

 

 

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.