The name of an arbitrarily supplied request parameter is copied into a JavaScript string which is encapsulated in double quotation marks. The payload 86571"-alert(1)-"53dc00d3df5 was submitted in the name of an arbitrarily supplied request 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.
Issue background
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.
Request
GET /home/html/researcher.en.html?86571"-alert(1)-"53dc00d3df5=1 HTTP/1.1 Host: www.ecb.int Proxy-Connection: keep-alive Referer: http://www.ecb.int/home/html/index.en.html Accept: application/xml,application/xhtml+xml,text/html;q=0.9,text/plain;q=0.8,image/png,*/*;q=0.5 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: __utmz=268787301.1293817340.1.1.utmcsr=google|utmccn=(organic)|utmcmd=organic|utmctr=European%20Central%20Bank; __utma=268787301.2094457390.1293817340.1293817340.1293817340.1; __utmc=268787301; __utmb=268787301.1.10.1293817340
Response
HTTP/1.1 200 OK Date: Fri, 31 Dec 2010 17:49:12 GMT Server: Apache/2.2.3 (Linux/SUSE) X-Powered-By: PHP/5.2.5 Content-Type: text/html Content-Language: en Content-Length: 47651
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en">
<head> <title>ECB: Resear ...[SNIP]... <script type="text/javascript"> var xajaxRequestUri="http://www.ecb.int/home/html/researcher.en.html?86571"-alert(1)-"53dc00d3df5=1"; var xajaxDebug=false; var xajaxStatusMessages=false; var xajaxWaitCursor=true; var xajaxDefinedGet=0; var xajaxDefinedPost=1; var xajaxLoaded=false; function xajax_getAbstract(){return xajax.call( ...[SNIP]...
2. Email addresses disclosedpreviousnext There are 2 instances of this issue:
The presence of email addresses within application responses does not necessarily constitute a security vulnerability. Email addresses may appear intentionally within contact information, and many applications (such as web mail) include arbitrary third-party email addresses within their core content.
However, email addresses of developers and other individuals (whether appearing on-screen or hidden within page source) may disclose information that is useful to an attacker; for example, they may represent usernames that can be used at the application's login, and they may be used in social engineering attacks against the organisation's personnel. Unnecessary or excessive disclosure of email addresses may also lead to an increase in the volume of spam email received.
Issue remediation
You should review the email addresses being disclosed by the application, and consider removing any that are unnecessary, or replacing personal addresses with anonymous mailbox addresses (such as helpdesk@example.com).
/** * Cookie plugin * * Copyright (c) 2006 Klaus Hartl (stilbuero.de) * Dual licensed under the MIT and GPL licenses: * http://www.opensource.org/licenses/mit-license.php * http://www.gnu.org/li ...[SNIP]... kie will be set and the cookie transmission will * require a secure protocol (like HTTPS). * @type undefined * * @name $.cookie * @cat Plugins/Cookie * @author Klaus Hartl/klaus.hartl@stilbuero.de */
/** * Get the value of a cookie with the given name. * * @example $.cookie('the_cookie'); * @desc Get the value of a cookie. * * @param String name The name of the cookie. * @return The value of the cookie. * @type String * * @name $.cookie * @cat Plugins/Cookie * @author Klaus Hartl/klaus.hartl@stilbuero.de */ jQuery.cookie = function(name, value, options) { if (typeof value != 'undefined') { // name and value given, set cookie options = options || {}; if (value === null) {
The following email addresses were disclosed in the response:
dave.methvin@gmail.com
malsup@gmail.com
Request
GET /shared/js/jquery.corner.js HTTP/1.1 Host: www.ecb.int Proxy-Connection: keep-alive Referer: http://www.ecb.int/home/html/index.en.html 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
Response
HTTP/1.1 200 OK Date: Fri, 31 Dec 2010 17:43:00 GMT Server: Apache/2.2.3 (Linux/SUSE) Last-Modified: Fri, 06 Feb 2009 12:29:53 GMT ETag: "af86ae-1e31-4623f2d851240" Accept-Ranges: bytes Content-Length: 7729 Content-Type: text/x-js
/* * jQuery corner plugin * * version 1.92 (12/18/2007) * * Dual licensed under the MIT and GPL licenses: * http://www.opensource.org/licenses/mit-license.php * http://www.gnu.org/licenses/ ...[SNIP]... ng both the element and its parent * * @name corner * @type jQuery * @param String options Options which control the corner style * @cat Plugins/Corner * @return jQuery * @author Dave Methvin (dave.methvin@gmail.com) * @author Mike Alsup (malsup@gmail.com) */ (function($) {
$.fn.corner = function(o) { var ie6 = $.browser.msie && /MSIE 6.0/.test(navigator.userAgent); function sz(el, p) { return parseInt($.css(el,p))||0; }; function hex2(s ...[SNIP]...
3. Credit card numbers disclosedprevious There are 3 instances of this issue:
Responses containing credit card numbers may not represent any security vulnerability - for example, a number may belong to the logged-in user to whom it is displayed. You should verify whether the numbers identified are actually valid credit card numbers and whether their disclosure within the application is appropriate.
The following credit card number was disclosed in the response:
5565565560000000
Request
GET /pub/pdf/other/ecbresearchevaluationfinalen.pdf HTTP/1.1 Host: www.ecb.int Accept: */* Accept-Language: en User-Agent: Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 6.0) Connection: close Cookie: __utmz=268787301.1293817340.1.1.utmcsr=google|utmccn=(organic)|utmcmd=organic|utmctr=European%20Central%20Bank; __utma=268787301.2094457390.1293817340.1293817340.1293817340.1; __utmc=268787301; __utmb=268787301.1.10.1293817340;
Response
HTTP/1.1 200 OK Date: Fri, 31 Dec 2010 17:48:41 GMT Server: Apache/2.2.3 (Linux/SUSE) Last-Modified: Thu, 20 Aug 2009 09:16:02 GMT ETag: "b50a0-3bf0d-4718f33503880" Accept-Ranges: bytes Content-Length: 245517 Connection: close Content-Type: application/pdf
The following credit card numbers were disclosed in the response:
4900313354281
5620882000000000
Request
GET /pub/pdf/scpwps/ecbwp030.pdf HTTP/1.1 Host: www.ecb.int Accept: */* Accept-Language: en User-Agent: Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 6.0) Connection: close Cookie: __utmz=268787301.1293817340.1.1.utmcsr=google|utmccn=(organic)|utmcmd=organic|utmctr=European%20Central%20Bank; __utma=268787301.2094457390.1293817340.1293817340.1293817340.1; __utmc=268787301; __utmb=268787301.1.10.1293817340;
Response
HTTP/1.1 200 OK Date: Fri, 31 Dec 2010 17:48:49 GMT Server: Apache/2.2.3 (Linux/SUSE) Last-Modified: Fri, 28 Nov 2003 15:19:53 GMT ETag: "270177-1777a5-3cd306c865840" Accept-Ranges: bytes Content-Length: 1537957 Connection: close Content-Type: application/pdf
The following credit card numbers were disclosed in the response:
4584584174170000
5005005005002780
5287225285284440
Request
GET /pub/pdf/scpwps/ecbwp944.pdf HTTP/1.1 Host: www.ecb.int Accept: */* Accept-Language: en User-Agent: Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 6.0) Connection: close Cookie: __utmz=268787301.1293817340.1.1.utmcsr=google|utmccn=(organic)|utmcmd=organic|utmctr=European%20Central%20Bank; __utma=268787301.2094457390.1293817340.1293817340.1293817340.1; __utmc=268787301; __utmb=268787301.1.10.1293817340;
Response
HTTP/1.1 200 OK Date: Fri, 31 Dec 2010 17:48:44 GMT Server: Apache/2.2.3 (Linux/SUSE) Last-Modified: Mon, 13 Oct 2008 10:41:36 GMT ETag: "270541-1d2ace-4592024ad3800" Accept-Ranges: bytes Content-Length: 1911502 Connection: close Content-Type: application/pdf