<?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=Tom+Parker</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=Tom+Parker"/>
		<link rel="alternate" type="text/html" href="https://wiki.owasp.org/index.php/Special:Contributions/Tom_Parker"/>
		<updated>2026-05-06T13:01:55Z</updated>
		<subtitle>User contributions</subtitle>
		<generator>MediaWiki 1.27.2</generator>

	<entry>
		<id>https://wiki.owasp.org/index.php?title=Clickjacking_Defense_Cheat_Sheet&amp;diff=189524</id>
		<title>Clickjacking Defense Cheat Sheet</title>
		<link rel="alternate" type="text/html" href="https://wiki.owasp.org/index.php?title=Clickjacking_Defense_Cheat_Sheet&amp;diff=189524"/>
				<updated>2015-02-12T04:00:42Z</updated>
		
		<summary type="html">&lt;p&gt;Tom Parker: Added Defending with Content Security Policy frame-ancestors directive section&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&amp;lt;div style=&amp;quot;width:100%;height:160px;border:0,margin:0;overflow: hidden;&amp;quot;&amp;gt;[[File:Cheatsheets-header.jpg|link=]]&amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;br/&amp;gt;Last revision (mm/dd/yy): '''{{REVISIONMONTH}}/{{REVISIONDAY}}/{{REVISIONYEAR}}''' &lt;br /&gt;
= Introduction  =&lt;br /&gt;
 __TOC__{{TOC hidden}}&lt;br /&gt;
&lt;br /&gt;
This cheat sheet is focused on providing developer guidance on [[Clickjacking|Clickjack/UI Redress]] attack prevention.&lt;br /&gt;
&lt;br /&gt;
The most popular way to defend against Clickjacking is to include some sort of &amp;quot;frame-breaking&amp;quot; functionality which prevents other web pages from framing the site you wish to defend. This cheat sheet will discuss two methods of implementing frame-breaking: first is X-Frame-Options headers (used if the browser supports the functionality); and second is javascript frame-breaking code.&lt;br /&gt;
&lt;br /&gt;
= Defending with Content Security Policy frame-ancestors directive =&lt;br /&gt;
The frame-ancestors directive can be used in a Content-Security-Policy HTTP response header to indicate whether or not a browser should be allowed to render a page in a &amp;amp;lt;frame&amp;amp;gt; or &amp;amp;lt;iframe&amp;amp;gt;. Sites can use this to avoid Clickjacking attacks, by ensuring that their content is not embedded into other sites.&lt;br /&gt;
&lt;br /&gt;
frame-ancestors allows a site to authorize multiple domains using the normal Content Security Policy symantics.&lt;br /&gt;
&lt;br /&gt;
See https://w3c.github.io/webappsec/specs/content-security-policy/#directive-frame-ancestors for further details&lt;br /&gt;
&lt;br /&gt;
=== Limitations ===&lt;br /&gt;
* '''Browser support:''' frame-ancestors is not supported by all the major browsers yet.&lt;br /&gt;
* '''X-Frame-Options takes priority:''' [https://w3c.github.io/webappsec/specs/content-security-policy/#frame-ancestors-and-frame-options Section 7.7.1 of the CSP Spec] says X-Frame-Options should be ignored if frame-ancestors is specified, but Chrome 40 &amp;amp; Firefox 35 ignore the frame-ancestors directive and follow the X-Frame-Options header instead.&lt;br /&gt;
&lt;br /&gt;
= Defending with X-Frame-Options Response Headers =&lt;br /&gt;
&lt;br /&gt;
The X-Frame-Options HTTP response header can be used to indicate whether or not a browser should be allowed to render a page in a &amp;amp;lt;frame&amp;amp;gt; or &amp;amp;lt;iframe&amp;amp;gt;. Sites can use this to avoid Clickjacking attacks, by ensuring that their content is not embedded into other sites.&lt;br /&gt;
&lt;br /&gt;
=== X-Frame-Options Header Types  ===&lt;br /&gt;
&lt;br /&gt;
There are three possible values for the X-Frame-Options header:&lt;br /&gt;
* &amp;lt;b&amp;gt;DENY&amp;lt;/b&amp;gt;, which prevents any domain from framing the content.&lt;br /&gt;
* &amp;lt;b&amp;gt;SAMEORIGIN&amp;lt;/b&amp;gt;, which only allows the current site to frame the content.&lt;br /&gt;
* &amp;lt;b&amp;gt;ALLOW-FROM uri&amp;lt;/b&amp;gt;, which permits the specified 'uri' to frame this page. (e.g., ALLOW-FROM http&amp;amp;#58;//www.example.com) '''Check Limitations Below''' this will fail open if the browser does not support it.&lt;br /&gt;
&lt;br /&gt;
=== Browser Support ===&lt;br /&gt;
&lt;br /&gt;
The following browsers support X-Frame-Options headers.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;table border=&amp;quot;1&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt; &amp;lt;th&amp;gt;Browser&amp;lt;/th&amp;gt; &amp;lt;th&amp;gt;DENY/SAMEORIGIN Support Introduced&amp;lt;/th&amp;gt; &amp;lt;th&amp;gt;ALLOW-FROM Support Introduced&amp;lt;/th&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt; &amp;lt;td&amp;gt;Chrome&amp;lt;/td&amp;gt; &amp;lt;td&amp;gt;[http://blog.chromium.org/2010/01/security-in-depth-new-security-features.html 4.1.249.1042]&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;td&amp;gt;[https://code.google.com/p/chromium/issues/detail?id=129139 Not supported/Bug reported]&amp;lt;/td&amp;gt; &amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt; &amp;lt;td&amp;gt;Firefox (Gecko)&amp;lt;/td&amp;gt; &amp;lt;td&amp;gt;[https://developer.mozilla.org/en-US/docs/HTTP/X-Frame-Options?redirectlocale=en-US&amp;amp;redirectslug=The_X-FRAME-OPTIONS_response_header 3.6.9 (1.9.2.9)]&amp;lt;/td&amp;gt; &amp;lt;td&amp;gt;[https://bugzilla.mozilla.org/show_bug.cgi?id=690168 18.0]&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt; &amp;lt;td&amp;gt;Internet Explorer&amp;lt;/td&amp;gt; &amp;lt;td&amp;gt;[http://blogs.msdn.com/b/ie/archive/2009/01/27/ie8-security-part-vii-clickjacking-defenses.aspx 8.0]&amp;lt;/td&amp;gt; &amp;lt;td&amp;gt;[http://erlend.oftedal.no/blog/tools/xframeoptions/ 9.0]&amp;lt;/td&amp;gt; &amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt; &amp;lt;td&amp;gt;Opera&amp;lt;/td&amp;gt; &amp;lt;td&amp;gt;[http://www.opera.com/docs/specs/presto26/#network 10.50]&amp;lt;/td&amp;gt; &amp;lt;td&amp;gt;&amp;lt;/td&amp;gt; &amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt; &amp;lt;td&amp;gt;Safari&amp;lt;/td&amp;gt; &amp;lt;td&amp;gt;[http://www.zdnet.com/blog/security/apple-safari-jumbo-patch-50-vulnerabilities-fixed/3541 4.0]&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;[https://bugs.webkit.org/show_bug.cgi?id=94836 Not supported/Bug reported]&amp;lt;/td&amp;gt; &amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;/table&amp;gt;&lt;br /&gt;
&lt;br /&gt;
References: &lt;br /&gt;
* [https://developer.mozilla.org/en-US/docs/HTTP/X-Frame-Options Mozilla Developer Network]&amp;lt;br&amp;gt;&lt;br /&gt;
* [http://datatracker.ietf.org/doc/draft-ietf-websec-x-frame-options/ IETF Draft]&lt;br /&gt;
* [http://erlend.oftedal.no/blog/tools/xframeoptions/ X-Frame-Options Compatibility Test] - Check this for the LATEST browser support info for the X-Frame-Options header&lt;br /&gt;
&lt;br /&gt;
=== Implementation ===&lt;br /&gt;
&lt;br /&gt;
To implement this protection, you need to add the X-Frame-Options HTTP Response header to any page that you want to protect from being clickjacked via framebusting. One way to do this is to add the HTTP Response Header manually to every page.  A possibly simpler way is to implement a filter that automatically adds the header to every page.&lt;br /&gt;
&lt;br /&gt;
OWASP has an [[ClickjackFilter for Java EE|article and some code]] that provides all the details for implementing this in the Java EE environment.&lt;br /&gt;
&lt;br /&gt;
The SDL blog has posted an [http://blogs.msdn.com/sdl/archive/2009/02/05/clickjacking-defense-in-ie8.aspx article] covering how to implement this in a .NET environment.&lt;br /&gt;
&lt;br /&gt;
=== Common Defense Mistakes ===&lt;br /&gt;
Meta-tags that attempt to apply the X-Frame-Options directive DO NOT WORK. For example, &amp;lt;meta http-equiv=&amp;quot;X-Frame-Options&amp;quot; content=&amp;quot;deny&amp;quot;&amp;gt;) will not work. You must apply the X-FRAME-OPTIONS directive as HTTP Response Header as described above.&lt;br /&gt;
&lt;br /&gt;
=== Limitations ===&lt;br /&gt;
&lt;br /&gt;
* '''Per-page policy specification''' The policy needs to be specified for every page, which can complicate deployment. Providing the ability to enforce it for the entire site, at login time for instance, could simplify adoption.&lt;br /&gt;
* '''Problems with multi-domain sites''' The current implementation does not allow the webmaster to provide a whitelist of domains that are allowed to frame the page. While whitelisting can be dangerous, in some cases a webmaster might have no choice but to use more than one hostname.&lt;br /&gt;
* '''ALLOW-FROM browser support''' The ALLOW-FROM option is a relatively recent addition (circa 2012) and may not be supported by all browsers yet.  BE CAREFUL ABOUT DEPENDING ON ALLOW-FROM. If you apply it and the browser does not support it, then you will have NO clickjacking defense in place.&lt;br /&gt;
* '''Multiple options not supported''' There is no way to allow the current site and a 3rd party site to frame the same response -- browsers only honour one X-Frame-Options header and only one value on that header.&lt;br /&gt;
* '''Nested Frames don't work with SAMEORIGIN and ALLOW-FROM''' In the following situation, the http://framed.invalid/child frame does not load because ALLOW-FROM applies to the top-level browsing context, not that of the immediate parent. The solution is to use ALLOW-FROM in both the parent and child frames (but this prevents the child frame loading if the //framed.invalid/parent page is loaded as the top level document).&lt;br /&gt;
 +-//friendlysite.invalid-----------------------+&lt;br /&gt;
 |                                              |&lt;br /&gt;
 | +-//framed.invalid/parent------------------+ |&lt;br /&gt;
 | |                                          | |&lt;br /&gt;
 | | ALLOW-FROM http://friendlysite.invalid | |&lt;br /&gt;
 | |                                          | |&lt;br /&gt;
 | | +-//framed.invalid/child--------+        | |&lt;br /&gt;
 | | |                               |        | |&lt;br /&gt;
 | | | SAMEORIGIN                    |        | |&lt;br /&gt;
 | | |                               |        | |&lt;br /&gt;
 | | +-------------------------------+        | |&lt;br /&gt;
 | +------------------------------------------+ |&lt;br /&gt;
 +----------------------------------------------+&lt;br /&gt;
* '''X-Frame-Options Deprecated''' While the X-Frame-Options header is supported by the major browsers, it was never standardized and has been deprecated in favour of the frame-ancestors directive from the CSP Level 2 specification.&lt;br /&gt;
* '''Proxies''' Web proxies are notorious for adding and stripping headers. If a web proxy strips the X-Frame-Options header then the site loses its framing protection.&lt;br /&gt;
&lt;br /&gt;
= Best-for-now Legacy Browser Frame Breaking Script =&lt;br /&gt;
&lt;br /&gt;
One way to defend against clickjacking is to include a &amp;quot;frame-breaker&amp;quot; script&lt;br /&gt;
in each page that should not be framed. The following methodology will prevent&lt;br /&gt;
a webpage from being framed even in legacy browsers, that do not support the&lt;br /&gt;
X-Frame-Options-Header.&lt;br /&gt;
&lt;br /&gt;
In the document HEAD element, add the following:&lt;br /&gt;
&lt;br /&gt;
First apply an ID to the style element itself:&lt;br /&gt;
&lt;br /&gt;
 &amp;amp;lt;style id=&amp;amp;quot;antiClickjack&amp;amp;quot;&amp;amp;gt;body{display:none !important;}&amp;amp;lt;/style&amp;amp;gt;&lt;br /&gt;
&lt;br /&gt;
And then delete that style by its ID immediately after in the script:&lt;br /&gt;
&lt;br /&gt;
 &amp;amp;lt;script type=&amp;amp;quot;text/javascript&amp;amp;quot;&amp;amp;gt;&lt;br /&gt;
    if (self === top) {&lt;br /&gt;
        var antiClickjack = document.getElementById(&amp;amp;quot;antiClickjack&amp;amp;quot;);&lt;br /&gt;
        antiClickjack.parentNode.removeChild(antiClickjack);&lt;br /&gt;
    } else {&lt;br /&gt;
        top.location = self.location;&lt;br /&gt;
    }&lt;br /&gt;
 &amp;amp;lt;/script&amp;amp;gt;&lt;br /&gt;
&lt;br /&gt;
This way, everything can be in the document HEAD and you only need one method/taglib in your API.&lt;br /&gt;
&lt;br /&gt;
Reference: [https://www.codemagi.com/blog/post/194 https://www.codemagi.com/blog/post/194]&lt;br /&gt;
&lt;br /&gt;
= window.confirm() Protection =&lt;br /&gt;
The use of x-frame-options or a frame-breaking script is a more fail-safe method of clickjacking protection.  However, in scenarios where content must be frameable, then a window.confirm() can be used to help mitigate Clickjacking by informing the user of the action they are about to perform.&lt;br /&gt;
&lt;br /&gt;
Invoking window.confirm() will display a popup that cannot be framed.  If the window.confirm() originates from within an iframe with a different domain than the parent, then the dialog box will display what domain the window.confirm() originated from.  In this scenario the browser is displaying the origin of the dialog box to help mitigate Clickjacking attacks.  It should be noted that Internet Explorer is the only known browser that does not display the domain that the window.confirm() dialog box originated from,  to address this issue with Internet Explorer insure that the message within the dialog box contains contextual information about the type of action being performed.  For example:&lt;br /&gt;
&lt;br /&gt;
 &amp;amp;lt;script type=&amp;amp;quot;text/javascript&amp;amp;quot;&amp;amp;gt;&lt;br /&gt;
    var action_confirm = window.confirm(&amp;quot;Are you sure you want to delete your youtube account?&amp;quot;)&lt;br /&gt;
    if (action_confirm) {&lt;br /&gt;
        //... perform action&lt;br /&gt;
    } else {&lt;br /&gt;
        //...  The user does not want to perform the requested action.&lt;br /&gt;
    }&lt;br /&gt;
 &amp;amp;lt;/script&amp;amp;gt;&lt;br /&gt;
&lt;br /&gt;
= Non-Working Scripts =&lt;br /&gt;
Consider the following snippet which is '''NOT recommended''' for defending&lt;br /&gt;
against clickjacking:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&amp;lt;script&amp;gt;if (top!=self) top.location.href=self.location.href&amp;lt;/script&amp;gt;&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This simple frame breaking script attempts to prevent the page from being incorporated into a frame or iframe by forcing the parent window to load the current frame's URL. Unfortunately, multiple ways of defeating this type of script have been made public. We outline some here.&lt;br /&gt;
&lt;br /&gt;
== Double Framing ==&lt;br /&gt;
Some frame busting techniques navigate to the correct page by assigning a value to parent.location. This works well if the victim page is framed by a single page. However, if the attacker encloses the victim in one frame inside another (a double frame), then accessing parent.location becomes a security violation in all popular browsers, due to the '''descendant frame navigation policy'''. This security violation disables the counter-action navigation.&lt;br /&gt;
&lt;br /&gt;
'''Victim frame busting code:'''&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
if(top.location!=self.locaton) {&lt;br /&gt;
  parent.location = self.location;&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
'''Attacker top frame:'''&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;lt;iframe src=&amp;quot;attacker2.html&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
'''Attacker sub-frame:'''&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;lt;iframe src=&amp;quot;http://www.victim.com&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== The onBeforeUnload Event ==&lt;br /&gt;
A user can manually cancel any navigation request submitted by a framed page. To exploit this, the framing page registers an onBeforeUnload handler which is called whenever the framing page is about to be unloaded due to navigation. The handler function returns a string that becomes part of a prompt displayed to the user. Say the attacker wants to frame PayPal. He registers an unload handler function that returns the string &amp;quot;Do you want to exit PayPal?&amp;quot;. When this string is displayed to the user is likely to cancel the navigation, defeating PayPal's frame busting attempt.&lt;br /&gt;
&lt;br /&gt;
The attacker mounts this attack by registering an unload event on the top page using the&lt;br /&gt;
following code:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;lt;script&amp;gt;&lt;br /&gt;
window.onbeforeunload = function()&lt;br /&gt;
{&lt;br /&gt;
  return &amp;quot;Asking the user nicely&amp;quot;;&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/script&amp;gt;&lt;br /&gt;
&amp;lt;iframe src=&amp;quot;http://www.paypal.com&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
PayPal's frame busting code will generate a BeforeUnload event activating our function and prompting the user to cancel the navigation event.&lt;br /&gt;
&lt;br /&gt;
== No-Content Flushing ==&lt;br /&gt;
While the previous attack requires user interaction, the same attack can be done without prompting the user. Most browsers (IE7, IE8, Google Chrome, and Firefox) enable an attacker to automatically cancel the incoming navigation request in an onBeforeUnload event handler by repeatedly submitting a navigation request to a site responding with \204 - No Content.&amp;quot; Navigating to a No Content site is effectively a NOP, but flushes the request pipeline, thus canceling the original navigation request. Here is sample code to do this:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
var preventbust = 0&lt;br /&gt;
window.onbeforeunload = function() { killbust++ }&lt;br /&gt;
setInterval( function() {&lt;br /&gt;
  if(killbust &amp;gt; 0){&lt;br /&gt;
  killbust = 2;&lt;br /&gt;
  window.top.location = 'http://nocontent204.com'&lt;br /&gt;
  }&lt;br /&gt;
}, 1);&lt;br /&gt;
&amp;lt;iframe src=&amp;quot;http://www.victim.com&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Exploiting XSS filters ==&lt;br /&gt;
IE8 and Google Chrome introduced reflective XSS filters that help protect web pages from certain types of XSS attacks. Nava and Lindsay (at Blackhat) observed that these filters can be used to circumvent frame busting code. The IE8 XSS filter compares given request parameters to a set of regular expressions in order to look for obvious attempts at cross-site scripting. Using &amp;quot;induced false positives&amp;quot;, the filter can be used to disable selected scripts. By matching the beginning of any script tag in the request parameters, the XSS filter will disable all inline scripts within the page, including frame busting scripts. External scripts can also be targeted by matching an external include, effectively disabling all external scripts. Since subsets of the JavaScript loaded is still functional (inline or external) and cookies are still available, this attack is effective for clickjacking.&lt;br /&gt;
&lt;br /&gt;
'''Victim frame busting code:'''&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;lt;script&amp;gt;&lt;br /&gt;
if(top != self) {&lt;br /&gt;
  top.location = self.location;&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/script&amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
'''Attacker:'''&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;lt;iframe src=&amp;quot;http://www.victim.com/?v=&amp;lt;script&amp;gt;if''&amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The XSS filter will match that parameter &amp;quot;&amp;lt;script&amp;gt;if&amp;quot; to the beginning of the frame busting script on the victim and will consequently disable all inline scripts in the victim's page, including the frame busting script. The XSSAuditor filter available for Google Chrome enables the same exploit.&lt;br /&gt;
&lt;br /&gt;
== Clobbering top.location ==&lt;br /&gt;
Several modern browsers treat the location variable as a special immutable attribute across all contexts. However, this is not the case in IE7 and Safari 4.0.4 where the location variable can be redefined.&lt;br /&gt;
&lt;br /&gt;
'''IE7'''&lt;br /&gt;
Once the framing page redefines location, any frame busting code in a subframe that tries to read top.location will commit a security violation by trying to read a local variable in another domain. Similarly, any attempt to navigate by assigning top.location will fail.&lt;br /&gt;
&lt;br /&gt;
'''Victim frame busting code:'''&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
if(top.location != self.location) {&lt;br /&gt;
  top.location = self.location;&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
'''Attacker:'''&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;lt;script&amp;gt; var location = &amp;quot;clobbered&amp;quot;;&lt;br /&gt;
&amp;lt;/script&amp;gt;&lt;br /&gt;
&amp;lt;iframe src=&amp;quot;http://www.victim.com&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;/iframe&amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
'''Safari 4.0.4'''&lt;br /&gt;
&lt;br /&gt;
We observed that although location is kept immutable in most circumstances, when a custom location setter is defined via defineSetter (through window) the object location becomes undefined. The framing page simply does:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;lt;script&amp;gt;&lt;br /&gt;
  window.defineSetter(&amp;quot;location&amp;quot; , function(){});&lt;br /&gt;
&amp;lt;/script&amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
Now any attempt to read or navigate the top frame's location will fail.&lt;br /&gt;
&lt;br /&gt;
== Restricted zones ==&lt;br /&gt;
&lt;br /&gt;
Most frame busting relies on JavaScript in the framed page to detect framing and bust itself out. If JavaScript is disabled in the context of the subframe, the frame busting code will not run. There are unfortunately several ways of restricting JavaScript in a subframe:&lt;br /&gt;
&lt;br /&gt;
* '''In IE 8:''' &amp;lt;pre&amp;gt;&amp;lt;iframe src=&amp;quot;http://www.victim.com&amp;quot; security=&amp;quot;restricted&amp;quot;&amp;gt;&amp;lt;/iframe&amp;gt;&amp;lt;/pre&amp;gt;&lt;br /&gt;
* '''In Chrome:''' &amp;lt;pre&amp;gt;&amp;lt;iframe src=&amp;quot;http://www.victim.com&amp;quot; sandbox&amp;gt;&amp;lt;/iframe&amp;gt;&amp;lt;/pre&amp;gt;&lt;br /&gt;
*''' In Firefox and IE:''' Activate designMode in parent page.&lt;br /&gt;
&lt;br /&gt;
== Other Cheatsheets ==&lt;br /&gt;
&lt;br /&gt;
{{Cheatsheet_Navigation_Body}}&lt;br /&gt;
&lt;br /&gt;
[[Category:Cheatsheets]]&lt;/div&gt;</summary>
		<author><name>Tom Parker</name></author>	</entry>

	<entry>
		<id>https://wiki.owasp.org/index.php?title=Clickjacking_Defense_Cheat_Sheet&amp;diff=189523</id>
		<title>Clickjacking Defense Cheat Sheet</title>
		<link rel="alternate" type="text/html" href="https://wiki.owasp.org/index.php?title=Clickjacking_Defense_Cheat_Sheet&amp;diff=189523"/>
				<updated>2015-02-12T02:02:40Z</updated>
		
		<summary type="html">&lt;p&gt;Tom Parker: updated nested frames limitation&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&amp;lt;div style=&amp;quot;width:100%;height:160px;border:0,margin:0;overflow: hidden;&amp;quot;&amp;gt;[[File:Cheatsheets-header.jpg|link=]]&amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;br/&amp;gt;Last revision (mm/dd/yy): '''{{REVISIONMONTH}}/{{REVISIONDAY}}/{{REVISIONYEAR}}''' &lt;br /&gt;
= Introduction  =&lt;br /&gt;
 __TOC__{{TOC hidden}}&lt;br /&gt;
&lt;br /&gt;
This cheat sheet is focused on providing developer guidance on [[Clickjacking|Clickjack/UI Redress]] attack prevention.&lt;br /&gt;
&lt;br /&gt;
The most popular way to defend against Clickjacking is to include some sort of &amp;quot;frame-breaking&amp;quot; functionality which prevents other web pages from framing the site you wish to defend. This cheat sheet will discuss two methods of implementing frame-breaking: first is X-Frame-Options headers (used if the browser supports the functionality); and second is javascript frame-breaking code.&lt;br /&gt;
&lt;br /&gt;
= Defending with X-Frame-Options Response Headers =&lt;br /&gt;
&lt;br /&gt;
The X-Frame-Options HTTP response header can be used to indicate whether or not a browser should be allowed to render a page in a &amp;amp;lt;frame&amp;amp;gt; or &amp;amp;lt;iframe&amp;amp;gt;. Sites can use this to avoid Clickjacking attacks, by ensuring that their content is not embedded into other sites.&lt;br /&gt;
&lt;br /&gt;
=== X-Frame-Options Header Types  ===&lt;br /&gt;
&lt;br /&gt;
There are three possible values for the X-Frame-Options header:&lt;br /&gt;
* &amp;lt;b&amp;gt;DENY&amp;lt;/b&amp;gt;, which prevents any domain from framing the content.&lt;br /&gt;
* &amp;lt;b&amp;gt;SAMEORIGIN&amp;lt;/b&amp;gt;, which only allows the current site to frame the content.&lt;br /&gt;
* &amp;lt;b&amp;gt;ALLOW-FROM uri&amp;lt;/b&amp;gt;, which permits the specified 'uri' to frame this page. (e.g., ALLOW-FROM http&amp;amp;#58;//www.example.com) '''Check Limitations Below''' this will fail open if the browser does not support it.&lt;br /&gt;
&lt;br /&gt;
=== Browser Support ===&lt;br /&gt;
&lt;br /&gt;
The following browsers support X-Frame-Options headers.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;table border=&amp;quot;1&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt; &amp;lt;th&amp;gt;Browser&amp;lt;/th&amp;gt; &amp;lt;th&amp;gt;DENY/SAMEORIGIN Support Introduced&amp;lt;/th&amp;gt; &amp;lt;th&amp;gt;ALLOW-FROM Support Introduced&amp;lt;/th&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt; &amp;lt;td&amp;gt;Chrome&amp;lt;/td&amp;gt; &amp;lt;td&amp;gt;[http://blog.chromium.org/2010/01/security-in-depth-new-security-features.html 4.1.249.1042]&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;td&amp;gt;[https://code.google.com/p/chromium/issues/detail?id=129139 Not supported/Bug reported]&amp;lt;/td&amp;gt; &amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt; &amp;lt;td&amp;gt;Firefox (Gecko)&amp;lt;/td&amp;gt; &amp;lt;td&amp;gt;[https://developer.mozilla.org/en-US/docs/HTTP/X-Frame-Options?redirectlocale=en-US&amp;amp;redirectslug=The_X-FRAME-OPTIONS_response_header 3.6.9 (1.9.2.9)]&amp;lt;/td&amp;gt; &amp;lt;td&amp;gt;[https://bugzilla.mozilla.org/show_bug.cgi?id=690168 18.0]&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt; &amp;lt;td&amp;gt;Internet Explorer&amp;lt;/td&amp;gt; &amp;lt;td&amp;gt;[http://blogs.msdn.com/b/ie/archive/2009/01/27/ie8-security-part-vii-clickjacking-defenses.aspx 8.0]&amp;lt;/td&amp;gt; &amp;lt;td&amp;gt;[http://erlend.oftedal.no/blog/tools/xframeoptions/ 9.0]&amp;lt;/td&amp;gt; &amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt; &amp;lt;td&amp;gt;Opera&amp;lt;/td&amp;gt; &amp;lt;td&amp;gt;[http://www.opera.com/docs/specs/presto26/#network 10.50]&amp;lt;/td&amp;gt; &amp;lt;td&amp;gt;&amp;lt;/td&amp;gt; &amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt; &amp;lt;td&amp;gt;Safari&amp;lt;/td&amp;gt; &amp;lt;td&amp;gt;[http://www.zdnet.com/blog/security/apple-safari-jumbo-patch-50-vulnerabilities-fixed/3541 4.0]&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;[https://bugs.webkit.org/show_bug.cgi?id=94836 Not supported/Bug reported]&amp;lt;/td&amp;gt; &amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;/table&amp;gt;&lt;br /&gt;
&lt;br /&gt;
References: &lt;br /&gt;
* [https://developer.mozilla.org/en-US/docs/HTTP/X-Frame-Options Mozilla Developer Network]&amp;lt;br&amp;gt;&lt;br /&gt;
* [http://datatracker.ietf.org/doc/draft-ietf-websec-x-frame-options/ IETF Draft]&lt;br /&gt;
* [http://erlend.oftedal.no/blog/tools/xframeoptions/ X-Frame-Options Compatibility Test] - Check this for the LATEST browser support info for the X-Frame-Options header&lt;br /&gt;
&lt;br /&gt;
=== Implementation ===&lt;br /&gt;
&lt;br /&gt;
To implement this protection, you need to add the X-Frame-Options HTTP Response header to any page that you want to protect from being clickjacked via framebusting. One way to do this is to add the HTTP Response Header manually to every page.  A possibly simpler way is to implement a filter that automatically adds the header to every page.&lt;br /&gt;
&lt;br /&gt;
OWASP has an [[ClickjackFilter for Java EE|article and some code]] that provides all the details for implementing this in the Java EE environment.&lt;br /&gt;
&lt;br /&gt;
The SDL blog has posted an [http://blogs.msdn.com/sdl/archive/2009/02/05/clickjacking-defense-in-ie8.aspx article] covering how to implement this in a .NET environment.&lt;br /&gt;
&lt;br /&gt;
=== Common Defense Mistakes ===&lt;br /&gt;
Meta-tags that attempt to apply the X-Frame-Options directive DO NOT WORK. For example, &amp;lt;meta http-equiv=&amp;quot;X-Frame-Options&amp;quot; content=&amp;quot;deny&amp;quot;&amp;gt;) will not work. You must apply the X-FRAME-OPTIONS directive as HTTP Response Header as described above.&lt;br /&gt;
&lt;br /&gt;
=== Limitations ===&lt;br /&gt;
&lt;br /&gt;
* '''Per-page policy specification''' The policy needs to be specified for every page, which can complicate deployment. Providing the ability to enforce it for the entire site, at login time for instance, could simplify adoption.&lt;br /&gt;
* '''Problems with multi-domain sites''' The current implementation does not allow the webmaster to provide a whitelist of domains that are allowed to frame the page. While whitelisting can be dangerous, in some cases a webmaster might have no choice but to use more than one hostname.&lt;br /&gt;
* '''ALLOW-FROM browser support''' The ALLOW-FROM option is a relatively recent addition (circa 2012) and may not be supported by all browsers yet.  BE CAREFUL ABOUT DEPENDING ON ALLOW-FROM. If you apply it and the browser does not support it, then you will have NO clickjacking defense in place.&lt;br /&gt;
* '''Multiple options not supported''' There is no way to allow the current site and a 3rd party site to frame the same response -- browsers only honour one X-Frame-Options header and only one value on that header.&lt;br /&gt;
* '''Nested Frames don't work with SAMEORIGIN and ALLOW-FROM''' In the following situation, the http://framed.invalid/child frame does not load because ALLOW-FROM applies to the top-level browsing context, not that of the immediate parent. The solution is to use ALLOW-FROM in both the parent and child frames (but this prevents the child frame loading if the //framed.invalid/parent page is loaded as the top level document).&lt;br /&gt;
 +-//friendlysite.invalid-----------------------+&lt;br /&gt;
 |                                              |&lt;br /&gt;
 | +-//framed.invalid/parent------------------+ |&lt;br /&gt;
 | |                                          | |&lt;br /&gt;
 | | ALLOW-FROM http://friendlysite.invalid | |&lt;br /&gt;
 | |                                          | |&lt;br /&gt;
 | | +-//framed.invalid/child--------+        | |&lt;br /&gt;
 | | |                               |        | |&lt;br /&gt;
 | | | SAMEORIGIN                    |        | |&lt;br /&gt;
 | | |                               |        | |&lt;br /&gt;
 | | +-------------------------------+        | |&lt;br /&gt;
 | +------------------------------------------+ |&lt;br /&gt;
 +----------------------------------------------+&lt;br /&gt;
* '''X-Frame-Options Deprecated''' While the X-Frame-Options header is supported by the major browsers, it was never standardized and has been deprecated in favour of the frame-ancestors directive from the CSP Level 2 specification.&lt;br /&gt;
* '''Proxies''' Web proxies are notorious for adding and stripping headers. If a web proxy strips the X-Frame-Options header then the site loses its framing protection.&lt;br /&gt;
&lt;br /&gt;
= Best-for-now Legacy Browser Frame Breaking Script =&lt;br /&gt;
&lt;br /&gt;
One way to defend against clickjacking is to include a &amp;quot;frame-breaker&amp;quot; script&lt;br /&gt;
in each page that should not be framed. The following methodology will prevent&lt;br /&gt;
a webpage from being framed even in legacy browsers, that do not support the&lt;br /&gt;
X-Frame-Options-Header.&lt;br /&gt;
&lt;br /&gt;
In the document HEAD element, add the following:&lt;br /&gt;
&lt;br /&gt;
First apply an ID to the style element itself:&lt;br /&gt;
&lt;br /&gt;
 &amp;amp;lt;style id=&amp;amp;quot;antiClickjack&amp;amp;quot;&amp;amp;gt;body{display:none !important;}&amp;amp;lt;/style&amp;amp;gt;&lt;br /&gt;
&lt;br /&gt;
And then delete that style by its ID immediately after in the script:&lt;br /&gt;
&lt;br /&gt;
 &amp;amp;lt;script type=&amp;amp;quot;text/javascript&amp;amp;quot;&amp;amp;gt;&lt;br /&gt;
    if (self === top) {&lt;br /&gt;
        var antiClickjack = document.getElementById(&amp;amp;quot;antiClickjack&amp;amp;quot;);&lt;br /&gt;
        antiClickjack.parentNode.removeChild(antiClickjack);&lt;br /&gt;
    } else {&lt;br /&gt;
        top.location = self.location;&lt;br /&gt;
    }&lt;br /&gt;
 &amp;amp;lt;/script&amp;amp;gt;&lt;br /&gt;
&lt;br /&gt;
This way, everything can be in the document HEAD and you only need one method/taglib in your API.&lt;br /&gt;
&lt;br /&gt;
Reference: [https://www.codemagi.com/blog/post/194 https://www.codemagi.com/blog/post/194]&lt;br /&gt;
&lt;br /&gt;
= window.confirm() Protection =&lt;br /&gt;
The use of x-frame-options or a frame-breaking script is a more fail-safe method of clickjacking protection.  However, in scenarios where content must be frameable, then a window.confirm() can be used to help mitigate Clickjacking by informing the user of the action they are about to perform.&lt;br /&gt;
&lt;br /&gt;
Invoking window.confirm() will display a popup that cannot be framed.  If the window.confirm() originates from within an iframe with a different domain than the parent, then the dialog box will display what domain the window.confirm() originated from.  In this scenario the browser is displaying the origin of the dialog box to help mitigate Clickjacking attacks.  It should be noted that Internet Explorer is the only known browser that does not display the domain that the window.confirm() dialog box originated from,  to address this issue with Internet Explorer insure that the message within the dialog box contains contextual information about the type of action being performed.  For example:&lt;br /&gt;
&lt;br /&gt;
 &amp;amp;lt;script type=&amp;amp;quot;text/javascript&amp;amp;quot;&amp;amp;gt;&lt;br /&gt;
    var action_confirm = window.confirm(&amp;quot;Are you sure you want to delete your youtube account?&amp;quot;)&lt;br /&gt;
    if (action_confirm) {&lt;br /&gt;
        //... perform action&lt;br /&gt;
    } else {&lt;br /&gt;
        //...  The user does not want to perform the requested action.&lt;br /&gt;
    }&lt;br /&gt;
 &amp;amp;lt;/script&amp;amp;gt;&lt;br /&gt;
&lt;br /&gt;
= Non-Working Scripts =&lt;br /&gt;
Consider the following snippet which is '''NOT recommended''' for defending&lt;br /&gt;
against clickjacking:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&amp;lt;script&amp;gt;if (top!=self) top.location.href=self.location.href&amp;lt;/script&amp;gt;&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This simple frame breaking script attempts to prevent the page from being incorporated into a frame or iframe by forcing the parent window to load the current frame's URL. Unfortunately, multiple ways of defeating this type of script have been made public. We outline some here.&lt;br /&gt;
&lt;br /&gt;
== Double Framing ==&lt;br /&gt;
Some frame busting techniques navigate to the correct page by assigning a value to parent.location. This works well if the victim page is framed by a single page. However, if the attacker encloses the victim in one frame inside another (a double frame), then accessing parent.location becomes a security violation in all popular browsers, due to the '''descendant frame navigation policy'''. This security violation disables the counter-action navigation.&lt;br /&gt;
&lt;br /&gt;
'''Victim frame busting code:'''&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
if(top.location!=self.locaton) {&lt;br /&gt;
  parent.location = self.location;&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
'''Attacker top frame:'''&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;lt;iframe src=&amp;quot;attacker2.html&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
'''Attacker sub-frame:'''&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;lt;iframe src=&amp;quot;http://www.victim.com&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== The onBeforeUnload Event ==&lt;br /&gt;
A user can manually cancel any navigation request submitted by a framed page. To exploit this, the framing page registers an onBeforeUnload handler which is called whenever the framing page is about to be unloaded due to navigation. The handler function returns a string that becomes part of a prompt displayed to the user. Say the attacker wants to frame PayPal. He registers an unload handler function that returns the string &amp;quot;Do you want to exit PayPal?&amp;quot;. When this string is displayed to the user is likely to cancel the navigation, defeating PayPal's frame busting attempt.&lt;br /&gt;
&lt;br /&gt;
The attacker mounts this attack by registering an unload event on the top page using the&lt;br /&gt;
following code:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;lt;script&amp;gt;&lt;br /&gt;
window.onbeforeunload = function()&lt;br /&gt;
{&lt;br /&gt;
  return &amp;quot;Asking the user nicely&amp;quot;;&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/script&amp;gt;&lt;br /&gt;
&amp;lt;iframe src=&amp;quot;http://www.paypal.com&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
PayPal's frame busting code will generate a BeforeUnload event activating our function and prompting the user to cancel the navigation event.&lt;br /&gt;
&lt;br /&gt;
== No-Content Flushing ==&lt;br /&gt;
While the previous attack requires user interaction, the same attack can be done without prompting the user. Most browsers (IE7, IE8, Google Chrome, and Firefox) enable an attacker to automatically cancel the incoming navigation request in an onBeforeUnload event handler by repeatedly submitting a navigation request to a site responding with \204 - No Content.&amp;quot; Navigating to a No Content site is effectively a NOP, but flushes the request pipeline, thus canceling the original navigation request. Here is sample code to do this:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
var preventbust = 0&lt;br /&gt;
window.onbeforeunload = function() { killbust++ }&lt;br /&gt;
setInterval( function() {&lt;br /&gt;
  if(killbust &amp;gt; 0){&lt;br /&gt;
  killbust = 2;&lt;br /&gt;
  window.top.location = 'http://nocontent204.com'&lt;br /&gt;
  }&lt;br /&gt;
}, 1);&lt;br /&gt;
&amp;lt;iframe src=&amp;quot;http://www.victim.com&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Exploiting XSS filters ==&lt;br /&gt;
IE8 and Google Chrome introduced reflective XSS filters that help protect web pages from certain types of XSS attacks. Nava and Lindsay (at Blackhat) observed that these filters can be used to circumvent frame busting code. The IE8 XSS filter compares given request parameters to a set of regular expressions in order to look for obvious attempts at cross-site scripting. Using &amp;quot;induced false positives&amp;quot;, the filter can be used to disable selected scripts. By matching the beginning of any script tag in the request parameters, the XSS filter will disable all inline scripts within the page, including frame busting scripts. External scripts can also be targeted by matching an external include, effectively disabling all external scripts. Since subsets of the JavaScript loaded is still functional (inline or external) and cookies are still available, this attack is effective for clickjacking.&lt;br /&gt;
&lt;br /&gt;
'''Victim frame busting code:'''&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;lt;script&amp;gt;&lt;br /&gt;
if(top != self) {&lt;br /&gt;
  top.location = self.location;&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/script&amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
'''Attacker:'''&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;lt;iframe src=&amp;quot;http://www.victim.com/?v=&amp;lt;script&amp;gt;if''&amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The XSS filter will match that parameter &amp;quot;&amp;lt;script&amp;gt;if&amp;quot; to the beginning of the frame busting script on the victim and will consequently disable all inline scripts in the victim's page, including the frame busting script. The XSSAuditor filter available for Google Chrome enables the same exploit.&lt;br /&gt;
&lt;br /&gt;
== Clobbering top.location ==&lt;br /&gt;
Several modern browsers treat the location variable as a special immutable attribute across all contexts. However, this is not the case in IE7 and Safari 4.0.4 where the location variable can be redefined.&lt;br /&gt;
&lt;br /&gt;
'''IE7'''&lt;br /&gt;
Once the framing page redefines location, any frame busting code in a subframe that tries to read top.location will commit a security violation by trying to read a local variable in another domain. Similarly, any attempt to navigate by assigning top.location will fail.&lt;br /&gt;
&lt;br /&gt;
'''Victim frame busting code:'''&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
if(top.location != self.location) {&lt;br /&gt;
  top.location = self.location;&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
'''Attacker:'''&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;lt;script&amp;gt; var location = &amp;quot;clobbered&amp;quot;;&lt;br /&gt;
&amp;lt;/script&amp;gt;&lt;br /&gt;
&amp;lt;iframe src=&amp;quot;http://www.victim.com&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;/iframe&amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
'''Safari 4.0.4'''&lt;br /&gt;
&lt;br /&gt;
We observed that although location is kept immutable in most circumstances, when a custom location setter is defined via defineSetter (through window) the object location becomes undefined. The framing page simply does:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;lt;script&amp;gt;&lt;br /&gt;
  window.defineSetter(&amp;quot;location&amp;quot; , function(){});&lt;br /&gt;
&amp;lt;/script&amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
Now any attempt to read or navigate the top frame's location will fail.&lt;br /&gt;
&lt;br /&gt;
== Restricted zones ==&lt;br /&gt;
&lt;br /&gt;
Most frame busting relies on JavaScript in the framed page to detect framing and bust itself out. If JavaScript is disabled in the context of the subframe, the frame busting code will not run. There are unfortunately several ways of restricting JavaScript in a subframe:&lt;br /&gt;
&lt;br /&gt;
* '''In IE 8:''' &amp;lt;pre&amp;gt;&amp;lt;iframe src=&amp;quot;http://www.victim.com&amp;quot; security=&amp;quot;restricted&amp;quot;&amp;gt;&amp;lt;/iframe&amp;gt;&amp;lt;/pre&amp;gt;&lt;br /&gt;
* '''In Chrome:''' &amp;lt;pre&amp;gt;&amp;lt;iframe src=&amp;quot;http://www.victim.com&amp;quot; sandbox&amp;gt;&amp;lt;/iframe&amp;gt;&amp;lt;/pre&amp;gt;&lt;br /&gt;
*''' In Firefox and IE:''' Activate designMode in parent page.&lt;br /&gt;
&lt;br /&gt;
== Other Cheatsheets ==&lt;br /&gt;
&lt;br /&gt;
{{Cheatsheet_Navigation_Body}}&lt;br /&gt;
&lt;br /&gt;
[[Category:Cheatsheets]]&lt;/div&gt;</summary>
		<author><name>Tom Parker</name></author>	</entry>

	<entry>
		<id>https://wiki.owasp.org/index.php?title=Clickjacking_Defense_Cheat_Sheet&amp;diff=189522</id>
		<title>Clickjacking Defense Cheat Sheet</title>
		<link rel="alternate" type="text/html" href="https://wiki.owasp.org/index.php?title=Clickjacking_Defense_Cheat_Sheet&amp;diff=189522"/>
				<updated>2015-02-12T01:45:12Z</updated>
		
		<summary type="html">&lt;p&gt;Tom Parker: moved new limitations section to existing limitations section&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&amp;lt;div style=&amp;quot;width:100%;height:160px;border:0,margin:0;overflow: hidden;&amp;quot;&amp;gt;[[File:Cheatsheets-header.jpg|link=]]&amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;br/&amp;gt;Last revision (mm/dd/yy): '''{{REVISIONMONTH}}/{{REVISIONDAY}}/{{REVISIONYEAR}}''' &lt;br /&gt;
= Introduction  =&lt;br /&gt;
 __TOC__{{TOC hidden}}&lt;br /&gt;
&lt;br /&gt;
This cheat sheet is focused on providing developer guidance on [[Clickjacking|Clickjack/UI Redress]] attack prevention.&lt;br /&gt;
&lt;br /&gt;
The most popular way to defend against Clickjacking is to include some sort of &amp;quot;frame-breaking&amp;quot; functionality which prevents other web pages from framing the site you wish to defend. This cheat sheet will discuss two methods of implementing frame-breaking: first is X-Frame-Options headers (used if the browser supports the functionality); and second is javascript frame-breaking code.&lt;br /&gt;
&lt;br /&gt;
= Defending with X-Frame-Options Response Headers =&lt;br /&gt;
&lt;br /&gt;
The X-Frame-Options HTTP response header can be used to indicate whether or not a browser should be allowed to render a page in a &amp;amp;lt;frame&amp;amp;gt; or &amp;amp;lt;iframe&amp;amp;gt;. Sites can use this to avoid Clickjacking attacks, by ensuring that their content is not embedded into other sites.&lt;br /&gt;
&lt;br /&gt;
=== X-Frame-Options Header Types  ===&lt;br /&gt;
&lt;br /&gt;
There are three possible values for the X-Frame-Options header:&lt;br /&gt;
* &amp;lt;b&amp;gt;DENY&amp;lt;/b&amp;gt;, which prevents any domain from framing the content.&lt;br /&gt;
* &amp;lt;b&amp;gt;SAMEORIGIN&amp;lt;/b&amp;gt;, which only allows the current site to frame the content.&lt;br /&gt;
* &amp;lt;b&amp;gt;ALLOW-FROM uri&amp;lt;/b&amp;gt;, which permits the specified 'uri' to frame this page. (e.g., ALLOW-FROM http&amp;amp;#58;//www.example.com) '''Check Limitations Below''' this will fail open if the browser does not support it.&lt;br /&gt;
&lt;br /&gt;
=== Browser Support ===&lt;br /&gt;
&lt;br /&gt;
The following browsers support X-Frame-Options headers.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;table border=&amp;quot;1&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt; &amp;lt;th&amp;gt;Browser&amp;lt;/th&amp;gt; &amp;lt;th&amp;gt;DENY/SAMEORIGIN Support Introduced&amp;lt;/th&amp;gt; &amp;lt;th&amp;gt;ALLOW-FROM Support Introduced&amp;lt;/th&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt; &amp;lt;td&amp;gt;Chrome&amp;lt;/td&amp;gt; &amp;lt;td&amp;gt;[http://blog.chromium.org/2010/01/security-in-depth-new-security-features.html 4.1.249.1042]&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;td&amp;gt;[https://code.google.com/p/chromium/issues/detail?id=129139 Not supported/Bug reported]&amp;lt;/td&amp;gt; &amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt; &amp;lt;td&amp;gt;Firefox (Gecko)&amp;lt;/td&amp;gt; &amp;lt;td&amp;gt;[https://developer.mozilla.org/en-US/docs/HTTP/X-Frame-Options?redirectlocale=en-US&amp;amp;redirectslug=The_X-FRAME-OPTIONS_response_header 3.6.9 (1.9.2.9)]&amp;lt;/td&amp;gt; &amp;lt;td&amp;gt;[https://bugzilla.mozilla.org/show_bug.cgi?id=690168 18.0]&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt; &amp;lt;td&amp;gt;Internet Explorer&amp;lt;/td&amp;gt; &amp;lt;td&amp;gt;[http://blogs.msdn.com/b/ie/archive/2009/01/27/ie8-security-part-vii-clickjacking-defenses.aspx 8.0]&amp;lt;/td&amp;gt; &amp;lt;td&amp;gt;[http://erlend.oftedal.no/blog/tools/xframeoptions/ 9.0]&amp;lt;/td&amp;gt; &amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt; &amp;lt;td&amp;gt;Opera&amp;lt;/td&amp;gt; &amp;lt;td&amp;gt;[http://www.opera.com/docs/specs/presto26/#network 10.50]&amp;lt;/td&amp;gt; &amp;lt;td&amp;gt;&amp;lt;/td&amp;gt; &amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt; &amp;lt;td&amp;gt;Safari&amp;lt;/td&amp;gt; &amp;lt;td&amp;gt;[http://www.zdnet.com/blog/security/apple-safari-jumbo-patch-50-vulnerabilities-fixed/3541 4.0]&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;[https://bugs.webkit.org/show_bug.cgi?id=94836 Not supported/Bug reported]&amp;lt;/td&amp;gt; &amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;/table&amp;gt;&lt;br /&gt;
&lt;br /&gt;
References: &lt;br /&gt;
* [https://developer.mozilla.org/en-US/docs/HTTP/X-Frame-Options Mozilla Developer Network]&amp;lt;br&amp;gt;&lt;br /&gt;
* [http://datatracker.ietf.org/doc/draft-ietf-websec-x-frame-options/ IETF Draft]&lt;br /&gt;
* [http://erlend.oftedal.no/blog/tools/xframeoptions/ X-Frame-Options Compatibility Test] - Check this for the LATEST browser support info for the X-Frame-Options header&lt;br /&gt;
&lt;br /&gt;
=== Implementation ===&lt;br /&gt;
&lt;br /&gt;
To implement this protection, you need to add the X-Frame-Options HTTP Response header to any page that you want to protect from being clickjacked via framebusting. One way to do this is to add the HTTP Response Header manually to every page.  A possibly simpler way is to implement a filter that automatically adds the header to every page.&lt;br /&gt;
&lt;br /&gt;
OWASP has an [[ClickjackFilter for Java EE|article and some code]] that provides all the details for implementing this in the Java EE environment.&lt;br /&gt;
&lt;br /&gt;
The SDL blog has posted an [http://blogs.msdn.com/sdl/archive/2009/02/05/clickjacking-defense-in-ie8.aspx article] covering how to implement this in a .NET environment.&lt;br /&gt;
&lt;br /&gt;
=== Common Defense Mistakes ===&lt;br /&gt;
Meta-tags that attempt to apply the X-Frame-Options directive DO NOT WORK. For example, &amp;lt;meta http-equiv=&amp;quot;X-Frame-Options&amp;quot; content=&amp;quot;deny&amp;quot;&amp;gt;) will not work. You must apply the X-FRAME-OPTIONS directive as HTTP Response Header as described above.&lt;br /&gt;
&lt;br /&gt;
=== Limitations ===&lt;br /&gt;
&lt;br /&gt;
* '''Per-page policy specification''' The policy needs to be specified for every page, which can complicate deployment. Providing the ability to enforce it for the entire site, at login time for instance, could simplify adoption.&lt;br /&gt;
* '''Problems with multi-domain sites''' The current implementation does not allow the webmaster to provide a whitelist of domains that are allowed to frame the page. While whitelisting can be dangerous, in some cases a webmaster might have no choice but to use more than one hostname.&lt;br /&gt;
* '''ALLOW-FROM browser support''' The ALLOW-FROM option is a relatively recent addition (circa 2012) and may not be supported by all browsers yet.  BE CAREFUL ABOUT DEPENDING ON ALLOW-FROM. If you apply it and the browser does not support it, then you will have NO clickjacking defense in place.&lt;br /&gt;
* '''Multiple options not supported''' There is no way to allow the current site and a 3rd party site to frame the same response -- browsers only honour one X-Frame-Options header and only one value on that header.&lt;br /&gt;
* '''Nested Frames don't work with ALLOW-FROM''' In the following situation, the http://framed.invalid/child frame does not load because ALLOW-FROM applies to the top-level browsing context, not that of the immediate parent:&lt;br /&gt;
 +-//friendlysite.invalid-----------------------+&lt;br /&gt;
 |                                              |&lt;br /&gt;
 | +-//framed.invalid/parent------------------+ |&lt;br /&gt;
 | |                                          | |&lt;br /&gt;
 | | ALLOW-FROM http://friendlysite.invalid | |&lt;br /&gt;
 | |                                          | |&lt;br /&gt;
 | | +-//framed.invalid/child--------+        | |&lt;br /&gt;
 | | |                               |        | |&lt;br /&gt;
 | | | SAMEORIGIN                    |        | |&lt;br /&gt;
 | | |                               |        | |&lt;br /&gt;
 | | +-------------------------------+        | |&lt;br /&gt;
 | +------------------------------------------+ |&lt;br /&gt;
 +----------------------------------------------+&lt;br /&gt;
* '''X-Frame-Options Deprecated''' While the X-Frame-Options header is supported by the major browsers, it was never standardized and has been deprecated in favour of the frame-ancestors directive from the CSP Level 2 specification.&lt;br /&gt;
* '''Proxies''' Web proxies are notorious for adding and stripping headers. If a web proxy strips the X-Frame-Options header then the site loses its framing protection.&lt;br /&gt;
&lt;br /&gt;
= Best-for-now Legacy Browser Frame Breaking Script =&lt;br /&gt;
&lt;br /&gt;
One way to defend against clickjacking is to include a &amp;quot;frame-breaker&amp;quot; script&lt;br /&gt;
in each page that should not be framed. The following methodology will prevent&lt;br /&gt;
a webpage from being framed even in legacy browsers, that do not support the&lt;br /&gt;
X-Frame-Options-Header.&lt;br /&gt;
&lt;br /&gt;
In the document HEAD element, add the following:&lt;br /&gt;
&lt;br /&gt;
First apply an ID to the style element itself:&lt;br /&gt;
&lt;br /&gt;
 &amp;amp;lt;style id=&amp;amp;quot;antiClickjack&amp;amp;quot;&amp;amp;gt;body{display:none !important;}&amp;amp;lt;/style&amp;amp;gt;&lt;br /&gt;
&lt;br /&gt;
And then delete that style by its ID immediately after in the script:&lt;br /&gt;
&lt;br /&gt;
 &amp;amp;lt;script type=&amp;amp;quot;text/javascript&amp;amp;quot;&amp;amp;gt;&lt;br /&gt;
    if (self === top) {&lt;br /&gt;
        var antiClickjack = document.getElementById(&amp;amp;quot;antiClickjack&amp;amp;quot;);&lt;br /&gt;
        antiClickjack.parentNode.removeChild(antiClickjack);&lt;br /&gt;
    } else {&lt;br /&gt;
        top.location = self.location;&lt;br /&gt;
    }&lt;br /&gt;
 &amp;amp;lt;/script&amp;amp;gt;&lt;br /&gt;
&lt;br /&gt;
This way, everything can be in the document HEAD and you only need one method/taglib in your API.&lt;br /&gt;
&lt;br /&gt;
Reference: [https://www.codemagi.com/blog/post/194 https://www.codemagi.com/blog/post/194]&lt;br /&gt;
&lt;br /&gt;
= window.confirm() Protection =&lt;br /&gt;
The use of x-frame-options or a frame-breaking script is a more fail-safe method of clickjacking protection.  However, in scenarios where content must be frameable, then a window.confirm() can be used to help mitigate Clickjacking by informing the user of the action they are about to perform.&lt;br /&gt;
&lt;br /&gt;
Invoking window.confirm() will display a popup that cannot be framed.  If the window.confirm() originates from within an iframe with a different domain than the parent, then the dialog box will display what domain the window.confirm() originated from.  In this scenario the browser is displaying the origin of the dialog box to help mitigate Clickjacking attacks.  It should be noted that Internet Explorer is the only known browser that does not display the domain that the window.confirm() dialog box originated from,  to address this issue with Internet Explorer insure that the message within the dialog box contains contextual information about the type of action being performed.  For example:&lt;br /&gt;
&lt;br /&gt;
 &amp;amp;lt;script type=&amp;amp;quot;text/javascript&amp;amp;quot;&amp;amp;gt;&lt;br /&gt;
    var action_confirm = window.confirm(&amp;quot;Are you sure you want to delete your youtube account?&amp;quot;)&lt;br /&gt;
    if (action_confirm) {&lt;br /&gt;
        //... perform action&lt;br /&gt;
    } else {&lt;br /&gt;
        //...  The user does not want to perform the requested action.&lt;br /&gt;
    }&lt;br /&gt;
 &amp;amp;lt;/script&amp;amp;gt;&lt;br /&gt;
&lt;br /&gt;
= Non-Working Scripts =&lt;br /&gt;
Consider the following snippet which is '''NOT recommended''' for defending&lt;br /&gt;
against clickjacking:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&amp;lt;script&amp;gt;if (top!=self) top.location.href=self.location.href&amp;lt;/script&amp;gt;&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This simple frame breaking script attempts to prevent the page from being incorporated into a frame or iframe by forcing the parent window to load the current frame's URL. Unfortunately, multiple ways of defeating this type of script have been made public. We outline some here.&lt;br /&gt;
&lt;br /&gt;
== Double Framing ==&lt;br /&gt;
Some frame busting techniques navigate to the correct page by assigning a value to parent.location. This works well if the victim page is framed by a single page. However, if the attacker encloses the victim in one frame inside another (a double frame), then accessing parent.location becomes a security violation in all popular browsers, due to the '''descendant frame navigation policy'''. This security violation disables the counter-action navigation.&lt;br /&gt;
&lt;br /&gt;
'''Victim frame busting code:'''&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
if(top.location!=self.locaton) {&lt;br /&gt;
  parent.location = self.location;&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
'''Attacker top frame:'''&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;lt;iframe src=&amp;quot;attacker2.html&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
'''Attacker sub-frame:'''&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;lt;iframe src=&amp;quot;http://www.victim.com&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== The onBeforeUnload Event ==&lt;br /&gt;
A user can manually cancel any navigation request submitted by a framed page. To exploit this, the framing page registers an onBeforeUnload handler which is called whenever the framing page is about to be unloaded due to navigation. The handler function returns a string that becomes part of a prompt displayed to the user. Say the attacker wants to frame PayPal. He registers an unload handler function that returns the string &amp;quot;Do you want to exit PayPal?&amp;quot;. When this string is displayed to the user is likely to cancel the navigation, defeating PayPal's frame busting attempt.&lt;br /&gt;
&lt;br /&gt;
The attacker mounts this attack by registering an unload event on the top page using the&lt;br /&gt;
following code:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;lt;script&amp;gt;&lt;br /&gt;
window.onbeforeunload = function()&lt;br /&gt;
{&lt;br /&gt;
  return &amp;quot;Asking the user nicely&amp;quot;;&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/script&amp;gt;&lt;br /&gt;
&amp;lt;iframe src=&amp;quot;http://www.paypal.com&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
PayPal's frame busting code will generate a BeforeUnload event activating our function and prompting the user to cancel the navigation event.&lt;br /&gt;
&lt;br /&gt;
== No-Content Flushing ==&lt;br /&gt;
While the previous attack requires user interaction, the same attack can be done without prompting the user. Most browsers (IE7, IE8, Google Chrome, and Firefox) enable an attacker to automatically cancel the incoming navigation request in an onBeforeUnload event handler by repeatedly submitting a navigation request to a site responding with \204 - No Content.&amp;quot; Navigating to a No Content site is effectively a NOP, but flushes the request pipeline, thus canceling the original navigation request. Here is sample code to do this:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
var preventbust = 0&lt;br /&gt;
window.onbeforeunload = function() { killbust++ }&lt;br /&gt;
setInterval( function() {&lt;br /&gt;
  if(killbust &amp;gt; 0){&lt;br /&gt;
  killbust = 2;&lt;br /&gt;
  window.top.location = 'http://nocontent204.com'&lt;br /&gt;
  }&lt;br /&gt;
}, 1);&lt;br /&gt;
&amp;lt;iframe src=&amp;quot;http://www.victim.com&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Exploiting XSS filters ==&lt;br /&gt;
IE8 and Google Chrome introduced reflective XSS filters that help protect web pages from certain types of XSS attacks. Nava and Lindsay (at Blackhat) observed that these filters can be used to circumvent frame busting code. The IE8 XSS filter compares given request parameters to a set of regular expressions in order to look for obvious attempts at cross-site scripting. Using &amp;quot;induced false positives&amp;quot;, the filter can be used to disable selected scripts. By matching the beginning of any script tag in the request parameters, the XSS filter will disable all inline scripts within the page, including frame busting scripts. External scripts can also be targeted by matching an external include, effectively disabling all external scripts. Since subsets of the JavaScript loaded is still functional (inline or external) and cookies are still available, this attack is effective for clickjacking.&lt;br /&gt;
&lt;br /&gt;
'''Victim frame busting code:'''&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;lt;script&amp;gt;&lt;br /&gt;
if(top != self) {&lt;br /&gt;
  top.location = self.location;&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/script&amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
'''Attacker:'''&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;lt;iframe src=&amp;quot;http://www.victim.com/?v=&amp;lt;script&amp;gt;if''&amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The XSS filter will match that parameter &amp;quot;&amp;lt;script&amp;gt;if&amp;quot; to the beginning of the frame busting script on the victim and will consequently disable all inline scripts in the victim's page, including the frame busting script. The XSSAuditor filter available for Google Chrome enables the same exploit.&lt;br /&gt;
&lt;br /&gt;
== Clobbering top.location ==&lt;br /&gt;
Several modern browsers treat the location variable as a special immutable attribute across all contexts. However, this is not the case in IE7 and Safari 4.0.4 where the location variable can be redefined.&lt;br /&gt;
&lt;br /&gt;
'''IE7'''&lt;br /&gt;
Once the framing page redefines location, any frame busting code in a subframe that tries to read top.location will commit a security violation by trying to read a local variable in another domain. Similarly, any attempt to navigate by assigning top.location will fail.&lt;br /&gt;
&lt;br /&gt;
'''Victim frame busting code:'''&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
if(top.location != self.location) {&lt;br /&gt;
  top.location = self.location;&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
'''Attacker:'''&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;lt;script&amp;gt; var location = &amp;quot;clobbered&amp;quot;;&lt;br /&gt;
&amp;lt;/script&amp;gt;&lt;br /&gt;
&amp;lt;iframe src=&amp;quot;http://www.victim.com&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;/iframe&amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
'''Safari 4.0.4'''&lt;br /&gt;
&lt;br /&gt;
We observed that although location is kept immutable in most circumstances, when a custom location setter is defined via defineSetter (through window) the object location becomes undefined. The framing page simply does:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;lt;script&amp;gt;&lt;br /&gt;
  window.defineSetter(&amp;quot;location&amp;quot; , function(){});&lt;br /&gt;
&amp;lt;/script&amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
Now any attempt to read or navigate the top frame's location will fail.&lt;br /&gt;
&lt;br /&gt;
== Restricted zones ==&lt;br /&gt;
&lt;br /&gt;
Most frame busting relies on JavaScript in the framed page to detect framing and bust itself out. If JavaScript is disabled in the context of the subframe, the frame busting code will not run. There are unfortunately several ways of restricting JavaScript in a subframe:&lt;br /&gt;
&lt;br /&gt;
* '''In IE 8:''' &amp;lt;pre&amp;gt;&amp;lt;iframe src=&amp;quot;http://www.victim.com&amp;quot; security=&amp;quot;restricted&amp;quot;&amp;gt;&amp;lt;/iframe&amp;gt;&amp;lt;/pre&amp;gt;&lt;br /&gt;
* '''In Chrome:''' &amp;lt;pre&amp;gt;&amp;lt;iframe src=&amp;quot;http://www.victim.com&amp;quot; sandbox&amp;gt;&amp;lt;/iframe&amp;gt;&amp;lt;/pre&amp;gt;&lt;br /&gt;
*''' In Firefox and IE:''' Activate designMode in parent page.&lt;br /&gt;
&lt;br /&gt;
== Other Cheatsheets ==&lt;br /&gt;
&lt;br /&gt;
{{Cheatsheet_Navigation_Body}}&lt;br /&gt;
&lt;br /&gt;
[[Category:Cheatsheets]]&lt;/div&gt;</summary>
		<author><name>Tom Parker</name></author>	</entry>

	<entry>
		<id>https://wiki.owasp.org/index.php?title=Clickjacking_Defense_Cheat_Sheet&amp;diff=189521</id>
		<title>Clickjacking Defense Cheat Sheet</title>
		<link rel="alternate" type="text/html" href="https://wiki.owasp.org/index.php?title=Clickjacking_Defense_Cheat_Sheet&amp;diff=189521"/>
				<updated>2015-02-12T01:25:11Z</updated>
		
		<summary type="html">&lt;p&gt;Tom Parker: Added limitations of X-Frame-Options header&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&amp;lt;div style=&amp;quot;width:100%;height:160px;border:0,margin:0;overflow: hidden;&amp;quot;&amp;gt;[[File:Cheatsheets-header.jpg|link=]]&amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;br/&amp;gt;Last revision (mm/dd/yy): '''{{REVISIONMONTH}}/{{REVISIONDAY}}/{{REVISIONYEAR}}''' &lt;br /&gt;
= Introduction  =&lt;br /&gt;
 __TOC__{{TOC hidden}}&lt;br /&gt;
&lt;br /&gt;
This cheat sheet is focused on providing developer guidance on [[Clickjacking|Clickjack/UI Redress]] attack prevention.&lt;br /&gt;
&lt;br /&gt;
The most popular way to defend against Clickjacking is to include some sort of &amp;quot;frame-breaking&amp;quot; functionality which prevents other web pages from framing the site you wish to defend. This cheat sheet will discuss two methods of implementing frame-breaking: first is X-Frame-Options headers (used if the browser supports the functionality); and second is javascript frame-breaking code.&lt;br /&gt;
&lt;br /&gt;
= Defending with X-Frame-Options Response Headers =&lt;br /&gt;
&lt;br /&gt;
The X-Frame-Options HTTP response header can be used to indicate whether or not a browser should be allowed to render a page in a &amp;amp;lt;frame&amp;amp;gt; or &amp;amp;lt;iframe&amp;amp;gt;. Sites can use this to avoid Clickjacking attacks, by ensuring that their content is not embedded into other sites.&lt;br /&gt;
&lt;br /&gt;
=== X-Frame-Options Header Types  ===&lt;br /&gt;
&lt;br /&gt;
There are three possible values for the X-Frame-Options header:&lt;br /&gt;
* &amp;lt;b&amp;gt;DENY&amp;lt;/b&amp;gt;, which prevents any domain from framing the content.&lt;br /&gt;
* &amp;lt;b&amp;gt;SAMEORIGIN&amp;lt;/b&amp;gt;, which only allows the current site to frame the content.&lt;br /&gt;
* &amp;lt;b&amp;gt;ALLOW-FROM uri&amp;lt;/b&amp;gt;, which permits the specified 'uri' to frame this page. (e.g., ALLOW-FROM http&amp;amp;#58;//www.example.com)&lt;br /&gt;
&lt;br /&gt;
=== Limitations ===&lt;br /&gt;
* The ALLOW-FROM option is a relatively recent addition (circa 2012) and may not be supported by all browsers yet.  BE CAREFUL ABOUT DEPENDING ON ALLOW-FROM. If you apply it and the browser does not support it, then you will have NO clickjacking defense in place.&lt;br /&gt;
* There is no way to allow the current site and a 3rd party site to frame the same response -- browsers only honour one X-Frame-Options header and only one value on that header.&lt;br /&gt;
* In the following situation, the http://framed.invalid/child frame does not load because ALLOW-FROM applies to the top-level browsing context, not that of the immediate parent.&lt;br /&gt;
 +-//friendlysite.invalid-----------------------+&lt;br /&gt;
 |                                              |&lt;br /&gt;
 | +-//framed.invalid/parent------------------+ |&lt;br /&gt;
 | |                                          | |&lt;br /&gt;
 | | ALLOW-FROM http://friendlysite.invalid | |&lt;br /&gt;
 | |                                          | |&lt;br /&gt;
 | | +-//framed.invalid/child--------+        | |&lt;br /&gt;
 | | |                               |        | |&lt;br /&gt;
 | | | SAMEORIGIN                    |        | |&lt;br /&gt;
 | | |                               |        | |&lt;br /&gt;
 | | +-------------------------------+        | |&lt;br /&gt;
 | +------------------------------------------+ |&lt;br /&gt;
 +----------------------------------------------+&lt;br /&gt;
* While the X-Frame-Options header is supported by the major browsers, it was never standardized and has been deprecated in favour of the frame-ancestors directive from the CSP Level 2 specification.&lt;br /&gt;
&lt;br /&gt;
=== Browser Support ===&lt;br /&gt;
&lt;br /&gt;
The following browsers support X-Frame-Options headers.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;table border=&amp;quot;1&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt; &amp;lt;th&amp;gt;Browser&amp;lt;/th&amp;gt; &amp;lt;th&amp;gt;DENY/SAMEORIGIN Support Introduced&amp;lt;/th&amp;gt; &amp;lt;th&amp;gt;ALLOW-FROM Support Introduced&amp;lt;/th&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt; &amp;lt;td&amp;gt;Chrome&amp;lt;/td&amp;gt; &amp;lt;td&amp;gt;[http://blog.chromium.org/2010/01/security-in-depth-new-security-features.html 4.1.249.1042]&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;td&amp;gt;[https://code.google.com/p/chromium/issues/detail?id=129139 Not supported/Bug reported]&amp;lt;/td&amp;gt; &amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt; &amp;lt;td&amp;gt;Firefox (Gecko)&amp;lt;/td&amp;gt; &amp;lt;td&amp;gt;[https://developer.mozilla.org/en-US/docs/HTTP/X-Frame-Options?redirectlocale=en-US&amp;amp;redirectslug=The_X-FRAME-OPTIONS_response_header 3.6.9 (1.9.2.9)]&amp;lt;/td&amp;gt; &amp;lt;td&amp;gt;[https://bugzilla.mozilla.org/show_bug.cgi?id=690168 18.0]&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt; &amp;lt;td&amp;gt;Internet Explorer&amp;lt;/td&amp;gt; &amp;lt;td&amp;gt;[http://blogs.msdn.com/b/ie/archive/2009/01/27/ie8-security-part-vii-clickjacking-defenses.aspx 8.0]&amp;lt;/td&amp;gt; &amp;lt;td&amp;gt;[http://erlend.oftedal.no/blog/tools/xframeoptions/ 9.0]&amp;lt;/td&amp;gt; &amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt; &amp;lt;td&amp;gt;Opera&amp;lt;/td&amp;gt; &amp;lt;td&amp;gt;[http://www.opera.com/docs/specs/presto26/#network 10.50]&amp;lt;/td&amp;gt; &amp;lt;td&amp;gt;&amp;lt;/td&amp;gt; &amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt; &amp;lt;td&amp;gt;Safari&amp;lt;/td&amp;gt; &amp;lt;td&amp;gt;[http://www.zdnet.com/blog/security/apple-safari-jumbo-patch-50-vulnerabilities-fixed/3541 4.0]&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;[https://bugs.webkit.org/show_bug.cgi?id=94836 Not supported/Bug reported]&amp;lt;/td&amp;gt; &amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;/table&amp;gt;&lt;br /&gt;
&lt;br /&gt;
References: &lt;br /&gt;
* [https://developer.mozilla.org/en-US/docs/HTTP/X-Frame-Options Mozilla Developer Network]&amp;lt;br&amp;gt;&lt;br /&gt;
* [http://datatracker.ietf.org/doc/draft-ietf-websec-x-frame-options/ IETF Draft]&lt;br /&gt;
* [http://erlend.oftedal.no/blog/tools/xframeoptions/ X-Frame-Options Compatibility Test] - Check this for the LATEST browser support info for the X-Frame-Options header&lt;br /&gt;
&lt;br /&gt;
=== Implementation ===&lt;br /&gt;
&lt;br /&gt;
To implement this protection, you need to add the X-Frame-Options HTTP Response header to any page that you want to protect from being clickjacked via framebusting. One way to do this is to add the HTTP Response Header manually to every page.  A possibly simpler way is to implement a filter that automatically adds the header to every page.&lt;br /&gt;
&lt;br /&gt;
OWASP has an [[ClickjackFilter for Java EE|article and some code]] that provides all the details for implementing this in the Java EE environment.&lt;br /&gt;
&lt;br /&gt;
The SDL blog has posted an [http://blogs.msdn.com/sdl/archive/2009/02/05/clickjacking-defense-in-ie8.aspx article] covering how to implement this in a .NET environment.&lt;br /&gt;
&lt;br /&gt;
=== Common Defense Mistakes ===&lt;br /&gt;
Meta-tags that attempt to apply the X-Frame-Options directive DO NOT WORK. For example, &amp;lt;meta http-equiv=&amp;quot;X-Frame-Options&amp;quot; content=&amp;quot;deny&amp;quot;&amp;gt;) will not work. You must apply the X-FRAME-OPTIONS directive as HTTP Response Header as described above.&lt;br /&gt;
&lt;br /&gt;
=== Limitations ===&lt;br /&gt;
&lt;br /&gt;
* '''Per-page policy specification''' &lt;br /&gt;
The policy needs to be specified for every page, which can complicate deployment. Providing the ability to enforce it for the entire site, at login time for instance, could simplify adoption.&lt;br /&gt;
&lt;br /&gt;
* '''Problems with multi-domain sites'''&lt;br /&gt;
The current implementation does not allow the webmaster to provide a whitelist of domains that are allowed to frame the page. While whitelisting can be dangerous, in some cases a webmaster might have no choice but to use more than one hostname.&lt;br /&gt;
&lt;br /&gt;
* '''Proxies'''&lt;br /&gt;
Web proxies are notorious for adding and stripping headers. If a web proxy strips the X-Frame-Options header then the site loses its framing protection.&lt;br /&gt;
&lt;br /&gt;
= Best-for-now Legacy Browser Frame Breaking Script =&lt;br /&gt;
&lt;br /&gt;
One way to defend against clickjacking is to include a &amp;quot;frame-breaker&amp;quot; script&lt;br /&gt;
in each page that should not be framed. The following methodology will prevent&lt;br /&gt;
a webpage from being framed even in legacy browsers, that do not support the&lt;br /&gt;
X-Frame-Options-Header.&lt;br /&gt;
&lt;br /&gt;
In the document HEAD element, add the following:&lt;br /&gt;
&lt;br /&gt;
First apply an ID to the style element itself:&lt;br /&gt;
&lt;br /&gt;
 &amp;amp;lt;style id=&amp;amp;quot;antiClickjack&amp;amp;quot;&amp;amp;gt;body{display:none !important;}&amp;amp;lt;/style&amp;amp;gt;&lt;br /&gt;
&lt;br /&gt;
And then delete that style by its ID immediately after in the script:&lt;br /&gt;
&lt;br /&gt;
 &amp;amp;lt;script type=&amp;amp;quot;text/javascript&amp;amp;quot;&amp;amp;gt;&lt;br /&gt;
    if (self === top) {&lt;br /&gt;
        var antiClickjack = document.getElementById(&amp;amp;quot;antiClickjack&amp;amp;quot;);&lt;br /&gt;
        antiClickjack.parentNode.removeChild(antiClickjack);&lt;br /&gt;
    } else {&lt;br /&gt;
        top.location = self.location;&lt;br /&gt;
    }&lt;br /&gt;
 &amp;amp;lt;/script&amp;amp;gt;&lt;br /&gt;
&lt;br /&gt;
This way, everything can be in the document HEAD and you only need one method/taglib in your API.&lt;br /&gt;
&lt;br /&gt;
Reference: [https://www.codemagi.com/blog/post/194 https://www.codemagi.com/blog/post/194]&lt;br /&gt;
&lt;br /&gt;
= window.confirm() Protection =&lt;br /&gt;
The use of x-frame-options or a frame-breaking script is a more fail-safe method of clickjacking protection.  However, in scenarios where content must be frameable, then a window.confirm() can be used to help mitigate Clickjacking by informing the user of the action they are about to perform.&lt;br /&gt;
&lt;br /&gt;
Invoking window.confirm() will display a popup that cannot be framed.  If the window.confirm() originates from within an iframe with a different domain than the parent, then the dialog box will display what domain the window.confirm() originated from.  In this scenario the browser is displaying the origin of the dialog box to help mitigate Clickjacking attacks.  It should be noted that Internet Explorer is the only known browser that does not display the domain that the window.confirm() dialog box originated from,  to address this issue with Internet Explorer insure that the message within the dialog box contains contextual information about the type of action being performed.  For example:&lt;br /&gt;
&lt;br /&gt;
 &amp;amp;lt;script type=&amp;amp;quot;text/javascript&amp;amp;quot;&amp;amp;gt;&lt;br /&gt;
    var action_confirm = window.confirm(&amp;quot;Are you sure you want to delete your youtube account?&amp;quot;)&lt;br /&gt;
    if (action_confirm) {&lt;br /&gt;
        //... perform action&lt;br /&gt;
    } else {&lt;br /&gt;
        //...  The user does not want to perform the requested action.&lt;br /&gt;
    }&lt;br /&gt;
 &amp;amp;lt;/script&amp;amp;gt;&lt;br /&gt;
&lt;br /&gt;
= Non-Working Scripts =&lt;br /&gt;
Consider the following snippet which is '''NOT recommended''' for defending&lt;br /&gt;
against clickjacking:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&amp;lt;script&amp;gt;if (top!=self) top.location.href=self.location.href&amp;lt;/script&amp;gt;&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This simple frame breaking script attempts to prevent the page from being incorporated into a frame or iframe by forcing the parent window to load the current frame's URL. Unfortunately, multiple ways of defeating this type of script have been made public. We outline some here.&lt;br /&gt;
&lt;br /&gt;
== Double Framing ==&lt;br /&gt;
Some frame busting techniques navigate to the correct page by assigning a value to parent.location. This works well if the victim page is framed by a single page. However, if the attacker encloses the victim in one frame inside another (a double frame), then accessing parent.location becomes a security violation in all popular browsers, due to the '''descendant frame navigation policy'''. This security violation disables the counter-action navigation.&lt;br /&gt;
&lt;br /&gt;
'''Victim frame busting code:'''&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
if(top.location!=self.locaton) {&lt;br /&gt;
  parent.location = self.location;&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
'''Attacker top frame:'''&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;lt;iframe src=&amp;quot;attacker2.html&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
'''Attacker sub-frame:'''&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;lt;iframe src=&amp;quot;http://www.victim.com&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== The onBeforeUnload Event ==&lt;br /&gt;
A user can manually cancel any navigation request submitted by a framed page. To exploit this, the framing page registers an onBeforeUnload handler which is called whenever the framing page is about to be unloaded due to navigation. The handler function returns a string that becomes part of a prompt displayed to the user. Say the attacker wants to frame PayPal. He registers an unload handler function that returns the string &amp;quot;Do you want to exit PayPal?&amp;quot;. When this string is displayed to the user is likely to cancel the navigation, defeating PayPal's frame busting attempt.&lt;br /&gt;
&lt;br /&gt;
The attacker mounts this attack by registering an unload event on the top page using the&lt;br /&gt;
following code:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;lt;script&amp;gt;&lt;br /&gt;
window.onbeforeunload = function()&lt;br /&gt;
{&lt;br /&gt;
  return &amp;quot;Asking the user nicely&amp;quot;;&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/script&amp;gt;&lt;br /&gt;
&amp;lt;iframe src=&amp;quot;http://www.paypal.com&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
PayPal's frame busting code will generate a BeforeUnload event activating our function and prompting the user to cancel the navigation event.&lt;br /&gt;
&lt;br /&gt;
== No-Content Flushing ==&lt;br /&gt;
While the previous attack requires user interaction, the same attack can be done without prompting the user. Most browsers (IE7, IE8, Google Chrome, and Firefox) enable an attacker to automatically cancel the incoming navigation request in an onBeforeUnload event handler by repeatedly submitting a navigation request to a site responding with \204 - No Content.&amp;quot; Navigating to a No Content site is effectively a NOP, but flushes the request pipeline, thus canceling the original navigation request. Here is sample code to do this:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
var preventbust = 0&lt;br /&gt;
window.onbeforeunload = function() { killbust++ }&lt;br /&gt;
setInterval( function() {&lt;br /&gt;
  if(killbust &amp;gt; 0){&lt;br /&gt;
  killbust = 2;&lt;br /&gt;
  window.top.location = 'http://nocontent204.com'&lt;br /&gt;
  }&lt;br /&gt;
}, 1);&lt;br /&gt;
&amp;lt;iframe src=&amp;quot;http://www.victim.com&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Exploiting XSS filters ==&lt;br /&gt;
IE8 and Google Chrome introduced reflective XSS filters that help protect web pages from certain types of XSS attacks. Nava and Lindsay (at Blackhat) observed that these filters can be used to circumvent frame busting code. The IE8 XSS filter compares given request parameters to a set of regular expressions in order to look for obvious attempts at cross-site scripting. Using &amp;quot;induced false positives&amp;quot;, the filter can be used to disable selected scripts. By matching the beginning of any script tag in the request parameters, the XSS filter will disable all inline scripts within the page, including frame busting scripts. External scripts can also be targeted by matching an external include, effectively disabling all external scripts. Since subsets of the JavaScript loaded is still functional (inline or external) and cookies are still available, this attack is effective for clickjacking.&lt;br /&gt;
&lt;br /&gt;
'''Victim frame busting code:'''&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;lt;script&amp;gt;&lt;br /&gt;
if(top != self) {&lt;br /&gt;
  top.location = self.location;&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/script&amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
'''Attacker:'''&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;lt;iframe src=&amp;quot;http://www.victim.com/?v=&amp;lt;script&amp;gt;if''&amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The XSS filter will match that parameter &amp;quot;&amp;lt;script&amp;gt;if&amp;quot; to the beginning of the frame busting script on the victim and will consequently disable all inline scripts in the victim's page, including the frame busting script. The XSSAuditor filter available for Google Chrome enables the same exploit.&lt;br /&gt;
&lt;br /&gt;
== Clobbering top.location ==&lt;br /&gt;
Several modern browsers treat the location variable as a special immutable attribute across all contexts. However, this is not the case in IE7 and Safari 4.0.4 where the location variable can be redefined.&lt;br /&gt;
&lt;br /&gt;
'''IE7'''&lt;br /&gt;
Once the framing page redefines location, any frame busting code in a subframe that tries to read top.location will commit a security violation by trying to read a local variable in another domain. Similarly, any attempt to navigate by assigning top.location will fail.&lt;br /&gt;
&lt;br /&gt;
'''Victim frame busting code:'''&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
if(top.location != self.location) {&lt;br /&gt;
  top.location = self.location;&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
'''Attacker:'''&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;lt;script&amp;gt; var location = &amp;quot;clobbered&amp;quot;;&lt;br /&gt;
&amp;lt;/script&amp;gt;&lt;br /&gt;
&amp;lt;iframe src=&amp;quot;http://www.victim.com&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;/iframe&amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
'''Safari 4.0.4'''&lt;br /&gt;
&lt;br /&gt;
We observed that although location is kept immutable in most circumstances, when a custom location setter is defined via defineSetter (through window) the object location becomes undefined. The framing page simply does:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;lt;script&amp;gt;&lt;br /&gt;
  window.defineSetter(&amp;quot;location&amp;quot; , function(){});&lt;br /&gt;
&amp;lt;/script&amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
Now any attempt to read or navigate the top frame's location will fail.&lt;br /&gt;
&lt;br /&gt;
== Restricted zones ==&lt;br /&gt;
&lt;br /&gt;
Most frame busting relies on JavaScript in the framed page to detect framing and bust itself out. If JavaScript is disabled in the context of the subframe, the frame busting code will not run. There are unfortunately several ways of restricting JavaScript in a subframe:&lt;br /&gt;
&lt;br /&gt;
* '''In IE 8:''' &amp;lt;pre&amp;gt;&amp;lt;iframe src=&amp;quot;http://www.victim.com&amp;quot; security=&amp;quot;restricted&amp;quot;&amp;gt;&amp;lt;/iframe&amp;gt;&amp;lt;/pre&amp;gt;&lt;br /&gt;
* '''In Chrome:''' &amp;lt;pre&amp;gt;&amp;lt;iframe src=&amp;quot;http://www.victim.com&amp;quot; sandbox&amp;gt;&amp;lt;/iframe&amp;gt;&amp;lt;/pre&amp;gt;&lt;br /&gt;
*''' In Firefox and IE:''' Activate designMode in parent page.&lt;br /&gt;
&lt;br /&gt;
== Other Cheatsheets ==&lt;br /&gt;
&lt;br /&gt;
{{Cheatsheet_Navigation_Body}}&lt;br /&gt;
&lt;br /&gt;
[[Category:Cheatsheets]]&lt;/div&gt;</summary>
		<author><name>Tom Parker</name></author>	</entry>

	<entry>
		<id>https://wiki.owasp.org/index.php?title=XML_External_Entity_(XXE)_Processing&amp;diff=158488</id>
		<title>XML External Entity (XXE) Processing</title>
		<link rel="alternate" type="text/html" href="https://wiki.owasp.org/index.php?title=XML_External_Entity_(XXE)_Processing&amp;diff=158488"/>
				<updated>2013-09-15T23:30:04Z</updated>
		
		<summary type="html">&lt;p&gt;Tom Parker: fix code example to match documentation: disallow-doctype-decl should be set to true&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Template:Vulnerability}}&lt;br /&gt;
Last revision (mm/dd/yy): '''{{REVISIONMONTH}}/{{REVISIONDAY}}/{{REVISIONYEAR}}'''&lt;br /&gt;
&lt;br /&gt;
[[ASDR_TOC_Vulnerabilities|Vulnerabilities Table of Contents]]&lt;br /&gt;
&lt;br /&gt;
==Description==&lt;br /&gt;
&lt;br /&gt;
Processing of an external entity containing tainted data may lead to disclosure of confidential information and other system impacts. &lt;br /&gt;
&lt;br /&gt;
The [http://www.w3.org/TR/REC-xml/ XML 1.0 standard] defines the structure of an XML document. The standard defines a concept called an entity, which is a storage unit of some type. There exists a specific type of entity, an [http://www.w3.org/TR/REC-xml/#sec-external-ent external general parsed entity] often shortened to an '''external entity''', that can access local or remote content via a declared system identifier. The system identifier is assumed to be a URI that can be dereferenced (accessed) by the XML processor when processing the entity. The XML processor then replaces occurrences of the named external entity with the contents dereferenced by the system identifier. If the system identifier contains tainted data and the XML processor dereferences this tainted data, the XML processor may disclose confidential information normally not accessible by the application.&lt;br /&gt;
&lt;br /&gt;
Attacks can include disclosing local files, which may contain sensitive data such as passwords or private user data, using file: schemes or relative paths in the system identifier. Since the attack occurs relative to the application processing the XML document, an attacker may use this trusted application to pivot to other internal systems, possibly disclosing other internal content via http(s) requests. In some situations, an XML processor library that is vulnerable to client-side memory corruption issues may be exploited by dereferencing a malicious URI, possibly allowing arbitrary code execution under the application account. Other attacks can access local resources that may not stop returning data, possibly impacting application availability if too many threads or processes are not released.&lt;br /&gt;
&lt;br /&gt;
==Risk Factors==&lt;br /&gt;
&lt;br /&gt;
* The application parses XML documents.&lt;br /&gt;
* Tainted data is allowed within the system identifier portion of the entity, within the [http://www.w3.org/TR/REC-xml/#sec-prolog-dtd document type declaration] (DTD).&lt;br /&gt;
* The XML processor is configured to validate and process the DTD.&lt;br /&gt;
* The XML processor is configured to resolve external entities within the DTD.&lt;br /&gt;
&lt;br /&gt;
==Examples==&lt;br /&gt;
&lt;br /&gt;
The examples below are from [[Testing for XML Injection (OWASP-DV-008)]].&lt;br /&gt;
&lt;br /&gt;
===Accessing a local resource that may not return===&lt;br /&gt;
&lt;br /&gt;
 '''&amp;lt;nowiki&amp;gt;&amp;lt;?xml version=&amp;quot;1.0&amp;quot; encoding=&amp;quot;ISO-8859-1&amp;quot;?&amp;gt;&lt;br /&gt;
 &amp;lt;!DOCTYPE foo [  &lt;br /&gt;
  &amp;lt;!ELEMENT foo ANY &amp;gt;&lt;br /&gt;
  &amp;lt;!ENTITY xxe SYSTEM &amp;quot;file:///dev/random&amp;quot; &amp;gt;]&amp;gt;&amp;lt;foo&amp;gt;&amp;amp;xxe;&amp;lt;/foo&amp;gt;&amp;lt;/nowiki&amp;gt;'''&lt;br /&gt;
&lt;br /&gt;
===Disclosing /etc/passwd or other targeted files===&lt;br /&gt;
&lt;br /&gt;
 '''&amp;lt;nowiki&amp;gt;  &amp;lt;?xml version=&amp;quot;1.0&amp;quot; encoding=&amp;quot;ISO-8859-1&amp;quot;?&amp;gt;&lt;br /&gt;
 &amp;lt;!DOCTYPE foo [  &lt;br /&gt;
   &amp;lt;!ELEMENT foo ANY &amp;gt;&lt;br /&gt;
   &amp;lt;!ENTITY xxe SYSTEM &amp;quot;file:///etc/passwd&amp;quot; &amp;gt;]&amp;gt;&amp;lt;foo&amp;gt;&amp;amp;xxe;&amp;lt;/foo&amp;gt;&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;?xml version=&amp;quot;1.0&amp;quot; encoding=&amp;quot;ISO-8859-1&amp;quot;?&amp;gt;&lt;br /&gt;
 &amp;lt;!DOCTYPE foo [  &lt;br /&gt;
   &amp;lt;!ELEMENT foo ANY &amp;gt;&lt;br /&gt;
   &amp;lt;!ENTITY xxe SYSTEM &amp;quot;file:///etc/shadow&amp;quot; &amp;gt;]&amp;gt;&amp;lt;foo&amp;gt;&amp;amp;xxe;&amp;lt;/foo&amp;gt;&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;?xml version=&amp;quot;1.0&amp;quot; encoding=&amp;quot;ISO-8859-1&amp;quot;?&amp;gt;&lt;br /&gt;
 &amp;lt;!DOCTYPE foo [  &lt;br /&gt;
   &amp;lt;!ELEMENT foo ANY &amp;gt;&lt;br /&gt;
   &amp;lt;!ENTITY xxe SYSTEM &amp;quot;file:///c:/boot.ini&amp;quot; &amp;gt;]&amp;gt;&amp;lt;foo&amp;gt;&amp;amp;xxe;&amp;lt;/foo&amp;gt;&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;?xml version=&amp;quot;1.0&amp;quot; encoding=&amp;quot;ISO-8859-1&amp;quot;?&amp;gt;&lt;br /&gt;
 &amp;lt;!DOCTYPE foo [  &lt;br /&gt;
   &amp;lt;!ELEMENT foo ANY &amp;gt;&lt;br /&gt;
   &amp;lt;!ENTITY xxe SYSTEM &amp;quot;http://www.attacker.com/text.txt&amp;quot; &amp;gt;]&amp;gt;&amp;lt;foo&amp;gt;&amp;amp;xxe;&amp;lt;/foo&amp;gt;&amp;lt;/nowiki&amp;gt;'''&lt;br /&gt;
&lt;br /&gt;
==Related [[Attacks]]==&lt;br /&gt;
&lt;br /&gt;
* [[SQL Injection]]&lt;br /&gt;
* [[Blind SQL Injection]]&lt;br /&gt;
&lt;br /&gt;
==Related [[Vulnerabilities]]==&lt;br /&gt;
&lt;br /&gt;
* [[Missing XML Validation]]&lt;br /&gt;
&lt;br /&gt;
==Related [[Controls]]==&lt;br /&gt;
&lt;br /&gt;
Since the whole XML document is communicated from an untrusted client, it's not usually possible to selectively [[Input Validation|validate]] or escape tainted data within the system identifier in the DTD. Therefore, the XML processor should be configured to use a local static DTD and disallow any declared DTD included in the XML document.&lt;br /&gt;
&lt;br /&gt;
Testing ought to occur with specific implementations for any controls documented below.&lt;br /&gt;
&lt;br /&gt;
===C/C++===&lt;br /&gt;
&lt;br /&gt;
====libxml2====&lt;br /&gt;
&lt;br /&gt;
The Enum [http://xmlsoft.org/html/libxml-parser.html#xmlParserOption xmlParserOption] should not have the following options defined:&lt;br /&gt;
&lt;br /&gt;
* XML_PARSE_NOENT: Expands entities and substitutes them with replacement text&lt;br /&gt;
* XML_PARSE_DTDLOAD: Load the external DTD&lt;br /&gt;
&lt;br /&gt;
Note: Per: https://mail.gnome.org/archives/xml/2012-October/msg00045.html, starting with libxml2 version 2.9, XXE has been disabled by default as committed by the following patch: http://git.gnome.org/browse/libxml2/commit/?id=4629ee02ac649c27f9c0cf98ba017c6b5526070f.&lt;br /&gt;
&lt;br /&gt;
===Java===&lt;br /&gt;
&lt;br /&gt;
Java applications using XML libraries are particularly vulnerable to XXE because the default settings for most Java XML parsers is to have XXE enabled. To use these parsers safely, you have to explicitly disable XXE in the parser you use. The following describes how to disable XXE in the most commonly used XML parsers for Java.&lt;br /&gt;
&lt;br /&gt;
====JAXP DOM and DocumentBuilderFactory====&lt;br /&gt;
&lt;br /&gt;
The DocumentBuilderFactory [http://docs.oracle.com/javase/7/docs/api/javax/xml/parsers/DocumentBuilderFactory.html#setFeature(java.lang.String,%20boolean) setFeature] method allows a developer to control which implementation-specific XML processor features are enabled or disabled. Each XML processor implementation has its own features that govern how DTDs and external entities are processed.&lt;br /&gt;
&lt;br /&gt;
For a syntax highlighted code snippet, click [https://gist.github.com/anonymous/5599156 here].&lt;br /&gt;
&lt;br /&gt;
 '''&amp;lt;nowiki&amp;gt;import javax.xml.parsers.DocumentBuilderFactory;&lt;br /&gt;
import javax.xml.parsers.ParserConfigurationException; // catching unsupported features&lt;br /&gt;
...&lt;br /&gt;
 &lt;br /&gt;
    DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();&lt;br /&gt;
    try {&lt;br /&gt;
      // Xerces 1 - http://xerces.apache.org/xerces-j/features.html#external-general-entities&lt;br /&gt;
      // Xerces 2 - http://xerces.apache.org/xerces2-j/features.html#external-general-entities&lt;br /&gt;
      String FEATURE = &amp;quot;http://xml.org/sax/features/external-general-entities&amp;quot;;&lt;br /&gt;
      dbf.setFeature(FEATURE, false);&lt;br /&gt;
 &lt;br /&gt;
      // Xerces 2 only - http://xerces.apache.org/xerces2-j/features.html#disallow-doctype-decl&lt;br /&gt;
      FEATURE = &amp;quot;http://apache.org/xml/features/disallow-doctype-decl&amp;quot;;&lt;br /&gt;
      dbf.setFeature(FEATURE, true);&lt;br /&gt;
 &lt;br /&gt;
      // remaining parser logic&lt;br /&gt;
      ...&lt;br /&gt;
 &lt;br /&gt;
        catch (ParserConfigurationException e) {&lt;br /&gt;
            // This should catch a failed setFeature feature&lt;br /&gt;
            logger.info(&amp;quot;ParserConfigurationException was thrown. The feature '&amp;quot; +&lt;br /&gt;
                        FEATURE +&lt;br /&gt;
                        &amp;quot;' is probably not supported by your XML processor.&amp;quot;);&lt;br /&gt;
            ...&lt;br /&gt;
        }&lt;br /&gt;
        catch (SAXException e) {&lt;br /&gt;
            // On Apache, this should be thrown when disallowing DOCTYPE&lt;br /&gt;
            logger.warning(&amp;quot;A DOCTYPE was passed into the XML document&amp;quot;);&lt;br /&gt;
            ...&lt;br /&gt;
        }&lt;br /&gt;
        catch (IOException e) {&lt;br /&gt;
            // XXE that points to a file that doesn't exist&lt;br /&gt;
            logger.error(&amp;quot;IOException occurred, XXE may still possible: &amp;quot; + e.getMessage());&lt;br /&gt;
            ...&lt;br /&gt;
        }&lt;br /&gt;
&amp;lt;/nowiki&amp;gt;'''&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[http://xerces.apache.org/xerces-j/ Xerces 1] [http://xerces.apache.org/xerces-j/features.html Features]:&lt;br /&gt;
* Do not include external entities by setting [http://xerces.apache.org/xerces-j/features.html#external-general-entities this feature] to &amp;lt;code&amp;gt;false&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
[http://xerces.apache.org/xerces2-j/ Xerces 2] [http://xerces.apache.org/xerces2-j/features.html Features]:&lt;br /&gt;
* Disallow an inline DTD by setting [http://xerces.apache.org/xerces2-j/features.html#disallow-doctype-decl this feature] to &amp;lt;code&amp;gt;true&amp;lt;/code&amp;gt;.&lt;br /&gt;
* Do not include external entities by setting [http://xerces.apache.org/xerces2-j/features.html#external-general-entities  this feature] to &amp;lt;code&amp;gt;false&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
====JAXP SAX and SAXParserFactory====&lt;br /&gt;
&lt;br /&gt;
The SAXParserFactory [http://docs.oracle.com/javase/7/docs/api/javax/xml/parsers/SAXParserFactory.html#setFeature(java.lang.String,%20boolean) setFeature] method allows a developer to control which implementation-specific XML processor features are enabled or disabled. The features can either be set on the factory or the underlying XMLReader [http://docs.oracle.com/javase/7/docs/api/org/xml/sax/XMLReader.html#setFeature%28java.lang.String,%20boolean%29 setFeature] method. Each XML processor implementation has its own features that govern how DTDs and external entities are processed.&lt;br /&gt;
&lt;br /&gt;
For a syntax highlighted code snippet, click [https://gist.github.com/jonpasski/5599721 here].&lt;br /&gt;
&lt;br /&gt;
 '''&amp;lt;nowiki&amp;gt;import javax.xml.parsers.ParserConfigurationException;  // catching unsupported features&lt;br /&gt;
import javax.xml.parsers.SAXParser;&lt;br /&gt;
import javax.xml.parsers.SAXParserFactory;&lt;br /&gt;
&lt;br /&gt;
import org.xml.sax.SAXNotRecognizedException;  // catching unknown features&lt;br /&gt;
import org.xml.sax.SAXNotSupportedException;  // catching known but unsupported features&lt;br /&gt;
import org.xml.sax.XMLReader;&lt;br /&gt;
&lt;br /&gt;
...&lt;br /&gt;
&lt;br /&gt;
    SAXParserFactory spf = SAXParserFactory.newInstance();&lt;br /&gt;
    SAXParser saxParser = spf.newSAXParser();&lt;br /&gt;
    XMLReader reader = saxParser.getXMLReader();&lt;br /&gt;
&lt;br /&gt;
    try {&lt;br /&gt;
      // Xerces 1 - http://xerces.apache.org/xerces-j/features.html#external-general-entities&lt;br /&gt;
      // Xerces 2 - http://xerces.apache.org/xerces2-j/features.html#external-general-entities&lt;br /&gt;
&lt;br /&gt;
      // Using the SAXParserFactory's setFeature&lt;br /&gt;
      spf.setFeature(&amp;quot;http://xml.org/sax/features/external-general-entities&amp;quot;, false);&lt;br /&gt;
      // Using the XMLReader's setFeature&lt;br /&gt;
      reader.setFeature(&amp;quot;http://xml.org/sax/features/external-general-entities&amp;quot;, false);&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
      // Xerces 2 only - http://xerces.apache.org/xerces2-j/features.html#disallow-doctype-decl&lt;br /&gt;
      spf.setFeature(&amp;quot;http://apache.org/xml/features/disallow-doctype-decl&amp;quot;, true);&lt;br /&gt;
&lt;br /&gt;
      // remaining parser logic&lt;br /&gt;
      ...&lt;br /&gt;
&lt;br /&gt;
    } catch (ParserConfigurationException e) {&lt;br /&gt;
      // Tried an unsupported feature.&lt;br /&gt;
&lt;br /&gt;
    } catch (SAXNotRecognizedException e) {&lt;br /&gt;
      // Tried an unknown feature.&lt;br /&gt;
&lt;br /&gt;
    } catch (SAXNotSupportedException e) {&lt;br /&gt;
      // Tried a feature known to the parser but unsupported.&lt;br /&gt;
&lt;br /&gt;
    } catch ... {&lt;br /&gt;
      &lt;br /&gt;
    }&lt;br /&gt;
...&lt;br /&gt;
&amp;lt;/nowiki&amp;gt;'''&lt;br /&gt;
&lt;br /&gt;
[http://xerces.apache.org/xerces-j/ Xerces 1] [http://xerces.apache.org/xerces-j/features.html Features]:&lt;br /&gt;
* Do not include external entities by setting [http://xerces.apache.org/xerces-j/features.html#external-general-entities this feature] to &amp;lt;code&amp;gt;false&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
[http://xerces.apache.org/xerces2-j/ Xerces 2] [http://xerces.apache.org/xerces2-j/features.html Features]:&lt;br /&gt;
* Disallow an inline DTD by setting [http://xerces.apache.org/xerces2-j/features.html#disallow-doctype-decl this feature] to &amp;lt;code&amp;gt;true&amp;lt;/code&amp;gt;.&lt;br /&gt;
* Do not include external entities by setting [http://xerces.apache.org/xerces2-j/features.html#external-general-entities  this feature] to &amp;lt;code&amp;gt;false&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
====StAX and XMLInputFactory====&lt;br /&gt;
&lt;br /&gt;
The [http://en.wikipedia.org/wiki/StAX StAX] [http://docs.oracle.com/javase/7/docs/api/javax/xml/stream/XMLInputFactory.html XMLInputFactory] can allow properties and features to be set.&lt;br /&gt;
&lt;br /&gt;
Disallow Resolving of External Entities:&lt;br /&gt;
* Set the &amp;quot;javax.xml.stream.isSupportingExternalEntities&amp;quot; property to &amp;lt;code&amp;gt;false&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
===.NET===&lt;br /&gt;
&lt;br /&gt;
====.NET 3.5====&lt;br /&gt;
&lt;br /&gt;
The following information for .NET are almost direct quotes from this great article on how to prevent XXE and XML Denial of Service in .NET: http://msdn.microsoft.com/en-us/magazine/ee335713.aspx.&lt;br /&gt;
&lt;br /&gt;
In .NET Framework versions 3.5 and earlier, DTD parsing behavior is controlled by the Boolean ProhibitDtd property found in the System.Xml.XmlTextReader and System.Xml.XmlReaderSettings classes. Set this value to true to disable inline DTDs completely:&lt;br /&gt;
&lt;br /&gt;
 XmlTextReader reader = new XmlTextReader(stream);&lt;br /&gt;
 reader.ProhibitDtd = true;&lt;br /&gt;
&lt;br /&gt;
or&lt;br /&gt;
&lt;br /&gt;
 XmlReaderSettings settings = new XmlReaderSettings();&lt;br /&gt;
 settings.ProhibitDtd = true;&lt;br /&gt;
 XmlReader reader = XmlReader.Create(stream, settings);&lt;br /&gt;
&lt;br /&gt;
The default value of ProhibitDtd in XmlReaderSettings is true, but the default value of ProhibitDtd in XmlTextReader is false, which means that you have to explicitly set it to true to disable inline DTDs.&lt;br /&gt;
&lt;br /&gt;
If you need DTD parsing enabled, but need to know how to do it safely, the above referenced MSDN article has detailed instructions on how to do that too.&lt;br /&gt;
&lt;br /&gt;
====.NET 4.0====&lt;br /&gt;
&lt;br /&gt;
In .NET Framework version 4.0, DTD parsing behavior has been changed. The ProhibitDtd property has been deprecated in favor of the new DtdProcessing property, whose default value is Prohibit. This means that .NET 4.0 apps should be immune to XXE by default, if they are using an XmlReader to parse their XML.&lt;br /&gt;
&lt;br /&gt;
Setting DtdProcessing to Prohibit causes the runtime to throw an exception if a &amp;lt;!DOCTYPE&amp;gt; element is present in the XML. To set this value yourself, it looks like this:&lt;br /&gt;
&lt;br /&gt;
 XmlReaderSettings settings = new XmlReaderSettings();&lt;br /&gt;
 settings.DtdProcessing = DtdProcessing.Prohibit;&lt;br /&gt;
 XmlReader reader = XmlReader.Create(stream, settings);&lt;br /&gt;
&lt;br /&gt;
Alternatively, you can set the DtdProcessing property to Ignore, which will not throw an exception on encountering a &amp;lt;!DOCTYPE&amp;gt; element but will simply skip over it and not process it. Finally, you can set DtdProcessing to Parse if you do want to allow and process inline DTDs.&lt;br /&gt;
&lt;br /&gt;
Again, if you need to enable DTD processing, instructions on how to do so safely are described in detail in the referenced MSDN article.&lt;br /&gt;
&lt;br /&gt;
===iOS===&lt;br /&gt;
&lt;br /&gt;
====libxml2====&lt;br /&gt;
&lt;br /&gt;
iOS includes the C/C++ libxml2 library described above, so that guidance applies if you are using libxml2 directly. However, the version of libxml2 provided up through iOS6 is prior to version 2.9 of libxml2 (which protects against XXE by default).&lt;br /&gt;
&lt;br /&gt;
====NSXMLDocument====&lt;br /&gt;
&lt;br /&gt;
iOS also provides an NSXMLDocument type, which is built on top of libxml2. However, NSXMLDocument provides some additional protections against XXE that aren't available in libxml2 directly. Per the 'NSXMLDocument External Entity Restriction API' section of: http://developer.apple.com/library/ios/#releasenotes/Foundation/RN-Foundation-iOS/Foundation_iOS5.html:&lt;br /&gt;
&lt;br /&gt;
* iOS4 and earlier: All external entities are loaded by default.&lt;br /&gt;
&lt;br /&gt;
* iOS5 and later: Only entities that don't require network access are loaded. (which is safer)&lt;br /&gt;
&lt;br /&gt;
However, to completely disable XXE in an NSXMLDocument in any version of iOS you simply specify NSXMLNodeLoadExternalEntitiesNever when creating the NSXMLDocument.&lt;br /&gt;
&lt;br /&gt;
==References==&lt;br /&gt;
&lt;br /&gt;
* [http://www.securityfocus.com/archive/1/297714/2002-10-27/2002-11-02/0 Early (2002) BugTraq Article on XXE]&lt;br /&gt;
* [http://cwe.mitre.org/data/definitions/611.html CWE-611: Information Exposure Through XML External Entity Reference]&lt;br /&gt;
* [http://cwe.mitre.org/data/definitions/827.html CWE-827: Improper Control of Document Type Definition]&lt;br /&gt;
* [https://www.owasp.org/images/5/5d/XML_Exteral_Entity_Attack.pdf XML External Entity Attacks]&lt;br /&gt;
* [http://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2012-3489 PostgreSQL XXE vulnerability]&lt;br /&gt;
* [http://www.agarri.fr/kom/archives/2011/09/15/failles_de_type_xee_dans_sharepoint_et_dotnetnuke/index.html SharePoint and DotNetNuke XXE Vulnerabilities, in French]&lt;br /&gt;
* [http://msdn.microsoft.com/en-us/magazine/ee335713.aspx XML Denial of Service Attacks and Defenses (in .NET)]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Category:API_Abuse]]&lt;/div&gt;</summary>
		<author><name>Tom Parker</name></author>	</entry>

	</feed>