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.
Issue remediation
In most situations where user-controllable data is copied into application responses, cross-site scripting attacks can be prevented using two layers of defenses:
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 REST URL parameter 4 is copied into the value of an HTML tag attribute which is encapsulated in single quotation marks. The payload d1205'style%3d'x%3aexpression(alert(1))'04ac6827f1e was submitted in the REST URL parameter 4. This input was echoed as d1205'style='x:expression(alert(1))'04ac6827f1e in the application's response.
This proof-of-concept attack demonstrates that it is possible to inject arbitrary JavaScript into the application's response. The PoC attack demonstrated uses a dynamically evaluated expression with a style attribute to introduce arbirary JavaScript into the document. Note that this technique is specific to Internet Explorer, and may not work on other browsers.
Request
GET /app/center/nlvisitor.nl/c.1034828d1205'style%3d'x%3aexpression(alert(1))'04ac6827f1e/n.3/sc.6/.f HTTP/1.1 Host: checkout.netsuite.com Accept: */* Accept-Language: en User-Agent: Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 6.0) Connection: close Cookie: NLVisitorId=rnoX2kNXAZKv7gpK; JSESSIONID=LycGMyBNRjjQpg2yQxfl568LH03v7PJ2JZhbrvfVJvqcPnWypyG9MDpC5CBHkTSjvQXJ7XfkxPhrQJbWLwsx4vv2QwMgnpHZ4bfg8R2qCtRQh3R6Q1mQQGCHQQcl4G9c!-548196153; NLShopperId3=rnoX2q9XAatYKaJC; __utmz=1.1289244024.1.1.utmcsr=(direct)|utmccn=(direct)|utmcmd=(none); StoreEmail=rt'@1.com; NLShopperId7=rnoX2qVXAQEJBIY6; NS_VER=2010.2.0; __utma=1.2027734133.1289244024.1289251037.1290273104.3; __utmc=1; __utmb=1.2.10.1290273104; NLShopperId=rnoX2lhXAQEmkIji;
The value of REST URL parameter 5 is copied into the value of an HTML tag attribute which is encapsulated in single quotation marks. The payload ea1e0%2527a%253d%2527b%2527a4e19e91a04 was submitted in the REST URL parameter 5. This input was echoed as ea1e0'a='b'a4e19e91a04 in the application's response.
This behaviour demonstrates that it is possible to inject new attributes into an existing HTML tag. An attempt was made to identify a full proof-of-concept attack for injecting arbitrary JavaScript but this was not successful. You should manually examine the application's behaviour and attempt to identify any unusual input validation or other obstacles that may be in place.
The application attempts to block certain characters that are often used in XSS attacks but this can be circumvented by double URL-encoding the required characters - for example, by submitting %253c instead of the < character.
Remediation detail
There is probably no need to perform a second URL-decode of the value of REST URL parameter 5 as the web server will have already carried out one decode. In any case, the application should perform its input validation after any custom canonicalisation has been carried out.
Request
GET /app/center/nlvisitor.nl/c.1034828/n.3ea1e0%2527a%253d%2527b%2527a4e19e91a04/sc.6/.f HTTP/1.1 Host: checkout.netsuite.com Accept: */* Accept-Language: en User-Agent: Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 6.0) Connection: close Cookie: NLVisitorId=rnoX2kNXAZKv7gpK; JSESSIONID=LycGMyBNRjjQpg2yQxfl568LH03v7PJ2JZhbrvfVJvqcPnWypyG9MDpC5CBHkTSjvQXJ7XfkxPhrQJbWLwsx4vv2QwMgnpHZ4bfg8R2qCtRQh3R6Q1mQQGCHQQcl4G9c!-548196153; NLShopperId3=rnoX2q9XAatYKaJC; __utmz=1.1289244024.1.1.utmcsr=(direct)|utmccn=(direct)|utmcmd=(none); StoreEmail=rt'@1.com; NLShopperId7=rnoX2qVXAQEJBIY6; NS_VER=2010.2.0; __utma=1.2027734133.1289244024.1289251037.1290273104.3; __utmc=1; __utmb=1.2.10.1290273104; NLShopperId=rnoX2lhXAQEmkIji;
The value of the redirect request parameter is copied into the HTML document as plain text between tags. The payload f1799<script>alert(1)</script>85b0cbdcd5eeb48c1 was submitted in the redirect 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.
The original request used the POST method, however it was possible to convert the request to use the GET method, to enable easier demonstration and delivery of the attack.
The value of the redirect request parameter is copied into the value of an HTML tag attribute which is encapsulated in single quotation marks. The payload 87277'><script>alert(1)</script>0d33e5361ab was submitted in the redirect 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.
The value of the redirect request parameter is copied into the value of an HTML tag attribute which is encapsulated in single quotation marks. The payload 12983'><script>alert(1)</script>f4dd61d6b9f81a0d8 was submitted in the redirect 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.
The original request used the POST method, however it was possible to convert the request to use the GET method, to enable easier demonstration and delivery of the attack.
The value of REST URL parameter 1 is copied into a JavaScript string which is encapsulated in double quotation marks. The payload 67a32"%3b9a1fdcd0d7 was submitted in the REST URL parameter 1. This input was echoed as 67a32";9a1fdcd0d7 in the application's response.
This behaviour demonstrates that it is possible to terminate the JavaScript string into which our data is being copied. An attempt was made to identify a full proof-of-concept attack for injecting arbitrary JavaScript but this was not successful. You should manually examine the application's behaviour and attempt to identify any unusual input validation or other obstacles that may be in place.
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.
HTTP/1.1 404 Not Found Date: Sat, 20 Nov 2010 17:28:59 GMT Server: Apache Content-Length: 2691 Expires: Sun, 21 Nov 2010 07:15:59 GMT Last-Modified: Thu, 01 Jan 1970 00:00:00 GMT encoding: UTF-8 Content-Language: UTF-8 P3P: CP="CAO PSAa OUR BUS PUR" Vary: User-Agent Keep-Alive: timeout=10, max=999 Connection: Keep-Alive Content-Type: text/javascript; charset=UTF-8
...[SNIP]...
alert("Script file 'https://checkout.netsuite.com/67a32";9a1fdcd0d7/site/drop_down_menu/anylinkcssmenu.js' not found");
1.7. https://checkout.netsuite.com/citricle-ga/ [name of an arbitrarily supplied request parameter]previousnext
Summary
Severity:
High
Confidence:
Certain
Host:
https://checkout.netsuite.com
Path:
/citricle-ga/
Issue detail
The name of an arbitrarily supplied request parameter is copied into the value of an HTML tag attribute which is encapsulated in single quotation marks. The payload 5d377'%20style%3dx%3aexpression(alert(1))%20caad02a7c27 was submitted in the name of an arbitrarily supplied request parameter. This input was echoed as 5d377\' style=x:expression(alert(1)) caad02a7c27 in the application's response.
This proof-of-concept attack demonstrates that it is possible to inject arbitrary JavaScript into the application's response. The PoC attack demonstrated uses a dynamically evaluated expression with a style attribute to introduce arbirary JavaScript into the document. Note that this technique is specific to Internet Explorer, and may not work on other browsers.
Request
GET /citricle-ga/?5d377'%20style%3dx%3aexpression(alert(1))%20caad02a7c27=1 HTTP/1.1 Host: checkout.netsuite.com Accept: */* Accept-Language: en User-Agent: Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 6.0) Connection: close Cookie: NLVisitorId=rnoX2kNXAZKv7gpK; loginredirect=T; JSESSIONID=dhQMMyJDpGpPkZGgt12gQSdl2ZxqXVLWRpRGDFyvG6Jv4j6tbFfKcQZD64vmtnhKLhRymJDB9Fv1RDGJXWqCm5hvXJvNQ9fxsVfFB0tVjPwKYx6gZ1fBZsh1JQYRnRZG!-1642534427; NLShopperId3=rnoX2q9XAatYKaJC; __utmz=1.1289244024.1.1.utmcsr=(direct)|utmccn=(direct)|utmcmd=(none); StoreEmail=rt'@1.com; NLShopperId7=rnoX2qVXAQEJBIY6; NS_VER=2010.2.0; __utma=1.2027734133.1289244024.1289251037.1290273104.3; __utmc=1; __utmb=1.4.10.1290273104; NLShopperId=rnoX2lhXAQEmkIji;
1.8. https://checkout.netsuite.com/citricle-ga/ [name of an arbitrarily supplied request parameter]previousnext
Summary
Severity:
High
Confidence:
Certain
Host:
https://checkout.netsuite.com
Path:
/citricle-ga/
Issue detail
The name of an arbitrarily supplied request parameter is copied into a JavaScript string which is encapsulated in single quotation marks. The payload 7175f\'%3balert(1)//122e2e8962c was submitted in the name of an arbitrarily supplied request parameter. This input was echoed as 7175f\\';alert(1)//122e2e8962c in the application's response.
This proof-of-concept attack demonstrates that it is possible to inject arbitrary JavaScript into the application's response.
The application attempts to prevent termination of the quoted JavaScript string by placing a backslash character (\) before any quotation mark characters contained within the input. The purpose of this defense is to escape the quotation mark and prevent it from terminating the string. However, the application fails to escape any backslash characters that already appear within the input itself. This enables an attacker to supply their own backslash character before the quotation mark, which has the effect of escaping the backslash character added by the application, and so the quotation mark remains unescaped and succeeds in terminating the string. This technique is used in the attack demonstrated.
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. If it is unavoidable to echo user input into a quoted JavaScript string the the backslash character should be blocked, or escaped by replacing it with two backslashes.
Request
GET /citricle-ga/?7175f\'%3balert(1)//122e2e8962c=1 HTTP/1.1 Host: checkout.netsuite.com Accept: */* Accept-Language: en User-Agent: Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 6.0) Connection: close Cookie: NLVisitorId=rnoX2kNXAZKv7gpK; loginredirect=T; JSESSIONID=dhQMMyJDpGpPkZGgt12gQSdl2ZxqXVLWRpRGDFyvG6Jv4j6tbFfKcQZD64vmtnhKLhRymJDB9Fv1RDGJXWqCm5hvXJvNQ9fxsVfFB0tVjPwKYx6gZ1fBZsh1JQYRnRZG!-1642534427; NLShopperId3=rnoX2q9XAatYKaJC; __utmz=1.1289244024.1.1.utmcsr=(direct)|utmccn=(direct)|utmcmd=(none); StoreEmail=rt'@1.com; NLShopperId7=rnoX2qVXAQEJBIY6; NS_VER=2010.2.0; __utma=1.2027734133.1289244024.1289251037.1290273104.3; __utmc=1; __utmb=1.4.10.1290273104; NLShopperId=rnoX2lhXAQEmkIji;
The value of REST URL parameter 1 is copied into a JavaScript string which is encapsulated in double quotation marks. The payload 49886"%3bd493f9d8869 was submitted in the REST URL parameter 1. This input was echoed as 49886";d493f9d8869 in the application's response.
This behaviour demonstrates that it is possible to terminate the JavaScript string into which our data is being copied. An attempt was made to identify a full proof-of-concept attack for injecting arbitrary JavaScript but this was not successful. You should manually examine the application's behaviour and attempt to identify any unusual input validation or other obstacles that may be in place.
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.
HTTP/1.1 404 Not Found Date: Sat, 20 Nov 2010 17:50:29 GMT Server: Apache Content-Length: 2672 Expires: Sun, 21 Nov 2010 07:15:29 GMT Last-Modified: Thu, 01 Jan 1970 00:00:00 GMT encoding: UTF-8 Content-Language: UTF-8 P3P: CP="CAO PSAa OUR BUS PUR" Vary: User-Agent Keep-Alive: timeout=10, max=974 Connection: Keep-Alive Content-Type: text/javascript; charset=UTF-8
...[SNIP]...
alert("Script file 'https://checkout.netsuite.com/javascript49886";d493f9d8869/help.js' not found");
1.10. https://checkout.netsuite.com/s.nl [name of an arbitrarily supplied request parameter]previousnext
Summary
Severity:
High
Confidence:
Certain
Host:
https://checkout.netsuite.com
Path:
/s.nl
Issue detail
The name of an arbitrarily supplied request parameter is copied into the value of an HTML tag attribute which is encapsulated in single quotation marks. The payload %009847a'style%3d'x%3aexpression(alert(1))'ba0bac45916 was submitted in the name of an arbitrarily supplied request parameter. This input was echoed as 9847a'style='x:expression(alert(1))'ba0bac45916 in the application's response.
This proof-of-concept attack demonstrates that it is possible to inject arbitrary JavaScript into the application's response. The PoC attack demonstrated uses a dynamically evaluated expression with a style attribute to introduce arbirary JavaScript into the document. Note that this technique is specific to Internet Explorer, and may not work on other browsers.
The application attempts to block certain characters that are often used in XSS attacks but this can be circumvented by submitting a URL-encoded NULL byte (%00) anywhere before the characters that are being blocked.
Remediation detail
NULL byte bypasses typically arise when the application is being defended by a web application firewall (WAF) that is written in native code, where strings are terminated by a NULL byte. You should fix the actual vulnerability within the application code, and if appropriate ask your WAF vendor to provide a fix for the NULL byte bypass.
1.11. https://checkout.netsuite.com/s.nl [name of an arbitrarily supplied request parameter]previousnext
Summary
Severity:
High
Confidence:
Certain
Host:
https://checkout.netsuite.com
Path:
/s.nl
Issue detail
The name of an arbitrarily supplied request parameter is copied into the value of an HTML tag attribute which is encapsulated in single quotation marks. The payload 8bc49'style%3d'x%3aexpression(alert(1))'02b68d32520 was submitted in the name of an arbitrarily supplied request parameter. This input was echoed as 8bc49'style='x:expression(alert(1))'02b68d32520 in the application's response.
This proof-of-concept attack demonstrates that it is possible to inject arbitrary JavaScript into the application's response. The PoC attack demonstrated uses a dynamically evaluated expression with a style attribute to introduce arbirary JavaScript into the document. Note that this technique is specific to Internet Explorer, and may not work on other browsers.
The value of the vid request parameter is copied into the value of an HTML tag attribute which is encapsulated in single quotation marks. The payload be972'><script>alert(1)</script>b07e51e7e4a was submitted in the vid 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.