The value of the [Place%20Your%20Cache%20Buster%20ID%20here]&ASTPCT request parameter is copied into a JavaScript string which is encapsulated in single quotation marks. The payload 7b2c1'-alert(1)-'e487fce3e94 was submitted in the [Place%20Your%20Cache%20Buster%20ID%20here]&ASTPCT 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.
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:
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.
Request
GET /p/kl/46/799/r/12/4/8/ast0k3n/cj_K_lW0d4_d3JJuxKB7S1iRpEVo0XCH/view.html?[Place%20Your%20Cache%20Buster%20ID%20here]&ASTPCT=7b2c1'-alert(1)-'e487fce3e94 HTTP/1.1 Host: this.content.served.by.adshuffle.com Proxy-Connection: keep-alive Referer: http://www.newsmax.com/ User-Agent: Mozilla/5.0 (Windows; U; Windows NT 6.1; en-US) AppleWebKit/534.16 (KHTML, like Gecko) Chrome/10.0.648.151 Safari/534.16 Accept: application/xml,application/xhtml+xml,text/html;q=0.9,text/plain;q=0.8,image/png,*/*;q=0.5 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: v=576462396446310722; ts=2/23/2011+9:38:20+PM; z=4; sid=4b2be264-f94d-44a8-b2d8-ea9c07cda0c3; pxl=1062:428FD4; px=1062:00223111538; av1=ce447.6ab11=0223111538; vcs0=vCE447:6AB11_0_0_0_2147EA_0_0
Response
HTTP/1.1 200 OK Cache-Control: private, no-cache="Set-Cookie" Pragma: no-cache Content-Type: text/html; charset=utf-8 Expires: Sat, 19 Mar 2011 13:51:14 GMT Server: Microsoft-IIS/7.0 P3P: CP="CURa ADMa DEVa PSAo PSDo OUR BUS UNI PUR INT DEM STA PRE COM NAV OTC NOI DSP COR" Set-Cookie: ts=3/19/2011+1:51:14+PM; domain=by.adshuffle.com; expires=Thu, 01-Jan-2099 06:00:00 GMT; path=/ Set-Cookie: z=4; domain=by.adshuffle.com; expires=Thu, 01-Jan-2099 06:00:00 GMT; path=/ Set-Cookie: av1=ce447.6ab11=0223111538; domain=by.adshuffle.com; expires=Thu, 01-Jan-2099 06:00:00 GMT; path=/ Set-Cookie: vcs0=vCE447:6AB11_0_0_0_2147EA_0_0; domain=by.adshuffle.com; expires=Thu, 01-Jan-2099 06:00:00 GMT; path=/ Date: Sat, 19 Mar 2011 13:51:14 GMT Content-Length: 1130 Set-Cookie: NSC_betivggmf-opef=ffffffff0908153445525d5f4f58455e445a4a423660;expires=Sat, 19-Mar-2011 13:56:14 GMT;path=/
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.
The cookies do not appear to contain session tokens, which may reduce the risk associated with this issue. You should review the contents of the cookies to determine their function.
Request
GET /p/kl/46/799/r/12/4/8/ast0k3n/cj_K_lW0d4_d3JJuxKB7S1iRpEVo0XCH/view.html?[Place%20Your%20Cache%20Buster%20ID%20here]&ASTPCT=[Place%20Your%20Click%20Tracking%20URL%20Here] HTTP/1.1 Host: this.content.served.by.adshuffle.com Proxy-Connection: keep-alive Referer: http://www.newsmax.com/ User-Agent: Mozilla/5.0 (Windows; U; Windows NT 6.1; en-US) AppleWebKit/534.16 (KHTML, like Gecko) Chrome/10.0.648.151 Safari/534.16 Accept: application/xml,application/xhtml+xml,text/html;q=0.9,text/plain;q=0.8,image/png,*/*;q=0.5 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: v=576462396446310722; ts=2/23/2011+9:38:20+PM; z=4; sid=4b2be264-f94d-44a8-b2d8-ea9c07cda0c3; pxl=1062:428FD4; px=1062:00223111538; av1=ce447.6ab11=0223111538; vcs0=vCE447:6AB11_0_0_0_2147EA_0_0
Response
HTTP/1.1 200 OK Cache-Control: private, no-cache="Set-Cookie" Pragma: no-cache Content-Type: text/html; charset=utf-8 Expires: Sat, 19 Mar 2011 13:51:07 GMT Server: Microsoft-IIS/7.0 P3P: CP="CURa ADMa DEVa PSAo PSDo OUR BUS UNI PUR INT DEM STA PRE COM NAV OTC NOI DSP COR" Set-Cookie: ts=3/19/2011+1:51:07+PM; domain=by.adshuffle.com; expires=Thu, 01-Jan-2099 06:00:00 GMT; path=/ Set-Cookie: z=4; domain=by.adshuffle.com; expires=Thu, 01-Jan-2099 06:00:00 GMT; path=/ Set-Cookie: sid=096f678b-736c-435e-8cde-3ca30fcf9aaf; domain=by.adshuffle.com; expires=Thu, 01-Jan-2099 06:00:00 GMT; path=/ Set-Cookie: av1=ce447.6ab11=0223111538; domain=by.adshuffle.com; expires=Thu, 01-Jan-2099 06:00:00 GMT; path=/ Set-Cookie: vcs0=vCE447:6AB11_0_0_0_2147EA_0_0; domain=by.adshuffle.com; expires=Thu, 01-Jan-2099 06:00:00 GMT; path=/ Date: Sat, 19 Mar 2011 13:51:06 GMT Content-Length: 1078 Set-Cookie: NSC_betivggmf-opef=ffffffff0908150245525d5f4f58455e445a4a423660;expires=Sat, 19-Mar-2011 13:56:07 GMT;path=/
The cookies do not appear to contain session tokens, which may reduce the risk associated with this issue. You should review the contents of the cookies to determine their function.
HTTP/1.1 302 Found Cache-Control: private, no-cache="Set-Cookie" Pragma: no-cache Content-Type: text/html; charset=utf-8 Expires: Sat, 19 Mar 2011 13:51:34 GMT Location: http://media2.adshuffle.com/images/744787/17cc6427fae343a8b8b0b2e848929206.gif Server: Microsoft-IIS/7.0 P3P: CP="CURa ADMa DEVa PSAo PSDo OUR BUS UNI PUR INT DEM STA PRE COM NAV OTC NOI DSP COR" Set-Cookie: vc=; domain=by.adshuffle.com; expires=Tue, 01-Jan-1980 06:00:00 GMT; path=/ Set-Cookie: av1=ce447.6ab11=0223111538:b5d53.6f0d1=0319110851; domain=by.adshuffle.com; expires=Thu, 01-Jan-2099 06:00:00 GMT; path=/ Set-Cookie: vcs0=vCE447:6AB11_0_0_0_2147EA_0_0|vB5D53:6F0D1_0_0_0_21CD53_0_0; domain=by.adshuffle.com; expires=Thu, 01-Jan-2099 06:00:00 GMT; path=/ Date: Sat, 19 Mar 2011 13:51:34 GMT Content-Length: 195 Set-Cookie: NSC_betivggmf-opef=ffffffff0908150045525d5f4f58455e445a4a423660;expires=Sat, 19-Mar-2011 13:56:34 GMT;path=/
<html><head><title>Object moved</title></head><body> <h2>Object moved to <a href="http://media2.adshuffle.com/images/744787/17cc6427fae343a8b8b0b2e848929206.gif">here</a>.</h2> </body></html>
The cookies do not appear to contain session tokens, which may reduce the risk associated with this issue. You should review the contents of the cookies to determine their function.
HTTP/1.1 302 Found Cache-Control: private, no-cache="Set-Cookie" Pragma: no-cache Content-Type: text/html; charset=utf-8 Expires: Sat, 19 Mar 2011 14:16:28 GMT Location: http://media2.adshuffle.com/images/744787/e4addacb1a334e8d8ba9da877ad7de73.gif Server: Microsoft-IIS/7.0 P3P: CP="CURa ADMa DEVa PSAo PSDo OUR BUS UNI PUR INT DEM STA PRE COM NAV OTC NOI DSP COR" Set-Cookie: vc=; domain=by.adshuffle.com; expires=Tue, 01-Jan-1980 06:00:00 GMT; path=/ Set-Cookie: av1=ce447.6ab11=0223111538:b5d53.6f0d0=0319110916; domain=by.adshuffle.com; expires=Thu, 01-Jan-2099 06:00:00 GMT; path=/ Set-Cookie: vcs0=vCE447:6AB11_0_0_0_2147EA_0_0|vB5D53:6F0D0_0_0_0_21CD6C_0_0; domain=by.adshuffle.com; expires=Thu, 01-Jan-2099 06:00:00 GMT; path=/ Date: Sat, 19 Mar 2011 14:16:27 GMT Content-Length: 195 Set-Cookie: NSC_betivggmf-opef=ffffffff0908150045525d5f4f58455e445a4a423660;expires=Sat, 19-Mar-2011 14:21:28 GMT;path=/
<html><head><title>Object moved</title></head><body> <h2>Object moved to <a href="http://media2.adshuffle.com/images/744787/e4addacb1a334e8d8ba9da877ad7de73.gif">here</a>.</h2> </body></html>
The cookies do not appear to contain session tokens, which may reduce the risk associated with this issue. You should review the contents of the cookies to determine their function.
HTTP/1.1 302 Found Cache-Control: private, no-cache="Set-Cookie" Pragma: no-cache Content-Type: text/html; charset=utf-8 Expires: Sat, 19 Mar 2011 13:59:42 GMT Location: http://media2.adshuffle.com/images/744787/e4addacb1a334e8d8ba9da877ad7de73.gif Server: Microsoft-IIS/7.0 P3P: CP="CURa ADMa DEVa PSAo PSDo OUR BUS UNI PUR INT DEM STA PRE COM NAV OTC NOI DSP COR" Set-Cookie: sid=057dd0d7-8a86-43f6-9926-9e613cb107f8; domain=by.adshuffle.com; expires=Thu, 01-Jan-2099 06:00:00 GMT; path=/ Set-Cookie: vc=; domain=by.adshuffle.com; expires=Tue, 01-Jan-1980 06:00:00 GMT; path=/ Set-Cookie: av1=ce447.6ab11=0223111538:b5d53.6f0d0=0319110859; domain=by.adshuffle.com; expires=Thu, 01-Jan-2099 06:00:00 GMT; path=/ Set-Cookie: vcs0=vCE447:6AB11_0_0_0_2147EA_0_0|vB5D53:6F0D0_0_0_0_21CD5B_0_0; domain=by.adshuffle.com; expires=Thu, 01-Jan-2099 06:00:00 GMT; path=/ Date: Sat, 19 Mar 2011 13:59:41 GMT Content-Length: 195 Set-Cookie: NSC_betivggmf-opef=ffffffff0908153445525d5f4f58455e445a4a423660;expires=Sat, 19-Mar-2011 14:04:42 GMT;path=/
<html><head><title>Object moved</title></head><body> <h2>Object moved to <a href="http://media2.adshuffle.com/images/744787/e4addacb1a334e8d8ba9da877ad7de73.gif">here</a>.</h2> </body></html>
3. Cookie without HttpOnly flag setpreviousnext There are 5 instances of this issue:
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.
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 /favicon.ico HTTP/1.1 Host: this.content.served.by.adshuffle.com Proxy-Connection: keep-alive Accept: */* User-Agent: Mozilla/5.0 (Windows; U; Windows NT 6.1; en-US) AppleWebKit/534.16 (KHTML, like Gecko) Chrome/10.0.648.151 Safari/534.16 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: v=576462396446310722; pxl=1062:428FD4; px=1062:00223111538; ts=3/19/2011+1:51:14+PM; z=4; sid=057dd0d7-8a86-43f6-9926-9e613cb107f8; av1=ce447.6ab11=0223111538:b5d53.6f0d0=0319110851; vcs0=vCE447:6AB11_0_0_0_2147EA_0_0|vB5D53:6F0D0_0_0_0_21CD53_0_0; NSC_betivggmf-opef=ffffffff0908153445525d5f4f58455e445a4a423660
The cookies do not appear to contain session tokens, which may reduce the risk associated with this issue. You should review the contents of the cookies to determine their function.
Request
GET /p/kl/46/799/r/12/4/8/ast0k3n/cj_K_lW0d4_d3JJuxKB7S1iRpEVo0XCH/view.html?[Place%20Your%20Cache%20Buster%20ID%20here]&ASTPCT=[Place%20Your%20Click%20Tracking%20URL%20Here] HTTP/1.1 Host: this.content.served.by.adshuffle.com Proxy-Connection: keep-alive Referer: http://www.newsmax.com/ User-Agent: Mozilla/5.0 (Windows; U; Windows NT 6.1; en-US) AppleWebKit/534.16 (KHTML, like Gecko) Chrome/10.0.648.151 Safari/534.16 Accept: application/xml,application/xhtml+xml,text/html;q=0.9,text/plain;q=0.8,image/png,*/*;q=0.5 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: v=576462396446310722; ts=2/23/2011+9:38:20+PM; z=4; sid=4b2be264-f94d-44a8-b2d8-ea9c07cda0c3; pxl=1062:428FD4; px=1062:00223111538; av1=ce447.6ab11=0223111538; vcs0=vCE447:6AB11_0_0_0_2147EA_0_0
Response
HTTP/1.1 200 OK Cache-Control: private, no-cache="Set-Cookie" Pragma: no-cache Content-Type: text/html; charset=utf-8 Expires: Sat, 19 Mar 2011 13:51:07 GMT Server: Microsoft-IIS/7.0 P3P: CP="CURa ADMa DEVa PSAo PSDo OUR BUS UNI PUR INT DEM STA PRE COM NAV OTC NOI DSP COR" Set-Cookie: ts=3/19/2011+1:51:07+PM; domain=by.adshuffle.com; expires=Thu, 01-Jan-2099 06:00:00 GMT; path=/ Set-Cookie: z=4; domain=by.adshuffle.com; expires=Thu, 01-Jan-2099 06:00:00 GMT; path=/ Set-Cookie: sid=096f678b-736c-435e-8cde-3ca30fcf9aaf; domain=by.adshuffle.com; expires=Thu, 01-Jan-2099 06:00:00 GMT; path=/ Set-Cookie: av1=ce447.6ab11=0223111538; domain=by.adshuffle.com; expires=Thu, 01-Jan-2099 06:00:00 GMT; path=/ Set-Cookie: vcs0=vCE447:6AB11_0_0_0_2147EA_0_0; domain=by.adshuffle.com; expires=Thu, 01-Jan-2099 06:00:00 GMT; path=/ Date: Sat, 19 Mar 2011 13:51:06 GMT Content-Length: 1078 Set-Cookie: NSC_betivggmf-opef=ffffffff0908150245525d5f4f58455e445a4a423660;expires=Sat, 19-Mar-2011 13:56:07 GMT;path=/
The cookies do not appear to contain session tokens, which may reduce the risk associated with this issue. You should review the contents of the cookies to determine their function.
HTTP/1.1 302 Found Cache-Control: private, no-cache="Set-Cookie" Pragma: no-cache Content-Type: text/html; charset=utf-8 Expires: Sat, 19 Mar 2011 13:51:34 GMT Location: http://media2.adshuffle.com/images/744787/17cc6427fae343a8b8b0b2e848929206.gif Server: Microsoft-IIS/7.0 P3P: CP="CURa ADMa DEVa PSAo PSDo OUR BUS UNI PUR INT DEM STA PRE COM NAV OTC NOI DSP COR" Set-Cookie: vc=; domain=by.adshuffle.com; expires=Tue, 01-Jan-1980 06:00:00 GMT; path=/ Set-Cookie: av1=ce447.6ab11=0223111538:b5d53.6f0d1=0319110851; domain=by.adshuffle.com; expires=Thu, 01-Jan-2099 06:00:00 GMT; path=/ Set-Cookie: vcs0=vCE447:6AB11_0_0_0_2147EA_0_0|vB5D53:6F0D1_0_0_0_21CD53_0_0; domain=by.adshuffle.com; expires=Thu, 01-Jan-2099 06:00:00 GMT; path=/ Date: Sat, 19 Mar 2011 13:51:34 GMT Content-Length: 195 Set-Cookie: NSC_betivggmf-opef=ffffffff0908150045525d5f4f58455e445a4a423660;expires=Sat, 19-Mar-2011 13:56:34 GMT;path=/
<html><head><title>Object moved</title></head><body> <h2>Object moved to <a href="http://media2.adshuffle.com/images/744787/17cc6427fae343a8b8b0b2e848929206.gif">here</a>.</h2> </body></html>
The cookies do not appear to contain session tokens, which may reduce the risk associated with this issue. You should review the contents of the cookies to determine their function.
HTTP/1.1 302 Found Cache-Control: private, no-cache="Set-Cookie" Pragma: no-cache Content-Type: text/html; charset=utf-8 Expires: Sat, 19 Mar 2011 14:16:28 GMT Location: http://media2.adshuffle.com/images/744787/e4addacb1a334e8d8ba9da877ad7de73.gif Server: Microsoft-IIS/7.0 P3P: CP="CURa ADMa DEVa PSAo PSDo OUR BUS UNI PUR INT DEM STA PRE COM NAV OTC NOI DSP COR" Set-Cookie: vc=; domain=by.adshuffle.com; expires=Tue, 01-Jan-1980 06:00:00 GMT; path=/ Set-Cookie: av1=ce447.6ab11=0223111538:b5d53.6f0d0=0319110916; domain=by.adshuffle.com; expires=Thu, 01-Jan-2099 06:00:00 GMT; path=/ Set-Cookie: vcs0=vCE447:6AB11_0_0_0_2147EA_0_0|vB5D53:6F0D0_0_0_0_21CD6C_0_0; domain=by.adshuffle.com; expires=Thu, 01-Jan-2099 06:00:00 GMT; path=/ Date: Sat, 19 Mar 2011 14:16:27 GMT Content-Length: 195 Set-Cookie: NSC_betivggmf-opef=ffffffff0908150045525d5f4f58455e445a4a423660;expires=Sat, 19-Mar-2011 14:21:28 GMT;path=/
<html><head><title>Object moved</title></head><body> <h2>Object moved to <a href="http://media2.adshuffle.com/images/744787/e4addacb1a334e8d8ba9da877ad7de73.gif">here</a>.</h2> </body></html>
The cookies do not appear to contain session tokens, which may reduce the risk associated with this issue. You should review the contents of the cookies to determine their function.
HTTP/1.1 302 Found Cache-Control: private, no-cache="Set-Cookie" Pragma: no-cache Content-Type: text/html; charset=utf-8 Expires: Sat, 19 Mar 2011 13:59:42 GMT Location: http://media2.adshuffle.com/images/744787/e4addacb1a334e8d8ba9da877ad7de73.gif Server: Microsoft-IIS/7.0 P3P: CP="CURa ADMa DEVa PSAo PSDo OUR BUS UNI PUR INT DEM STA PRE COM NAV OTC NOI DSP COR" Set-Cookie: sid=057dd0d7-8a86-43f6-9926-9e613cb107f8; domain=by.adshuffle.com; expires=Thu, 01-Jan-2099 06:00:00 GMT; path=/ Set-Cookie: vc=; domain=by.adshuffle.com; expires=Tue, 01-Jan-1980 06:00:00 GMT; path=/ Set-Cookie: av1=ce447.6ab11=0223111538:b5d53.6f0d0=0319110859; domain=by.adshuffle.com; expires=Thu, 01-Jan-2099 06:00:00 GMT; path=/ Set-Cookie: vcs0=vCE447:6AB11_0_0_0_2147EA_0_0|vB5D53:6F0D0_0_0_0_21CD5B_0_0; domain=by.adshuffle.com; expires=Thu, 01-Jan-2099 06:00:00 GMT; path=/ Date: Sat, 19 Mar 2011 13:59:41 GMT Content-Length: 195 Set-Cookie: NSC_betivggmf-opef=ffffffff0908153445525d5f4f58455e445a4a423660;expires=Sat, 19-Mar-2011 14:04:42 GMT;path=/
<html><head><title>Object moved</title></head><body> <h2>Object moved to <a href="http://media2.adshuffle.com/images/744787/e4addacb1a334e8d8ba9da877ad7de73.gif">here</a>.</h2> </body></html>
If a web response states that it contains HTML content but does not specify a character set, then the browser may analyse the HTML and attempt to determine which character set it appears to be using. Even if the majority of the HTML actually employs a standard character set such as UTF-8, the presence of non-standard characters anywhere in the response may cause the browser to interpret the content using a different character set. This can have unexpected results, and can lead to cross-site scripting vulnerabilities in which non-standard encodings like UTF-7 can be used to bypass the application's defensive filters.
In most cases, the absence of a charset directive 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 HTML content, the application should include within the Content-type header a directive specifying a standard recognised character set, for example charset=ISO-8859-1.
Request
GET /favicon.ico HTTP/1.1 Host: this.content.served.by.adshuffle.com Proxy-Connection: keep-alive Accept: */* User-Agent: Mozilla/5.0 (Windows; U; Windows NT 6.1; en-US) AppleWebKit/534.16 (KHTML, like Gecko) Chrome/10.0.648.151 Safari/534.16 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: v=576462396446310722; pxl=1062:428FD4; px=1062:00223111538; ts=3/19/2011+1:51:14+PM; z=4; sid=057dd0d7-8a86-43f6-9926-9e613cb107f8; av1=ce447.6ab11=0223111538:b5d53.6f0d0=0319110851; vcs0=vCE447:6AB11_0_0_0_2147EA_0_0|vB5D53:6F0D0_0_0_0_21CD53_0_0; NSC_betivggmf-opef=ffffffff0908153445525d5f4f58455e445a4a423660
The response contains the following Content-type statement:
Content-Type: text/html
The response states that it contains HTML. 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 /favicon.ico HTTP/1.1 Host: this.content.served.by.adshuffle.com Proxy-Connection: keep-alive Accept: */* User-Agent: Mozilla/5.0 (Windows; U; Windows NT 6.1; en-US) AppleWebKit/534.16 (KHTML, like Gecko) Chrome/10.0.648.151 Safari/534.16 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: v=576462396446310722; pxl=1062:428FD4; px=1062:00223111538; ts=3/19/2011+1:51:14+PM; z=4; sid=057dd0d7-8a86-43f6-9926-9e613cb107f8; av1=ce447.6ab11=0223111538:b5d53.6f0d0=0319110851; vcs0=vCE447:6AB11_0_0_0_2147EA_0_0|vB5D53:6F0D0_0_0_0_21CD53_0_0; NSC_betivggmf-opef=ffffffff0908153445525d5f4f58455e445a4a423660