19.08.2015 Views

4.0

1IZ1TDd

1IZ1TDd

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

202Web Application Penetration Testing• Restricted frames with Internet Explorer: Starting fromInternet Explorer 6, a frame can have the “security” attributethat, if it is set to the value “restricted”, ensures that JavaScriptcode, ActiveX controls, and re-directs to other sites do notwork in the frame.Example:• Sandbox attribute: with HTML5 there is a new attribute called“sandbox”. It enables a set of restrictions on content loadedinto the iframe. At this moment this attribute is only compatiblewhit Chrome and Safari.Example:• Design mode: Paul Stone showed a security issue concerningthe “designMode” that can be turned on in the framing page (viadocument.designMode), disabling JavaScript in top and subframe.The design mode is currently implemented in Firefoxand IE8.onBeforeUnload eventThe onBeforeUnload event could be used to evade frame bustingcode. This event is called when the frame busting code wants todestroy the iframe by loading the URL in the whole web page andnot only in the iframe. The handler function returns a string thatis prompted to the user asking confirm if he wants to leave thepage. When this string is displayed to the user is likely to cancelthe navigation, defeating traget’s frame busting attempt.The attacker can use this attack by registering an unload eventon the top page using the following example code:www.fictitious.sitewindow.onbeforeunload = function(){return “ Do you want to leave fictitious.site?”;}The previous technique requires the user interaction but, thesame result, can be achieved without prompting the user. Todo this the attacker have to automatically cancel the incomingnavigation request in an onBeforeUnload event handler by repeatedlysubmitting (for example every millisecond) a navigationrequest to a web page that responds with a “HTTP/1.1 204 NoContent” header.Since with this response the browser will do nothing, the resultingof this operation is the flushing of the request pipeline, renderingthe original frame busting attempt futile.Following an example code:204 page:Attacker’s page:var prevent_bust = 0;window.onbeforeunload = function() {prevent_bust++;};setInterval(function() {if (prevent_bust > 0) {prevent_bust -= 2;window.top.location =“http: /attacker.site/204.php”;}}, 1);XSS FilterStarting from Google Chrome <strong>4.0</strong> and from IE8 there were introducedXSS filters to protect users from reflected XSS attacks. Navaand Lindsay have observed that these kind of filters can be used todeactivate frame busting code by faking it as malicious code.• IE8 XSS filter: this filter has visibility into all requests andresponses parameters flowing through the web browser andit compares them to a set of regular expressions in order to lookfor reflected XSS attempts. When the filter identifies a possibleXSS attacks; it disable all inline scripts within the page, includingframe busting scripts (the same thing could be done with externalscripts). For this reason an attacker could induces a false positiveby inserting the beginning of the frame busting script into a requestparameters.Example: Target web page frame busting code:if ( top != self ){top.location=self.location;}Attacker code:

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!