<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
	<id>https://wiki.mozilla.org/index.php?action=history&amp;feed=atom&amp;title=Security%2FReviews%2Fxssfilter</id>
	<title>Security/Reviews/xssfilter - Revision history</title>
	<link rel="self" type="application/atom+xml" href="https://wiki.mozilla.org/index.php?action=history&amp;feed=atom&amp;title=Security%2FReviews%2Fxssfilter"/>
	<link rel="alternate" type="text/html" href="https://wiki.mozilla.org/index.php?title=Security/Reviews/xssfilter&amp;action=history"/>
	<updated>2026-06-24T18:16:39Z</updated>
	<subtitle>Revision history for this page on the wiki</subtitle>
	<generator>MediaWiki 1.39.10</generator>
	<entry>
		<id>https://wiki.mozilla.org/index.php?title=Security/Reviews/xssfilter&amp;diff=383670&amp;oldid=prev</id>
		<title>Curtisk at 19:29, 4 January 2012</title>
		<link rel="alternate" type="text/html" href="https://wiki.mozilla.org/index.php?title=Security/Reviews/xssfilter&amp;diff=383670&amp;oldid=prev"/>
		<updated>2012-01-04T19:29:41Z</updated>

		<summary type="html">&lt;p&gt;&lt;/p&gt;
&lt;table style=&quot;background-color: #fff; color: #202122;&quot; data-mw=&quot;interface&quot;&gt;
				&lt;col class=&quot;diff-marker&quot; /&gt;
				&lt;col class=&quot;diff-content&quot; /&gt;
				&lt;col class=&quot;diff-marker&quot; /&gt;
				&lt;col class=&quot;diff-content&quot; /&gt;
				&lt;tr class=&quot;diff-title&quot; lang=&quot;en&quot;&gt;
				&lt;td colspan=&quot;2&quot; style=&quot;background-color: #fff; color: #202122; text-align: center;&quot;&gt;← Older revision&lt;/td&gt;
				&lt;td colspan=&quot;2&quot; style=&quot;background-color: #fff; color: #202122; text-align: center;&quot;&gt;Revision as of 19:29, 4 January 2012&lt;/td&gt;
				&lt;/tr&gt;&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot; id=&quot;mw-diff-left-l74&quot;&gt;Line 74:&lt;/td&gt;
&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Line 74:&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;* granularity for blocking ?&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;* granularity for blocking ?&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;* Implement nuclear mode, at least as an option?  riccardo will have to ask jst how to do that.&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;* Implement nuclear mode, at least as an option?  riccardo will have to ask jst how to do that.&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-side-deleted&quot;&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;+&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;&lt;/ins&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-side-deleted&quot;&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;+&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;[[Category:SecReview|XSSFilter]]&lt;/ins&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;/table&gt;</summary>
		<author><name>Curtisk</name></author>
	</entry>
	<entry>
		<id>https://wiki.mozilla.org/index.php?title=Security/Reviews/xssfilter&amp;diff=334446&amp;oldid=prev</id>
		<title>Curtisk: Created page with &quot;== 2011.07.28 Items to be reviewed: == * Feature Page: XSS Filter - https://wiki.mozilla.org/Security/Features/XSS_Filter  * {{bug|528661}}  == Introduce Feature ==  === Goal of ...&quot;</title>
		<link rel="alternate" type="text/html" href="https://wiki.mozilla.org/index.php?title=Security/Reviews/xssfilter&amp;diff=334446&amp;oldid=prev"/>
		<updated>2011-07-28T20:46:34Z</updated>

		<summary type="html">&lt;p&gt;Created page with &amp;quot;== 2011.07.28 Items to be reviewed: == * Feature Page: XSS Filter - https://wiki.mozilla.org/Security/Features/XSS_Filter  * {{bug|528661}}  == Introduce Feature ==  === Goal of ...&amp;quot;&lt;/p&gt;
&lt;p&gt;&lt;b&gt;New page&lt;/b&gt;&lt;/p&gt;&lt;div&gt;== 2011.07.28 Items to be reviewed: ==&lt;br /&gt;
* Feature Page: XSS Filter - https://wiki.mozilla.org/Security/Features/XSS_Filter &lt;br /&gt;
* {{bug|528661}}&lt;br /&gt;
&lt;br /&gt;
== Introduce Feature ==&lt;br /&gt;
&lt;br /&gt;
=== Goal of Feature, what is trying to be achieved (problem solved, use cases, etc) ===&lt;br /&gt;
* to protect users from XSS&lt;br /&gt;
** Injection of whole inline scripts&lt;br /&gt;
** Injection of &amp;lt;script src&amp;gt; (with mismatched eTLD+1)&lt;br /&gt;
** Injection of partial scripts (like SQL injection) (Chrome doesn&amp;#039;t do this)&lt;br /&gt;
*** This is the trickiest part. It requires integrating with the JS engine, getting between the tokenizer and the parser. But in Spidermonkey, the tokenizer and parser are tightly coupled.&lt;br /&gt;
** For now, testing with a separate tokenizer, but we don&amp;#039;t want to ship this because it&amp;#039;s slow and unsafe.&lt;br /&gt;
&lt;br /&gt;
=== What solutions/approaches were considered other than the proposed solution? ===&lt;br /&gt;
&lt;br /&gt;
=== Why was this solution chosen? ===&lt;br /&gt;
&lt;br /&gt;
=== Any security threats already considered in the design and why? ===&lt;br /&gt;
* Escape partial injections: detecting partial injections can  protect against more attacks, but attackers can use a different  technique to inject JavaScript in presence of an opportunity for partial  injection. Assuming that the web application is written in PHP and  contains the code &lt;br /&gt;
&lt;br /&gt;
  &amp;lt;script&amp;gt;var username=&amp;quot;&amp;lt;?$_GET[&amp;quot;username&amp;quot;]?&amp;gt;&amp;quot;;&lt;br /&gt;
do_login(username);&amp;lt;/script&amp;gt;, the attacker can provide the parameter &lt;br /&gt;
 &amp;quot;;&amp;lt;/script&amp;gt;&amp;lt;script&amp;gt;xss();var a = &amp;quot;  &lt;br /&gt;
&lt;br /&gt;
to create a new script. Note that the script is not a substring of the  URL, but the URL is also not a substring of the script. One solution consist in decoupling taint-inference from policy enforcement: the matching can happen on the HTML source, and the taint information can be  used later when enforcing the policies on scripts. This might be problematic wrt to performance and whole script detection when the url  is not parsed correctly. &lt;br /&gt;
 &lt;br /&gt;
* Circumvention of approximate substring matching: the effectiveness of approximate substring matching over exact string matching is debatable. Approximate matching is more robust toward unexpected sanitizations and XSS attacks not specifically written for this filter, but can be easily circumvented by attackers targeting this feature: assuming the web application transforms double quotes into single quotes, an attacker can simply use the sanitized character often to increase the distance between the parameter and the script. For  exanple: &lt;br /&gt;
 &lt;br /&gt;
  &amp;lt;script&amp;gt;&amp;quot;&amp;quot;+&amp;quot;&amp;quot;+&amp;quot;&amp;quot;+&amp;quot;&amp;quot;+&amp;quot;&amp;quot;+&amp;quot;&amp;quot;+&amp;quot;&amp;quot;+&amp;quot;&amp;quot;+...+&amp;quot;&amp;quot;; xss();&amp;lt;/script&amp;gt;.  &lt;br /&gt;
 &lt;br /&gt;
Canonicalization, as employed by XSSAuditor, can solve this problem,  but it can only account for a small subset of string transformations. &lt;br /&gt;
&lt;br /&gt;
== Threat Brainstorming ==&lt;br /&gt;
* Allows an attacker to selectively break one script on a site :( But I guess you can do this by bringing the browser close to memory or recursion limits as well :(&lt;br /&gt;
* Interaction with HPP?&lt;br /&gt;
e.g.&lt;br /&gt;
 http://server/?q=&amp;lt;script&amp;gt;&amp;amp;q=alert(1)&amp;amp;q=&amp;lt;/script&amp;gt;&lt;br /&gt;
&lt;br /&gt;
depending on the backend this may turn into q=&amp;lt;script&amp;gt;alert(1)&amp;lt;/script&amp;gt;&lt;br /&gt;
it would be matched against ?q=&amp;lt;script&amp;gt;&amp;amp;q=alert(1)&amp;amp;q=&amp;lt;/script&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Induced false positives ===&lt;br /&gt;
&lt;br /&gt;
==== Whole scripts ====&lt;br /&gt;
* Allows an attacker to selectively break one inline script or event handler :( &lt;br /&gt;
** The script disabled might be a client-side security feature that &amp;quot;fails open&amp;quot;: framebusting, clickjacking prevention, invisiblly-copying-text protection, anti-spoofing&lt;br /&gt;
** As more happens on the client, more security checks happen on the client&lt;br /&gt;
** But I guess attackers can already break scripts on other sites  selectively, by bringing the browser close to memory or recursion limits as well :(&lt;br /&gt;
** Given that other browsers have similar filters, and we feel XSS is a bigger problem, this is a reasonable tradeoff.&lt;br /&gt;
** What if we exercise the &amp;quot;nuclear option&amp;quot; of disabling the entire page when one script breaks?&lt;br /&gt;
** Privacy?&lt;br /&gt;
* Possibilities for reducing induced-false-positives&lt;br /&gt;
** Keep track of hashes of scripts that have been seen&lt;br /&gt;
** Or request the same URL without the URL parameter, and see if the same script appears&lt;br /&gt;
** Seems expensive.&lt;br /&gt;
** Seems dangerous for POST, sketchy even for GET.&lt;br /&gt;
* interactions with the developer consloe?&lt;br /&gt;
&lt;br /&gt;
==== Partial scripts ====&lt;br /&gt;
* extract sensitive information such as a username, CSRF token, recon&lt;br /&gt;
** requires a side channel (cpu use, bandwidth use, network cache)&lt;br /&gt;
&lt;br /&gt;
=== Circumvention ===&lt;br /&gt;
* If the attacker injects &amp;quot;&amp;lt;/script&amp;gt;&amp;lt;script&amp;gt;&amp;quot;, the URL parameter is not a substring of any script and no script is a substring of the URL parameter.&lt;br /&gt;
** Perhaps do taint analysis before HTML parsing, and use information from that taint analysis later while looking at the tokenizer output&lt;br /&gt;
Items to be reviewed: &lt;br /&gt;
XSS Filter - https://wiki.mozilla.org/Security/Features/XSS_Filter &lt;br /&gt;
https://intranet.mozilla.org/XSS_Filter&lt;br /&gt;
&lt;br /&gt;
== Conclusions / Action Items ==&lt;br /&gt;
* need to schedule a follow-up meeing to discuss circumvention. Let&amp;#039;s reconvene after BH+DC and after riccardo&amp;#039;s poster at usenix (aug 11)&lt;br /&gt;
* Developers console ?&lt;br /&gt;
* granularity for blocking ?&lt;br /&gt;
* Implement nuclear mode, at least as an option?  riccardo will have to ask jst how to do that.&lt;/div&gt;</summary>
		<author><name>Curtisk</name></author>
	</entry>
</feed>